/* BWA Crew app mockup. Mobile-first, light + dark, no framework.
   Shape rule: cards 16px, buttons/inputs 12px, chips/pills full radius. */

/* ───────────────────────── Tokens ───────────────────────── */
:root {
  color-scheme: light;
  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-brand: 'Cinzel', Georgia, serif;

  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #edf0f6;
  --surface-3: #e1e5ef;
  --line: #e1e5ee;
  --line-2: #c7cedd;
  --text: #101733;
  --text-2: #4a5676;
  --text-3: #5f6a88;          /* a11y (S8): was #727d9b, 3.8:1 on --bg */
  --text-inv: #ffffff;

  --navy: #0f1835;
  --navy-2: #182454;
  --gold: #bf9b3b;
  --gold-2: #d4b35a;
  --gold-ink: #1a1405;
  --gold-text: #7a5d12;
  --gold-soft: rgba(191, 155, 59, .14);
  --teal: #0b6d84;            /* a11y (S8): was #0f7f97 */
  --teal-soft: rgba(11, 109, 132, .12);
  --ok: #177246;              /* a11y (S8): was #1e8a55 */
  --ok-soft: rgba(23, 114, 70, .12);
  --warn: #925306;            /* a11y (S8): was #b0660a */
  --warn-soft: rgba(146, 83, 6, .13);
  --danger: #b73333;          /* a11y (S8): was #c53b3b */
  --danger-soft: rgba(183, 51, 51, .11);
  --on-accent: #ffffff;       /* text/icons on a solid --ok / --danger fill */

  --shadow-1: 0 1px 2px rgba(16, 23, 51, .06), 0 1px 1px rgba(16, 23, 51, .03);
  --shadow-2: 0 6px 20px rgba(16, 23, 51, .08), 0 1px 3px rgba(16, 23, 51, .05);
  --shadow-3: 0 -8px 40px rgba(16, 23, 51, .18);
  --scrim: rgba(10, 15, 36, .5);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --pill: 999px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: 62px;
  --topbar-h: 56px;
  --gutter: 16px;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur: 220ms;
  --dur-fast: 120ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #070b19;
    --surface: #0e1530;
    --surface-2: #151e3f;
    --surface-3: #1c2750;
    --line: #1e2a54;
    --line-2: #2d3b70;
    --text: #e7ecf9;
    --text-2: #a7b2d2;
    --text-3: #828db3;
    --on-accent: #0a0f24;
    --text-inv: #0a0f24;
    --gold: #cfae55;
    --gold-2: #e3c56a;
    --gold-ink: #171103;
    --gold-text: #e3c56a;
    --gold-soft: rgba(207, 174, 85, .16);
    --teal: #3cb7d6;
    --teal-soft: rgba(60, 183, 214, .14);
    --ok: #43c47f;
    --ok-soft: rgba(67, 196, 127, .14);
    --warn: #e6a23c;
    --warn-soft: rgba(230, 162, 60, .15);
    --danger: #f06464;
    --danger-soft: rgba(240, 100, 100, .14);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-2: 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-3: 0 -8px 40px rgba(0, 0, 0, .55);
    --scrim: rgba(2, 4, 12, .62);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b19;
  --surface: #0e1530;
  --surface-2: #151e3f;
  --surface-3: #1c2750;
  --line: #1e2a54;
  --line-2: #2d3b70;
  --text: #e7ecf9;
  --text-2: #a7b2d2;
  --text-3: #828db3;
  --on-accent: #0a0f24;
  --text-inv: #0a0f24;
  --gold: #cfae55;
  --gold-2: #e3c56a;
  --gold-ink: #171103;
  --gold-text: #e3c56a;
  --gold-soft: rgba(207, 174, 85, .16);
  --teal: #3cb7d6;
  --teal-soft: rgba(60, 183, 214, .14);
  --ok: #43c47f;
  --ok-soft: rgba(67, 196, 127, .14);
  --warn: #e6a23c;
  --warn-soft: rgba(230, 162, 60, .15);
  --danger: #f06464;
  --danger-soft: rgba(240, 100, 100, .14);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-3: 0 -8px 40px rgba(0, 0, 0, .55);
  --scrim: rgba(2, 4, 12, .62);
}

/* ───────────────────────── Base ───────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  background: var(--bg);
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button, a, [role="button"], .tappable, .chip, .tab {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
a { color: var(--gold-text); text-decoration: none; }
input, textarea, select { font-size: max(16px, 1rem); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
svg.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
svg.ico.sm { width: 16px; height: 16px; }
svg.ico.lg { width: 24px; height: 24px; }
svg.ico.xl { width: 32px; height: 32px; stroke-width: 1.5; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* a11y (S8): applies to every crew stylesheet (app.css + the streams' v3-*.css): no motion, no loops */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .sk::after { display: none; }
}

