/* AllRoundIT console. Layout and components follow the AllRoundIT dashboard design; colours
   follow the AllRoundIT login (blues #005a9c / #004377 / #0d6ebd). */
:root {
  --brand: #0d6ebd;
  --brand-hover: #005a9c;
  --brand-deep: #004377;
  --brand-tint: #e8f2fb;
  --brand-ring: rgba(13, 110, 189, .22);

  --side-bg: #062b4c;
  --side-surface: #08355c;
  --side-border: #0d3f6b;
  --side-hover: #0a3a64;
  --side-active: #0e4c82;
  --side-text: #c9d9ea;
  --side-muted: #8eabc8;
  --side-accent: #5cb4ff;

  --bg: #f8fafc;
  --surface: #ffffff;
  --subtle: #f1f5f9;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --line-strong: #cbd5e1;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;

  --green-bg: #ecfdf5; --green-ink: #047857; --green-line: #a7f3d0;
  --red-bg: #fff1f2;   --red-ink: #be123c;   --red-line: #fecdd3;
  --amber-bg: #fffbeb; --amber-ink: #b45309; --amber-line: #fde68a;
  --blue-bg: #eff6ff;  --blue-ink: #1d4ed8;  --blue-line: #bfdbfe;
  --gray-bg: #f1f5f9;  --gray-ink: #475569;  --gray-line: #cbd5e1;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Calibri, Carlito, 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --chart-grid: #e2e8f0;
  --chart-axis: #94a3b8;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
::selection { background: #1e293b; color: #fff; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: var(--mono); }
svg { flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Buttons ---------------------------------------------------------------------------- */
button { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--brand); border-radius: 4px; background: var(--brand); color: #fff; font-size: 13px; font-weight: 500; line-height: 1.3; transition: background-color .15s, border-color .15s, color .15s; }
button:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button.secondary, .ghost, a.button { background: #fff; color: var(--ink-2); border-color: var(--line-strong); }
button.secondary:hover, a.button:hover { background: var(--bg); border-color: var(--faint); color: var(--ink); }
button.secondary svg { color: var(--muted); }
button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
button.ghost:hover { background: var(--subtle); color: var(--ink); }
button.danger { background: #e11d48; border-color: #e11d48; color: #fff; }
button.danger:hover { background: #be123c; border-color: #be123c; }
button.small, a.button.small { padding: 5px 10px; font-size: 12px; }
a.button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 4px; text-decoration: none; font-size: 13px; font-weight: 500; }
button.link { padding: 0; border: 0; background: none; color: var(--ink); font-weight: 600; text-align: left; justify-content: flex-start; }
button.link:hover { background: none; color: var(--brand); }
.close { padding: 2px 6px; border: 0; background: none; color: var(--faint); font-size: 22px; line-height: 1; }
.close:hover { background: var(--subtle); color: var(--ink); }

/* ---- Sign in (AllRoundIT login design) ---------------------------------------------------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between; color: #fff; position: relative; overflow-x: hidden; user-select: none;
  background-color: #0b609c;
  background-image: radial-gradient(ellipse at 50% 40%, rgba(20, 120, 190, .85) 0%, rgba(5, 70, 120, .95) 75%, rgba(2, 50, 95, 1) 100%), linear-gradient(135deg, rgba(255, 255, 255, .05) 0%, transparent 60%); }
.auth::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 20% 70%, rgba(2, 45, 80, .6) 0%, transparent 50%), radial-gradient(circle at 80% 65%, rgba(3, 40, 75, .5) 0%, transparent 50%), linear-gradient(180deg, transparent 40%, rgba(0, 35, 65, .4) 100%); }
.auth-top { height: 48px; }
.auth-main { position: relative; z-index: 1; width: 100%; max-width: 896px; margin: 0 auto; padding: 32px 24px; display: flex; align-items: center; justify-content: center; }
.auth-unit { width: 100%; max-width: 640px; display: flex; align-items: stretch; justify-content: center; gap: 40px; }
.auth-brand { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px 0; }
.auth-logo { position: relative; display: flex; align-items: center; justify-content: center; margin-bottom: 24px; }
.auth-ring { position: absolute; right: -12px; top: -8px; width: 64px; height: 64px; border: 1.5px dashed rgba(255, 255, 255, .4); border-radius: 50%; opacity: .6; pointer-events: none; }
.auth-logo h1 { position: relative; margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -.025em; line-height: 1.2; }
.auth-logo sup { font-size: 12px; font-weight: 400; margin-left: 4px; opacity: .75; }
.auth-link { color: #fff; font-size: 14px; letter-spacing: .02em; text-decoration: none; }
.auth-link:hover { color: #dbeafe; }
.auth-divider { width: 1px; align-self: stretch; margin: 8px 0; opacity: .8; background: linear-gradient(180deg, rgba(255, 255, 255, .05) 0%, rgba(255, 255, 255, .35) 20%, rgba(255, 255, 255, .35) 80%, rgba(255, 255, 255, .05) 100%); }
.auth-pane { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 8px 16px; user-select: text; }
.auth-pane h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.auth-form { width: 100%; max-width: 240px; display: flex; flex-direction: column; gap: 12px; }
.auth-pane.wide .auth-form { max-width: 290px; gap: 9px; }
.auth-input { display: block; width: 100%; height: 38px; padding: 6px 12px; background: #fff; border: 1px solid #d1d5db; border-radius: 2px; font-size: 15px; color: #374151; outline: none; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08); transition: border-color .15s; }
select.auth-input { font-size: 14px; }
.auth-input::placeholder { color: #9ca3af; font-size: 14px; }
.auth-input:focus { border-color: #3b82f6; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px #3b82f6; }
.auth-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 4px; }
.auth-forgot { color: rgba(255, 255, 255, .9); font-size: 13px; font-style: italic; letter-spacing: -.01em; text-decoration: none; }
.auth-forgot:hover { color: #fff; }
.auth-go { padding: 0; border: 0; background: none; color: #fff; font-size: 16px; font-weight: 600; gap: 2px; }
.auth-go:hover { background: none; color: #dbeafe; }
.auth-go:active { transform: scale(.95); }
.auth-go svg { width: 16px; height: 16px; stroke-width: 3; transition: transform .15s; }
.auth-go:hover svg { transform: translateX(2px); }
.auth-error { min-height: 18px; margin: 0; font-size: 12.5px; color: #fecdd3; }
.auth-note { margin: 0 0 12px; max-width: 290px; font-size: 13px; line-height: 1.55; color: rgba(255, 255, 255, .85); }
.auth-small { font-size: 11px; line-height: 1.4; color: rgba(255, 255, 255, .75); }
.auth-footer { position: relative; z-index: 1; padding: 0 40px 16px 24px; text-align: right; }
.auth-footer nav { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: rgba(255, 255, 255, .8); }
.auth-footer a { color: rgba(255, 255, 255, .8); text-decoration: none; }
.auth-footer a:hover { color: #fff; }
.auth-footer span { color: rgba(255, 255, 255, .6); }
@media (max-width: 767px) {
  .auth-top { height: 24px; }
  .auth-unit { flex-direction: column; gap: 32px; }
  .auth-divider { width: 75%; height: 1px; margin: 0 auto; align-self: auto; background: rgba(255, 255, 255, .2); }
  .auth-pane { align-items: center; padding: 0 8px; }
  .auth-form, .auth-pane.wide .auth-form { max-width: 320px; }
  .auth-footer { padding-right: 24px; }
}

/* ---- App shell: sidebar + header ---------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 256px; flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--side-bg); color: var(--side-text); border-right: 1px solid var(--side-border); user-select: none; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--side-border); }
.brand-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2); }
.brand-icon svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.brand-text { display: grid; }
.brand-line { display: flex; align-items: center; gap: 6px; }
.brand-line strong { color: #fff; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.brand-ver { font: 10px var(--sans); color: var(--side-muted); background: var(--side-surface); padding: 0 4px; border-radius: 3px; }
.brand-text small { font-size: 11px; color: var(--side-muted); }
.side-nav { flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 24px; font-size: 14px; scrollbar-width: thin; scrollbar-color: #1e3a5f transparent; }
.side-nav::-webkit-scrollbar-thumb { background: var(--side-border); }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-label { margin: 0; padding: 0 12px 8px; font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--side-muted); }
.side-item { width: 100%; justify-content: space-between; gap: 8px; padding: 8px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--side-text); font-size: 12px; font-weight: 400; text-align: left; }
.side-item:hover { background: var(--side-hover); border-color: transparent; color: #fff; }
.side-item.active { background: var(--side-active); color: #fff; font-weight: 500; }
.side-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.side-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item svg { width: 16px; height: 16px; fill: none; stroke: var(--side-muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-item.active svg { stroke: var(--side-accent); }
.side-item.active::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--side-accent); flex: none; }
.side-item.active .side-badge + * { display: none; }
.side-badge { font: 11px var(--sans); font-style: normal; padding: 1px 6px; border-radius: 4px; background: var(--side-surface); color: var(--side-muted); flex: none; }
.side-badge.plain { background: none; padding: 0; font-size: 10px; }
.side-badge.live { background: none; padding: 0; font-size: 10px; color: #34d399; }
.side-badge.warn { font-size: 10px; color: #fbbf24; background: rgba(120, 53, 15, .45); border: 1px solid rgba(146, 64, 14, .5); }
.side-item.active .side-badge { display: none; }
.side-hidden { display: none !important; }
.side-workspace { padding: 0 0 12px; margin-bottom: 4px; }
.switcher select { width: 100%; margin: 0 0 4px; padding: 7px 10px; border: 1px solid var(--side-border); border-radius: 6px; background: var(--side-surface); color: #fff; font-size: 12px; }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--side-border); font-size: 11px; color: var(--side-muted); }
.env-pill { font: 10px var(--sans); padding: 2px 6px; border-radius: 4px; background: var(--side-surface); color: #fbbf24; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 32px; background: #fff; border-bottom: 1px solid var(--line); }
.page-title { min-width: 0; }
.page-title h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); line-height: 1.25; }
.page-title p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.top-right { display: flex; align-items: center; gap: 16px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-sep { width: 1px; height: 20px; background: var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 4px; background: #1e293b; border: 1px solid #334155; color: #fff; font: 600 11px var(--sans); }
.user-text { display: grid; line-height: 1.2; }
.user-text strong { font-size: 12px; font-weight: 500; color: var(--ink); }
.user-text small { font: 12px var(--sans); color: var(--faint); margin-top: 2px; }
.icon-btn { padding: 4px; border: 0; background: none; color: var(--faint); }
.icon-btn:hover { background: none; color: var(--ink-2); }
.icon-btn.out:hover { color: #f43f5e; }
.icon-btn svg { width: 15px; height: 15px; }

.content { width: 100%; max-width: 1360px; padding: 28px 32px 48px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
#platform > .subnav { display: none; }

/* ---- Notices and banners ------------------------------------------------------------------ */
.notice { margin: 0 0 18px; padding: 10px 14px; border: 1px solid var(--green-line); background: var(--green-bg); color: var(--green-ink); border-radius: 6px; font-size: 13px; }
.notice.error-notice { border-color: var(--red-line); background: var(--red-bg); color: var(--red-ink); }
.banner { margin: 0 0 18px; padding: 10px 14px; border: 1px solid var(--amber-line); background: var(--amber-bg); color: var(--amber-ink); border-radius: 6px; font-size: 13px; font-weight: 500; }
.banner.billing { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.banner.billing.danger { border-color: var(--red-line); background: var(--red-bg); color: var(--red-ink); }
.banner.billing small { color: inherit; opacity: .8; }

/* ---- Layout helpers ----------------------------------------------------------------------- */
.grid { display: grid; gap: 24px; }
.grid.two { grid-template-columns: 2fr 1fr; }
.grid.two.even { grid-template-columns: 1fr 1fr; }
.grid.two:has(> [hidden]) { grid-template-columns: 1fr; }
.stack-gap { margin-top: 24px; }
.stack-bottom { margin-bottom: 24px; }
.split-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.split-heading h2 { margin: 2px 0 0; font-size: 16px; font-weight: 600; }
.eyebrow { margin: 0; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.hint.pad { margin: 0; padding: 12px 20px 16px; }
.pad { padding: 12px 20px; }
.pad-x { padding: 0 20px; }
.muted { color: var(--muted); }
.error-text { color: var(--red-ink) !important; }
.sub, .dtable .sub { display: block; margin-top: 2px; font-size: 11px; font-weight: 400; color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
.row-actions.left { justify-content: flex-start; margin: 6px 0; }
.loading-row { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---- KPI cards ---------------------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi { min-width: 0; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.kpi > span { display: block; font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.kpi strong { display: block; margin-top: 8px; font: 700 26px/1.2 var(--sans); color: var(--ink); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi small { display: block; margin-top: 4px; font: 12.5px/1.45 var(--sans); color: var(--muted); }
.kpi.attention { border-color: #fde68a; background: #fffdf5; }
.kpi.attention > span { color: #475569; }
.kpi.attention small { color: var(--amber-ink); }
.kpis.pad { padding: 20px; margin: 0; }

/* ---- Panels ------------------------------------------------------------------------------- */
.panel { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.panel h2 { margin: 2px 0 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.panel h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush-body { padding: 0; overflow: hidden; }
.panel.flush-body > header { margin: 0; padding: 14px 20px; background: rgba(248, 250, 252, .6); border-bottom: 1px solid var(--line); }
.panel.narrow { max-width: 780px; }
.panel.inset { padding: 14px; background: var(--bg); }
.panel.inset .big { margin: 2px 0; font-size: 16px; font-weight: 700; }
.pill { display: inline-flex; align-items: center; width: max-content; padding: 2px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--subtle); color: var(--ink-2); font: 12px var(--sans); }
.pill.success { border-color: var(--green-line); background: var(--green-bg); color: var(--green-ink); }

/* ---- Status pills (event-code style) ------------------------------------------------------- */
.status { display: inline-block; width: max-content; padding: 2px 6px; border: 1px solid var(--amber-line); border-radius: 4px; background: var(--amber-bg); color: var(--amber-ink); font: 700 11px/1.5 var(--sans); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.status.PAID, .status.ACTIVE, .status.ONLINE, .status.SENT { border-color: var(--green-line); background: var(--green-bg); color: var(--green-ink); }
.status.FAILED, .status.EXPIRED, .status.SUSPENDED, .status.OFFLINE, .status.DISABLED, .status.REVOKED { border-color: var(--red-line); background: var(--red-bg); color: var(--red-ink); }
.status.DEGRADED, .status.PROVIDER_CONFIRMATION, .status.GRACE, .status.PAST_DUE { border-color: var(--amber-line); background: var(--amber-bg); color: var(--amber-ink); }
.status.PENDING, .status.ARCHIVED, .status.NOT_STARTED, .status.UNUSED, .status.QUEUED { border-color: var(--gray-line); background: var(--gray-bg); color: var(--gray-ink); }
.status.REFUNDED, .status.RENEWED, .status.TRIAL, .status.USED { border-color: var(--blue-line); background: var(--blue-bg); color: var(--blue-ink); }

/* ---- Tables ------------------------------------------------------------------------------- */
.dtable-wrap { overflow-x: auto; }
.dtable { width: 100%; border-collapse: collapse; font-size: 12px; }
.dtable th { position: sticky; top: 0; padding: 10px 16px; background: #f4f6f9; border-bottom: 1px solid var(--line); color: #475569; font-size: 11px; font-weight: 500; text-align: left; white-space: nowrap; }
.dtable td { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; color: var(--ink-2); }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable tbody tr:hover { background: rgba(248, 250, 252, .9); }
.dtable .right { text-align: right; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.dtable code { display: inline-block; padding: 1px 6px; border: 1px solid var(--gray-line); border-radius: 4px; background: var(--gray-bg); color: #334155; font-size: 10.5px; }
.dtable .change { font: 11px var(--sans); color: var(--muted); word-break: break-word; }
.panel > .dtable-wrap, .panel.flush > div > .dtable-wrap { margin: 0; }
.empty-row { padding: 32px 20px; text-align: center; font-size: 13px; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 20px; border-top: 1px solid var(--line); background: #fff; font-size: 12px; color: var(--muted); }
.pager:empty { display: none; }
.pager span:last-child { display: flex; gap: 4px; }
.pager button { padding: 2px 10px; font: 12px var(--sans); background: #fff; color: var(--ink-2); border: 1px solid var(--line); }
.pager button:hover:not(:disabled) { background: var(--bg); }

/* ---- Toolbars and forms -------------------------------------------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.toolbar.tight { margin: 0; }
.toolbar .spacer { flex: 1; }
.toolbar input, .toolbar select, .inline-select { height: 32px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; color: var(--ink); font-size: 12.5px; }
.toolbar input[type=search] { min-width: 240px; }
.toolbar.tight input { min-width: 170px; }
.toolbar label.inline { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.toolbar label.check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.inline-select { height: 28px; padding: 2px 8px; font-size: 12px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand) !important; box-shadow: 0 0 0 3px var(--brand-ring); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid label, label.block { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.form-grid input, .form-grid select, label.block input, dialog textarea, .form-grid textarea { display: block; width: 100%; margin-top: 5px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; color: var(--ink); font-size: 13px; }
.form-grid input[type=color] { padding: 2px; }
.form-grid > button { grid-column: 1 / -1; justify-self: start; }
.form-grid .span { grid-column: 1 / -1; }
.form-grid .span2 { grid-column: span 2; }
.form-grid.three { grid-template-columns: repeat(4, 1fr); padding: 14px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; background: var(--bg); }
.form-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
label.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; font-weight: 400; color: var(--ink-2); }
label.check input { width: auto; margin: 3px 0 0; accent-color: var(--brand); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 0; }
legend { padding: 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.site-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-checks .check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.site-checks input { width: auto; margin: 0; accent-color: var(--brand); }
details { margin: 10px 0; }
details summary { cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--brand); }
dialog textarea, #wg-status textarea, #rs-install, #rs-ports-command, #router-setup-dialog details textarea { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 4px; background: #0f172a; color: #e2e8f0; font: 12px/1.5 var(--mono); resize: vertical; }
.sms-wording textarea { background: #fff; color: var(--ink); font: 13px/1.5 var(--sans); }
input.mini { width: 88px !important; display: inline-block !important; margin: 0 6px !important; padding: 3px 8px !important; }
.color-row { display: flex; gap: 6px; margin-top: 5px; }
.color-row input[type=color] { width: 44px; height: 34px; padding: 2px; margin: 0; }
.color-row input:not([type=color]) { margin: 0; }

/* ---- Dialogs (create / edit forms) ---------------------------------------------------------- */
dialog { width: min(620px, calc(100% - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); box-shadow: 0 24px 64px rgba(15, 23, 42, .25); }
dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
dialog > form, dialog > div { padding: 20px 24px 22px; }
dialog header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -20px -24px 18px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: rgba(248, 250, 252, .7); }
dialog h2 { margin: 0; font-size: 16px; font-weight: 600; }
dialog.wide { width: min(1180px, calc(100% - 32px)); }
dialog.wide h3 { margin: 4px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
dialog footer { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin: 20px -24px -22px; padding: 14px 24px; border-top: 1px solid var(--line); background: rgba(248, 250, 252, .7); }
dialog footer button[value=cancel], dialog footer .secondary { background: #fff; color: var(--ink-2); border-color: var(--line-strong); }
dialog footer button[value=cancel]:hover { background: var(--bg); }
#confirm-dialog > form { padding-top: 22px; }
#confirm-dialog h2 { margin-bottom: 8px; }
.confirm-body { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.secret-box { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px dashed #f59e0b; border-radius: 6px; background: var(--amber-bg); }
.secret-box code { flex: 1; word-break: break-all; color: #92400e; font-size: 13px; }

/* ---- Charts (bars, ranks, meters) ---------------------------------------------------------- */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .base-line { stroke: var(--line-strong); stroke-width: 1; }
.chart .axis-label { fill: var(--chart-axis); font: 10px var(--sans); }
.chart .hit { fill: transparent; }
.chart .bar-col.hover .hit { fill: rgba(15, 23, 42, .04); }
.chart-tip { position: absolute; z-index: 3; pointer-events: none; white-space: pre; padding: 7px 10px; border-radius: 6px; background: #0f172a; color: #f8fafc; font: 11px/1.5 var(--sans); box-shadow: 0 8px 24px rgba(15, 23, 42, .25); }
.chart-empty { min-height: 180px; display: grid; place-items: center; }
.legend { display: flex; gap: 16px; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.rank { display: grid; gap: 2px; }
.rank-row { display: grid; grid-template-columns: minmax(0, 1.3fr) 1fr auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 7px 6px; border: 0; border-radius: 6px; background: none; color: var(--ink); font-size: 12.5px; font-weight: 500; text-align: left; }
button.rank-row:hover { background: var(--bg); }
.rank-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row small { grid-column: 3; text-align: right; font-size: 11px; font-weight: 400; color: var(--muted); }
.rank-row strong { text-align: right; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.rank-bar { height: 8px; border-radius: 4px; background: var(--subtle); overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--brand); }
.rank-bar i.reject { background: #e11d48; }
.meter { display: grid; gap: 4px; margin: 10px 0; }
.meter span { font-size: 12px; color: var(--muted); }
.meter-bar { height: 8px; border-radius: 4px; background: var(--subtle); overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--brand); }
.meter-bar i.high { background: #e11d48; }

/* ---- Platform health strip ----------------------------------------------------------------- */
.health-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.health { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.health > span:nth-child(2) { display: grid; min-width: 0; }
.health strong { font-size: 12px; font-weight: 600; }
.health small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health .dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--faint); }
.health.ok .dot { background: #10b981; }
.health.bad { border-color: var(--red-line); }
.health.bad .dot { background: #e11d48; box-shadow: 0 0 0 3px rgba(225, 29, 72, .15); }
.health.unknown .dot { background: #f59e0b; }

/* ---- Sub-tabs inside a page (e.g. Billing) -------------------------------------------------- */
.subnav { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.subnav button { margin-bottom: -1px; padding: 9px 14px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 500; }
.subnav button:hover { background: none; color: var(--ink); }
.subnav button.active { color: var(--brand); border-bottom-color: var(--brand); }
.p-view { display: none; }
.p-view.active { display: block; }

/* ---- Workspace widgets -------------------------------------------------------------------- */
.inspect-grid section { min-width: 0; }
.wide-specs { grid-template-columns: repeat(6, 1fr); margin: 4px 0 16px; }
.specs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.specs span { padding-left: 8px; border-left: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.specs span:first-child { padding: 0; border: 0; }
.specs strong { display: block; font: 600 12px var(--sans); color: var(--ink); }
.action-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; border: 1px solid rgba(15, 23, 42, .15); }
.role-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.role-card { display: grid; gap: 4px; align-content: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.role-card small { font-size: 12px; color: var(--muted); }
.role-card ul { margin: 6px 0 0; padding-left: 16px; font: 11px/1.6 var(--sans); color: var(--ink-2); }
.brand-preview { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); box-shadow: 0 8px 24px -14px rgba(15, 23, 42, .35); }
.brand-preview strong { font-size: 17px; }
.brand-preview small { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.brand-preview span { justify-self: start; padding: 6px 12px; border-radius: 6px; background: var(--brand); color: var(--on-brand, #fff); font-size: 12px; font-weight: 700; }
.site-picker { margin: 0; }
.invoice-line { display: grid; grid-template-columns: 1.2fr 1.6fr .5fr .7fr auto; gap: 6px; margin-bottom: 6px; }
.invoice-line input, .invoice-line select { width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; font-size: 13px; }
.invoice-totals { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 24px; margin: 6px 0 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.invoice-totals span { display: grid; text-align: right; font-size: 11px; color: var(--muted); }
.invoice-totals strong { font: 600 15px var(--sans); color: var(--ink); }
.invoice-totals .due strong { color: var(--amber-ink); }
.billing-summary .invoice-totals { justify-content: flex-start; padding-top: 0; border-top: 0; }
.stamp { display: inline-block; padding: 3px 8px; border: 2px solid #e11d48; border-radius: 4px; color: #e11d48; font: 700 12px var(--sans); letter-spacing: .06em; transform: rotate(-4deg); }
.pick-list { display: grid; gap: 4px; }
.pick-list .pick { justify-content: flex-start; background: #fff; border-color: var(--line); color: var(--ink); text-align: left; font-size: 13px; font-weight: 500; }
.pick-list .pick:hover { background: var(--bg); }
.pick-list .pick small { color: var(--muted); font-weight: 400; }
.settlement { margin-bottom: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.settlement.ok { border-color: var(--green-line); background: var(--green-bg); color: var(--green-ink); }
.settlement.warn { border-color: var(--amber-line); background: var(--amber-bg); color: var(--amber-ink); }
.timeline.empty { min-height: 220px; display: grid; place-items: center; font-size: 13px; color: var(--muted); }
.event { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.event:first-child { border: 0; }
.event-num { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--brand); font: 600 11px var(--sans); }
.event > div { display: grid; }
.event p { margin: 2px 0; font-size: 12px; color: var(--muted); }

/* SMS settings */
.sms-events { display: grid; gap: 8px; }
.sms-events label.check { align-items: center; flex-wrap: wrap; }
.sms-wording label { display: block; margin-top: 10px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.sms-wording small.hint { display: block; }
.sms-test { margin-top: 16px; }

/* Router setup wizard */
.provision { margin: 12px 0 0; }
.wizard-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 18px; }
.wizard-steps li { flex: 1; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-size: 12px; font-weight: 500; color: var(--muted); }
.wizard-steps li.active { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-deep); }
.wizard-steps li.done { color: var(--green-ink); }
.connect-status { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; font-size: 14px; }
.progress-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; font-size: 13px; }
.progress-list li { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); }
.progress-list li span { width: 18px; flex: none; text-align: center; font-weight: 700; }
.progress-list li.ok { color: var(--ink); }
.progress-list li.ok span { color: #10b981; }
.port-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 8px; margin: 10px 0 16px; }
.port { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; }
.port input { grid-row: 1 / 3; width: auto; margin: 0; accent-color: var(--brand); }
.port strong { font-family: var(--sans); font-weight: 600; }
.port small { font-size: 11px; color: var(--muted); }
.port:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.port.wan { opacity: .6; cursor: not-allowed; }
.done-banner { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.done-banner p { margin: 0; font-size: 13px; }

/* ---- Responsive --------------------------------------------------------------------------- */
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } .health-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .grid.two { grid-template-columns: 1fr; } }
@media (max-width: 960px) {
  .grid.two.even { grid-template-columns: 1fr; }
  .form-grid.three { grid-template-columns: 1fr 1fr; }
  .wide-specs { grid-template-columns: repeat(3, 1fr); }
  .role-grid { grid-template-columns: 1fr 1fr; }
}
/* Phones and small tablets: the menu is a drawer that slides in from the left, opened with
   the hamburger button in the header. */
.menu-toggle, .side-backdrop { display: none; }
.menu-toggle { color: var(--ink); padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.menu-toggle svg { width: 20px; height: 20px; }
@media (max-width: 860px) {
  .app { display: block; }
  .sidebar { position: fixed; z-index: 60; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); height: 100%; transform: translateX(-100%); transition: transform .25s ease; box-shadow: none; }
  .app.menu-open .sidebar { transform: none; box-shadow: 18px 0 40px rgba(2, 6, 23, .35); }
  .side-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(2, 6, 23, .5); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
  .app.menu-open .side-backdrop { opacity: 1; pointer-events: auto; }
  .menu-toggle { display: inline-grid; }
  .topbar { position: sticky; top: 0; z-index: 40; padding: 10px 14px; }
  .page-title h1 { font-size: 20px; }
  .topbar { flex-wrap: nowrap; }
  .page-title { min-width: 0; }
  .top-left { min-width: 0; }
  .page-title p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-right { gap: 10px; }
  .content { padding: 18px 14px 40px; }
}
@media (max-width: 860px) and (prefers-reduced-motion: reduce) { .sidebar, .side-backdrop { transition: none; } }
@media (max-width: 700px) {
  .kpis, .health-strip { grid-template-columns: 1fr 1fr; }
  .form-grid, .form-grid.three, .role-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
  .toolbar input[type=search] { min-width: 0; flex: 1 1 100%; }
  .user-text, .top-sep, #top-actions { display: none; }
  .invoice-line { grid-template-columns: 1fr 1fr; }
  .invoice-line [name="description"] { grid-column: 1 / -1; }
  .split-heading { display: grid; align-items: flex-start; }
}

.field-label { margin: 0 0 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }

/* Sidebar: just the platform name. */
.side-name { color: #fff; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }

/* Keep the console pages clean: no small help text under forms and panels, and no small
   labels above panel titles. Dialogs keep theirs (setup steps and one-time passwords). */
.tab-panel .hint, .tab-panel .panel > header .eyebrow, #paystack-intro { display: none; }
