/* Airmeez Command Center
 *
 * The visual system is airmeez.com's, not a lookalike. Tokens are copied from
 * the site's own `site/src/styles/global.css`, which derives them from the logo
 * — see the site repo's `docs/02-brand.md`. Do not invent a colour here; if one
 * is missing, it is missing from the brand.
 *
 * Fonts are self-hosted, deliberately. The brand doc forbids a Google Fonts CDN
 * link: a third-party request is not acceptable on a product sold on security
 * posture, and the same reasoning applies to an internal operations console.
 */

/* --- self-hosted type, the same files airmeez.com ships ------------------- */

@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/static/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,
                 U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,
                 U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('/static/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url('/static/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
}

:root {
  /* --- brand, verbatim from airmeez.com --- */
  --brand-cyan:  #2eb8d9;
  --brand-teal:  #16ccb5;
  --brand-green: #0cdda1;
  --brand-gradient: linear-gradient(100deg, #2eb8d9 0%, #16ccb5 50%, #0cdda1 100%);
  --accent: #0a6270;

  --ink:        #1a1718;
  --ink-soft:   #4a4547;
  --ink-faint:  #909494;
  --paper:      #ffffff;
  --paper-alt:  #f7f8f8;
  --sunken:     #eef1f1;
  --rule:       #e2e6e6;
  --rule-strong:#909494;

  /* --- night band, for the footer and the dark theme ---
     The site's own hero/footer palette. Every pair below is one the site's
     contrast script already verified: #eef2f2 / #a3aeae / #16ccb5 on
     #0f1213 and #171b1c. */
  --night:       #0f1213;
  --night-alt:   #171b1c;
  --night-text:  #eef2f2;
  --night-soft:  #a3aeae;
  --night-rule:  #252b2c;
  --night-accent:#16ccb5;

  /* --- derived, for data --- */
  --pos: #0f7a5a;
  --neg: #b3261e;
  --warn:#8a5a00;
  --shadow:   0 1px 2px rgba(26,23,24,.05), 0 10px 28px -16px rgba(26,23,24,.18);
  --shadow-sm:0 1px 2px rgba(26,23,24,.06);

  --font-sans: "Inter Variable", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-md: .375rem;
  --r-lg: .5rem;
  --r-xl: .75rem;
  --r-2xl: 1rem;
}

/* Dark theme: the surfaces become the site's night band, so the two themes are
   the same palette used two ways rather than two palettes to keep in step. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink:        #eef2f2;   /* night-text */
    --ink-soft:   #a3aeae;   /* night-soft */
    --ink-faint:  #6f7a7a;
    --paper:      #171b1c;   /* night-alt  */
    --paper-alt:  #0f1213;   /* night      */
    --sunken:     #1e2425;
    --rule:       #252b2c;   /* night-rule */
    --rule-strong:#3a4243;
    --accent:     #16ccb5;   /* night-accent */
    --pos: #4fc79b;
    --neg: #f0857a;
    --warn:#d9a441;
    --shadow:   0 1px 2px rgba(0,0,0,.4), 0 10px 28px -16px rgba(0,0,0,.7);
    --shadow-sm:0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --ink:#eef2f2; --ink-soft:#a3aeae; --ink-faint:#6f7a7a;
  --paper:#171b1c; --paper-alt:#0f1213; --sunken:#1e2425;
  --rule:#252b2c; --rule-strong:#3a4243; --accent:#16ccb5;
  --pos:#4fc79b; --neg:#f0857a; --warn:#d9a441;
  --shadow:0 1px 2px rgba(0,0,0,.4),0 10px 28px -16px rgba(0,0,0,.7);
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper-alt);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-family: inherit; }

/* ------------------------------------------------------------ environment */

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: 0 0 var(--r-md) 0; font-weight: 600; font-size: 13px;
}
.skip:focus { left: 0; text-decoration: none; }

/* Inverts with the theme — ink on paper, paper on ink — so it stays a legible
   band in both rather than depending on a fixed light text colour. */
.envbar {
  background: var(--ink); color: var(--paper);
  font-size: 12px; font-weight: 500; letter-spacing: .01em;
  text-align: center; padding: 6px 12px;
}
.envbar::first-letter { text-transform: uppercase; }

/* ------------------------------------------------------------------ chrome */
/* Structure follows the site's own Header.astro: sticky, hairline rule,
   translucent paper with a backdrop blur, 72rem measure, pill nav links. */

