/* ============================================================
   editorial.css — the Statura "editorial light" design system.

   One shared stylesheet for every in-app page: design tokens (light +
   dark), typography, and the shared component kit (header, cards, chips,
   buttons, forms, table, empty states, toasts, dropdown menus).

   Extracted verbatim from the canonical pages bills.html / dashboard-
   preview.html / login.html so they render identically once migrated.

   Usage on a page:
     <link rel="stylesheet" href="/styles/editorial.css" />
   plus the no-flash theme script in <head> and /js/theme.js?v=6.
   Page-specific layout/CSS stays inline in each page's own <style>.

   Naming note — two collisions were resolved when unifying the pages:
     .label       = uppercase mono kicker (NOT a form label)
     .field-label = a form field's <label>
     .card        = generic surface (auth pages use their own .auth-card)
   ============================================================ */

/* ---------- design tokens (consumes brand-tokens.css) ----------
   Legacy var names preserved (--paper, --ink, --green, etc.) so
   every component selector below keeps working. Hex values now
   resolve to Statura Navy/Cream/Gold per STATURA-BRAND-KIT.md.
   The --green var has always meant "accent" — it is now the
   brand gold. Component CSS doesn't need to change.
*/
:root {
  --paper: var(--statura-cream); --card: var(--surface-lifted); --tint: var(--surface-hover);
  --ink: var(--statura-navy); --ink-2: var(--text-secondary); --muted: var(--text-tertiary);
  --green: var(--statura-gold); --green-d: var(--statura-gold-80);
  --line: var(--border-default); --line-2: var(--border-strong);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --rose: var(--semantic-danger); --amber-ink: var(--semantic-warning);
}
html[data-theme="dark"] {
  --paper: var(--statura-navy); --card: var(--statura-navy-90); --tint: var(--statura-navy-70);
  --ink: var(--statura-cream); --ink-2: var(--statura-cream-90); --muted: var(--statura-cream-70);
  --green: var(--statura-gold); --green-d: var(--statura-gold-60);
  --line: var(--border-default-inv); --line-2: var(--border-strong-inv);
  --rose: var(--semantic-danger); --amber-ink: var(--statura-gold-60);
}

/* ---------- reset + typography ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--paper); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.serif { font-family: 'Cormorant Garamond', Georgia, serif; }
.mono { font-family: 'JetBrains Mono', monospace; }

/* theme toggle shows the icon of the CURRENT mode: sun = light, moon = dark */
.theme-ic-moon { display: none; }
html[data-theme="dark"] .theme-ic-sun { display: none; }
html[data-theme="dark"] .theme-ic-moon { display: block; }

/* ---------- layout primitives ---------- */
.main { max-width: 1320px; margin: 0 auto; padding: 30px 20px 24px; }
.label { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--muted); }
.eyebrow { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--green); }
h1.page-h, .page-h { font-family: 'Cormorant Garamond', serif; font-size: clamp(27px, 5vw, 35px); font-weight: 600; letter-spacing: -0.02em; margin: 7px 0 0; }
.sub { margin: 9px 0 0; color: var(--ink-2); font-size: 14px; }
.sub b { color: var(--ink); font-weight: 600; }
.alink { display: inline-flex; align-items: center; gap: 5px; font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600; color: var(--green); white-space: nowrap; background: none; border: 0; cursor: pointer; padding: 0; }
.alink:hover { color: var(--green-d); }
.foot { max-width: 1320px; margin: 26px auto 0; padding: 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); }

/* ---------- header ---------- */
.hdr { position: sticky; top: 0; z-index: 40; background: var(--statura-navy, #14233E); border-bottom: 1px solid rgba(245,241,232,0.08); --card: var(--statura-navy-90, #1F2D49); --paper: var(--statura-navy, #14233E); --ink: var(--statura-cream, #F5F1E8); --ink-2: var(--statura-cream-90, #EEE9DC); --muted: var(--statura-cream-70, #D4CDB8); --line: rgba(245,241,232,0.10); --line-2: rgba(245,241,232,0.18); color: var(--statura-cream, #F5F1E8); isolation: isolate; }
.hdr-in { display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 20px; max-width: 1320px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.brand img { width: 30px; height: 30px; border-radius: 7px; }
.brand b { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.hbtn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s var(--ease); }
.hbtn:hover { border-color: var(--line-2); background: var(--paper); }
.hbtn svg { width: 13px; height: 13px; }
.ws-badge { width: 20px; height: 20px; border-radius: 5px; background: var(--green); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.search { flex: 1; display: flex; align-items: center; gap: 9px; height: 34px; max-width: 440px; margin: 0 auto; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--muted); font-size: 13px; cursor: text; transition: border-color 0.15s var(--ease); }
.search:hover { border-color: var(--line-2); }
.search svg { width: 15px; height: 15px; }
.kbd { font-family: 'JetBrains Mono', monospace; font-size: 10px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--muted); }
.iconbtn, .theme-toggle { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); display: flex; align-items: center; justify-content: center; color: var(--ink-2); cursor: pointer; position: relative; transition: all 0.15s var(--ease); }
.iconbtn:hover, .theme-toggle:hover { border-color: var(--line-2); background: var(--paper); }
.iconbtn svg, .theme-toggle svg { width: 16px; height: 16px; }
.avatar { width: 34px; height: 34px; border: 0; border-radius: 8px; background: var(--green); color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; cursor: pointer; }
html[data-theme="dark"] .ws-badge, html[data-theme="dark"] .avatar { background: var(--statura-gold); color: var(--statura-navy); }

/* ---------- card ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 13px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px; border: 0; border-radius: 9px; background: var(--green); color: #fff; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; transition: background 0.15s var(--ease); }
.btn:hover:not(:disabled) { background: var(--green-d); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-block { width: 100%; }
html[data-theme="dark"] .btn { background: var(--statura-gold); color: var(--statura-navy); }
html[data-theme="dark"] .btn:hover:not(:disabled) { background: var(--statura-gold-80); }

/* ---------- filter chips ---------- */
.chiprow { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--card); border: 1px solid var(--line); cursor: pointer; transition: all 0.12s var(--ease); white-space: nowrap; }
.fchip:hover { border-color: var(--line-2); color: var(--ink); }
.fchip.active { background: var(--tint); color: var(--green); border-color: rgba(201,149,74,0.30); }
.fchip .ct { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--muted); }
.fchip.active .ct { color: var(--green); }
html[data-theme="dark"] .fchip.active { border-color: rgba(201,149,74,0.40); }