/* ───────────────────────── App shell ───────────────────────── */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.sidebar { display: none; }
.view { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.screen {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
}
.screen.anim-fwd { animation: slide-in-right var(--dur) var(--ease-out); }
.screen.anim-back { animation: slide-in-left var(--dur) var(--ease-out); }
.screen.anim-fade { animation: fade-in 160ms var(--ease-out); }
@keyframes slide-in-right { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes slide-in-left { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.content { padding: 0 var(--gutter) 24px; display: flex; flex-direction: column; gap: 16px; }
.content > .section + .section { margin-top: 4px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 6px;
  min-height: var(--topbar-h);
  padding: var(--safe-t) 10px 0;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.topbar h1 { font-size: 1.25rem; font-weight: 600; letter-spacing: -.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.topbar h1 small { display: block; font-size: .8125rem; font-weight: 500; color: var(--text-3); letter-spacing: .02em; line-height: 1.2; }
.topbar.large { align-items: flex-end; min-height: 84px; padding-bottom: 8px; }
.topbar.large h1 { font-size: 1.75rem; letter-spacing: -.02em; line-height: 1.1; }
/* split view (wide): the list title is an h2 that looks like the h1 (one h1 per page) */
.topbar h2.h1 { font-size: 1.25rem; font-weight: 600; letter-spacing: -.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; margin: 0; }
.topbar h2.h1 small { display: block; font-size: .8125rem; font-weight: 500; color: var(--text-3); letter-spacing: .02em; line-height: 1.2; }
.topbar.large h2.h1 { font-size: 1.75rem; letter-spacing: -.02em; line-height: 1.1; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 44px; height: 44px; border-radius: var(--r); display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); position: relative; transition: background var(--dur-fast), transform var(--dur-fast);
}
.icon-btn:active { transform: scale(.94); background: var(--surface-2); }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); }
.icon-btn .count { position: absolute; top: 5px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--pill); background: var(--danger); color: var(--on-accent); font-size: .75rem; font-weight: 700; line-height: 18px; text-align: center; }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--surface-2); } }

/* Brand mark */
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark { width: 32px; height: 32px; border-radius: 10px; background: var(--navy); color: var(--gold-2); display: grid; place-items: center; font-family: var(--font-brand); font-weight: 700; font-size: .8125rem; letter-spacing: .04em; border: 1px solid rgba(200, 168, 75, .35); }
.brand .name { font-family: var(--font-brand); font-weight: 600; font-size: .875rem; letter-spacing: .08em; color: var(--gold-text); }
.brand .sub { font-size: .8125rem; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; }

/* Offline / status banner */
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: .875rem; font-weight: 500; border-radius: var(--r); }
.banner.offline { background: var(--warn-soft); color: var(--warn); }
.banner.info { background: var(--teal-soft); color: var(--teal); }
.banner.danger { background: var(--danger-soft); color: var(--danger); }
.banner .grow { flex: 1; }
.banner button { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; color: inherit; min-height: 32px; }
.global-banner { position: sticky; top: 0; z-index: 40; margin: 0; border-radius: 0; padding-top: calc(10px + var(--safe-t)); }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-3); font-size: .8125rem; font-weight: 500; position: relative; transition: color var(--dur-fast); }
.tab svg.ico { width: 24px; height: 24px; transition: transform var(--dur-fast); }
.tab:active svg.ico { transform: scale(.9); }
.tab.on { color: var(--gold-text); font-weight: 600; }
.tab.on svg.ico { stroke-width: 2.2; }
.tab .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: var(--pill); background: var(--danger); color: var(--on-accent); font-size: .75rem; font-weight: 700; line-height: 17px; text-align: center; }

