/* Finance Approval — design system "Trust & Authority" (T-001, ported from the
   approved mockup 2026-07-11). Self-hosted, no external CDN/fonts (ADR-0008).
   Dual theme: light default; dark via OS preference AND an explicit data-theme
   override on <html> (the toggle wins and is remembered). a11y focus + reduced-motion. */

/* Roboto — self-hosted (ADR-0008, no runtime CDN). Latin + Cyrillic (Ukrainian UI),
   weights 400/500/600/700 — matches the canonical design source (design-system/
   canonical-source.dc.html, themeVars + Roboto). Vendored via tmp/fetch_roboto.py. */
@font-face{font-family:'Roboto';font-style:normal;font-weight:400;font-display:swap;src:url('/static/fonts/roboto-400-latin.woff2?v=1') 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:'Roboto';font-style:normal;font-weight:400;font-display:swap;src:url('/static/fonts/roboto-400-cyrillic.woff2?v=1') format('woff2');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;}
@font-face{font-family:'Roboto';font-style:normal;font-weight:500;font-display:swap;src:url('/static/fonts/roboto-500-latin.woff2?v=1') 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:'Roboto';font-style:normal;font-weight:500;font-display:swap;src:url('/static/fonts/roboto-500-cyrillic.woff2?v=1') format('woff2');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;}
@font-face{font-family:'Roboto';font-style:normal;font-weight:600;font-display:swap;src:url('/static/fonts/roboto-600-latin.woff2?v=1') 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:'Roboto';font-style:normal;font-weight:600;font-display:swap;src:url('/static/fonts/roboto-600-cyrillic.woff2?v=1') format('woff2');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;}
@font-face{font-family:'Roboto';font-style:normal;font-weight:700;font-display:swap;src:url('/static/fonts/roboto-700-latin.woff2?v=1') 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:'Roboto';font-style:normal;font-weight:700;font-display:swap;src:url('/static/fonts/roboto-700-cyrillic.woff2?v=1') format('woff2');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;}

:root {
  --bg: #F8FAFC; --panel: #FFFFFF; --panel2: #F1F5F9; --chrome: #0F172A;
  --text: #020617; --muted: #475569; --line: #E2E8F0;
  --secondary: #1E3A8A; --accent: #CA8A04; --accent-fg: #FFFFFF; --on-chrome: #F8FAFC;
  --ok-bg: #DCFCE7; --ok-fg: #15803D;
  --warn-bg: #FEF3C7; --warn-fg: #B45309;
  --crit-bg: #FEE2E2; --crit-fg: #B91C1C;
  --neu-bg: #E0E7FF; --neu-fg: #3730A3;
  --paid-bg: #E2E8F0; --paid-fg: #475569;

  --space-sm: .5rem; --space-md: 1rem; --space-lg: 1.5rem; --space-xl: 2rem;
  --radius: 9px; /* controls — matches the canonical design (inputs/buttons/nav 9px) */
  --shadow-sm: 0 1px 2px rgba(2,6,23,.06);
  --shadow-md: 0 4px 6px rgba(2,6,23,.10);
  /* Roboto self-hosted above; system stack is the pre-swap fallback only */
  --font-body: 'Roboto', system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-head: var(--font-body);
}

