:root {
  --ink: #17211d;
  --ink-2: #24332d;
  --ink-3: #405149;
  --muted: #728078;
  --paper: #f4f0e7;
  --paper-2: #ebe4d7;
  --surface: #fffdf8;
  --surface-2: #faf7f0;
  --line: #d9d0c0;
  --line-strong: #c2b6a2;
  --accent: #cf4e2f;
  --accent-deep: #a7351f;
  --accent-soft: #f7dfd7;
  --jade: #2f7461;
  --jade-soft: #dcece6;
  --amber: #9b6818;
  --amber-soft: #f5e8cb;
  --danger: #b23a30;
  --danger-soft: #f6ddda;
  --shadow-sm: 0 1px 2px rgba(42, 34, 23, .04), 0 8px 24px -20px rgba(42, 34, 23, .45);
  --shadow-md: 0 2px 4px rgba(42, 34, 23, .04), 0 22px 54px -34px rgba(42, 34, 23, .62);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --display: "Source Han Serif SC", "Noto Serif SC", "Songti SC", SimSun, serif;
  --sans: "MiSans", "HarmonyOS Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 90% -8%, rgba(207,78,47,.10), transparent 62%),
    radial-gradient(820px 500px at -8% 108%, rgba(47,116,97,.10), transparent 60%),
    repeating-linear-gradient(90deg, rgba(96,82,61,.03) 0 1px, transparent 1px 88px),
    linear-gradient(180deg, var(--paper), #eee7db);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* Login */
.login-body { overflow-x: hidden; }
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 1.12fr) minmax(420px, .88fr);
}
.login-story {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100vh; padding: clamp(36px, 6vw, 88px);
  color: #f9f4e9;
  background: linear-gradient(145deg, rgba(15,28,23,.96), rgba(32,51,43,.98)), var(--ink);
}
.login-story::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(520px 520px at 82% 18%, rgba(207,78,47,.28), transparent 65%),
    radial-gradient(460px 460px at 8% 88%, rgba(91,159,137,.20), transparent 67%),
    repeating-linear-gradient(0deg, transparent 0 47px, rgba(255,255,255,.035) 47px 48px),
    repeating-linear-gradient(90deg, transparent 0 47px, rgba(255,255,255,.035) 47px 48px);
}
.login-story::after {
  content: "序"; position: absolute; right: -.12em; bottom: -.34em; z-index: -1;
  color: rgba(255,251,243,.035); font-family: var(--display);
  font-size: clamp(360px, 47vw, 760px); font-weight: 700; line-height: .8;
  transform: rotate(-7deg);
}
.story-brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 13px; color: #fff9ef;
  background: linear-gradient(150deg, var(--accent), #8e2e1a);
  box-shadow: 0 14px 28px -18px rgba(0,0,0,.82);
  font-family: var(--display); font-size: 21px; font-weight: 700;
}
.brand-copy strong {
  display: block; font-family: var(--display); font-size: 20px; letter-spacing: .08em;
}
.brand-copy span {
  display: block; margin-top: 3px; color: rgba(249,244,233,.60);
  font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
}
.story-center { max-width: 720px; margin-top: clamp(88px, 13vh, 160px); animation: rise .7s ease both; }
.story-eyebrow {
  display: flex; align-items: center; gap: 12px; margin: 0 0 24px;
  color: #d9a992; font-family: var(--mono); font-size: 12px; letter-spacing: .12em;
}
.story-eyebrow::before { content: ""; width: 36px; height: 1px; background: currentColor; }
.story-center h1 {
  max-width: 640px; margin: 0; font-family: var(--display);
  font-size: clamp(42px, 5.6vw, 82px); font-weight: 700;
  letter-spacing: -.035em; line-height: 1.14;
}
.story-center h1 em { color: #e28b69; font-style: normal; }
.story-center > p {
  max-width: 560px; margin: 26px 0 0; color: rgba(249,244,233,.68);
  font-size: 16px; line-height: 1.9;
}
.story-steps {
  display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1px;
  max-width: 700px; margin-top: clamp(52px, 9vh, 96px);
  border: 1px solid rgba(255,255,255,.12); border-radius: 18px;
  overflow: hidden; background: rgba(255,255,255,.10); animation: rise .7s .14s ease both;
}
.story-step { min-height: 126px; padding: 22px; background: rgba(16,31,25,.70); }
.story-step span { color: #dba086; font-family: var(--mono); font-size: 11px; }
.story-step strong { display: block; margin-top: 18px; font-size: 14px; letter-spacing: .04em; }
.story-step p { margin: 7px 0 0; color: rgba(249,244,233,.50); font-size: 12px; line-height: 1.65; }
.story-foot {
  position: absolute; left: clamp(36px,6vw,88px); bottom: 34px;
  color: rgba(249,244,233,.34); font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
}
.login-panel {
  min-height: 100vh; display: grid; place-items: center; padding: 32px; position: relative;
  background:
    radial-gradient(560px 420px at 100% 0, rgba(207,78,47,.07), transparent 60%),
    rgba(255,253,248,.62);
}
.login-card { width: min(410px,100%); animation: rise .6s .08s ease both; }
.login-card .mobile-brand { display: none; }
.login-kicker {
  margin: 0 0 12px; color: var(--accent); font-family: var(--mono);
  font-size: 11px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase;
}
.login-card h2 { margin: 0; font-family: var(--display); font-size: 36px; letter-spacing: -.02em; }
.login-intro { margin: 12px 0 34px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.form-stack { display: grid; gap: 20px; }
.field { display: grid; gap: 8px; }
.field > label, .field-label {
  color: var(--ink-3); font-size: 12px; font-weight: 700; letter-spacing: .04em;
}
.field input, .field select {
  width: 100%; height: 46px; padding: 0 14px; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  outline: none; background: var(--surface);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.field input:focus, .field select:focus {
  border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(207,78,47,.11);
}
.login-submit {
  width: 100%; height: 48px; margin-top: 4px; border: 0; border-radius: var(--radius-sm);
  color: #fff8ef; background: linear-gradient(150deg,var(--accent),var(--accent-deep));
  box-shadow: 0 16px 28px -20px rgba(167,53,31,.90); cursor: pointer;
  font-size: 14px; font-weight: 700; letter-spacing: .06em;
  transition: transform .18s, box-shadow .18s, opacity .18s;
}
.login-submit:hover { transform: translateY(-1px); box-shadow: 0 18px 36px -20px rgba(167,53,31,.95); }
.login-submit:disabled { cursor: wait; opacity: .55; transform: none; }
.form-error {
  display: none; padding: 11px 13px; color: var(--danger);
  border: 1px solid rgba(178,58,48,.24); border-radius: 9px;
  background: var(--danger-soft); font-size: 12px; line-height: 1.55;
}
.form-error.is-visible { display: block; }
.login-note {
  margin: 26px 0 0; padding-top: 20px; color: #999184;
  border-top: 1px solid var(--line); font-size: 11px; line-height: 1.75;
}

/* App shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0,1fr); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30; width: 248px;
  display: flex; flex-direction: column; overflow: hidden; color: #e9eee9;
  background:
    radial-gradient(320px 300px at 20% 0, rgba(207,78,47,.20), transparent 70%),
    linear-gradient(180deg,#182922,#12201a);
}
.sidebar::after {
  content: ""; position: absolute; right: -80px; bottom: -100px; width: 280px; height: 280px;
  border: 1px solid rgba(255,255,255,.055); border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(255,255,255,.025), 0 0 0 82px rgba(255,255,255,.018);
  pointer-events: none;
}
.sidebar-brand { display: flex; align-items: center; gap: 13px; padding: 28px 24px 24px; }
.sidebar-brand .brand-mark { width: 40px; height: 40px; border-radius: 12px; font-size: 19px; }
.sidebar-brand strong {
  display: block; color: #fffaf2; font-family: var(--display); font-size: 17px; letter-spacing: .06em;
}
.sidebar-brand span {
  display: block; margin-top: 4px; color: rgba(233,238,233,.38);
  font-family: var(--mono); font-size: 9px; letter-spacing: .13em;
}
.nav { display: grid; gap: 4px; padding: 12px 14px; }
.nav-label {
  padding: 14px 12px 8px; color: rgba(233,238,233,.33);
  font-family: var(--mono); font-size: 9px; letter-spacing: .16em; text-transform: uppercase;
}
.nav-item {
  width: 100%; min-height: 44px; display: flex; align-items: center; gap: 12px;
  padding: 0 13px; color: rgba(233,238,233,.68); border: 1px solid transparent;
  border-radius: 11px; background: transparent; cursor: pointer; text-align: left;
  font-size: 13px; font-weight: 600; transition: .18s ease;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; }
.nav-item:hover { color: #fffaf2; background: rgba(255,255,255,.055); }
.nav-item.is-active {
  color: #fffaf2; border-color: rgba(255,255,255,.075);
  background: linear-gradient(90deg, rgba(207,78,47,.24), rgba(255,255,255,.055));
  box-shadow: inset 2px 0 0 var(--accent);
}
.sidebar-foot { position: relative; z-index: 1; margin-top: auto; padding: 18px 16px 22px; }
.sidebar-user {
  display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center;
  gap: 10px; padding: 12px 11px; border: 1px solid rgba(255,255,255,.08);
  border-radius: 13px; background: rgba(255,255,255,.035);
}
.avatar {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px;
  color: #fff8ef; background: rgba(207,78,47,.74);
  font-family: var(--display); font-size: 16px; font-weight: 700;
}
.sidebar-user strong {
  display: block; overflow: hidden; color: #fffaf2; font-size: 12px;
  text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user span { display: block; margin-top: 3px; color: rgba(233,238,233,.42); font-size: 10px; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0;
  color: var(--muted); border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); cursor: pointer; transition: .18s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); transform: translateY(-1px); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.sidebar-user .icon-btn {
  color: rgba(233,238,233,.55); border-color: rgba(255,255,255,.09);
  background: rgba(255,255,255,.04);
}
.sidebar-user .icon-btn:hover { color: #fffaf2; }
.app-main { grid-column: 2; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 82px; display: flex;
  align-items: center; gap: 20px; padding: 16px clamp(22px,3.2vw,48px);
  border-bottom: 1px solid rgba(194,182,162,.62);
  background: rgba(244,240,231,.86); backdrop-filter: blur(16px);
}
.mobile-menu { display: none; }
.page-heading { min-width: 0; }
.page-heading h1 { margin: 0; font-family: var(--display); font-size: 23px; letter-spacing: .02em; }
.page-heading p {
  margin: 5px 0 0; overflow: hidden; color: var(--muted);
  font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap;
}
.top-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.date-chip {
  min-height: 36px; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; color: var(--ink-3); border: 1px solid var(--line);
  border-radius: 999px; background: rgba(255,253,248,.65);
  font-family: var(--mono); font-size: 10.5px;
}
.date-chip i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--jade);
  box-shadow: 0 0 0 4px rgba(47,116,97,.10);
}
.content {
  width: min(1600px,100%); margin: 0 auto;
  padding: clamp(22px,3vw,42px) clamp(18px,3.2vw,48px) 80px;
}
.view { display: none; animation: rise .38s ease both; }
.view.is-active { display: block; }

/* Shared */
.panel {
  overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: rgba(255,253,248,.92); box-shadow: var(--shadow-sm);
}
.panel-head {
  min-height: 64px; display: flex; align-items: center; gap: 12px;
  padding: 15px 19px; border-bottom: 1px dashed var(--line);
}
.panel-head h2 { margin: 0; font-family: var(--display); font-size: 16px; letter-spacing: .04em; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 10.5px; }
.panel-head .panel-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.panel-body { padding: 18px 19px; }
.btn {
  min-height: 38px; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 0 15px; color: var(--ink-2); border: 1px solid var(--line-strong);
  border-radius: 9px; background: var(--surface); cursor: pointer;
  font-size: 12.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
  transition: .18s ease;
}
.btn:hover {
  border-color: #aa9b84; transform: translateY(-1px);
  box-shadow: 0 10px 20px -17px rgba(42,34,23,.75);
}
.btn:active { transform: translateY(0); }
.btn:disabled { cursor: not-allowed; opacity: .48; transform: none; box-shadow: none; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; }
.btn-primary {
  color: #fff8ef; border-color: #96331f;
  background: linear-gradient(150deg,var(--accent),var(--accent-deep));
  box-shadow: 0 12px 22px -18px rgba(167,53,31,.90);
}
.btn-primary:hover { border-color: #7f2817; box-shadow: 0 14px 26px -18px rgba(167,53,31,1); }
.btn-dark { color: #fffaf2; border-color: var(--ink); background: var(--ink); }
.btn-ghost { color: var(--ink-3); border-color: transparent; background: transparent; }
.btn-ghost:hover { border-color: var(--line); background: var(--surface-2); box-shadow: none; }
.btn-danger { color: var(--danger); border-color: rgba(178,58,48,.25); background: var(--danger-soft); }
.btn-sm { min-height: 31px; padding: 0 10px; border-radius: 7px; font-size: 11px; }
.text-btn {
  padding: 0; color: var(--jade); border: 0; background: transparent;
  cursor: pointer; font-size: 11.5px; font-weight: 700;
}
.text-btn:hover { color: var(--ink); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 24px;
  padding: 0 8px; color: var(--ink-3); border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface-2); font-size: 10px;
  font-weight: 700; white-space: nowrap;
}
.chip i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status {
  display: inline-flex; align-items: center; gap: 6px; min-height: 24px;
  padding: 0 9px; border-radius: 999px; font-size: 10px; font-weight: 700; white-space: nowrap;
}
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-running, .status-submitting { color: var(--jade); background: var(--jade-soft); }
.status-queued { color: var(--amber); background: var(--amber-soft); }
.status-completed { color: #436a57; background: #e1ebe4; }
.status-failed, .status-needs_review { color: var(--danger); background: var(--danger-soft); }
.status-paused { color: var(--muted); background: #ece8df; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; }
.metric-card {
  position: relative; overflow: hidden; min-height: 126px; padding: 20px;
  border: 1px solid var(--line); border-radius: 14px;
  background: radial-gradient(180px 100px at 100% 0, rgba(207,78,47,.06), transparent 70%), var(--surface);
}
.metric-card::after {
  content: ""; position: absolute; right: 17px; bottom: 18px;
  width: 28px; height: 28px; border: 1px solid rgba(23,33,29,.08); border-radius: 50%;
}
.metric-card .metric-label { color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; }
.metric-card .metric-value {
  margin-top: 16px; font-family: var(--mono); font-size: 31px;
  font-weight: 650; letter-spacing: -.04em; line-height: 1;
}
.metric-card .metric-value small {
  margin-left: 3px; color: var(--muted); font-family: var(--sans);
  font-size: 11px; font-weight: 500;
}
.metric-card .metric-foot { margin-top: 12px; color: var(--muted); font-size: 10.5px; }
.progress { width: 100%; height: 6px; overflow: hidden; border-radius: 999px; background: #e8e2d7; }
.progress > span {
  display: block; width: var(--progress,0%); height: 100%; border-radius: inherit;
  background: linear-gradient(90deg,var(--jade),#5a9b85); transition: width .45s ease;
}
.progress.accent > span { background: linear-gradient(90deg,var(--accent),#e27859); }
.progress.amber > span { background: linear-gradient(90deg,var(--amber),#d2a746); }

/* Workbench */
.workbench-grid {
  display: grid; grid-template-columns: minmax(0,1fr);
  gap: 18px; align-items: start;
}
.intake-panel { min-height: 660px; }
.paste-wrap { position: relative; padding: 16px 18px 0; }
.paste-area {
  width: 100%; min-height: 188px; resize: vertical; display: block;
  padding: 16px 17px; color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 12px; outline: none; tab-size: 4;
  background:
    repeating-linear-gradient(0deg, transparent 0 25px, rgba(194,182,162,.16) 25px 26px),
    var(--surface);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.75;
  transition: border-color .2s, box-shadow .2s;
}
.paste-area:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(207,78,47,.10); }
.paste-area::placeholder { color: transparent; }
.paste-actions {
  display: flex; align-items: center; gap: 9px; padding: 12px 18px 16px;
}
.paste-actions .grow { flex: 1; }
.parse-meter {
  display: flex; align-items: center; gap: 9px; min-height: 34px;
  color: var(--muted); font-size: 11px;
}
.parse-meter b { color: var(--ink-2); font-family: var(--mono); font-size: 12px; }
.parse-meter .bad { color: var(--danger); }
.parse-meter .good { color: var(--jade); }
.review-area { border-top: 1px dashed var(--line); }
.table-shell { overflow: auto; max-height: 430px; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.data-table th {
  position: sticky; top: 0; z-index: 3;
  padding: 10px 11px; color: var(--ink-3); border-bottom: 1px solid var(--line-strong);
  background: #efe8dc; font-size: 10.5px; font-weight: 700;
  letter-spacing: .04em; text-align: left; white-space: nowrap;
}
.data-table td {
  padding: 9px 11px; border-bottom: 1px solid rgba(217,208,192,.62);
  vertical-align: middle;
}
.data-table tbody tr:nth-child(even) { background: rgba(250,247,240,.62); }
.data-table tbody tr:hover { background: rgba(247,223,215,.22); }
.data-table .num { width: 38px; color: var(--muted); font-family: var(--mono); text-align: center; }
.data-table .compact { width: 58px; text-align: center; }
.data-table .phone-col { width: 120px; }
.data-table .action-col { width: 42px; }
.table-input {
  width: 100%; min-width: 0; padding: 6px 7px; color: var(--ink);
  border: 1px solid transparent; border-radius: 6px; outline: none;
  background: transparent; font-size: 11.5px;
}
.table-input:focus { border-color: var(--line-strong); background: #fff; box-shadow: 0 0 0 2px rgba(207,78,47,.08); }
.table-input.phone { font-family: var(--mono); font-size: 11px; }
.review-table { min-width: 0; table-layout: fixed; }
.review-table th, .review-table td { padding-left: 5px; padding-right: 5px; }
.review-table th:nth-child(2) { width: 9%; }
.review-table th:nth-child(3) { width: 14%; }
.review-table th:nth-child(4) { width: 23%; }
.review-table th:nth-child(5) { width: 8%; }
.review-table th:nth-child(6) { width: 14%; }
.review-table th:nth-child(7) { width: 10%; }
.review-table th:nth-child(8) { width: 14%; }
.review-table .num { width: 30px; }
.review-table .action-col {
  position: sticky; right: 0; z-index: 2; width: 36px;
  background: #f5f0e7; box-shadow: -5px 0 8px rgba(55,45,31,.035);
}
.review-table thead .action-col { z-index: 4; background: #efe8dc; }
.review-table tbody tr:nth-child(even) .action-col { background: #f7f3eb; }
.review-table tbody tr:hover .action-col { background: #f7eee6; }
.row-invalid { background: rgba(178,58,48,.05) !important; }
.row-remove {
  width: 27px; height: 27px; display: inline-grid; place-items: center;
  padding: 0; color: var(--muted); border: 0; border-radius: 6px;
  background: transparent; cursor: pointer;
}
.row-remove:hover { color: var(--danger); background: var(--danger-soft); }
.row-remove svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.8; }
.review-foot {
  display: flex; align-items: center; gap: 10px; padding: 13px 18px;
  border-top: 1px dashed var(--line); background: rgba(250,247,240,.6);
}
.review-foot .grow { flex: 1; }
.queue-list { display: grid; gap: 9px; padding: 15px; max-height: 560px; overflow: auto; }
.queue-empty, .table-empty {
  padding: 42px 18px; color: var(--muted); text-align: center;
  font-size: 12px; line-height: 1.8;
}
.queue-item {
  padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); cursor: pointer; transition: .18s;
}
.queue-item:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.queue-item-top { display: flex; align-items: center; gap: 8px; }
.queue-item-top strong {
  min-width: 0; overflow: hidden; font-size: 11.5px;
  text-overflow: ellipsis; white-space: nowrap;
}
.queue-item-top .status { margin-left: auto; }
.queue-meta { display: flex; align-items: center; gap: 8px; margin-top: 11px; color: var(--muted); font-size: 10px; }
.queue-meta .mono { color: var(--ink-3); }
.queue-progress { margin-top: 10px; }
.summary-list { display: grid; gap: 11px; padding: 15px; }
.summary-card {
  padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface);
}
.summary-card-top { display: flex; align-items: center; gap: 8px; }
.summary-card-top strong { font-size: 11.5px; }
.summary-card-top span { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 9.5px; }
.summary-card p {
  display: -webkit-box; margin: 9px 0 0; overflow: hidden; color: var(--ink-3);
  font-size: 11px; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
}

/* Dashboard */
.hero-card {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end;
  gap: 24px; min-height: 210px; padding: clamp(24px,3vw,40px);
  color: #f8f2e7; border-radius: var(--radius-lg);
  background:
    radial-gradient(560px 300px at 95% 0, rgba(207,78,47,.30), transparent 70%),
    radial-gradient(420px 300px at 22% 130%, rgba(89,151,129,.22), transparent 70%),
    linear-gradient(135deg,#17251f,#223a30);
  box-shadow: var(--shadow-md);
}
.hero-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    repeating-linear-gradient(0deg, transparent 0 42px, rgba(255,255,255,.025) 42px 43px),
    repeating-linear-gradient(90deg, transparent 0 42px, rgba(255,255,255,.025) 42px 43px);
}
.hero-card::after {
  content: ""; position: absolute; right: -76px; top: -116px; z-index: -1;
  width: 330px; height: 330px; border: 1px solid rgba(255,255,255,.10); border-radius: 50%;
  box-shadow: 0 0 0 44px rgba(255,255,255,.028), 0 0 0 96px rgba(255,255,255,.018);
}
.hero-copy .eyebrow {
  margin: 0 0 16px; color: #dbb096; font-family: var(--mono);
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
}
.hero-copy h2 {
  max-width: 700px; margin: 0; font-family: var(--display);
  font-size: clamp(31px,4vw,52px); line-height: 1.22; letter-spacing: -.03em;
}
.hero-copy h2 em { color: #e68b69; font-style: normal; }
.hero-copy p { max-width: 610px; margin: 18px 0 0; color: rgba(248,242,231,.60); font-size: 12.5px; line-height: 1.8; }
.hero-side { position: relative; z-index: 1; min-width: 170px; text-align: right; }
.hero-side strong {
  display: block; font-family: var(--mono); font-size: clamp(48px,6vw,74px);
  font-weight: 600; line-height: 1; letter-spacing: -.06em;
}
.hero-side span { display: block; margin-top: 8px; color: rgba(248,242,231,.55); font-size: 11px; }
.dashboard-stack { display: grid; gap: 18px; margin-top: 18px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(330px,.75fr); gap: 18px; align-items: start; }
.section-head { display: flex; align-items: end; gap: 12px; margin: 0 0 12px; }
.section-head h2 { margin: 0; font-family: var(--display); font-size: 18px; letter-spacing: .03em; }
.section-head p { margin: 0 0 0 auto; color: var(--muted); font-size: 10.5px; }
.person-cell { display: flex; align-items: center; gap: 9px; }
.person-avatar {
  width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 9px; color: var(--jade); background: var(--jade-soft);
  font-family: var(--display); font-size: 12px; font-weight: 700;
}
.person-cell strong { display: block; font-size: 11.5px; }
.person-cell span { display: block; margin-top: 2px; color: var(--muted); font-size: 9.5px; }
.inline-progress { min-width: 128px; }
.inline-progress .progress { height: 5px; }
.inline-progress span { display: block; margin-top: 5px; color: var(--muted); font-family: var(--mono); font-size: 9.5px; }
.admin-table { min-width: 780px; }
.admin-table th { padding: 11px 13px; }
.admin-table td { padding: 11px 13px; font-size: 11.5px; }
.recent-summary-item {
  display: grid; grid-template-columns: 90px minmax(0,1fr) auto; gap: 12px;
  align-items: start; padding: 12px 15px; border-bottom: 1px solid var(--line);
}
.recent-summary-item:last-child { border-bottom: 0; }
.recent-summary-item .who strong { display: block; font-size: 11px; }
.recent-summary-item .who span { display: block; margin-top: 3px; color: var(--muted); font-family: var(--mono); font-size: 9px; }
.recent-summary-item p {
  display: -webkit-box; margin: 0; overflow: hidden; color: var(--ink-3);
  font-size: 10.5px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.recent-summary-item time { color: var(--muted); font-family: var(--mono); font-size: 9px; }

/* Settings/Accounts */
.settings-grid { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(320px,.9fr); gap: 18px; align-items: start; }
.settings-form { display: grid; gap: 20px; }
.form-section {
  display: grid; gap: 16px; padding-bottom: 19px;
  border-bottom: 1px dashed var(--line);
}
.form-section:last-child { padding-bottom: 0; border-bottom: 0; }
.form-section-title { display: flex; align-items: baseline; gap: 9px; }
.form-section-title h3 { margin: 0; font-family: var(--display); font-size: 14px; letter-spacing: .04em; }
.form-section-title span { color: var(--muted); font-size: 9.5px; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field-grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.caller-list { display: flex; flex-wrap: wrap; gap: 7px; min-height: 38px; align-items: center; }
.caller-tag {
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px;
  padding: 0 11px; color: var(--ink-2); border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface-2); font-family: var(--mono); font-size: 11px;
}
.caller-tag button {
  width: 16px; height: 16px; display: grid; place-items: center; padding: 0;
  color: var(--muted); border: 0; border-radius: 50%; background: transparent; cursor: pointer;
}
.caller-tag button:hover { color: var(--danger); background: var(--danger-soft); }
.inline-add { display: flex; gap: 8px; }
.inline-add .field { flex: 1; }
.inline-add .field input { height: 38px; }
.weekday-row { display: flex; flex-wrap: wrap; gap: 7px; }
.day-toggle {
  width: 38px; height: 34px; display: grid; place-items: center; padding: 0;
  color: var(--muted); border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); cursor: pointer; font-size: 11px; transition: .18s;
}
.day-toggle.is-on { color: #fffaf2; border-color: var(--jade); background: var(--jade); }
.window-list { display: grid; gap: 9px; }
.window-row { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 8px; }
.window-row input { height: 38px; }
.window-row span { color: var(--muted); font-size: 10px; }
.remove-window {
  width: 31px; height: 31px; display: grid; place-items: center; padding: 0;
  color: var(--muted); border: 1px solid transparent; border-radius: 7px;
  background: transparent; cursor: pointer;
}
.remove-window:hover { color: var(--danger); border-color: rgba(178,58,48,.18); background: var(--danger-soft); }
.form-actions {
  display: flex; align-items: center; gap: 10px; padding-top: 6px;
}
.form-actions .grow { flex: 1; }
.form-message { color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.form-message.ok { color: var(--jade); }
.form-message.err { color: var(--danger); }
.settings-side { display: grid; gap: 18px; }
.dialog-current {
  position: relative; overflow: hidden; padding: 22px;
  color: #f7f2e8; border-radius: 15px;
  background:
    radial-gradient(260px 190px at 100% 0, rgba(207,78,47,.28), transparent 70%),
    linear-gradient(145deg,#1a2a23,#253e33);
}
.dialog-current .small { color: rgba(247,242,232,.45); font-family: var(--mono); font-size: 9px; letter-spacing: .12em; }
.dialog-current strong {
  display: block; margin-top: 16px; font-family: var(--display);
  font-size: 23px; letter-spacing: .02em;
}
.dialog-current .id { margin-top: 9px; color: rgba(247,242,232,.52); font-family: var(--mono); font-size: 10px; }
.dialog-current .seal {
  position: absolute; right: 18px; top: 18px; width: 36px; height: 36px;
  display: grid; place-items: center; color: #f1b59d;
  border: 1px solid rgba(241,181,157,.32); border-radius: 50%;
  font-family: var(--display); font-size: 14px;
}
.hint-box {
  padding: 14px; color: var(--ink-3); border: 1px solid var(--line);
  border-radius: 11px; background: var(--surface-2); font-size: 10.5px; line-height: 1.7;
}
.accounts-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.accounts-head h2 { margin: 0; font-family: var(--display); font-size: 18px; }
.accounts-head .btn { margin-left: auto; }
.account-status { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; }
.account-status i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--jade);
  box-shadow: 0 0 0 3px rgba(47,116,97,.10);
}
.account-status.off { color: var(--muted); }
.account-status.off i { background: #a7aa9f; box-shadow: none; }

/* Batch detail */
.back-line { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.detail-hero {
  display: flex; align-items: center; gap: 20px; padding: 22px 24px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.detail-hero-main { min-width: 0; }
.detail-hero h2 {
  margin: 0; overflow: hidden; font-family: var(--display);
  font-size: 21px; text-overflow: ellipsis; white-space: nowrap;
}
.detail-hero .meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; color: var(--muted); font-size: 10.5px; }
.detail-hero .spacer { flex: 1; }
.detail-progress { min-width: 190px; }
.detail-progress .value {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px; color: var(--muted); font-size: 10px;
}
.detail-progress .value b { color: var(--ink); font-family: var(--mono); font-size: 20px; }
.detail-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.detail-grid .panel { min-height: 260px; }
.detail-list { max-height: 500px; overflow: auto; }
.ticket-item {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px;
  padding: 12px 15px; border-bottom: 1px solid var(--line);
}
.ticket-item:last-child { border-bottom: 0; }
.ticket-item strong { display: block; font-size: 11.5px; }
.ticket-item p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.ticket-phone { color: var(--ink-2); font-family: var(--mono); font-size: 10.5px; text-align: right; }
.call-item { padding: 12px 15px; border-bottom: 1px solid var(--line); }
.call-item:last-child { border-bottom: 0; }
.call-item-top { display: flex; align-items: center; gap: 8px; }
.call-item-top strong { font-family: var(--mono); font-size: 11px; }
.call-item-top span { margin-left: auto; color: var(--muted); font-size: 9.5px; }
.call-item p { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.summary-detail { padding: 13px 15px; border-bottom: 1px solid var(--line); }
.summary-detail:last-child { border-bottom: 0; }
.summary-detail-top { display: flex; align-items: center; gap: 7px; }
.summary-detail-top strong { font-family: var(--mono); font-size: 10.5px; }
.summary-detail-top .chip { margin-left: auto; }
.summary-detail p { margin: 9px 0 0; color: var(--ink-3); font-size: 10.5px; line-height: 1.7; }
.summary-detail .reason { color: var(--muted); }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag-row .chip { min-height: 20px; padding: 0 7px; font-size: 9px; }
.error-banner {
  display: flex; gap: 10px; margin-top: 14px; padding: 12px 14px; color: var(--danger);
  border: 1px solid rgba(178,58,48,.20); border-radius: 10px;
  background: var(--danger-soft); font-size: 11px; line-height: 1.6;
}

/* Dialog and toast */
.app-dialog {
  width: min(460px, calc(100vw - 32px)); padding: 0; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 17px;
  background: var(--surface); box-shadow: 0 34px 80px -36px rgba(30,24,14,.68);
}
.app-dialog::backdrop { background: rgba(19,29,25,.42); backdrop-filter: blur(4px); }
.dialog-head {
  display: flex; align-items: center; gap: 12px; padding: 19px 21px;
  border-bottom: 1px dashed var(--line);
}
.dialog-head h2 { margin: 0; font-family: var(--display); font-size: 17px; letter-spacing: .03em; }
.dialog-head .icon-btn { margin-left: auto; }
.dialog-body { display: grid; gap: 15px; padding: 20px 21px; }
.dialog-note { color: var(--muted); font-size: 10.5px; line-height: 1.7; }
.dialog-error {
  display: none; padding: 10px 12px; color: var(--danger); border-radius: 8px;
  background: var(--danger-soft); font-size: 11px; line-height: 1.55;
}
.dialog-error.is-visible { display: block; }
.dialog-actions {
  display: flex; justify-content: flex-end; gap: 9px; padding: 15px 21px;
  border-top: 1px dashed var(--line); background: rgba(250,247,240,.55);
}
.toast-region {
  position: fixed; right: 22px; bottom: 22px; z-index: 100;
  display: grid; gap: 9px; width: min(360px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  display: grid; grid-template-columns: 8px minmax(0,1fr); gap: 11px;
  padding: 13px 15px; color: #f7f2e8; border: 1px solid rgba(255,255,255,.08);
  border-radius: 11px; background: rgba(24,38,32,.96);
  box-shadow: 0 18px 42px -22px rgba(0,0,0,.72);
  font-size: 11.5px; line-height: 1.55; animation: toast-in .25s ease both;
  pointer-events: auto;
}
.toast::before { content: ""; width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: #7fc4a8; }
.toast.error::before { background: #e67666; }
.toast.warn::before { background: #e1ad58; }
.loading-shimmer {
  position: relative; overflow: hidden; min-height: 72px; border-radius: 10px;
  background: #eee8dd;
}
.loading-shimmer::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg,transparent,rgba(255,255,255,.55),transparent);
  animation: shimmer 1.2s infinite;
}

/* Responsive */
@media (max-width: 1180px) {
  .workbench-grid { grid-template-columns: minmax(0,1fr); }
  .intake-panel { min-height: auto; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-panel { min-height: 100vh; padding: 24px; }
  .login-card .mobile-brand {
    display: flex; align-items: center; gap: 12px; margin-bottom: 52px;
  }
  .mobile-brand .brand-copy strong { color: var(--ink); }
  .mobile-brand .brand-copy span { color: var(--muted); }
  .app-shell { display: block; }
  .sidebar {
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 24px 0 60px -30px rgba(0,0,0,.7);
  }
  .sidebar.is-open { transform: translateX(0); }
  .app-main { min-height: 100vh; }
  .mobile-menu { display: inline-grid; }
  .topbar { min-height: 74px; padding: 13px 17px; }
  .top-actions .date-chip { display: none; }
  .content { padding: 18px 14px 60px; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hero-card { grid-template-columns: 1fr; align-items: start; }
  .hero-side { text-align: left; }
}
@media (max-width: 640px) {
  .page-heading h1 { font-size: 20px; }
  .page-heading p { max-width: 210px; }
  .metric-grid { gap: 9px; }
  .metric-card { min-height: 110px; padding: 15px; }
  .metric-card .metric-value { margin-top: 12px; font-size: 27px; }
  .paste-wrap { padding: 12px 12px 0; }
  .paste-actions { padding: 10px 12px 13px; flex-wrap: wrap; }
  .parse-meter { width: 100%; }
  .paste-actions .grow { display: none; }
  .review-foot { padding: 11px 12px; flex-wrap: wrap; }
  .review-foot .grow { display: none; }
  .review-foot .btn-primary { flex: 1; }
  .panel-head { padding: 13px 14px; }
  .queue-list { padding: 11px; }
  .field-grid, .field-grid.three { grid-template-columns: 1fr; }
  .inline-add { flex-direction: column; }
  .detail-hero { align-items: flex-start; flex-wrap: wrap; padding: 17px; }
  .detail-hero h2 { font-size: 18px; white-space: normal; }
  .detail-hero .spacer { display: none; }
  .detail-progress { width: 100%; min-width: 0; }
  .detail-grid { grid-template-columns: 1fr; }
  .recent-summary-item { grid-template-columns: 1fr; gap: 5px; }
  .recent-summary-item time { display: none; }
  .dialog-actions .btn { flex: 1; }
  .toast-region { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes shimmer {
  to { transform: translateX(100%); }
}
