/* Dashboard styles, served to every brand (keep product names out of this file). Colors come from /brand/theme.css (tokens); a white-label brand overrides --brand-*. */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
a { color: var(--brand-text); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 17px; margin: 0 0 4px; }
p { margin: 0 0 12px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px; position: sticky; top: 0;
        height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.side .logo { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; color: var(--ink); }
.side .logo img { display: block; }
.side .logo .name { font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm);
              color: var(--ink-2); font-weight: 600; text-decoration: none; }
.side nav a:hover { background: var(--bg); color: var(--ink); }
.side nav a.on { background: var(--brand-tint); color: var(--brand-text); }
.side nav svg { width: 18px; height: 18px; flex: none; }
.side .foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.side .foot .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.side .foot form { margin-top: 6px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand-text); font: inherit; font-weight: 600; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
main { padding: 28px 32px 64px; min-width: 0; max-width: 1200px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; min-width: 0; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 8px; }
  .side .logo { padding: 0 8px 0 0; }
  .side nav { display: flex; overflow-x: auto; gap: 2px; width: 100%; min-width: 0; order: 3; }
  .side nav a { white-space: nowrap; padding: 7px 10px; }
  .side nav svg { display: none; }
  .side .foot { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; gap: 10px; align-items: center; }
  .side .foot .who, .side .foot .muted { display: none; }
  .side .foot form { margin: 0; }
  main { padding: 20px 16px 48px; }
}

/* ---------- blocks ---------- */
.grid > * { min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 20px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.stack > * + * { margin-top: 16px; }
.tile { padding: 16px 18px; }
.tile .label { color: var(--ink-2); font-size: 13px; }
.tile .value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 4px 0; }
.tile .sub { font-size: 13px; color: var(--ink-2); }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 28px 0 12px; flex-wrap: wrap; }
.section-title h2 { margin: 0; }

.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 500; }
.flash.ok { background: var(--human-tint); color: var(--human-text); }
.flash.error { background: var(--danger-tint); color: var(--danger-text); }
.notice { background: var(--sun-tint); border-radius: var(--radius-sm); padding: 12px 16px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--ink-2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FBFDFF; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 36px 20px; text-align: center; color: var(--ink-2); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.pill.HUMAN, .pill.active { background: var(--human-tint); color: var(--human-text); }
.pill.MACHINE { background: var(--machine-tint); color: var(--machine-text); }
.pill.FALLBACK, .pill.disabled { background: var(--fallback-tint); color: var(--fallback-text); }
.pill.revoked { background: var(--danger-tint); color: var(--danger-text); }
.pill.plain { background: var(--bg); color: var(--ink-2); border: 1px solid var(--border); }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.hint { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px; }
input:focus, select:focus, button:focus-visible { outline: 3px solid var(--brand-tint); border-color: var(--brand); outline-offset: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 160px; margin-bottom: 0; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

.btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 600; padding: 9px 16px;
       border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn.primary { background: var(--brand-bright); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-bright-hover); }
.btn.secondary { background: var(--surface); color: var(--brand-text); border-color: var(--border); }
.btn.secondary:hover { background: var(--bg); }
.btn.danger { background: var(--danger-tint); color: var(--danger-text); }
.btn.danger:hover { background: #FFDADA; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: var(--brand-tint); }
.auth .box { width: 100%; max-width: 420px; }
.auth .logo { display: flex; justify-content: center; margin-bottom: 22px; }
.auth .card { padding: 28px; }
.auth h1 { font-size: 22px; margin-bottom: 4px; }
.auth .btn { width: 100%; justify-content: center; margin-top: 4px; }
.auth .alt { text-align: center; margin-top: 16px; font-size: 14px; color: var(--ink-2); }

/* ---------- charts (plain HTML bars) ---------- */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 8px; }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 3px; position: relative; }
.bars .b i { display: block; background: var(--brand-bright); border-radius: 3px 3px 0 0; min-height: 0; }
.bars .b i.h { background: var(--human); border-radius: 0; }
.bars .b:hover i { filter: brightness(.92); }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--brand-bright); vertical-align: -1px; }
.legend span.h::before { background: var(--human); }
.hbar { display: grid; grid-template-columns: 110px 1fr 70px; gap: 10px; align-items: center; font-size: 14px; margin: 8px 0; }
.hbar .track { background: var(--bg); border-radius: 999px; height: 10px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 999px; background: var(--machine); }
.hbar .fill.HUMAN { background: var(--human); }
.hbar .fill.fb { background: var(--fallback); }
.meter { background: var(--bg); border-radius: 999px; height: 10px; overflow: hidden; margin: 10px 0 6px; }
.meter i { display: block; height: 100%; background: var(--brand-bright); border-radius: 999px; }
.meter i.warn { background: var(--fallback); }