/* ───────────────────────── Primitives ───────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; box-shadow: var(--shadow-1);
}
.card.flat { box-shadow: none; }
.card.pad-0 { padding: 0; overflow: hidden; }
.card.hero {
  position: relative; overflow: hidden; color: #eef1fb;
  background: linear-gradient(160deg, #0e1838 0%, #0a1026 55%, #070b19 100%);
  border-color: rgba(200, 168, 75, .28);
}
.card.hero::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(200, 168, 75, .75), transparent); }
.card.hero::after {
  content: ''; position: absolute; inset: auto -40% -70% -10%; height: 120%;
  background: radial-gradient(ellipse at 50% 100%, rgba(31, 168, 201, .22), transparent 60%);
  pointer-events: none;
}
.card.hero .muted { color: #a9b4d6; }
.card.hero .faint { color: #7f8bb3; }
.card.hero > * { position: relative; z-index: 1; }

.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-h h2 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.005em; }
.section-h .link { font-size: .875rem; font-weight: 600; color: var(--gold-text); min-height: 32px; display: inline-flex; align-items: center; gap: 4px; }

.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 8px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title { font-weight: 600; font-size: 1rem; line-height: 1.3; }
.sub { font-size: .875rem; color: var(--text-2); line-height: 1.35; }
.cap { font-size: .8125rem; color: var(--text-3); }
.kicker { font-size: .8125rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.big { font-size: 1.75rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.vessel-name { font-family: var(--font-brand); font-weight: 600; letter-spacing: .1em; color: var(--gold-2); font-size: .8125rem; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: var(--r);
  font-weight: 600; font-size: 1rem; line-height: 1; white-space: nowrap;
  background: var(--surface-2); color: var(--text); border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast), opacity var(--dur-fast), box-shadow var(--dur-fast);
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--gold); color: var(--gold-ink); }
.btn.primary:active { background: var(--gold-2); }
.btn.navy { background: var(--navy); color: #fff; }
.btn.outline { background: transparent; border-color: var(--line-2); }
.btn.ghost { background: transparent; color: var(--gold-text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: var(--on-accent); }
.btn.ok { background: var(--ok); color: var(--on-accent); }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: .875rem; border-radius: 10px; }
.btn.xs { min-height: 32px; padding: 0 10px; font-size: .8125rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.pill { border-radius: var(--pill); }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.btn.loading { pointer-events: none; }
.btn.loading .lbl { opacity: 0; }
.btn.loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn { position: relative; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--surface-3); }
  .btn.primary:hover { background: var(--gold-2); }
  .btn.navy:hover { background: var(--navy-2); }
  .btn.ghost:hover, .btn.outline:hover { background: var(--surface-2); }
  .btn.danger:hover { background: var(--danger); color: var(--on-accent); }
}
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }

/* Sticky action bar at the bottom of a screen */
.action-bar {
  position: sticky; bottom: calc(var(--tab-h) + var(--safe-b)); z-index: 20;
  display: flex; gap: 10px; padding: 12px var(--gutter) 12px; margin-top: auto;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.action-bar > .btn { flex: 1; }
.action-bar > .btn.fit { flex: 0 0 auto; }
.screen.no-tabs { padding-bottom: 0; }
.screen.no-tabs .action-bar { bottom: 0; padding-bottom: calc(12px + var(--safe-b)); }

/* Pills, chips, badges */
.pill-s { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 0 9px; border-radius: var(--pill); font-size: .8125rem; font-weight: 600; letter-spacing: .02em; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.pill-s svg.ico { width: 13px; height: 13px; }
.pill-s.grey { background: var(--surface-2); color: var(--text-2); }
.pill-s.teal { background: var(--teal-soft); color: var(--teal); }
.pill-s.gold { background: var(--gold-soft); color: var(--gold-text); }
.pill-s.ok { background: var(--ok-soft); color: var(--ok); }
.pill-s.warn { background: var(--warn-soft); color: var(--warn); }
.pill-s.danger { background: var(--danger-soft); color: var(--danger); }
.pill-s.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.pill-s.solid-danger { background: var(--danger); color: var(--on-accent); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: var(--pill);
  background: var(--surface); border: 1px solid var(--line-2); color: var(--text); font-weight: 500; font-size: .9375rem; white-space: nowrap;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
}
.chip:active { transform: scale(.97); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.on svg.ico { color: var(--gold-2); }
.chip.sm { min-height: 34px; padding: 0 12px; font-size: .875rem; }
.chip svg.ico { width: 17px; height: 17px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter); scrollbar-width: none; scroll-snap-type: x proximity; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll .chip { scroll-snap-align: start; }
:root[data-theme="dark"] .chip.on, :root:not([data-theme="light"]) .chip.on { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
:root[data-theme="dark"] .chip.on svg.ico, :root:not([data-theme="light"]) .chip.on svg.ico { color: var(--gold-ink); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .chip.on { background: var(--navy); border-color: var(--navy); color: #fff; } :root:not([data-theme="dark"]) .chip.on svg.ico { color: var(--gold-2); } }

/* Segmented control */
.seg { display: flex; background: var(--surface-2); border-radius: var(--r); padding: 3px; gap: 2px; }
.seg button { flex: 1; min-height: 38px; border-radius: 9px; font-size: .875rem; font-weight: 600; color: var(--text-2); transition: background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast); display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 6px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.seg button .n { font-size: .8125rem; font-weight: 700; color: var(--text-2); background: var(--surface-3); border-radius: var(--pill); padding: 0 6px; min-width: 18px; height: 18px; line-height: 18px; }
.seg button.on .n { color: var(--gold-text); background: var(--gold-soft); }

/* Avatars */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .875rem; letter-spacing: .02em; flex: none; background: var(--surface-3); color: var(--text-2); }
.avatar.sm { width: 32px; height: 32px; font-size: .75rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.25rem; }
.avatar.bwa { background: var(--navy); color: var(--gold-2); font-family: var(--font-brand); font-size: .6875rem; }
.avatar.a1 { background: #dbe6f6; color: #1f3f7a; } .avatar.a2 { background: #e6e0f5; color: #4c2f8f; } .avatar.a3 { background: #d9f1e6; color: #1b6b45; }
.avatar.a4 { background: #fbe4d0; color: #8a4310; } .avatar.a5 { background: #f8dfe6; color: #8c2443; } .avatar.a6 { background: #dff3f6; color: #0f6577; }
:root[data-theme="dark"] .avatar.a1, :root[data-theme="dark"] .avatar.a2, :root[data-theme="dark"] .avatar.a3, :root[data-theme="dark"] .avatar.a4, :root[data-theme="dark"] .avatar.a5, :root[data-theme="dark"] .avatar.a6 { filter: brightness(.85) saturate(.9); }

/* Tile icon (type badge) */
.tile-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); }
.tile-ico.gold { background: var(--gold-soft); color: var(--gold-text); }
.tile-ico.teal { background: var(--teal-soft); color: var(--teal); }
.tile-ico.ok { background: var(--ok-soft); color: var(--ok); }
.tile-ico.warn { background: var(--warn-soft); color: var(--warn); }
.tile-ico.danger { background: var(--danger-soft); color: var(--danger); }
.tile-ico.navy { background: var(--navy); color: var(--gold-2); }
.tile-ico.sm { width: 36px; height: 36px; border-radius: 10px; }
.tile-ico.sm svg.ico { width: 18px; height: 18px; }

/* List rows */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); }
.list .item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 60px; text-align: left; width: 100%; color: inherit; transition: background var(--dur-fast); position: relative; }
.list .item + .item { border-top: 1px solid var(--line); }
.list .item:active { background: var(--surface-2); }
.list .item .chev { color: var(--text-3); flex: none; }
.list .item.static:active { background: transparent; }
@media (hover: hover) and (pointer: fine) { .list .item:not(.static):hover { background: var(--surface-2); } }
.list .item .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list .item .body .t { font-weight: 600; font-size: 1rem; line-height: 1.3; }
.list .item .body .s { font-size: .875rem; color: var(--text-2); }
.list .item .body .c { font-size: .8125rem; color: var(--text-3); }
.list .item .right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.list .item .right .amt { font-weight: 600; font-size: 1rem; }
.list .item .right .when { font-size: .8125rem; color: var(--text-3); }
.list .head { padding: 10px 14px 6px; font-size: .8125rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); }
.list .item .unread { position: absolute; left: 4px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--teal); }

