/* =========================================================================
   Design tokens
   Birdie Connect
   - Interface colours are FIXED (violet primary + neutrals + status colours),
     the same for every client.
   ========================================================================= */
:root {
  --brand: linear-gradient(135deg, #8a7bff 0%, #6d5df5 55%, #5238e0 100%);
  --brand-ink: #fff;

  --bg: #f5f5f8;
  --surface: #ffffff;
  --surface-2: #f7f7fa;
  --surface-3: #efeff4;
  --border: #e8e8ef;
  --border-strong: #d8d8e3;
  --text: #17172a;
  --text-2: #4a4a63;
  --muted: #80809a;

  --primary: #6d5df5;
  --primary-hover: #5d4de8;
  --primary-ink: #ffffff;
  --primary-soft: #f0eefe;
  --primary-text: #5645e0;
  --ring: rgb(109 93 245 / 20%);

  /* status — never tied to the brand */
  --ok: #178a58;       --ok-soft: #e6f6ee;      --ok-solid: #22b573;
  --warn: #9a6400;     --warn-soft: #fff3db;    --warn-solid: #f0a92b;
  --danger: #cf3b3b;   --danger-soft: #fdecec;  --danger-solid: #ef5b5b;
  --info: #2764d8;     --info-soft: #e8f0fe;
  --neutral: #5d5d75;  --neutral-soft: #f0f0f5;

  /* soft gradient tiles (icon chips) */
  --g-violet: linear-gradient(135deg, #efeaff, #f7e9fb);
  --g-green: linear-gradient(135deg, #e3f7ec, #eef9e6);
  --g-blue: linear-gradient(135deg, #e5efff, #eaf5ff);
  --g-amber: linear-gradient(135deg, #fff1dc, #fff7e3);
  --g-pink: linear-gradient(135deg, #fde8f2, #fff0ea);

  --chart: #6d5df5;
  --chart-muted: #e3e0fb;
  --grid: #eeeef3;

  --chat-bg: #efe7dd;
  --bubble: #ffffff;

  --r-sm: 8px;
  --r: 10px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgb(20 20 50 / 4%);
  --shadow: 0 1px 2px rgb(20 20 50 / 4%), 0 6px 20px rgb(20 20 50 / 4%);
  --shadow-lg: 0 18px 50px rgb(20 20 50 / 18%);
  color-scheme: light;
}

/* Dark theme: chosen in the account menu (Light / Dark / Match my computer). */
:root[data-theme="dark"] {
  --bg: #0f0f16;
  --surface: #17171f;
  --surface-2: #1d1d27;
  --surface-3: #25252f;
  --border: #2a2a37;
  --border-strong: #363645;
  --text: #ececf4;
  --text-2: #c2c2d3;
  --muted: #8d8da8;

  --primary: #8b7dfa;
  --primary-hover: #9a8dfb;
  --primary-ink: #0f0f16;
  --primary-soft: rgb(139 125 250 / 14%);
  --primary-text: #b2a8ff;
  --ring: rgb(139 125 250 / 30%);

  --ok: #58d39a;     --ok-soft: rgb(88 211 154 / 13%);    --ok-solid: #34c182;
  --warn: #f3bf5b;   --warn-soft: rgb(243 191 91 / 13%);  --warn-solid: #f0a92b;
  --danger: #ff8080; --danger-soft: rgb(255 128 128 / 13%); --danger-solid: #f26464;
  --info: #86aefc;   --info-soft: rgb(134 174 252 / 13%);
  --neutral: #b8b8cc; --neutral-soft: rgb(184 184 204 / 11%);

  --g-violet: linear-gradient(135deg, rgb(139 125 250 / 22%), rgb(214 120 220 / 14%));
  --g-green: linear-gradient(135deg, rgb(52 193 130 / 20%), rgb(150 210 90 / 12%));
  --g-blue: linear-gradient(135deg, rgb(90 140 250 / 22%), rgb(90 190 250 / 12%));
  --g-amber: linear-gradient(135deg, rgb(240 169 43 / 22%), rgb(250 210 90 / 12%));
  --g-pink: linear-gradient(135deg, rgb(240 110 170 / 20%), rgb(250 150 120 / 12%));

  --chart: #8b7dfa;
  --chart-muted: #2e2b4a;
  --grid: #25252f;

  --chat-bg: #0b1412;
  --bubble: #1f2c33;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
  --shadow: 0 1px 2px rgb(0 0 0 / 30%);
  --shadow-lg: 0 18px 50px rgb(0 0 0 / 50%);
  color-scheme: dark;
}

/* =========================================================================
   Base
   ========================================================================= */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.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; }

/* =========================================================================
   App shell: sidebar + top bar + content
   ========================================================================= */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px 12px;
  display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 0; height: 100vh; z-index: 30;
}
.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 6px; }
.brand { display: flex; gap: 10px; align-items: center; min-width: 0; }
.brand-mark {
  display: block; width: 34px; height: 34px; border-radius: 10px; flex: none; position: relative;
  background: var(--brand);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 14%), 0 2px 6px rgb(20 20 50 / 12%);
}
.brand-mark::after {
  content: ""; position: absolute; inset: 8px; background: var(--brand-ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2.5 11.2 21.5 3l-7.3 18.5-3.1-7.6z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2.5 11.2 21.5 3l-7.3 18.5-3.1-7.6z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.brand-mark.big { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 16px; }
.brand-mark.big::after { inset: 13px; }
.brand-text { min-width: 0; }
.brand-name { font-weight: 650; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { font-size: 11.5px; color: var(--muted); }
.sb-toggle, .sb-open {
  width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); border-radius: 8px;
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.sb-toggle:hover, .sb-open:hover { background: var(--surface-2); color: var(--text); }
.sb-toggle svg, .sb-open svg { width: 19px; height: 19px; }
.sb-open { display: none; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; }
.nav-label:first-child { padding-top: 4px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px;
  color: var(--text-2); text-decoration: none; font-weight: 500; position: relative;
}
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .8; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.nav a.active svg { opacity: 1; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }

.sb-user.active { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: var(--primary-soft); }
.sb-user.active .sb-user-name { color: var(--primary-text); }
/* visible in the narrow icon rail too, where the card has no background */
.sb-user.active .avatar { box-shadow: 0 0 0 2px var(--primary); }
.sb-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--g-violet); color: var(--primary-text); display: grid; place-items: center; font-weight: 650; font-size: 13px; flex: none; text-transform: uppercase; }
.sb-user-text { min-width: 0; flex: 1; }
.sb-user-name { font-weight: 600; font-size: 13px; }
.sb-user-mail { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.crumbs { font-weight: 600; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs span { color: var(--muted); font-weight: 500; }
.crumbs a { color: var(--muted); font-weight: 500; }
.top-search { position: relative; width: min(300px, 32vw); }
.top-search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.top-search input { padding-left: 34px !important; background: var(--surface) !important; }
.topbar .btn svg { width: 16px; height: 16px; }

.main { padding: 26px 28px 60px; max-width: 1240px; width: 100%; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-weight: 500; margin-bottom: 10px; }
.back:hover { color: var(--text); text-decoration: none; }

/* collapsed sidebar (icon rail) */
body.sb-collapsed .shell { grid-template-columns: 76px minmax(0, 1fr); }
body.sb-collapsed .sidebar { padding-left: 10px; padding-right: 10px; align-items: stretch; }
body.sb-collapsed .sb-head { flex-direction: column; gap: 10px; }
body.sb-collapsed .brand-text,
body.sb-collapsed .nav a span,
body.sb-collapsed .sb-user-text,
body.sb-collapsed .sb-user .dots { display: none; }
body.sb-collapsed .nav-label { font-size: 0; padding: 8px 0 4px; }
body.sb-collapsed .nav-label::after { content: ""; display: block; height: 1px; background: var(--border); margin: 0 10px; }
body.sb-collapsed .nav a { justify-content: center; padding: 10px; }
body.sb-collapsed .nav a.active::before { left: -10px; }
body.sb-collapsed .sb-user { justify-content: center; padding: 8px 0; border: 0; background: none; cursor: pointer; }

/* =========================================================================
   Cards, stats
   ========================================================================= */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px 22px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat .stat-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.stat .icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--g-violet); color: var(--primary-text); }
.stat .icon svg { width: 18px; height: 18px; }
.stat .icon.green { background: var(--g-green); color: var(--ok); }
.stat .icon.blue { background: var(--g-blue); color: var(--info); }
.stat .icon.amber { background: var(--g-amber); color: var(--warn); }
.stat .icon.pink { background: var(--g-pink); color: #c0428a; }
.stat .label { color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat .value { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.stat .value small { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stat .sub { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.delta.up { background: var(--ok-soft); color: var(--ok); }
.delta.down { background: var(--danger-soft); color: var(--danger); }
.delta.flat { background: var(--neutral-soft); color: var(--neutral); }
.meter { height: 6px; border-radius: 3px; background: var(--chart-muted); overflow: hidden; margin-top: 10px; }
.meter > span { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.meter.warn > span { background: var(--warn-solid); }
.meter.danger > span { background: var(--danger-solid); }

/* dashboard layout */
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: stretch; }
.dash-grid > .card { margin: 0; }
/* Side by side, the "match" card takes the height of its neighbour (the chart) and scrolls
   its list inside, instead of making the row taller. */
@media (min-width: 1181px) {
  .dash-grid > .card.match { height: 0; min-height: 100%; display: flex; flex-direction: column; }
  .card.match > .card-head { flex: none; }
  .card.match > .sources, .card.match > .empty { flex: 1; min-height: 0; overflow-y: auto; }
}
.hello { font-size: 26px; }

/* bar chart */
.chart { position: relative; padding: 8px 22px 16px; }
.chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .bar { fill: var(--chart); }
.chart .bar-hit { fill: transparent; cursor: pointer; }
.chart .bar.hl { fill: var(--primary-hover); }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 150px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 9px 11px; font-size: 12.5px; transform: translate(-50%, -100%);
}
.chart-tip b { display: block; margin-bottom: 4px; font-size: 12.5px; }
.chart-tip .tr { display: flex; justify-content: space-between; gap: 14px; color: var(--text-2); }
.chart-tip .tr span:last-child { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-empty { height: 220px; display: grid; place-items: center; color: var(--muted); text-align: center; }

/* sources list (horizontal bars) */
.sources { list-style: none; margin: 0; padding: 6px 22px 18px; display: flex; flex-direction: column; gap: 10px; }
.sources li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; }
.sources .src-top { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 13px; }
.sources .src-top span:last-child { font-variant-numeric: tabular-nums; }
.sources .src-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.sources .meter { margin-top: 8px; height: 5px; }

/* =========================================================================
   Buttons & inputs
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: var(--r);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 1px 2px rgb(20 20 50 / 10%), inset 0 1px 0 rgb(255 255 255 / 14%); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; fill: currentColor; }
.dots { width: 32px; padding: 0 !important; font-size: 18px; letter-spacing: 1px; line-height: 1; color: var(--muted); }
.dots:hover { color: var(--text); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > span, .field > label { font-weight: 550; font-size: 13px; color: var(--text); }
.field .help { font-size: 12.5px; color: var(--muted); font-weight: 400; }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=search], input[type=number], input[type=tel], input[type=datetime-local], input[type=date], select, textarea {
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r);
  padding: 8px 11px; min-height: 38px; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
select { appearance: none; -webkit-appearance: none; padding-right: 32px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2380809a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 10px center / 15px no-repeat; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.btn:focus-visible, .nav a:focus-visible, .choice:focus-within, .sb-toggle:focus-visible, a:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
input[type=color] { width: 56px; height: 38px; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.form-error { color: var(--danger); min-height: 1.2em; margin: 4px 0 10px; font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 200px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
fieldset:disabled { opacity: .65; }

/* phone number: country picker + number */
.phone-field { display: grid; grid-template-columns: minmax(118px, 150px) 1fr; gap: 8px; }
.phone-field input { font-variant-numeric: tabular-nums; }
.cp.wide .cp-btn { min-height: 38px; }

/* =========================================================================
   Tables & lists
   ========================================================================= */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; min-width: 140px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); letter-spacing: .01em; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.check-col, th.check-col { width: 40px; padding-right: 0; }
tr.clickable { cursor: pointer; }
td.col-menu, th.col-menu { position: sticky; right: 0; width: 46px; text-align: right; background: var(--surface); padding-left: 6px; padding-right: 12px; }
th.col-menu { background: var(--surface-2); }
tbody tr:hover td.col-menu { background: var(--surface-2); }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 4px; font-size: 15px; }
.empty .actions { justify-content: center; margin-top: 14px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.bulkbar { display: flex; gap: 10px; align-items: center; padding: 10px 18px; min-height: 52px; background: var(--primary-soft); border-bottom: 1px solid var(--border); flex-wrap: wrap; color: var(--primary-text); }
.bulkbar b { color: var(--text); }
.bulkbar.idle { background: transparent; color: var(--muted); font-size: 13px; }
.src { color: var(--muted); font-size: 12px; margin-top: 1px; }
.src b { font-weight: 600; color: var(--text-2); }
.form-link { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; display: block; }

/* =========================================================================
   Pills, tags, notices
   ========================================================================= */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.accent { background: var(--primary-soft); color: var(--primary-text); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 500; margin: 1px 4px 1px 0; }

.notice { padding: 12px 14px; border-radius: 12px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 18%, transparent); }
.notice.info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 16%, transparent); }
.notice.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 16%, transparent); }
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 16%, transparent); }
.notice strong { font-weight: 650; }
.notice a { color: inherit; text-decoration: underline; }

