/* Kesy Salesbot — marketing desk. Light, admincontrol-like; the selected region tints the accent. */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e5e7eb;
  --line-2: #f0f1f4;
  --accent: #EA580C;          /* region colour (IN orange · US blue · CA red), set by JS */
  --accent-soft: #FFF7ED;
  --good: #15803d; --good-soft: #dcfce7;
  --warn: #a16207; --warn-soft: #fef9c3;
  --bad: #b91c1c;  --bad-soft: #fee2e2;
  --info: #1d4ed8; --info-soft: #dbeafe;
  --plain-soft: #f3f4f6;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--accent); }
button { font: inherit; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ── Login ── */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 32px 28px; text-align: center; display: grid; gap: 14px; }
.login-mark, .brand-mark { display: inline-grid; place-items: center; width: 44px; height: 44px; margin: 0 auto; border-radius: 11px; background: var(--ink); color: #fff; font-weight: 800; font-size: 20px; }
.login-card h1 { font-size: 20px; }
.login-card p { margin: 0; }
.login-err { color: var(--bad); min-height: 20px; font-size: 13px; }
#login-step2 { display: grid; gap: 12px; text-align: left; }
#login-otp { letter-spacing: .4em; text-align: center; font-size: 20px; }

/* ── Shell ── */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-head { padding: 18px 16px 14px; border-bottom: 1px solid var(--line-2); display: grid; gap: 8px; }
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.brand-mark { width: 34px; height: 34px; margin: 0; font-size: 16px; border-radius: 9px; }
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.region-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.region-wrap { position: relative; }
.region-select { width: 100%; appearance: none; border: 2px solid var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; border-radius: 8px; padding: 8px 30px 8px 10px; cursor: pointer; }
.region-select:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.region-caret { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--accent); pointer-events: none; font-size: 12px; }
.nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; display: grid; align-content: start; gap: 2px; }
.nav-section { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; display: flex; align-items: center; gap: 6px; }
.nav-section:first-child { padding-top: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--plain-soft); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav a .ico { width: 18px; text-align: center; opacity: .85; }
.nav a .badge { margin-left: auto; }
.side-foot { padding: 12px 16px; border-top: 1px solid var(--line-2); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 14px 28px 0; min-height: 44px; }
.menu-btn { display: none; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.crumbs { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.page { padding: 10px 28px 48px; display: grid; gap: 18px; align-content: start; max-width: 1280px; width: 100%; }
.scrim { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(17, 24, 39, .35); z-index: 30; }
  .menu-btn { display: inline-block; }
  .topbar { padding: 12px 16px 0; }
  .page { padding: 8px 16px 40px; }
}

/* ── Page header ── */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.ph h1 { font-size: 22px; font-weight: 750; letter-spacing: -.01em; }
.ph p { margin: 4px 0 0; color: var(--muted); max-width: 68ch; }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.region-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 3px 9px; vertical-align: middle; }

/* ── Panels ── */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.panel-h h2 { font-size: 15px; font-weight: 700; }
.panel-h .sub { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.panel-b { padding: 16px; display: grid; gap: 14px; }
.panel-b.tight { padding: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 1100px) { .g-side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 800px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } }

