/* ============================================================
   app.css — Juno Billing Console design tokens + base components
   Drop into wwwroot/css/app.css and reference from App.razor.
   Every value here is lifted from the approved design.
   ============================================================ */

/* ---------- Fonts (self-hosted in wwwroot/fonts for offline/GDPR, per DESIGN.md Assets:
   the Google @import is replaced by local @font-face rules) ---------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Inter-var-latin.woff2') format('woff2');
  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: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Inter-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* IBM Plex Mono stays self-hosted for .mono — the design rules keep it as the numeric face */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/IBMPlexMono-400-latin.woff2') format('woff2');
  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: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/IBMPlexMono-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/IBMPlexMono-500-latin.woff2') format('woff2');
  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: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/IBMPlexMono-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/IBMPlexMono-600-latin.woff2') format('woff2');
  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: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/IBMPlexMono-600-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ============================================================
   TOKENS
   ============================================================ */
:root {
  /* Type */
  --font-sans: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Surfaces & text */
  --ink:            #18171C;  /* primary text, toast surface */
  --black:          #0C0B0A;  /* primary buttons only */
  --canvas:         #FBFBFD;  /* page */
  --surface:        rgba(255,255,255,0.88);  /* translucent so the wash reads through */
  --surface-solid:  #FFFFFF;  /* inputs, modals, popovers */
  --border:         #EAEAF0;
  --border-soft:    rgba(234,234,240,0.9);
  --divider:        #F1F1F6;  /* hairline inside a card */
  --divider-2:      #F0EFEC;
  --row-hover:      #FBFBFD;
  --input-bg:       #F0EFEC;

  --text:           #18171C;
  --text-2:         #18171C;
  --text-muted:     #6B6A72;  /* contrast floor for readable text */
  --text-faint:     #6B6A72;  /* was #8A8993 (3.45:1) — failed on every caps label */
  --text-faintest:  #B0AFA9;  /* ORNAMENT ONLY — 2.20:1 on white. Never a label, header,
                                 data value, caption or consequence line. In practice its only
                                 legitimate use is a non-informational hint chip (⌘K). */

  /* Sidebar sits on the wash — no dark panel */
  --nav-text:        #6B6A72;
  --nav-text-active: #C2560A;
  --nav-section:     #6B6A72;  /* IA, not decoration — must clear 4.5:1 */
  --nav-active-bg:   #FFF2E8;
  --nav-hover-bg:    #F0EFEC;

  /* Brand — orange accent. Primary/CTA/active only. */
  --brand:            #FF6A00;  /* rules, active marks, one hero figure. NEVER a fill. */
  --brand-text:       #C2560A;  /* orange that must be READ as words */
  --brand-figure:     #E85D00;  /* large numerals only */
  --brand-soft:       #FFF2E8;  /* active nav, selected chip, tint */
  --brand-soft-hover: #FFE4D0;
  --row-selected:     #FFF2E8;
  --neutral-series:   #A9A8B4;  /* neutral bars — #DCDCE4 is invisible on white */

  /* Semantic status — KEEP DISTINCT. Never recolor to brand. */
  --success-bg: #E6F5EC;  --success-fg: #2D7A4F;
  --warning-bg: #FEF3E0;  --warning-fg: #B07300;
  --danger-bg:  #FDECEC;  --danger-fg:  #C03B3B;
  --info-bg:    #EBF1FB;  --info-fg:    #2256A6;
  --neutral-bg: #F0EFEC;  --neutral-fg: #6B6B67;
  --notify-dot: #C03B3B;

  /* Categorical — IDENTITY ONLY, never state. Use in this fixed order. */
  --cat-1: #FF6A00;  --cat-2: #7A5AF8;  --cat-3: #12B5A6;  --cat-4: #2E90FA;  --cat-5: #FF3D77;
  --pal-blue-bg:   #EAF2FE;  --pal-blue-fg:   #2E90FA;
  --pal-green-bg:  #E4F7F5;  --pal-green-fg:  #12B5A6;
  --pal-purple-bg: #F1EDFE;  --pal-purple-fg: #7A5AF8;
  --pal-amber-bg:  #FFF2E8;  --pal-amber-fg:  #C2560A;
  --pal-red-bg:    #FDECEC;  --pal-red-fg:    #C03B3B;

  /* Radius */
  --r-card: 12px;
  --r-control: 10px;
  --r-chip: 8px;
  --r-pill: 100px;

  /* Elevation */
  --sh-card:  0 1px 2px rgba(24,23,28,0.05), 0 10px 30px -14px rgba(24,23,28,0.14);
  --sh-pop:   0 24px 60px -20px rgba(24,23,28,0.28), 0 2px 8px rgba(24,23,28,0.08);
  --sh-toast: 0 24px 60px -20px rgba(24,23,28,0.28);
  --sh-header: 0 1px 3px rgba(24,23,28,0.06);

  /* Layout */
  --sidebar-w: 248px;
  --header-h: 62px;
  --toolbar-h: 64px;
  --statusbar-h: 28px;
  --content-max: 1400px;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

/* The aurora wash. Fixed, never scrolling, never animated — ambience, not content.
   Opacity ceiling 0.13: above that it starts tinting numbers and status pills.
   Four blobs maximum, well separated; overlapping blobs make mud. */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(760px 520px at  8%   2%, rgba(255,106,0,0.13), transparent 62%),
    radial-gradient(700px 560px at 96%  12%, rgba(122,90,248,0.10), transparent 60%),
    radial-gradient(900px 620px at 62% 100%, rgba(18,181,166,0.11), transparent 58%),
    radial-gradient(620px 480px at 22%  88%, rgba(46,144,250,0.09), transparent 62%);
}
.app { position: relative; z-index: 1; }

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