/* Request-specific row */
.req-row .body .t { display: flex; align-items: center; gap: 6px; }
.req-row .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }

/* Key / value */
.kv { display: grid; grid-template-columns: minmax(96px, 36%) 1fr; gap: 8px 12px; font-size: .9375rem; }
.kv dt { color: var(--text-3); font-size: .875rem; padding-top: 1px; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.kv dd.strong { font-weight: 600; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-height: 76px; text-align: left; color: inherit; transition: background var(--dur-fast); }
.stat:active { background: var(--surface-2); }
.stat .v { font-size: 1.375rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.stat .l { font-size: .8125rem; color: var(--text-2); }
.stat.warn .v { color: var(--warn); }
.stat.danger .v { color: var(--danger); }
.stat.ok .v { color: var(--ok); }
.stat.gold .v { color: var(--gold-text); }

/* Quick action tiles */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px 10px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: .8125rem; font-weight: 600; line-height: 1.15; text-align: center; transition: transform var(--dur-fast), background var(--dur-fast); min-height: 78px; }
.quick button:active { transform: scale(.97); background: var(--surface-2); }
.quick button .tile-ico { width: 40px; height: 40px; }
.quick button.urgent { border-color: color-mix(in srgb, var(--danger) 35%, transparent); }

/* Attention list items */
.attn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.attn .body { flex: 1; min-width: 0; }
.attn .body .t { font-weight: 600; font-size: .9375rem; }
.attn .body .s { font-size: .84375rem; color: var(--text-2); }
.attn .act { flex: none; }

/* Type grid for New request */
.type-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.type-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--text); text-align: left; min-height: 116px; transition: transform var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast); box-shadow: var(--shadow-1); }
.type-tile:active { transform: scale(.98); background: var(--surface-2); }
.type-tile .lbl { font-weight: 600; font-size: .9375rem; line-height: 1.2; }
.type-tile .hint { font-size: .8125rem; color: var(--text-3); line-height: 1.3; }
@media (hover: hover) and (pointer: fine) { .type-tile:hover { border-color: var(--line-2); background: var(--surface-2); } }

/* Recent / duplicate cards (horizontal) */
.hscroll { display: flex; gap: 10px; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: 0 0 auto; }
.mini-card { width: 200px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); text-align: left; color: var(--text); display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-1); transition: transform var(--dur-fast); }
.mini-card:active { transform: scale(.98); }
.mini-card .t { font-weight: 600; font-size: .90625rem; line-height: 1.25; }
.mini-card .s { font-size: .8125rem; color: var(--text-3); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field .lab { font-size: .875rem; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field .lab .req { color: var(--danger); }
.field .lab .optl, .field label .optl { font-weight: 500; color: var(--text-3); }
.items-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.field .hint { font-size: .8125rem; color: var(--text-3); }
.field .err { display: none; font-size: .84375rem; color: var(--danger); font-weight: 500; align-items: center; gap: 5px; }
.field.invalid .err { display: flex; }
.field.invalid .input, .field.invalid .input-wrap { border-color: var(--danger); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line-2); color: var(--text); font-size: max(16px, 1rem);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.input-wrap { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 8px 0 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line-2); }
.input-wrap:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.input-wrap input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 0; }
.input-wrap input:focus { outline: none; }
.input-wrap .unit { font-size: .875rem; color: var(--text-3); font-weight: 500; padding-right: 6px; }
.input-wrap svg.ico { color: var(--text-3); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.form-section { display: flex; flex-direction: column; gap: 14px; }
.form-section > h3 { font-size: .8125rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-top: 6px; }

/* Stepper (quantity) */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.stepper button { width: 46px; height: 46px; display: grid; place-items: center; color: var(--text-2); transition: background var(--dur-fast); }
.stepper button:active { background: var(--surface-2); }
.stepper input { width: 64px; text-align: center; border: 0; background: transparent; font-weight: 600; font-size: 1.0625rem; min-height: 46px; }
.stepper input:focus { outline: none; }

/* Option cards (single choice, large tap) */
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 52px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line-2); color: var(--text); font-weight: 500; font-size: .9375rem; text-align: left; transition: border-color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast); }
.opt:active { transform: scale(.98); }
.opt.on { border-color: var(--gold); background: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--gold); }
.opt .ck { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; }
.opt.on .ck { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.opt.on .ck::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--gold-ink); }
.opt.multi .ck { border-radius: 6px; }
.opt.multi.on .ck::after { width: 10px; height: 6px; border-radius: 0; border-left: 2px solid var(--gold-ink); border-bottom: 2px solid var(--gold-ink); background: none; transform: translateY(-1px) rotate(-45deg); }
.opt .ol { display: flex; flex-direction: column; min-width: 0; }
.opt .ol small { font-size: .8125rem; color: var(--text-3); font-weight: 500; }

