/* ============================================================
   Company as a Game — "retro-modern" design system, Wave 4
   The map IS the app: full-bleed canvas, ONE thin bottom strip,
   everything else lives in floating RCT/OpenTTD windows.
   Warm paper, flat ink-bordered panels, hard offset shadows.
   Type scale (locked):
     · ONE 15px sans-700 headline per window
     · every number: IBM Plex Mono 700 tabular 13px
     · Press Start 2P only for the logo + ≤8px labels
   ============================================================ */

:root {
  --paper: #efe9dc;
  --panel: #fbf8f1;
  --panel-dim: #f3eee1;
  --ink: #1a1a2e;
  --ink-soft: #4c4c60;
  --navy: #232a52;
  --coral: #e85d4c;
  --coral-dark: #c73f2f;
  --coral-tint: #fdeee9;
  --teal: #1d9e75;
  --teal-dark: #157a5a;
  --teal-tint: #e3f3ec;
  --gold: #c9a227;
  --shadow: 3px 3px 0 rgba(26, 26, 46, 0.9);
  --shadow-sm: 2px 2px 0 rgba(26, 26, 46, 0.9);
  --inset: inset 2px 2px 0 rgba(26, 26, 46, 0.1);
  --font-pixel: "Press Start 2P", monospace;
  --font-body: "IBM Plex Sans", "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --pad-window: 8px;
  --row-h: 26px;
  --gap: 8px;
  --gap-tight: 4px;
  --bar-h: 30px;
}

* { box-sizing: border-box; }

/* [hidden] must always win over display rules below */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  background: #171b2c; /* the map backdrop runs edge to edge */
}

/* number utility — the ONLY size numbers come in */
.stat-value, .timer-num, .sheet-value, .spark-tag {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* ---------- App frame: map + window layer + bottom strip ---------- */

#app { position: fixed; inset: 0; }

#stage {
  position: absolute;
  inset: 0 0 var(--bar-h) 0;
}

#cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#window-layer {
  position: absolute;
  inset: 0 0 var(--bar-h) 0;
  pointer-events: none; /* windows re-enable */
  z-index: 20;
}

/* ---------- Bottom strip — DAY · LIVE ticker · CASH · BRAND ---------- */

.bottombar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--bar-h);
  display: flex;
  align-items: stretch;
  background: var(--panel);
  border-top: 2px solid var(--ink);
  z-index: 30;
}

.bar-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: none;
  border-right: 2px solid var(--ink);
  background: var(--panel-dim);
  font-family: var(--font-body);
  color: var(--ink);
  white-space: nowrap;
}

