/* ==========================================================================
   Factory 54 · store app — design system
   Monochrome on paper, hairline borders instead of shadows, one restrained
   accent (burgundy) for primary actions. 8 px spacing grid. System font stack
   (no web fonts: the app must work offline). Light + dark (prefers-color-scheme).
   Logical properties (inline-start/end) so Hebrew (RTL) mirrors correctly.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Palette */
  --bg: #f4f1ea;            /* paper */
  --surface: #ffffff;
  --surface-2: #ece8df;     /* warm grey wells */
  --ink: #111111;           /* near-black text */
  --ink-2: #2e2d2a;
  --muted: #5f5b54;         /* 6.4:1 on white - readable in sunlight */
  --line: #dfd9cd;          /* hairline */
  --line-strong: #c7c0b2;
  --accent: #6b1d2a;        /* burgundy - primary actions only */
  --accent-ink: #ffffff;
  --accent-soft: #f1e4e5;

  /* Status (muted, meaning kept) */
  --present: #3d6a4c;
  --present-soft: #e9f0ea;
  --missing: #9e4239;
  --missing-soft: #f5e8e5;
  --uncertain: #85692c;
  --uncertain-soft: #f4eedf;

  /* Legacy aliases used by markup/older rules */
  --card: var(--surface);
  --olive: var(--accent);
  --olive-soft: var(--accent-soft);
  --button: var(--accent);
  --paper: var(--bg);
  --shadow: none;

  /* Spacing (8 px grid) */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 40px;

  /* Radii */
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;
  --radius: var(--r);

  /* Type scale */
  /* Hanken Grotesk when the font file is bundled (public/fonts); otherwise the system font - works offline. */
  --font: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, "Noto Sans Hebrew", sans-serif;
  --fs-display: 1.875rem;   /* 30 - screen title */
  --fs-title: 1.25rem;      /* 20 - section / card title */
  --fs-body: 1rem;          /* 16 */
  --fs-small: 0.9375rem;    /* 15 */
  --fs-caption: 0.8125rem;  /* 13 */
  --lh: 1.5;

  /* Motion */
  --t: 160ms cubic-bezier(0.2, 0, 0, 1);

  --tap: 44px;
  --nav: calc(64px + env(safe-area-inset-bottom));
  --thumb: 104px;

  font-family: var(--font);
  font-size: 16px;
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f0e0d;
    --surface: #181816;
    --surface-2: #22211f;
    --ink: #f3f1ec;
    --ink-2: #d9d6cf;
    --muted: #a7a298;
    --line: #2c2b28;
    --line-strong: #3d3b37;
    --accent: #d99aa4;
    --accent-ink: #15130f;
    --accent-soft: #2c1b1e;
    --present: #8fc19f;
    --present-soft: #1c2a21;
    --missing: #e39a90;
    --missing-soft: #2e1d1a;
    --uncertain: #d9be7f;
    --uncertain-soft: #2b2518;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100dvh; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.bidi, .sku { direction: ltr; unicode-bidi: isolate; }

.screen {
  min-height: 100dvh;
  padding: calc(var(--s3) + env(safe-area-inset-top)) var(--s4) calc(var(--nav) + var(--thumb));
  max-width: 480px;
  margin: 0 auto;
}

/* ---------- Top bar ---------- */
.top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s2);
  min-height: var(--tap);
  margin-bottom: var(--s4);
}
.brand { margin: 0; font-weight: 600; line-height: 1.2; }
.brand-block { min-width: 0; }
.logo { display: block; height: 28px; width: auto; object-fit: contain; }
.wordmark {
  display: block;
  font-size: var(--fs-caption);
  letter-spacing: 0.24em;
  font-weight: 700;
  text-transform: uppercase;
}
.subtitle { margin: 2px 0 0; font-size: var(--fs-caption); color: var(--muted); }
.loc { display: block; margin-top: var(--s1); font-size: var(--fs-caption); color: var(--muted); }
.back, .back-spacer { width: var(--tap); height: var(--tap); }
.top > .back-spacer:first-child { width: 0; }
.back {
  border: 0;
  background: transparent;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background-color var(--t);
}
.back:active { background: var(--surface-2); }
[dir="rtl"] .back svg { transform: scaleX(-1); }