/* Dark palette — applied by OS preference OR explicit override */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark;
    --bg: #0C1220; --panel: #131C2E; --panel2: #0F1728; --chrome: #0B1220;
    --text: #E6EDF7; --muted: #94A3B8; --line: #22304A;
    --secondary: #60A5FA; --accent: #E0A44B; --accent-fg: #0B1220; --on-chrome: #E6EDF7;
    --ok-bg: rgba(74,222,128,.14); --ok-fg: #4ADE80;
    --warn-bg: rgba(251,191,36,.14); --warn-fg: #FBBF24;
    --crit-bg: rgba(248,113,113,.14); --crit-fg: #F87171;
    --neu-bg: rgba(96,165,250,.14); --neu-fg: #93C5FD;
    --paid-bg: #22304A; --paid-fg: #94A3B8;
  }
}
:root[data-theme="dark"] { color-scheme: dark;
  --bg: #0C1220; --panel: #131C2E; --panel2: #0F1728; --chrome: #0B1220;
  --text: #E6EDF7; --muted: #94A3B8; --line: #22304A;
  --secondary: #60A5FA; --accent: #E0A44B; --accent-fg: #0B1220; --on-chrome: #E6EDF7;
  --ok-bg: rgba(74,222,128,.14); --ok-fg: #4ADE80;
  --warn-bg: rgba(251,191,36,.14); --warn-fg: #FBBF24;
  --crit-bg: rgba(248,113,113,.14); --crit-fg: #F87171;
  --neu-bg: rgba(96,165,250,.14); --neu-fg: #93C5FD;
  --paid-bg: #22304A; --paid-fg: #94A3B8;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font-body); font-size: 15px; line-height: 1.55;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
h1 { font-family: var(--font-head); font-size: 1.5rem; line-height: 1.25; margin: 0 0 .35rem; }
h2 { font-family: var(--font-head); font-size: 1.15rem; margin: var(--space-lg) 0 var(--space-sm); }
p { color: var(--muted); margin: 0 0 var(--space-md); }
a { color: var(--secondary); }

/* ---- App shell: top bar + sidebar + content ---- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: var(--space-md);
  padding: .6rem var(--space-lg); background: var(--chrome); color: var(--on-chrome);
  box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 20;
}
.topbar__brand { font-weight: 700; letter-spacing: .01em; margin-right: auto; display: flex; align-items: center; gap: .5rem; }
.topbar__actions { display: flex; align-items: center; gap: .35rem; }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; min-height: 40px; padding: .4rem; border: none; border-radius: var(--radius);
  background: transparent; color: var(--on-chrome); cursor: pointer; opacity: .85;
  transition: background-color 180ms ease, opacity 180ms ease; text-decoration: none;
}
.iconbtn:hover { opacity: 1; background: rgba(255,255,255,.10); }
.iconbtn.is-on { opacity: 1; background: rgba(255,255,255,.16); }
.lang { display: flex; gap: .15rem; }
.lang a { color: var(--on-chrome); text-decoration: none; padding: .3rem .55rem; border-radius: var(--radius); opacity: .8; }
.lang a[aria-current="true"] { opacity: 1; background: rgba(255,255,255,.14); font-weight: 600; }

.shell { flex: 1; display: flex; align-items: stretch; }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line);
  padding: var(--space-md) .6rem; display: flex; flex-direction: column; gap: .1rem;
}
.sidebar__group { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: var(--space-md) .6rem .3rem; }
.navitem {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: var(--radius);
  color: var(--text); text-decoration: none; font-weight: 500; min-height: 40px;
}
.navitem:hover { background: var(--panel2); }
.navitem[aria-current="page"] { background: var(--secondary); color: #fff; }
.navitem[aria-current="page"] svg { color: #fff; }
.navitem svg { color: var(--muted); flex-shrink: 0; }

.content { flex: 1; min-width: 0; padding: var(--space-xl) var(--space-lg); }
.content--narrow { max-width: 60rem; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; gap: var(--space-md); margin-bottom: var(--space-lg); }
.page-head__text { margin-right: auto; }
.page-head p { margin: 0; }

/* ---- Components ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: var(--space-lg); box-shadow: var(--shadow-sm); }
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; border: 1px solid transparent; border-radius: var(--radius); font: inherit; font-weight: 600; cursor: pointer; min-height: 40px; text-decoration: none; transition: opacity 180ms ease, background-color 180ms ease; }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { opacity: .9; }
.btn-secondary { background: var(--panel); color: var(--text); border-color: var(--line); }
.btn-secondary:hover { background: var(--panel2); }
.btn-danger { background: var(--crit-bg); color: var(--crit-fg); }
/* aria-disabled, not the native `disabled` attribute (Diablo 2026-09-07: `disabled`
   drops a control from the tab order, so its title/reason is unreachable by keyboard
   or screen reader) — this class carries the visual "inert" look on its own. */
.btn--blocked { opacity: .5; cursor: not-allowed; }
.btn--blocked:hover { opacity: .5; }
.btn-ghost { background: transparent; color: var(--secondary); }

.input, select.input, textarea.input {
  padding: .6rem .8rem; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 15px; background: var(--panel); color: var(--text); width: 100%;
}
/* Opaque dropdown options — otherwise the page's chrome background bleeds through the
   native option list as faint colour bands (owner-reported artifact). */
select.input option { background: var(--panel); color: var(--text); }
label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 .3rem; color: var(--text); }
.field { margin-bottom: var(--space-md); }
.field .hint { color: var(--muted); font-size: 12px; margin: .3rem 0 0; }
.field .err { color: var(--crit-fg); font-size: 12px; margin: .3rem 0 0; }