button { font-family: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #D3D7DE;
  border-radius: 8px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #B9BFC9; background-clip: content-box; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
/* 44px minimum interactive height (EN 301 549 / EAA). */
button, input, select, [role="button"] { min-height: 34px; }
.btn, .btn--primary, .btn--outline { min-height: 44px; }

@keyframes toast-in { from { opacity:0; transform: translate(-50%, 8px); } to { opacity:1; transform: translate(-50%,0); } }
@keyframes fade-in  { from { opacity:0; } to { opacity:1; } }
/* Enter = 8px rise + fade. Decelerate only; nothing bounces, nothing overshoots. */
@keyframes enter { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform:none; } }
.enter { animation: enter 400ms cubic-bezier(0,0,0.2,1); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Numeric treatment — use on ALL money, ids, dates in tables, KPI values */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--canvas);
}

.content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.content-pad {
  padding: 24px;
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ---------- Glass header ---------- */
/* The one place a blur is allowed besides the modal backdrop. Never nest blurred surfaces. */
.header {
  height: var(--header-h);
  background: rgba(255,255,255,0.9);
  backdrop-filter: saturate(180%) blur(14px);
  box-shadow: var(--sh-header);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  position: relative; z-index: 40;
}
/* The aurora rule. Use an explicit strip, NOT border-image — the shorthand is fragile
   and a flattened border-image paints the whole header. */
.header__rule {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, #FF6A00 0%, #FF3D77 42%, #7A5AF8 72%, #12B5A6 100%);
}
.header__mark { display: flex; align-items: center; gap: 13px; }
.header__mark img { width: 30px; height: 30px; display: block; }
.header__divider { width: 1px; height: 22px; background: var(--border); }
.header__name {
  font-size: 11px; font-weight: 600; letter-spacing: 1.9px;
  text-transform: uppercase; color: var(--text-muted); white-space: nowrap;
}

/* ---------- Sidebar ---------- */
/* No dark panel. The rail sits on the wash; a hairline separates it from content. */
.sidebar {
  background: transparent;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--toolbar-h);
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex: 0 0 var(--toolbar-h);
}
.sidebar__logo {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--on-brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; letter-spacing: -.02em;
}
.sidebar__name { color: #EDEFF2; font-weight: 600; font-size: 13.5px; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 14px 12px 8px; }

/* Group label = 5px categorical dot + caps label. The hue is identity, never state. */
.nav-section {
  display: flex; align-items: center; gap: 7px;
  color: var(--nav-section);
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 1.8px; text-transform: uppercase;
  padding: 0 10px 8px;
}
.nav-section__dot { width: 5px; height: 5px; border-radius: 100px; }
.nav-group + .nav-group { margin-top: 16px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  border: none; cursor: pointer; text-align: left;
  padding: 9px 12px;
  border-radius: 9px;
  margin-bottom: 2px;
  font: 500 13.5px/1 var(--font-sans);
  background: transparent;
  color: var(--nav-text);
  position: relative;
}
.nav-item:hover { background: var(--nav-hover-bg); }
/* Active = orange TINT + darkened-orange text. Never a solid orange fill (contrast),
   never black (too heavy for this register). No left accent bar. */
.nav-item.active { background: var(--nav-active-bg); color: var(--nav-text-active); font-weight: 600; }
.nav-item__icon { display: flex; width: 18px; height: 18px; flex: 0 0 18px; align-items: center; justify-content: center; }
.nav-item__label { flex: 1; }
.nav-item__badge {
  background: rgba(255,255,255,.1); color: #C4CAD3;
  font-size: 11px; font-weight: 600;
  min-width: 20px; height: 19px; padding: 0 6px;
  border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center;
}
.nav-item.active .nav-item__badge { background: var(--brand); color: var(--on-brand); }

.sidebar__user {
  border-top: 1px solid rgba(255,255,255,.07);
  padding: 12px;
  display: flex; align-items: center; gap: 11px;
}
.sidebar__avatar {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #CE6320, var(--brand));
  color: var(--on-brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}

/* ---------- Toolbar ---------- */
.toolbar {
  height: var(--toolbar-h);
  flex: 0 0 var(--toolbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 20px;
  padding: 0 24px;
  position: relative;
  z-index: 20;
}
.toolbar__title { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.toolbar__subtitle { font-size: 12px; color: var(--text-faint); margin-top: 1px; }

.search { flex: 1; max-width: 520px; margin: 0 auto; position: relative; }
.search__box {
  display: flex; align-items: center; gap: 9px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  padding: 0 12px; height: 38px;
}
.search__box:focus-within { border-color: var(--brand); background: var(--surface); }
/* Placeholders are content: the global bar's placeholder is the only affordance naming the
   entities it spans. Browser-default placeholder is ~4.61:1 and passes; any hand-set value
   must clear 4.5:1 too. #8A8993 (3.45:1) is not a placeholder tone. */
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 1; }

.search__input {
  flex: 1; border: none; background: transparent; outline: none;
  font: 400 13.5px var(--font-sans); color: var(--text);
}
.search__kbd {
  font-size: 10.5px; color: var(--text-faintest);
  border: 1px solid #DCE0E6; border-radius: 5px;
  padding: 1px 6px; font-weight: 500;
}
.search__results {
  position: absolute; top: 46px; left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--sh-pop);
  padding: 6px;
  max-height: 380px; overflow-y: auto;
  animation: fade-in .13s ease;
  z-index: 30;
}
.search__result {
  display: flex; align-items: center; gap: 12px;
  width: 100%; border: none; background: transparent;
  cursor: pointer; text-align: left;
  padding: 9px 10px; border-radius: var(--r-chip);
}
.search__result:hover, .search__result[aria-selected="true"] { background: var(--input-bg); }

/* ---------- Status bar ---------- */
.statusbar {
  height: var(--statusbar-h);
  flex: 0 0 var(--statusbar-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 18px;
  padding: 0 18px;
  font-size: 11.5px; color: var(--text-faint);
}
.statusbar__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success-fg); }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-card);
  box-shadow: var(--sh-card);
  padding: 18px;
}
.card--flush { padding: 0; overflow: hidden; }
.card__title { font-size: 14.5px; font-weight: 600; }
.card__sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 16px; }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--auto { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--facts { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 20px 24px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px;
  border-radius: var(--r-control);
  border: none; cursor: pointer;
  font: 600 13px var(--font-sans);
  transition: background .12s;
}
/* A dark primary button on a light page is correct here — orange is not a button fill. */
.btn--primary { background: var(--black); color: #fff; font-weight: 500; min-height: 44px; }
.btn--primary:hover { background: #2A2830; }

.btn--outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border); min-height: 44px; padding: 0 16px; font-size: 13px; font-weight: 500;
}
.btn--outline:hover { background: var(--input-bg); }

.btn--icon {
  width: 38px; height: 38px; padding: 0;
  background: var(--surface); border: 1px solid var(--border);
  position: relative;
}
.btn--icon:hover { background: var(--input-bg); }
.btn--icon .notify {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--notify-dot); border: 1.5px solid #fff;
}

