/* MoSCoW Prospect — design system (neutral, flat, no gradients) */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #e4e4e7;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #09090b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --primary: #18181b;
  --primary-hover: #27272a;
  --on-primary: #fafafa;
  --ring: rgba(24, 24, 27, .12);
  --green: #15803d;   --green-bg: #f0fdf4;  --green-bd: #bbf7d0;
  --amber: #b45309;   --amber-bg: #fffbeb;  --amber-bd: #fde68a;
  --red: #b91c1c;     --red-bg: #fef2f2;    --red-bd: #fecaca;
  --blue: #1d4ed8;    --blue-bg: #eff6ff;   --blue-bd: #bfdbfe;
  --wa: #16a34a;
  --star: #eab308;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .06);
  --sidebar: 248px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #09090b;
  --surface: #111113;
  --surface-2: #18181b;
  --surface-3: #27272a;
  --border: #27272a;
  --border-strong: #3f3f46;
  --text: #fafafa;
  --text-2: #d4d4d8;
  --muted: #a1a1aa;
  --faint: #71717a;
  --primary: #fafafa;
  --primary-hover: #e4e4e7;
  --on-primary: #09090b;
  --ring: rgba(250, 250, 250, .14);
  --green: #4ade80;   --green-bg: rgba(34, 197, 94, .1);   --green-bd: rgba(34, 197, 94, .25);
  --amber: #fbbf24;   --amber-bg: rgba(245, 158, 11, .1);  --amber-bd: rgba(245, 158, 11, .25);
  --red: #f87171;     --red-bg: rgba(239, 68, 68, .1);     --red-bd: rgba(239, 68, 68, .25);
  --blue: #60a5fa;    --blue-bg: rgba(59, 130, 246, .1);   --blue-bd: rgba(59, 130, 246, .25);
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
svg.i { width: 16px; height: 16px; flex: none; stroke-width: 1.75; vertical-align: middle; }
svg.i.sm { width: 14px; height: 14px; }
svg.i.lg { width: 20px; height: 20px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; padding: 16px 12px; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.mark { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 700; font-size: 14px; letter-spacing: -.02em; flex: none; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -.01em; line-height: 1.15; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; font-weight: 500; transition: background .12s, color .12s; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.nav a .count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }
.side-status { margin-top: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; font-size: 12.5px; }
.side-status .row { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.side-status .row span:last-child { margin-left: auto; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.on { background: var(--wa); box-shadow: 0 0 0 3px color-mix(in srgb, var(--wa) 20%, transparent); }
.dot.warn { background: #f59e0b; }
.dot.err { background: #ef4444; }
.side-foot { display: flex; gap: 6px; padding-top: 10px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); margin-top: 10px; }
.side-user .su-av { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-2); flex: none; }
.side-user .su-txt { min-width: 0; line-height: 1.25; }
.side-user .su-txt b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .su-txt span { font-size: 11.5px; color: var(--muted); }
.nav a .count.alert:not(:empty) { background: var(--red); color: #fff; border-radius: 999px; min-width: 18px; height: 18px; display: inline-grid; place-items: center; padding: 0 5px; font-size: 11px; font-weight: 600; }

/* cookie consent */
.cookie-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 55; margin: 0 auto; max-width: 720px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.cookie-txt { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-2); min-width: 240px; flex: 1; }
.cookie-txt svg { flex: none; margin-top: 1px; color: var(--faint); }
.cookie-actions { display: flex; gap: 8px; flex: none; }

.topbar { display: none; }
.tabbar { display: none; }
main { min-width: 0; padding: 28px 32px 96px; max-width: 1480px; width: 100%; }

/* ---------------------------------------------------------------- page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 550; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, opacity .12s, box-shadow .12s; box-shadow: var(--shadow-sm); text-decoration: none; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.danger { color: var(--red); }
.btn.danger:hover:not(:disabled) { background: var(--red-bg); border-color: var(--red-bd); }
.btn.solid-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn.wa svg { color: var(--wa); }

/* ---------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); min-width: 0; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat-top svg { color: var(--faint); }
.stat-value { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.flash .stat-value { animation: flash .6s ease; }
@keyframes flash { 30% { color: var(--wa); } }
.meter { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.meter > div { height: 100%; background: var(--text); width: 0; transition: width .4s; border-radius: 4px; }
.meter.green > div { background: var(--wa); }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; }

/* live banner */
.live { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.live .txt { min-width: 0; flex: 1; }
.live .txt b { font-weight: 600; }
.live .txt div { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live .meter { width: 160px; margin: 0; }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 550; color: var(--text-2); }
.hint, .field > span.hint { font-size: 12px; font-weight: 400; color: var(--muted); }
.input, .select, textarea.input { width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s; box-shadow: var(--shadow-sm); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.input:focus, .select:focus { border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--ring); }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 34px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span-2 { grid-column: 1 / -1; }
.range-row { display: flex; align-items: center; gap: 14px; }
input[type=range] { flex: 1; accent-color: var(--primary); height: 20px; margin: 0; }
.range-row .input { width: 88px; text-align: right; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 13.5px; color: var(--text-2); }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 20px; background: var(--surface-3); position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(14px); background: var(--on-primary); }
.check { appearance: none; width: 16px; height: 16px; border: 1.5px solid var(--border-strong); border-radius: 4px; background: var(--surface); cursor: pointer; display: inline-grid; place-items: center; margin: 0; vertical-align: middle; transition: background .1s, border-color .1s; }
.check:checked, .check:indeterminate { background: var(--primary); border-color: var(--primary); }
.check:checked::after { content: ""; width: 8px; height: 4px; border: 2px solid var(--on-primary); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check:indeterminate::after { content: ""; width: 8px; height: 2px; background: var(--on-primary); }

/* ---------------------------------------------------------------- toolbar & chips */
.toolbar { display: flex; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.toolbar .input-icon { flex: 1 1 260px; }
.toolbar .select { width: auto; min-width: 150px; flex: 0 1 180px; }
.chips { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px dashed var(--border-strong); background: transparent; font-size: 12.5px; font-weight: 500; color: var(--text-2); cursor: pointer; transition: all .12s; }
.chip:hover { background: var(--surface-2); }
.chip.active { border-style: solid; border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
.chips .count { margin-left: auto; font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- table */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); text-align: left; font-weight: 550; font-size: 12.5px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable svg { opacity: .5; margin-left: 2px; }
th.sorted svg { opacity: 1; color: var(--text); }
tbody td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr { cursor: pointer; transition: background .08s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.selected { background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
tbody tr.fresh { animation: rowIn 1.8s ease; }
@keyframes rowIn { 0% { background: var(--green-bg); } 100% { background: transparent; } }
tbody tr:last-child td { border-bottom: 0; }
td.cb, th.cb { width: 40px; padding-right: 0; }
.col-addr .cell-sub { max-width: 240px; }
.cell-name { font-weight: 600; color: var(--text); max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-sub { font-size: 12.5px; color: var(--muted); max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-phone { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 500; }
.icons-row { display: flex; gap: 4px; }
.icon-pill { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; border: 1px solid var(--border); color: var(--muted); background: var(--surface); }
.icon-pill.on { color: var(--text); }
.icon-pill.off { opacity: .35; }
.rating { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rating svg { color: var(--star); fill: var(--star); }
.rating small { color: var(--muted); font-weight: 400; }
.go { color: var(--faint); width: 32px; }
tr:hover .go { color: var(--text); }
.empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.empty svg { width: 28px; height: 28px; color: var(--faint); margin-bottom: 8px; }
.empty b { display: block; color: var(--text); font-weight: 600; margin-bottom: 4px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 550; border: 1px solid var(--border); color: var(--text-2); background: var(--surface-2); white-space: nowrap; }
.badge svg { width: 12px; height: 12px; }
.badge.green { color: var(--green); background: var(--green-bg); border-color: var(--green-bd); }
.badge.amber { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-bd); }
.badge.red { color: var(--red); background: var(--red-bg); border-color: var(--red-bd); }
.badge.blue { color: var(--blue); background: var(--blue-bg); border-color: var(--blue-bd); }
.badges { display: flex; gap: 4px; flex-wrap: wrap; }

/* pagination */
.card { scroll-margin-top: 16px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); border-radius: 0 0 var(--radius) var(--radius); font-size: 13px; color: var(--muted); }
.pg-info { display: grid; gap: 6px; min-width: 0; }
.pg-info b { color: var(--text); font-weight: 600; }
.pg-meter { width: 132px; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.pg-meter > div { height: 100%; background: var(--text); border-radius: 3px; transition: width .25s ease; }
.pg-nav { display: flex; align-items: center; gap: 4px; }
.pg-pages { display: flex; align-items: center; gap: 2px; padding: 2px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.pg-btn, .pg-num { display: inline-grid; place-items: center; height: 32px; min-width: 32px; padding: 0 8px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--text-2); font-weight: 550; font-size: 13px; cursor: pointer; transition: background .12s, color .12s, border-color .12s, box-shadow .12s; -webkit-tap-highlight-color: transparent; }
.pg-btn { border-color: var(--border); background: var(--surface); box-shadow: var(--shadow-sm); padding: 0; width: 34px; height: 34px; }
.pg-btn.pg-wide { display: inline-flex; gap: 6px; width: auto; padding: 0 12px 0 10px; }
.pg-btn[data-nav="next"].pg-wide { padding: 0 10px 0 12px; }
.pg-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.pg-num { height: 28px; min-width: 30px; border-radius: 6px; }
.pg-num:hover:not(.active) { background: var(--surface); color: var(--text); }
.pg-num.active { background: var(--primary); color: var(--on-primary); cursor: default; box-shadow: var(--shadow); }
.pg-gap { color: var(--faint); }
.pg-gap svg { display: none; }
.pg-gap:hover span { display: none; }
.pg-gap:hover svg { display: block; }
.pg-btn:focus-visible, .pg-num:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-color: var(--border-strong); }
.pg-compact { display: none; padding: 0 10px; white-space: nowrap; color: var(--muted); }
.pg-compact b { color: var(--text); font-weight: 600; }
@media (max-width: 1100px) { .pg-btn .lbl { display: none; } .pg-btn.pg-wide { width: 34px; padding: 0; } }

/* bulk bar */
.bulkbar { position: fixed; left: calc(50% + var(--sidebar) / 2); bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 30; display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 16px; border-radius: 12px; background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-lg); transition: all .18s ease; }
.bulkbar.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.bulkbar .n { font-weight: 600; margin-right: 8px; white-space: nowrap; }
.bulkbar .btn { background: transparent; border-color: transparent; color: var(--on-primary); box-shadow: none; }
.bulkbar .btn:hover:not(:disabled) { background: color-mix(in srgb, var(--on-primary) 12%, transparent); }
.bulkbar .sep { width: 1px; height: 20px; background: color-mix(in srgb, var(--on-primary) 20%, transparent); margin: 0 2px; }

/* ---------------------------------------------------------------- drawer (detail) */
.overlay { position: fixed; inset: 0; background: rgba(9, 9, 11, .45); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .18s; }
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--surface); border-left: 1px solid var(--border); z-index: 41; transform: translateX(100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.drawer.show { transform: translateX(0); }
.drawer-head { padding: 20px 24px 0; }
.drawer-top { display: flex; align-items: flex-start; gap: 12px; }
.drawer-top .avatar { width: 44px; height: 44px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-2); flex: none; }
.drawer-top h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; line-height: 1.3; }
.drawer-top .meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; padding: 10px 12px; font-weight: 550; font-size: 13.5px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab .badge { height: 18px; padding: 0 6px; font-size: 11px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 32px; overscroll-behavior: contain; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.dl > div { padding: 10px 14px; border-bottom: 1px solid var(--border); min-width: 0; }
.dl > div:nth-last-child(-n+2) { border-bottom: 0; }
.dl dt, .dl .k { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; background: var(--surface-2); }
.dl .v { display: flex; align-items: center; gap: 8px; justify-content: space-between; word-break: break-word; }
.dl .v a { color: var(--blue); text-decoration: none; }
.dl .v a:hover { text-decoration: underline; }
.copy { opacity: .5; }
.copy:hover { opacity: 1; }
.section-title { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 24px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.map-frame { width: 100%; height: 220px; border: 1px solid var(--border); border-radius: var(--radius); display: block; background: var(--surface-2); }
.prose { color: var(--text-2); line-height: 1.6; white-space: pre-line; }

/* catalog */
.cat-summary { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 6px; background: var(--surface-2); }
.cat-summary .range { font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.cat-pills { display: flex; gap: 6px; overflow-x: auto; padding: 16px 0 12px; scrollbar-width: none; }
.cat-pill { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 550; color: var(--text-2); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.cat-pill span { color: var(--muted); font-weight: 500; }
.cat-pill.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.cat-pill.active span { color: inherit; opacity: .7; }
.items { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.item { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item .n { font-weight: 550; }
.item .d { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.item .p { font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.item .p.nc { color: var(--faint); font-weight: 500; }
.sources { display: grid; gap: 4px; font-size: 12.5px; }
.sources a { color: var(--blue); text-decoration: none; word-break: break-all; }
.state { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 28px 20px; text-align: center; color: var(--muted); }
.state svg { width: 22px; height: 22px; color: var(--faint); margin-bottom: 6px; }
.state b { display: block; color: var(--text); font-weight: 600; margin-bottom: 4px; }
.state .btn { margin-top: 14px; }
.skeleton { height: 14px; border-radius: 6px; background: var(--surface-2); margin: 10px 0; animation: pulse 1.4s ease infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* security */
.icon-pill.sec.green { color: var(--green); border-color: var(--green-bd); background: var(--green-bg); }
.icon-pill.sec.amber { color: var(--amber); border-color: var(--amber-bd); background: var(--amber-bg); }
.icon-pill.sec.red { color: var(--red); border-color: var(--red-bd); background: var(--red-bg); }
.sec-hero { display: flex; align-items: center; gap: 16px; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface-2); }
.sec-score { flex: none; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; line-height: 1; border: 3px solid var(--border-strong); }
.sec-score.green { border-color: var(--green); color: var(--green); background: var(--green-bg); }
.sec-score.amber { border-color: var(--amber); color: var(--amber); background: var(--amber-bg); }
.sec-score.red { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.sec-num { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sec-max { font-size: 11px; opacity: .7; margin-top: 1px; }
.sec-hero-txt { min-width: 0; display: grid; gap: 6px; }
.sec-grade { font-size: 16px; font-weight: 650; }
.sec-grade.green { color: var(--green); } .sec-grade.amber { color: var(--amber); } .sec-grade.red { color: var(--red); }
.sec-counts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.sec-list { display: grid; gap: 8px; }
.sec-item { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.sec-item.fail { border-color: var(--red-bd); background: var(--red-bg); }
.sec-item.warn { border-color: var(--amber-bd); background: var(--amber-bg); }
.sec-ic { flex: none; margin-top: 1px; color: var(--faint); }
.sec-ic.green { color: var(--green); } .sec-ic.amber { color: var(--amber); } .sec-ic.red { color: var(--red); }
.sec-body { min-width: 0; flex: 1; }
.sec-head { display: flex; align-items: center; gap: 8px; }
.sec-head b { font-weight: 600; font-size: 13.5px; }
.sec-detail { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.sec-fix { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; align-items: flex-start; gap: 6px; }
.sec-fix svg { flex: none; margin-top: 1px; color: var(--faint); }

/* timeline */
.timeline { display: grid; gap: 10px; }
.msg { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.msg-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.msg-head .badge { margin-left: auto; }
.msg-body { white-space: pre-wrap; color: var(--text-2); font-size: 13.5px; }

/* ---------------------------------------------------------------- modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(9, 9, 11, .5); opacity: 0; pointer-events: none; transition: opacity .15s; }
.modal.show { opacity: 1; pointer-events: auto; }
.modal-box { width: min(680px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); transform: scale(.98); transition: transform .15s; }
.modal.show .modal-box { transform: scale(1); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 650; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-body { padding: 18px 22px; display: grid; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.notice { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; border: 1px solid var(--amber-bd); background: var(--amber-bg); color: var(--amber); }
.notice.info { border-color: var(--border); background: var(--surface-2); color: var(--text-2); }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 550; font-size: 13px; cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.vars { display: flex; gap: 6px; flex-wrap: wrap; }
.vars button { font-family: var(--mono); font-size: 12px; height: 24px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; color: var(--text-2); }
.preview { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-height: 96px; background: var(--surface-2); }
.preview iframe { width: 100%; height: 460px; border: 0; border-radius: 8px; background: #fff; }
.bubble { background: #d9fdd3; color: #111b21; border-radius: 10px 10px 2px 10px; padding: 10px 12px; max-width: 92%; margin-left: auto; white-space: pre-wrap; box-shadow: 0 1px 1px rgba(0,0,0,.08); font-size: 14px; }
:root[data-theme="dark"] .bubble { background: #005c4b; color: #e9edef; }

/* ---------------------------------------------------------------- misc blocks */
.kv { display: grid; gap: 10px; }
.kv .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.kv .row span:first-child { color: var(--muted); }
.bot-state { display: flex; align-items: center; gap: 12px; }
.bot-state .icon-box { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); display: grid; place-items: center; }
.bot-state b { font-size: 15px; display: block; }
.bot-state small { color: var(--muted); }
.qr { width: 220px; height: 220px; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; background: #fff; display: block; margin: 12px auto 0; }
.log { font-family: var(--mono); font-size: 12px; color: var(--muted); display: grid; gap: 4px; max-height: 220px; overflow: auto; }
.log div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log div:first-child { color: var(--text); }
.progress-num { font-size: 32px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.seg-filter { display: flex; gap: 2px; padding: 12px 16px; border-bottom: 1px solid var(--border); overflow-x: auto; }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toastIn .2s ease; }
.toast svg { margin-top: 1px; }
.toast.ok svg { color: var(--green); }
.toast.err svg { color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1560px) {
  .col-addr { display: none; }
}
@media (max-width: 1280px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .col-addr { display: none; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--border); }
  .topbar .brand { padding: 0; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px 9px; font-size: 11px; font-weight: 550; color: var(--muted); text-decoration: none; }
  .tabbar a.active { color: var(--text); }
  .tabbar svg.i { width: 20px; height: 20px; }
  main { padding: 18px 16px calc(120px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 20px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 10px 12px; }
  .stat-top { font-size: 12px; }
  .stat-value { font-size: 20px; margin-top: 2px; }
  .toolbar .select { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .live .meter { display: none; }
  .bulkbar { left: 50%; bottom: calc(72px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); overflow-x: auto; }
  .bulkbar .lbl { display: none; }
  .drawer { width: 100vw; border-left: 0; }
  .drawer-head { padding: 16px 16px 0; padding-top: max(16px, env(safe-area-inset-top)); }
  .drawer-body { padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); }
  .dl { grid-template-columns: 1fr; }
  .dl dt, .dl .k { border-bottom: 0 !important; padding-bottom: 2px !important; background: transparent; font-size: 12px; }
  .dl .v { padding-top: 0 !important; }
  .modal { align-items: end; padding: 0; }
  .modal-box { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .modal-foot { border-radius: 0; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .card { scroll-margin-top: 72px; }
  .pager { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 16px 14px; }
  .pg-info { justify-items: center; text-align: center; }
  .pg-meter { width: 100%; }
  .pg-nav { justify-content: space-between; gap: 6px; }
  .pg-pages { display: none; }
  .pg-compact { display: block; flex: 1; text-align: center; }
  .pg-btn, .pg-btn.pg-wide { width: 44px; height: 40px; }
  .toasts { left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); width: auto; }

  /* table → cards */
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { position: relative; padding: 14px 16px 14px 48px; border-bottom: 1px solid var(--border); }
  table.responsive td { border: 0; padding: 0; }
  table.responsive td.cb { position: absolute; left: 16px; top: 16px; width: auto; }
  table.responsive td.go { position: absolute; right: 12px; top: 16px; width: auto; }
  table.responsive td.c-name { padding-right: 28px; }
  table.responsive td.c-city, table.responsive td.col-addr { display: none; }
  table.responsive td.c-phone { margin-top: 8px; display: inline-block; width: auto; margin-right: 12px; }
  table.responsive td.c-rating { display: inline-block; width: auto; margin-right: 12px; }
  table.responsive td.c-contact { display: inline-block; width: auto; vertical-align: middle; }
  table.responsive td.c-price, table.responsive td.c-status { margin-top: 8px; display: inline-block; width: auto; margin-right: 6px; }
  .cell-name, .cell-sub { max-width: none; white-space: normal; }
  #outbox td.o-body { display: none; }
}
@media (hover: none) {
  tbody tr:hover { background: transparent; }
}

/* ---------------------------------------------------------------- reports */
.rp-period { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 16px; }
.rp-period .seg { overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.rp-period .seg button { white-space: nowrap; flex: 0 0 auto; }
.rp-dates { display: flex; gap: 10px; }
.rp-dates .field { grid-template-columns: auto 150px; align-items: center; gap: 8px; }
.rp-dates .field > span { color: var(--muted); font-weight: 500; }
.rp-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.rp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }
.sw.ink { background: var(--text); }
.sw.green { background: var(--wa); }
.rp-chart { display: flex; align-items: flex-end; gap: 2px; height: 180px; padding-bottom: 20px; position: relative; border-bottom: 1px solid var(--border); }
.rp-day { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 1px; position: relative; border-radius: 3px; }
.rp-day:hover { background: var(--surface-2); }
.rp-day i { display: block; flex: 1 1 0; max-width: 12px; min-height: 0; border-radius: 2px 2px 0 0; background: var(--text); }
.rp-day i.s { background: var(--wa); }
.rp-day small { position: absolute; bottom: -19px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rp-chart .empty { position: absolute; inset: 0; padding: 0; display: grid; place-items: center; }
.rp-split { grid-template-columns: 1fr 1fr; }
.rp-bars { display: grid; gap: 12px; }
.rp-bar-row { display: grid; gap: 5px; font-size: 13px; }
.rp-bar-row .top { display: flex; justify-content: space-between; gap: 8px; }
.rp-bar-row .top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-bar-row .top b { font-variant-numeric: tabular-nums; font-weight: 600; }
.rp-bar-row .top b small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.rp-bar-row .meter { margin-top: 0; height: 6px; }
.rp-form { display: grid; gap: 16px; }
.rp-emails { display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-sm); cursor: text; transition: border-color .12s, box-shadow .12s; }
.rp-emails:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--ring); }
.rp-emails.invalid { border-color: var(--red); }
.rp-chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 9px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; max-width: 100%; }
.rp-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-chip button { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.rp-chip button:hover { background: var(--border); color: var(--text); }
.rp-chip button svg { width: 12px; height: 12px; }
.rp-email-input { flex: 1 1 160px; min-width: 120px; height: 26px; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 13px; padding: 0 4px; }
.rp-freq { width: 100%; }
.rp-freq button { flex: 1 1 0; justify-content: center; padding: 0 6px; }
.rp-form-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rp-form.readonly .rp-chip button, .rp-form.readonly .rp-email-input, .rp-form.readonly .rp-form-foot .btn { display: none; }
.rp-form.readonly .seg button { pointer-events: none; }
.rp-top { display: grid; }
.rp-top .item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--border); cursor: pointer; }
.rp-top .item:last-child { border-bottom: 0; }
.rp-top .item:hover { background: var(--surface-2); }
.rp-top .item div { min-width: 0; }
.rp-top .item b { display: block; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-top .item small { color: var(--muted); font-size: 12px; }
.rp-loading { opacity: .55; transition: opacity .15s; }
@media (max-width: 900px) {
  .rp-period { align-items: stretch; }
  .rp-dates { width: 100%; }
  .rp-dates .field { flex: 1 1 0; grid-template-columns: 1fr; gap: 4px; }
  .rp-split { grid-template-columns: 1fr; }
  .rp-chart { height: 150px; }
  .rp-legend { display: none; }
}