/* T-056: day/month/year entry, always in that visual order regardless of browser
   locale (native <input type="date"> pickers follow the browser's own language
   setting, not the page's — verified, not fixable via the page's `lang` attribute). */
.date3 { display: inline-flex; align-items: center; gap: 3px; }
.date3__box {
  width: 2.6em; padding: .6rem .3rem; text-align: center;
  font-variant-numeric: tabular-nums;
}
.date3__box--year { width: 3.6em; }
.date3__sep { color: var(--muted); user-select: none; }
.date3.has-err .date3__box { border-color: var(--crit-fg); }

/* T-100: popup calendar trigger + the popup itself (appended to <body>, positioned
   via inline left/top computed in app.js — see _date3Position). z-index sits below
   #toast-root (80) and above ordinary content; no .modal collision today (spec §5 —
   neither usage site is inside a modal in this version). */
.date3__cal-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0; margin-left: 2px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--muted); cursor: pointer;
}
.date3__cal-btn:hover { color: var(--text); border-color: var(--secondary); }
.date3-popup {
  position: absolute; z-index: 75; width: 17.5rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: var(--space-sm);
}
.date3-popup__nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-sm); }
.date3-popup__label { font-weight: 600; }
.date3-popup__prev, .date3-popup__next {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  width: 1.8rem; height: 1.8rem; border-radius: var(--radius); font-size: 1.1rem; line-height: 1;
}
.date3-popup__prev:hover, .date3-popup__next:hover { background: var(--panel2); color: var(--text); }
.date3-popup__weekdays, .date3-popup__grid {
  display: grid; grid-template-columns: repeat(7, 1fr); text-align: center;
}
.date3-popup__weekdays span { font-size: 11.5px; color: var(--muted); padding: 2px 0; }
.date3-popup__day, .date3-popup__pad { min-height: 2rem; }
.date3-popup__day {
  border: 1px solid transparent; background: transparent; color: var(--text);
  border-radius: var(--radius); cursor: pointer; font-variant-numeric: tabular-nums;
}
.date3-popup__day:hover:not(.is-disabled) { background: var(--panel2); }
.date3-popup__day:focus-visible { outline: 2px solid var(--secondary); outline-offset: 1px; }
.date3-popup__day.is-today { border-color: var(--secondary); }
.date3-popup__day.is-selected { background: var(--accent); color: var(--accent-fg); }
.date3-popup__day.is-disabled { color: var(--muted); opacity: .45; cursor: not-allowed; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 11.5px; font-weight: 600; line-height: 1.35; white-space: nowrap; }
.badge--ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge--warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge--crit { background: var(--crit-bg); color: var(--crit-fg); }
.badge--neu { background: var(--neu-bg); color: var(--neu-fg); }
.badge--muted { background: var(--paid-bg); color: var(--paid-fg); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
table.data th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: var(--panel2); }
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty { text-align: center; color: var(--muted); padding: var(--space-xl); }
.empty .btn { margin-top: var(--space-md); }

/* ---- a11y ---- */
a:focus-visible, button:focus-visible, .input:focus-visible, [tabindex]:focus-visible, .navitem:focus-visible, .iconbtn:focus-visible, .date3__box:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-fg); padding: var(--space-sm) var(--space-md); z-index: 30; }
.skip-link:focus { left: 0; }