button.bar-chip { cursor: pointer; }
button.bar-chip:hover { background: #fff8e6; }
button.bar-chip:active { box-shadow: var(--inset); }

.bar-chip-label {
  font-family: var(--font-pixel);
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.chip-day { background: var(--teal-tint); }
.chip-cash { background: #fff8e6; }

/* brand chip — full name, NEVER ellipsized (the ticker shrinks instead) */
.chip-brand {
  border-right: none;
  border-left: 2px solid var(--ink);
  background: var(--panel);
  margin-left: -2px;
}

.bar-kicker {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-name {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--ink);
  white-space: nowrap; /* full brand name, no ellipsis */
}
.brand-name.unnamed { color: var(--ink-soft); font-size: 9px; }

/* ---------- Ticker — continuous, boundary-swapped, never jumps ---------- */

.bar-ticker {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  background: var(--panel);
}

.ticker-tag {
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-pixel);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-right: 2px solid var(--ink);
}

.ticker-viewport { flex: 1; min-width: 0; overflow: hidden; display: flex; align-items: center; }

.ticker-track {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
}
.ticker-track.ticker-live {
  animation: marquee var(--ticker-dur, 22s) linear infinite;
}

.ticker-half { display: inline-flex; align-items: center; }

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.ticker-item::after { content: "◆"; font-size: 7px; color: var(--coral); }

.ticker-idle {
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ============================================================
   Floating windows (js/windows.js)
   ============================================================ */

.fwin {
  position: absolute;
  min-width: 240px;
  max-width: 420px;
  max-height: calc(100% - 8px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(26, 26, 46, 0.9);
  pointer-events: auto;
  animation: fwin-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.12);
}
@keyframes fwin-in {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.fwin-bounce { animation: fwin-bounce 0.28s ease; }
@keyframes fwin-bounce {
  0%   { transform: none; }
  35%  { transform: translateY(-7px) scale(1.02); }
  70%  { transform: translateY(2px); }
  100% { transform: none; }
}

.fwin-dragging { opacity: 0.92; }
.fwin-dragging .fwin-titlebar { cursor: grabbing; }

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--w-accent, var(--navy));
  color: #ffffff;
  padding: 4px 6px 4px 8px;
  border-bottom: 2px solid var(--ink);
  flex: none;
}
.fwin-titlebar { cursor: grab; user-select: none; touch-action: none; }

.titlebar-text {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-pixel);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.fwin-title-text { overflow: hidden; text-overflow: ellipsis; }

.fwin-icon { flex: none; font-size: 12px; line-height: 1; font-family: var(--font-body); }
.fwin-icon-sam, .fwin-icon-avatar { display: inline-flex; }
.fwin-icon-sam svg, .fwin-icon-avatar svg { width: 16px; height: 18px; display: block; image-rendering: pixelated; }

.fwin-btns { flex: none; display: inline-flex; gap: 4px; }

.fwin-btn {
  width: 18px;
  height: 18px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 2px solid var(--ink);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
}
.fwin-btn:hover { background: var(--gold); }
.fwin-btn-close:hover { background: var(--coral); color: #fff; }

/* tabs (Sam: Chat/Docs/Todos · entities: Preview/Stats/…) */
.fwin-tabs {
  display: flex;
  flex: none;
  border-bottom: 2px solid var(--ink);
  background: var(--panel-dim);
}
.fwin-tab {
  flex: 1;
  font-family: var(--font-pixel);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 7px 6px;
  cursor: pointer;
  background: transparent;
  border: none;
  border-right: 2px solid var(--ink);
  color: var(--ink-soft);
}
.fwin-tab:last-child { border-right: none; }
.fwin-tab.active { background: var(--w-accent, var(--navy)); color: #fff; }

.fwin-body {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
.fwin-body > * { flex: none; }
.fwin-body > .sam-chat { flex: 1 1 auto; }

/* minimize → collapse to the titlebar */
.fwin-minimized .fwin-body,
.fwin-minimized .fwin-tabs { display: none; }
.fwin-minimized { min-width: 200px; }

/* generic padded pane inside a window body */
.wpad { padding: var(--pad-window); }

.section-label {
  font-family: var(--font-pixel);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 12px 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label:first-child { margin-top: 2px; }
.section-label::after {
  content: "";
  flex: 1;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--ink-soft) 0 4px, transparent 4px 8px);
  opacity: 0.4;
}

.dept-empty { font-size: 12px; color: var(--ink-soft); font-style: italic; margin: 2px 0; }

/* ============================================================
   Sam window — chat tab (stream + docked decision popup)
   ============================================================ */

.sam-chat {
  position: relative; /* anchors the docked decision popup */
  display: flex;
  flex-direction: column;
  height: min(56vh, 430px);
  min-height: 220px;
}

.chat-stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--pad-window);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg { animation: msg-in 0.18s ease-out; max-width: 100%; flex: none; }
@keyframes msg-in {
  from { transform: translateY(4px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.msg-sam { display: flex; gap: 6px; align-items: flex-start; }

.msg-avatar {
  flex: none;
  width: 24px;
  height: 26px;
  border: 2px solid var(--ink);
  background: var(--teal-tint);
  overflow: hidden;
  margin-top: 2px;
}
.msg-avatar svg { width: 100%; height: 100%; display: block; }

.msg-bubble {
  background: #ffffff;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 5px 8px;
  min-width: 0;
}

.msg-text {
  margin: 0;
  display: inline;
  font-size: 13px;
  line-height: 1.4;
}

.msg-caret {
  display: inline-block;
  width: 7px;
  height: 12px;
  background: var(--teal);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: caret-blink 0.9s steps(1) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }

/* company-log entries as muted one-line system messages */
.msg-system {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 0 2px;
  overflow-wrap: break-word;
}

/* resolution chip: who decided + what */
.msg-resolution {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--ink);
  background: var(--panel-dim);
  box-shadow: var(--shadow-sm);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  min-width: 0;
}

.resolution-by {
  flex: none;
  font-family: var(--font-pixel);
  font-size: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 5px;
  border: 2px solid var(--ink);
  color: #fff;
}
.resolution-by.by-sam { background: var(--teal); }
.resolution-by.by-you { background: var(--coral); }

.resolution-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Decision popup — docked over the chat ---------- */

.decision-popup {
  position: absolute;
  left: var(--pad-window);
  right: var(--pad-window);
  bottom: var(--pad-window);
  z-index: 6;
  background: var(--panel);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(26, 26, 46, 0.9);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--pad-window);
  max-height: 88%;
  animation: popup-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.decision-popup.closing {
  animation: popup-out 0.2s ease-in forwards;
  pointer-events: none;
}
@keyframes popup-in {
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@keyframes popup-out {
  to { transform: translateY(26px); opacity: 0; }
}

.popup-kicker {
  font-family: var(--font-pixel);
  font-size: 7px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--coral-dark);
}

/* the window's ONE 15px headline */
.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.card-options {
  display: flex;
  flex-direction: column;
  gap: var(--gap-tight);
  overflow-y: auto;
  min-height: 0;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: var(--row-h);
  text-align: left;
  background: #ffffff;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 4px 8px;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--ink);
  transition: transform 60ms ease, box-shadow 60ms ease, background 60ms ease;
}

.option-btn:hover { background: var(--coral-tint); }
.option-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(26, 26, 46, 0.9); }

.option-btn.selected {
  background: var(--coral-tint);
  border-color: var(--coral-dark);
  box-shadow: 2px 2px 0 var(--coral-dark);
}

.option-marker {
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: transparent;
}
.option-btn.selected .option-marker { background: var(--coral); color: #fff; }

.option-main { flex: 1; min-width: 0; }

.option-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.option-sub {
  display: block;
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 1px;
}

.sam-pick-badge {
  flex: none;
  font-family: var(--font-pixel);
  font-size: 6px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ffffff;
  background: var(--teal);
  border: 2px solid var(--ink);
  padding: 2px 4px;
  white-space: nowrap;
}

/* free-text slot — visible while the selected option carries .input */
.popup-input {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.popup-input-label {
  font-family: var(--font-pixel);
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal-dark);
}
.popup-textarea {
  width: 100%;
  resize: none;
  border: 2px solid var(--ink);
  box-shadow: var(--inset);
  background: #ffffff;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink);
  padding: 5px 8px;
}
.popup-textarea:focus { outline: 3px solid var(--teal); outline-offset: 1px; }

/* popup footer: timer + lock-in on one row */

.popup-footer { display: flex; align-items: center; gap: var(--gap); }

.timer-row { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }

.timer-track {
  flex: 1;
  height: 12px;
  border: 2px solid var(--ink);
  background: #ffffff;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: var(--coral);
  transition: width 100ms linear;
}

.timer-num { flex: none; min-width: 32px; text-align: right; }

.timer-row.urgent .timer-bar { background: var(--coral-dark); animation: urgent-pulse 0.5s steps(2) infinite; }
.timer-row.urgent .timer-num { color: var(--coral-dark); animation: urgent-pulse 0.5s steps(2) infinite; }

@keyframes urgent-pulse { 50% { opacity: 0.45; } }

.btn-lockin {
  flex: none;
  padding: 7px 14px;
  background: var(--coral);
  color: #ffffff;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 60ms ease, box-shadow 60ms ease;
}
.btn-lockin:hover { background: var(--coral-dark); }
.btn-lockin:active { transform: translate(2px, 2px); box-shadow: 0 0 0 rgba(0, 0, 0, 0); }

/* ---------- Sam window — Todos tab ---------- */

.sam-now {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: var(--row-h);
  border: 2px solid var(--teal-dark);
  background: var(--teal-tint);
  box-shadow: 2px 2px 0 var(--teal-dark);
  padding: 3px 8px;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  min-width: 0;
}
.sam-now:hover { background: #d2ece1; }

.sam-now-chip {
  flex: none;
  font-family: var(--font-pixel);
  font-size: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--teal);
  border: 2px solid var(--ink);
  padding: 2px 4px;
}

.sam-now-task {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sam-now-arrow { flex: none; font-size: 11px; }

.sam-ongoing { display: flex; flex-direction: column; }

.sam-ongoing-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 0;
  border-bottom: 1px dotted rgba(26, 26, 46, 0.12);
  min-width: 0;
}
.sam-ongoing-row:last-child { border-bottom: none; }

.sam-ongoing-mark { flex: none; color: var(--teal-dark); font-weight: 700; font-size: 11px; }

.sam-ongoing-text {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* cadence chip — HOW OFTEN Sam does each ongoing duty */
.cadence-chip {
  flex: none;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--teal-dark);
  background: var(--teal-tint);
  border: 1.5px solid var(--teal-dark);
  padding: 0 5px;
  border-radius: 8px;
  white-space: nowrap;
}

.sam-todo-list li { white-space: normal; }

/* ============================================================
   Shared dense components (stat sheet, team, work, docs, log)
   ============================================================ */

.stat-sheet {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 16px;
  border: 2px solid var(--ink);
  background: var(--panel-dim);
  box-shadow: var(--inset);
  padding: 5px 10px;
}

.sheet-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-height: 22px;
  min-width: 0;
}

.sheet-label {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.sheet-dots {
  flex: 1;
  min-width: 8px;
  border-bottom: 2px dotted rgba(26, 26, 46, 0.3);
  transform: translateY(-3px);
}

.sheet-value {
  flex: none;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}

/* ---------- Team — compact rows, real work, ALL clickable ---------- */

.dept-team { display: flex; flex-direction: column; gap: 2px; }

.team-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--row-h);
  border: 2px solid var(--ink);
  background: #ffffff;
  box-shadow: 2px 2px 0 rgba(26, 26, 46, 0.16);
  padding: 2px 8px 2px 3px;
  min-width: 0;
}

.team-clickable { cursor: pointer; }
.team-clickable:hover { background: var(--coral-tint); }
.team-clickable:focus-visible { outline: 3px solid var(--coral); outline-offset: 1px; }
.team-row.team-sam.team-clickable:hover { background: #d2ece1; }

.team-avatar {
  flex: none;
  width: 20px;
  height: 22px;
  border: 2px solid var(--ink);
  background: var(--panel-dim);
  overflow: hidden;
}
.team-avatar svg { width: 100%; height: 100%; display: block; }

.team-id {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex: none;
  max-width: 55%;
}
.team-name { font-weight: 700; font-size: 13px; white-space: nowrap; }
.team-role {
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-task {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--teal-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  text-align: right;
}
.team-task::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--teal);
  border: 1px solid var(--ink);
  margin-right: 5px;
  vertical-align: 1px;
}
.team-task.task-busy { color: var(--coral-dark); }
.team-task.task-busy::before { background: var(--coral); }

/* Sam's hero row in HQ — slightly larger */
.team-row.team-sam {
  min-height: 34px;
  background: var(--teal-tint);
  border-color: var(--teal-dark);
  box-shadow: 2px 2px 0 var(--teal-dark);
}
.team-row.team-sam .team-avatar { width: 28px; height: 30px; background: #fff; }
.team-row.team-sam .team-name { font-size: 14px; }

/* ---------- Work — To-do / Ongoing / Projects / Initiatives ---------- */

.dept-work { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.work-group { min-width: 0; }
.work-group-title {
  font-family: var(--font-pixel);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--w-accent, var(--navy));
  margin: 0 0 4px;
}
.work-list { list-style: none; margin: 0; padding: 0; }
.work-list li {
  position: relative;
  font-size: 12px;
  line-height: 18px;
  color: var(--ink);
  padding: 3px 0 3px 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px dotted rgba(26, 26, 46, 0.12);
}
.work-list li:last-child { border-bottom: none; }
.work-list li::before {
  position: absolute;
  left: 0;
  top: 3px;
  font-size: 11px;
}
.work-check li::before { content: "☐"; color: var(--w-accent, var(--ink-soft)); }
.work-loop  li::before { content: "↻"; color: var(--teal-dark); font-weight: 700; }
.work-arrow li::before { content: "▸"; color: var(--ink-soft); }
.work-star  li::before { content: "◆"; color: var(--ink-soft); font-size: 9px; top: 5px; }

/* ---------- Documents — unified list ---------- */

.dept-docs { display: flex; flex-direction: column; gap: 3px; }

.doc-tiles { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }

.doc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--row-h);
  border: 2px solid var(--ink);
  background: #ffffff;
  box-shadow: 2px 2px 0 rgba(26, 26, 46, 0.16);
  padding: 2px 8px;
  font-size: 12.5px;
  cursor: pointer;
  min-width: 0;
}
.doc-row:hover { background: var(--coral-tint); }
.doc-row:focus-visible { outline: 3px solid var(--coral); outline-offset: 1px; }

.doc-icon { flex: none; width: 18px; text-align: center; font-size: 12px; }
.doc-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-day {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
}
.doc-caret { flex: none; font-size: 10px; color: var(--ink-soft); transition: transform 0.12s ease; }
.doc-row.open .doc-caret { transform: rotate(180deg); }
.doc-row.open { background: var(--panel-dim); }

/* static maintained files — muted, not clickable */
.doc-row.doc-static {
  cursor: default;
  background: var(--panel-dim);
  box-shadow: none;
  border-color: rgba(26, 26, 46, 0.45);
}
.doc-row.doc-static .doc-title { font-weight: 500; color: var(--ink-soft); }

.doc-expand {
  border: 2px dashed rgba(26, 26, 46, 0.35);
  background: var(--panel-dim);
  padding: var(--pad-window);
  display: flex;
  justify-content: center;
}

/* rich tiles keep the caption + Open affordance */
.artifact { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.artifact-caption {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
}

.artifact-clickable { cursor: pointer; position: relative; }
.artifact-clickable::after {
  content: "Open ›";
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--w-accent, var(--navy));
  border: 2px solid var(--ink);
  padding: 1px 6px;
  box-shadow: 2px 2px 0 rgba(26, 26, 46, 0.2);
}
.artifact-clickable:hover, .artifact-clickable:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}

/* ---------- Dept log ---------- */

.dept-log {
  max-height: 130px;
  overflow-y: auto;
  border: 2px solid var(--ink);
  background: #ffffff;
  box-shadow: var(--inset);
  padding: 4px 8px;
}

.log-row {
  display: flex;
  gap: 8px;
  padding: 3px 2px;
  font-size: 12px;
  border-bottom: 1px dashed rgba(26, 26, 46, 0.15);
}
.log-row:last-child { border-bottom: none; }

.log-day {
  flex: none;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  color: var(--teal-dark);
  white-space: nowrap;
  padding-top: 1px;
}

.log-text { flex: 1; min-width: 0; }

/* ============================================================
   Person window — pixel avatar, live task, rotation, log
   ============================================================ */

.person-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}