/* Toggle switch */
.switch { position: relative; width: 50px; height: 30px; border-radius: var(--pill); background: var(--surface-3); transition: background var(--dur-fast); flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform var(--dur) var(--ease-out); }
.switch.on { background: var(--ok); }
.switch.on::after { transform: translateX(20px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }

/* Items list (provisioning etc.) */
.items { display: flex; flex-direction: column; gap: 8px; }
.item-line { display: grid; grid-template-columns: 1fr 70px 76px 40px; gap: 6px; align-items: center; }
.item-line .input { min-height: 44px; padding: 8px 10px; }
.item-line .del { width: 40px; height: 44px; display: grid; place-items: center; color: var(--text-3); border-radius: 10px; }
.item-line .del:active { background: var(--danger-soft); color: var(--danger); }

/* Attachments */
.attach-row { display: flex; gap: 8px; flex-wrap: wrap; }
.attach { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 8px; border-radius: 10px; background: var(--surface-2); font-size: .875rem; font-weight: 500; }
.attach .thumb { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, var(--surface-3), var(--line-2)); display: grid; place-items: center; color: var(--text-3); }
.attach button { color: var(--text-3); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; }
.attach-add { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px dashed var(--line-2); color: var(--text-2); font-weight: 500; font-size: .875rem; }

/* Urgency selector */
.urgency { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
/* min-width:0 + wrapping: "Prioritaire" / "Urgente" fit three columns at 360 px (FR / ES) */
.urgency .opt { justify-content: center; min-width: 0; padding-left: 8px; padding-right: 8px; gap: 6px; text-align: center; overflow-wrap: anywhere; }
.urgency .opt.u-urgent.on { border-color: var(--danger); background: var(--danger-soft); box-shadow: inset 0 0 0 1px var(--danger); color: var(--danger); }
.urgency .opt.u-urgent.on .ck { background: var(--danger); border-color: var(--danger); }
.urgency .opt.u-urgent.on .ck::after { background: #fff; }
.urgency .opt.u-priority.on { border-color: var(--warn); background: var(--warn-soft); box-shadow: inset 0 0 0 1px var(--warn); color: var(--warn); }
.urgency .opt.u-priority.on .ck { background: var(--warn); border-color: var(--warn); }
.urgency .opt.u-priority.on .ck::after { background: #fff; }

/* Progress steps (wizard) */
.steps { display: flex; align-items: center; gap: 6px; padding: 4px 0 2px; }
.steps .st { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.steps .st.done { background: var(--gold); }
.steps .st.cur { background: linear-gradient(90deg, var(--gold) 50%, var(--surface-3) 50%); }
.step-lbl { font-size: .8125rem; color: var(--text-3); font-weight: 500; }

/* Ticket (review summary) */
.ticket { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); }
.ticket .ticket-h { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--navy); color: #eef1fb; }
.ticket .ticket-h .tile-ico { background: rgba(200, 168, 75, .18); color: var(--gold-2); }
.ticket .ticket-h .kicker { color: #a9b4d6; }
.ticket .ticket-b { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.ticket .ticket-f { padding: 10px 16px; border-top: 1px dashed var(--line-2); font-size: .8125rem; color: var(--text-3); display: flex; gap: 8px; align-items: center; }

/* Timeline (request status) */
.tl { display: grid; grid-template-columns: repeat(4, 1fr); position: relative; margin: 6px 0 2px; }
.tl::before { content: ''; position: absolute; left: 12.5%; right: 12.5%; top: 11px; height: 2px; background: var(--line-2); }
.tl .n { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; text-align: center; }
.tl .n .d { width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); display: grid; place-items: center; color: var(--on-accent); position: relative; z-index: 1; }
.tl .n .d svg.ico { width: 13px; height: 13px; stroke-width: 3; }
.tl .n.done .d { background: var(--ok); border-color: var(--ok); }
.tl .n.cur .d { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); box-shadow: 0 0 0 4px var(--gold-soft); }
.tl .n.cur .d::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--gold-ink); }
.tl .n.cancel .d { background: var(--danger); border-color: var(--danger); }
.tl .n .l { font-size: .8125rem; font-weight: 600; color: var(--text-3); line-height: 1.2; }
.tl .n.done .l, .tl .n.cur .l { color: var(--text); }
.tl .n .w { font-size: .8125rem; color: var(--text-3); }
.tl .n:nth-child(1) ~ .n.done::before, .tl .n.cur::before { content: ''; position: absolute; top: 11px; right: 50%; width: 100%; height: 2px; background: var(--ok); z-index: 0; }
.tl .n.cur::before { background: var(--ok); }
.tl .n:first-child::before { display: none; }

/* Quote card */
.quote { border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); background: linear-gradient(180deg, var(--gold-soft), transparent 70%), var(--surface); }
.quote .amt { font-size: 1.875rem; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.quote .amt small { font-size: .9375rem; font-weight: 600; color: var(--text-2); margin-left: 4px; letter-spacing: 0; }
.quote .lines { display: flex; flex-direction: column; gap: 6px; font-size: .90625rem; }
.quote .lines .ln { display: flex; justify-content: space-between; gap: 10px; }
.quote .lines .ln span:first-child { color: var(--text-2); }

/* Messages */
.thread { display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble { padding: 10px 13px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: .9375rem; line-height: 1.4; box-shadow: var(--shadow-1); }
.msg.me .bubble { background: var(--navy); color: #eef1fb; border-color: var(--navy); border-bottom-right-radius: 5px; }
.msg:not(.me) .bubble { border-bottom-left-radius: 5px; }
.msg .meta { font-size: .8125rem; color: var(--text-3); margin-top: 3px; }
.msg.me .meta { text-align: right; }
.msg.sys { align-self: center; max-width: 100%; }
.msg.sys .bubble { background: transparent; border: 0; box-shadow: none; color: var(--text-3); font-size: .8125rem; text-align: center; padding: 4px 0; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer .input-wrap { flex: 1; align-items: flex-end; padding-right: 4px; }
.composer textarea { flex: 1; min-width: 0; border: 0; background: transparent; resize: none; max-height: 120px; padding: 11px 0; line-height: 1.35; }
.composer textarea:focus { outline: none; }
.composer .send { width: 48px; height: 48px; border-radius: var(--r); background: var(--gold); color: var(--gold-ink); display: grid; place-items: center; flex: none; transition: transform var(--dur-fast), opacity var(--dur-fast); }
.composer .send:active { transform: scale(.94); }
.composer .send[disabled] { opacity: .4; }
.quick-replies { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.quick-replies::-webkit-scrollbar { display: none; }
.typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* Activity log */
.log { display: flex; flex-direction: column; gap: 0; }
.log .ev { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 6px 0; font-size: .875rem; }
.log .ev .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); margin: 7px auto 0; }
.log .ev .dot.ok { background: var(--ok); } .log .ev .dot.gold { background: var(--gold); } .log .ev .dot.teal { background: var(--teal); } .log .ev .dot.danger { background: var(--danger); }
.log .ev .w { font-size: .8125rem; color: var(--text-3); }

/* Checklist */
.check { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 56px; width: 100%; text-align: left; color: inherit; }
.check + .check { border-top: 1px solid var(--line); }
.check .box { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; color: var(--on-accent); flex: none; transition: background var(--dur-fast), border-color var(--dur-fast); }
.check .box svg.ico { width: 14px; height: 14px; stroke-width: 3; }
.check.done .box { background: var(--ok); border-color: var(--ok); }
.check.warn .box { border-color: var(--warn); }
.check .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.check .body .t { font-weight: 600; font-size: .9375rem; line-height: 1.3; }
.check.done .body .t { color: var(--text-2); }
.check .body .s { font-size: .8125rem; color: var(--text-3); }
.check .go { font-size: .84375rem; font-weight: 600; color: var(--gold-text); white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; min-height: 36px; padding: 0 6px; }

/* Progress ring */
.ring { --p: 0; width: 56px; height: 56px; border-radius: 50%; background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--surface-3) 0); display: grid; place-items: center; flex: none; }
.ring::after { content: attr(data-label); width: 44px; height: 44px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: .8125rem; }
.card.hero .ring::after { background: #0b1230; color: #fff; }

/* Bars */
.bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--gold); border-radius: 4px; transition: width 400ms var(--ease-out); }
.bar.teal > span { background: var(--teal); }
.bar.danger > span { background: var(--danger); }