.top {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 95%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.top-in {
  max-width: 72rem; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px;
}

.brand { display: flex; align-items: center; gap: 12px; flex: none; text-decoration: none; }
.brand:hover { text-decoration: none; }

/* The wordmark is the logo — never retyped as text, never recoloured. Its own
   gradient on the `a` is the brand mark; nothing else here competes with it. */
.wordmark { height: 26px; width: auto; display: block; }
.wordmark-sm { height: 20px; width: auto; display: block; opacity: .9; }
.wordmark-lg { height: 38px; width: auto; margin: 0 auto; display: block; }

/* Ink wordmark on light surfaces, light wordmark on dark ones. */
.on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .on-light { display: none; }
  :root:not([data-theme="light"]) .on-dark  { display: block; }
}
:root[data-theme="dark"] .on-light { display: none; }
:root[data-theme="dark"] .on-dark  { display: block; }

/* "Command Center" is set beside the logo, divided by a hairline — it names
   this application without pretending to be part of the wordmark. */
.brand .unit {
  font-size: 14px; font-weight: 500; color: var(--ink-soft);
  padding-left: 12px; border-left: 1px solid var(--rule);
  white-space: nowrap;
}

.top nav { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.top nav a {
  padding: 6px 10px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; color: var(--ink-soft);
  white-space: nowrap; transition: background-color .12s, color .12s;
}
.top nav a:hover { background: var(--paper-alt); color: var(--ink); text-decoration: none; }
.top nav a.on { background: var(--sunken); color: var(--ink); }

.who { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--ink-soft); flex: none; }
.who .email { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The site's primary control: solid ink, white label, no border. */
.btn-ink {
  background: var(--ink); color: var(--paper);
  padding: 7px 14px; border-radius: var(--r-lg);
  font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: opacity .12s;
}
.btn-ink:hover { opacity: .85; text-decoration: none; color: var(--paper); }

.role {
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 99px; border: 1px solid var(--rule);
  color: var(--ink-soft); background: var(--sunken);
}
.role-admin    { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.role-approver { color: var(--pos); border-color: color-mix(in srgb, var(--pos) 35%, transparent); }

/* ------------------------------------------------------------- sub-navigation */

.subnav { background: var(--paper); border-bottom: 1px solid var(--rule); }
.subnav-in {
  max-width: 72rem; margin: 0 auto;
  display: flex; gap: 4px; align-items: center;
  padding: 8px 24px; overflow-x: auto;
}
.subnav a {
  padding: 5px 10px; border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 500; color: var(--ink-soft); white-space: nowrap;
}
.subnav a:hover { background: var(--paper-alt); color: var(--ink); text-decoration: none; }
.subnav a.on { color: var(--ink); background: var(--sunken); }

/* ------------------------------------------------------------------- layout */

main { max-width: 72rem; margin: 0 auto; padding: 36px 24px 96px; }
main.wide { max-width: 96rem; }

.page-head { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head .grow { flex: 1; min-width: 260px; }
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 6px;
}
h1 { font-size: 27px; font-weight: 600; letter-spacing: -.02em; margin: 0; line-height: 1.15; }
h2 { font-size: 12px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 12px; }
h3 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.lede { color: var(--ink-soft); margin: 6px 0 0; max-width: 72ch; font-size: 14.5px; }

section + section { margin-top: 40px; }

/* -------------------------------------------------------------------- cards */

.card {
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: var(--r-xl); box-shadow: var(--shadow-sm);
}
.card.pad { padding: 20px; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* module tiles on the home page */
.tile {
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px; min-height: 168px;
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: var(--r-xl); box-shadow: var(--shadow-sm);
  color: inherit; position: relative; overflow: hidden;
  transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
}
a.tile:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--rule-strong); }
.tile::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--brand-gradient); opacity: 0;
  transition: opacity .16s ease;
}
a.tile:hover::before { opacity: 1; }
.tile.off { opacity: .62; }
.tile .t-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tile .t-title { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.tile .t-sum { font-size: 13.5px; color: var(--ink-soft); flex: 1; text-wrap: pretty; }
.tile .t-stats { display: flex; gap: 18px; flex-wrap: wrap; border-top: 1px solid var(--rule); padding-top: 11px; }
.tile .t-stat { display: flex; flex-direction: column; gap: 1px; }
.tile .t-stat b { font-size: 17px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tile .t-stat span { font-size: 11px; color: var(--ink-faint); letter-spacing: .04em; text-transform: uppercase; font-weight: 600; }

/* status dot */
.dot { width: 7px; height: 7px; border-radius: 99px; flex: none; display: inline-block; }
.dot.up   { background: var(--brand-green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-green) 22%, transparent); }
.dot.down { background: var(--neg);         box-shadow: 0 0 0 3px color-mix(in srgb, var(--neg) 22%, transparent); }
.dot.idle { background: var(--rule-strong); }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-faint); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