.person-avatar {
  flex: none;
  width: 30px;
  height: 33px;
  border: 2px solid var(--ink);
  background: var(--panel-dim);
  overflow: hidden;
}
.person-avatar svg { width: 100%; height: 100%; display: block; }

.person-id { min-width: 0; display: flex; flex-direction: column; }
.person-name { font-size: 15px; font-weight: 700; line-height: 1.15; } /* the window's headline */
.person-role { font-size: 11px; color: var(--ink-soft); }

.person-dept {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 24px;
  border: 2px solid var(--ink);
  background: var(--panel-dim);
  box-shadow: 2px 2px 0 rgba(26, 26, 46, 0.16);
  padding: 2px 8px;
  margin-bottom: 4px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  min-width: 0;
}
.person-dept:hover { background: var(--coral-tint); }
.person-dept-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-dept-arrow { flex: none; color: var(--ink-soft); font-weight: 700; }

.person-now {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--row-h);
  border: 2px solid var(--teal-dark);
  background: var(--teal-tint);
  box-shadow: 2px 2px 0 var(--teal-dark);
  padding: 3px 8px;
  min-width: 0;
}
.person-now-task {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--teal-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* busy accent while a reactive task pins them (taskHold > 0) */
.person-now.busy { border-color: var(--coral-dark); background: var(--coral-tint); box-shadow: 2px 2px 0 var(--coral-dark); }
.person-now.busy .person-now-task { color: var(--coral-dark); }
.person-now.busy .sam-now-chip { background: var(--coral); }

.person-log { max-height: 110px; }

/* ============================================================
   Company window — the OpenTTD stats popup
   ============================================================ */

.company-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}