/* ── Stat tiles ── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; align-content: start; min-width: 0; }
.tile .v { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile .l { font-size: 12.5px; color: var(--muted); }
.tile .s { font-size: 11.5px; color: var(--faint); }
.tile.good .v { color: var(--good); } .tile.bad .v { color: var(--bad); } .tile.accent .v { color: var(--accent); }
.tiles.in-panel .tile { border: 0; background: var(--bg); }

/* ── Funnel ── */
.funnel { display: grid; gap: 8px; }
.fstep { display: grid; grid-template-columns: 150px minmax(0, 1fr) 64px 52px; gap: 10px; align-items: center; font-size: 13px; }
.fstep .fl { color: var(--ink-2); }
.fbar { height: 22px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.fbar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; min-width: 2px; opacity: .9; }
.fstep .fv { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.fstep .fp { color: var(--muted); text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .fstep { grid-template-columns: 96px minmax(0, 1fr) 52px; } .fstep .fp { display: none; } }

/* ── Buttons & form ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 7px 12px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: #cfd3da; background: #fafafa; }
.btn:focus-visible, .btn-link:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #1f2937; border-color: #1f2937; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(.95); background: var(--accent); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: #fecaca; }
.btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; padding: 10px; }
.btn-link { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
.btn-link:hover { color: var(--ink); }
.field { display: grid; gap: 5px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; min-width: 0; }
.field small { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea, .inp { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; font-weight: 400; font-size: 13.5px; }
.field textarea, textarea.inp { min-height: 90px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: var(--mono); font-size: 12.5px; min-height: 280px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 10px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.check input { margin-top: 3px; }
.check small { display: block; color: var(--muted); font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

/* Toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: #d1d5db; position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked + .track { background: var(--good); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Pills ── */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; border-radius: 999px; padding: 2px 8px; white-space: nowrap; background: var(--plain-soft); color: var(--ink-2); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); }
.dot.on { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }

/* ── Tables ── */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #fafbfc; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl .t-main { font-weight: 600; color: var(--ink); }
.tbl .t-sub { font-size: 12px; color: var(--muted); }
.tbl .clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink-2); margin-bottom: 4px; font-size: 14px; }