/* ---------- keys ---------- */
.keybox { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px dashed var(--brand); border-radius: var(--radius-sm); padding: 10px 12px; }
.keybox code { flex: 1; font-family: var(--font-mono); font-size: 14px; word-break: break-all; }
pre.code { background: var(--ink); color: #E6F6FE; border-radius: var(--radius-sm); padding: 14px 16px; overflow-x: auto;
           font-family: var(--font-mono); font-size: 13px; line-height: 1.6; margin: 0; }
details.inline summary { cursor: pointer; color: var(--brand-text); font-weight: 600; font-size: 13px; }
details.inline[open] { margin-top: 6px; }
audio { height: 32px; max-width: 220px; vertical-align: middle; }
.danger-zone { border-color: #FFD0D0; }

/* ---------- plan cards (Billing), same layout as the website's pricing ---------- */
.plan-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(185px, 100%), 1fr)); align-items: stretch; }
.plan-card { display: flex; flex-direction: column; padding: 24px 22px; position: relative; }
.plan-card.current { border: 2px solid var(--brand); }
.plan-card.popular { border: 2px solid var(--brand-bright); }
.plan-tag { position: absolute; top: -12px; left: 20px; background: var(--brand-bright); color: var(--on-brand); font-size: 11px;
            font-weight: 800; padding: 3px 10px; border-radius: 999px; letter-spacing: .05em; text-transform: uppercase; }
.plan-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan-top h2 { margin: 0; font-size: 19px; }
.plan-price { font-size: 36px; font-weight: 800; letter-spacing: -.03em; margin: 14px 0 2px; line-height: 1.1; }
.plan-price small { font-size: 15px; color: var(--ink-2); font-weight: 600; letter-spacing: 0; }
.plan-note { font-size: 13px; color: var(--ink-2); margin: 0 0 18px; }
.ticks { list-style: none; padding: 0; margin: 0 0 22px; font-size: 14px; }
.ticks li { position: relative; padding-left: 28px; margin: 0 0 11px; line-height: 1.45; }
.ticks li::before { content: ""; position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--human-tint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%2304724D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat; }
.plan-action { margin-top: auto; }
.btn.wide { width: 100%; justify-content: center; }

/* ---------- platform admin ---------- */
.flash.viewas { background: var(--brand-tint); color: var(--brand-text); }
.side .tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
             color: var(--danger-text); background: var(--danger-tint); border-radius: 999px; padding: 2px 8px; margin: 0 0 10px 8px;
             align-self: flex-start; }
.kv { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { width: 240px; max-width: 100%; }
.filters select { width: auto; }
details.panel { margin-top: 16px; }
details.panel > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; font-weight: 700; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: "+"; font-size: 20px; color: var(--ink-2); line-height: 1; }
details.panel[open] > summary::after { content: "–"; }
details.panel > .body { padding: 0 20px 20px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border); vertical-align: -2px; margin-right: 6px; }
.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 70px; }
.mini-bars i { flex: 1; background: var(--brand-bright); border-radius: 2px 2px 0 0; min-height: 1px; }
.mini-bars i.zero { background: var(--border); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border);
           border-radius: var(--radius-sm); padding: 9px 12px; min-height: 90px; resize: vertical; }
.radio { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; margin: 6px 0; cursor: pointer; }
.radio input { margin-top: 4px; accent-color: var(--brand); }
.inline-form { display: inline; }