/* ---- responsive: sidebar → bottom nav ---- */
@media (max-width: 640px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: auto; flex-direction: row; overflow-x: auto; border-right: none; border-top: 1px solid var(--line);
    position: sticky; bottom: 0; order: 2; padding: .3rem;
  }
  .sidebar__group { display: none; }
  .navitem { flex-direction: column; gap: .15rem; font-size: 11px; padding: .4rem .6rem; }
  .content { order: 1; padding: var(--space-lg) var(--space-md); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============================================================================
   Approval queue — master-detail (T-046, canonical mockup)
   ============================================================================ */
.queue-filters { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; margin-bottom: var(--space-md); }
.qf { margin: 0; }
.qf select.input { width: auto; }
.qf--search { flex: 0 1 15rem; }
.qf--search input { width: 100%; }

.master-detail { display: grid; grid-template-columns: minmax(300px, 360px) 1fr; gap: var(--space-lg); align-items: start; }

.req-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.req-list__item { margin: 0; }
.req-card {
  display: block; width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid transparent;
  border-radius: 12px; padding: .85rem 1rem; box-shadow: var(--shadow-sm);
  transition: box-shadow 180ms ease, border-color 180ms ease;
}
.req-card:hover { box-shadow: var(--shadow-md); }
.req-card.is-selected { border-left-color: var(--accent); box-shadow: var(--shadow-md); }
.req-card__row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.req-card__row + .req-card__row { margin-top: .35rem; }
.req-card__no { font-weight: 700; letter-spacing: .01em; }
.req-card__who { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-card__amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.req-card__cat, .req-card__days { font-size: .85rem; color: var(--muted); }
.req-card__days { white-space: nowrap; }
.req-card[hidden] { display: none; }

.req-detail { min-width: 0; transition: opacity 120ms ease; }
/* Loading affordance while a card's detail is being fetched (Diablo S1). HTMX stamps
   .htmx-request on the hx-indicator target for the duration of the request. */
.req-detail.htmx-request { opacity: .5; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: var(--space-lg); box-shadow: var(--shadow-sm); }
.panel--empty { text-align: center; padding: var(--space-xl); }
.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-md); }
.panel__no { margin: 0; font-size: 1.4rem; }
/* T-084: the request's NAME, directly under its number on the card and the approval
   panel. Heavier than the muted category line below it, lighter than the number — the
   number identifies the row, the name explains it. */
.panel__title { margin: .2rem 0 0; font-size: 1rem; font-weight: 600; }
.panel__who { margin: .25rem 0 0; }
.panel__head-r { text-align: right; flex-shrink: 0; }
.panel__amt { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.panel__amt-eur { font-size: .85rem; margin-top: .15rem; }
.panel__head-r .badge { margin-top: .4rem; }

.panel__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); margin: var(--space-lg) 0; padding-top: var(--space-lg); border-top: 1px solid var(--line); }
.panel__grid > div { min-width: 0; }
.panel__grid dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 .25rem; }
.panel__grid dd { margin: 0; font-weight: 600; }
.panel__section { margin: var(--space-md) 0; }
.panel__k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .3rem; }
.panel__desc { color: var(--text); margin: 0; }

.attach { display: flex; align-items: center; gap: var(--space-md); border: 1px solid var(--line); border-radius: 10px; padding: .75rem 1rem; margin: var(--space-md) 0; }
.attach__name { font-weight: 600; }
.attach__note { margin-left: auto; font-size: .8rem; text-align: right; }

.why-box { background: var(--neu-bg); border-radius: 10px; padding: .75rem 1rem; margin: var(--space-md) 0; }
.why-box__title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--neu-fg); margin-bottom: .2rem; }
.why-box__body { color: var(--text); }

.chain { margin: var(--space-lg) 0; }
.chain__title { font-size: 1rem; margin: 0 0 var(--space-sm); }
.chain__list { list-style: none; margin: 0; padding: 0; }
.chain__step { display: grid; grid-template-columns: 26px 1fr auto; gap: .7rem; align-items: center; padding: .35rem 0; }
.chain__mark { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; background: var(--panel2); color: var(--muted); }
.chain__step--done .chain__mark { background: var(--ok-bg); color: var(--ok-fg); }
.chain__step--current .chain__mark { background: var(--warn-bg); color: var(--warn-fg); }
.chain__role { min-width: 0; }
.chain__date { font-size: .8rem; white-space: nowrap; }

