:root {
  --bg: #f7f9fb;
  --surface: #ffffff;
  --surface-soft: #f2f4f6;
  --surface-strong: #111827;
  --text: #191c1e;
  --muted: #434655;
  --line: #e0e3e5;
  --primary: #004ac6;
  --primary-strong: #003ea8;
  --primary-soft: #dbeafe;
  --success: #16a34a;
  --warning: #b45309;
  --danger: #ba1a1a;
  --info: #0891b2;
  --shadow: none;
  --shadow-soft: none;
  --radius: 4px;
  --sidebar-width: 256px;
  --topbar-height: 64px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  vertical-align: middle;
  font-size: 20px;
  line-height: 1;
}

.material-symbols-outlined.filled,
.stitch-nav-link.active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 20;
}

.stitch-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #fff;
}

.stitch-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 82px;
  padding: 24px 24px 20px;
}

.stitch-brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
}

.stitch-brand strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.1;
}

.stitch-brand span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.stitch-nav {
  display: grid;
  align-content: start;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 18px;
}

.stitch-sidebar-bottom {
  display: grid;
  gap: 4px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
}

.stitch-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.stitch-nav-link:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.stitch-nav-link.active {
  color: var(--primary);
  background: rgba(0, 74, 198, .07);
  border-right: 4px solid var(--primary);
  font-weight: 800;
}

.stitch-nav-link.danger {
  color: var(--danger);
}

.stitch-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-height);
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.stitch-search {
  position: relative;
  width: min(420px, 42vw);
}

.stitch-search .material-symbols-outlined {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--muted);
  transform: translateY(-50%);
  font-size: 18px;
}

.stitch-search input {
  width: 100%;
  min-height: 36px;
  padding: 8px 12px 8px 40px;
  border: 0;
  border-radius: 999px;
  outline: none;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
}

.stitch-search input:focus {
  box-shadow: 0 0 0 2px rgba(0, 74, 198, .18);
  background: #fff;
}

.stitch-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-nav {
  position: relative;
}

.toolbar-nav-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.toolbar-nav-button:hover,
.toolbar-nav-button[aria-expanded="true"] {
  border-color: rgba(0, 74, 198, .24);
  background: #edf4ff;
  color: var(--primary);
}

.toolbar-nav-button .material-symbols-outlined {
  font-size: 18px;
}

.toolbar-nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  display: grid;
  width: 260px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(15, 23, 42, .14);
}

.toolbar-nav-menu[hidden] {
  display: none;
}

.toolbar-nav-menu a {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.toolbar-nav-menu a:last-child {
  border-bottom: 0;
}

.toolbar-nav-menu a:hover {
  background: var(--surface-soft);
  color: var(--primary);
}

.toolbar-nav-menu .material-symbols-outlined {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 4px;
  background: #edf4ff;
  color: var(--primary);
  font-size: 18px;
}

.toolbar-nav-menu strong,
.toolbar-nav-menu small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-nav-menu strong {
  font-size: 13px;
  line-height: 1.3;
}

.toolbar-nav-menu small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.stitch-icon-action {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  color: var(--muted);
}

.stitch-icon-action:hover {
  background: var(--surface-soft);
  color: var(--primary);
}

.stitch-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.stitch-user strong,
.stitch-user span {
  display: block;
  text-align: right;
}

.stitch-user strong {
  color: var(--text);
  font-size: 12px;
  line-height: 1;
}

.stitch-user span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.stitch-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary);
  font-weight: 900;
}

