/* FirstNet look (www.firstnet.co.za): deep navy, blue and cyan accents, Montserrat headings, Inter text.
   Shared by the console (otp-admin) and the customer portal (mfa). Fonts are self-hosted: the portal's CSP
   allows nothing from other origins. Inter and Montserrat are under the SIL Open Font License (fonts/OFL-*.txt). */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/inter-400.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/inter-500.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/inter-600.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/inter-700.woff2) format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/montserrat-500.woff2) format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/montserrat-600.woff2) format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/montserrat-700.woff2) format("woff2"); }

:root {
  color-scheme: dark;
  --page: #070b12;
  --page-2: #05080d;
  --surface: #101826;
  --surface-2: #131d2d;
  --surface-3: #18243a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f2f6fa;
  --text-2: #c9d6e3;
  --muted: #8fa3b8;
  --accent: #5aa9ec;
  --accent-ink: #070b12;
  --accent-soft: rgba(90, 169, 236, 0.14);
  --cyan: #3fd8f5;
  --cyan-soft: #9fd9ec;
  --grid: #1a2534;
  --axis: #2a3747;
  --good: #34d399;
  --good-text: #5fe3b0;
  --warn: #f5b942;
  --serious: #f0905f;
  --critical: #f06464;
  --critical-text: #ff8f8f;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 20px 40px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: "Montserrat", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--page); }
body { background: var(--page); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--cyan-soft); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-heading); color: var(--text); }
h1 { font-size: 24px; font-weight: 600; margin: 0; letter-spacing: -0.01em; line-height: 1.2; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 14px; letter-spacing: -0.005em; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
::selection { background: rgba(63, 216, 245, 0.3); }
.boot { padding: 40px; color: var(--muted); }

/* ---------- brand ---------- */
.logo { display: block; height: 26px; width: auto; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 6px 12px 24px; }
.brand-sub { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan-soft); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--page-2); border-right: 1px solid var(--border); padding: 22px 12px 20px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 14px; border-radius: 999px; color: var(--text-2); font-weight: 500; }
.nav a:hover { background: var(--surface); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--cyan); }
.nav svg { width: 17px; height: 17px; flex: none; }
.sidebar .spacer { flex: 1; }
.user { border-top: 1px solid var(--border); padding: 14px 12px 0; font-size: 13px; }
.user .name { font-weight: 600; }
.user .role { color: var(--muted); font-size: 12px; word-break: break-word; }
.main { padding: 30px 36px 56px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.menu-btn { display: none; }

/* ---------- cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: 2fr 1fr; }
.cols-2e { grid-template-columns: 1fr 1fr; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.tile .label { font-size: 11.5px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.07em; }
.tile .value { font-family: var(--font-heading); font-size: 28px; font-weight: 600; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.section { margin-top: 16px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; }
.table-wrap:not(:last-child) { margin-bottom: 0; border-bottom: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.link { cursor: pointer; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
tfoot td { font-weight: 600; border-top: 1px solid var(--border-strong); }
.empty { color: var(--muted); padding: 28px 12px; text-align: center; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); color: var(--text-2); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.good { color: var(--good-text); border-color: rgba(52, 211, 153, 0.25); background: rgba(52, 211, 153, 0.08); } .pill.good::before { background: var(--good); }
.pill.blocked { color: var(--text-2); border-color: rgba(240, 144, 95, 0.25); } .pill.blocked::before { background: var(--serious); }
.pill.bad { color: var(--critical-text); border-color: rgba(240, 100, 100, 0.3); background: rgba(240, 100, 100, 0.08); } .pill.bad::before { background: var(--critical); }
.pill.neutral::before { background: var(--muted); }
.pill.plain::before { display: none; }

/* ---------- forms ---------- */
label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--page-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 12px; min-width: 0; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(63, 216, 245, 0.18); }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: end; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters label.field { min-width: 140px; }
.errors { background: rgba(240, 100, 100, 0.1); border: 1px solid rgba(240, 100, 100, 0.3); color: var(--critical-text); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px; }
.errors ul { margin: 0; padding-left: 18px; }
.notice { background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.28); color: var(--good-text); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px; }
.notice code, .errors code { font-family: var(--mono, ui-monospace, monospace); font-size: 12px; }