.panel__actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); margin-top: var(--space-lg); align-items: end; }
.approve-form, .reject-form { display: flex; flex-direction: column; gap: .5rem; margin: 0; }
.btn-lg { padding: .8rem 1.2rem; font-size: 1rem; width: 100%; justify-content: center; min-height: 48px; }

/* Master-detail → single column on narrow screens; ≥44px touch targets (design brief). */
@media (max-width: 900px) {
  .master-detail { grid-template-columns: 1fr; }
  .panel__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .queue-filters { justify-content: stretch; }
  .qf, .qf--search { flex: 1 1 100%; }
  .qf select.input { width: 100%; }
  .panel__head { flex-direction: column; }
  .panel__head-r { text-align: left; }
  .panel__actions { grid-template-columns: 1fr; }
  .iconbtn, .lang a { min-height: 44px; }
  .req-card { padding: 1rem; }
}

/* ============================================================================
   List screens — filter chips + flat-row grid table (T-046, canonical mockup)
   Used by: my requests, all requests, payments. Grid columns set per screen.
   ============================================================================ */
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  height: 32px; padding: 0 13px; border-radius: 8px; font: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--muted); background: var(--panel); border: 1px solid var(--line);
  cursor: pointer; display: inline-flex; align-items: center;
}
.chip:hover { background: var(--panel2); }
.chip.is-on { color: var(--accent-fg); background: var(--secondary); border-color: var(--secondary); }

