/* portal.css — the client portal.
   One quiet palette: paper grey, white surfaces, one accent, and colour only where it carries meaning
   (a document that has lapsed, a decision that is waiting). The brand accent arrives per tenant as
   --accent / --heading from portal_brand; everything else is fixed here. No gradients, no shadows to
   speak of, no decoration that is not information. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --line: #e5e7eb;
  --line-2: #eef0f3;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --ink-4: #9ca3af;
  --heading: #0f2a47;
  --accent: #2457c5;
  --accent-bg: #eef3fc;
  --accent-ink: #1d4ed8;
  --ok: #15803d;     --ok-bg: #ecfdf5;
  --warn: #b45309;   --warn-bg: #fffbeb;
  --bad: #b91c1c;    --bad-bg: #fef2f2;
  --neutral: #4b5563; --neutral-bg: #f3f4f6;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 8px;
  --side-w: 236px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; color: var(--heading); font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 15px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; }
p { margin: 0 0 .8em; }
strong { font-weight: 600; }
.muted { color: var(--ink-3); } .small { font-size: 12.5px; } .tnum { font-variant-numeric: tabular-nums; }
.inline { display: inline; }
.skip { position: absolute; left: -999px; top: 0; background: var(--heading); color: #fff; padding: 8px 12px; z-index: 99; }
.skip:focus { left: 8px; top: 8px; }
/* utilities used instead of style attributes (the CSP forbids inline styles) */
.m-0 { margin: 0 !important; } .block { display: block !important; } .nowrap { white-space: nowrap; } .maxw-520 { max-width: 520px; }
.mt-6 { margin-top: 6px; } .mt-8 { margin-top: 8px; } .mt-10 { margin-top: 10px; } .mt-12 { margin-top: 12px; } .mt-14 { margin-top: 14px; } .mt-16 { margin-top: 16px; } .mt-18 { margin-top: 18px; }
.mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.logo { display: block; padding: 18px 20px 14px; border-bottom: 1px solid var(--line-2); }
.logo img { display: block; width: 132px; height: auto; }
.logo-text { font-weight: 700; font-size: 16px; color: var(--heading); }
.side nav { padding: 10px 12px 16px; flex: 1; overflow-y: auto; }
.side-sec { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 16px 10px 6px; }
.side-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 6px; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.side-item:hover { background: var(--bg); text-decoration: none; color: var(--ink); }
.side-item.on { background: var(--neutral-bg); color: var(--heading); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.side-foot { padding: 14px 20px; border-top: 1px solid var(--line-2); font-size: 11.5px; color: var(--ink-4); line-height: 1.4; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; text-align: center; line-height: 20px; }
.body { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; gap: 16px; }
.clocks { display: flex; gap: 22px; font-size: 12.5px; color: var(--ink-3); letter-spacing: .04em; }
.clock b { font-weight: 600; color: var(--ink-2); margin-right: 6px; text-transform: uppercase; }
.clock time { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.may { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; background: var(--bg); }
.may b { color: var(--accent-ink); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.user { display: flex; align-items: center; gap: 10px; }
.user-text { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.user-text strong { font-size: 13.5px; color: var(--ink); }
.user-text span { font-size: 11.5px; color: var(--ink-3); }
.user-init { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px; letter-spacing: .02em; }
.btn-out { font: inherit; font-size: 12.5px; color: var(--ink-2); background: none; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
.btn-out:hover { background: var(--bg); color: var(--ink); }
.main { padding: 26px 28px 48px; max-width: 1320px; width: 100%; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }

/* ---------------------------------------------------------------- page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head > div:first-child { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.page-head p { margin: 0; color: var(--ink-3); font-size: 14px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- cards, grids, stats */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
/* The overview is not three equal cards: the fleet is the anchor and needs the room, the two
   action panels are narrow lists. minmax(0,...) so a wide table scrolls inside its own cell
   instead of forcing the grid wider. */
.grid-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1100px) { .grid-main { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.card h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card h2 a, .card h2 .small { font-size: 12.5px; font-weight: 500; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 18px; overflow: hidden; }
.stat { padding: 14px 18px; border-right: 1px solid var(--line-2); text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 2px; }
.stat:last-child { border-right: 0; }
.stat:hover { background: var(--bg); text-decoration: none; }
.stat .n { font-size: 24px; font-weight: 600; color: var(--heading); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { font-size: 12.5px; color: var(--ink-3); }
.stat.hot .n { color: var(--bad); }

/* ---------------------------------------------------------------- tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.person { display: flex; align-items: center; gap: 10px; }
.person a { font-weight: 600; color: var(--ink); }
.person .sub { display: block; font-size: 12px; color: var(--ink-3); }
.group-head td { background: var(--bg); font-weight: 600; color: var(--heading); padding: 7px 10px; font-size: 12.5px; }

/* ---------------------------------------------------------------- avatars, chips, pills */
.av { display: inline-flex; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: var(--neutral-bg); align-items: center; justify-content: center; flex: none; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-init { font-weight: 600; font-size: 12px; color: var(--ink-2); }
.av-lg { width: 64px; height: 64px; } .av-lg.av-init { font-size: 20px; }
.chip, .pill { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 18px; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-warn { background: var(--neutral-bg); color: var(--neutral); }
.chip-soon { background: var(--warn-bg); color: var(--warn); }
.chip-expired { background: var(--bad-bg); color: var(--bad); }
.chip-none { background: var(--neutral-bg); color: var(--ink-3); }
.pill { background: var(--neutral-bg); color: var(--neutral); }
.pill-sent { background: var(--accent-bg); color: var(--accent-ink); }
.pill-accepted, .pill-on { background: var(--ok-bg); color: var(--ok); }
.pill-declined { background: var(--neutral-bg); color: var(--ink-3); }
.pill-off { background: var(--warn-bg); color: var(--warn); }
.ref { font-family: var(--mono); font-size: 12px; color: var(--ink-3); letter-spacing: .02em; }

/* ---------------------------------------------------------------- forms and buttons */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field input, .field textarea, .field select { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.field input:focus, .field textarea:focus, .field select:focus, .btn:focus-visible, .btn-out:focus-visible, a:focus-visible, .side-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn { font: inherit; font-size: 13.5px; font-weight: 600; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--accent); cursor: pointer; background: var(--accent); color: #fff; text-decoration: none; display: inline-block; line-height: 1.3; }
.btn:hover { filter: brightness(.94); text-decoration: none; }
.btn-accent { background: var(--accent); border-color: var(--accent); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); filter: none; }
.btn-danger { background: var(--surface); color: var(--bad); border-color: #f1c4c4; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.notice { padding: 11px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); margin-bottom: 16px; font-size: 13.5px; }
.notice-ok { border-color: #bfe3d0; background: var(--ok-bg); color: #14532d; }
.notice-bad { border-color: #f1c4c4; background: var(--bad-bg); color: #7f1d1d; }
.notice-info { border-color: #cfdcf5; background: var(--accent-bg); color: #1e3a8a; }
.empty { padding: 22px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line); border-radius: var(--r); font-size: 13.5px; }

/* ---------------------------------------------------------------- kanban (proposals only) */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; align-items: start; }
.col { min-width: 0; }
.col-head { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; }
.col-head strong { font-size: 14px; color: var(--heading); }
.col-head .cnt { font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--neutral-bg); border-radius: 6px; padding: 2px 8px; }
.col-head.hot { box-shadow: inset 3px 0 0 var(--bad); }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 10px; }
.kcard-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.kcard-top .when { margin-left: auto; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.kcard .who { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.kcard .who strong { font-size: 14.5px; color: var(--ink); }
.kcard .who span { display: block; font-size: 12px; color: var(--ink-3); }
.kcard .line { font-size: 13px; color: var(--ink-2); margin: 2px 0; }
.kcard .line b { color: var(--ink); font-weight: 600; }
.kcard .actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); }
details.more > summary { list-style: none; cursor: pointer; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--r); color: var(--ink-3); font-size: 13px; text-align: center; background: var(--surface); }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 10px; }

/* ---------------------------------------------------------------- profile */
.profile-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.profile-head h1 { margin-bottom: 2px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.facts dd { margin: 2px 0 0; font-weight: 500; }

/* ---------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 30px 30px 24px; }
.login-card .logo { padding: 0 0 18px; border: 0; }
.login-card .logo img { width: 150px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .btn { width: 100%; padding: 10px; margin-top: 4px; }
.login-foot { text-align: center; font-size: 12px; color: var(--ink-4); margin-top: 22px; }

/* ---------------------------------------------------------------- footer */
.foot { padding: 14px 28px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--ink-4); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: auto; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { display: flex; gap: 2px; overflow-x: auto; padding: 6px 10px; }
  .side-sec { display: none; }
  .side-item { white-space: nowrap; padding: 8px 12px; }
  .side-item.on { box-shadow: inset 0 -3px 0 var(--accent); }
  .side-foot { display: none; }
  .logo { padding: 12px 16px; }
  .logo img { width: 110px; }
  .topbar { height: auto; padding: 10px 16px; flex-wrap: wrap; }
  .user-text { display: none; }
  .may { display: none; }
  .main { padding: 18px 16px 40px; }
  h1 { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