/* ---------- status chips ---------- */
.chip { font-family: 'JetBrains Mono', monospace; font-size: 9.5px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; padding: 3px 7px; border-radius: 5px; background: var(--tint); color: var(--green); border: 1px solid rgba(201,149,74,0.30); white-space: nowrap; display: inline-block; }
.chip.neutral { background: var(--tint); color: var(--ink-2); border-color: var(--line); }
.chip.muted { background: transparent; color: var(--muted); border-color: var(--line); }
.chip.rose { background: rgba(163,55,47,0.08); color: var(--rose); border-color: rgba(163,55,47,0.22); }
html[data-theme="dark"] .chip { border-color: rgba(201,149,74,0.40); }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field-label { display: flex; justify-content: space-between; align-items: baseline; font-family: 'JetBrains Mono', monospace; font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.field-label a { font-family: 'Inter', sans-serif; text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; color: var(--green); }
.field-label a:hover { color: var(--green-d); }
.input { width: 100%; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--paper); color: var(--ink); font-size: 14px; font-family: inherit; transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.input::placeholder { color: var(--muted); opacity: 0.7; }
.input:focus { outline: none; border-color: var(--green); box-shadow: var(--focus-ring); }
textarea.input { resize: vertical; min-height: 84px; }
select.input { cursor: pointer; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--green); cursor: pointer; }

/* ---------- table ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th { text-align: left; font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl thead th.r { text-align: right; }
.tbl tbody tr { border-bottom: 1px solid var(--line); transition: background 0.12s var(--ease); }
.tbl tbody tr:last-child { border-bottom: none; }
.tbl tbody tr:hover { background: var(--paper); }
.tbl td { padding: 13px 14px; vertical-align: top; font-size: 13.5px; }
.tbl td.r { text-align: right; }
.tbl.rows-link tbody tr { cursor: pointer; }

/* ---------- star / track button ---------- */
.star-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; background: transparent; border: 1px solid transparent; color: var(--muted); cursor: pointer; transition: all 0.15s var(--ease); }
.star-btn:hover { background: var(--tint); color: var(--green); }
.star-btn.active { color: var(--green); }
.star-btn svg { width: 15px; height: 15px; }

/* ---------- empty state ---------- */
.empty { padding: 44px 24px; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.empty b { display: block; color: var(--ink-2); font-weight: 600; margin-bottom: 4px; font-size: 14px; }

/* ---------- skeleton loader ---------- */
.skel { display: block; background: linear-gradient(90deg, var(--tint) 0%, var(--line) 50%, var(--tint) 100%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: 4px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- dropdown menus (override the dark-themed auth-menus.css) ---------- */
.menu-pop { background: var(--card) !important; border: 1px solid var(--line) !important; box-shadow: 0 16px 44px rgba(20,35,62,0.14) !important; }
.menu-header { border-color: var(--line) !important; }
.menu-header .top { color: var(--ink) !important; }
.menu-header .sub { color: var(--muted) !important; }
.menu-section { border-color: var(--line) !important; }
.menu-item { color: var(--ink-2) !important; }
.menu-item:hover { background: var(--paper) !important; color: var(--ink) !important; }
.menu-item.danger { color: var(--semantic-danger) !important; }
html[data-theme="dark"] .menu-item.danger { color: var(--semantic-danger) !important; }

/* ---------- toast ---------- */
.toast-msg { background: var(--card); color: var(--ink); border: 1px solid var(--line-2); padding: 12px 16px; border-radius: 10px; font-weight: 600; font-size: 13px; box-shadow: 0 12px 30px rgba(20,35,62,0.14); display: flex; align-items: center; gap: 8px; pointer-events: auto; opacity: 0; transform: translateY(10px); transition: all 0.25s var(--ease); max-width: 360px; }
.toast-msg.in { opacity: 1; transform: translateY(0); }
.toast-msg svg { color: var(--green); flex-shrink: 0; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  html { scroll-behavior: auto; }
}