.rt { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.rt__head, .rt__row { display: grid; gap: 12px; align-items: center; }
.rt__head { padding: 12px 20px; background: var(--panel2); border-bottom: 1px solid var(--line); }
.rt__head span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rt__row { padding: 14px 20px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.rt__row:last-child { border-bottom: none; }
.rt__row:hover { background: var(--panel2); }
.rt__id { font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rt__mut { color: var(--muted); font-size: 12.5px; }
.rt__cat { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt__amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* T-084: the request's NAME sits under its number, in the same cell — the two read as
   one identity, and no list gains a column (every grid below is a fixed template, so an
   extra <span> would silently fall out of alignment). The first column widens to make
   room for it; nothing else in these templates moves. */
.rt__ident { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rt__title { font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt__title--gone { color: var(--muted); font-style: italic; }
/* per-screen column templates */
.rt--myreq .rt__head, .rt--myreq .rt__row { grid-template-columns: 220px 96px 1fr 140px 128px 120px; }
.rt--allreq .rt__head, .rt--allreq .rt__row { grid-template-columns: 200px 1fr 140px 130px 128px 120px 130px; }
/* mobile cards — hidden on desktop */
.rt__card { display: none; }
.rt__card-top { display: flex; justify-content: space-between; align-items: center; }
.rt__badges { display: flex; gap: 6px; flex-wrap: wrap; }
/* chip filter hides non-matching rows/cards (wins over the mobile display rule) */
.rt__row.filtered, .rt__card.filtered { display: none !important; }

@media (max-width: 760px) {
  .rt [data-desk] { display: none !important; }
  .rt__card[data-mob] {
    display: flex; flex-direction: column; gap: 8px; padding: 14px 16px;
    border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none;
  }
  .rt__card[data-mob]:last-child { border-bottom: none; }
}

/* ---- Payments (accountant): approved-to-pay cards + actions (T-046) ---- */
.pay-note { margin-bottom: var(--space-md); }
.pay-list { display: flex; flex-direction: column; gap: .8rem; }
.pay-card {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-lg);
  flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 1rem 1.2rem; box-shadow: var(--shadow-sm);
}
.pay-card__info { min-width: 0; flex: 1 1 16rem; }
.pay-card__head { display: flex; align-items: baseline; gap: var(--space-md); margin-bottom: .3rem; }
.pay-card__amt { font-size: 1.05rem; }
.pay-card__actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.pay-card__actions form { margin: 0; }
.pay-decline { display: flex; align-items: center; gap: .5rem; }
.pay-decline .input { width: 15rem; max-width: 100%; }

@media (max-width: 640px) {
  .pay-card__actions, .pay-decline { width: 100%; }
  .pay-decline .input { flex: 1; width: auto; }
}

/* ---- Invite: form + role-capabilities panel (T-046) ---- */
.invite-layout { display: grid; grid-template-columns: minmax(0, 34rem) 1fr; gap: var(--space-lg); align-items: start; }
.caps-card__title { margin: 0 0 var(--space-md); font-size: 1.05rem; }
.caps { margin: 0; }
.caps dt { margin-top: var(--space-md); }
.caps dt:first-child { margin-top: 0; }
.caps dd { margin: .3rem 0 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
@media (max-width: 860px) { .invite-layout { grid-template-columns: 1fr; } }

/* Audit viewer (T-043) */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); font-size: .9rem; }
/* scoped to admin forms only — a bare global `.warn` would also restyle the
   receipt-upload screen's warning (templates/requests/_receipts.html), out of scope (Diablo S1) */
.admin-form .warn { color: var(--warn-fg); background: var(--warn-bg); border-radius: var(--radius);
  padding: .5rem .75rem; font-size: .9rem; margin: 0 0 var(--space-md); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
/* owner report 2026-09-04: max-width alone does nothing without these three — a long
   unbreakable hex/email string overflows its grid cell into the next column instead of
   truncating. display:block also needed: an inline span's overflow box is its line, not
   the width constraint, so overflow:hidden/text-overflow never engage. */
.mono-clip { display: block; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.audit-change { color: var(--muted); font-size: .85rem; }

/* ============================================================================
   Modal + toast layer (T-047, canonical mockup: renderModal/renderToasts)
   ============================================================================ */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(2, 6, 23, .55); backdrop-filter: blur(2px);
  animation: fa-fadein .18s ease;
}
.modal__dialog {
  position: relative; width: 100%; max-width: 520px; max-height: 88vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 24px 70px rgba(2, 6, 23, .4); padding: 24px;
  animation: fa-pop .18s ease;
}
.modal__title { margin: 0 0 4px; font-weight: 600; font-size: 18px; color: var(--text); }
.modal__hint { margin: 0 0 16px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.modal__summary {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 13px 15px; background: var(--panel2); border-radius: 10px; margin-bottom: 18px;
}
.modal__summary-amt { font-weight: 700; font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.modal__summary-id { font-weight: 600; font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.modal__summary-sub { font-size: 12.5px; color: var(--muted); }
.modal .input, .modal textarea.input { width: 100%; }
.modal__label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.modal__actions { display: flex; gap: 10px; margin-top: 20px; }
.modal__actions .btn { min-height: 44px; }
.modal__actions .btn[type="submit"], .modal__actions .btn--confirm { flex: 1; }

#toast-root {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 80;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 12px;
  background: var(--chrome); color: #fff; box-shadow: 0 12px 34px rgba(2, 6, 23, .34);
  font-size: 13.5px; font-weight: 500; pointer-events: auto; animation: fa-toastin .22s ease;
}
.toast__icon { display: flex; }
.toast--ok .toast__icon { color: var(--ok-fg); }
.toast--crit .toast__icon { color: var(--crit-fg); }

@keyframes fa-fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes fa-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fa-toastin { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
body.modal-open { overflow: hidden; }

/* ============================================================================
   Request form + detail card (T-048, canonical mockup renderForm/renderDetailCard)
   ============================================================================ */
.form-card { max-width: 40rem; margin: 0 auto; }
.req-form { display: grid; gap: var(--space-md); }
.field { display: grid; gap: .4rem; }
/* T-081: `display: grid` above beats the user agent's own `[hidden] { display: none }`,
   so a conditional payment field marked hidden would still be drawn — and a field the
   form does not apply is worse than clutter here, it invites somebody to type an account
   number into a box the server is about to ignore. Same explicit pairing the modal and
   the queue card already need (`.modal[hidden]`, `.req-card[hidden]`). */
.field[hidden] { display: none; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.field__row { display: flex; gap: .6rem; }
.req-form__amount { flex: 1; }
.req-form__ccy { max-width: 7rem; }
.confirm { display: flex; gap: .5rem; align-items: center; font-size: 13.5px; color: var(--text); }
.req-form__submit { margin-top: .2rem; }

.req-detail-card { max-width: 40rem; }
.panel__actions--detail { display: flex; gap: .6rem; margin-top: var(--space-md); }

/* «Shared with» — who else may open this request (T-078). */
.shared-with { list-style: none; margin: 0 0 var(--space-sm); padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.shared-with__row { display: flex; align-items: center; gap: var(--space-sm); min-height: 32px; }
.shared-with__who { color: var(--text); font-size: 13.5px; }
.shared-with__drop { margin-left: auto; display: flex; }
.shared-with__drop .btn { min-height: 32px; padding: .2rem .5rem; font-size: 12.5px; font-weight: 500; }
.shared-with__add { margin-top: var(--space-sm); }
.shared-with__add .input { max-width: 18rem; }
.shared-with__hint { font-size: 12px; margin: .35rem 0 0; }
.reject-banner {
  border: 1px solid var(--crit-fg); border-radius: 12px; padding: 12px 15px;
  background: color-mix(in srgb, var(--crit-fg) 8%, transparent); margin-bottom: 4px;
}
.reject-banner__title { font-weight: 600; font-size: 12.5px; color: var(--crit-fg); margin-bottom: 4px; }
.reject-banner__body { margin: 0; font-size: 13.5px; color: var(--text); line-height: 1.5; }

/* ============================================================================
   Sign-in card + profile (T-049, canonical mockup renderSignin)
   ============================================================================ */
.signin-body { min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: var(--font-body); margin: 0; }
.signin { min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px; gap: 14px; }
.signin__lang { display: flex; align-items: center; gap: .4rem; font-size: 12px; }
.signin__lang a { color: var(--muted); text-decoration: none; padding: 2px 6px; border-radius: 6px; }
.signin__lang a[aria-current] { color: var(--text); font-weight: 600; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 36px 32px;
  box-shadow: 0 12px 40px rgba(2, 6, 23, .10); animation: fa-fadein .3s ease; }
.auth-card__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.auth-card__logo { width: 34px; height: 34px; border-radius: 9px; background: var(--chrome);
  color: var(--accent); display: flex; align-items: center; justify-content: center; }
.auth-card__name { font-weight: 600; font-size: 16px; color: var(--text); letter-spacing: -.01em; }
.auth-card__title { margin: 0 0 6px; font-weight: 600; font-size: 20px; color: var(--text); }
.auth-card__sub { margin: 0 0 22px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.auth-card__go { width: 100%; justify-content: center; }
.profile-tg__hint { font-size: .85rem; }
.profile-logout { margin-top: var(--space-md); }

/* Payment card: link to the full request detail (bug fix — accountant view) */
.pay-card__details { display: inline-block; margin-top: .3rem; font-size: .85rem;
  color: var(--accent); text-decoration: none; }
.pay-card__details:hover { text-decoration: underline; }

/* Admin all-requests overview (R-008) — section heading above each admin card list */
.section-title { margin: 0 0 var(--space-md); font-size: 1rem; font-weight: 600; color: var(--text); }

/* Pager (all-requests / admin overview) — prev/next + page-size selector */
.pager { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
  justify-content: space-between; margin-top: var(--space-md); }
.pager__nav { display: flex; gap: .6rem; align-items: center; }
.pager__sizes { display: flex; gap: .4rem; align-items: center; font-size: .9rem; }
.pager__size { padding: 2px 8px; border-radius: 7px; text-decoration: none;
  color: var(--muted); border: 1px solid var(--line); }
.pager__size.is-on { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }

/* Extra breathing room between stacked admin cards (e.g. all-requests vs stuck-chains) */
.admin-section-gap { margin-top: var(--space-xl); }

/* Invite modal (T-051): form stacked + role-capabilities hint below the form */
.invite-add { display: flex; flex-direction: column; gap: .6rem; }
.invite-add__hint { font-size: .85rem; }
.caps--modal { margin-top: var(--space-lg); padding-top: var(--space-md); border-top: 1px solid var(--line); }
.caps__title { margin: 0 0 var(--space-sm); font-size: .95rem; font-weight: 600; color: var(--text); }
.caps__list { margin: 0; }

/* ============================================================================
   Admin flat-row tables (T-050) — restyle the 7 admin screens to the canonical
   `.rt` grid (design-system/canonical-source.dc.html renderUsers/renderCollection/
   renderRules/renderAudit). NEW selectors only — no edit to shared classes, so the
   already-shipped operational screens (.rt--myreq/--allreq) are untouched (Diablo S1).
   Rows here are <div> (they carry inline forms), not <a> link-rows. ============= */
.rt--admin .rt__row { cursor: default; }
.rt--admin .rt__row:hover { background: transparent; }   /* forms inside → no row-hover */
.rt__act { display: flex; gap: .4rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.rt__act form { margin: 0; display: inline-flex; gap: .4rem; }
.rt__cell-form { display: flex; gap: .4rem; align-items: center; margin: 0; }
.rt__cell-form .input { min-width: 0; }
.rt__chain { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rt__chain .badge { background: var(--neu-bg); color: var(--neu-fg); }

/* per-screen desktop column templates */
/* T-072: three columns since the per-user department cell was removed (ADR-0016 —
   a project belongs to a request, so there is no per-person replacement column). */
.rt--users  .rt__head, .rt--users  .rt__row { grid-template-columns: minmax(0,1fr) 160px 130px; }
.rt--coll   .rt__head, .rt--coll   .rt__row { grid-template-columns: minmax(0,1fr) 120px 170px; }
/* T-072: eight columns — the department column became project, and "author" joined it
   as the third optional matching dimension (ADR-0016). */
.rt--rules  .rt__head, .rt--rules  .rt__row { grid-template-columns: 120px minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1.6fr) 60px 88px 104px; }
/* T-092: fourth column for the revoke action, same 130px width as .rt--users' own act column. */
.rt--deleg  .rt__head, .rt--deleg  .rt__row { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 210px 130px; }
.rt--audit  .rt__head, .rt--audit  .rt__row { grid-template-columns: 150px 140px 130px 104px 120px minmax(0,1fr); }
.rt--areq   .rt__head, .rt--areq   .rt__row { grid-template-columns: 112px minmax(0,1fr) 150px minmax(0,1fr) 118px 110px; }
.rt--secrets .rt__head, .rt--secrets .rt__row { grid-template-columns: minmax(0,1fr) 150px 220px; }
.rt--inflt  .rt__head, .rt--inflt  .rt__row { grid-template-columns: 70px 130px minmax(0,1fr) 160px minmax(0,1.4fr); }

/* mobile — admin tables keep their columns AND their header row, scrolling
   horizontally like the old `.table-wrap` did. A label-less single-column stack
   would drop the column headers that act as field labels on the data-dense screens
   (audit/rules) — a regression vs the old tables (Diablo S2). Operational screens
   (.rt--myreq/--allreq) still use their dedicated stacked cards. */
@media (max-width: 760px) {
  .rt--admin { overflow-x: auto; }
  .rt--admin .rt__head[data-desk] { display: grid; }   /* overrides the global `.rt [data-desk]{display:none}` */
  .rt--admin .rt__head, .rt--admin .rt__row { min-width: 680px; }
}

/* prototype-style add/edit form card above admin lists (categories/projects/
   delegations/rules) — replaces the old inline style="" attributes */
.admin-form { margin-bottom: var(--space-lg); }
.admin-form--inline { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.admin-form--grid { display: grid; gap: .8rem; grid-template-columns: repeat(2, minmax(0,1fr)); }
.admin-form--grid .span-2 { grid-column: 1 / -1; }
.admin-form__range { display: flex; gap: .4rem; }
@media (max-width: 640px) { .admin-form--grid { grid-template-columns: 1fr; } }

/* T-099: who-am-I corner — passive, never competes with topbar(20)/skip-link(30)/
   modal(70)/toast(80) for attention. */
.user-badge {
  position: fixed; left: var(--space-sm); bottom: var(--space-sm); z-index: 10;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--muted); font-size: 11px; padding: .3rem .55rem; pointer-events: none;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