/* Skeletons */
.sk { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 8px; }
.sk::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk.line { height: 14px; }
.sk.line.w40 { width: 40%; } .sk.line.w60 { width: 60%; } .sk.line.w80 { width: 80%; }
.sk.block { height: 84px; border-radius: var(--r-lg); }
.sk.circle { width: 40px; height: 40px; border-radius: 50%; }
.sk-row { display: flex; gap: 12px; align-items: center; padding: 14px; }
.sk-row .col { flex: 1; gap: 8px; }

/* Empty / error states */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 20px; color: var(--text-2); }
.empty .tile-ico { width: 56px; height: 56px; border-radius: 18px; margin-bottom: 4px; }
.empty h3 { font-size: 1.0625rem; font-weight: 600; color: var(--text); }
.empty p { font-size: .90625rem; max-width: 32ch; }
.empty .btn { margin-top: 8px; }

/* Alerts inline */
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r); font-size: .90625rem; line-height: 1.4; align-items: flex-start; }
.callout svg.ico { flex: none; margin-top: 1px; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout.danger { background: var(--danger-soft); color: var(--danger); }
.callout.teal { background: var(--teal-soft); color: var(--teal); }
.callout.ok { background: var(--ok-soft); color: var(--ok); }
.callout.neutral { background: var(--surface-2); color: var(--text-2); }
.callout b { font-weight: 600; }

/* Search */
.search { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: var(--r); background: var(--surface-2); color: var(--text-3); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); padding: 10px 0; }
.search input:focus { outline: none; }
.search input::placeholder { color: var(--text-3); }

/* FAB */
.fab { position: fixed; right: 16px; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); z-index: 34; height: 56px; padding: 0 22px 0 18px; border-radius: var(--pill); background: var(--gold); color: var(--gold-ink); font-weight: 700; font-size: 1rem; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 10px 24px rgba(16, 23, 51, .22), 0 2px 6px rgba(16, 23, 51, .15); transition: transform var(--dur-fast); }
.fab:active { transform: scale(.96); }

/* Sheet */
.sheet-root { position: fixed; inset: 0; z-index: 100; display: none; }
.sheet-root.open { display: block; }
.sheet-scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade-in 180ms var(--ease-out); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100dvh - 40px);
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-3);
  display: flex; flex-direction: column; animation: slide-up 260ms var(--ease-out);
  padding-bottom: var(--safe-b);
  touch-action: pan-y;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 8px auto 2px; }