/* ------------------------------------------------------------------- stats */

.stat {
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-lg);
  padding: 15px 16px; display: flex; flex-direction: column; gap: 3px;
}
.stat .k { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.stat .v { font-size: 25px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .s { font-size: 12.5px; color: var(--ink-soft); }

/* ------------------------------------------------------------------ tables */

.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r-xl); background: var(--paper); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--paper); text-align: left;
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); padding: 11px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--rule);
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--paper-alt); }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
td.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sku { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-soft); }
.sub { font-size: 12px; color: var(--ink-faint); }
.group-row td {
  background: var(--sunken); font-size: 10.5px; font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase; color: var(--ink-soft);
  padding: 7px 12px;
}

.margin-good { color: var(--pos); font-weight: 600; }
.margin-thin { color: var(--warn); font-weight: 600; }
.margin-bad  { color: var(--neg);  font-weight: 600; }

/* ------------------------------------------------------------------- chips */

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 2.5px 8px;
  border-radius: 99px; border: 1px solid var(--rule);
  background: var(--sunken); color: var(--ink-soft); white-space: nowrap;
}
.chip.pending  { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.chip.approved { color: var(--pos);  border-color: color-mix(in srgb, var(--pos) 35%, transparent); }
.chip.rejected,
.chip.withdrawn{ color: var(--neg);  border-color: color-mix(in srgb, var(--neg) 35%, transparent); }

/* ------------------------------------------------------------------ forms */

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
input[type=text], input[type=search], input[type=number], select, textarea {
  font: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: var(--r-md); padding: 7px 10px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--brand-teal) 55%, transparent);
  outline-offset: 1px; border-color: transparent;
}
textarea { width: 100%; min-height: 84px; resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }

.btn {
  font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 7px 14px; border-radius: var(--r-md);
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { background: var(--sunken); text-decoration: none; }
.btn.primary { border-color: transparent; background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 35%, transparent); }
.btn.brand { border-color: transparent; background: var(--brand-gradient); color: #06282c; }

/* ------------------------------------------------------------------ notices */

.flash {
  background: color-mix(in srgb, var(--brand-teal) 12%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--brand-teal) 40%, transparent);
  border-radius: var(--r-lg); padding: 11px 14px; margin-bottom: 20px; font-size: 13.5px;
}
.notice {
  border: 1px dashed var(--rule-strong); border-radius: var(--r-lg);
  padding: 18px; color: var(--ink-soft); font-size: 13.5px; background: var(--paper);
}
.notice b { color: var(--ink); }
.notice.bad { border-style: solid; border-color: color-mix(in srgb, var(--neg) 40%, transparent); }
.empty { padding: 34px 18px; text-align: center; color: var(--ink-faint); font-size: 13.5px; }

/* ------------------------------------------------------------------- charts */

.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 1.4fr) 1fr auto; gap: 12px; align-items: center; font-size: 13px; }
/* Both are spans, so they must be blockified — width and height do nothing on
   an inline box, and the fill silently disappears. */
.bar-track { display: block; background: var(--sunken); border-radius: 99px; height: 8px; overflow: hidden; }
.bar-fill  { display: block; height: 100%; min-width: 2px; border-radius: 99px; background: var(--brand-gradient); }
.bar-fill.voice { background: var(--brand-cyan); }
.bar-fill.text  { background: var(--brand-green); }
.bar-fill.fee   { background: var(--accent); }
.bar-val { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: 12.5px; }

/* ------------------------------------------------------------------ footer */
/* A night band, the gradient's home turf per the brand doc. */

footer {
  margin-top: 72px;
  background: var(--night); color: var(--night-soft);
  border-top: 3px solid transparent;
  border-image: var(--brand-gradient) 1;
  font-size: 13px;
}
footer .in {
  max-width: 72rem; margin: 0 auto;
  padding: 26px 24px 40px;
  display: flex; gap: 20px; flex-wrap: wrap; align-items: center;
}
footer .in span:not(.env) { flex: 1; min-width: 200px; }
footer .env { color: var(--night-soft); text-transform: uppercase; letter-spacing: .1em; font-size: 11px; font-weight: 600; }

/* ------------------------------------------------------------------- login */

.signin { min-height: 72vh; display: grid; place-items: center; padding: 40px 20px; }
.signin .box { width: 100%; max-width: 380px; text-align: center; display: flex; flex-direction: column; gap: 16px; }

@media (max-width: 720px) {
  .top-in { gap: 12px; padding: 10px 14px; }
  .subnav-in { padding: 8px 14px; }
  .brand .unit { display: none; }
  .who .email { display: none; }
  main { padding: 22px 14px 72px; }
}