/* =========================================================================
   Compose / template editor
   ========================================================================= */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 20px; align-items: start; }
.step { padding: 20px 22px; container-type: inline-size; }
.step + .step { border-top: 1px solid var(--border); }
.step-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-num { width: 26px; height: 26px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-text); font-size: 12.5px; font-weight: 700; display: grid; place-items: center; flex: none; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 13px 14px; border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; background: var(--surface); transition: border-color .12s, background .12s; }
.choice:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border-strong)); }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.choice input { margin-top: 3px; }
.choice > span > b { display: block; font-weight: 600; }
.choice small { color: var(--muted); font-size: 12.5px; line-height: 1.4; display: block; margin-top: 2px; }
.var-row { display: grid; grid-template-columns: 170px 1fr 1fr; gap: 8px; align-items: center; margin-bottom: 10px; }
.var-row .var-label { font-weight: 550; font-size: 13px; }
@container (max-width: 560px) {
  .var-row { grid-template-columns: 1fr 1fr; gap: 6px 8px; }
  .var-row .var-label { grid-column: 1 / -1; }
}
.token-btns { display: flex; gap: 6px; margin: 6px 0 12px; flex-wrap: wrap; align-items: center; }
.image-drop { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px dashed var(--border-strong); border-radius: 12px; background: var(--surface-2); }
.image-drop img, .image-drop video { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: var(--surface-3); }
.sticky { position: sticky; top: 84px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tpl-card b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-snip { display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 6px !important; color: var(--text-2) !important; unicode-bidi: plaintext; }
.fill { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.fill-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.fill-head select { width: auto; min-width: 220px; }
.var-chip { background: color-mix(in srgb, #0a84c9 14%, transparent); border-radius: 3px; padding: 0 3px; color: var(--text); }
.group-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 12px; }
.group-item { padding: 10px 12px; }
.btn-row { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.btn-row-head { display: flex; justify-content: space-between; align-items: center; }
.btn-row .btn.sm { height: 26px; }
.ferr { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.ferr:empty { display: none; }
.ferr-e { color: var(--danger); }
.ferr-e::before { content: "● "; font-size: 9px; vertical-align: 2px; }
.ferr-w { color: var(--warn); }
.ferr-w::before { content: "▲ "; font-size: 9px; vertical-align: 2px; }
.step .ferr { margin-top: 4px; }
.checks { border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; background: var(--surface-2); }
.issues { list-style: none; margin: 0; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.issues li { padding-left: 16px; position: relative; line-height: 1.4; }
.issues li::before { position: absolute; left: 0; top: 2px; font-size: 10px; }
.issues li.e { color: var(--danger); }
.issues li.e::before { content: "●"; }
.issues li.w { color: var(--warn); }
.issues li.w::before { content: "▲"; }

/* WhatsApp-like preview (keeps WhatsApp's own colours on purpose) */
.phone { border-radius: 22px; overflow: hidden; border: 1px solid var(--border); background: var(--chat-bg); box-shadow: var(--shadow); }
.phone-top { background: #075e54; color: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.phone-top .avatar { width: 30px; height: 30px; background: rgb(255 255 255 / 25%); color: #fff; font-size: 13px; }
.phone-top small { display: block; font-weight: 400; opacity: .8; font-size: 11.5px; }
.phone-body { padding: 16px 12px 22px; min-height: 280px; }
.bubble { background: var(--bubble); border-radius: 0 9px 9px 9px; padding: 5px 5px 4px; max-width: 94%; box-shadow: 0 1px 1px rgb(0 0 0 / 10%); font-size: 13.5px; }
.bubble video.b-img { background: #000; object-fit: contain; }
.bubble .b-img { width: 100%; aspect-ratio: 1.6; border-radius: 6px; background: var(--surface-3); object-fit: cover; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.bubble .b-head { font-weight: 700; padding: 4px 5px 0; }
.bubble .b-text { padding: 4px 5px 0; white-space: pre-wrap; word-wrap: break-word; unicode-bidi: plaintext; }
.bubble .b-foot { padding: 2px 5px 0; color: var(--muted); font-size: 12px; }
.bubble .b-time { text-align: right; font-size: 11px; color: var(--muted); padding: 0 4px; }
.bubble .b-btn { border-top: 1px solid var(--border); text-align: center; color: #0a84c9; padding: 8px 4px 4px; font-weight: 550; font-size: 13px; }
.bubble .b-btn + .b-btn { padding-top: 8px; }
.b-text .var { background: color-mix(in srgb, #0a84c9 14%, transparent); border-radius: 3px; padding: 0 2px; }
.b-link { color: #0a84c9; text-decoration: underline; }

/* =========================================================================
   History / details
   ========================================================================= */
.progress { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-3); min-width: 120px; }
.progress span { display: block; height: 100%; }
.progress .p-read { background: var(--ok-solid); }
.progress .p-delivered { background: color-mix(in srgb, var(--ok-solid) 45%, var(--surface)); }
.progress .p-sent { background: var(--primary); }
.progress .p-failed { background: var(--danger-solid); }
.progress .p-skipped { background: var(--border-strong); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.tabs { display: inline-flex; gap: 2px; flex-wrap: wrap; padding: 3px; background: var(--surface-3); border-radius: 10px; }
.tabs button { border: 0; background: transparent; border-radius: 8px; padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; color: var(--text-2); }
.tabs button:hover { color: var(--text); }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* =========================================================================
   Settings
   ========================================================================= */
.settings-section h2 { margin-bottom: 4px; }
.settings-section > p { margin: 0 0 18px; color: var(--muted); }
.copy-row { display: flex; gap: 6px; align-items: center; }
.copy-row code { flex: 1; padding: 8px 11px; border-radius: var(--r); }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border: 0; }
.checklist .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; display: grid; place-items: center; font-size: 12px; }
.checklist .done .dot { background: var(--ok-solid); border-color: var(--ok-solid); color: #fff; }
.checklist .done span:nth-child(2) { color: var(--muted); text-decoration: line-through; }

/* =========================================================================
   Menus, dialogs, toasts
   ========================================================================= */
.menu { position: fixed; z-index: 55; min-width: 210px; max-width: 290px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; animation: fade .1s ease-out; }
.menu button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; border: 0; background: none; color: var(--text); font: inherit; font-weight: 500; text-align: start; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.menu button small { color: var(--muted); font-size: 12px; font-weight: 400; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); outline: none; }
.menu button.danger { color: var(--danger); }
.menu button:disabled { opacity: .45; cursor: default; }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }

.modal-backdrop { position: fixed; inset: 0; background: rgb(15 15 30 / 42%); backdrop-filter: blur(2px); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .12s ease-out; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.modal.wide { width: min(780px, 100%); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 18px 18px; }
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--text); color: var(--surface); padding: 11px 15px; border-radius: 12px; box-shadow: var(--shadow-lg); max-width: 380px; animation: fade .15s ease-out; font-weight: 500; display: flex; gap: 9px; align-items: flex-start; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok-solid); margin-top: 6px; flex: none; }
.toast.error { background: var(--danger-solid); color: #fff; }
.toast.error::before { background: #fff; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* =========================================================================
   Sign-in
   ========================================================================= */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(900px 500px at 15% 0%, #efeaff 0%, transparent 60%), radial-gradient(700px 500px at 100% 100%, #fde9f3 0%, transparent 55%), var(--bg); }
:root[data-theme="dark"] .login { background: radial-gradient(900px 500px at 15% 0%, rgb(139 125 250 / 14%) 0%, transparent 60%), var(--bg); }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px 28px; box-shadow: var(--shadow-lg); text-align: center; }
.login-card .field { text-align: left; margin-top: 16px; }
.login-card p.muted { margin: 4px 0 0; }
.login-card .btn.primary { height: 42px; margin-top: 4px; }

.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 60px; text-align: center; color: var(--muted); }

/* Footer: "Powered by Birdie · 2014 – <current year>" */
.app-footer { margin-top: auto; padding: 18px 28px 22px; font-size: 12.5px; color: var(--muted); text-align: center; }
.app-footer a { color: var(--text-2); font-weight: 600; }
.app-footer a:hover { color: var(--primary-text); }
.login { grid-template-rows: 1fr auto; }
.login .app-footer { padding-bottom: 6px; }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1180px) {
  .compose, .detail-grid, .dash-grid { grid-template-columns: 1fr; }
  .sticky { position: static; max-width: 440px; }
}
@media (max-width: 1100px) { .col-added { display: none; } }
@media (min-width: 721px) and (max-width: 1000px) {
  /* Tablet: icon rail */
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .brand-text, .nav a span, .sb-user-text, .sb-user .dots, .sb-toggle { display: none; }
  .nav-label { font-size: 0; padding: 8px 0 4px; }
  .nav-label::after { content: ""; display: block; height: 1px; background: var(--border); margin: 0 10px; }
  .nav a { justify-content: center; padding: 10px; }
  .nav a.active::before { left: -12px; }
  .sb-user { justify-content: center; border: 0; background: none; padding: 8px 0; }
  .top-search { width: 200px; }
}
@media (max-width: 720px) {
  /* Phone: sidebar becomes a drawer */
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.sb-open-mobile .sidebar { transform: none; }
  .sb-toggle { display: none; }
  .sb-scrim { position: fixed; inset: 0; background: rgb(15 15 30 / 40%); z-index: 25; }
  .sb-open { display: grid; margin-left: -8px; }
  .topbar { padding: 0 16px; height: 58px; }
  .top-search { display: none; }
  #top-new span { display: none; }
  #top-new { width: 38px; padding: 0; }
  .main { padding: 18px 16px 50px; }
  .two, .var-row { grid-template-columns: 1fr; }
  .toolbar input[type=search] { max-width: none; }
  th, td { padding: 10px 12px; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: 8px; }
  .phone-field { grid-template-columns: 1fr; }
  h1 { font-size: 21px; }
  .grid.stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat .value { font-size: 23px; }
  .stat .stat-top { margin-bottom: 6px; }
}

/* =========================================================================
   Sign-in (Birdie Connect): brand panel + form card
   ========================================================================= */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 44%) 1fr; background: var(--bg); }
.auth-side {
  position: relative; overflow: hidden; color: #fff; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(600px 400px at 110% 110%, rgb(255 255 255 / 12%), transparent 60%),
              radial-gradient(500px 380px at -10% -10%, rgb(255 255 255 / 10%), transparent 60%),
              linear-gradient(150deg, #7c6cfb 0%, #5b47e8 55%, #3b2bb4 100%);
}
.auth-side::after {
  content: ""; position: absolute; right: -80px; bottom: 90px; width: 320px; height: 320px; border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 16%); box-shadow: 0 0 0 40px rgb(255 255 255 / 4%), 0 0 0 80px rgb(255 255 255 / 3%);
}
.auth-logo { display: flex; align-items: center; gap: 10px; font-size: 17px; letter-spacing: -.01em; }
.auth-logo .brand-mark { background: rgb(255 255 255 / 18%); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 25%); }
.auth-pitch { position: relative; z-index: 1; max-width: 420px; }
.auth-pitch h2 { font-size: 30px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 22px; font-weight: 700; }
.auth-pitch ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.auth-pitch li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: rgb(255 255 255 / 88%); }
.auth-pitch li span { width: 22px; height: 22px; border-radius: 50%; background: rgb(255 255 255 / 18%); display: grid; place-items: center; font-size: 12px; flex: none; margin-top: 1px; }
.auth-side-foot { font-size: 13px; color: rgb(255 255 255 / 70%); position: relative; z-index: 1; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px 0; }
.auth-card { width: min(400px, 100%); margin: auto 0; }
.auth-card-logo { display: none; margin-bottom: 18px; }
.auth-card h1 { font-size: 26px; letter-spacing: -.02em; margin: 0; }
.auth-sub { color: var(--text-2); margin: 6px 0 22px; line-height: 1.5; }
.auth-card .field { margin-top: 0; }
.auth-card .btn.primary.block, .auth-card .btn.block { height: 44px; font-size: 15px; }
.auth-tabs { display: flex; width: 100%; margin-bottom: 20px; }
.auth-tabs button { flex: 1; padding: 8px 10px; }
.auth-row { display: flex; justify-content: space-between; align-items: center; margin: -6px 0 16px; font-size: 13.5px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 13.5px; flex-wrap: wrap; }
.auth-back { display: inline-block; margin-top: 18px; font-size: 13.5px; }
.auth-note { color: var(--text-2); line-height: 1.55; margin: 0 0 18px; }
.auth-options { display: grid; gap: 10px; }
.auth-option {
  display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; padding: 14px 16px; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); font: inherit; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.auth-option:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: 0 0 0 3px var(--ring); }
.auth-option small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.ao-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); font-size: 18px; flex: none; }
.ao-icon.wa { background: var(--ok-soft); color: var(--ok); }
.code-input { font-size: 22px !important; letter-spacing: .45em; text-align: center; font-variant-numeric: tabular-nums; height: 52px !important; }
.pw-wrap { position: relative; }
.pw-wrap input { width: 100%; padding-right: 42px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.pw-eye:hover, .pw-eye.on { color: var(--primary-text); background: var(--primary-soft); }
.pw-eye svg { width: 18px; height: 18px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--primary-text); cursor: pointer; }
.linkish:disabled { color: var(--muted); cursor: default; }
.ts-box:not(:empty) { margin: 4px 0 14px; }
.auth-steps { margin: 0 0 12px; padding-left: 20px; color: var(--text-2); line-height: 1.6; }
.qr { display: grid; place-items: center; padding: 14px; background: #fff; border: 1px solid var(--border); border-radius: 14px; width: fit-content; margin: 0 auto 10px; }
.auth-secret { margin: 0 0 18px; font-size: 13px; color: var(--muted); text-align: center; }
.auth-secret code { display: block; margin-top: 8px; font-size: 14px; letter-spacing: .06em; color: var(--text); word-break: break-all; }
.recovery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.recovery code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px; text-align: center; font-size: 14px; letter-spacing: .04em; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.auth .app-footer { padding: 24px 0 18px; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-card-logo { display: block; }
  .auth-card-logo .brand-mark { width: 46px; height: 46px; border-radius: 13px; }
  .auth-card-logo .brand-mark::after { inset: 11px; }
}

/* =========================================================================
   Account notices (Super Admin viewing a client, subscription ended)
   ========================================================================= */
#banners:empty { display: none; }
#banners { padding: 12px 28px 0; display: grid; gap: 8px; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; border: 1px solid transparent; flex-wrap: wrap; }
.banner.info { background: var(--primary-soft); color: var(--primary-text); border-color: color-mix(in srgb, var(--primary) 20%, transparent); }
.banner.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 18%, transparent); }
.banner a:not(.btn) { color: inherit; text-decoration: underline; }