/* Buttons follow the site: a white pill for the main action, outlined pills for the rest. */
button, .btn { font: inherit; font-weight: 600; border-radius: 999px; padding: 8px 18px; border: 1px solid rgba(255, 255, 255, 0.25); background: transparent; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
button:hover, .btn:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.4); color: var(--text); text-decoration: none; }
button.primary, .btn.primary { background: #ffffff; border-color: #ffffff; color: var(--accent-ink); }
button.primary:hover, .btn.primary:hover { background: #dbe5ef; border-color: #dbe5ef; color: var(--accent-ink); }
button.danger { color: var(--critical-text); border-color: rgba(240, 100, 100, 0.4); }
button.danger:hover { background: rgba(240, 100, 100, 0.1); color: var(--critical-text); }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; padding: 3px; gap: 2px; background: var(--page-2); }
.seg button { border: 0; border-radius: 999px; padding: 5px 14px; color: var(--text-2); }
.seg button.on { background: var(--accent-soft); color: var(--cyan); }

/* ---------- dialog ---------- */
dialog { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 0; width: min(720px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
dialog::backdrop { background: rgba(3, 6, 10, .7); }
dialog header, dialog footer { padding: 16px 22px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
dialog header { border-bottom: 1px solid var(--border); }
dialog footer { border-top: 1px solid var(--border); justify-content: flex-end; }
dialog .body { padding: 22px; max-height: 70vh; overflow: auto; }

/* ---------- key/value ---------- */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 9px 20px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }

/* ---------- chart ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: rgba(255, 255, 255, 0.04); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-bottom: 10px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); min-width: 140px; z-index: 5; }
.tooltip .t { font-weight: 600; margin-bottom: 4px; }
.tooltip .r { display: flex; justify-content: space-between; gap: 14px; color: var(--text-2); }
.tooltip .r b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
details.as-table { margin-top: 10px; font-size: 12px; color: var(--muted); }
details.as-table summary { cursor: pointer; }

/* ---------- sign-in ---------- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse 60% 50% at 70% 15%, rgba(90, 169, 236, 0.16), transparent 70%),
    radial-gradient(ellipse 50% 45% at 15% 90%, rgba(63, 216, 245, 0.08), transparent 70%), var(--page); }
.signin .card { width: min(440px, 100%); padding: 40px 36px; text-align: center; }
.signin .logo { height: 34px; margin: 0 auto; }
.signin .eyebrow { margin: 24px 0 0; font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan-soft); }
.signin h1 { margin: 8px 0 8px; font-size: 26px; }
.signin p { color: var(--muted); margin: 0 0 26px; }
.ms-btn { width: 100%; justify-content: center; padding: 11px 18px; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #ffffff; color: var(--accent-ink); padding: 10px 18px; border-radius: 999px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
#toast.show { opacity: 1; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .7); }
  .main { padding: 18px 16px 40px; }
  .menu-btn { display: inline-flex; padding: 6px 12px; }
  .cols-2, .cols-2e { grid-template-columns: 1fr; }
}

/* ---------- pricing & budgets ---------- */
.meter { height: 8px; border-radius: 999px; background: var(--grid); overflow: hidden; margin: 8px 0 2px; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--cyan)); border-radius: 999px; }
.meter.warn > span { background: var(--warn); }
.meter.over > span { background: var(--critical); }
.warning { background: rgba(245, 185, 66, 0.1); border: 1px solid rgba(245, 185, 66, 0.3); color: var(--text); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px; }
table.edit td { padding-top: 6px; padding-bottom: 6px; }
table.edit input, table.edit select { width: 100%; }
table.edit input.amount { text-align: right; font-variant-numeric: tabular-nums; min-width: 90px; }

/* Which server answered (bottom of the sidebar) */
.user .server { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); }
.user .server .mono { font-size: 11px; }
.server-site { font-weight: 700; letter-spacing: 0.08em; font-size: 10.5px; color: var(--cyan); border: 1px solid rgba(63, 216, 245, 0.35); border-radius: 999px; padding: 1px 7px; }