/* Row actions — small semantic buttons */
.btn--row { height: auto; padding: 6px 12px; font-size: 12px; border-radius: var(--r-chip); }
.btn--approve { background: var(--success-bg); color: var(--success-fg); }
.btn--approve:hover { background: #d4efe2; }
.btn--reject  { background: var(--input-bg);  color: var(--text-muted); }
.btn--reject:hover { background: #E8EBEF; }
.btn--submit  { background: var(--info-bg);   color: var(--info-fg); }
.btn--submit:hover { background: #dbe6ff; }
.btn--void    { background: var(--danger-bg); color: var(--danger-fg); }
.btn--void:hover { background: #fadadd; }

.btn--link { background: none; border: none; color: var(--brand-text); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; height: auto; }
.btn--destructive { background: var(--danger-fg); color: #fff; }

/* ---------- Status pill ---------- */
/* Every pill contains a WORD. Colour alone is never the message. */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  background: var(--neutral-bg); color: var(--neutral-fg);
}
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill--success { background: var(--success-bg); color: var(--success-fg); }
.pill--warning { background: var(--warning-bg); color: var(--warning-fg); }
.pill--danger  { background: var(--danger-bg);  color: var(--danger-fg); }
.pill--info    { background: var(--info-bg);    color: var(--info-fg); }
.pill--neutral { background: var(--neutral-bg); color: var(--neutral-fg); }

/* ---------- Avatar / tag chip ---------- */
.avatar {
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px; font-weight: 600; flex-shrink: 0;
  background: var(--pal-blue-bg); color: var(--pal-blue-fg);
}
.avatar--sm { width: 34px; height: 34px; font-size: 12px; }
.avatar--md { width: 36px; height: 36px; font-size: 13px; }
.avatar--lg { width: 46px; height: 46px; font-size: 15px; border-radius: 11px; }
.avatar--xl { width: 52px; height: 52px; font-size: 18px; border-radius: 13px; }

.pal-blue   { background: var(--pal-blue-bg);   color: var(--pal-blue-fg); }
.pal-green  { background: var(--pal-green-bg);  color: var(--pal-green-fg); }
.pal-purple { background: var(--pal-purple-bg); color: var(--pal-purple-fg); }
.pal-amber  { background: var(--pal-amber-bg);  color: var(--pal-amber-fg); }
.pal-red    { background: var(--pal-red-bg);    color: var(--pal-red-fg); }

.tag {
  font-size: 11.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 7px;
  background: var(--neutral-bg); color: var(--neutral-fg);
}

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table thead tr { background: var(--row-hover); }
.table thead tr { border-bottom: 1px solid var(--border); }
/* Applies to EVERY th. A right-aligned numeric column is still a caps micro-label —
   set text-align only, never a different size/case/tracking. */
.table th.is-sorted { color: var(--text); }
.table th {
  text-align: left;
  font-size: 9.5px; font-weight: 600;
  color: var(--text-muted);   /* NOT --text-faintest: 2.20:1 fails. See the contrast note. */
  text-transform: uppercase; letter-spacing: 1.8px;
  padding: 11px 12px;
  white-space: nowrap;
}
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child,  .table td:last-child  { padding-right: 20px; }
.table td { padding: 11px 12px; font-size: 12.5px; border-bottom: 1px solid var(--divider); }
.table tbody tr:hover { background: var(--row-hover); }
.table .num { text-align: right; font-family: var(--font-mono); font-weight: 600; }
.table-wrap { overflow-x: auto; }

/* ---------- KPI card ---------- */
/* Secondary lines inside a table cell (a commercial name under an account name, a code under
   an id) are DATA. They use --text-muted, never --text-faintest. "Smaller and lighter" is a
   hierarchy tool only down to 4.5:1; below that it stops being hierarchy and starts being
   unreadable.

/* ONE uppercase micro-label treatment app-wide: 9.5px / 600 / 1.8px tracking / --text-muted.
   Column headers, KPI labels and nav group labels all use it. Two competing header
   treatments side by side read as two design systems.

/* Contrast floor: any text a user must READ — caps labels, column headers, captions that
   carry meaning — uses --text-muted (#6B6A72, 5.34:1). --text-faintest (#B0AFA9) is 2.20:1
   and is reserved for purely decorative meta. The light register makes this easy to lose.

/* No left accent stripe. Caps label, figure carrying the severity colour, one line of
   consequence, then a text action. Let the number do the work. */
.kpi__label {
  font-size: 9.5px; color: var(--text-muted); font-weight: 600;
  letter-spacing: 1.8px; text-transform: uppercase; line-height: 1.5;
}
.kpi__icon {
  width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.kpi__value {
  font-size: 27px; font-weight: 600; letter-spacing: -.02em;
  margin-top: 12px; font-family: var(--font-mono);
}
.kpi__delta { font-size: 12px; font-weight: 600; }
/* The consequence line tells the operator what the number MEANS — it is not ornament. */
.kpi__note  { font-size: 11.5px; color: var(--text-muted); }

/* ---------- Charts (flat bars) ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 8px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
/* NEVER colour a quantity by category — the fill comes from state, or stays neutral. */
.bars__bar { width: 100%; border-radius: 6px 6px 3px 3px; background: var(--neutral-series); min-height: 6px; transition: height .32s cubic-bezier(0,0,0.2,1); }
.bars__bar--current { background: var(--brand); }
.bars__label { font-size: 10.5px; color: var(--text-faintest); }

.meter { height: 8px; background: var(--input-bg); border-radius: 6px; overflow: hidden; }
.meter__fill { height: 100%; border-radius: 100px; background: var(--neutral-series); transition: width .32s cubic-bezier(0,0,0.2,1); }
.meter__fill--success { background: var(--success-fg); }
.meter__fill--warning { background: var(--warning-fg); }
.meter__fill--danger  { background: var(--danger-fg); }

/* ---------- Segmented control (density toggle) ---------- */
.segmented { display: inline-flex; background: var(--border); border-radius: var(--r-control); padding: 3px; gap: 2px; }
.segmented__btn {
  border: none; cursor: pointer;
  font-size: 12.5px; font-weight: 600;
  padding: 6px 14px; border-radius: var(--r-chip);
  background: transparent; color: var(--text-muted);
}
.segmented__btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* ---------- Master-detail (Subscriptions) ---------- */
.master-detail { display: flex; height: 100%; min-height: 0; }
.master {
  width: 360px; flex: 0 0 360px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex; flex-direction: column; min-height: 0;
}
.master__list { flex: 1; overflow-y: auto; min-height: 0; }
.master__row {
  display: block; width: 100%; text-align: left;
  border: none; border-bottom: 1px solid var(--divider);
  border-left: 3px solid transparent;
  cursor: pointer; padding: 14px 16px; background: var(--surface);
}
.master__row:hover { background: var(--row-hover); }
.master__row.selected { background: var(--row-selected); border-left-color: var(--brand); }
.detail { flex: 1; overflow-y: auto; min-height: 0; background: var(--canvas); padding: 22px 26px; }

/* ---------- Toggle switch ---------- */
.switch { width: 40px; height: 23px; border-radius: var(--r-pill); background: #D3D7DE; position: relative; cursor: pointer; border: none; padding: 0; }
.switch.on { background: var(--brand); }
.switch__knob { position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on .switch__knob { left: 19px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 44px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  font-size: 13px; font-weight: 500;
  padding: 11px 18px; border-radius: 11px;
  box-shadow: var(--sh-toast);
  display: flex; align-items: center; gap: 10px;
  animation: toast-in .2s ease;
  z-index: 100;
}
.toast svg { color: var(--brand); }
.toast { background: var(--ink); box-shadow: var(--sh-toast); border-radius: 9px; }

/* ---------- Modal ---------- */
/* Elevation is the depth cue that replaces dark chrome. A modal with no shadow looks
   broken here in a way it never would on a dark UI. */
.modal {
  background: var(--surface-solid);
  border-radius: var(--r-card);
  border-top: 2px solid var(--neutral-fg);   /* swap for the severity colour */
  box-shadow: var(--sh-pop);
}
.modal--danger  { border-top-color: var(--danger-fg); }
.modal--warning { border-top-color: var(--warning-fg); }
.modal__backdrop { background: rgba(24,23,28,0.32); backdrop-filter: blur(2px); }

/* ---------- Small mono chip ---------- */
.chip-mono {
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--input-bg); color: var(--neutral-fg);
  border-radius: 6px; padding: 3px 8px;
}

/* ---------- Timeline ---------- */
.timeline__item { display: flex; gap: 12px; padding-bottom: 16px; }
.timeline__dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; margin-top: 3px; }

/* ============================================================
   RESPONSIVE — real breakpoints (a web-only win over the WPF plan)
   ============================================================ */
@media (max-width: 1340px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1100px) {
  .master { width: 300px; flex-basis: 300px; }
  .grid--2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 72px 1fr; }      /* sidebar collapses to icons */
  .sidebar__name, .nav-item__label, .nav-section { display: none; }
  .nav-item { justify-content: center; }
  .grid--4, .grid--3 { grid-template-columns: 1fr; }
  .master-detail { flex-direction: column; }
  .master { width: 100%; flex-basis: auto; max-height: 40vh; border-right: none; border-bottom: 1px solid var(--border); }
}

/* ============================================================
   PRINT — invoices/statements
   ============================================================ */
@media print {
  .sidebar, .toolbar, .statusbar, .btn, .toast { display: none !important; }
  .app { display: block; height: auto; }
  .content { overflow: visible; }
  .card { border: none; padding: 0; }
}


/* ============================================================
   DOMAIN STATUS ALIASES
   Map real API states -> semantic pill classes. Use these class
   names directly so markup reads in domain terms.
   Invoice:      draft -> open -> paid | voided   (overdue = open + past due, DERIVED)
   Charge:       pending -> billable -> billed
   Subscription: active | trialing | past_due | paused | canceled
   Request:      pending | approved | rejected
   ============================================================ */
.pill--draft      { background: var(--neutral-bg); color: var(--neutral-fg); }
.pill--open       { background: var(--info-bg);    color: var(--info-fg); }
.pill--paid       { background: var(--success-bg); color: var(--success-fg); }
.pill--voided     { background: var(--neutral-bg); color: var(--neutral-fg); }
.pill--overdue    { background: var(--danger-bg);  color: var(--danger-fg); }

.pill--pending    { background: var(--warning-bg); color: var(--warning-fg); }
.pill--billable   { background: var(--info-bg);    color: var(--info-fg); }
.pill--billed     { background: var(--success-bg); color: var(--success-fg); }

.pill--active     { background: var(--success-bg); color: var(--success-fg); }
.pill--trialing   { background: var(--info-bg);    color: var(--info-fg); }
.pill--past-due   { background: var(--warning-bg); color: var(--warning-fg); }
.pill--paused     { background: var(--neutral-bg); color: var(--neutral-fg); }
.pill--canceled   { background: var(--neutral-bg); color: var(--neutral-fg); }

.pill--approved   { background: var(--success-bg); color: var(--success-fg); }
.pill--rejected   { background: var(--danger-bg);  color: var(--danger-fg); }

/* Site selector in the top bar — site_id is explicit on every call */
.site-picker {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 7px; padding: 3px 9px;
  color: #C4CAD3; font: 500 11.5px var(--font-sans);
  cursor: pointer;
}
.site-picker:hover { background: rgba(255,255,255,.12); }
.site-picker__dot { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }

/* Simulation / dry-run banner (transaction pre-charges) */
.banner-simulation {
  display: flex; align-items: center; gap: 10px;
  background: var(--warning-bg); color: var(--warning-fg);
  border: 1px solid #F3E0BC; border-radius: var(--r-control);
  padding: 10px 14px; font-size: 12.5px; font-weight: 600;
  margin-bottom: 16px;
}


/* ============================================================
   AURORA FILTER CHIPS
   Selected chip uses the same tint treatment as active navigation.
   Contract status chips are NOT an exception any more — one style app-wide.
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 12px; min-height: 34px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}
.chip:hover { background: var(--input-bg); }
.chip.active {
  background: var(--brand-soft);
  border-color: var(--brand-soft-hover);
  color: var(--brand-text);
  font-weight: 600;
}
.chip__count { opacity: .7; }

/* Two-tone headline — the one permitted typographic flourish, once per page at most.
   Never gradient-clipped text: it fails silently to invisible. */
.headline em { font-style: normal; color: var(--brand); }
