/* WAPI Pilot dashboard — neutral design system (inset sidebar shell, cards, pill tabs). */
:root {
  --background: oklch(1 0 0); --foreground: oklch(.145 0 0);
  --card: oklch(1 0 0); --primary: oklch(.205 0 0); --primary-fg: oklch(.985 0 0);
  --secondary: oklch(.97 0 0); --muted: oklch(.97 0 0); --muted-fg: oklch(.556 0 0);
  --border: oklch(.922 0 0); --ring: oklch(.708 0 0);
  --sidebar: oklch(.985 0 0); --sidebar-accent: oklch(.94 0 0);
  --destructive: oklch(.577 .245 27.325); --destructive-soft: oklch(.97 .02 25);
  --green: #15803d; --green-soft: #f0fdf4; --green-line: #bbf7d0; --green-dot: #22c55e;
  --amber: #b45309; --amber-soft: #fffbeb; --amber-line: #fde68a;
  --blue: #1d4ed8; --blue-soft: #eff6ff; --blue-line: #bfdbfe;
  --purple: #7e22ce; --purple-soft: #faf5ff; --purple-line: #e9d5ff;
  --orange: #ea580c; --orange-line: #fed7aa;
  --red-soft: #fef2f2; --red-line: #fecaca;
  --chart: #2563eb; --chart-fill: rgba(37, 99, 235, .12);
  --code-bg: #18181b; --code-fg: #f4f4f5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05);
  --radius: .625rem;
  --font: "Instrument Sans", "Hind Siliguri", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --background: oklch(.145 0 0); --foreground: oklch(.985 0 0);
  --card: oklch(.205 0 0); --primary: oklch(.922 0 0); --primary-fg: oklch(.205 0 0);
  --secondary: oklch(.269 0 0); --muted: oklch(.269 0 0); --muted-fg: oklch(.708 0 0);
  --border: oklch(1 0 0 / 12%); --ring: oklch(.556 0 0);
  --sidebar: oklch(.18 0 0); --sidebar-accent: oklch(.269 0 0);
  --destructive: oklch(.704 .191 22.216); --destructive-soft: oklch(.25 .05 25);
  --green: #4ade80; --green-soft: rgba(34, 197, 94, .12); --green-line: rgba(34, 197, 94, .35);
  --amber: #fbbf24; --amber-soft: rgba(245, 158, 11, .12); --amber-line: rgba(245, 158, 11, .35);
  --blue: #93c5fd; --blue-soft: rgba(59, 130, 246, .12); --blue-line: rgba(59, 130, 246, .35);
  --purple: #d8b4fe; --purple-soft: rgba(168, 85, 247, .12); --purple-line: rgba(168, 85, 247, .35);
  --orange: #fb923c; --orange-line: rgba(249, 115, 22, .4);
  --red-soft: rgba(239, 68, 68, .12); --red-line: rgba(239, 68, 68, .35);
  --chart: #3b82f6; --chart-fill: rgba(59, 130, 246, .18);
  --code-bg: #0a0a0b; --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); background: var(--sidebar); color: var(--foreground); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0; }
h3 { font-size: .95rem; font-weight: 600; margin: 0; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .8em; }
code { background: var(--muted); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
.muted { color: var(--muted-fg); }
.small { font-size: .8rem; }
.xs { font-size: .74rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.loading { padding: 40px; color: var(--muted-fg); }
.grow { flex: 1; }
.section { margin-top: 16px; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.shell.collapsed { grid-template-columns: 64px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 8px 14px; font-weight: 700; font-size: 1.02rem; text-decoration: none; }
.brand .mark { width: 32px; height: 32px; flex: none; border-radius: 9px; background: var(--primary); color: var(--primary-fg); display: grid; place-items: center; font-weight: 700; }
.brand small { display: block; font-size: .7rem; font-weight: 500; color: var(--muted-fg); }
.nav-label { font-size: .72rem; color: var(--muted-fg); padding: 12px 10px 4px; }
.modesw { display: flex; gap: 4px; padding: 3px; margin: 0 0 4px; background: var(--muted); border-radius: 10px; }
.modesw button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: none; padding: 6px 4px; border-radius: 7px; font-size: .8rem; cursor: pointer; color: var(--muted-fg); white-space: nowrap; }
.modesw button.on { background: var(--card); color: var(--foreground); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.collapsed .modesw { flex-direction: column; }
a.stat { text-decoration: none; color: inherit; display: block; }
a.stat:hover { border-color: var(--ring); }
.stat .value.sm { font-size: 1.1rem; }
.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 6px 14px; font-size: .9rem; }
.kv dt { color: var(--muted-fg); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--muted); }
.nav a, .nav button.navbtn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 8px; text-decoration: none; border: 0; background: none; cursor: pointer; text-align: left; white-space: nowrap; }
.nav a:hover, .nav button.navbtn:hover { background: var(--sidebar-accent); }
.nav a.active { background: var(--sidebar-accent); font-weight: 500; }
.nav .sub { padding-left: 38px; font-size: .9rem; color: var(--muted-fg); }
.nav .sub.active { color: var(--foreground); }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .spacer { flex: 1; min-height: 16px; }
.usermenu { position: relative; }
.userbtn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; }
.userbtn:hover { background: var(--sidebar-accent); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--secondary); display: grid; place-items: center; font-size: .78rem; font-weight: 600; flex: none; border: 1px solid var(--border); }
.userbtn .who { min-width: 0; flex: 1; }
.userbtn .who b, .userbtn .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown { position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .12); padding: 6px; z-index: 40; }
.dropdown .head { display: flex; gap: 10px; align-items: center; padding: 6px 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown button { display: flex; gap: 8px; align-items: center; width: 100%; padding: 7px 8px; border: 0; background: none; border-radius: 6px; cursor: pointer; }
.dropdown button:hover { background: var(--muted); }
.collapsed .sidebar .label-text, .collapsed .nav-label, .collapsed .brand small, .collapsed .brand span, .collapsed .userbtn .who, .collapsed .nav .sub { display: none; }
.inset { margin: 8px 8px 8px 0; background: var(--background); border: 1px solid var(--border); border-radius: 14px; min-width: 0; display: flex; flex-direction: column; min-height: calc(100vh - 16px); }
.topbar { height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); flex: none; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--muted-fg); font-size: .88rem; flex-wrap: wrap; min-width: 0; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--foreground); }
.crumbs .cur { color: var(--foreground); }
.content { padding: 20px 24px 48px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.support { margin-left: auto; display: flex; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-weight: 500; font-size: .85rem; text-decoration: none; flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-dot); display: inline-block; flex: none; }
.dot.grey { background: var(--muted-fg); } .dot.amber { background: #f59e0b; } .dot.red { background: #ef4444; } .dot.blue { background: #3b82f6; }
.dot.live { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- page parts ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted-fg); margin-top: 4px; }
.page-head h1 a { text-decoration: none; color: var(--muted-fg); margin-right: 6px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.card-head .desc { color: var(--muted-fg); font-size: .85rem; margin-top: 2px; }
.grid { display: grid; gap: 16px; align-items: start; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.split-6040 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.grid.split-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stat .label { color: var(--muted-fg); font-size: .8rem; }
.stat .value { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .hint { color: var(--muted-fg); font-size: .76rem; }
.banner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--muted); border-radius: 12px; padding: 14px 16px; }
.banner .grow { min-width: 220px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.kv dt { color: var(--muted-fg); font-size: .8rem; }
.kv dd { margin: 2px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); font-weight: 500; font-size: .875rem; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s; }
.btn:hover { background: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--destructive); }
.btn.danger.solid { background: var(--destructive); color: #fff; border-color: var(--destructive); }
.btn.warn { color: var(--orange); border-color: var(--orange-line); }
.btn.ghost { border-color: transparent; background: none; }
.btn.sm { height: 30px; padding: 0 10px; font-size: .8rem; }
.btn.icon { width: 34px; padding: 0; }
.btn.link { border: 0; background: none; height: auto; padding: 2px 4px; color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* forms */
label { display: block; font-weight: 500; font-size: .875rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.help { color: var(--muted-fg); font-size: .76rem; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=tel], input[type=url], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--background); }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 30%, transparent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.check b { font-weight: 500; display: block; }
.optbox { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.events { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; max-height: 240px; overflow-y: auto; display: grid; gap: 6px; }
.collapsible > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--muted); font-weight: 500; }
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary::after { content: "Click to expand ⌄"; font-weight: 400; color: var(--muted-fg); font-size: .8rem; }
.collapsible[open] > summary::after { content: "Click to collapse ⌃"; }
.collapsible > div { padding: 14px 2px 0; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border: 1px dashed var(--border); border-radius: 10px; padding: 10px; }
.tiles .check { border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search] { flex: 1 1 240px; }
.toolbar select { width: auto; }
.addon-buy { justify-content: flex-end; }
.preview-list { max-height: 300px; overflow: auto; }
.adcard { display: grid; gap: 2px; margin: -2px 0 8px; padding: 8px 10px; border-left: 3px solid var(--primary); background: var(--muted); border-radius: 6px; }
.adcard a { overflow-wrap: anywhere; }
.ib-ad { display: block; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addon-buy input { width: 72px; }

/* badges & status */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; font-size: .74rem; font-weight: 500; border: 1px solid var(--border); background: var(--secondary); white-space: nowrap; }
.pill { display: inline-flex; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 500; background: var(--secondary); white-space: nowrap; }
.badge.connected, .badge.sent, .badge.delivered, .badge.read, .badge.played, .badge.completed, .badge.success, .badge.active, .badge.valid, .badge.info { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.badge.need_scan, .badge.pending, .badge.paused, .badge.warning, .badge.unknown, .badge.scheduled { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.badge.connecting, .badge.running, .badge.in_progress, .badge.sending { background: var(--blue-soft); color: var(--blue); border-color: var(--blue-line); }
.badge.passkey, .badge.trial { background: var(--purple-soft); color: var(--purple); border-color: var(--purple-line); }
.badge.logged_out, .badge.expired, .badge.failed, .badge.error, .badge.cancelled, .badge.invalid, .badge.suspended { background: var(--red-soft); color: var(--destructive); border-color: var(--red-line); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; font-size: .82rem; }
.progress { height: 8px; background: var(--muted); border-radius: 999px; overflow: hidden; display: flex; }
.progress > span { display: block; height: 100%; background: var(--primary); }
.progress .ok { background: var(--green-dot); } .progress .bad { background: #ef4444; } .progress .skip { background: var(--muted-fg); }
.info { display: flex; gap: 10px; background: var(--blue-soft); border: 1px solid var(--blue-line); color: var(--blue); border-radius: 10px; padding: 12px 14px; font-size: .85rem; }
.info .ico { margin-top: 2px; }
.alert { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); font-size: .88rem; }
.alert.warn { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.alert.error { background: var(--red-soft); color: var(--destructive); border-color: var(--red-line); }
.alert.ok { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.alert.info { background: var(--blue-soft); color: var(--blue); border-color: var(--blue-line); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted-fg); }
.empty.dashed { border: 1px dashed var(--border); border-radius: 10px; }

/* tabs */
.tabs { display: inline-flex; gap: 2px; background: var(--muted); padding: 3px; border-radius: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { display: inline-flex; gap: 6px; align-items: center; border: 0; background: none; padding: 6px 12px; border-radius: 7px; font-weight: 500; color: var(--muted-fg); cursor: pointer; font-size: .86rem; }
.tabs button.active { background: var(--card); color: var(--foreground); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

/* tables & logs */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-weight: 500; color: var(--muted-fg); font-size: .8rem; }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted-fg); font-size: .82rem; flex-wrap: wrap; }
.log { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: grid; gap: 8px; }
.log-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.json { background: var(--muted); border-radius: 8px; padding: 10px; font: .76rem/1.5 var(--mono); overflow-x: auto; white-space: pre; margin: 0; }
pre.code { background: var(--code-bg); color: var(--code-fg); padding: 14px; border-radius: 10px; overflow-x: auto; font: .78rem/1.6 var(--mono); white-space: pre; margin: 0; }
.list { display: grid; gap: 10px; }
.list-item { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }

/* session cards */
.scard { display: flex; flex-direction: column; gap: 10px; }
.scard h3 small { color: var(--muted-fg); font-weight: 400; }

/* secrets, steps */
.secret { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; justify-content: space-between; flex-wrap: wrap; box-shadow: var(--shadow); }
.secret code { font-size: .8rem; padding: 4px 8px; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: flex; gap: 10px; }
.steps li::before { content: counter(s); width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: .72rem; font-weight: 600; background: var(--green-soft); color: var(--green); border: 1px solid var(--green-line); }
.steps a { color: var(--green); font-weight: 500; }

/* chart */
.chart { width: 100%; height: 220px; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted-fg); font-size: 11px; font-family: var(--font); }
.chart .line { stroke: var(--chart); stroke-width: 2; fill: none; }
.chart .area { fill: var(--chart-fill); stroke: none; }
.chart .pt { fill: var(--card); stroke: var(--chart); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart-wrap { position: relative; }
.tip { position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: .78rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); white-space: nowrap; transform: translate(-50%, -110%); }

/* modal & toasts */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal.wide { max-width: 780px; }
.modal header { padding: 18px 20px 8px; display: flex; justify-content: space-between; align-items: center; }
.modal .body { padding: 8px 20px 16px; }
.modal footer { padding: 12px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted-fg); }
#toasts { position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--card); color: var(--foreground); border: 1px solid var(--border); padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); max-width: 380px; font-size: .88rem; }
.toast b { display: block; }
.toast.error { border-color: var(--red-line); color: var(--destructive); }
.toast.ok { border-color: var(--green-line); }
.qr { display: flex; justify-content: center; padding: 8px; }
.qr img { width: 260px; height: 260px; background: #fff; padding: 8px; border-radius: 10px; }
.pair-code { font: 700 1.8rem/1 var(--mono); letter-spacing: .25em; text-align: center; padding: 14px; background: var(--muted); border-radius: 10px; }
.phone-frame { background: var(--muted); border-radius: 10px; padding: 12px; }
.bubble { background: #d9fdd3; color: #111; border-radius: 10px 10px 2px 10px; padding: 8px 12px; white-space: pre-wrap; word-wrap: break-word; max-width: 440px; margin-left: auto; font-size: .88rem; }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--muted); }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth .brand { justify-content: center; }

/* settings */
.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }
.settings nav { display: grid; gap: 2px; }
.settings nav a { padding: 7px 10px; border-radius: 8px; text-decoration: none; }
.settings nav a.active, .settings nav a:hover { background: var(--muted); }
.settings .panel { max-width: 640px; display: grid; gap: 16px; }
.seg { display: inline-flex; gap: 2px; background: var(--muted); padding: 3px; border-radius: 10px; }
.seg button { display: inline-flex; gap: 6px; align-items: center; border: 0; background: none; padding: 6px 14px; border-radius: 7px; cursor: pointer; }
.seg button.active { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

/* pricing */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; padding-top: 10px; }
.plan { display: flex; flex-direction: column; gap: 10px; position: relative; }
.plan.current { border: 2px solid var(--primary); }
.plan .price { font-size: 1.9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: .86rem; }
.plan ul li::before { content: "✓"; margin-right: 8px; color: var(--green); font-weight: 700; }
.plan ul li.no { color: var(--muted-fg); text-decoration: line-through; }
.plan ul li.no::before { content: "✕"; color: inherit; }
.plan .btn { margin-top: auto; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 99px; background: var(--border); position: relative; cursor: pointer; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { left: 18px; }
.faq details { border-bottom: 1px solid var(--border); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 500; }
.faq p { color: var(--muted-fg); margin-top: 8px; }
.eps-banner { display: block; width: 100%; max-width: 560px; border-radius: 8px; }

@media (max-width: 1100px) {
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.split-6040, .grid.split-1-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 45; left: 0; top: 0; bottom: 0; width: 260px; background: var(--sidebar); border-right: 1px solid var(--border); transform: translateX(-105%); transition: transform .2s; }
  .shell.open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  .collapsed .sidebar .label-text, .collapsed .nav-label, .collapsed .brand span, .collapsed .userbtn .who, .collapsed .nav .sub { display: revert; }
  .inset { margin: 0; border-radius: 0; border: 0; min-height: 100vh; }
  .content { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 80px max(16px, env(safe-area-inset-left, 0px)); }
  .grid.cols-2, .grid.cols-3, .row, .kv, .settings, .tiles { grid-template-columns: minmax(0, 1fr); }
}

/* additions: auth button, docs endpoints, chips as buttons */
.auth form .btn { width: 100%; }
.auth h2 { margin-top: 8px; }
button.chip { background: var(--card); cursor: pointer; font-family: var(--mono); font-size: .76rem; }
button.chip:hover { background: var(--muted); }
a.chip { text-decoration: none; }
a.chip:hover { background: var(--muted); }
.endpoint code { font-size: .85rem; }
.method { display: inline-flex; padding: 2px 8px; border-radius: 6px; font: 600 .72rem var(--mono); border: 1px solid var(--border); }
.method.get { background: var(--blue-soft); color: var(--blue); border-color: var(--blue-line); }
.method.post { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.method.put { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.method.delete { background: var(--red-soft); color: var(--destructive); border-color: var(--red-line); }
.card ul { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 6px; }
.plan .card-head { margin-bottom: 0; }
details > summary { cursor: pointer; }
.check > span { display: block; }
.check .small.muted { display: block; }
.stat.card { padding: 20px; }
.badge.current { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.collapsible.card { padding: 0; }
.collapsible.card > summary { border: 0; border-radius: 14px; background: none; padding: 16px 20px; }
.collapsible.card > div { padding: 0 20px 20px; }
textarea.mono { font: .8rem/1.5 var(--mono); }

.badge.info { display: inline-flex; padding: 2px 8px; border-radius: 6px; font-size: .74rem; gap: 5px; }

/* signup steps */
.onb { max-width: 1100px; margin: 0 auto; padding: 20px 20px 60px; min-height: 100vh; display: flex; flex-direction: column; gap: 18px; }
.onb-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.onb-top .brand { padding: 0; }
.onb .lead { max-width: 760px; }
.onb h1 { font-size: 1.9rem; }
.onb h1.h2 { font-size: 1.5rem; }
.onb-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.onb-grid.pay { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.stepper { list-style: none; display: flex; align-items: center; gap: 10px; padding: 0; margin: 0; font-size: .82rem; color: var(--muted-fg); flex-wrap: wrap; }
.stepper li { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.stepper li.line { flex: 1; min-width: 24px; height: 1px; background: var(--border); }
.stepper b { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border); font-size: .7rem; }
.stepper .done { color: var(--green); }
.stepper .cur { color: var(--foreground); font-weight: 600; }
.stepper .cur b { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn.big { width: 100%; height: 46px; font-size: .95rem; border-radius: 10px; }
.btn.wa { background: #22c55e; color: #052e16; border-color: #22c55e; }
.btn.wa:hover { background: #16a34a; }
.picks { display: grid; gap: 10px; }
.pick { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); cursor: pointer; }
.pick:hover { border-color: var(--ring); }
.pick.sel { border: 2px solid var(--primary); padding: 13px 15px; background: var(--muted); }
.pick .xs { display: block; margin-top: 3px; }
.pick .amt { font-size: 1.25rem; font-weight: 700; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.pick .amt small { display: block; font-size: .72rem; font-weight: 400; color: var(--muted-fg); }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; justify-content: center; }
.feats { padding-left: 18px; margin: 12px 0 0; display: grid; gap: 4px; }
.otp { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.otp input { height: 54px; text-align: center; font-size: 1.4rem; font-weight: 600; padding: 0; }
.bill > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.bill dt { color: var(--muted-fg); }
.bill dd { margin: 0; text-align: right; }
.payable { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--border); background: var(--muted); border-radius: 12px; padding: 16px; }
.payable .xs { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.big-amt { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.eps { padding: 0; overflow: hidden; }
.eps > :not(.eps-head) { margin-left: 20px; margin-right: 20px; }
.eps > :last-child { margin-bottom: 20px; }
.eps .btn.big { width: calc(100% - 40px); }
.eps-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--muted); }
.eps-logo { width: 38px; height: 38px; border-radius: 9px; background: #0f766e; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .78rem; }
.fixed { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 42px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--muted); }
.fixed .xs { display: inline-flex; gap: 4px; align-items: center; }
.eps img.eps-banner { width: calc(100% - 40px); max-width: none; }
@media (max-width: 820px) {
  .onb-grid, .onb-grid.pay { grid-template-columns: minmax(0, 1fr); }
  .stepper li.line { display: none; }
  .onb { padding: 16px 16px 48px; }
}

/* number risk */
.badge.risk-low { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.badge.risk-medium { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.badge.risk-high { background: var(--red-soft); color: var(--destructive); border-color: var(--red-line); font-weight: 600; }
.progress.risk { height: 10px; gap: 2px; background: none; }
.progress.risk > span { border-radius: 3px; }
.r-low, .progress > span.r-low { background: #22c55e; } .r-medium, .progress > span.r-medium { background: #f59e0b; } .r-high, .progress > span.r-high { background: #ef4444; }
.risk-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; color: var(--muted-fg); }
.risk-legend span { display: inline-flex; align-items: center; gap: 6px; }
.risk-legend b { color: var(--foreground); }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.picker { max-height: 52vh; overflow-y: auto; }
.picker th.cb, .picker td.cb { width: 36px; }
.picker input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
tr.muted td { color: var(--muted-fg); }
.stack.sticky { position: sticky; top: 16px; }
@media (max-width: 1100px) { .stack.sticky { position: static; } }

.toolbar select#bFrom, .toolbar select#bTo { flex: 1; min-width: 0; }
.toolbar:has(#bFrom) { flex-wrap: nowrap; }

/* number health, coupons */
.health { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.big-score { font-size: 1.3rem; }
.progress > span.h-good, .badge.h-good { background: #22c55e; } .progress > span.h-warning { background: #f59e0b; } .progress > span.h-critical { background: #ef4444; }
.badge.h-good { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.badge.h-warning { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.badge.h-critical { background: var(--red-soft); color: var(--destructive); border-color: var(--red-line); }
.hs-good { color: var(--green); } .hs-warning { color: var(--amber); } .hs-critical { color: var(--destructive); }
.toolbar .coupon-in { max-width: 220px; }
.toolbar input.num { width: 80px; flex: none; }
.step textarea { min-height: 90px; }
label.chip { cursor: pointer; font-weight: 400; margin: 0; }

/* banners, nav count */
#banners:empty { display: none; }
.topnote { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 24px; border-bottom: 1px solid var(--border); font-size: .88rem; }
.topnote.info { background: var(--blue-soft); color: var(--blue); }
.topnote.warn, .topnote.warning { background: var(--amber-soft); color: var(--amber); }
.nav-count { margin-left: auto; background: var(--destructive); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 600; padding: 1px 7px; }

/* inbox */
.content.flush { padding: 0; }
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 16px - 58px); min-height: 480px; }
.ib-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.ib-tools { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--border); }
.ib-tools .toolbar select { flex: 1; }
.ib-items { overflow-y: auto; flex: 1; }
.ib-item { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); text-decoration: none; }
.ib-item:hover { background: var(--muted); } .ib-item.active { background: var(--sidebar-accent); }
.ib-item.unread b { font-weight: 700; }
.ib-main { min-width: 0; display: grid; gap: 2px; }
.ib-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; min-width: 0; }
.ib-prev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.ib-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ib-thread > .empty { margin: auto; }
.ib-head { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ib-head select { width: auto; }
.ib-back { display: none; }
.ib-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: var(--muted); }
.msg { display: flex; } .msg.out { justify-content: flex-end; }
.bubble2 { max-width: min(560px, 80%); padding: 7px 10px 5px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); white-space: pre-wrap; word-wrap: break-word; font-size: .9rem; }
.msg.out .bubble2 { background: #d9fdd3; color: #111; border-color: #c4ecbd; }
.bubble2 .meta { display: block; text-align: right; font-size: .68rem; color: var(--muted-fg); margin-top: 2px; }
.msg.out .bubble2 .meta { color: #4b5563; }
.ib-compose { border-top: 1px solid var(--border); padding: 10px 12px; display: grid; gap: 8px; }
.ib-compose textarea { min-height: 44px; flex: 1; }
.ib-compose .toolbar input, .ib-compose .toolbar select { flex: 1; min-width: 120px; }
.tmsg { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.tmsg.staff { background: var(--blue-soft); border-color: var(--blue-line); }
.tbody { white-space: pre-wrap; margin-top: 4px; }
@media (max-width: 820px) {
  .inbox { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 58px); }
  .inbox.has-thread .ib-list, .inbox:not(.has-thread) .ib-thread { display: none; }
  .ib-back { display: inline-flex; }
}

/* integrations */
.intg { display: flex; flex-direction: column; }
.intg .btns { margin-top: auto; padding-top: 12px; }
.intg h3 { display: flex; align-items: center; gap: 8px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--muted); }
ul.bullets { padding-left: 18px; margin: 0; display: grid; gap: 6px; }
.fieldlist { display: flex; flex-wrap: wrap; gap: 6px; max-height: 420px; overflow: auto; }
.fchip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; border: 1px solid var(--border); background: var(--card); color: inherit; border-radius: 8px; padding: 6px 8px; cursor: pointer; font: inherit; max-width: 100%; }
.fchip:hover { border-color: var(--ring); }
.fchip code { background: none; padding: 0; }
.wg-stage { position: relative; min-height: 340px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--muted); padding: 16px; display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; gap: 12px; }
.wg-stage.left { align-items: flex-start; }
.wg-card { width: 260px; max-width: 100%; background: #fff; color: #111; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.wg-head { color: #fff; padding: 12px 14px; font-weight: 600; font-size: .9rem; }
.wg-body { background: #efeae2; padding: 14px; }
.wg-msg { background: #fff; border-radius: 0 10px 10px 10px; padding: 9px 11px; font-size: .85rem; white-space: pre-wrap; }
.wg-go { margin: 10px 14px 14px; text-align: center; color: #fff; border-radius: 999px; padding: 8px; font-weight: 600; font-size: .85rem; }
.wg-btn { color: #fff; border-radius: 999px; padding: 10px 16px; font-weight: 600; font-size: .9rem; box-shadow: 0 6px 20px rgba(0,0,0,.18); }

/* revenue bars */
.hbars { display: grid; gap: 6px; }
.hbar { display: grid; grid-template-columns: 52px 1fr 90px 54px; align-items: center; gap: 10px; }
.hbar .track { height: 14px; background: var(--muted); border-radius: 4px; overflow: hidden; }
.hbar .track > span { display: block; height: 100%; background: var(--green); border-radius: 0 4px 4px 0; min-width: 0; }
.hbar > :nth-child(3), td.r { text-align: right; white-space: nowrap; }
td.ok { color: var(--green); }

/* hard risk warning (unknown numbers) */
.alert.danger-box { border-width: 2px; line-height: 1.55; }
.alert.danger-box > b:first-child { font-size: 1.02rem; }
.alert.danger-box .btns { flex-wrap: wrap; }
.text-error { color: var(--destructive); }
.topbar .lang-toggle { margin-left: auto; font-weight: 500; }
.auth .card { position: relative; }
.auth-lang { position: absolute; top: 12px; right: 12px; }
.onb-top .btns { align-items: center; }
.topbar .lang-toggle + .support { margin-left: 8px; }
.optin-row { display: flex; gap: 14px; align-items: center; }
.optin-qr { width: 120px; height: 120px; border-radius: 8px; border: 1px solid var(--border); background: #fff; flex: none; }
@media (max-width: 520px) { .optin-row { flex-direction: column; align-items: stretch; } .optin-qr { align-self: center; } }
.check-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.check-steps li { display: flex; gap: 12px; align-items: flex-start; }
.check-steps .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-size: .75rem; flex: none; margin-top: 1px; }
.check-steps li.done .tick { background: var(--green); border-color: var(--green); color: #fff; }
.check-steps li.done b { color: var(--muted-fg); text-decoration: line-through; font-weight: 500; }
.check-steps li.next .tick { border-color: var(--primary); }
.check-steps a { color: inherit; text-decoration: none; }
.check-steps a:hover b { text-decoration: underline; }