.sheet .sheet-h { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 20px; min-height: 52px; }
.sheet .sheet-h h2 { flex: 1; font-size: 1.125rem; font-weight: 600; }
.sheet .sheet-b { padding: 4px 20px 20px; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 14px; }
.sheet .sheet-f { display: flex; gap: 10px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.sheet .sheet-f > .btn { flex: 1; }
.sheet.closing { animation: sheet-out 180ms var(--ease) forwards; }
.sheet-root.closing .sheet-scrim { animation: fade-out 180ms var(--ease) forwards; }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes fade-out { to { opacity: 0; } }
/* Dialog (centered confirm) */
.sheet.dialog { left: 50%; right: auto; bottom: auto; top: 50%; width: min(420px, calc(100% - 32px)); transform: translate(-50%, -50%); border-radius: 18px; animation: pop-in 200ms var(--ease-out); padding-bottom: 0; }
.sheet.dialog.closing { animation: fade-out 140ms var(--ease) forwards; }
.sheet.dialog .sheet-h { padding-top: 16px; }
.sheet.dialog .grab { display: none; }

/* Toasts */
#toast-root { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); z-index: 120; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 480px; width: 100%; padding: 12px 14px; border-radius: 14px; background: var(--navy); color: #eef1fb; font-size: .90625rem; font-weight: 500; box-shadow: var(--shadow-2); animation: pop-in 200ms var(--ease-out); }
.toast .grow { flex: 1; }
.toast svg.ico { color: var(--gold-2); flex: none; }
.toast.ok svg.ico { color: var(--ok); } .toast.err svg.ico { color: var(--danger); } .toast.warn svg.ico { color: var(--warn); }
.toast button { color: var(--gold-2); font-weight: 700; min-height: 32px; padding: 0 6px; }
.toast.out { animation: fade-out 160ms var(--ease) forwards; }

/* Success screen */
.success { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 40px 20px 20px; }
.success .big-check { width: 84px; height: 84px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; animation: pop-in 320ms var(--ease-out); }
.success .big-check svg.ico { width: 40px; height: 40px; stroke-width: 2.5; }
.success .big-check.warn { background: var(--warn-soft); color: var(--warn); }
.success h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -.01em; }
.success p { color: var(--text-2); max-width: 34ch; }
.success .ref { font-family: var(--font-brand); font-size: .9375rem; letter-spacing: .08em; color: var(--gold-text); }

/* Invoice lines */
.inv-line { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; }
.inv-line + .inv-line { border-top: 1px solid var(--line); }
.inv-line .body { flex: 1; min-width: 0; }
.inv-line .body .t { font-weight: 500; font-size: .9375rem; }
.inv-line .body .s { font-size: .8125rem; color: var(--text-3); }
.inv-line .amt { font-weight: 600; white-space: nowrap; }
.inv-line .more { width: 36px; height: 36px; display: grid; place-items: center; color: var(--text-3); border-radius: 10px; margin: -6px -8px -6px 0; }
.inv-line.disputed { background: var(--warn-soft); }
.total-row { display: flex; justify-content: space-between; padding: 12px 14px; font-weight: 600; border-top: 1px solid var(--line-2); }
.total-row.grand { font-size: 1.125rem; }

/* Doc rows */
.doc-exp { font-size: .8125rem; font-weight: 600; }
.doc-exp.ok { color: var(--ok); } .doc-exp.warn { color: var(--warn); } .doc-exp.danger { color: var(--danger); }

/* Vessel specs */
.specs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.specs .sp { background: var(--surface-2); border-radius: var(--r); padding: 10px 12px; }
.specs .sp .v { font-weight: 600; font-size: 1rem; }
.specs .sp .l { font-size: .8125rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }

/* Role / permission matrix */
.perm { display: grid; grid-template-columns: 1fr repeat(4, 44px); gap: 4px; align-items: center; font-size: .84375rem; }
.perm .h { font-size: .6875rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); text-align: center; }
.perm .y { display: grid; place-items: center; color: var(--ok); } .perm .n { display: grid; place-items: center; color: var(--line-2); }

