/* ------------------------------------------------------------------
   AI Sales Agent Platform — admin styles

   Same tokens as the chat widget, so the two never drift apart.
   Deliberately plain: this is a working tool, not a showcase.
   ------------------------------------------------------------------ */

:root {
  --ink: #0F2138;
  --ink-soft: #4A5C72;
  --ink-faint: #7A8899;
  --paper: #FFFFFF;
  --wash: #F4F6F9;
  --line: #DCE3EC;
  --accent: #1B4E8F;
  --accent-dark: #17427A;
  --accent-wash: #ECF2F9;
  --signal: #8A5100;
  --signal-wash: #FBF3E6;
  --signal-line: #EBDCC2;
  --ok: #14663F;
  --ok-wash: #E8F3ED;
  --ok-line: #C2DED0;
  --danger: #A32318;
  --danger-wash: #FBEDEC;
  --danger-line: #EFCFCC;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--wash);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

h1, h2, h3, h4 { margin: 0 0 12px; line-height: 1.3; font-weight: 600; letter-spacing: -0.005em; }
h1 { font-size: 23px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

code, pre, .mono { font-family: var(--mono); font-size: 13px; }
pre {
  background: var(--ink); color: #E6EDF5; padding: 13px 15px;
  border-radius: var(--radius); overflow-x: auto; line-height: 1.5;
}
code { background: var(--wash); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; }
pre code { background: none; border: 0; padding: 0; color: inherit; }

/* ---------------- Layout ---------------- */

.shell { display: flex; min-height: 100vh; }

.side {
  width: 232px; flex: 0 0 232px; background: var(--ink); color: #C9D6E5;
  padding: 18px 0; display: flex; flex-direction: column;
}
.side-brand { padding: 0 20px 18px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 14px; }
.side-brand strong { display: block; color: #fff; font-size: 15px; font-weight: 600; }
.side-brand span { display: block; font-size: 11.5px; color: #8FA5BE; margin-top: 2px; }

.side-group { padding: 0 12px; margin-bottom: 18px; }
.side-group p {
  margin: 0 8px 6px; font-size: 10.5px; letter-spacing: .09em;
  text-transform: uppercase; color: #7B93AE; font-weight: 700;
}
.side a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-radius: 5px; color: #C9D6E5;
  text-decoration: none; font-size: 14px;
}
.side a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side a.is-active { background: var(--accent); color: #fff; font-weight: 500; }
.side a .tally {
  background: rgba(255,255,255,.16); color: #fff; font-size: 11px;
  border-radius: 999px; padding: 1px 7px; font-variant-numeric: tabular-nums;
}
.side a.is-active .tally { background: rgba(0,0,0,.22); }
.side-foot { margin-top: auto; padding: 14px 20px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: 12.5px; }
.side-foot a { padding: 4px 0; }

.main { flex: 1 1 auto; min-width: 0; }
.topbar {
  background: var(--paper); border-bottom: 1px solid var(--line);
  padding: 14px 28px; display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-size: 19px; flex: 1 1 auto; }
.content { padding: 24px 28px 60px; max-width: 1180px; }

/* ---------------- Cards and tables ---------------- */

.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px; padding: 20px 22px; margin-bottom: 18px;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; flex: 1 1 auto; }
.lede { color: var(--ink-soft); margin-bottom: 18px; }
.muted { color: var(--ink-faint); }
.small { font-size: 13px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }

.stat {
  background: var(--paper); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 5px; padding: 14px 16px;
}
.stat b { display: block; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat span { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }
.stat.is-signal { border-left-color: var(--signal); }
.stat.is-ok { border-left-color: var(--ok); }
.stat.is-danger { border-left-color: var(--danger); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 700; padding: 0 12px 8px 0;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--wash); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

.empty {
  text-align: center; padding: 34px 20px; color: var(--ink-faint);
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--wash);
}

/* ---------------- Pills and badges ---------------- */

.pill {
  display: inline-block; font-size: 11.5px; font-weight: 600; line-height: 1.5;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--wash); border: 1px solid var(--line); color: var(--ink-soft);
}
.pill-ok { background: var(--ok-wash); border-color: var(--ok-line); color: var(--ok); }
.pill-bad { background: var(--danger-wash); border-color: var(--danger-line); color: var(--danger); }
.pill-warn { background: var(--signal-wash); border-color: var(--signal-line); color: var(--signal); }
.pill-info { background: var(--accent-wash); border-color: #BCCFE6; color: var(--accent); }

/* ---------------- Alerts ---------------- */

.alert {
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  background: var(--accent-wash); border-radius: 5px;
  padding: 13px 15px; margin-bottom: 18px; font-size: 14px;
}
.alert p:last-child { margin-bottom: 0; }
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert-ok { background: var(--ok-wash); border-color: var(--ok-line); border-left-color: var(--ok); color: #124F32; }
.alert-warn { background: var(--signal-wash); border-color: var(--signal-line); border-left-color: var(--signal); color: var(--signal); }
.alert-error { background: var(--danger-wash); border-color: var(--danger-line); border-left-color: var(--danger); color: var(--danger); }

/* ---------------- Forms ---------------- */

.field { margin-bottom: 16px; }
.field label, .label {
  display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 5px;
}
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=url], .field input[type=number], .field input[type=date],
.field input[type=search], .field select, .field textarea, .input {
  width: 100%; font-family: inherit; font-size: 14.5px; line-height: 1.5;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px;
}
.field textarea { resize: vertical; min-height: 96px; }
.field textarea.tall { min-height: 220px; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash);
}
.field input[disabled], .field textarea[disabled] { background: var(--wash); color: var(--ink-faint); }
.hint { margin: 5px 0 0; font-size: 12.5px; color: var(--ink-faint); line-height: 1.5; }
.field-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.check { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 10px; font-size: 14px; }
.check input { margin: 3px 0 0; flex: 0 0 auto; }
.check label { font-weight: 400; margin: 0; }

fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend {
  padding: 0; font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 700; margin-bottom: 10px;
}

/* ---------------- Settings pages made of cards ---------------- */

.settings-form { margin: 0; }
.set-nav {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; overflow-x: auto;
  padding: 10px 0 12px; margin-bottom: 6px; background: var(--wash); scrollbar-width: thin;
}
.set-nav a {
  flex: none; font-size: 13px; padding: 6px 12px; border-radius: 999px; text-decoration: none;
  color: var(--ink-soft); background: var(--paper); border: 1px solid var(--line); white-space: nowrap;
}
.set-nav a:hover { color: var(--accent); border-color: #BCCFE6; background: var(--accent-wash); }
.set-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 16px; scroll-margin-top: 64px; overflow: hidden;
}
.set-head { padding: 16px 22px 14px; border-bottom: 1px solid var(--line); background: #FAFBFD; }
.set-head h2 { margin: 0; font-size: 16.5px; font-weight: 650; color: var(--ink); }
.set-head p { margin: 3px 0 0; font-size: 13px; color: var(--ink-soft); }
.set-body { padding: 18px 22px 8px; }
.set-sub {
  margin: 14px -22px 14px; padding: 12px 22px 0; border-top: 1px dashed var(--line);
  font-size: 13px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700;
}
.save-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 12px 16px; margin: 4px 0 18px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 -6px 18px rgba(15, 33, 56, .08);
}
.save-note { margin-right: auto; font-size: 13px; color: var(--ink-faint); }
@media (max-width: 640px) {
  .set-head, .set-body { padding-left: 16px; padding-right: 16px; }
  .set-sub { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .save-note { display: none; }
}

/* Platform settings: providers that fold away, tests beside what they test */
.side-form { display: none; }
.prov-grid { display: grid; gap: 8px; margin-bottom: 12px; }
.prov { border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.prov.is-ready { border-left: 3px solid var(--ok); }
.prov > summary {
  list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 12px 14px;
}
.prov > summary::-webkit-details-marker { display: none; }
.prov > summary::before { content: "\25B8"; color: var(--ink-faint); font-size: 12px; transition: transform .15s; }
.prov[open] > summary::before { transform: rotate(90deg); }
.prov-name { font-weight: 650; color: var(--ink); }
.prov > summary .pill { margin-left: auto; }
.prov-used { flex-basis: 100%; font-size: 12.5px; color: var(--ink-soft); padding-left: 20px; }
.prov-body { padding: 4px 14px 6px; border-top: 1px solid var(--line); }
.prov[open] > summary { background: #FAFBFD; }
.test-row { margin: 4px 0 14px; }
.test-row label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.test-row .inline { display: flex; gap: 8px; align-items: center; }
.test-row input {
  flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; font-size: 14px; background: var(--paper); color: var(--ink);
}
.test-row .hint { margin-top: 6px; }
.queue-line, .meter-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; font-size: 13.5px; color: var(--ink-soft);
  padding: 12px 14px; background: var(--wash); border-radius: 8px; margin: 4px 0 14px;
}
.queue-line span { flex: 1; min-width: 220px; }
.meter { flex: 1; min-width: 120px; height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.note-warn {
  font-size: 13px; color: var(--ink-soft); background: var(--signal-wash); border: 1px solid var(--signal-line);
  border-left: 3px solid var(--signal); border-radius: 6px; padding: 10px 12px; margin: 0 0 12px;
}
.cron-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cron-grid h3 { margin: 0 0 6px; font-size: 14px; }
.cron-grid pre { margin: 0 0 6px; white-space: pre-wrap; word-break: break-all; }
@media (max-width: 640px) {
}

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-block; font-family: inherit; font-size: 14.5px; font-weight: 500;
  line-height: 1.4; padding: 10px 17px; border: 1px solid transparent;
  border-radius: var(--radius); background: var(--accent); color: #fff;
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn:focus-visible { outline: 3px solid #9DBCE4; outline-offset: 1px; }
.btn[disabled] { background: #B9C6D6; cursor: not-allowed; }
.btn-quiet { background: var(--paper); border-color: var(--line); color: var(--ink); }
.btn-quiet:hover { background: var(--wash); border-color: #C7D2E0; color: var(--ink); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8A1D14; }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #0F5233; }
.btn-small { font-size: 13px; padding: 6px 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }

/* ---------------- Filters ---------------- */

.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 14px 16px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px;
}
.filters .field { margin: 0; min-width: 150px; }
.filters .field label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }

/* ---------------- Transcript ---------------- */

.turn { margin-bottom: 12px; max-width: 760px; }
.turn-meta { font-size: 11.5px; color: var(--ink-faint); margin-bottom: 4px; }
.turn-body {
  padding: 11px 13px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--wash);
  white-space: pre-wrap; font-size: 14.5px; line-height: 1.55;
}
.turn-visitor .turn-body { background: var(--accent-wash); border-color: #CFDEEF; }
.turn-system .turn-body { background: var(--paper); color: var(--ink-soft); font-style: italic; }
.turn-fallback .turn-body { background: var(--signal-wash); border-color: var(--signal-line); }

.sums { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 9px; }
.sums td { padding: 3px 0; border: 0; }
.sums td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.sums tr:last-child td { font-weight: 600; padding-top: 6px; border-top: 1px solid var(--line); }

/* ---------------- Analytics ---------------- */

.viz { --series-web: #2a78d6; --series-whatsapp: #eb6834; --series-prospecting: #1baf7a; }
.stat-tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 16px; }
.stat-tile { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.stat-label { margin: 0; font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.stat-value { margin: 4px 0 2px; font-size: 28px; font-weight: 650; letter-spacing: -.01em; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-note { margin: 0; font-size: 12px; color: var(--ink-faint); line-height: 1.4; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw-web { background: #2a78d6; } .sw-whatsapp { background: #eb6834; } .sw-prospecting { background: #1baf7a; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--ink-soft); margin: -4px 0 8px; }
.chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.chart { width: 100%; height: auto; display: block; margin-bottom: 8px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { font-size: 11px; fill: var(--ink-faint); font-variant-numeric: tabular-nums; }
.chart .end-label { font-size: 12px; fill: var(--ink-soft); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln-web { stroke: #2a78d6; } .chart .ln-whatsapp { stroke: #eb6834; } .chart .ln-prospecting { stroke: #1baf7a; }
.chart .dot { stroke: var(--paper); stroke-width: 2; opacity: 0; }
.chart .dt-web { fill: #2a78d6; } .chart .dt-whatsapp { fill: #eb6834; } .chart .dt-prospecting { fill: #1baf7a; }
.chart .hit { fill: transparent; }
.chart .pt:hover .dot { opacity: 1; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(150px, 38%) 1fr 56px; gap: 12px; align-items: center; }
.bar-label { font-size: 13.5px; color: var(--ink); line-height: 1.3; }
.bar-note { display: block; font-size: 11.5px; color: var(--ink-faint); }
.bar-track { height: 14px; background: var(--wash); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: #2a78d6; border-radius: 0 4px 4px 0; }
.bar-row:hover .bar-fill { background: #1f63b5; }
.bar-value { font-size: 13.5px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
@media (max-width: 640px) {
  .bar-row { grid-template-columns: 1fr 48px; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------------- One person's history ---------------- */

.timeline { list-style: none; margin: 0; padding: 0; max-width: 860px; }
.tl-day {
  margin: 18px 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-faint);
}
.tl-day:first-child { margin-top: 0; }
.tl-item {
  display: grid; grid-template-columns: 150px 1fr; gap: 14px;
  padding: 9px 0 9px 12px; border-left: 3px solid var(--line); margin-bottom: 4px;
}
.tl-meta { font-size: 12px; color: var(--ink-faint); display: flex; flex-direction: column; gap: 2px; }
.tl-time { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.tl-who { font-weight: 700; letter-spacing: .02em; }
.tl-body { font-size: 14px; min-width: 0; }
.tl-text { margin-top: 3px; white-space: pre-wrap; color: var(--ink-soft); line-height: 1.5; overflow-wrap: anywhere; }
.tl-visitor { border-left-color: var(--accent); }
.tl-visitor .tl-who { color: var(--accent); }
.tl-ai { border-left-color: #6B7FA0; }
.tl-ai .tl-who { color: #4E6283; }
.tl-team { border-left-color: var(--ok); }
.tl-team .tl-who { color: var(--ok); }
.tl-system { border-left-color: var(--line); }
.tl-system .tl-body strong { font-weight: 600; color: var(--ink-soft); }
@media (max-width: 640px) {
  .tl-item { grid-template-columns: 1fr; gap: 4px; }
  .tl-meta { flex-direction: row; gap: 10px; }
}

/* ---------------- Review page (no login) ---------------- */

.review-page { background: var(--wash); }
.review-shell { max-width: 780px; margin: 0 auto; padding: 32px 18px 70px; }
.review-head { margin-bottom: 22px; }
.review-eyebrow {
  margin: 0 0 5px; font-size: 11px; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-faint); font-weight: 700;
}
.review-item { border-left: 3px solid var(--signal); }
.review-item.is-approved { border-left-color: var(--ok); }
.review-item.is-rejected { border-left-color: var(--danger); }
.review-body {
  background: var(--wash); border: 1px solid var(--line); border-radius: 5px;
  padding: 13px 15px; margin: 12px 0; white-space: pre-wrap; font-size: 14.5px;
}
.diff-old { background: var(--danger-wash); border-color: var(--danger-line); }
.diff-new { background: var(--ok-wash); border-color: var(--ok-line); }

/* ---------------- Installer ---------------- */

.install-page { background: var(--wash); }
.install-shell { max-width: 720px; margin: 0 auto; padding: 40px 18px 70px; }
.install-head { margin-bottom: 22px; }
.install-eyebrow {
  margin: 0 0 5px; font-size: 11px; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-faint); font-weight: 700;
}
.steps { margin: 0 0 18px; padding-left: 22px; }
.steps li { margin-bottom: 8px; }

/* ---------------- Sign in ---------------- */

.signin-page { background: var(--wash); display: grid; place-items: center; min-height: 100vh; }
.signin { width: 100%; max-width: 380px; padding: 20px; }
.signin .card { padding: 26px 24px; }
.signin h1 { font-size: 20px; }

/* ---------------- Small screens ---------------- */

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side { width: 100%; flex: none; padding: 12px 0; }
  .side-group { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
  .side-group p { width: 100%; }
  .side a { padding: 7px 11px; }
  .side-foot { margin-top: 8px; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
}

@media print {
  .side, .topbar, .btn, .filters { display: none !important; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}

/* Agent switcher in the top bar. The Switch button is a fallback for when
   admin.js has not loaded; the script hides it and switches on change. */
.agent-switch { display: flex; gap: 6px; align-items: center; }

/* Visible to screen readers only. */
.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;
}

/* The hidden attribute must win over any class that sets display, otherwise
   an element the script has hidden stays on screen. */
[hidden] { display: none !important; }

/* Standard messages: what it is on the left, the words on the right */
.msg-row { display: grid; grid-template-columns: minmax(200px, 32%) 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.set-body > .msg-row:first-child { border-top: 0; padding-top: 0; }
.msg-about label { font-size: 14px; font-weight: 650; color: var(--ink); margin-right: 6px; }
.msg-about .pill { vertical-align: 1px; }
.msg-about .hint { margin: 6px 0 0; }
.msg-row textarea {
  width: 100%; min-height: 84px; resize: vertical; font: inherit; font-size: 14px; line-height: 1.5; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; background: var(--paper);
}
.msg-row textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
@media (max-width: 760px) { .msg-row { grid-template-columns: 1fr; gap: 8px; } }

/* WhatsApp: the day at a glance beside the emergency stop */
.wa-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.wa-top > .card { margin-bottom: 16px; }
.stop-card { border-top: 3px solid var(--danger); }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 6px 0 14px; }
.mini-stats > div { background: var(--wash); border-radius: 8px; padding: 12px 14px; }
.mini-stats b { display: block; font-size: 22px; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.mini-stats span { font-size: 12.5px; color: var(--ink-soft); }
@media (max-width: 900px) { .wa-top { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .mini-stats { grid-template-columns: 1fr; } }

/* Tables never push the page sideways on a phone: they scroll inside their card */
@media (max-width: 700px) {
  table.table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table.table { display: table; }
}

/* Dashboard: what is waiting for someone */
.dash-h { font-size: 15px; margin: 4px 0 10px; }
.todo-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.todo {
  display: block; text-decoration: none; background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; color: var(--ink-soft); transition: border-color .15s, box-shadow .15s;
}
.todo:hover { border-color: #BCCFE6; box-shadow: 0 2px 10px rgba(15, 33, 56, .06); }
.todo b { display: block; font-size: 26px; line-height: 1.15; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.todo span { display: block; font-weight: 650; color: var(--ink); font-size: 14px; }
.todo small { font-size: 12.5px; }
.todo.has { border-left: 3px solid var(--accent); }
.todo.has b { color: var(--accent); }
@media (max-width: 900px) { .todo-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Header buttons wrap under the title on a phone instead of running off it */
@media (max-width: 640px) {
  .topbar h1 { flex-basis: 100%; }
  .topbar .agent-switch { margin-right: auto !important; }
}

/* Content edit forms: short boxes side by side, long ones full width */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.form-grid .fg-wide { grid-column: 1 / -1; }
.set-head p:empty { display: none; }
.add-card > summary { cursor: pointer; }

/* Switch between the two platforms (same markup and styling as /social) */
.platform-switch{display:inline-flex;border:1px solid var(--line,#d0d5dd);border-radius:999px;overflow:hidden;margin-right:12px;flex-shrink:0}
.platform-switch a{padding:6px 14px;font-size:13px;font-weight:600;text-decoration:none;color:inherit;white-space:nowrap}
.platform-switch a[aria-current=page]{background:var(--accent,#1f4fbf);color:#fff}
@media (max-width:700px){.platform-switch a{padding:6px 10px;font-size:12px}}
.side-foot a { display: block; margin-top: 4px; }
.signin .sub { margin: -6px 0 16px; color: var(--ink-soft); font-size: 13.5px; }