.company-brand {
  font-family: var(--font-pixel);
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.company-brand.unnamed { color: var(--ink-soft); font-size: 9px; }

.company-day { flex: none; color: var(--teal-dark); }

.company-sheet { grid-template-columns: 1fr; margin-bottom: var(--gap); }

.company-sparks { display: flex; flex-direction: column; gap: var(--gap-tight); }
.company-sparks .spark-chart { height: 44px; }

.company-depts { display: flex; flex-direction: column; gap: 2px; }

.company-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 7px;
  min-height: var(--row-h);
  border: 2px solid var(--ink);
  background: #ffffff;
  box-shadow: 2px 2px 0 rgba(26, 26, 46, 0.16);
  padding: 2px 8px 2px 6px;
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  min-width: 0;
}
.company-row:hover { background: var(--coral-tint); }
.company-row:focus-visible { outline: 3px solid var(--coral); outline-offset: 1px; }

.company-row-icon { font-size: 12px; text-align: center; }
.company-row-name {
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-left: 3px solid var(--w-accent, var(--navy));
  padding-left: 6px;
}
.company-row-head, .company-row-cost, .company-row-day {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.company-row-head { color: var(--ink); }
.company-row-cost { color: var(--ink-soft); }
.company-row-day { color: var(--teal-dark); }

.company-foot:not(:empty) {
  margin-top: var(--gap);
  border: 2px solid var(--ink);
  background: #fff8e6;
  box-shadow: var(--shadow-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.done-head { display: flex; align-items: center; gap: 8px; }
.done-trophy { font-size: 20px; line-height: 1; }
.done-brand { font-family: var(--font-pixel); font-size: 10px; }
.done-teaser { font-size: 11.5px; color: var(--ink-soft); font-style: italic; margin: 0; }
.done-restart { width: 100%; }

/* ============================================================
   Artifact mockups (Documents + entity windows)
   ============================================================ */

/* ---------- website — storefront ---------- */

.art-browser {
  width: 100%;
  max-width: 330px;
  border: 2px solid var(--ink);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}
.art-browser.art-full { max-width: 420px; margin: 0 auto; }

.art-browser-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--panel-dim);
  border-bottom: 2px solid var(--ink);
  padding: 4px 7px;
}
.art-browser-dot { width: 7px; height: 7px; border: 1px solid var(--ink); background: #fff; }
.art-browser-dot:nth-child(1) { background: var(--coral); }
.art-browser-dot:nth-child(2) { background: var(--gold); }
.art-browser-dot:nth-child(3) { background: var(--teal); }
.art-browser-url {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 10px;
  background: #fff;
  border: 1px solid var(--ink);
  padding: 1px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border-bottom: 1.5px solid var(--ink);
}
.site-logo { font-family: var(--font-pixel); font-size: 8px; letter-spacing: 0.04em; }
.site-links { display: flex; gap: 9px; margin-left: auto; font-size: 9.5px; font-weight: 600; color: var(--ink-soft); }
.site-cart { font-size: 11px; line-height: 1; }

.site-hero {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 8px;
  padding: 9px 9px 7px;
  align-items: center;
}
.site-hero-copy { min-width: 0; }
.site-h { margin: 0 0 3px; font-size: 14px; font-weight: 800; line-height: 1.15; }
.site-sub { margin: 0 0 7px; font-size: 10px; line-height: 1.35; color: var(--ink-soft); }
.site-cta {
  display: inline-block;
  background: var(--coral);
  color: #fff;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 rgba(26, 26, 46, 0.85);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
}
.site-art {
  height: 66px;
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.site-products {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 0 9px 8px;
}
.site-product {
  border: 1.5px solid var(--ink);
  background: #fff;
  padding: 4px 4px 5px;
  text-align: center;
  min-width: 0;
}
.site-tee svg { width: 78%; height: auto; display: block; margin: 0 auto 2px; }
.site-pname {
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-pby {
  font-size: 8px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-pprice { font-family: var(--font-mono); font-weight: 700; font-size: 11px; color: var(--teal-dark); }
.site-add {
  display: inline-block;
  margin-top: 3px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1.5px solid var(--ink);
  background: var(--panel-dim);
  padding: 1px 5px;
  white-space: nowrap;
}

.site-footer {
  border-top: 2px solid var(--ink);
  background: var(--navy);
  color: #fff;
  font-size: 9px;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  text-align: center;
}

/* ---------- instagram — phone frame ---------- */

.art-phone {
  width: 236px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.art-phone.art-full { width: 264px; margin: 0 auto; }

.art-phone-notch { height: 11px; display: flex; justify-content: center; align-items: center; }
.art-phone-notch::after { content: ""; width: 46px; height: 5px; background: var(--ink); border-radius: 3px; }

.ig-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 6px;
  min-width: 0;
}
.ig-avatar {
  flex: none;
  width: 34px;
  height: 36px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: var(--panel-dim);
  overflow: hidden;
}
.ig-avatar svg { width: 100%; height: 100%; display: block; }
.ig-idcol { flex: 1; min-width: 0; }
.ig-handle {
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ig-counts { display: flex; gap: 10px; margin-top: 2px; }
.ig-count { display: flex; flex-direction: column; line-height: 1.15; }
.ig-count b {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.ig-count span { font-size: 8px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.02em; }
.ig-follow {
  flex: none;
  background: var(--coral);
  color: #fff;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 rgba(26, 26, 46, 0.85);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  cursor: pointer;
}
.ig-follow:active { transform: translate(1px, 1px); box-shadow: none; }

.ig-stories {
  display: flex;
  gap: 8px;
  padding: 2px 10px 7px;
  border-bottom: 2px solid var(--ink);
}
.ig-story {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
}

.ig-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
}
.ig-tile {
  aspect-ratio: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}
.ig-likes {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 0 rgba(26, 26, 46, 0.7);
}

/* ---------- paper artifacts: doc / contract / certificate ---------- */

.art-paper {
  position: relative;
  width: 250px;
  max-width: 100%;
  min-height: 100px;
  background: #ffffff;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 10px 12px;
}
.art-paper::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 0;
  height: 0;
  border-left: 16px solid var(--panel-dim);
  border-top: 16px solid var(--paper);
  filter: drop-shadow(-1px 1px 0 var(--ink));
}
.art-paper-title { font-weight: 700; font-size: 12.5px; margin: 0 0 7px; padding-right: 14px; }
.art-paper-body { font-size: 11px; color: var(--ink-soft); margin: 0 0 7px; }
.art-paper-fact {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-soft);
  margin: 3px 0;
  overflow-wrap: break-word;
}
.art-paper-line { height: 5px; background: rgba(26, 26, 46, 0.12); margin: 6px 0; }
.art-paper-line.short { width: 60%; }
.art-paper-sign {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-soft);
  border-top: 1px solid var(--ink);
  margin-top: 10px;
  padding-top: 4px;
}
.art-paper-seal {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

/* ---------- domain artifact — tag chip ---------- */

.art-domain {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--ink);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
}
.art-domain::before { content: "🔗"; font-size: 12px; }
.art-domain-tld { color: var(--coral-dark); }

/* ---------- tickets artifact — inbox rows ---------- */

.art-tickets {
  width: 280px;
  max-width: 100%;
  border: 2px solid var(--ink);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}
.art-ticket-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--row-h);
  padding: 2px 9px;
  border-bottom: 1px solid rgba(26, 26, 46, 0.15);
  font-size: 12px;
}
.art-ticket-row:last-child { border-bottom: none; }
.art-ticket-dot { flex: none; width: 8px; height: 8px; border: 1px solid var(--ink); }
.art-ticket-dot.open { background: var(--coral); }
.art-ticket-dot.done { background: var(--teal); }
.art-ticket-from { flex: none; font-weight: 700; max-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art-ticket-subject { flex: 1; min-width: 0; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- project artifact — derived checklist ---------- */

.art-project {
  width: 280px;
  max-width: 100%;
  border: 2px solid var(--ink);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  padding: 7px 9px 8px;
}

.art-project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 5px;
  margin-bottom: 4px;
  min-width: 0;
}
.art-project-title {
  font-weight: 700;
  font-size: 12.5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.art-project-tag {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--teal-dark);
  background: var(--teal-tint);
  border: 1.5px solid var(--teal-dark);
  padding: 0 6px;
}

.art-project-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  border-bottom: 1px dotted rgba(26, 26, 46, 0.15);
  font-size: 12px;
  min-width: 0;
}
.art-project-step:last-child { border-bottom: none; }

.art-project-check {
  flex: none;
  width: 13px;
  height: 13px;
  border: 2px solid var(--ink);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}
.art-project-step.done .art-project-check { background: var(--teal); }
.art-project-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-project-step.done .art-project-label { color: var(--ink-soft); text-decoration: line-through; text-decoration-thickness: 1px; }

/* ---------- Entity window content (stats / actions / DMs) ---------- */

.entity-statsheet { display: flex; flex-direction: column; gap: var(--gap); }
.entity-statsheet .stat-sheet { grid-template-columns: 1fr 1fr; }

.spark-well {
  border: 2px solid var(--ink);
  background: #ffffff;
  box-shadow: var(--inset);
  padding: 6px 8px 8px;
}
.spark-label {
  display: block;
  font-family: var(--font-pixel);
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.spark-chart { position: relative; height: 64px; }
.spark-chart svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.spark-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border: 2px solid var(--ink);
  transform: translate(-50%, -50%);
}
.spark-tag {
  position: absolute;
  right: 2px;
  transform: translateY(-130%);
  background: var(--panel);
  border: 1.5px solid var(--ink);
  padding: 0 4px;
  color: var(--ink);
}
.spark-empty {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  font-style: italic;
}

.entity-actions { display: flex; flex-direction: column; gap: 6px; }
.entity-action-note { margin: 0 0 2px; font-size: 12px; color: var(--ink-soft); }
.entity-action-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  min-height: var(--row-h);
  padding: 4px 10px;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(26, 26, 46, 0.18);
}
.entity-action-btn:hover:not(:disabled) { background: var(--w-accent, var(--navy)); color: #fff; }
.entity-action-btn:hover:not(:disabled) .entity-action-cost { color: #fff; }
.entity-action-cost { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--teal-dark); }
.entity-action-btn.queued { opacity: 0.65; box-shadow: none; }
.entity-action-result { font-size: 11.5px; color: var(--teal-dark); padding: 1px 2px 4px; }

.entity-dms { display: flex; flex-direction: column; gap: 5px; }
.entity-dm { border: 2px solid var(--ink); padding: 5px 8px; background: var(--panel-dim); }
.entity-dm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.entity-dm-from { font-weight: 700; font-size: 12px; }
.entity-dm-tag {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 6px;
  border: 1.5px solid var(--ink);
  border-radius: 9px;
}
.entity-dm-tag-artist { background: var(--teal-tint); color: var(--teal-dark); }
.entity-dm-tag-customer { background: var(--coral-tint); color: var(--coral-dark); }
.entity-dm-text { font-size: 12px; color: var(--ink); line-height: 1.35; }

/* ---------- Scanline overlay (ultra subtle) ---------- */

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    to bottom,
    rgba(26, 26, 46, 0.022) 0px,
    rgba(26, 26, 46, 0.022) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* ---------- Scrollbars (webkit) ---------- */

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--panel-dim); border-left: 2px solid var(--ink); }
::-webkit-scrollbar-thumb { background: var(--ink); border: 2px solid var(--panel-dim); }