/* Weather strip */
.weather { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.weather .w { background: var(--surface-2); border-radius: var(--r); padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
.weather .w .v { font-weight: 600; font-size: .90625rem; line-height: 1.2; }
.weather .w .l { font-size: .75rem; color: var(--text-3); }

/* Countdown */
.countdown { display: flex; gap: 14px; }
.countdown .u { display: flex; flex-direction: column; align-items: center; min-width: 48px; }
.countdown .u b { font-size: 1.625rem; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.countdown .u span { font-size: .8125rem; letter-spacing: .08em; text-transform: uppercase; color: #a9b4d6; margin-top: 4px; }

/* Demo badge */
.demo-tag { position: fixed; top: calc(8px + var(--safe-t)); right: 8px; z-index: 50; font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: var(--pill); background: var(--gold-soft); color: var(--gold-text); pointer-events: none; opacity: .85; }
.sidebar .demo-tag { position: static; }

/* ───────────────────────── Tablet / desktop ───────────────────────── */
@media (min-width: 900px) {
  :root { --gutter: 24px; }
  .app { flex-direction: row; }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px; width: 248px; flex: none;
    position: sticky; top: 0; height: 100dvh; padding: 20px 14px; border-right: 1px solid var(--line);
    background: var(--surface);
  }
  .sidebar .brand { padding: 4px 8px 16px; }
  .sidebar .nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--r); color: var(--text-2); font-weight: 500; font-size: .9375rem; width: 100%; text-align: left; position: relative; transition: background var(--dur-fast), color var(--dur-fast); }
  .sidebar .nav-item:hover { background: var(--surface-2); color: var(--text); }
  .sidebar .nav-item.on { background: var(--gold-soft); color: var(--gold-text); font-weight: 600; }
  .sidebar .nav-item .badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--pill); background: var(--danger); color: var(--on-accent); font-size: .75rem; font-weight: 700; line-height: 20px; text-align: center; }
  .sidebar .nav-sep { height: 1px; background: var(--line); margin: 8px 4px; }
  .sidebar .nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
  .sidebar .nav-foot .user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r); }
  .sidebar .nav-foot .user .t { font-weight: 600; font-size: .875rem; }
  .sidebar .nav-foot .user .s { font-size: .8125rem; color: var(--text-3); }
  .sidebar .nav-vessel { padding: 10px 12px; border-radius: var(--r); background: var(--navy); color: #eef1fb; margin-bottom: 8px; }
  .sidebar .nav-vessel .s { font-size: .8125rem; color: #a9b4d6; }
  .tabbar { display: none; }
  .fab { bottom: 24px; right: 24px; }
  #toast-root { bottom: 24px; left: 272px; }
  .screen { padding-bottom: 24px; max-width: 820px; width: 100%; }
  .screen.wide { max-width: none; }
  .action-bar { bottom: 0; border-top: 0; }
  .view { align-items: stretch; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .type-grid { grid-template-columns: repeat(3, 1fr); }
  .quick { grid-template-columns: repeat(4, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .sheet { left: 50%; right: auto; width: min(560px, calc(100% - 32px)); transform: translateX(-50%); border-radius: 22px; bottom: 24px; max-height: calc(100dvh - 48px); }
  .sheet.closing { animation: dialog-out 160ms var(--ease) forwards; }
  @keyframes dialog-out { to { opacity: 0; transform: translateX(-50%) translateY(12px); } }
  .sheet.dialog { transform: translate(-50%, -50%); bottom: auto; }
  .sheet.dialog.closing { animation: fade-out 140ms var(--ease) forwards; }
  .demo-tag { top: auto; bottom: 12px; right: 12px; }
}

/* Two-pane master/detail on wide screens */
@media (min-width: 1120px) {
  .view.split { flex-direction: row; align-items: stretch; }
  .view.split .screen.master { width: 400px; max-width: 400px; flex: none; border-right: 1px solid var(--line); height: 100dvh; position: sticky; top: 0; overflow-y: auto; overscroll-behavior: contain; }
  .view.split .screen.detail { flex: 1; max-width: 860px; }
  .view.split .screen.master .fab { display: none; }
  .view.split .master .list .item.selected { background: var(--gold-soft); }
  .view.split .screen.detail .topbar .back { display: none; }
  .split-placeholder { flex: 1; display: grid; place-items: center; color: var(--text-3); padding: 40px; }
}
@media (min-width: 1280px) { .type-grid { grid-template-columns: repeat(4, 1fr); } }

/* ───────────────────────── crew v3 shell (stream S0) ───────────────────────── */
/* tab bar shows 4 tabs until the Chat screen is loaded */
.tabbar[data-n="4"] { grid-template-columns: repeat(4, 1fr); }
.tab[aria-current="page"] { color: var(--gold-text); }
/* Today hero buttons (plug-ins returning a hero action use class "btn sm hero-btn") */
.card.hero .hero-btn { background: rgba(255, 255, 255, .1); color: #fff; flex: 1 1 0; min-width: 0; min-height: 44px; }
.card.hero .hero-btn:active { background: rgba(255, 255, 255, .18); }
.list .item.more-row { min-height: 48px; color: var(--gold-text); }
.list .item.more-row .t { font-size: .9375rem; }
/* Yacht hub: 2 columns on phones, 4 on wide screens */
.hub-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.hub-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; min-height: 112px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--text); text-align: left; box-shadow: var(--shadow-1); transition: transform var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast); }
.hub-tile:active { transform: scale(.98); background: var(--surface-2); }
.hub-tile .lbl { font-weight: 600; font-size: .9375rem; line-height: 1.2; }
.hub-tile .hint { font-size: .8125rem; color: var(--text-2); line-height: 1.3; }
.hub-tile.tone-warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.hub-tile.tone-danger { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
@media (hover: hover) and (pointer: fine) { .hub-tile:hover { border-color: var(--line-2); background: var(--surface-2); } }
@media (min-width: 900px) { .hub-grid { grid-template-columns: repeat(4, 1fr); } }
/* plug-in slots and state helpers */
.req-slot:empty { display: none; }
.list .item .body .s.req-extra { color: var(--teal); font-weight: 500; }
.saved-copy { display: flex; align-items: center; gap: 6px; }

/* ───────────────────────── accessibility (crew v3, stream S8) ───────────────────────── */
/* a visible keyboard focus ring on every interactive component (inset where a parent clips: lists, scrollers, tab bar, segments) */
.btn:focus-visible, .item:focus-visible, .tab:focus-visible, .seg button:focus-visible, .switch:focus-visible, .icon-btn:focus-visible,
.hub-tile:focus-visible, .chip:focus-visible, .opt:focus-visible, .type-tile:focus-visible, .mini-card:focus-visible, .stat:focus-visible,
.quick button:focus-visible, .check:focus-visible, .fab:focus-visible, .nav-item:focus-visible, .attach-add:focus-visible, .stepper button:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 2px;
}
.list .item:focus-visible, .list .check:focus-visible, .card.pad-0 .item:focus-visible, .ticket .item:focus-visible,
.chips.scroll .chip:focus-visible, .hscroll > :focus-visible, .seg button:focus-visible, .tab:focus-visible { outline-offset: -3px; }
.search:focus-within, .stepper:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
/* 44 px touch target around the 30 px switch (::after is the knob) */
.switch::before { content: ''; position: absolute; inset: -7px -4px; }
.switch[disabled] { opacity: .55; cursor: default; }
/* tab labels stay on one line at 360 px and with larger text */
.tab > span:not(.badge) { max-width: 100%; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