.logout-form { display: inline-flex; margin: 0; }
.logout-form button { color: #fecaca; }
.logout-form button:hover { background: rgba(220, 38, 38, .16); border-color: rgba(248, 113, 113, .25); }

.container {
  width: auto;
  max-width: none;
  margin: 0;
  margin-left: var(--sidebar-width);
  padding: calc(var(--topbar-height) + 32px) 32px 48px;
}

.stitch-main {
  min-height: 100vh;
}

body.shared-source-page .container {
  margin-left: 0;
  padding: 24px;
}

body.shared-source-page .source-message-workbench {
  max-width: 1760px;
  margin: 0 auto;
}

h1, h2, h3 { color: #0f172a; line-height: 1.2; }
h1 { margin: 0 0 20px; font-size: 24px; letter-spacing: 0; }
h2 { margin: 28px 0 14px; font-size: 20px; letter-spacing: 0; }
h3 { margin: 0 0 10px; font-size: 18px; }

.page-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.compact-hero { padding: 0; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero-subtitle { margin: -8px 0 0; color: var(--muted); font-size: 14px; }
.hero-action,
.inline-action {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-weight: 750;
}
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 30px; }
.section-title h2 { margin: 0 0 12px; }
.metric-card .metric-label { color: var(--muted); font-size: 13px; font-weight: 800; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 18px; margin-top: 28px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.top-stats { margin-bottom: 14px; }
.secondary-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; }
.secondary-stats .metric-card { padding: 18px; }
.secondary-stats .num { font-size: clamp(24px, 3vw, 32px); }
.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; margin-top: 0; align-items: start; }
.dashboard-main, .dashboard-side { display: grid; gap: 20px; align-content: start; }
.dashboard-section { overflow: hidden; padding: 18px; }
.risk-overview-card { min-height: 260px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-action.ghost { background: #fff; }
.metric-card { min-height: 132px; }
.metric-card.priority { border-color: rgba(186, 26, 26, .24); background: #fff; }
.metric-card.priority .num { color: var(--danger); }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; }
.mini-bars, .source-rank { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 34px; align-items: center; gap: 10px; }
.bar-label { min-width: 0; }
.bar-track { display: block; height: 9px; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.bar-fill { display: block; height: 100%; min-width: 4px; border-radius: inherit; background: linear-gradient(90deg, #2563eb, #06b6d4); }
.status-fill { background: linear-gradient(90deg, #16a34a, #84cc16); }
.bar-value { color: var(--muted); font-size: 13px; font-weight: 800; text-align: right; }
.risk-feed { display: grid; gap: 10px; }
.feed-item { padding: 13px 14px; border: 1px solid var(--line); border-radius: 16px; background: #f8fafc; }
.feed-item p { margin: 7px 0; color: #334155; line-height: 1.55; }
.feed-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.rank-row { display: grid; gap: 8px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.rank-info { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rank-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-table { overflow-x: auto; }
.compact-table table { box-shadow: none; border-radius: 14px; }
.dashboard-bottom { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); gap: 20px; margin-top: 26px; align-items: start; }
.compact-list { gap: 10px; }
.compact-list .item { padding: 13px 14px; }
.recent-message-list { max-height: 520px; overflow: auto; padding-right: 4px; }
.lower-grid { align-items: start; }
.home-hero { align-items: center; }
.home-metric-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.home-metric-link:hover {
  color: inherit;
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, .26);
  box-shadow: var(--shadow);
}
.home-stat-detail {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.home-secondary-stats .metric-card { min-height: 118px; }
.home-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.order-signal-stats { margin-bottom: 18px; }
.order-signal-filters {
  align-items: center;
  margin-bottom: 18px;
}
.order-signal-list {
  display: grid;
  gap: 16px;
}
.order-signal-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
}
.order-signal-toolbar.bottom {
  margin: 16px 0 0;
}
.order-signal-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}
.order-signal-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 18px;
  align-items: start;
  padding: 18px;
}
.order-signal-main { min-width: 0; }
.order-signal-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}
.order-signal-head h2 {
  margin: 7px 0 0;
  font-size: 20px;
  letter-spacing: 0;
}
.risk-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}
.risk-critical { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }
.risk-high { color: #c2410c; background: #ffedd5; border-color: #fed7aa; }
.risk-medium-high { color: #a16207; background: #fef3c7; border-color: #fde68a; }
.risk-medium { color: #0369a1; background: #e0f2fe; border-color: #bae6fd; }
.risk-low { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
.order-signal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
}
.order-signal-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  font-weight: 750;
}
.order-signal-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.order-signal-fields div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}
.order-signal-fields dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.order-signal-fields dd {
  margin: 0;
  color: #0f172a;
  font-size: 13px;
  font-weight: 760;
  overflow-wrap: anywhere;
}
.number-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.number-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.number-chip.warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}
.order-signal-summary {
  margin: 12px 0 8px;
  color: #1e293b;
  line-height: 1.7;
}
.order-signal-warning {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  color: #9a3412;
  background: #fff7ed;
  font-size: 13px;
  line-height: 1.65;
}
.order-signal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.inline-action.send {
  border: 1px solid rgba(37, 99, 235, .18);
  background: #2563eb;
  color: #fff;
}
.inline-action.send:disabled {
  cursor: not-allowed;
  opacity: .62;
}
.inline-action.subtle {
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
}
.order-signal-evidence {
  display: grid;
  gap: 10px;
}
.order-signal-thumb {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  max-height: 280px;
}
.order-signal-thumb img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: contain;
}
.order-signal-evidence details {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  overflow: hidden;
}
.order-signal-evidence summary {
  cursor: pointer;
  padding: 10px 12px;
  color: #334155;
  font-size: 13px;
  font-weight: 850;
}
.order-signal-evidence pre {
  margin: 0;
  padding: 0 12px 12px;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
  font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.empty-state { padding: 22px; }

@media (max-width: 980px) {
  .order-signal-card { grid-template-columns: 1fr; }
  .order-signal-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .order-signal-head { display: grid; }
  .order-signal-fields { grid-template-columns: 1fr; }
  .order-signal-toolbar { align-items: flex-start; flex-direction: column; }
  .order-signal-pager { justify-content: flex-start; }
}
.home-main,
.home-side {
  display: grid;
  gap: 20px;
  min-width: 0;
}
.home-section {
  display: grid;
  gap: 14px;
}
.home-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.home-section-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: 0;
}
.home-section-head .sub { margin: 0; }
.home-section-head.compact { align-items: center; }
.home-section-head.compact h2 { margin: 0; }
.home-message-list { max-height: 680px; }
.home-message-card {
  display: grid;
  gap: 10px;
}
.home-card-head,
.home-link-row,
.home-row,
.home-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
}
.home-message-text {
  color: #1e293b;
  line-height: 1.68;
  overflow-wrap: anywhere;
  text-decoration: none;
}
.home-message-text:hover { color: var(--primary-strong); }
.home-link-row {
  justify-content: flex-start;
  color: var(--muted);
  font-size: 13px;
}
.home-moment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.home-moment-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 14px;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  text-decoration: none;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.home-moment-card:hover {
  color: inherit;
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, .28);
  background: #eff6ff;
}
.home-moment-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.home-moment-head strong {
  min-width: 0;
  overflow: hidden;
  color: #0f172a;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-moment-card p {
  display: -webkit-box;
  min-height: 48px;
  margin: 0;
  overflow: hidden;
  color: #334155;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.home-card-foot {
  justify-content: flex-start;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.home-batch-current {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid rgba(37, 99, 235, .2);
  border-left: 5px solid var(--primary);
  border-radius: 16px;
  background: linear-gradient(135deg, #f8fafc, #eff6ff);
}
.home-batch-current.status-done,
.home-batch-current.status-completed,
.home-batch-current.status-success { border-left-color: var(--success); }
.home-batch-current.status-pending,
.home-batch-current.status-processing { border-left-color: var(--warning); }
.home-batch-current.status-failed,
.home-batch-current.status-error { border-left-color: var(--danger); background: #fef2f2; }
.home-batch-current p {
  margin: 0;
  color: #334155;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.home-mini-list,
.home-status-list,
.home-source-list {
  display: grid;
  gap: 10px;
}
.home-mini-row,
.home-status-row,
.home-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  text-decoration: none;
}
.home-source-row:hover {
  color: inherit;
  border-color: rgba(37, 99, 235, .25);
  background: #eff6ff;
}
.home-mini-row div,
.home-status-row div,
.home-source-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.home-mini-row strong,
.home-status-row strong,
.home-source-row strong {
  overflow: hidden;
  color: #0f172a;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-mini-row span:not(.badge),
.home-status-row span:not(.count),
.home-source-row span:not(.count) {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-title { color: #0f172a; font-weight: 800; }
.message-card .item-title { display: block; margin-top: 6px; line-height: 1.55; }
.result-head { display: flex; justify-content: space-between; gap: 14px; }
.result-body { color: #1e293b; line-height: 1.7; }
.empty-state { text-align: center; }
.summary-cell { min-width: 280px; line-height: 1.6; }
.detail-panel { margin-bottom: 28px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.status-stack { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; min-width: 220px; }
.inline-filters { width: fit-content; margin-top: 16px; }
.ai-panel { margin: 18px 0; background: linear-gradient(135deg, #f8fafc, #eff6ff); }
.ai-panel h4 { margin: 16px 0 8px; color: #334155; }
.context-list { margin-bottom: 24px; }
mark { padding: 0 2px; border-radius: 4px; background: #fef08a; color: inherit; }
.context-media { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.wechat-message { margin-top: 10px; line-height: 1.72; white-space: pre-wrap; }
.mini-program-card,
.article-card {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.mini-program-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}
.mini-program-badge,
.article-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid rgba(37, 99, 235, .24);
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.article-badge {
  border-color: rgba(21, 128, 61, .24);
  background: #f0fdf4;
  color: #15803d;
}
.mini-program-title,
.article-title {
  margin: 0;
  color: #0f172a;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.mini-program-desc,
.article-desc,
.article-summary {
  margin: 0;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.mini-program-meta,
.mini-program-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.mini-program-meta {
  color: var(--muted);
  font-size: 12px;
}
.mini-program-meta span {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid #dbe3ee;
  border-radius: 999px;
  background: #f8fafc;
}
.mini-program-link {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid rgba(37, 99, 235, .28);
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  text-decoration: none;
}
.mini-program-link.secondary {
  border-color: #dbe3ee;
  background: #fff;
  color: #334155;
}
.mini-program-path {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.mini-program-path summary {
  cursor: pointer;
  font-weight: 800;
}
.mini-program-path p {
  margin-top: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.context-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 10px;
}
.context-actions-header { margin-top: 14px; }
.context-action-link,
.share-action-btn,
.share-copy-btn,
.share-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(148, 163, 184, .38);
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 780;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.context-action-link:hover,
.share-action-btn:hover,
.share-copy-btn:hover,
.share-open-link:hover {
  border-color: rgba(37, 99, 235, .38);
  background: #f8fafc;
  color: var(--primary-strong);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
  transform: translateY(-1px);
}
.share-action-btn.primary {
  border-color: rgba(22, 163, 74, .32);
  background: linear-gradient(135deg, #ecfdf5, #eff6ff);
  color: #166534;
}
.share-action-btn:disabled {
  cursor: wait;
  opacity: .7;
  transform: none;
  box-shadow: none;
}
.share-result {
  display: grid;
  gap: 9px;
  margin: 10px 0 12px;
  padding: 11px;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 12px;
  background: #f8fafc;
}
.share-result.active {
  border-color: rgba(22, 163, 74, .26);
  background: linear-gradient(135deg, #f0fdf4, #f8fafc);
}
.share-result.error {
  border-color: rgba(220, 38, 38, .26);
  background: #fef2f2;
  color: #991b1b;
}
.share-result-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}
.share-copy-hint {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}
.share-link-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}
.share-link-input {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.merged-message { margin-top: 12px; border: 1px solid rgba(203, 213, 225, .9); border-radius: 14px; background: #fff; overflow: hidden; }
.merged-message > details > summary { list-style: none; }
.merged-message > details > summary::-webkit-details-marker { display: none; }
.merged-summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 14px; cursor: pointer; background: linear-gradient(180deg, #f8fafc, #fff); }
.merged-icon { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px; border-radius: 999px; background: #dbeafe; color: #1d4ed8; font-size: 12px; font-weight: 800; white-space: nowrap; }
.merged-summary-main { display: grid; min-width: 0; gap: 3px; }
.merged-summary-main strong { min-width: 0; overflow: hidden; color: #0f172a; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.merged-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 12px; line-height: 1.45; }
.merged-meta span { display: inline-flex; align-items: center; min-height: 20px; padding: 1px 7px; border: 1px solid #dbe3ee; border-radius: 999px; background: #f8fafc; }
.merged-toggle { color: #64748b; font-size: 12px; font-weight: 800; white-space: nowrap; }
.merged-toggle::after { content: "展开"; }
.merged-message details[open] .merged-toggle::after { content: "收起"; }
.merged-body { display: grid; gap: 10px; padding: 0 14px 14px; border-top: 1px solid rgba(226, 232, 240, .85); background: #fff; }
.merged-list-hint { margin-top: 12px; padding: 8px 10px; border: 1px solid #dbeafe; border-radius: 8px; background: #eff6ff; color: #1d4ed8; font-size: 12px; font-weight: 700; }
.merged-record-list { display: grid; gap: 10px; max-height: min(68vh, 720px); overflow: auto; padding: 12px 4px 2px 0; scroll-padding: 12px; }
.merged-record-item { display: grid; gap: 7px; padding: 12px; border: 1px solid rgba(219, 227, 238, .9); border-radius: 10px; background: #f8fafc; }
.record-meta { display: flex; gap: 6px 10px; align-items: baseline; flex-wrap: wrap; color: var(--muted); font-size: 12px; line-height: 1.45; }
.record-meta strong { color: #334155; font-size: 12px; overflow-wrap: anywhere; }
.chat-bubble { display: inline-block; max-width: min(760px, 100%); padding: 10px 12px; border: 1px solid rgba(191, 219, 254, .9); border-radius: 10px; background: #eff6ff; color: #1e293b; line-height: 1.68; overflow-wrap: anywhere; white-space: pre-wrap; }
.record-link-list { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.record-link { display: inline-flex; align-items: center; min-height: 30px; padding: 5px 9px; border: 1px solid rgba(37, 99, 235, .24); border-radius: 8px; background: #eff6ff; color: #1d4ed8; font-size: 12px; font-weight: 800; text-decoration: none; }
.record-link:hover { border-color: rgba(37, 99, 235, .45); background: #dbeafe; }
.merged-record-media {
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, .9);
  border-radius: 10px;
  background: #fff;
}
.merged-record-media > summary {
  list-style: none;
}
.merged-record-media > summary::-webkit-details-marker {
  display: none;
}
.merged-media-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  cursor: pointer;
  background: #fff;
}
.merged-media-title {
  min-width: 0;
  color: #334155;
  font-size: 12px;
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.merged-media-toggle {
  color: #2563eb;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.merged-media-toggle::after { content: "展开图片"; }
.merged-record-media[open] .merged-media-toggle::after { content: "收起图片"; }
.merged-media-body {
  padding: 0 10px 10px;
  border-top: 1px solid rgba(226, 232, 240, .85);
}
.merged-record-media .context-media {
  margin: 0;
  padding: 10px 0 0;
  border: 0;
  background: #fff;
}
.merged-record-media .image-preview,
.merged-record-media .video-preview {
  max-width: 100%;
  max-height: min(52vh, 520px);
  object-fit: contain;
}
.merged-footer { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding-top: 2px; }
.merged-fullscreen-btn { min-height: 32px; padding: 6px 11px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; color: #1d4ed8; font-size: 13px; font-weight: 800; cursor: pointer; }
.merged-fullscreen-btn:hover { border-color: #93c5fd; background: #dbeafe; }
.merged-raw { margin: 0; color: var(--muted); font-size: 13px; }
.merged-raw summary { cursor: pointer; font-weight: 700; }
.merged-raw p { white-space: pre-wrap; overflow-wrap: anywhere; }
.merged-modal[hidden] { display: none; }
.merged-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 22px; background: rgba(15, 23, 42, .58); backdrop-filter: blur(6px); }
.merged-modal-card { display: grid; grid-template-rows: auto minmax(0, 1fr); width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 44px); overflow: hidden; border: 1px solid rgba(203, 213, 225, .9); border-radius: 14px; background: #fff; box-shadow: 0 24px 70px rgba(15,23,42,.28); }
.merged-modal-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.merged-modal-title { margin: 0; color: #0f172a; font-size: 16px; line-height: 1.35; }
.merged-modal-meta { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.merged-modal-close { min-width: 34px; min-height: 34px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #334155; cursor: pointer; font-size: 18px; line-height: 1; }
.merged-modal-body { min-height: 0; overflow: auto; padding: 14px; background: #fff; }
.merged-modal-body .merged-record-list { max-height: none; overflow: visible; padding: 0; }
body.merged-modal-open { overflow: hidden; }
.evidence-card { border-left: 4px solid rgba(37, 99, 235, .35); }
.quick-filters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.quick-filter-card { padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.86); box-shadow: var(--shadow-soft); color: var(--text); }
.quick-filter-card span { display: block; color: var(--muted); font-size: 13px; font-weight: 800; }
.quick-filter-card strong { display: block; margin-top: 6px; font-size: 28px; letter-spacing: -.04em; }
.quick-filter-card.active { border-color: rgba(37,99,235,.42); background: #eff6ff; }
.compact-filters { padding: 10px; }
.risk-event-list { display: grid; gap: 14px; }
.risk-event-card { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 18px; padding: 18px; border: 1px solid var(--line); border-left: 5px solid #cbd5e1; border-radius: 20px; background: rgba(255,255,255,.9); box-shadow: var(--shadow-soft); }
.risk-event-card.priority-P1 { border-left-color: var(--danger); }
.risk-event-card.priority-P2 { border-left-color: var(--warning); }
.risk-event-card.priority-P3 { border-left-color: var(--primary); }
.risk-event-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.risk-summary { margin: 10px 0; color: #1e293b; line-height: 1.65; }
.risk-event-side { display: grid; gap: 10px; align-content: start; padding-left: 16px; border-left: 1px solid var(--line); }
.risk-type { color: var(--muted); font-size: 13px; font-weight: 800; }
.risk-scale strong { font-size: 22px; }
.risk-scale span { color: var(--muted); font-size: 13px; }
.risk-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.disposition-card { position: sticky; top: 86px; padding: 18px; }
.disposition-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.disposition-stats div { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.disposition-stats span, .disposition-stats strong { display: block; }
.disposition-stats strong { margin-top: 4px; font-size: 22px; }
.evidence-timeline { position: relative; display: grid; gap: 14px; margin-left: 10px; }
.evidence-timeline::before { position: absolute; top: 0; bottom: 0; left: 8px; width: 2px; content: ""; background: #dbe3ee; }
.timeline-item { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; }
.timeline-dot { z-index: 1; width: 18px; height: 18px; margin-top: 18px; border: 4px solid #eff6ff; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 1px rgba(37,99,235,.22); }
.timeline-content { margin: 0; }

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.card,
.panel,
.item,
table {
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(219, 227, 238, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.card {
  position: relative;
  overflow: hidden;
  padding: 22px;
}

.card::after {
  position: absolute;
  top: -36px;
  right: -36px;
  width: 92px;
  height: 92px;
  content: "";
  border-radius: 50%;
  background: var(--primary-soft);
  opacity: .55;
}

.num {
  position: relative;
  z-index: 1;
  margin-bottom: 6px;
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 850;
  color: var(--primary);
  letter-spacing: -.04em;
}

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { padding: 20px; }
.list { display: grid; gap: 14px; }
.item { padding: 16px 18px; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.item:hover { transform: translateY(-1px); border-color: rgba(37, 99, 235, .25); box-shadow: var(--shadow); }
.item.current { border-color: var(--primary); background: #eff6ff; }

.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow-soft); }
table { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
th { color: #475569; background: #f8fafc; font-size: 13px; font-weight: 750; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(248, 250, 252, .7); }

.meta,
.sub { color: var(--muted); font-size: 13px; line-height: 1.55; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.empty { color: #94a3b8; }
.error { color: var(--danger); font-weight: 650; }

.badge,
.count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  background: #e2e8f0;
  color: #334155;
}

.count { background: #eef2ff; color: #3730a3; }
.badge.P1, .badge.failed, .badge.false_positive { background: #fee2e2; color: #991b1b; }
.badge.P2, .badge.pending { background: #fef3c7; color: #92400e; }
.badge.P3, .badge.processing { background: #dbeafe; color: #1d4ed8; }
.badge.P4 { background: #e0f2fe; color: #075985; }
.badge.done, .badge.success, .badge.confirmed { background: #dcfce7; color: #166534; }
.badge.closed, .badge.skipped { background: #e2e8f0; color: #475569; }

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 14px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(219, 227, 238, .86);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

input,
select,
textarea,
button { font: inherit; }

.filters input,
.filters select,
.login-form input,
textarea {
  min-height: 40px;
  padding: 9px 12px;
  color: var(--text);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  outline: none;
}

.filters input:focus,
.filters select:focus,
.login-form input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.filters input[name=q] { min-width: min(420px, 100%); flex: 1; }
.filters button,
.login-form button,
.save-btn {
  min-height: 40px;
  padding: 9px 16px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .24);
}

.filters button:hover,
.login-form button:hover,
.save-btn:hover { filter: brightness(.96); }

.order-signal-range {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
}

.order-signal-range-label {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.order-signal-range-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #334155;
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
}

.order-signal-range-chip:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.order-signal-range-chip.active {
  border-color: rgba(37, 99, 235, .28);
  background: #eff6ff;
  color: var(--primary);
}

body.login-page {
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(59, 130, 246, .38), transparent 26rem),
    radial-gradient(circle at 82% 12%, rgba(34, 197, 94, .22), transparent 24rem),
    radial-gradient(circle at 50% 86%, rgba(14, 165, 233, .24), transparent 28rem),
    #050816;
}

body.login-page .stitch-main {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  padding: 0;
}

.login-topbar {
  justify-content: center;
  background: transparent;
  border-bottom: 0;
  box-shadow: none;
}

.login-topbar .brand {
  color: rgba(255, 255, 255, .8);
  pointer-events: none;
}

.login-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
}

.login-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, .12) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, black 0%, transparent 72%);
  animation: gridFloat 18s linear infinite;
}

.login-orb {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  filter: blur(18px);
  opacity: .55;
  animation: orbPulse 7s ease-in-out infinite alternate;
}

.orb-a { left: 14%; top: 18%; background: rgba(37, 99, 235, .5); }
.orb-b { right: 14%; bottom: 12%; background: rgba(34, 197, 94, .34); animation-delay: -2s; }

.login-panel {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  margin: 24px auto;
  padding: 38px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(15, 23, 42, .74), rgba(15, 23, 42, .54));
  box-shadow: 0 30px 90px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .18);
  backdrop-filter: blur(22px);
  color: #fff;
}

.login-brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 18px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(37, 99, 235, .95), rgba(14, 165, 233, .72));
  box-shadow: 0 16px 36px rgba(37, 99, 235, .36);
  font-size: 24px;
  font-weight: 900;
}

.login-panel h1 { margin-bottom: 8px; color: #fff; }
.login-kicker {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 5px 10px;
  border: 1px solid rgba(147, 197, 253, .28);
  border-radius: 999px;
  color: #bfdbfe;
  background: rgba(37, 99, 235, .16);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.login-panel .sub { margin: 0 0 22px; color: rgba(226, 232, 240, .76); }
.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 8px; color: rgba(226, 232, 240, .9); font-weight: 750; }
.login-form input {
  color: #fff;
  border-color: rgba(255, 255, 255, .16);
  background: rgba(15, 23, 42, .58);
}
.login-form input::placeholder { color: rgba(148, 163, 184, .72); }
.login-form input:focus { border-color: rgba(96, 165, 250, .9); box-shadow: 0 0 0 4px rgba(59, 130, 246, .2); }
.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.captcha-question {
  min-width: 104px;
  padding: 12px 14px;
  border: 1px solid rgba(125, 211, 252, .26);
  border-radius: 14px;
  color: #e0f2fe;
  background: rgba(14, 165, 233, .14);
  text-align: center;
  font-weight: 850;
  letter-spacing: .04em;
}
.login-form button {
  width: 100%;
  min-height: 46px;
  margin-top: 8px;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4 55%, #22c55e);
  box-shadow: 0 18px 42px rgba(14, 165, 233, .28);
}
.login-note { margin: 18px 0 0; color: rgba(148, 163, 184, .8); font-size: 12px; text-align: center; }
.login-panel .error {
  padding: 10px 12px;
  border: 1px solid rgba(248, 113, 113, .45);
  border-radius: 12px;
  color: #fecaca;
  background: rgba(127, 29, 29, .34);
}

@keyframes orbPulse {
  from { transform: translate3d(0, 0, 0) scale(.92); }
  to { transform: translate3d(18px, -14px, 0) scale(1.08); }
}

@keyframes gridFloat {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(44px, 44px, 0); }
}


.rule-dashboard, .batch-dashboard { margin-bottom: 18px; }
.rule-type-filters { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.rule-create-panel { margin-bottom: 16px; }
.rule-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}
.rule-form-grid label,
.rule-fields label,
.rule-keywords { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 800; }
.rule-form-grid .wide { grid-column: span 2; }
.rule-form-grid input,
.rule-form-grid select,
.rule-form-grid textarea,
.rule-fields input,
.rule-fields select,
.rule-keywords textarea,
.rule-name-input {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  color: var(--text);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  outline: none;
}
.rule-form-grid input:focus,
.rule-form-grid select:focus,
.rule-form-grid textarea:focus,
.rule-fields input:focus,
.rule-fields select:focus,
.rule-keywords textarea:focus,
.rule-name-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.rule-form-grid button,
.rule-toggle-form button {
  min-height: 40px;
  padding: 9px 14px;
  border: 0;
  border-radius: 12px;
  background: #eff6ff;
  color: var(--primary-strong);
  font-weight: 800;
  cursor: pointer;
}
.rule-list { display: grid; gap: 14px; }
.rule-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--success);
  border-radius: 20px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-soft);
}
.rule-card.disabled-rule { border-left-color: #94a3b8; background: rgba(248, 250, 252, .88); }
.rule-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.rule-name-input { padding-left: 0; border-color: transparent; background: transparent; font-size: 18px; font-weight: 850; }
.rule-fields { display: grid; grid-template-columns: minmax(0, 1.2fr) 120px 130px; gap: 10px; margin-bottom: 12px; }
.keyword-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.rule-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.rule-toggle-form { align-self: end; }
.batch-quick-filters { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.batch-list { display: grid; gap: 14px; }
.batch-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 20px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-soft);
}
.batch-card.status-done,
.batch-card.status-completed,
.batch-card.status-success { border-left-color: var(--success); }
.batch-card.status-processing,
.batch-card.status-pending { border-left-color: var(--warning); }
.batch-card.batch-error { border-left-color: var(--danger); background: linear-gradient(135deg, rgba(255,255,255,.94), rgba(254,242,242,.9)); }
.batch-title-row { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.batch-title-row h3 { margin-bottom: 4px; overflow-wrap: anywhere; }
.batch-meta-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.batch-meta-grid div { padding: 11px 12px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.batch-meta-grid span,
.batch-meta-grid strong { display: block; }
.batch-meta-grid strong { margin-top: 4px; color: #1e293b; font-size: 14px; overflow-wrap: anywhere; }
.batch-error-box { margin-top: 14px; padding: 12px 14px; border: 1px solid rgba(220, 38, 38, .24); border-radius: 14px; background: #fef2f2; color: #991b1b; }
.batch-error-box p { margin: 6px 0 0; line-height: 1.55; overflow-wrap: anywhere; }

@media (max-width: 980px) {
  .rule-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rule-form-grid .wide { grid-column: span 2; }
  .rule-card { grid-template-columns: 1fr; }
  .batch-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .rule-type-filters, .batch-quick-filters, .rule-form-grid, .rule-fields, .batch-meta-grid { grid-template-columns: 1fr; }
  .rule-form-grid .wide { grid-column: auto; }
  .rule-card-head, .rule-card-actions, .batch-title-row { flex-direction: column; align-items: flex-start; }
  .rule-toggle-form, .rule-toggle-form button, .rule-card-actions .save-btn { width: 100%; }
}
.search-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.search-main { min-width: 0; }
.search-section-title { margin-top: 8px; }
.search-results { display: grid; gap: 14px; }
.search-result-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 5px solid rgba(37, 99, 235, .38);
  border-radius: 20px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-soft);
}
.search-result-card.has-media { border-left-color: var(--info); }
.result-kicker { margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.search-result-meta {
  display: flex;
  gap: 8px 14px;
  flex-wrap: wrap;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}
.match-snippets { display: grid; gap: 8px; margin-top: 12px; }
.match-snippets div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.match-snippets span { display: block; margin-bottom: 4px; color: var(--primary-strong); font-size: 12px; font-weight: 850; }
.match-snippets p { margin: 0; color: #334155; line-height: 1.55; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.inline-action.ghost { background: #f8fafc; color: #334155; }
.search-side { position: sticky; top: 86px; }
.search-tip-list { display: grid; gap: 10px; }
.search-tip-list div { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.search-tip-list strong, .search-tip-list span { display: block; }
.search-tip-list span { margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.search-empty { margin-top: 0; }
.item-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.item-detail-main { min-width: 0; }
.item-detail-side { position: sticky; top: 86px; display: grid; gap: 14px; }
.current-message-panel { border-color: rgba(37, 99, 235, .28); background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(239,246,255,.88)); }
.current-message-body { font-size: 16px; }
.message-timeline { margin-left: 4px; }
.current-dot { background: var(--success); box-shadow: 0 0 0 1px rgba(22, 163, 74, .24), 0 0 0 7px rgba(22, 163, 74, .10); }
.evidence-media-card { overflow: hidden; }
.evidence-media-card .image-preview, .item-media-list .image-preview { max-height: 360px; }
.item-stats { grid-template-columns: 1fr; }
.item-stats strong { overflow-wrap: anywhere; font-size: 16px; letter-spacing: -.02em; }
.item-media-list { max-height: 680px; overflow: auto; padding-right: 4px; }

@media (max-width: 980px) {
  .search-layout, .item-detail-layout { grid-template-columns: 1fr; }
  .search-side, .item-detail-side { position: static; }
}

@media (max-width: 680px) {
  .search-quick-filters { grid-template-columns: 1fr; }
  .search-result-meta, .result-actions { flex-direction: column; }
  .context-actions { align-items: stretch; }
  .context-action-link, .share-action-btn { width: 100%; }
  .share-link-row { grid-template-columns: 1fr; }
  .share-copy-btn, .share-open-link { width: 100%; }
}
.sync-panel,
.sync-category-panel { display: grid; gap: 16px; }
.sync-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px;
  border: 1px solid rgba(203, 213, 225, .8);
  border-radius: 14px;
  background: #f8fafc;
}
.sync-tabs button {
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #475569;
  font-weight: 850;
  cursor: pointer;
}
.sync-tabs button.active {
  background: #fff;
  color: var(--primary-strong);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .08);
}
.media-backfill-tabs { margin-bottom: 16px; }
.media-backfill-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  color: #475569;
  font-weight: 850;
}
.media-backfill-tabs a:hover {
  color: var(--primary-strong);
  background: rgba(255, 255, 255, .72);
}
.media-backfill-tabs a.active {
  background: #fff;
  color: var(--primary-strong);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .08);
}
.media-backfill-cards { margin-bottom: 18px; }
.media-backfill-run-panel { margin-bottom: 18px; }
.sync-tabs span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  margin-left: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
}
.sync-tabs button.active span { background: #dbeafe; color: var(--primary-strong); }
.category-manager-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.category-manager-block {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.category-manager-block label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}
.category-manager-block select {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
}
.sync-visible-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}
.sync-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.sync-search {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.sync-search input[type="search"],
.sync-search select {
  min-width: min(220px, 100%);
  min-height: 40px;
  padding: 9px 12px;
  color: var(--text);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  outline: none;
}
.sync-search input[type="search"] {
  min-width: min(360px, 100%);
}
.sync-search input[type="search"]:focus,
.sync-search select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.sync-search label { color: var(--muted); font-size: 14px; font-weight: 750; }
.sync-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sync-actions button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-weight: 750;
  cursor: pointer;
}
.sync-actions button:hover { border-color: rgba(37, 99, 235, .34); color: var(--primary-strong); background: #eff6ff; }
.save-bar {
  position: sticky;
  top: 76px;
  z-index: 12;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(37, 99, 235, .24);
  border-radius: 16px;
  background: rgba(239, 246, 255, .94);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}
.save-bar .hint { color: var(--primary-strong); font-weight: 800; }
.hero-action[disabled],
.save-btn[disabled] { opacity: .55; cursor: not-allowed; filter: grayscale(.2); }
.toast {
  display: none;
  padding: 11px 13px;
  border: 1px solid rgba(22, 163, 74, .26);
  border-radius: 14px;
  background: #dcfce7;
  color: #166534;
  font-weight: 750;
}
.toast.error-toast { border-color: rgba(220, 38, 38, .28); background: #fee2e2; color: #991b1b; }
.sync-table table { min-width: 1680px; table-layout: fixed; }
.sync-table th:first-child,
.sync-table td:first-child { width: 74px; }
.sync-table th:nth-child(2),
.sync-table td:nth-child(2) { width: 340px; text-align: left; vertical-align: middle; }
.sync-table th:nth-child(3),
.sync-table td:nth-child(3) { width: 112px; }
.sync-table th:nth-child(4),
.sync-table td:nth-child(4) { width: 300px; text-align: left; vertical-align: middle; }
.sync-table th:nth-child(5),
.sync-table td:nth-child(5) { width: 300px; text-align: left; vertical-align: middle; }
.sync-table th:nth-child(6),
.sync-table td:nth-child(6),
.sync-table th:nth-child(7),
.sync-table td:nth-child(7),
.sync-table th:nth-child(8),
.sync-table td:nth-child(8),
.sync-table th:nth-child(9),
.sync-table td:nth-child(9) { width: 72px; }
.sync-table th:nth-child(10),
.sync-table td:nth-child(10) { width: 92px; }
.sync-table th:nth-child(11),
.sync-table td:nth-child(11) { width: 168px; }
.sync-table th:not(:nth-child(2)):not(:nth-child(4)):not(:nth-child(5)),
.sync-table td:not(:nth-child(2)):not(:nth-child(4)):not(:nth-child(5)) { text-align: center; vertical-align: middle; }
.chat-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: #0f172a;
  font-weight: 750;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-name-cell { width: 340px; }
.source-name-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}
.source-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.source-message-link { display: block; text-decoration: none; }
.source-message-link:hover { color: var(--primary-strong); text-decoration: underline; text-underline-offset: 3px; }
.source-provider-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #3730a3;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}
.source-meta {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-type-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.source-type-chip.group { border-color: rgba(37, 99, 235, .24); background: #eff6ff; color: var(--primary-strong); }
.source-type-chip.contact { border-color: rgba(22, 163, 74, .24); background: #f0fdf4; color: #166534; }
.source-type-chip.other { border-color: rgba(148, 163, 184, .36); background: #f8fafc; color: #475569; }
.source-type-chip.karma { border-color: #c7d2fe; background: #eef2ff; color: #3730a3; }
.disabled-row td { color: #94a3b8; background: rgba(248, 250, 252, .58); }
.disabled-row .chat-name { color: #94a3b8; }
.sync-latest {
  min-width: 138px;
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}
.category-cell { display: grid; gap: 8px; }
.category-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.category-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.add-category-btn { min-width: 56px; }
.category-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.category-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: 6px;
  padding: 4px 7px 4px 9px;
  border: 1px solid rgba(37, 99, 235, .18);
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 750;
}
.category-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.category-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(37, 99, 235, .12);
  color: var(--primary-strong);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.category-chip-remove:hover { background: rgba(37, 99, 235, .2); }
.category-empty {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
}
.level1-select,
.level2-select,
.inline-editor input {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
}
.level1-select:focus,
.level2-select:focus,
.inline-editor input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
  outline: none;
}
.inline-editor { display: grid; gap: 6px; }
.inline-editor.hidden { display: none; }
.inline-editor button {
  width: fit-content;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-weight: 750;
  cursor: pointer;
}
.inline-editor button:hover { border-color: rgba(37, 99, 235, .34); color: var(--primary-strong); background: #eff6ff; }

.source-message-hero .hero-action { text-decoration: none; }
.source-message-stats .source-stat-time {
  position: relative;
  z-index: 1;
  margin: 7px 0 8px;
  color: #0f172a;
  font-size: 17px;
  font-weight: 850;
  line-height: 1.35;
}
.source-message-panel { display: grid; gap: 18px; }
.source-message-filters { margin-bottom: 0; }
.source-message-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.source-message-side {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 14px;
}
.side-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}
.side-section h2 {
  margin: 0 0 10px;
  color: #334155;
  font-size: 14px;
  letter-spacing: 0;
}
.side-list {
  display: grid;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
}
.side-list a,
.side-list-static {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #334155;
  text-decoration: none;
}
.side-list a:hover,
.side-list a.active {
  border-color: rgba(37, 99, 235, .24);
  background: #eff6ff;
  color: var(--primary-strong);
}
.side-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-list strong {
  color: inherit;
  font-size: 12px;
}
.source-message-main { min-width: 0; }
.source-message-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}
.source-message-card { display: grid; gap: 11px; }
.source-message-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}
.plain-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(203, 213, 225, .9);
  border-radius: 10px;
  background: #fff;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}
.plain-action:hover { border-color: rgba(37, 99, 235, .34); background: #eff6ff; }
.inline-link {
  color: var(--primary-strong);
  font-weight: 750;
  text-decoration: none;
}
.inline-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.count.warn { background: #fef3c7; color: #92400e; }
.count.muted { background: #f1f5f9; color: #64748b; }
.category-preview {
  max-width: 100%;
  overflow: hidden;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-btn {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary-strong);
  font-weight: 750;
  cursor: pointer;
}
.danger-link { color: var(--danger); }
.link-btn:hover { text-decoration: underline; }
.switch {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 24px;
  vertical-align: middle;
}
.switch input { width: 0; height: 0; opacity: 0; }
.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background .18s ease, box-shadow .18s ease;
}
.slider::before {
  position: absolute;
  left: 3px;
  bottom: 3px;
  width: 18px;
  height: 18px;
  content: "";
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 7px rgba(15, 23, 42, .24);
  transition: transform .18s ease;
}
.switch input:checked + .slider { background: linear-gradient(135deg, var(--primary), #0ea5e9); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus + .slider { box-shadow: 0 0 0 4px rgba(37, 99, 235, .14); }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.media-card {
  overflow: hidden;
  border: 1px solid rgba(219, 227, 238, .92);
  border-radius: 24px;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow-soft);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.media-card:hover { transform: translateY(-2px); border-color: rgba(37, 99, 235, .26); box-shadow: var(--shadow); }
.media-preview-frame {
  display: grid;
  place-items: center;
  min-height: 220px;
  overflow: hidden;
  background: linear-gradient(135deg, #f8fafc, #e0f2fe);
}
.media-preview-frame a { display: grid; place-items: center; width: 100%; height: 100%; }
.media-preview-frame .image-preview,
.media-preview-frame .video-preview {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #0f172a;
}
.media-player { width: min(88%, 360px); margin: 12px 0 22px; }
.media-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 112px;
  height: 112px;
  border: 1px solid rgba(37, 99, 235, .18);
  border-radius: 28px;
  background: rgba(255,255,255,.72);
  color: var(--primary-strong);
  font-weight: 850;
}
.audio-placeholder { margin-top: 24px; }
.muted-placeholder { color: #64748b; border-color: rgba(148, 163, 184, .3); background: rgba(248,250,252,.82); }
.media-card-body { display: grid; gap: 10px; padding: 16px; }
.media-card-head,
.media-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.media-type { color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.media-source { color: #0f172a; font-size: 16px; font-weight: 850; }
.media-raw {
  display: -webkit-box;
  min-height: 44px;
  margin: 0;
  overflow: hidden;
  color: #334155;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.media-recognition {
  min-height: 58px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  color: #334155;
  line-height: 1.5;
}
.media-recognition strong { display: block; margin-bottom: 3px; color: var(--primary-strong); font-size: 12px; letter-spacing: .08em; }
.media-footer { color: var(--muted); font-size: 12px; }
.media-footer .mono { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.moments-hero .hero-action { text-decoration: none; }
.moments-stats { margin-bottom: 16px; }
.moments-filters { margin-bottom: 18px; }
.moments-feed { display: grid; gap: 16px; }
.moment-card { display: grid; gap: 13px; }
.moment-card-head {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}
.moment-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #e0f2fe;
  color: #075985;
  font-size: 20px;
  font-weight: 900;
}
.moment-card h2 {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: 0;
}
.moment-card h2 a {
  color: #0f172a;
  text-decoration: none;
}
.moment-card h2 a:hover { color: var(--primary-strong); text-decoration: underline; text-underline-offset: 3px; }
.moment-content {
  color: #1e293b;
  font-size: 15px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  text-decoration: none;
  white-space: pre-wrap;
}
.moment-content:hover { color: var(--primary-strong); }
.moment-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.moment-preview-grid.count-1 { grid-template-columns: minmax(180px, 360px); }
.moment-preview-grid.count-2 { grid-template-columns: repeat(2, minmax(0, 240px)); }
.moment-preview-grid.count-3 { grid-template-columns: repeat(3, minmax(0, 210px)); }
.moment-preview-frame {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  aspect-ratio: 1 / 1;
}
.moment-preview-frame img,
.moment-preview-frame video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.moment-media-placeholder,
.moment-media-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
  font-weight: 750;
}
.moment-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.moment-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}
.moment-detail-main { min-width: 0; display: grid; gap: 18px; }
.moment-detail-side { position: sticky; top: 86px; }
.moment-detail-card { display: grid; gap: 14px; }
.moment-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.moment-detail-head h2 { margin: 0; font-size: 18px; letter-spacing: 0; }
.moment-detail-content {
  color: #1e293b;
  font-size: 16px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.moment-source-box {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  color: #334155;
}
.moment-source-box strong { color: var(--primary-strong); }
.moment-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.moment-media-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.moment-media-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.moment-media-card .image-preview,
.moment-media-card .video-preview {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 12px;
  background: #020617;
}
.moment-media-card audio { width: 100%; }
.moment-media-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.moment-comment-list {
  display: grid;
  gap: 10px;
  max-height: 720px;
  overflow: auto;
  padding-right: 3px;
}
.moment-comment {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}
.moment-comment-user {
  margin-top: 3px;
  color: #0f172a;
  font-weight: 800;
}
.moment-comment-user span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.moment-comment p {
  margin: 8px 0 0;
  color: #334155;
  line-height: 1.6;
}

.share-link-stats { margin-bottom: 18px; }
.share-link-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
}
.share-link-toolbar.bottom { margin: 16px 0 0; }
.share-link-list {
  display: grid;
  gap: 14px;
}
.share-link-card {
  padding: 18px;
}
.share-link-card-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.share-link-card-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}
.share-link-card-head h2 {
  margin: 6px 0 0;
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.share-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}
.share-status-pill.status-active {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.share-status-pill.status-expired {
  color: #475569;
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.share-status-pill.status-revoked {
  color: #b91c1c;
  background: #fee2e2;
  border-color: #fecaca;
}
.share-link-meta-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.share-link-meta-grid div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}
.share-link-meta-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}
.share-link-meta-grid strong {
  display: block;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.share-link-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.share-link-manage-input {
  min-width: 0;
  height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}
.share-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.share-link-actions form {
  margin: 0;
}
.inline-action.danger {
  border: 1px solid #fecaca;
  background: #fee2e2;
  color: #b91c1c;
}
.order-send-modal[hidden] {
  display: none;
}
.order-send-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(5px);
}
.order-send-dialog {
  width: min(460px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, .92);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}
.order-send-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}
.order-send-head h2 {
  margin: 0;
  font-size: 18px;
}
.order-send-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.order-send-close {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-size: 20px;
}
.order-send-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}
.order-send-form label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}
.order-send-form input {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
}
.order-send-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.order-send-status.success {
  color: #15803d;
}
.order-send-status.error {
  color: #b91c1c;
}
.order-send-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 680px) {
  .sync-toolbar, .sync-search, .sync-actions, .save-bar { align-items: stretch; flex-direction: column; }
  .category-manager-grid { grid-template-columns: 1fr; }
  .sync-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sync-actions { justify-content: flex-start; }
  .sync-actions button, .save-bar .save-btn { width: 100%; }
  .sync-search input[type="search"] { width: 100%; min-width: 0; }
  .save-bar { top: 10px; }
  .media-grid { grid-template-columns: 1fr; }
  .media-preview-frame { min-height: 180px; }
  .order-send-actions { align-items: stretch; flex-direction: column-reverse; }
  .order-send-actions .inline-action { justify-content: center; width: 100%; }
}

@media (max-width: 980px) {
  .topbar { position: static; align-items: flex-start; flex-direction: column; }
  nav { justify-content: flex-start; }
  .cards, .grid, .dashboard-grid, .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-layout, .dashboard-bottom, .risk-detail-layout, .source-message-layout, .moment-detail-layout, .home-dashboard { grid-template-columns: 1fr; }
  .source-message-side, .moment-detail-side { position: static; }
  .moment-media-grid { grid-template-columns: 1fr; }
  .share-link-meta-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .disposition-card { position: static; }
}

@media (max-width: 680px) {
  .container { width: min(100% - 24px, 1320px); margin-top: 18px; }
  .cards, .grid, .dashboard-grid, .chart-grid, .stat-grid, .dashboard-bottom, .quick-filters { grid-template-columns: 1fr; }
  .risk-event-card { grid-template-columns: 1fr; }
  .risk-event-side { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: 12px; }
  .page-hero, .result-head, .section-title, .detail-head { align-items: flex-start; flex-direction: column; }
  .home-section-head, .home-card-head, .home-row { align-items: flex-start; flex-direction: column; }
  .home-moment-grid { grid-template-columns: 1fr; }
  .share-link-toolbar, .share-link-card-head { align-items: flex-start; flex-direction: column; }
  .share-link-meta-grid, .share-link-url-row { grid-template-columns: 1fr; }
  .source-message-card-head, .source-message-summary { align-items: flex-start; flex-direction: column; }
  .moment-card-head { grid-template-columns: 40px minmax(0, 1fr); }
  .moment-card-head .badge { grid-column: 1 / -1; width: fit-content; }
  .moment-avatar { width: 40px; height: 40px; border-radius: 12px; font-size: 18px; }
  .moment-preview-grid,
  .moment-preview-grid.count-1,
  .moment-preview-grid.count-2,
  .moment-preview-grid.count-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .moment-detail-head, .moment-media-head { align-items: flex-start; flex-direction: column; }
  .status-stack { justify-content: flex-start; min-width: 0; }
  .merged-summary { grid-template-columns: 1fr auto; }
  .merged-icon { grid-column: 1 / -1; width: fit-content; }
  .merged-meta span { max-width: 100%; }
  .merged-record-list { max-height: 72vh; }
  .merged-footer { align-items: stretch; flex-direction: column; }
  .merged-fullscreen-btn { width: 100%; }
  .merged-modal { padding: 10px; }
  .merged-modal-card { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  h1 { font-size: 30px; }
  .filters { display: grid; }
  .filters > * { width: 100%; }
  .pager { align-items: flex-start; flex-direction: column; }
  th, td { padding: 11px 12px; }
}

/* Stitch-inspired compact order signal UI */
.order-signal-card {
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 16px;
  padding: 16px;
  border-radius: 16px;
  border-color: rgba(203, 213, 225, .8);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .055);
}

.order-signal-head {
  gap: 12px;
}

.order-signal-head h2 {
  max-width: 100%;
  margin-top: 6px;
  overflow: hidden;
  color: #0f172a;
  font-size: 18px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-signal-meta-line {
  display: flex;
  min-width: 0;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.order-signal-meta-line span {
  min-width: 0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-signal-meta-line span + span::before {
  margin-right: 6px;
  color: #cbd5e1;
  content: "/";
}

.risk-pill {
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 12px;
}

.order-signal-tags {
  flex-wrap: nowrap;
  gap: 6px;
  margin: 10px 0 12px;
  overflow: hidden;
}

.order-signal-tags span,
.order-signal-tags .signal-chip {
  max-width: 176px;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 7px;
  overflow: hidden;
  color: #475569;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-signal-tags .signal-chip.source {
  flex: 0 0 auto;
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.order-signal-tags .signal-chip.muted {
  color: #64748b;
  background: #f8fafc;
}

.order-signal-source-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.order-signal-source-grid div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.order-signal-source-grid b,
.summary-label,
.order-signal-notes span {
  display: block;
  margin-bottom: 3px;
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
}

.order-signal-source-grid span {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #172033;
  font-size: 12px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-signal-fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.order-signal-fields div {
  padding: 9px;
  border-radius: 10px;
}

.order-signal-fields dt {
  margin-bottom: 3px;
  font-size: 11px;
}

.order-signal-fields dd {
  min-height: 20px;
  font-size: 12px;
}

.number-chip-list {
  flex-wrap: nowrap;
  max-width: 100%;
  overflow: hidden;
}

.number-chip {
  max-width: 100%;
  min-height: 22px;
  padding: 3px 6px;
  border-radius: 6px;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-signal-summary-block {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.order-signal-summary {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #1e293b;
  font-size: 13px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.order-signal-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.order-signal-notes p {
  min-width: 0;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  line-height: 1.55;
}

.order-signal-actions {
  margin-top: 12px;
}

.order-signal-actions .inline-action {
  min-height: 32px;
  border-radius: 8px;
  font-size: 12px;
}

.order-signal-evidence {
  gap: 9px;
  min-width: 0;
}

.order-signal-thumb {
  position: relative;
  display: grid;
  place-items: center;
  height: 196px;
  max-height: 196px;
  border-radius: 12px;
  background: #f1f5f9;
}

.order-signal-thumb img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.order-signal-thumb span {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 7px;
  border-radius: 6px;
  color: #fff;
  background: rgba(15, 23, 42, .68);
  font-size: 11px;
  font-weight: 760;
}

.order-signal-evidence details {
  border-radius: 10px;
  background: #fff;
}

.order-signal-evidence summary {
  padding: 9px 10px;
  font-size: 12px;
}

.order-signal-evidence pre {
  max-height: 180px;
  overflow: auto;
  padding: 0 10px 10px;
  font-size: 11px;
}

@media (max-width: 1100px) {
  .order-signal-card {
    grid-template-columns: 1fr;
  }

  .order-signal-evidence {
    grid-template-columns: minmax(220px, 292px) minmax(0, 1fr);
    align-items: start;
  }
}

.karma-chip,
.badge.karma,
.search-type-chip.karma-chip {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #3730a3;
}

.status-stack.compact {
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.karma-meta-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 10px 0;
  padding: 8px 10px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.karma-meta-strip.compact {
  margin: 8px 0;
}

.karma-meta-strip > span:first-child {
  color: #3730a3;
  font-weight: 700;
}

.karma-source-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.karma-source-line span {
  color: #3730a3;
  font-weight: 700;
}

.karma-source-line a {
  color: #334155;
  text-decoration: none;
}

.karma-source-line a:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

@media (max-width: 760px) {
  .order-signal-head,
  .order-signal-source-grid,
  .order-signal-fields,
  .order-signal-notes,
  .order-signal-evidence {
    grid-template-columns: 1fr;
  }

  .order-signal-head {
    display: grid;
  }

  .order-signal-head h2 {
    white-space: normal;
  }

  .order-signal-thumb {
    height: 180px;
  }
}

/* Stitch-inspired media intelligence UI */
.media-hero {
  margin-bottom: 16px;
}

.media-stats {
  margin-bottom: 16px;
}

.media-filters {
  margin-bottom: 18px;
}

.media-grid {
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.media-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: 16px;
  border-color: rgba(203, 213, 225, .86);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .055);
}

.media-card:hover {
  transform: translateY(-1px);
}

.media-card.status-failed {
  border-color: rgba(248, 113, 113, .48);
}

.media-preview-frame {
  position: relative;
  min-height: 0;
  min-height: 220px;
  background:
    linear-gradient(135deg, rgba(248, 250, 252, .96), rgba(226, 232, 240, .78));
}

.media-preview-frame a {
  position: relative;
  overflow: hidden;
}

.media-preview-frame .image-preview,
.media-preview-frame .video-preview {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  background: #0f172a;
}

.media-preview-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  color: #fff;
  background: rgba(15, 23, 42, .68);
  font-size: 11px;
  font-weight: 760;
}

.media-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 18px;
}

.media-player {
  width: min(90%, 340px);
  margin: 10px 0 20px;
}

.media-card-body {
  gap: 9px;
  padding: 14px;
}

.media-card-head {
  justify-content: flex-start;
  gap: 8px;
}

.media-card-head .badge {
  border-radius: 7px;
}

.media-type {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #f8fafc;
  color: #475569;
  letter-spacing: 0;
  text-transform: none;
}

.media-source {
  display: block;
  color: #0f172a;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.media-meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.media-meta-grid div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.media-meta-grid b,
.media-text-block strong {
  display: block;
  margin-bottom: 3px;
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
}

.media-meta-grid span {
  display: block;
  min-width: 0;
  color: #172033;
  font-size: 12px;
  font-weight: 760;
  overflow-wrap: anywhere;
  white-space: normal;
}

.media-cache-line {
  padding: 8px 9px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.media-text-block {
  padding: 10px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.media-raw {
  min-height: 0;
  margin: 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.media-recognition {
  min-height: 74px;
  overflow: visible;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 13px;
}

.media-recognition strong {
  letter-spacing: 0;
}

.media-recognition span,
.media-recognition .empty {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.article-fulltext {
  margin-top: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.article-fulltext summary {
  padding: 9px 11px;
  cursor: pointer;
  background: #f8fafc;
  color: #334155;
  font-weight: 850;
}

.article-fulltext p {
  max-height: 420px;
  margin: 0;
  overflow: auto;
  padding: 11px 12px;
  color: #1e293b;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.article-image-links {
  display: grid;
  gap: 7px;
  max-height: 260px;
  overflow: auto;
  padding: 11px 12px;
}

.article-image-links a {
  color: #1d4ed8;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.media-footer {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  justify-content: start;
  gap: 5px;
  padding-top: 2px;
}

.media-footer .mono {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.media-empty-state {
  grid-column: 1 / -1;
}

@media (max-width: 760px) {
  .media-grid,
  .media-meta-grid {
    grid-template-columns: 1fr;
  }

  .media-card {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .media-preview-frame {
    min-height: 200px;
  }
}

/* Stitch-inspired intelligence detail UI */
.item-detail-hero {
  margin-bottom: 16px;
}

.intelligence-detail-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.intelligence-current-panel {
  border-color: rgba(37, 99, 235, .24);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(239, 246, 255, .82));
}

.intelligence-current-panel .detail-head h2,
.detail-summary-card h2,
.evidence-media-card h2,
.intelligence-context-panel .section-title h2 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0;
}

.detail-key-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 16px 0 12px;
}

.detail-key-grid div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .78);
}

.detail-key-grid dt,
.detail-side-meta span {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
}

.detail-key-grid dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #172033;
  font-size: 13px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-current-body {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.detail-current-body .wechat-message,
.detail-timeline-item .wechat-message {
  padding: 12px 13px;
  border: 1px solid rgba(191, 219, 254, .8);
  border-radius: 12px;
  background: #fff;
  color: #1e293b;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.detail-current-media {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.detail-timeline {
  position: relative;
  display: grid;
  gap: 12px;
  margin: 12px 0 0 8px;
}

.detail-timeline::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 11px;
  width: 2px;
  content: "";
  background: #dbe3ee;
}

.detail-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.detail-timeline-item:hover {
  transform: none;
  border-color: transparent;
  box-shadow: none;
}

.detail-timeline-marker {
  z-index: 1;
  width: 22px;
  height: 22px;
  margin-top: 16px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: #cbd5e1;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, .42);
}

.detail-timeline-item.current .detail-timeline-marker {
  background: #16a34a;
  box-shadow: 0 0 0 1px rgba(22, 163, 74, .28), 0 0 0 7px rgba(22, 163, 74, .10);
}

.detail-timeline-content {
  min-width: 0;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .045);
}

.detail-timeline-item.current .detail-timeline-content {
  border-color: rgba(22, 163, 74, .34);
  background: linear-gradient(135deg, #fff, #f0fdf4);
}

.detail-timeline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.detail-media-card {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.detail-media-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.detail-media-head div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.detail-media-head strong {
  color: #0f172a;
  font-size: 13px;
  line-height: 1.25;
}

.detail-media-preview {
  display: grid;
  place-items: center;
  min-height: 120px;
  overflow: hidden;
  border-radius: 10px;
  background: #0f172a;
}

.detail-media-preview.placeholder {
  background: #f1f5f9;
}

.detail-media-preview .image-preview,
.detail-media-preview .video-preview {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
}

.detail-media-preview audio {
  width: min(100%, 320px);
  margin: 18px;
}

.detail-recognition {
  display: grid;
  gap: 5px;
  max-height: 142px;
  overflow: auto;
  padding: 9px 10px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e293b;
  font-size: 12px;
  line-height: 1.55;
}

.detail-recognition strong {
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 850;
}

.detail-recognition span {
  white-space: pre-wrap;
  word-break: break-word;
}

.intelligence-detail-side {
  gap: 14px;
}

.detail-summary-card,
.evidence-media-card {
  padding: 16px;
  border-radius: 14px;
}

.detail-side-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.detail-side-stats div {
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.detail-side-stats strong,
.detail-side-stats span {
  display: block;
}

.detail-side-stats strong {
  color: #0f172a;
  font-size: 22px;
  line-height: 1.1;
}

.detail-side-stats span {
  margin-top: 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.detail-side-meta {
  display: grid;
  gap: 8px;
}

.detail-side-meta div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.detail-side-meta strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #172033;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-side-media-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
}

.detail-side-media-list .detail-media-card {
  margin-top: 0;
}

.detail-side-media-list .detail-media-preview {
  min-height: 150px;
}

.detail-side-media-list .detail-media-preview .image-preview,
.detail-side-media-list .detail-media-preview .video-preview {
  max-height: 220px;
}

.section-title.compact {
  margin-bottom: 10px;
}

@media (max-width: 1180px) {
  .intelligence-detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .intelligence-detail-side {
    position: static;
  }
}

@media (max-width: 760px) {
  .detail-key-grid,
  .detail-current-media,
  .detail-side-stats {
    grid-template-columns: 1fr;
  }

  .detail-timeline {
    margin-left: 0;
  }

  .detail-timeline::before {
    display: none;
  }

  .detail-timeline-item {
    grid-template-columns: 1fr;
  }

  .detail-timeline-marker {
    display: none;
  }

  .detail-timeline-head,
  .detail-media-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Stitch-inspired task center sync UI */
.task-center-hero {
  margin-bottom: 16px;
}

.task-center-grid {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.task-center-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 190px;
  padding: 16px;
  border-radius: 14px;
  border-color: rgba(203, 213, 225, .86);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .052);
}

.task-center-card.primary {
  border-color: rgba(37, 99, 235, .26);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(239, 246, 255, .88));
}

.task-center-card.warning {
  border-color: rgba(245, 158, 11, .28);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(255, 251, 235, .86));
}

.task-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.task-card-head h2 {
  margin: 0;
  color: #0f172a;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

.task-status-pill,
.task-card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.task-status-pill.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.task-status-pill.warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.task-card-link:hover {
  border-color: rgba(37, 99, 235, .32);
  background: #eff6ff;
  color: #1d4ed8;
}

.task-card-number {
  color: #0f172a;
  font-size: 34px;
  font-weight: 860;
  line-height: 1;
  letter-spacing: 0;
}

.task-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.task-progress-row strong {
  color: #0f172a;
}

.task-channel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.task-channel-grid div {
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.task-channel-grid strong,
.task-channel-grid span {
  display: block;
}

.task-channel-grid strong {
  color: #0f172a;
  font-size: 22px;
  line-height: 1.1;
}

.task-channel-grid span {
  margin-top: 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
}

.task-link-list {
  display: grid;
  gap: 8px;
}

.task-link-list a,
.task-card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.task-link-list a::after {
  content: "进入";
  color: #2563eb;
  font-size: 12px;
}

.task-link-list a:hover,
.task-card-action:hover {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.task-card-action {
  justify-content: center;
  cursor: pointer;
}

.task-source-stats {
  margin-bottom: 16px;
}

@media (max-width: 1180px) {
  .task-center-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .task-center-grid,
  .task-channel-grid {
    grid-template-columns: 1fr;
  }

  .task-center-card {
    min-height: 0;
  }

  .task-card-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Stitch-inspired share link management UI */
.share-link-hero {
  margin-bottom: 16px;
}

.share-governance-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) repeat(2, minmax(0, .8fr));
  gap: 14px;
  margin-bottom: 16px;
}

.share-governance-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border-radius: 14px;
  border-color: rgba(203, 213, 225, .86);
  background: rgba(255, 255, 255, .92);
}

.share-governance-card h2 {
  margin: 0 0 4px;
  color: #0f172a;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: 0;
}

.share-governance-card.compact {
  min-height: 132px;
}

.share-governance-number {
  color: #0f172a;
  font-size: 34px;
  font-weight: 860;
  line-height: 1;
}

.share-status-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.share-status-filter-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 820;
}

.share-status-filter-row a.active,
.share-status-filter-row a:hover {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.share-link-card-v2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 16px;
  align-items: start;
  border-radius: 14px;
  border-color: rgba(203, 213, 225, .86);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .05);
}

.share-link-card-v2.status-active {
  border-left: 5px solid #10b981;
}

.share-link-card-v2.status-expired {
  border-left: 5px solid #94a3b8;
}

.share-link-card-v2.status-revoked {
  border-left: 5px solid #ef4444;
}

.share-link-card-v2 .share-link-meta-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.share-link-footnote {
  display: flex;
  gap: 8px 12px;
  align-items: center;
  flex-wrap: wrap;
  color: #64748b;
  font-size: 12px;
}

.share-link-card-side {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding-left: 16px;
  border-left: 1px solid #e2e8f0;
}

.share-link-side-stat {
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.share-link-side-stat strong,
.share-link-side-stat span {
  display: block;
}

.share-link-side-stat strong {
  color: #0f172a;
  font-size: 30px;
  line-height: 1.05;
}

.share-link-side-stat span {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 830;
}

.share-link-side-meta {
  display: grid;
  gap: 8px;
}

.share-link-side-meta div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.share-link-side-meta span {
  display: block;
  margin-bottom: 3px;
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
}

.share-link-side-meta strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #172033;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-link-card-side .share-link-actions {
  flex-direction: column;
  align-items: stretch;
}

.share-link-card-side .inline-action {
  width: 100%;
}

@media (max-width: 1180px) {
  .share-governance-grid {
    grid-template-columns: 1fr;
  }

  .share-link-card-v2 {
    grid-template-columns: 1fr;
  }

  .share-link-card-side {
    padding-top: 12px;
    padding-left: 0;
    border-top: 1px solid #e2e8f0;
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .share-link-card-v2 .share-link-meta-grid,
  .share-status-filter-row {
    grid-template-columns: 1fr;
  }

  .share-status-filter-row a {
    width: 100%;
  }
}

/* Stitch-inspired official account intelligence UI */
.official-hero {
  margin-bottom: 16px;
}

.official-stats,
.official-filters {
  margin-bottom: 16px;
}

.official-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
}

.official-toolbar.bottom {
  margin: 16px 0 0;
}

.official-list {
  display: grid;
  gap: 14px;
}

.official-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 16px;
  align-items: start;
  padding: 18px;
  border-radius: 14px;
  border-left: 5px solid rgba(37, 99, 235, .52);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .05);
}

.official-card-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.official-card-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.official-card-head h2 {
  margin: 6px 0 0;
  color: #0f172a;
  font-size: 19px;
  line-height: 1.38;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.official-domain {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.official-desc,
.official-digest {
  margin: 0;
  color: #334155;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.official-digest {
  padding: 10px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
}

.official-chip-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.official-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid #dbeafe;
  border-radius: 7px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 820;
}

.official-chip.price {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.official-chip.warning,
.official-chip.status-partial {
  border-color: #fde68a;
  background: #fffbeb;
  color: #a16207;
}

.official-chip.status-success,
.official-chip.value {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.official-chip.status-failed {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.official-chip.muted {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}

.official-ai-summary {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
}

.official-ai-summary span,
.official-send-preview strong {
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
}

.official-ai-summary p {
  margin: 0;
  color: #1e293b;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.official-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.official-meta-grid div,
.official-side-block {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.official-meta-grid span,
.official-side-block span {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
}

.official-meta-grid strong,
.official-side-block strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #172033;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.official-card-side {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding-left: 16px;
  border-left: 1px solid #e2e8f0;
}

.official-actions {
  display: grid;
  gap: 8px;
}

.official-actions .inline-action {
  width: 100%;
}

.official-send-preview {
  display: grid;
  gap: 4px;
  padding: 10px 11px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #eff6ff;
  color: #334155;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1180px) {
  .official-card {
    grid-template-columns: 1fr;
  }

  .official-card-side {
    padding-top: 12px;
    padding-left: 0;
    border-top: 1px solid #e2e8f0;
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .official-toolbar,
  .official-card-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .official-meta-grid {
    grid-template-columns: 1fr;
  }
}

/* Source-of-truth Stitch shell overrides from Desktop/stitch_ 2 */
.card,
.panel,
.metric-card,
.quick-filter-card,
.risk-event-card,
.search-result-card,
.media-card,
.moment-card,
.moment-detail-card,
.source-message-card,
.share-link-card,
.official-card,
.task-center-card,
.share-governance-card,
.detail-summary-card,
.evidence-media-card,
.order-signal-card,
.rule-card,
.batch-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: none;
}

.card:hover,
.media-card:hover,
.order-signal-card:hover,
.moment-card:hover,
.item:hover {
  transform: none;
  box-shadow: none;
}

.metric-card,
.secondary-stats .metric-card,
.dashboard-section,
.task-center-card,
.share-governance-card {
  padding: 20px;
}

.official-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.official-account-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.official-account-avatar {
  width: 56px !important;
  max-width: 56px !important;
  min-width: 56px !important;
  height: 56px !important;
  max-height: 56px !important;
  border-radius: 12px;
  overflow: hidden;
  background: #f1f5f9;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex: 0 0 56px;
}

.official-account-avatar img {
  width: 56px !important;
  max-width: 56px !important;
  height: 56px !important;
  max-height: 56px !important;
  display: block;
  object-fit: cover;
}

.official-account-body { min-width: 0; }

.metric-card .num,
.task-card-number,
.share-governance-number,
.detail-side-stats strong,
.task-channel-grid strong,
.share-link-side-stat strong {
  letter-spacing: 0;
}

.filters,
.sync-tabs,
.share-link-toolbar,
.official-toolbar,
.order-signal-toolbar {
  border-radius: 4px;
}

.filters input,
.filters select,
.filters button,
.sync-search input[type="search"],
.sync-search select,
.level1-select,
.level2-select,
.inline-editor input,
.share-link-manage-input,
.share-link-input,
input,
select,
button {
  border-radius: 4px;
}

.badge,
.source-type-chip,
.category-chip,
.official-chip,
.share-status-pill,
.task-status-pill,
.task-card-link,
.media-type,
.risk-pill,
.merged-icon,
.merged-meta span {
  border-radius: 4px;
}

.table-wrap,
table {
  border-radius: 4px;
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

td {
  background: #fff;
}

.hero-action:hover,
.inline-action:hover,
.task-card-action:hover,
.task-link-list a:hover {
  border-color: rgba(0, 74, 198, .36);
  background: var(--surface-soft);
  color: var(--primary);
  box-shadow: none;
}

.stat-grid {
  gap: 16px;
}

.page-hero h1 {
  margin-bottom: 8px;
  font-size: 24px;
  font-weight: 800;
}

.page-hero .hero-subtitle {
  margin-top: 0;
}

@media (max-width: 900px) {
  .stitch-sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stitch-brand {
    min-height: 58px;
    padding: 14px 16px;
  }

  .stitch-nav {
    display: flex;
    overflow-x: auto;
    padding: 0 12px 12px;
  }

  .stitch-nav-link {
    flex: 0 0 auto;
  }

  .stitch-sidebar-bottom {
    display: none;
  }

  .stitch-topbar {
    position: static;
    height: auto;
    padding: 12px 16px;
  }

  .stitch-search {
    width: 100%;
  }

  .stitch-user {
    display: none;
  }

  .container {
    margin-left: 0;
    padding: 20px 16px 40px;
  }
}

/* Stitch message workbench with phone-style chat preview */
.source-message-stitch-hero {
  margin-bottom: 14px;
}

.source-message-workbench {
  display: grid;
  gap: 14px;
}

.source-message-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(160px, .8fr) minmax(150px, .7fr) 120px auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.source-message-layout.phone-workbench {
  display: grid;
  grid-template-columns: 240px minmax(420px, 1fr) 380px;
  gap: 0;
  min-height: 660px;
  border: 1px solid var(--line);
  background: #fff;
}

.phone-workbench .source-message-side {
  position: relative;
  top: auto;
  gap: 0;
  max-height: calc(100vh - var(--topbar-height) - 150px);
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #fff;
}

.phone-workbench .side-section {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
}

.source-message-quick-stats h2,
.phone-workbench .side-section h2 {
  margin-bottom: 12px;
  color: #191c1e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.source-mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.source-mini-stats div {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-soft);
}

.source-mini-stats strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-mini-stats span,
.source-range {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.source-range {
  margin: 10px 0 0;
}

.source-message-feed-pane {
  display: flex;
  min-width: 0;
  min-height: 660px;
  max-height: calc(100vh - var(--topbar-height) - 150px);
  overflow: hidden;
  flex-direction: column;
  background: #f7f9fb;
}

.source-message-toolbar {
  display: flex;
  min-height: 48px;
  padding: 0 14px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.source-select-all,
.source-message-tools,
.source-page-buttons,
.icon-text-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.source-select-all input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.icon-text-action,
.source-page-buttons a,
.source-page-buttons span {
  color: var(--muted);
  text-decoration: none;
}

.source-page-buttons a,
.source-page-buttons span {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.source-page-buttons .material-symbols-outlined,
.icon-text-action .material-symbols-outlined {
  font-size: 18px;
}

.source-message-feed-pane .source-message-list {
  flex: 1;
  max-height: none;
  overflow: auto;
  padding: 0;
}

.source-message-row {
  margin: 0;
  padding: 14px 16px;
  border-width: 0 0 1px 2px;
  border-color: var(--line);
  border-left-color: transparent;
  border-radius: 0;
  cursor: pointer;
}

.source-message-row:hover,
.source-message-row.active {
  border-left-color: var(--primary);
  background: #fff;
}

.source-message-card-head {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: start;
}

.source-message-avatar,
.phone-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #ccd2d8;
  background: #eef2f6;
  color: #334155;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.source-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 13px;
}

.source-message-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.type-chip {
  display: inline-flex;
  min-height: 24px;
  padding: 3px 7px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.source-phone-pane {
  display: flex;
  min-width: 0;
  min-height: 660px;
  max-height: calc(100vh - var(--topbar-height) - 150px);
  padding: 18px 20px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  border-left: 1px solid var(--line);
  background: #fff;
}

.phone-device {
  display: flex;
  width: min(100%, 340px);
  height: min(690px, calc(100vh - var(--topbar-height) - 210px));
  min-height: 560px;
  overflow: hidden;
  flex-direction: column;
  border: 10px solid #15181d;
  border-radius: 28px;
  background: #eef1f4;
  box-shadow: 0 14px 30px rgba(15, 23, 42, .16);
}

.phone-status-bar,
.phone-chat-head,
.phone-input-bar {
  flex: 0 0 auto;
  background: #f7f7f7;
}

.phone-status-bar {
  display: flex;
  height: 28px;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  color: #111827;
  font-size: 11px;
  font-weight: 800;
}

.phone-status-bar div {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.phone-status-bar .material-symbols-outlined {
  font-size: 14px;
}

.phone-chat-head {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  gap: 8px;
  min-height: 50px;
  padding: 7px 10px 9px;
  align-items: center;
  border-bottom: 1px solid #d9dde1;
}

.phone-chat-head strong,
.phone-chat-head span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-chat-head strong {
  color: #111827;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.phone-chat-head span {
  color: #6b7280;
  font-size: 10px;
  text-align: center;
}

.phone-chat-head > .material-symbols-outlined {
  color: #111827;
  font-size: 22px;
}

.phone-chat-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 10px 16px;
  background: #e9edf1;
}

.phone-message {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  scroll-margin: 80px;
}

.phone-time {
  justify-self: center;
  max-width: 82%;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(139, 148, 158, .22);
  color: #6b7280;
  font-size: 10px;
  line-height: 1.5;
}

.phone-message-line {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.phone-avatar {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  font-size: 12px;
}

.phone-message-content {
  min-width: 0;
}

.phone-sender {
  margin-bottom: 3px;
  color: #7b8188;
  font-size: 10px;
  line-height: 1.2;
}

.phone-bubble {
  width: fit-content;
  max-width: min(235px, 100%);
  padding: 8px 9px;
  border: 1px solid #d7dce1;
  border-radius: 4px;
  background: #fff;
  color: #111827;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: normal;
}

.phone-message.active .phone-bubble {
  border-color: rgba(0, 74, 198, .42);
  box-shadow: 0 0 0 2px rgba(0, 74, 198, .1);
}

.phone-text {
  white-space: pre-wrap;
}

.phone-media-thumb {
  display: block;
  width: 164px;
  max-width: 100%;
  margin-top: 7px;
  overflow: hidden;
  border: 1px solid #d8dde3;
  border-radius: 4px;
  background: #f8fafc;
}

.phone-media-thumb img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
}

.phone-media-pill {
  display: inline-flex;
  max-width: 100%;
  min-height: 30px;
  margin-top: 7px;
  padding: 5px 8px;
  align-items: center;
  gap: 6px;
  border: 1px solid #d8dde3;
  border-radius: 4px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.phone-media-pill.muted {
  color: #808892;
}

.phone-media-pill .material-symbols-outlined {
  font-size: 17px;
}

.phone-merged-card,
.phone-link-card {
  display: grid;
  gap: 6px;
  min-width: 190px;
}

a.phone-link-card {
  color: inherit;
  text-decoration: none;
}

.phone-merged-card {
  cursor: pointer;
}

.phone-merged-card:focus-visible {
  outline: 2px solid rgba(0, 74, 198, .5);
  outline-offset: 3px;
}

.phone-merged-title {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.phone-merged-title .material-symbols-outlined {
  color: var(--primary);
  font-size: 18px;
}

.phone-merged-title strong,
.phone-link-card strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-merged-meta,
.phone-merged-more,
.phone-link-card span,
.phone-link-card em {
  color: #6b7280;
  font-size: 10px;
  font-style: normal;
}

.phone-merged-list {
  display: grid;
  gap: 4px;
  padding-top: 3px;
  border-top: 1px solid #eef1f4;
}

.phone-merged-list div {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 6px;
}

.phone-merged-list strong,
.phone-merged-list span {
  overflow: hidden;
  color: #4b5563;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-input-bar {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 24px;
  gap: 8px;
  min-height: 46px;
  padding: 8px 10px;
  align-items: center;
  border-top: 1px solid #d9dde1;
}

.phone-input-bar div {
  height: 28px;
  border: 1px solid #d7dce1;
  border-radius: 4px;
  background: #fff;
}

.phone-input-bar .material-symbols-outlined {
  color: #4b5563;
  font-size: 21px;
}

.phone-empty {
  display: grid;
  height: 100%;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: #8b949e;
  text-align: center;
}

.phone-empty .material-symbols-outlined {
  font-size: 44px;
}

.phone-preview-caption {
  display: grid;
  gap: 2px;
  width: min(100%, 340px);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.phone-preview-caption strong {
  color: var(--text);
  font-size: 12px;
}

.conversation-detail-hero {
  margin-bottom: 14px;
}

.conversation-window-hero {
  margin-bottom: 16px;
}

.conversation-window-stats {
  margin-bottom: 14px;
}

.conversation-window-filters {
  display: grid;
  grid-template-columns: 180px 120px auto auto;
  width: fit-content;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.conversation-window-board {
  display: grid;
  gap: 14px;
}

.conversation-window-card {
  overflow: hidden;
  padding: 0;
  border-radius: 8px;
}

.conversation-window-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px 16px 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.conversation-window-risk-pill {
  display: grid;
  width: 72px;
  min-height: 48px;
  place-items: center;
  border: 1px solid rgba(0, 74, 198, .22);
  border-radius: 6px;
  background: #edf4ff;
  color: var(--primary);
  text-decoration: none;
}

.conversation-window-risk-pill strong {
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.conversation-window-risk-pill span {
  color: inherit;
  font-size: 11px;
  font-weight: 800;
}

.conversation-window-card.risk-P1 .conversation-window-risk-pill {
  border-color: rgba(190, 18, 60, .28);
  background: #fff1f2;
  color: #be123c;
}

.conversation-window-card.risk-P2 .conversation-window-risk-pill {
  border-color: rgba(180, 83, 9, .28);
  background: #fff7ed;
  color: #b45309;
}

.conversation-window-card.risk-P3 .conversation-window-risk-pill {
  border-color: rgba(0, 74, 198, .24);
  background: #edf4ff;
  color: var(--primary);
}

.conversation-window-card.risk-P4 .conversation-window-risk-pill {
  border-color: rgba(21, 128, 61, .24);
  background: #f0fdf4;
  color: #15803d;
}

.conversation-window-card-title {
  min-width: 0;
}

.conversation-window-card-title h2 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-window-card-title p {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-window-card-body {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  align-items: stretch;
  background: #fbfcfe;
}

.conversation-window-mini-phone {
  display: flex;
  width: min(100%, 330px);
  height: 420px;
  min-width: 0;
  overflow: hidden;
  flex-direction: column;
  border: 8px solid #15181d;
  border-radius: 26px;
  background: #e9edf1;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 14px 28px rgba(15, 23, 42, .14);
}

.conversation-window-mini-status,
.conversation-window-mini-top,
.conversation-window-mini-input {
  flex: 0 0 auto;
  background: #f7f7f7;
}

.conversation-window-mini-status {
  display: flex;
  height: 25px;
  padding: 0 14px;
  align-items: center;
  justify-content: space-between;
  color: #111827;
  font-size: 10px;
  font-weight: 800;
}

.conversation-window-mini-top {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 24px;
  gap: 6px;
  min-height: 48px;
  padding: 7px 9px;
  align-items: center;
  border-bottom: 1px solid #d9dde1;
}

.conversation-window-mini-top strong,
.conversation-window-mini-top span {
  display: block;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-window-mini-top strong {
  color: #111827;
  font-size: 12px;
  font-weight: 850;
}

.conversation-window-mini-top span {
  color: #6b7280;
  font-size: 10px;
}

.conversation-window-mini-top > .material-symbols-outlined {
  color: #111827;
  font-size: 20px;
}

.conversation-window-mini-feed {
  display: grid;
  flex: 1;
  min-height: 0;
  padding: 10px;
  align-content: start;
  gap: 9px;
  overflow: hidden;
  background: #e9edf1;
}

.conversation-window-mini-message {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.conversation-window-mini-time {
  justify-self: center;
  max-width: 84%;
  padding: 2px 6px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(139, 148, 158, .22);
  color: #6b7280;
  font-size: 9px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-window-mini-line {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
}

.conversation-window-mini-avatar {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #ccd2d8;
  border-radius: 4px;
  background: #eef2f6;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.conversation-window-mini-bubble {
  min-width: 0;
  max-width: 100%;
  padding: 7px 8px;
  border: 1px solid #d7dce1;
  border-radius: 4px;
  background: #fff;
  color: #111827;
  font-size: 11px;
  line-height: 1.45;
}

.conversation-window-mini-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #6b7280;
  font-size: 9px;
  line-height: 1.2;
}

.conversation-window-mini-meta strong,
.conversation-window-mini-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-window-mini-meta strong {
  color: #4b5563;
  font-weight: 800;
}

.conversation-window-mini-meta span {
  flex: 0 0 auto;
}

.conversation-window-mini-bubble p {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}

.conversation-window-mini-bubble em {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: #6b7280;
  font-size: 9px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-window-mini-input {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 22px;
  gap: 7px;
  min-height: 42px;
  padding: 8px 10px;
  align-items: center;
  border-top: 1px solid #d9dde1;
}

.conversation-window-mini-input div {
  height: 26px;
  border: 1px solid #d7dce1;
  border-radius: 4px;
  background: #fff;
}

.conversation-window-mini-input .material-symbols-outlined {
  color: #4b5563;
  font-size: 19px;
}

.conversation-window-mini-empty {
  display: grid;
  height: 100%;
  place-items: center;
  align-content: center;
  gap: 6px;
  color: #8b949e;
  text-align: center;
}

.conversation-window-mini-empty .material-symbols-outlined {
  font-size: 36px;
}

.conversation-window-mini-empty p {
  margin: 0;
  font-size: 12px;
}

.conversation-window-card-side {
  display: grid;
  min-width: 0;
  gap: 14px;
  align-content: start;
}

.conversation-window-card-risk-type {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.conversation-window-card-summary {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow-wrap: anywhere;
}

.conversation-window-card-tags {
  display: flex;
  min-width: 0;
  gap: 6px;
  flex-wrap: wrap;
}

.conversation-window-muted-chip {
  display: inline-flex;
  min-height: 24px;
  padding: 3px 7px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.conversation-window-card-metrics {
  display: grid;
  grid-template-columns: 86px 86px minmax(0, 1fr);
  gap: 8px;
  margin: 0;
}

.conversation-window-card-metrics div {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.conversation-window-card-metrics dt {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.conversation-window-card-metrics dd {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-window-card-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.conversation-window-card-actions .mono {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-window-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.conversation-window-empty .material-symbols-outlined {
  font-size: 42px;
}

.conversation-phone-workbench {
  margin-top: 0;
}

.conversation-window-side .side-section {
  padding: 16px;
}

.conversation-risk-score {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.conversation-risk-score strong {
  color: var(--primary);
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}

.conversation-risk-score span {
  display: inline-flex;
  min-height: 24px;
  padding: 3px 8px;
  align-items: center;
  border: 1px solid rgba(0, 74, 198, .24);
  border-radius: 4px;
  background: #edf4ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.conversation-risk-type {
  margin: 10px 0 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.conversation-summary {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.conversation-keywords {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.conversation-meta-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.conversation-meta-list div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.conversation-meta-list dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.conversation-meta-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12px;
}

.conversation-feed-pane .source-message-row {
  background: #fff;
}

.conversation-message-row .wechat-message {
  max-height: 160px;
  overflow: hidden;
}

.conversation-phone-pane .phone-device {
  height: min(700px, calc(100vh - var(--topbar-height) - 190px));
}

.item-phone-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  justify-items: center;
}

.item-context-phone {
  width: min(100%, 320px);
  height: min(620px, calc(100vh - var(--topbar-height) - 170px));
  min-height: 520px;
}

.item-context-phone .phone-message.current .phone-bubble,
.item-context-phone .phone-message.active .phone-bubble {
  border-color: rgba(0, 74, 198, .46);
  background: #f8fbff;
  box-shadow: 0 0 0 2px rgba(0, 74, 198, .1);
}

.detail-timeline-item.phone-active .detail-timeline-content {
  border-color: rgba(0, 74, 198, .42);
  background: #f8fbff;
}

.item-phone-card .phone-preview-caption {
  width: min(100%, 320px);
}

@media (max-width: 1320px) {
  .source-message-layout.phone-workbench {
    grid-template-columns: 220px minmax(360px, 1fr) 340px;
  }

  .source-phone-pane {
    padding: 16px;
  }
}

@media (max-width: 1120px) {
  .source-message-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .conversation-window-card-body {
    grid-template-columns: 1fr;
  }

  .conversation-window-mini-phone {
    justify-self: center;
    width: min(100%, 360px);
  }

  .source-message-layout.phone-workbench {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .source-phone-pane {
    grid-column: 1 / -1;
    min-height: 620px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .source-message-filters,
  .source-message-layout.phone-workbench,
  .source-message-card-head {
    grid-template-columns: 1fr;
  }

  .conversation-window-filters,
  .conversation-window-card-head,
  .conversation-window-card-metrics,
  .conversation-window-card-actions {
    grid-template-columns: 1fr;
  }

  .conversation-window-filters {
    width: 100%;
  }

  .conversation-window-card-head {
    align-items: start;
  }

  .conversation-window-risk-pill {
    width: 100%;
    min-height: 42px;
    grid-template-columns: auto auto;
    justify-content: space-between;
    padding: 0 12px;
  }

  .conversation-window-card-body {
    padding: 12px;
  }

  .conversation-window-card-actions {
    display: grid;
  }

  .conversation-window-mini-phone {
    height: 400px;
  }

  .phone-workbench .source-message-side,
  .source-message-feed-pane,
  .source-phone-pane {
    max-height: none;
  }

  .source-message-toolbar,
  .source-message-tools {
    align-items: flex-start;
    flex-direction: column;
  }

  .source-message-row-actions {
    justify-content: space-between;
  }

  .phone-device {
    min-height: 560px;
  }
}

/* Stitch table treatment for JD order leads */
.order-signal-table-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.order-signal-table-head {
  display: flex;
  min-height: 58px;
  padding: 12px 14px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.order-signal-table-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.25;
}

.order-signal-table-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.order-signal-table-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.order-signal-table-actions .plain-action {
  min-height: 32px;
  gap: 6px;
  font-size: 12px;
}

.order-signal-table-actions .plain-action.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.order-signal-table-actions .material-symbols-outlined {
  font-size: 16px;
}

.order-signal-table-wrap {
  width: 100%;
  overflow: auto;
}

.order-signal-table {
  min-width: 1380px;
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.order-signal-table th,
.order-signal-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.order-signal-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
  text-transform: uppercase;
}

.order-signal-table tr:hover td {
  background: #f8fafc;
}

.order-signal-table .preview-col {
  width: 136px;
}

.order-signal-table .status-col {
  width: 116px;
}

.order-signal-table .action-col {
  width: 132px;
}

.order-table-preview {
  appearance: none;
  display: grid;
  width: 112px;
  height: 112px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: #8b949e;
  cursor: zoom-in;
  font: inherit;
  padding: 0;
}

.order-table-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.order-table-preview .material-symbols-outlined {
  font-size: 24px;
}

.order-image-modal[hidden] {
  display: none;
}

.order-image-modal {
  position: fixed;
  inset: 0;
  z-index: 1160;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, .72);
  backdrop-filter: blur(5px);
}

.order-image-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, .36);
  border-radius: 8px;
  background: #0f172a;
  box-shadow: 0 26px 80px rgba(0, 0, 0, .36);
}

.order-image-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid rgba(203, 213, 225, .18);
  color: #f8fafc;
}

.order-image-head strong {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-image-close {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(203, 213, 225, .28);
  border-radius: 6px;
  background: rgba(255, 255, 255, .08);
  color: #f8fafc;
  cursor: pointer;
}

.order-image-close .material-symbols-outlined {
  font-size: 19px;
}

.order-image-stage {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: auto;
  padding: 12px;
  background: #111827;
}

.order-image-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 106px);
  object-fit: contain;
}

.order-number-stack {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.order-number-stack strong,
.order-number-stack span {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-number-stack strong {
  color: var(--primary);
  font-weight: 900;
}

.order-number-stack strong.warning {
  color: #b45309;
}

.order-number-stack strong.muted,
.order-number-stack span {
  color: #6b7280;
  font-weight: 700;
}

.order-signal-mini-meta {
  margin-top: 5px;
  color: #8b949e;
  font-size: 10px;
  line-height: 1.3;
}

.receiver-stack {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.receiver-stack strong,
.receiver-stack span {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #334155;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receiver-stack strong {
  color: var(--text);
  font-weight: 900;
}

.receiver-stack.muted span,
.receiver-cell .muted {
  color: #8b949e;
}

.receiver-address {
  white-space: normal !important;
  display: -webkit-box !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-amount {
  margin-top: 4px;
  color: #b45309;
  font-size: 12px;
  font-weight: 850;
}

.product-tags {
  display: flex;
  gap: 5px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.product-tags span {
  max-width: 120px;
  min-height: 20px;
  padding: 2px 5px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-line {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.channel-line .material-symbols-outlined {
  color: var(--muted);
  font-size: 15px;
}

.channel-line span:last-child,
.sender-line,
.source-line,
.match-reason {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sender-line,
.source-line {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.match-line {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 11px;
  line-height: 1.35;
}

.match-line strong {
  font-weight: 900;
}

.match-line.success {
  color: #15803d;
}

.match-line.pending {
  color: #b45309;
}

.match-line.failed {
  color: #b91c1c;
}

.match-reason {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.order-row-evidence {
  margin-top: 6px;
}

.order-row-evidence summary {
  width: fit-content;
  cursor: pointer;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
}

.order-row-evidence pre,
.order-row-evidence p {
  max-height: 160px;
  margin: 6px 0 0;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: #334155;
  font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.status-cell {
  display: grid;
  gap: 6px;
}

.order-status-pill,
.status-cell .risk-pill {
  display: inline-flex;
  width: fit-content;
  min-height: 22px;
  padding: 2px 6px;
  align-items: center;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.35;
}

.order-status-pill.success {
  color: #15803d;
}

.order-status-pill.pending {
  color: #b45309;
}

.order-status-pill.failed {
  color: #b91c1c;
}

.status-cell .risk-pill {
  border: 1px solid var(--line);
  background: #fff;
}

.action-cell {
  display: grid;
  gap: 5px;
}

.order-table-action {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  padding: 3px 7px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.order-table-action.primary {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.order-table-action:hover {
  border-color: rgba(0, 74, 198, .26);
  background: #edf4ff;
}

.order-signal-table-foot {
  display: flex;
  min-height: 42px;
  padding: 8px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
}

.order-signal-table-foot .order-signal-pager {
  font-size: 11px;
}

.search-hero {
  align-items: center;
  margin-bottom: 18px;
}

.search-hero-count {
  display: grid;
  min-width: 108px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  text-align: right;
}

.search-hero-count span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.search-hero-count strong {
  margin-top: 2px;
  color: var(--text);
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.search-mode-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.search-mode-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.search-mode-tabs a.active {
  background: var(--primary);
  color: #fff;
}

.search-filters {
  align-items: center;
  margin-bottom: 14px;
}

.search-filters input[name="q"] {
  min-width: min(520px, 100%);
}

.search-filters input[name="limit"] {
  width: 88px;
}

.search-result-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(120px, .7fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--line);
}

.search-result-summary div {
  min-width: 0;
  padding: 10px 12px;
  background: #fff;
}

.search-result-summary span,
.search-result-side span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.search-result-summary strong {
  display: block;
  min-width: 0;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-results-list {
  display: grid;
  gap: 12px;
}

.search-result-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 4px;
  background: #fff;
}

.search-result-item.has-media {
  border-left-color: var(--info);
}

.search-result-item.is-official {
  border-left-color: var(--success);
}

.search-result-main {
  min-width: 0;
}

.search-result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.search-type-chip,
.search-official-strip span,
.search-media-strip,
.search-result-time {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.25;
}

.search-type-chip {
  border-color: rgba(0, 74, 198, .18);
  background: #edf4ff;
  color: var(--primary);
}

.search-result-time {
  white-space: nowrap;
}

.search-result-item h2 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.search-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.search-result-meta span {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-meta .material-symbols-outlined {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 15px;
}

.search-official-strip,
.search-media-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.search-official-strip span {
  background: #f0fdf4;
  color: #166534;
}

.search-official-strip .warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.search-media-strip {
  width: fit-content;
  align-items: center;
  color: #075985;
  background: #ecfeff;
}

.search-media-strip .material-symbols-outlined {
  font-size: 15px;
}

.search-media-strip strong {
  color: #0f172a;
}

.search-result-item .match-snippets {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.search-result-item .match-snippet {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbfcfd;
}

.search-result-item .match-snippet.primary {
  border-color: rgba(0, 74, 198, .18);
  background: #f7fbff;
}

.search-result-item .match-snippet span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.search-result-item .match-snippet p {
  margin: 0;
  color: #1f2937;
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.search-actions {
  margin-top: 12px;
  margin-bottom: 0;
}

.search-actions .material-symbols-outlined {
  margin-right: 4px;
  font-size: 16px;
}

.search-result-side {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.search-result-side div {
  min-width: 0;
}

.search-result-side strong {
  display: block;
  min-width: 0;
  margin-top: 3px;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.search-empty-state {
  display: grid;
  min-height: 240px;
  place-items: center;
  padding: 34px 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  background: #fff;
  text-align: center;
}

.search-empty-state .material-symbols-outlined {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 25px;
}

.search-empty-state h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.search-empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 980px) {
  .search-result-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-result-item {
    grid-template-columns: 1fr;
  }

  .search-result-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 12px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 680px) {
  .search-hero {
    align-items: flex-start;
  }

  .search-mode-tabs {
    display: flex;
  }

  .search-hero-count {
    width: 100%;
    text-align: left;
  }

  .search-result-summary,
  .search-result-side {
    grid-template-columns: 1fr;
  }

  .search-result-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-result-time {
    white-space: normal;
  }

  .search-actions > * {
    width: 100%;
  }

  .toolbar-nav-button span:last-child {
    display: none;
  }

  .toolbar-nav-menu {
    right: -92px;
    width: min(260px, calc(100vw - 24px));
  }

}

@media (max-width: 900px) {
  .order-signal-table-head,
  .order-signal-table-foot {
    align-items: flex-start;
    flex-direction: column;
  }
}

.rule-config-shell {
  display: grid;
  gap: 16px;
}

.rule-config-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.rule-config-head h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.rule-config-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.rule-config-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 8px;
  width: min(520px, 100%);
}

.rule-config-stats div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.rule-config-stats strong,
.rule-config-stats span {
  display: block;
}

.rule-config-stats strong {
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: 0;
}

.rule-config-stats span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.rule-config-panel,
.rule-config-card,
.rule-config-toolbar,
.rule-config-empty {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.rule-config-panel {
  padding: 16px;
}

.rule-config-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.rule-config-section-title h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

.rule-config-section-title span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.rule-config-create-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.rule-config-create-form label,
.rule-config-field,
.rule-config-fields label,
.rule-keyword-box,
.rule-keyword-config {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rule-config-create-form input,
.rule-config-create-form select,
.rule-config-create-form textarea,
.rule-config-toolbar input,
.rule-config-toolbar select,
.rule-config-fields input,
.rule-config-fields select,
.rule-keyword-box textarea,
.rule-keyword-config textarea,
.rule-config-name {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.rule-config-create-form input:focus,
.rule-config-create-form select:focus,
.rule-config-create-form textarea:focus,
.rule-config-toolbar input:focus,
.rule-config-toolbar select:focus,
.rule-config-fields input:focus,
.rule-config-fields select:focus,
.rule-keyword-box textarea:focus,
.rule-keyword-config textarea:focus,
.rule-config-name:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.rule-config-create-form textarea,
.rule-keyword-box textarea,
.rule-keyword-config textarea {
  min-height: 82px;
  resize: vertical;
}

.rule-config-wide {
  grid-column: span 2;
}

.rule-config-wide-row {
  grid-column: 1 / -1;
}

.rule-keyword-config {
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #f8fafc;
}

.rule-keyword-config.compact-card {
  background: #fff;
}

.rule-keyword-config-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.rule-keyword-config-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.rule-keyword-config-head > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.rule-config-field.relation {
  width: min(360px, 100%);
}

.rule-relation-block {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
}

.rule-relation-block > span {
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.rule-config-submit {
  align-self: end;
}

.rule-config-submit button,
.rule-config-toolbar button,
.rule-config-save,
.rule-config-toggle,
.rule-config-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.rule-config-submit button,
.rule-config-save {
  background: var(--primary);
  color: #fff;
}

.rule-config-toolbar button {
  background: #0f172a;
  color: #fff;
}

.rule-config-toggle,
.rule-config-reset {
  border-color: #dbe3ef;
  background: #fff;
  color: var(--text);
}

.rule-config-submit .material-symbols-outlined,
.rule-config-toolbar .material-symbols-outlined,
.rule-config-card-actions .material-symbols-outlined {
  font-size: 18px;
  line-height: 1;
}

.rule-operator-segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  min-height: 38px;
  padding: 2px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
}

.rule-operator-segment input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rule-operator-segment label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 32px;
  padding: 5px 8px;
  border-radius: 3px;
  color: #475569;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  cursor: pointer;
}

.rule-operator-segment input:checked + label {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}

.rule-operator-segment.compact {
  width: 132px;
  max-width: 100%;
}

.rule-operator-segment.descriptive {
  width: min(360px, 100%);
}

.rule-operator-segment.descriptive label {
  min-height: 34px;
  white-space: nowrap;
}

.rule-operator-segment.prominent {
  width: 100%;
  min-height: 44px;
  padding: 3px;
  border-color: #94a3b8;
}

.rule-operator-segment.prominent label {
  min-height: 36px;
  font-size: 14px;
}

.rule-config-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, .7fr) 130px minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.rule-config-list {
  display: grid;
  gap: 12px;
}

.rule-config-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-left: 4px solid #16a34a;
}

.rule-config-card.is-disabled {
  border-left-color: #94a3b8;
  background: #f8fafc;
}

.rule-config-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.rule-config-title {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.rule-config-name {
  min-height: 34px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  font-size: 18px;
  font-weight: 900;
}

.rule-config-status {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 6px;
  text-align: right;
}

.rule-config-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 100px 120px;
  gap: 10px;
  align-items: end;
}

.rule-expression {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
  padding: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
}

.rule-keyword-chip,
.rule-joiner {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.rule-keyword-chip {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.rule-joiner {
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.rule-config-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.rule-config-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  text-align: center;
}

.rule-config-empty .material-symbols-outlined {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--primary);
}

.rule-config-empty h2 {
  margin: 0 0 6px;
  font-size: 18px;
  letter-spacing: 0;
}

.rule-config-empty p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .rule-config-head {
    flex-direction: column;
  }

  .rule-config-stats {
    width: 100%;
  }

  .rule-config-create-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rule-config-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rule-config-toolbar input,
  .rule-config-toolbar button,
  .rule-config-reset {
    width: 100%;
  }

  .rule-config-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .rule-config-stats,
  .rule-config-create-form,
  .rule-config-toolbar,
  .rule-config-fields {
    grid-template-columns: 1fr;
  }

  .rule-config-wide {
    grid-column: auto;
  }

  .rule-config-card-head,
  .rule-keyword-config-head,
  .rule-config-card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .rule-config-status {
    align-items: flex-start;
    text-align: left;
  }

  .rule-operator-segment.compact,
  .rule-operator-segment.descriptive,
  .rule-config-field.relation,
  .rule-config-save,
  .rule-config-toggle {
    width: 100%;
  }
}

.api-docs-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.api-docs-head h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: 0;
}

.api-docs-head p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

.api-docs-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, 1fr));
  gap: 8px;
  min-width: min(520px, 100%);
}

.api-docs-summary div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.api-docs-summary strong {
  display: block;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.api-docs-summary span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.api-docs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.api-docs-search {
  position: relative;
  display: block;
  width: min(520px, 100%);
}

.api-docs-search .material-symbols-outlined {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--muted);
  transform: translateY(-50%);
  font-size: 18px;
}

.api-docs-search input {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px 8px 40px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.api-docs-search input:focus,
.api-try-box input:focus,
.api-try-box textarea:focus {
  outline: 0;
  border-color: rgba(0, 74, 198, .42);
  box-shadow: 0 0 0 2px rgba(0, 74, 198, .12);
}

.api-docs-methods {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.api-method-pill,
.api-method {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .03em;
}

.api-method.method-get,
.api-method-pill.method-get {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.api-method.method-post,
.api-method-pill.method-post {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.api-docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.api-docs-index {
  position: sticky;
  top: calc(var(--topbar-height) + 18px);
  display: grid;
  gap: 6px;
}

.api-docs-index a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

.api-docs-index a:hover {
  border-color: rgba(0, 74, 198, .3);
  background: #edf4ff;
  color: var(--primary);
}

.api-docs-index strong {
  color: var(--muted);
  font-size: 12px;
}

.api-docs-groups {
  display: grid;
  gap: 18px;
}

.api-docs-group {
  scroll-margin-top: calc(var(--topbar-height) + 18px);
}

.api-docs-group-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.api-docs-group-head h2 {
  margin: 0 0 5px;
  font-size: 20px;
  letter-spacing: 0;
}

.api-docs-group-head p {
  margin: 0;
  color: var(--muted);
}

.api-docs-group-head > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.api-endpoint-list {
  display: grid;
  gap: 10px;
}

.api-endpoint-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.api-endpoint-card.deprecated {
  background: #f8fafc;
  opacity: .82;
}

.api-endpoint-main {
  display: grid;
  gap: 7px;
}

.api-endpoint-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.api-endpoint-title code {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #0f172a;
  font-size: 13px;
  font-weight: 850;
}

.api-endpoint-main h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.api-endpoint-main p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.api-endpoint-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.api-endpoint-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid #d7dee8;
  border-radius: 4px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.api-endpoint-tags .danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.api-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid #fde68a;
  border-radius: 4px;
  background: #fffbeb;
  color: #92400e;
  font-weight: 750;
  line-height: 1.5;
}

.api-warning .material-symbols-outlined {
  flex: 0 0 auto;
  margin-top: 1px;
  font-size: 18px;
}

.api-param-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.api-param-table table {
  min-width: 760px;
  box-shadow: none;
}

.api-param-table th,
.api-param-table td {
  padding: 8px 10px;
  font-size: 12px;
}

.api-param-table th {
  background: #f8fafc;
  color: #334155;
}

.api-param-table code {
  color: #0f172a;
  font-weight: 850;
}

.api-try-box {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.api-try-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.api-try-grid label {
  display: grid;
  gap: 6px;
}

.api-try-grid label:first-child {
  grid-column: 1 / -1;
}

.api-try-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.api-try-box input,
.api-try-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.api-try-box input {
  min-height: 36px;
  padding: 8px 10px;
}

.api-try-box textarea {
  min-height: 86px;
  resize: vertical;
  padding: 9px 10px;
}

.api-try-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.api-try-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.api-try-button:hover {
  background: var(--primary-strong);
}

.api-try-button:disabled {
  border-color: #cbd5e1;
  background: #e2e8f0;
  color: #64748b;
  cursor: not-allowed;
}

.api-try-disabled {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.api-result {
  max-height: 460px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #0f172a;
  color: #dbeafe;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.api-result.error {
  border-color: #fecaca;
  background: #450a0a;
  color: #fee2e2;
}

@media (max-width: 1180px) {
  .api-docs-head,
  .api-docs-toolbar,
  .api-docs-group-head {
    align-items: stretch;
    flex-direction: column;
  }

  .api-docs-summary {
    min-width: 0;
  }

  .api-docs-methods {
    justify-content: flex-start;
  }

  .api-docs-layout {
    grid-template-columns: 1fr;
  }

  .api-docs-index {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .api-docs-summary,
  .api-docs-index,
  .api-try-grid {
    grid-template-columns: 1fr;
  }

  .api-endpoint-title {
    align-items: flex-start;
    flex-direction: column;
  }
}

.official-tag-manager { margin: 18px 0; }
.official-tag-create { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.official-tag-create input { min-width:220px; }
.official-managed-tag-list { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
.official-chip.managed { background:#eef2ff; color:#3730a3; border-color:#c7d2fe; }
.official-chip button { margin-left:6px; border:0; background:transparent; color:inherit; cursor:pointer; font-size:11px; text-decoration:underline; }
.official-tag-checkboxes { display:grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap:8px; max-height:260px; overflow:auto; padding:6px 0; }
.official-tag-check { display:flex; align-items:center; gap:6px; padding:8px; border:1px solid var(--line); border-radius:4px; background:#fff; }

.official-tabs { display:flex; gap:8px; margin:14px 0 18px; flex-wrap:wrap; }
.official-tabs a { padding:8px 14px; border:1px solid var(--line); border-radius:4px; background:#fff; color:var(--text); text-decoration:none; }
.official-tabs a.active { background:var(--primary); border-color:var(--primary); color:#fff; }
.official-category-manager { margin:18px 0; padding:18px; }
.official-category-admin { display:flex; gap:12px; flex-wrap:wrap; margin:12px 0; }
.official-category-admin form { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.official-category-tree { display:grid; gap:10px; }
.official-category-group { border:1px solid var(--line); border-radius:4px; padding:10px; background:#fff; }
.official-category-head { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.official-category-head button, .official-chip button { border:0; background:transparent; color:inherit; text-decoration:underline; cursor:pointer; font-size:11px; }
.official-account-manage-list { display:grid; gap:14px; }
.official-manage-card { display:grid; grid-template-columns:56px minmax(0,1fr); gap:14px; }
.official-manage-form { display:grid; gap:10px; margin-top:12px; }
.official-toggle { display:inline-flex; align-items:center; gap:6px; margin-right:12px; font-size:13px; color:var(--muted); }
.official-category-selects { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap:10px; }
.official-category-selects fieldset { border:1px solid var(--line); border-radius:4px; padding:8px; }
.official-category-selects legend { font-size:12px; color:var(--muted); padding:0 4px; }
.official-category-selects label { display:block; margin:4px 0; font-size:13px; }
.sub.success { color:#047857; }
.sub.error { color:#b91c1c; }
.sub.warning { color:#b45309; }