/* ============================================================
   PHONE (≤640px) — windows become content-sized bottom sheets,
   one at a time; the thin bar stays; zero horizontal overflow.
   ============================================================ */

@media (max-width: 640px) {
  :root { --bar-h: 40px; }

  html, body { overflow: hidden; }
  #app { height: 100dvh; }

  .bar-chip { padding: 0 8px; }
  .bar-kicker { display: none; } /* brand name survives, kicker doesn't */
  .brand-name { font-size: 10px; }
  .ticker-tag { padding: 0 7px; }

  /* windows → bottom sheets: full-width, sized to content (max 85vh) */
  .fwin-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--bar-h);
    top: auto;
    width: auto !important;
    min-width: 0;
    max-width: none;
    max-height: 85vh;
    border-left: none;
    border-right: none;
    box-shadow: 0 -4px 0 rgba(26, 26, 46, 0.28);
    animation: sheet-in 0.22s ease-out;
  }
  .fwin-sheet.fwin-bounce { animation: sheet-in 0.22s ease-out; }

  .fwin-sheet .fwin-titlebar { padding: 8px; }
  .fwin-sheet .fwin-btn { width: 32px; height: 32px; font-size: 14px; }
  .fwin-sheet .fwin-tab { min-height: 44px; }
  .fwin-sheet .fwin-body { max-height: calc(85vh - 80px); }

  .fwin-sheet .sam-chat { height: min(52vh, 420px); }

  .option-btn { min-height: 44px; }
  .btn-lockin { min-height: 44px; }
  .sam-now { min-height: 44px; }
  .person-dept { min-height: 44px; }
  .company-row { min-height: 40px; }
  .doc-row { min-height: 40px; }
  .team-row { min-height: 40px; }
  .fwin-tab { min-height: 44px; }

  .dept-work { grid-template-columns: 1fr; }
  .stat-sheet { grid-template-columns: 1fr; }
  .entity-statsheet .stat-sheet { grid-template-columns: 1fr; }
  .doc-tiles { gap: 8px; }
  .art-browser { max-width: 100%; }
}

@keyframes sheet-in {
  from { transform: translateY(100%); }
  to   { transform: none; }
}