/* ── Tabs / chips ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .c { opacity: .7; margin-left: 4px; font-weight: 500; }

/* ── Notices ── */
.note { border-radius: var(--radius); padding: 12px 14px; font-size: 13px; background: var(--info-soft); color: #1e3a8a; display: flex; gap: 10px; align-items: flex-start; }
.note.warn { background: var(--warn-soft); color: #713f12; }
.note.bad { background: var(--bad-soft); color: #7f1d1d; }
.note.plain { background: var(--plain-soft); color: var(--ink-2); }
.note b { font-weight: 700; }
.note p { margin: 0; }

/* ── Campaign cards ── */
.camp-list { display: grid; gap: 10px; }
.camp { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; }
.camp:hover { border-color: #cfd3da; }
.camp-name { font-weight: 700; font-size: 15px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.camp-meta { font-size: 12.5px; color: var(--muted); }
.camp-stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.camp-stats div { background: var(--bg); border-radius: 8px; padding: 6px 10px; }
.camp-stats b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.camp-stats span { font-size: 11.5px; color: var(--muted); }

/* ── Chart ── */
.chart svg { width: 100%; height: 160px; display: block; }
.chart .ax { fill: var(--faint); font-size: 10px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ── Inbox ── */
.inbox { display: grid; grid-template-columns: 360px minmax(0, 1fr); min-height: 620px; height: calc(100vh - 180px); }
.inbox-list { border-right: 1px solid var(--line); overflow-y: auto; min-width: 0; }
.inbox-filters { padding: 10px 12px; border-bottom: 1px solid var(--line-2); display: grid; gap: 8px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.thread { display: grid; gap: 3px; padding: 11px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.thread:hover { background: #fafbfc; }
.thread.on { background: var(--accent-soft); }
.thread-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.thread-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-time { font-size: 11.5px; color: var(--faint); flex: none; }
.thread-last { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread.unread .thread-name::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 2px; }
.convo { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.convo-h { padding: 12px 16px; border-bottom: 1px solid var(--line-2); display: grid; gap: 8px; }
.convo-msgs { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #fafbfc; }
.msg { max-width: 76%; display: grid; gap: 3px; }
.msg .b { padding: 9px 12px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; font-size: 13.5px; background: #fff; border: 1px solid var(--line); }
.msg.out { align-self: flex-end; }
.msg.out .b { background: #e8f0fe; border-color: #d2e3fc; }
.msg.out.by-ai .b { background: #f3e8ff; border-color: #e9d5ff; }
.msg.out.by-system .b { background: var(--plain-soft); border-color: var(--line); }
.msg .m { font-size: 11px; color: var(--faint); }
.msg.out .m { text-align: right; }
.msg .subj { font-weight: 700; font-size: 12.5px; }
.convo-reply { border-top: 1px solid var(--line-2); padding: 12px 16px; display: grid; gap: 8px; }
.ctx { display: grid; gap: 4px; font-size: 12.5px; background: var(--bg); border-radius: 8px; padding: 10px 12px; }
@media (max-width: 900px) { .inbox { grid-template-columns: minmax(0, 1fr); height: auto; } .inbox-list { max-height: 360px; border-right: 0; border-bottom: 1px solid var(--line); } .convo-msgs { max-height: 420px; } }

/* ── Social ── */
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.post { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: grid; grid-template-rows: auto 1fr; min-width: 0; }
.post img, .post .ph-img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--line-2); }
.post .ph-img { display: grid; place-items: center; color: var(--faint); font-size: 13px; }
.post-b { padding: 12px; display: grid; gap: 8px; align-content: start; }
.post-cap { font-size: 12.5px; color: var(--ink-2); white-space: pre-wrap; max-height: 9.5em; overflow: hidden; }
.review { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; padding: 16px; border-bottom: 1px solid var(--line-2); }
.review:last-child { border-bottom: 0; }
.review img, .review .ph-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--line-2); display: grid; place-items: center; color: var(--faint); }
@media (max-width: 760px) { .review { grid-template-columns: minmax(0, 1fr); } }

/* ── Template previews ── */
.wa-bubble { background: #dcf8c6; border-radius: 10px 10px 10px 2px; padding: 9px 12px; white-space: pre-wrap; font-size: 13px; max-width: 520px; border: 1px solid #c5ecb0; }
.email-prev { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; font-size: 13px; background: #fff; max-height: 360px; overflow: auto; }
.email-prev .subj { font-weight: 700; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line-2); white-space: normal; }

/* ── Activity ── */
.feed { display: grid; }
.feed-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line-2); align-items: start; }
.feed-item:last-child { border-bottom: 0; }
.feed-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--plain-soft); font-size: 14px; }
.feed-t { font-weight: 600; }
.feed-d { font-size: 12.5px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.feed-w { font-size: 11.5px; color: var(--faint); text-align: right; white-space: nowrap; display: grid; gap: 4px; justify-items: end; }

/* ── Batch card ── */
.batch { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 10px; background: #fff; }
.batch-h { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.removed-list { display: grid; gap: 4px; font-size: 12.5px; }
.removed-list div { display: flex; justify-content: space-between; gap: 10px; }
.progress { height: 6px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 40%; background: var(--accent); border-radius: 999px; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .progress i { animation: none; width: 100%; opacity: .5; } }

/* ── Windows editor ── */
.win-grid { display: grid; grid-template-columns: 60px repeat(2, minmax(0, 1fr)); gap: 6px 10px; align-items: center; font-size: 13px; }
.win-grid input { border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; width: 100%; }

/* ── Report ── */
.call-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.call-row:last-child { border-bottom: 0; }

/* ── Modal ── */
.modal-bg { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); display: grid; place-items: center; padding: 16px; z-index: 60; }
.modal { background: var(--panel); border-radius: 14px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.modal.wide { max-width: 860px; }
.modal-h { padding: 16px 18px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-h h3 { font-size: 16px; }
.modal-x { border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-b { padding: 16px 18px; display: grid; gap: 12px; overflow: auto; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.transcript { white-space: pre-wrap; font-size: 13px; background: var(--bg); border-radius: 8px; padding: 12px; max-height: 340px; overflow: auto; }

/* ── Toasts ── */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 80; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); max-width: 420px; }
.toast.err { background: var(--bad); }

.loading { padding: 40px; text-align: center; color: var(--faint); }
audio { width: 100%; height: 36px; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
hr.sep { border: 0; border-top: 1px solid var(--line-2); margin: 4px 0; }

/* Tab bodies stack their sections with the page rhythm */
#tab-body, #li-body { display: grid; gap: 16px; align-content: start; }
/* Setting rows: text on the left, control on the right, never wrapping under */
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.row > .inp { width: auto; flex: 0 1 auto; }
.t-main { font-weight: 600; color: var(--ink); }
.t-sub { font-size: 12px; color: var(--muted); }