/* =========================================================================
   Setup guide
   ========================================================================= */
.setup-progress { margin-bottom: 14px; }
.sp-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.setup-steps { display: grid; gap: 10px; }
.setup-step { overflow: hidden; }
.setup-step + .setup-step { margin-top: 0; }
.ss-head { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px 20px; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.ss-head:hover { background: var(--surface-2); }
.ss-num { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; background: var(--surface-3); color: var(--text-2); }
.setup-step.open .ss-num { background: var(--primary); color: var(--primary-ink); }
.setup-step.done .ss-num { background: var(--ok-solid); color: #fff; }
.ss-title { flex: 1; min-width: 0; }
.ss-title b { display: block; font-size: 15px; }
.ss-title small { color: var(--muted); font-size: 13px; }
.ss-chev { width: 18px; height: 18px; color: var(--muted); transition: transform .15s; flex: none; }
.setup-step.open .ss-chev { transform: rotate(180deg); }
.ss-body { padding: 4px 22px 22px 66px; border-top: 1px solid var(--border); }
.ss-body > p { color: var(--text-2); }
.watch-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 4px; }
.watch { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border)); background: var(--primary-soft); color: var(--primary-text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.watch:hover { border-color: var(--primary); }
.watch svg { width: 20px; height: 20px; }
.howto { margin: 14px 0 18px; padding-left: 20px; line-height: 1.65; color: var(--text-2); }
.howto li { margin-bottom: 8px; }
.howto li::marker { color: var(--primary-text); font-weight: 700; }
.tipbox { margin: 8px 0 2px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.wait-line { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 13.5px; }
.wait-line.ok { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.setup-form .row, .setup-test .row { margin-top: 4px; }
.video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 720px) {
  .ss-body { padding: 4px 16px 18px; }
  .ss-head { padding: 14px 16px; gap: 10px; }
  #banners { padding: 10px 16px 0; }
}

/* =========================================================================
   Plan & usage
   ========================================================================= */
.grid.two-col { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.plan-name { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 10px; }
.plan-status { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.usage-row + .usage-row { margin-top: 18px; }
.usage-row .src-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 550; }
.t-right { text-align: right; }

/* =========================================================================
   Super Admin
   ========================================================================= */
.admin-badge { font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--primary-text); background: var(--primary-soft); padding: 4px 9px; border-radius: 999px; margin-left: auto; }
.is-admin .topbar .crumbs { flex: none; }
.t-num { text-align: right; font-variant-numeric: tabular-nums; }
.form-sub { font-size: 14px; margin: 6px 0 8px; }
.detail-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.detail-cols .card + .card { margin-top: 16px; }
.detail-cols .card-pad h2 { margin-bottom: 12px; }
.detail-cols .kv { margin-bottom: 16px; }
.activity { list-style: none; margin: 0; padding: 6px 20px 14px; display: grid; gap: 12px; }
.activity li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.act-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex: none; }
.act-dot.bad { background: var(--danger-solid); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.plan-card { display: flex; flex-direction: column; }
.plan-card.retired { opacity: .65; }
.plan-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan-price { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 8px 0 12px; }
.plan-price small { font-size: 14px; color: var(--muted); font-weight: 500; }
.plan-feat { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; font-size: 14px; color: var(--text-2); }
.plan-feat li::before { content: "✓"; color: var(--ok); font-weight: 700; margin-right: 8px; }
.plan-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 12px; }
.video-row { display: flex; gap: 12px; align-items: flex-end; padding: 12px 0; border-bottom: 1px solid var(--border); }
.video-row:first-child { padding-top: 0; }
.vr-num { width: 26px; height: 26px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-text); font-size: 12.5px; font-weight: 700; display: grid; place-items: center; flex: none; margin-bottom: 7px; }
.row.wrap { flex-wrap: wrap; }
.phone-inline { width: 300px; max-width: 100%; }
@media (max-width: 1000px) { .detail-cols { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .admin-badge { display: none; } .video-row { flex-wrap: wrap; } }
.auth-card .form-error:empty { margin: 0; min-height: 0; }
.plan-grid > .card { margin-top: 0; }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.stack > .card { margin: 0; }
.card.match > .activity { flex: 1; min-height: 0; overflow-y: auto; }
.sys-kv { margin: 0; }
.sub-box { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.sub-end { min-height: 40px; padding: 9px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px dashed var(--border-strong); font-size: 14px; }
.sub-change { margin-top: 6px; font-size: 12.5px; color: var(--warn); }
.sub-preview { margin-top: 8px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); font-size: 13.5px; line-height: 1.7; }
@media (max-width: 720px) { .sub-box { grid-template-columns: 1fr; } }
.plan-dates { margin-top: 14px; grid-template-columns: 100px 1fr; }
.auth-safety { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