/* Language: compact segmented control */
.langs {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.langs button {
  min-height: 32px;
  min-width: 40px;
  padding: 0 var(--s2);
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: var(--fs-caption);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  transition: background-color var(--t), color var(--t);
}
.langs button.on { background: var(--ink); color: var(--bg); }

/* ---------- Type ---------- */
.greeting {
  font-size: var(--fs-display);
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 650;
  margin: var(--s2) 0 var(--s5);
}
.section-title {
  margin: var(--s5) 0 var(--s3);
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.zone-title { font-size: var(--fs-display); line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 var(--s4); }
.muted { color: var(--muted); margin: 0; }
.warn { color: var(--uncertain); font-size: var(--fs-small); margin: 0; }
.admin-note { font-size: var(--fs-small); color: var(--muted); }
p { margin: 0; }
.stack > p, .card > p { line-height: var(--lh); }

/* ---------- Surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--s4);
  margin-bottom: var(--s3);
}
.card h2, .card h3 { margin: 0 0 var(--s1); font-size: var(--fs-title); font-weight: 600; line-height: 1.3; }
.card strong { font-weight: 600; }
.row { display: flex; justify-content: space-between; gap: var(--s3); align-items: center; min-width: 0; }
.row > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
details.card > summary { cursor: pointer; font-weight: 600; min-height: 28px; list-style-position: inside; }
details.card[open] > summary { margin-bottom: var(--s3); }
a.card, a.banner { display: block; color: inherit; text-decoration: none; }
.history-item, .zone-link { display: block; text-decoration: none; color: inherit; }
.chev { color: var(--muted); }

.ok-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  background: var(--present-soft);
  color: var(--present);
  border-radius: 999px;
  padding: 2px var(--s2);
  font-size: var(--fs-caption);
  font-weight: 600;
  white-space: nowrap;
}

.banner {
  border-radius: var(--r);
  padding: var(--s3) var(--s4);
  margin-bottom: var(--s3);
  background: var(--uncertain-soft);
  color: var(--ink);
  border: 1px solid transparent;
  font-size: var(--fs-small);
}
.banner.bad { background: var(--missing-soft); color: var(--missing); }

/* ---------- Buttons ---------- */
.primary, .ghost, .danger {
  width: 100%;
  min-height: 52px;
  padding: 0 var(--s5);
  border-radius: var(--r);
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform var(--t), background-color var(--t), border-color var(--t), opacity var(--t);
}
.primary { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.danger { background: var(--missing-soft); color: var(--missing); border: 1px solid transparent; }
.primary:active, .ghost:active, .danger:active, .tile:active, .chip:active, .chips button:active { transform: scale(0.98); }
.ghost:active { background: var(--surface-2); }
.primary:disabled, .ghost:disabled { opacity: 0.4; }
a.primary, a.ghost { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); text-decoration: none; }
a.primary { color: var(--accent-ink); }
a.button {
  display: flex; align-items: center; justify-content: center;
  min-height: 52px; border-radius: var(--r); border: 1px solid var(--line-strong);
  text-decoration: none; color: inherit;
}
.camera-btn { min-height: 56px; }
.row > .primary, .row > .ghost { width: auto; flex: 1; }

/* Chips / segmented */
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.chips.four { grid-template-columns: repeat(4, 1fr); }
.chips button, .chips .chip, a.chip {
  min-height: var(--tap);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 500;
  padding: var(--s1) var(--s3);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: background-color var(--t), border-color var(--t), color var(--t), transform var(--t);
}
.chips button.on, .chips .chip.on, a.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Forms ---------- */
label { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--fs-small); color: var(--ink-2); }
input, select, textarea {
  min-height: 48px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  padding: 0 var(--s3);
  font-size: 16px; /* no iOS zoom */
  transition: border-color var(--t);
}
textarea { padding: var(--s3); line-height: var(--lh); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }
input[type="checkbox"] { min-height: 0; width: 20px; height: 20px; accent-color: var(--accent); }
.check { width: 22px; height: 22px; }

/* ---------- Bottom bars ---------- */
.thumb-wrap, .nav {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
}
.thumb-wrap {
  bottom: var(--nav);
  padding: var(--s2) var(--s4);
  max-width: 480px;
  margin: 0 auto;
}
.nav {
  bottom: 0;
  display: flex;
  justify-content: space-around;
  padding: var(--s1) var(--s2) calc(var(--s1) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.nav a, .nav button.linkish {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  max-width: 96px;
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: 0;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
  line-height: 1.2;
  transition: color var(--t);
}
.nav a.active { color: var(--ink); }
.nav a.active .nav-icon { stroke-width: 2; }
.nav-icon { width: 24px; height: 24px; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav a .nav-icon { stroke-width: 1.6; }

/* ---------- Home tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); margin: 0 0 var(--s4); }
.tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 64px;
  padding: var(--s3);
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.25;
  transition: transform var(--t), border-color var(--t);
}
.tile-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 20px;
}
.tile-icon .nav-icon { width: 22px; height: 22px; stroke-width: 1.6; }
.tile .chat-badge { position: absolute; top: var(--s2); inset-inline-end: var(--s2); }

/* ---------- Capture / check ---------- */
.progress-label { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--fs-small); }
.track { height: 3px; background: var(--line); border-radius: 99px; margin: var(--s2) 0 var(--s4); }
.track span { display: block; height: 100%; background: var(--ink); border-radius: inherit; }
.finder {
  position: relative;
  background: var(--surface-2);
  border-radius: var(--r-lg);
  min-height: 420px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.finder video, .finder img.shot, .finder img.overlay {
  width: 100%;
  height: 460px;
  object-fit: contain;
  background: #0b0b0b;
}
.finder img.overlay { position: absolute; inset: 0; height: 100%; opacity: 0.45; pointer-events: none; }
.corners { position: absolute; inset: var(--s4); pointer-events: none; }
.corners i { position: absolute; width: 24px; height: 24px; border: 2px solid #fff; }
.corners i:nth-child(1) { inset-inline-start: 0; top: 0; border-inline-end: 0; border-bottom: 0; }
.corners i:nth-child(2) { inset-inline-end: 0; top: 0; border-inline-start: 0; border-bottom: 0; }
.corners i:nth-child(3) { inset-inline-start: 0; bottom: 0; border-inline-end: 0; border-top: 0; }
.corners i:nth-child(4) { inset-inline-end: 0; bottom: 0; border-inline-start: 0; border-top: 0; }
.align { text-align: center; color: var(--muted); margin: var(--s3) 0 var(--s2); }
.ref-dot { color: var(--accent); font-weight: 600; display: flex; justify-content: center; gap: var(--s2); align-items: center; }
.ref-dot::before { content: ""; width: 8px; height: 8px; border-radius: 99px; background: var(--accent); }
.shutter-wrap { display: grid; place-items: center; margin: var(--s4) 0; }
.shutter {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: transparent;
  box-shadow: inset 0 0 0 5px var(--bg), inset 0 0 0 7px var(--ink);
  transition: transform var(--t);
}
.shutter:active { transform: scale(0.94); }

.counts { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: var(--s2) 0 var(--s4); }
.counts span { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.present { background: var(--present); }
.dot.missing { background: var(--missing); }
.dot.uncertain { background: var(--uncertain); }
.flag { font-size: var(--fs-small); font-weight: 600; }
.flag.present { color: var(--present); }
.flag.missing { color: var(--missing); }
.flag.uncertain { color: var(--uncertain); }

.item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; }
.thumb, .swatch {
  width: 64px;
  height: 64px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-2);
}
.swatch { display: grid; place-items: center; text-align: center; font-size: var(--fs-caption); padding: var(--s1); }
.sku { color: var(--muted); margin: 2px 0 0; font-size: var(--fs-small); }
.compare {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
  background: var(--surface-2);
  border-radius: var(--r);
  padding: var(--s3);
  margin: var(--s2) 0;
}
.compare button { width: auto; min-height: var(--tap); padding: 0 var(--s4); }
.pair { display: grid; gap: var(--s2); }
.pair img { width: 100%; border-radius: var(--r); background: #0b0b0b; max-height: 280px; object-fit: contain; }
.boxes { position: relative; }
.boxes i { position: absolute; border: 2px solid var(--missing); border-radius: 6px; }
.boxes i.present { border-color: var(--present); }
.boxes i.uncertain { border-color: var(--uncertain); }
.photo-strip { display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: var(--s1); }
.photo-strip img { width: 80px; height: 80px; object-fit: cover; border-radius: var(--r-sm); }
.spot-crop { width: 100%; max-height: 260px; object-fit: contain; border-radius: var(--r-sm); background: var(--surface); }
.spot.decided { opacity: 0.85; }

/* ---------- Sheets / overlays ---------- */
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.4);
  z-index: 8;
  display: flex;
  align-items: flex-end;
}
.sheet .panel {
  background: var(--surface);
  width: min(480px, 100%);
  margin: 0 auto;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  border-top: 1px solid var(--line);
  padding: var(--s4) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom));
  max-height: 92dvh;
  overflow: auto;
}
.zoom { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.88); display: flex; align-items: center; justify-content: center; padding: var(--s4); }
.zoom img { max-width: 100%; max-height: 100%; border-radius: var(--r); background: #fff; touch-action: pinch-zoom; }
.zoom-close {
  position: absolute; top: calc(var(--s3) + env(safe-area-inset-top)); inset-inline-end: var(--s4);
  width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: #fff; color: #111; font-size: 26px; line-height: 1;
}

/* ---------- Stock ---------- */
.sizes { display: flex; flex-wrap: wrap; gap: var(--s1); }
.size {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--s1) var(--s2);
  background: var(--present-soft);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-small);
}
.size.zero { background: transparent; color: var(--muted); }
.size.neg { background: var(--missing-soft); color: var(--missing); border-color: var(--missing); }
.size.hit { outline: 2px solid var(--ink); font-weight: 700; }
.stock-head { gap: var(--s3); align-items: center; }
.stock-img { width: 80px; height: 80px; object-fit: contain; border-radius: var(--r-sm); background: #fff; cursor: zoom-in; }
.stock-pick { width: 100%; text-align: start; gap: var(--s3); align-items: center; font: inherit; color: inherit; }
.stock-pick p { margin: 2px 0 0; }
.stock-thumb { width: 64px; height: 64px; object-fit: contain; border-radius: var(--r-sm); background: #fff; flex: none; }

/* ---------- Schedule ---------- */
.sched-chip {
  display: inline-block;
  padding: 2px var(--s2);
  border-radius: var(--r-sm);
  font-size: var(--fs-caption);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  border: 1px solid transparent;
}
.sched-work { background: var(--surface-2); color: var(--ink); }
.sched-off { background: #f3e6d6; color: #6e4b1f; }
.sched-sick { background: #f3e1e3; color: #7d3440; }
.sched-abroad { background: #e2e8f1; color: #34496b; }
.sched-split { background: #e3ede4; color: #2f5a3b; }
.sched-manager { background: #f1ead2; color: #6b5419; }
@media (prefers-color-scheme: dark) {
  .sched-off { background: #33281b; color: #e5c49a; }
  .sched-sick { background: #36222a; color: #eab0bb; }
  .sched-abroad { background: #1f2836; color: #a9bfe0; }
  .sched-split { background: #1d2b21; color: #a6d1b1; }
  .sched-manager { background: #322b17; color: #e2cd8f; }
}
.sched-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.sched-grid label { display: grid; gap: 2px; font-size: var(--fs-caption); }
.sched-new { border-color: var(--uncertain); box-shadow: inset 0 0 0 1px var(--uncertain); }
.tappable { cursor: pointer; }
.sched-panel { padding: var(--s2) 0 var(--s1); }
.sched-request { border-color: var(--uncertain); }
.sched-change { padding: var(--s2) 0; border-bottom: 1px solid var(--line); }

/* ---------- Chat ---------- */
.chat-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.chat-channels { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: var(--s4); }
.chat-channel {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: var(--s3);
  align-items: center;
  min-height: 64px;
  padding: var(--s3) var(--s4);
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: background-color var(--t);
}
.chat-channel:last-child { border-bottom: 0; }
.chat-channel:active { background: var(--surface-2); }
.chat-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; }
.chat-icon .nav-icon { width: 20px; height: 20px; stroke-width: 1.6; }
.chat-channel-body { display: grid; gap: 2px; min-width: 0; }
.chat-channel-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-preview { color: var(--muted); font-size: var(--fs-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-channel-side { display: grid; justify-items: end; gap: var(--s1); color: var(--muted); }
.chat-time { color: var(--muted); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; }
.chat-head { display: grid; grid-template-columns: var(--tap) minmax(0, 1fr) var(--tap); gap: var(--s2); align-items: center; margin: 0 0 var(--s3); }
.chat-head .ghost { width: var(--tap); height: var(--tap); min-height: 0; padding: 0; border-radius: 50%; display: grid; place-items: center; border-color: var(--line); }
.chat-title { margin: 0; font-size: var(--fs-title); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.chat-list { display: flex; flex-direction: column; gap: var(--s2); padding-bottom: 168px; }
.chat-msg {
  max-width: 84%;
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  border-start-start-radius: 4px;
  padding: var(--s2) var(--s3);
}
.chat-msg.mine { align-self: flex-end; background: var(--surface-2); border-start-start-radius: var(--r); border-start-end-radius: 4px; }
.chat-msg.important { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.chat-author { display: block; font-size: var(--fs-caption); font-weight: 600; color: var(--muted); }
.chat-text { margin: 2px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-meta { display: block; font-size: 0.6875rem; color: var(--muted); text-align: end; font-variant-numeric: tabular-nums; }
.chat-quote { margin: 0 0 var(--s1); padding-inline-start: var(--s2); border-inline-start: 2px solid var(--line-strong); font-size: var(--fs-caption); color: var(--muted); }
.chat-flag { display: inline-block; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.chat-photo { display: block; max-width: 100%; border-radius: var(--r-sm); margin: var(--s1) 0; }
.chat-pin { border-color: var(--line-strong); }
.chat-actions { flex-wrap: wrap; gap: var(--s1); margin-top: var(--s2); }
.chat-actions .ghost { width: auto; min-height: 36px; padding: 0 var(--s3); font-size: var(--fs-caption); }
.chat-msg .primary { min-height: 40px; width: auto; padding: 0 var(--s4); margin-top: var(--s2); font-size: var(--fs-small); }
.chat-composer {
  position: fixed;
  inset-inline: 0;
  bottom: var(--nav);
  z-index: 4;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: var(--s2) var(--s4);
  border-top: 1px solid var(--line);
  gap: var(--s2);
}
.chat-input { width: 100%; resize: none; min-height: 48px; border-radius: var(--r); padding: var(--s3); background: var(--surface); }
.chat-tools { display: flex; gap: var(--s3); align-items: center; }
.chat-tools .ghost { width: var(--tap); height: var(--tap); min-height: 0; padding: 0; flex: none; border-radius: 50%; display: grid; place-items: center; border-color: var(--line); }
.chat-tools label { flex: 1; flex-direction: row; display: flex; gap: var(--s2); align-items: center; justify-content: flex-start; margin: 0; font-size: var(--fs-small); }
.chat-tools > span { flex: 1; }
.chat-tools .primary { flex: none; width: auto; min-height: var(--tap); padding: 0 var(--s5); }
.chat-tools input[type="checkbox"] { width: 20px; height: 20px; margin: 0; flex: none; }

/* ---------- Breaks ---------- */
.break-left { font-size: 3rem; font-weight: 300; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; text-align: center; line-height: 1.1; }
.break-card .primary { min-height: 56px; }

@media (min-width: 900px) {
  .screen { max-width: 520px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
[dir="rtl"] .chat-head a.ghost svg { transform: scaleX(-1); }

/* ---------- Rhythm between blocks (8 px grid) ---------- */
.greeting + .muted { margin: calc(-1 * var(--s4)) 0 var(--s4); font-size: var(--fs-small); }
.chips { margin-bottom: var(--s3); }
.screen > div > .row { padding: var(--s2) 0; }
.screen > div > .row + .row { border-top: 1px solid var(--line); }
.screen > div > .muted { margin-top: var(--s3); font-size: var(--fs-small); }
.screen > div > p.card { font-size: var(--fs-small); }

/* ---------- Today (home) ---------- */
.eyebrow { margin: 0; font-size: var(--fs-caption); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.eyebrow + .greeting { margin-top: var(--s1); }
.hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s5) var(--s4) var(--s4);
  margin-bottom: var(--s4);
  display: grid;
  gap: var(--s2);
}
.hero-label { margin: 0; font-size: var(--fs-caption); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.hero-number { margin: 0; font-size: 4rem; line-height: 1; font-weight: 300; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.hero-number.hero-hours { font-size: 2.75rem; }
.hero-caption { margin: 0 0 var(--s2); color: var(--muted); font-size: var(--fs-small); }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: var(--s2) calc(-1 * var(--s4)) var(--s3);
}
.hero-stats a {
  display: grid;
  gap: 2px;
  padding: var(--s3) var(--s4);
  min-height: var(--tap);
  text-decoration: none;
  color: inherit;
}
.hero-stats a + a { border-inline-start: 1px solid var(--line); }
.hero-stats strong { font-size: var(--fs-title); font-weight: 600; font-variant-numeric: tabular-nums; }
.hero-stats span { font-size: var(--fs-caption); color: var(--muted); line-height: 1.3; }
.hero .primary { margin-top: var(--s1); }
.hero-progress { display: grid; gap: var(--s2); text-decoration: none; color: inherit; font-size: var(--fs-small); padding-top: var(--s3); border-top: 1px solid var(--line); }
.hero-progress .track { margin: 0; display: block; }
.card.receiving { display: grid; gap: var(--s1); border-inline-start: 3px solid var(--accent); }
.card.receiving strong { font-size: var(--fs-title); }
.check-row { flex-direction: row; align-items: center; gap: var(--s2); font-size: var(--fs-small); }
.row.flags { justify-content: flex-start; gap: var(--s4); flex-wrap: wrap; }

/* ---------- Developer credit ---------- */
.credit { text-align: center; color: var(--muted); font-size: var(--fs-caption); letter-spacing: 0.04em; margin: var(--s6) 0 var(--s2); }
