/* ISEA360 Neuro Office. Every value comes from build/tokens.css (compiled from /tokens).
   Two views of the same office: an isometric 3D scene (SVG) and a flat plan with the illustrated desks. */

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light dark; background: var(--color-surface-app); }
body {
  margin: 0; color: var(--color-text-primary);
  font-family: var(--typography-body-family); font-size: var(--typography-body-size); line-height: var(--typography-body-lh);
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 0;
}
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
time, .num { font-variant-numeric: tabular-nums; font-size: var(--typography-small-size); color: var(--color-text-tertiary); }
:focus-visible { outline: var(--border-width-line) solid var(--color-focus); outline-offset: var(--space-1); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--space-3); top: calc(-1 * var(--size-target)); padding: var(--space-2) var(--space-4); border-radius: var(--radius-control); background: var(--color-ink); color: var(--color-text-on-ink); z-index: 2; }
.skip:focus { top: var(--space-2); }

/* Controls: filled dark primary, light tonal secondary, rounded ------------------------------------ */
button, input, select, textarea { font: inherit; color: inherit; }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--size-control); padding: 0 var(--space-5);
  border: 0; border-radius: var(--radius-control);
  background: var(--color-surface-sunken); color: var(--color-text-primary);
  font-size: var(--typography-small-size); font-weight: var(--font-weight-semibold);
  cursor: pointer; touch-action: manipulation;
  transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);
}
button:hover:not(:disabled) { background: var(--color-surface-hover); }
button:active:not(:disabled) { transform: scale(.97); }
button[aria-pressed="true"] { background: var(--color-ink); color: var(--color-text-on-ink); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary, button.ink { background: var(--color-ink); color: var(--color-text-on-ink); box-shadow: var(--shadow-control); }
button.primary:hover:not(:disabled), button.ink:hover:not(:disabled) { background: var(--color-text-secondary); }
button.accent { background: var(--button-primary-bg); color: var(--button-primary-fg); box-shadow: var(--shadow-control); }
button.accent:hover:not(:disabled) { background: var(--button-primary-bg-hover); }
button.tonal { background: var(--color-surface-sheet); box-shadow: var(--shadow-control); }
button.quiet { background: transparent; min-height: var(--space-8); padding: 0 var(--space-3); font-weight: var(--font-weight-medium); color: var(--color-text-secondary); }
button.quiet:hover:not(:disabled) { background: var(--color-surface-sunken); color: var(--color-text-primary); }
button.danger { background: var(--color-status-review-surface); color: var(--color-status-review-text); }
button.danger:hover:not(:disabled) { background: var(--color-status-review-surface); box-shadow: inset 0 0 0 1px var(--color-status-review-fill); }
button.link { background: transparent; padding: 0; min-height: 0; justify-content: flex-start; font-weight: var(--font-weight-semibold); color: var(--color-text-primary); }
button.link:hover:not(:disabled) { background: transparent; color: var(--color-action-primary); }
@media (pointer: coarse) { button, button.quiet { min-height: var(--size-target); } }

input, select, textarea {
  width: 100%; min-height: var(--size-control); padding: 0 var(--space-4);
  border: var(--border-width-hair) solid var(--color-border-subtle); border-radius: var(--radius-control);
  background: var(--input-bg); color: var(--color-text-primary);
  transition: border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}
input:hover, select:hover, textarea:hover { border-color: var(--color-border-strong); }
textarea { padding: var(--space-3) var(--space-4); resize: vertical; line-height: var(--typography-small-lh); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 0; border-color: var(--color-ink); box-shadow: 0 0 0 3px var(--color-scene-selected); }
input[type="color"] { padding: var(--space-1); }
input::placeholder, textarea::placeholder { color: var(--color-text-tertiary); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--color-ink); }

/* Frame ------------------------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); flex-wrap: wrap;
  padding: var(--space-3) var(--space-7); background: var(--color-surface-app);
  border-bottom: var(--border-width-hair) solid var(--color-border-subtle); font-size: var(--typography-small-size);
}
.product { font-size: var(--typography-body-size); font-weight: var(--font-weight-medium); }
.product { display: inline-flex; align-items: center; gap: var(--space-2); }
.product b { font-weight: var(--font-weight-bold); }
.brand-mark { width: 28px; height: 28px; flex: none; border-radius: 8px; background: var(--color-ink); }
.brand-mark path { fill: none; stroke: var(--color-scene-brass); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.reset { margin-left: var(--space-3); }
.demo-note { color: var(--color-text-secondary); }
.demo-tag { margin-right: var(--space-2); padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); background: var(--color-status-review-surface); color: var(--color-status-review-text); font-weight: var(--font-weight-semibold); }

.workspace {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--size-inspector);
  grid-template-areas: "plan inspector"; align-items: start;
  gap: var(--space-7); padding: var(--space-7) var(--space-7) var(--space-9); max-width: 1680px; margin: 0 auto;
}
.plan-area { grid-area: plan; min-width: 0; }
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
h1 { font-size: 2rem; font-weight: var(--font-weight-bold); line-height: 1.1; letter-spacing: -0.02em; }
.summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin-top: var(--space-2); font-size: var(--typography-small-size); color: var(--color-text-secondary); }
.summary span + span::before { content: "·"; margin-right: var(--space-4); color: var(--color-text-tertiary); }
.chip-alert { min-height: var(--space-8); padding: 0 var(--space-3); border-radius: var(--radius-pill); background: var(--color-status-review-surface); color: var(--color-status-review-text); }
.chip-alert::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--color-status-review-fill); }
.chip-alert:hover:not(:disabled) { background: var(--color-status-review-surface); box-shadow: inset 0 0 0 1px var(--color-status-review-fill); }
.tools { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.switch { display: inline-flex; padding: 3px; border-radius: var(--radius-control); background: var(--color-surface-sunken); }
.switch button { min-height: 34px; padding: 0 var(--space-4); background: transparent; border-radius: 8px; color: var(--color-text-secondary); }
.switch button[aria-pressed="true"] { background: var(--color-surface-sheet); color: var(--color-text-primary); box-shadow: var(--shadow-control); }
.help { margin: var(--space-4) 0 var(--space-4); font-size: var(--typography-small-size); color: var(--color-text-secondary); max-width: 80ch; }

.sheet { position: relative; padding: var(--space-6); background: var(--color-surface-sheet); border-radius: var(--radius-card); box-shadow: var(--shadow-sheet); }
.zoom { position: absolute; top: var(--space-4); right: var(--space-4); z-index: 1; display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-control); background: var(--color-surface-sheet); box-shadow: var(--shadow-sheet); }
.zoom[hidden] { display: none; }
.zoom button { min-height: 32px; min-width: 36px; padding: 0 var(--space-3); background: transparent; border-radius: 8px; }
.zoom button:hover:not(:disabled) { background: var(--color-surface-sunken); }
.noscript { padding: var(--space-5); color: var(--color-text-secondary); }

/* 3D scene ---------------------------------------------------------------------------------------- */
.floor.is-3d {
  display: block; overflow: auto; max-height: 78vh; overscroll-behavior: contain; border-radius: var(--radius-control);
  /* a calm studio backdrop: soft light from above, no pattern */
  background: radial-gradient(120% 90% at 50% 0%, var(--color-scene-backdrop-glow), var(--color-scene-backdrop) 70%);
}
.scene { display: block; max-width: none; height: auto; margin: 0 auto; overflow: visible; user-select: none; }
.scene .concrete { fill: var(--color-scene-concrete); }
.scene .concrete-line { stroke: var(--color-scene-concrete-line); stroke-width: 1; }
.scene .building-edge.front { fill: var(--color-scene-building-edge); }
.scene .building-edge.side { fill: var(--color-scene-building-edge-side); }
.scene .outer-wall { fill: var(--color-scene-mullion); }
.scene .outer-wall.left { fill: color-mix(in oklch, var(--color-scene-mullion) 85%, black); }
.scene .outer-end { fill: color-mix(in oklch, var(--color-scene-mullion) 70%, black); }
.scene .outer-cap { fill: color-mix(in oklch, var(--color-scene-mullion) 80%, white); }
.scene .mullion-base { fill: color-mix(in oklch, var(--color-scene-mullion) 70%, black); }
.scene .glass { fill: var(--color-scene-glass); }
.scene .glass.left { fill: color-mix(in oklch, var(--color-scene-glass) 88%, var(--color-scene-glass-deep)); }
.scene .harbour { fill: var(--color-scene-harbour); opacity: .55; }
.scene .skyline path { fill: none; stroke: var(--color-scene-harbour); stroke-width: 2.4; stroke-linecap: round; opacity: .75; }
.scene .skyline rect { fill: var(--color-scene-harbour); opacity: .75; }
.scene .plinth.front { fill: var(--color-scene-skirting); }
.scene .plinth.side { fill: color-mix(in oklch, var(--color-scene-skirting) 85%, black); }
.scene .floor { fill: var(--color-scene-carpet); transition: fill var(--duration-base) var(--ease-standard); }
.scene .floor.active { fill: color-mix(in oklch, var(--color-scene-carpet) 90%, var(--color-action-primary)); }
.scene .tile { stroke: var(--color-scene-carpet-line); stroke-width: 1; }
.scene .skirting { fill: var(--color-scene-skirting); }
.scene .skirting.left { fill: color-mix(in oklch, var(--color-scene-skirting) 90%, black); }
.scene .feature { fill: var(--color-scene-feature); }
.scene .feature-mark .logo-tile { fill: var(--color-scene-feature-ink); }
.scene .feature-text { font-size: 11px; font-weight: var(--font-weight-bold); fill: var(--color-scene-feature-ink); letter-spacing: .04em; }
.scene .feature-sub { font-size: 8px; fill: var(--color-scene-feature-ink); opacity: .75; letter-spacing: .06em; }
.scene .wall-clock .face { fill: var(--color-scene-tag); stroke: var(--color-scene-mullion); stroke-width: 2; }
.scene .wall-clock line { stroke: var(--color-scene-mullion); stroke-width: 1.6; stroke-linecap: round; }
.scene .art .frame { fill: var(--color-scene-mullion); }
.scene .art .sky { fill: var(--color-scene-glass); }
.scene .art .sea { fill: var(--color-scene-harbour); }
.scene .art .art-ship { fill: var(--color-scene-feature-ink); stroke: var(--color-scene-mullion); stroke-width: 1.2; stroke-linejoin: round; }
.scene .whiteboard .board { fill: var(--color-scene-tag); stroke: var(--color-scene-skirting); stroke-width: 2; }
.scene .whiteboard .marker { fill: none; stroke: var(--color-action-primary); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }
.scene .glass-door .pane { fill: var(--color-scene-glass); stroke: var(--color-scene-mullion); stroke-width: 2.5; opacity: .9; }
.scene .glass-door .handle { stroke: var(--color-scene-mullion); stroke-width: 2.5; stroke-linecap: round; }
.scene .wall.back { fill: var(--color-scene-wall-back); }
.scene .wall.left { fill: var(--color-scene-wall-left); }
.scene .wall.end { fill: var(--color-scene-wall-end); }
.scene .wall.cap { fill: var(--color-scene-wall-cap); }
.scene .window { fill: var(--color-scene-window); }
.scene .window-frame { fill: var(--color-scene-window-frame); stroke: var(--color-scene-wall-cap); stroke-width: .5; }
.scene .door { fill: var(--color-scene-door); }
.scene .sign-bg { fill: var(--color-scene-tag); stroke: var(--color-border-subtle); stroke-width: 1; filter: drop-shadow(0 6px 14px var(--color-scene-shadow)); }
.scene .room-sign.active .sign-bg { stroke: var(--color-action-primary); stroke-width: 2; }
.scene .sign-icon { fill: var(--color-scene-feature); }
.scene .sign-title { font-size: 15px; font-weight: var(--font-weight-bold); fill: var(--color-scene-tag-text); letter-spacing: -0.01em; }
.scene .sign-meta { font-size: 11.5px; fill: var(--color-text-secondary); }
.scene .anchor { fill: none; stroke: var(--color-scene-feature-ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.scene .wall-chip { cursor: pointer; }
.scene .wall-chip rect { fill: var(--color-surface-sunken); }
.scene .wall-chip text { font-size: 12px; font-weight: var(--font-weight-semibold); fill: var(--color-action-primary); text-anchor: middle; }
.scene .wall-chip:hover rect, .scene .wall-chip:focus-visible rect, .scene .wall-chip[aria-pressed="true"] rect { fill: var(--color-action-primary); }
.scene .wall-chip:hover text, .scene .wall-chip:focus-visible text, .scene .wall-chip[aria-pressed="true"] text { fill: var(--color-text-on-action); }

.scene .unit { cursor: pointer; }
.scene :focus-visible { outline: var(--border-width-line) solid var(--color-focus); outline-offset: 2px; }
.scene .unit[data-agent] { cursor: grab; }
.scene .foot { fill: transparent; transition: fill var(--duration-fast) var(--ease-standard); }
.scene .unit:hover .foot { fill: var(--color-scene-hover); }
.scene .unit.selected .foot { fill: var(--color-scene-selected); stroke: var(--color-ink); stroke-width: 1.5; stroke-dasharray: 5 4; }
.scene .unit:focus-visible .foot { stroke: var(--color-focus); stroke-width: 2.5; stroke-dasharray: none; }
.scene .floor-shadow { fill: var(--color-scene-shadow); }
.scene .desk.top { fill: var(--color-scene-desk-top); }
.scene .desk.front { fill: var(--color-scene-desk-front); }
.scene .desk.side { fill: var(--color-scene-desk-side); }
.scene .kb.top { fill: var(--color-material-key-light); } .scene .kb.front, .scene .kb.side { fill: var(--color-material-key-dark); }
.scene .mug.top { fill: var(--color-material-mug-rim); } .scene .mug.front, .scene .mug.side { fill: var(--color-material-mug); }
.scene .paper.top { fill: var(--color-material-paper); } .scene .paper.front, .scene .paper.side { fill: var(--color-material-paper-line); }
.scene .monitor.top, .scene .mon-base.top { fill: var(--color-scene-monitor-top); }
.scene .monitor.front, .scene .monitor.side, .scene .mon-base.front, .scene .mon-base.side { fill: var(--color-scene-monitor); }
.scene .screen-face { fill: var(--color-material-screen); }
.scene .code { stroke: var(--color-status-idle-fill); stroke-width: 2; stroke-linecap: round; opacity: .85; }
.scene .chair.top { fill: var(--color-scene-chair-top); } .scene .chair.front, .scene .chair.side { fill: var(--color-scene-chair); }
.scene .body { stroke: var(--color-scene-shadow); stroke-width: 1; }
.scene .hair { fill: url(#hair-grad); }
.scene .face-ring { fill: none; stroke: var(--color-surface-sheet); stroke-width: 2; }
.scene .initials-head { fill: var(--color-surface-sunken); stroke: var(--color-surface-sheet); stroke-width: 2; }
.scene .initials { font-size: 10px; font-weight: var(--font-weight-bold); text-anchor: middle; fill: var(--color-text-primary); }
.scene .hand { fill: var(--color-material-skin); }
.scene .avatar, .scene .hand, .scene .code { transform-box: fill-box; }
.scene .avatar { transform-origin: 50% 100%; }

.scene .tag rect { fill: var(--color-scene-tag); stroke: var(--color-border-subtle); filter: drop-shadow(0 2px 3px var(--color-scene-shadow)); }
.scene .tag text { text-anchor: middle; }
.scene .tag-name { font-size: 12px; font-weight: var(--font-weight-semibold); fill: var(--color-scene-tag-text); }
.scene .tag-sub { font-size: 10px; font-weight: var(--font-weight-medium); fill: var(--color-text-tertiary); }
.scene .unit[data-status="active"] .tag-sub { fill: var(--color-status-working-text); }
.scene .unit[data-status="review"] .tag-sub { fill: var(--color-status-review-text); }
.scene .unit[data-status="review"] .tag rect { stroke: var(--color-status-review-fill); stroke-width: 1.5; }
.scene .unit.selected .tag rect { fill: var(--color-ink); stroke: var(--color-ink); }
.scene .unit.selected .tag-name { fill: var(--color-text-on-ink); }
.scene .unit.selected .tag-sub { fill: var(--color-text-on-ink); opacity: .75; }
.scene .badge circle { stroke: var(--color-scene-tag); stroke-width: 2; }
.scene .badge.review circle { fill: var(--color-status-review-fill); }
.scene .badge.paused circle { fill: var(--color-status-paused-fill); }
.scene .badge text { font-size: 10px; font-weight: var(--font-weight-bold); fill: var(--color-text-on-action); text-anchor: middle; }

.scene .furniture { transition: opacity var(--duration-fast) var(--ease-standard); }
/* a desk with nobody at it is only a faint outline; it firms up when pointed at or while seating people */
.scene .unit.vacant .furniture { opacity: .2; }
.scene .unit.vacant:hover .furniture, .scene .unit.vacant:focus-visible .furniture, .floor.arranging .scene .unit.vacant .furniture, .floor.dragging .scene .unit.vacant .furniture { opacity: .6; }
.scene .unit.vacant .tag { opacity: 0; transition: opacity var(--duration-fast) var(--ease-standard); }
.scene .unit.vacant:hover .tag, .scene .unit.vacant:focus-visible .tag, .floor.arranging .scene .unit.vacant .tag, .floor.dragging .scene .unit.vacant .tag { opacity: 1; }
.floor.arranging .scene .unit.vacant .foot { fill: var(--color-status-review-surface); stroke: var(--color-status-review-fill); stroke-width: 1.5; stroke-dasharray: 5 4; }
.scene .unit.drop-target .foot { fill: var(--color-status-working-surface); stroke: var(--color-status-working-fill); stroke-width: 2; stroke-dasharray: none; }
.scene .unit.lifted { opacity: .6; }
.floor.dragging, .floor.dragging .scene .unit { cursor: grabbing; }
.scene .unit[data-status="paused"] .avatar, .scene .unit[data-status="paused"] .desk { filter: saturate(.3); opacity: .75; }

.scene .unit[data-status="active"] .avatar { animation: bob 1.1s ease-in-out infinite alternate; }
.scene .unit[data-status="active"][data-mode="Learning"] .avatar { animation-duration: 2.2s; }
.scene .unit[data-status="idle"] .avatar, .scene .unit[data-status="review"] .avatar { animation: breathe3d 3.4s ease-in-out infinite alternate; }
.scene .unit:nth-child(even) .avatar { animation-delay: -1.3s; }
.scene .unit[data-status="active"] .hand { animation: tap .3s ease-in-out infinite alternate; }
.scene .unit[data-status="active"] .hand + .hand { animation-delay: -.15s; }
.scene .unit[data-status="active"] .code { stroke: var(--color-status-working-fill); animation: code 1.4s ease-in-out infinite; transform-origin: 0 50%; }
.scene .unit[data-status="review"] .code { stroke: var(--color-status-review-fill); }
@keyframes bob { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-2px) rotate(2deg); } }
@keyframes breathe3d { from { transform: scale(1); } to { transform: scale(1.03, 1.05); } }
@keyframes tap { from { transform: translateY(0); } to { transform: translateY(-2.5px); } }
@keyframes code { 0%, 100% { transform: scaleX(.3); } 60% { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .scene * { animation: none !important; } }

/* Plan view --------------------------------------------------------------------------------------- */
.floor:not(.is-3d) {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 680px), 1fr));
  padding: var(--border-width-wall) 0 0 var(--border-width-wall);
}
.room {
  position: relative; min-width: 0;
  margin: calc(-1 * var(--border-width-wall)) 0 0 calc(-1 * var(--border-width-wall));
  padding: var(--space-4) var(--space-4) var(--space-8);
  border: var(--border-width-wall) solid var(--color-plan-wall); background-color: color-mix(in oklch, var(--color-scene-carpet) 70%, var(--color-surface-sheet));
}
.room.selected { outline: var(--border-width-line) dashed var(--color-ink); outline-offset: calc(-1 * var(--space-3)); }
.room-tag { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--space-3); margin-bottom: var(--space-4); }
.room-tag .room-meta { grid-column: 1; }
.room-tag .room-edit { grid-row: 1; grid-column: 2; }
.room-tag h2 {
  font-family: var(--typography-plan-label-family); font-size: var(--typography-heading-size); font-weight: var(--typography-plan-label-weight);
  letter-spacing: var(--typography-plan-label-tracking); text-transform: uppercase; line-height: var(--typography-plan-label-lh); overflow-wrap: anywhere;
}
.room-meta { font-family: var(--typography-mono-family); font-size: var(--typography-mono-size); color: var(--color-text-tertiary); }
.room-edit { min-height: var(--space-8); padding: 0 var(--space-3); }
/* door: a gap in the bottom wall and its swing */
.door { position: absolute; left: var(--space-7); bottom: calc(-1 * var(--border-width-wall)); width: var(--space-8); height: var(--border-width-wall); background: var(--color-surface-sheet); }
.door::after {
  content: ""; position: absolute; left: 0; bottom: var(--border-width-wall); width: var(--space-8); height: var(--space-8);
  border-left: var(--border-width-hair) solid var(--color-plan-furniture); border-top: var(--border-width-hair) solid var(--color-plan-furniture);
  border-right: var(--border-width-hair) solid var(--color-plan-furniture); border-top-right-radius: 100%; border-right-color: transparent;
}

/* Desks: two facing rows share a bench, the next pair sits across an aisle.
   Each workstation is the illustrated top-down desk from the first prototype, now built from tokens. */
.desks { display: grid; grid-template-columns: repeat(var(--per-row, 3), minmax(0, var(--size-desk))); justify-content: center; column-gap: var(--space-8); }
.desk.aisle { margin-top: var(--space-9); }
.desk.bottom { margin-top: var(--space-4); }
.desk {
  position: relative; flex-direction: column; justify-content: flex-end; gap: var(--space-1);
  min-width: 0; height: 188px; padding: var(--space-2) 0 0; border: 0; border-radius: var(--space-2);
  background: transparent; color: var(--color-text-primary); font-weight: var(--font-weight-regular);
  --state: var(--color-status-idle-fill);
}
.desk.bottom { justify-content: flex-start; padding: 0 0 var(--space-2); }
.desk.bottom .workstation { order: -2; }
.desk.bottom .portrait { order: -1; }
.desk.top .workstation, .desk.top .desk-note { rotate: 180deg; }
.desk:hover:not(:disabled), .desk[aria-pressed="true"] { background: color-mix(in oklch, var(--color-surface-sunken) 80%, transparent); color: var(--color-text-primary); }
.desk[aria-pressed="true"] { border: 0; }
.desk[data-status="active"] { --state: var(--color-status-working-fill); }
.desk[data-status="review"] { --state: var(--color-status-review-fill); }
.desk[data-status="paused"] { --state: var(--color-status-paused-fill); }
.desk-label { display: flex; flex-direction: column; align-items: center; max-width: 100%; line-height: var(--typography-plan-name-lh); }
.desk-label b {
  font-family: var(--typography-plan-name-family); font-size: var(--typography-small-size); font-weight: var(--font-weight-bold);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.desk-label small:empty::before { content: "\00a0"; }
.desk-label small {
  font-family: var(--typography-plan-label-family); font-size: var(--typography-mono-size); font-weight: var(--font-weight-bold);
  letter-spacing: var(--typography-plan-label-tracking); text-transform: uppercase; color: var(--color-text-tertiary);
}
.desk[data-status="active"] .desk-label small { color: var(--color-status-working-text); }
.desk[data-status="review"] .desk-label small { color: var(--color-status-review-text); }
.desk[data-status="paused"] .desk-label small { color: var(--color-status-paused-text); }
.desk .portrait { border-color: var(--state); box-shadow: 0 0 0 1px var(--color-surface-sheet); }

.workstation { display: block; position: relative; width: min(100%, var(--size-workstation)); aspect-ratio: 96 / 77; isolation: isolate; }
.workstation > span, .desktop > span { position: absolute; }
.desktop { inset: 10% 9% 45%; border-radius: 9%; background: linear-gradient(118deg, var(--color-material-wood-light), var(--color-material-wood-dark)); box-shadow: 0 3px var(--color-material-wood-edge), 2px 5px 6px var(--color-material-shadow); }
.screen { top: 9%; left: 28%; width: 45%; height: 42%; display: grid; align-content: center; gap: 14%; padding: 4% 8%; background: var(--color-material-screen); border: 2px solid var(--color-material-screen-frame); border-radius: 18%; overflow: hidden; }
.screen span { height: 2px; background: var(--state); border-radius: 9px; opacity: .82; transform-origin: left; }
.screen span:nth-child(2) { width: 76%; } .screen span:nth-child(3) { width: 58%; }
.keyboard { top: 68%; left: 35%; width: 31%; height: 17%; border-radius: 2px; background: repeating-linear-gradient(90deg, var(--color-material-key-light) 0 2px, var(--color-material-key-dark) 2px 3px); box-shadow: 0 1px var(--color-material-key-edge); }
.paper { left: 9%; top: 36%; width: 13%; height: 37%; border-radius: 1px; background: repeating-linear-gradient(var(--color-material-paper) 0 3px, var(--color-material-paper-line) 3px 4px); rotate: -10deg; }
.mug { right: 10%; top: 43%; width: 11%; aspect-ratio: 1; border: 2px solid var(--color-material-mug-rim); border-radius: 50%; background: var(--color-material-mug); box-shadow: 2px 0 var(--color-material-mug-shadow); }
.seat-chair { inset: 56% 31% 9%; border-radius: 36%; background: linear-gradient(var(--color-material-chair-light), var(--color-material-chair-dark)); box-shadow: 0 3px 4px var(--color-material-shadow); }
.worker { inset: 58% 34% 20%; border-radius: 48%; background: var(--shirt); box-shadow: inset 0 -3px var(--color-material-shadow); transform-origin: center 80%; }
.arm { position: absolute; top: -35%; width: 20%; height: 88%; border-radius: 12px; background: linear-gradient(to bottom, var(--color-material-skin) 0 34%, var(--shirt) 38%); transform-origin: center bottom; }
.arm-left { left: 2%; rotate: -13deg; } .arm-right { right: 2%; rotate: 13deg; }
.head { position: absolute; left: 25%; top: -24%; width: 50%; height: 88%; border-radius: 48%; background: radial-gradient(ellipse at 36% 26%, var(--color-material-hair-light), var(--color-material-hair-dark) 78%); box-shadow: 0 2px 2px var(--color-material-shadow); }
.desk-note { right: 3%; top: 3%; min-width: 1.4em; padding: 0 var(--space-1); border-radius: 9px; background: var(--color-material-note); color: var(--state); font-size: var(--typography-mono-size); font-weight: var(--font-weight-bold); line-height: 1.3; text-align: center; }
.desk-note:empty { display: none; }

.desk[data-status="active"] .arm { animation: type .55s ease-in-out infinite alternate; }
.desk[data-status="active"] .arm-right { animation-delay: -.27s; }
.desk[data-status="active"] .worker { animation: work-sway 1.15s ease-in-out infinite alternate; }
.desk[data-status="active"] .head { animation: nod .9s ease-in-out infinite alternate; }
.desk[data-status="active"] .screen span { animation: write 1.4s ease-in-out infinite; }
.desk[data-status="active"] .screen span:nth-child(2) { animation-delay: .16s; }
.desk[data-status="active"] .screen span:nth-child(3) { animation-delay: .32s; }
.desk[data-status="active"] .screen { animation: monitor-glow 1.6s ease-in-out infinite alternate; }
.desk[data-status="active"][data-mode="Learning"] .worker { animation-duration: 2.6s; }
.desk[data-status="active"][data-mode="Learning"] .arm-right { animation-duration: 1.2s; }
.desk[data-status="idle"] .worker, .desk[data-status="review"] .worker { animation: breathe 3.4s ease-in-out infinite alternate; }
.desk:nth-child(even) .worker { animation-delay: -1.4s; }
.desk[data-status="paused"] .screen span { opacity: .35; }
.desk[data-status="paused"] .workstation { filter: saturate(.35); opacity: .8; }
@keyframes type { from { translate: 0 1px; } to { translate: 0 -4px; } }
@keyframes write { 0%, 100% { transform: scaleX(.24); opacity: .45; } 60%, 85% { transform: scaleX(1); opacity: 1; } }
@keyframes breathe { from { scale: 1; } to { scale: 1.07 1.10; } }
@keyframes work-sway { from { transform: translateY(1px) rotate(-5deg); } to { transform: translateY(-3px) rotate(5deg); } }
@keyframes monitor-glow { from { box-shadow: 0 0 0 transparent; } to { box-shadow: 0 0 8px var(--color-status-working-fill); } }
@keyframes nod { from { translate: 0 1px; } to { translate: 0 -2px; } }
@media (prefers-reduced-motion: reduce) { .desk .workstation * { animation: none !important; } }

.cloud { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.cloud path { fill: none; stroke: var(--color-status-review-fill); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.delta { position: absolute; top: calc(-1 * var(--space-2)); right: calc(-1 * var(--space-1)); width: 20px; height: 18px; pointer-events: none; }
.delta path { fill: var(--color-status-review-fill); }
.delta text { fill: var(--color-text-on-action); font: var(--font-weight-bold) 11px var(--font-family-text); text-anchor: middle; }
.grips {
  position: absolute; inset: 0; pointer-events: none; border: var(--border-width-hair) dashed var(--color-ink); border-radius: var(--space-2);
  --g: linear-gradient(var(--color-ink), var(--color-ink));
  background: var(--g) 0 0 / 7px 7px no-repeat, var(--g) 100% 0 / 7px 7px no-repeat, var(--g) 0 100% / 7px 7px no-repeat, var(--g) 100% 100% / 7px 7px no-repeat;
}

.desk.vacant { color: var(--color-text-tertiary); }
.desk.vacant .workstation { opacity: .2; transition: opacity var(--duration-fast) var(--ease-standard); }
.desk.vacant .desk-label { opacity: .6; }
.desk.vacant:hover .workstation, .desk.vacant:focus-visible .workstation, .floor.arranging .desk.vacant .workstation { opacity: .6; }
.desk.vacant .desk-label b { font-weight: var(--font-weight-regular); }
.floor.arranging .desk.vacant { outline: var(--border-width-line) dashed var(--color-action-primary); outline-offset: -4px; }
.floor.arranging .desk.vacant .desk-label b { color: var(--color-status-review-text); font-weight: var(--font-weight-bold); }
.desk[draggable="true"] { cursor: grab; }
.desk.drop-target { background: var(--color-status-working-surface); outline: var(--border-width-line) solid var(--color-status-working-fill); outline-offset: -2px; }

.portrait {
  display: block; flex: none; width: var(--size-portrait); height: var(--size-portrait); position: relative; z-index: 1;
  border: var(--border-width-line) solid var(--color-status-idle-fill); border-radius: var(--radius-portrait);
  background-color: var(--color-surface-sunken); background-image: url(portraits.jpg); background-size: 500% 200%; background-position: var(--px) var(--py);
}
.portrait.initials { display: grid; place-items: center; background-image: none; font-family: var(--typography-plan-label-family); font-size: var(--typography-mono-size); font-weight: var(--font-weight-bold); color: var(--color-text-primary); }
.portrait-lg { width: var(--size-portrait-lg); height: var(--size-portrait-lg); border-color: var(--color-border-strong); }

.proposed-room {
  display: flex; flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: var(--space-1) var(--space-3); text-align: left; width: 100%; margin-top: var(--space-5); padding: var(--space-4) var(--space-5);
  background: transparent; border: var(--border-width-line) dashed var(--color-border-subtle); border-radius: var(--radius-card); justify-content: flex-start;
}
.proposed-room:hover:not(:disabled) { background: var(--color-surface-sunken); border-color: var(--color-border-strong); }
.proposed-room span { font-size: var(--typography-body-size); font-weight: var(--font-weight-semibold); }
.proposed-room small { font-weight: var(--font-weight-regular); color: var(--color-text-secondary); }

.sheet-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-5); flex-wrap: wrap; margin-top: var(--space-5); }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); font-size: var(--typography-small-size); color: var(--color-text-secondary); }
.legend li { display: flex; align-items: center; gap: var(--space-2); }
.key { display: inline-block; width: 12px; height: 12px; flex: none; border-radius: 50%; }
.key-working { background: var(--color-status-working-fill); }
.key-review { background: var(--color-status-review-fill); }
.key-idle { background: var(--color-status-idle-fill); }
.key-paused { background: var(--color-status-paused-fill); }
.key-empty { border: var(--border-width-line) dashed var(--color-border-strong); }

/* Inspector --------------------------------------------------------------------------------------- */
.inspector {
  grid-area: inspector; position: sticky; top: 104px; max-height: calc(100dvh - 120px); overflow: auto;
  padding: var(--space-6); background: var(--color-surface-sheet); border-radius: var(--radius-card); box-shadow: var(--shadow-sheet);
  display: flex; flex-direction: column; gap: var(--space-5);
}
.insp-head { display: flex; gap: var(--space-4); align-items: center; }
.insp-head h2 { font-size: var(--typography-title-size); font-weight: var(--font-weight-bold); line-height: var(--typography-title-lh); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.insp-head p { font-size: var(--typography-small-size); color: var(--color-text-secondary); margin-top: var(--space-1); }
.inspector h3 { font-size: var(--typography-heading-size); font-weight: var(--font-weight-semibold); margin-top: var(--space-3); }
.eyebrow { display: block; font-size: 0.75rem; font-weight: var(--font-weight-semibold); letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-tertiary); }
.state { align-self: flex-start; display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); background: var(--color-surface-sunken); font-size: var(--typography-small-size); font-weight: var(--font-weight-semibold); }
.state-mark { width: 8px; height: 8px; border-radius: 50%; background: var(--color-status-idle-fill); }
.state-active { background: var(--color-status-working-surface); color: var(--color-status-working-text); }
.state-active .state-mark { background: var(--color-status-working-fill); }
.state-review { background: var(--color-status-review-surface); color: var(--color-status-review-text); }
.state-review .state-mark { background: var(--color-status-review-fill); }
.state-paused { color: var(--color-status-paused-text); }
.state-paused .state-mark { background: var(--color-status-paused-fill); }
.state-idle { color: var(--color-status-idle-text); }
.actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }

.field { display: grid; gap: var(--space-2); }
.field-label { font-size: var(--typography-small-size); font-weight: var(--font-weight-medium); color: var(--color-text-secondary); }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; border: 0; margin: 0; min-width: 0; padding: 3px; border-radius: var(--radius-control); background: var(--color-surface-sunken); }
.segmented label { position: relative; min-width: 0; }
.segmented input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.segmented span { display: flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 var(--space-2); border-radius: 8px; font-size: var(--typography-small-size); font-weight: var(--font-weight-semibold); color: var(--color-text-secondary); transition: background-color var(--duration-fast) var(--ease-standard); }
.segmented input:checked + span { background: var(--color-surface-sheet); color: var(--color-text-primary); box-shadow: var(--shadow-control); }
.segmented input:focus-visible + span { outline: var(--border-width-line) solid var(--color-focus); outline-offset: 1px; }
.segmented:disabled span { opacity: .45; }

.tabs { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius-control); background: var(--color-surface-sunken); }
.tabs button { flex: 1; min-width: 0; min-height: 34px; padding: 0 var(--space-2); background: transparent; border-radius: 8px; color: var(--color-text-secondary); white-space: nowrap; }
.tabs button[aria-pressed="true"] { background: var(--color-surface-sheet); color: var(--color-text-primary); box-shadow: var(--shadow-control); }
.count { display: inline-grid; place-items: center; min-width: 1.4em; padding: 0 4px; border-radius: var(--radius-pill); background: var(--color-surface-hover); font-size: 0.75rem; color: var(--color-text-secondary); }
.details { display: flex; flex-direction: column; gap: var(--space-4); font-size: var(--typography-small-size); line-height: var(--typography-small-lh); }

.current { padding: var(--space-4); border-radius: var(--radius-control); background: var(--color-surface-sunken); font-size: var(--typography-body-size); }
.review-box { padding: var(--space-4); border-radius: var(--radius-control); background: var(--color-status-review-surface); display: grid; gap: var(--space-3); }
.rows li { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: var(--border-width-hair) solid var(--color-border-subtle); overflow-wrap: anywhere; }
.rows li:last-child { border-bottom: 0; }
.rows .grow, .grow { flex: 1; min-width: 0; }
.rows .meta { color: var(--color-text-tertiary); }
.rows .num { min-width: 1.5em; }
.rows li.proposed { padding: var(--space-3); border-radius: var(--radius-control); border-bottom: 0; background: var(--color-status-review-surface); margin: var(--space-1) 0; }
.row-actions { display: flex; gap: var(--space-1); flex: none; }
.row-actions button:not(.quiet) { min-height: var(--space-8); padding: 0 var(--space-3); }
.inline-form { display: flex; gap: var(--space-2); }
.inline-form input { flex: 1; min-width: 0; }
.hint { color: var(--color-text-secondary); font-size: var(--typography-small-size); }

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack label, .pair label { display: flex; flex-direction: column; gap: var(--space-2); color: var(--color-text-secondary); font-size: var(--typography-small-size); font-weight: var(--font-weight-medium); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
fieldset { border: var(--border-width-hair) solid var(--color-border-subtle); border-radius: var(--radius-control); padding: var(--space-3) var(--space-4); margin: 0; min-width: 0; }
legend { padding: 0 var(--space-1); color: var(--color-text-secondary); }
.stack label.check { flex-direction: row; align-items: center; gap: var(--space-3); color: var(--color-text-primary); font-weight: var(--font-weight-regular); padding: var(--space-1) 0; min-height: var(--space-8); }
.danger-zone { margin-top: var(--space-3); padding-top: var(--space-5); border-top: var(--border-width-hair) solid var(--color-border-subtle); display: grid; gap: var(--space-2); justify-items: start; }

/* Activity ---------------------------------------------------------------------------------------- */
.log { grid-area: log; padding: var(--space-6); background: var(--color-surface-sheet); border-radius: var(--radius-card); box-shadow: var(--shadow-sheet); }
.log h2 { font-size: var(--typography-heading-size); font-weight: var(--font-weight-semibold); margin-bottom: var(--space-3); }
.log ol { columns: 2 340px; column-gap: var(--space-8); font-size: var(--typography-small-size); }
.log li { display: flex; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: var(--border-width-hair) solid var(--color-border-subtle); break-inside: avoid; }

/* Narrow layouts ---------------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-areas: "plan" "inspector"; }
  .inspector { position: static; max-height: none; }
}
@media (max-width: 600px) {
  .topbar, .workspace { padding-left: var(--space-4); padding-right: var(--space-4); }
  .sheet { padding: var(--space-3); }
  .room { padding-left: var(--space-2); padding-right: var(--space-2); }
  .pair { grid-template-columns: 1fr; }
  .tools { width: 100%; }
}

/* Sign-in, account and settings ------------------------------------------------------------------ */
body.locked .shell { display: none; }
.auth {
  min-height: calc(100dvh - 60px); display: grid; place-items: center; padding: var(--space-7) var(--space-5);
  background: radial-gradient(90% 70% at 50% 0%, var(--color-scene-backdrop-glow), var(--color-scene-backdrop) 75%);
}
.auth-card { width: min(100%, 420px); display: grid; gap: var(--space-4); padding: var(--space-8); background: var(--color-surface-sheet); border-radius: var(--radius-card); box-shadow: var(--shadow-sheet); }
.auth-brand { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: var(--font-weight-medium); }
.auth-brand span { display: grid; line-height: 1.15; } .auth-brand b { font-size: 1.15rem; } .auth-brand small { color: var(--color-text-secondary); font-weight: var(--font-weight-regular, 400); }
.auth-card h1 { font-size: 1.75rem; }
.auth-card .stack button { margin-top: var(--space-2); }
.auth-error { min-height: 1.5em; color: var(--color-status-review-text); font-size: var(--typography-small-size); font-weight: var(--font-weight-semibold); }
.small { font-size: 0.75rem; }

.account { display: flex; align-items: center; gap: var(--space-2); }
#who { display: inline-flex; align-items: center; gap: var(--space-2); margin-right: var(--space-2); }
.role-chip { display: inline-flex; align-items: center; padding: 2px var(--space-3); border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: var(--font-weight-semibold); background: var(--color-surface-sunken); color: var(--color-text-secondary); }
.role-admin { background: var(--color-ink); color: var(--color-text-on-ink); }
.role-manager { background: color-mix(in oklch, var(--color-scene-brass) 25%, var(--color-surface-sheet)); color: var(--color-text-primary); }
.role-viewer { background: var(--color-surface-sunken); color: var(--color-text-secondary); }

.readonly { padding: var(--space-3) var(--space-4); border-radius: var(--radius-control); background: var(--color-surface-sunken); color: var(--color-text-secondary); font-size: var(--typography-small-size); }
.notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-control); background: var(--color-status-working-surface); color: var(--color-status-working-text); font-weight: var(--font-weight-semibold); }
.empty-office { padding: var(--space-9) var(--space-5); text-align: center; color: var(--color-text-secondary); background: var(--color-surface-sheet); border-radius: var(--radius-control); }
fieldset.bare { border: 0; padding: 0; margin: 0; }
fieldset.bare:disabled { opacity: .85; }
.facts { display: grid; gap: var(--space-3); }
.facts div { display: grid; grid-template-columns: 6rem 1fr; gap: var(--space-3); align-items: baseline; }
.facts dt { font-size: var(--typography-small-size); color: var(--color-text-tertiary); }

.settings { width: min(calc(100vw - 32px), 640px); max-height: calc(100dvh - 48px); padding: 0; border: 0; border-radius: var(--radius-card); background: var(--color-surface-sheet); color: var(--color-text-primary); box-shadow: var(--shadow-sheet); }
.settings::backdrop { background: oklch(0.2 0.04 258 / .45); }
.settings-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-5) var(--space-6) var(--space-3); }
.settings-head h2 { font-size: var(--typography-title-size); }
.settings > .tabs { margin: 0 var(--space-6); }
.settings-body { display: grid; gap: var(--space-4); padding: var(--space-5) var(--space-6) var(--space-7); font-size: var(--typography-small-size); }
.settings-body h3 { font-size: var(--typography-heading-size); margin-top: var(--space-3); }
.role-help { display: grid; gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-control); background: var(--color-surface-sunken); }
.role-help .role-chip { margin-right: var(--space-2); }
.users li { align-items: flex-start; }
.users li.editing { padding: var(--space-4); border-radius: var(--radius-control); background: var(--color-surface-sunken); }
.room-access { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-5); }
.room-access legend { width: 100%; }
@media (max-width: 600px) { .account { width: 100%; } .facts div { grid-template-columns: 1fr; } }

/* App shell: sidebar, app bar, pages ------------------------------------------------------------ */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.locked .shell { display: none; }
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: var(--space-6); padding: var(--space-6) var(--space-4); background: var(--color-surface-sheet); border-right: var(--border-width-hair) solid var(--color-border-subtle); }
.brand { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-2); color: inherit; text-decoration: none; }
.brand .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
.brand span { display: grid; line-height: 1.15; }
.brand b { font-size: 1.25rem; letter-spacing: -0.01em; }
.brand small { color: var(--color-text-secondary); }
.nav { display: grid; gap: var(--space-1); }
.nav a, .nav button {
  display: flex; align-items: center; justify-content: flex-start; gap: var(--space-3); min-height: 44px; padding: 0 var(--space-4);
  border-radius: var(--radius-control); background: transparent; color: var(--color-text-secondary); font-size: var(--typography-body-size); font-weight: var(--font-weight-medium); text-decoration: none;
}
.nav a:hover, .nav button:hover:not(:disabled) { background: var(--color-surface-sunken); color: var(--color-text-primary); }
.nav a[aria-current="page"] { background: var(--color-ink); color: var(--color-text-on-ink); box-shadow: var(--shadow-control); }
.nav-count { margin-left: auto; min-width: 26px; padding: 1px var(--space-2); border-radius: var(--radius-pill); background: var(--color-surface-sunken); color: var(--color-text-primary); font-size: 0.75rem; font-weight: var(--font-weight-bold); text-align: center; }
.nav-count:empty { display: none; }
.nav-count.alert { background: var(--color-status-review-surface); color: var(--color-status-review-text); }
.nav a[aria-current="page"] .nav-count { background: color-mix(in oklch, var(--color-text-on-ink) 20%, transparent); color: var(--color-text-on-ink); }
.sidebar-foot { margin-top: auto; font-size: 0.75rem; color: var(--color-text-secondary); }
.sidebar-foot .demo-tag { display: inline-block; margin-bottom: var(--space-1); }

.content { min-width: 0; }
.appbar { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap; padding: var(--space-4) var(--space-7); background: var(--color-surface-app); border-bottom: var(--border-width-hair) solid var(--color-border-subtle); }
.page-title { margin-right: auto; }
.page-title h1 { font-size: 1.75rem; outline: none; }
.page-title p { color: var(--color-text-secondary); font-size: var(--typography-small-size); }
.clock { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); background: var(--color-surface-sheet); box-shadow: var(--shadow-control); font-variant-numeric: tabular-nums; }
.clock .time { display: inline-flex; align-items: baseline; gap: var(--space-1); }
.clock time { font-weight: var(--font-weight-semibold); }
.clock small { font-size: 0.75rem; color: var(--color-text-tertiary); }
.clock .utc { padding-left: var(--space-3); border-left: var(--border-width-hair) solid var(--color-border-subtle); }
.online { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 0.75rem; font-weight: var(--font-weight-semibold); color: var(--color-status-working-text); }
.online.off { color: var(--color-status-review-text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-status-idle-fill); display: inline-block; }
.online .dot, .dot.on { background: var(--color-status-working-fill); box-shadow: 0 0 0 0 var(--color-status-working-fill); animation: live-pulse 2s ease-out infinite; }
.online.off .dot { background: var(--color-status-review-fill); animation: none; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--color-status-working-fill) 60%, transparent); } 100% { box-shadow: 0 0 0 7px transparent; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none !important; } }
.appbar-tools { display: flex; align-items: center; gap: var(--space-3); }
.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: var(--space-3); color: var(--color-text-tertiary); pointer-events: none; }
.search input { width: 240px; padding-left: 40px; background: var(--color-surface-sheet); }
.icon-button, .user-button { position: relative; min-height: 44px; padding: 0 var(--space-3); background: var(--color-surface-sheet); box-shadow: var(--shadow-control); }
.bell-count { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--radius-pill); background: var(--color-status-review-fill); color: var(--color-text-on-action); font-size: 0.6875rem; line-height: 18px; text-align: center; }
.user-button { gap: var(--space-3); padding: 0 var(--space-3) 0 var(--space-1); }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--color-ink); color: var(--color-text-on-ink); font-weight: var(--font-weight-bold); font-size: var(--typography-small-size); }
.user-text { display: grid; text-align: left; line-height: 1.2; }
.user-text small { color: var(--color-text-secondary); font-weight: var(--font-weight-regular); font-size: 0.75rem; }
.bell-wrap, .user-wrap { position: relative; }
.popover { position: absolute; right: 0; top: calc(100% + var(--space-2)); z-index: 5; width: 320px; max-height: 60vh; overflow: auto; display: grid; gap: 2px; padding: var(--space-2); border-radius: var(--radius-card); background: var(--color-surface-sheet); box-shadow: var(--shadow-sheet), 0 0 0 1px var(--color-border-subtle); }
.popover[hidden] { display: none; }
.search .popover { left: 0; right: auto; width: 340px; }
.user-menu { width: 220px; }
.popover button { justify-content: flex-start; gap: var(--space-3); min-height: 44px; padding: var(--space-2) var(--space-3); background: transparent; text-align: left; font-weight: var(--font-weight-medium); }
.popover button:hover:not(:disabled), .popover button:focus-visible { background: var(--color-surface-sunken); }
.popover button span { display: grid; min-width: 0; }
.popover button small { color: var(--color-text-secondary); font-weight: var(--font-weight-regular); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popover .hint { padding: var(--space-3); }
.popover-title { padding: var(--space-2) var(--space-3); font-size: 0.75rem; font-weight: var(--font-weight-semibold); text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-tertiary); }

.workspace { padding-top: var(--space-6); }
.workspace[hidden], .page[hidden] { display: none; }
.stat-cards { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.stat { display: flex; align-items: center; gap: var(--space-3); min-height: 60px; padding: var(--space-2) var(--space-5) var(--space-2) var(--space-3); border-radius: var(--radius-card); background: var(--color-surface-sheet); box-shadow: var(--shadow-control); font: inherit; color: var(--color-text-primary); text-align: left; }
.stat b { display: block; font-size: 1.375rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat small { color: var(--color-text-secondary); font-size: 0.75rem; }
.stat-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--color-surface-sunken); color: var(--color-text-primary); }
.stat.is-working .stat-icon { background: var(--color-status-working-surface); color: var(--color-status-working-text); }
.stat.is-alert { background: var(--color-status-review-surface); }
.stat.is-alert .stat-icon { background: var(--color-status-review-fill); color: var(--color-text-on-action); }
button.stat:disabled { opacity: 1; cursor: default; }
.toolbar { align-items: center; }

.livebar { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-4); padding: var(--space-3) var(--space-5); border-radius: var(--radius-card); background: var(--color-surface-sheet); box-shadow: var(--shadow-sheet); overflow: hidden; }
.livebar h2 { display: flex; align-items: center; gap: var(--space-2); font-size: var(--typography-body-size); white-space: nowrap; }
.livebar h2 .icon { color: var(--color-status-working-fill); }
.livebar ol { display: flex; gap: var(--space-5); min-width: 0; flex: 1; overflow: hidden; }
.livebar li { display: flex; align-items: center; gap: var(--space-2); min-width: 0; font-size: var(--typography-small-size); color: var(--color-text-secondary); white-space: nowrap; }
.livebar li span { overflow: hidden; text-overflow: ellipsis; }
.livebar li + li { padding-left: var(--space-5); border-left: var(--border-width-hair) solid var(--color-border-subtle); }
.livebar li:first-child { animation: arrive var(--duration-move) var(--ease-move); }
@keyframes arrive { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.live-more { display: inline-flex; align-items: center; gap: var(--space-2); margin-left: auto; color: var(--color-text-primary); font-size: var(--typography-small-size); font-weight: var(--font-weight-semibold); white-space: nowrap; text-decoration: none; }
.live-more:hover { text-decoration: underline; }
#live-active { display: inline-flex; align-items: center; gap: var(--space-2); }

.page { display: grid; gap: var(--space-5); padding: var(--space-6) var(--space-7) var(--space-9); max-width: 1400px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip { min-height: 36px; padding: 0 var(--space-4); border-radius: var(--radius-pill); background: var(--color-surface-sheet); box-shadow: var(--shadow-control); }
.chip[aria-pressed="true"] .count { background: color-mix(in oklch, var(--color-text-on-ink) 20%, transparent); color: var(--color-text-on-ink); }
.card { display: grid; gap: var(--space-3); padding: var(--space-5); border-radius: var(--radius-card); background: var(--color-surface-sheet); box-shadow: var(--shadow-sheet); align-content: start; }
.card h2 { display: flex; align-items: center; gap: var(--space-2); font-size: var(--typography-heading-size); }
.card-head { display: flex; align-items: center; gap: var(--space-3); }
.card-head small { display: block; color: var(--color-text-secondary); font-size: var(--typography-small-size); }
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: var(--space-5); }
.memory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: var(--space-5); }
.assign-row { display: flex; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; }
.assign-row label { display: grid; gap: var(--space-2); font-size: var(--typography-small-size); color: var(--color-text-secondary); }
.assign-row select { min-width: 220px; }
.inline-label { display: inline-flex; align-items: center; gap: var(--space-3); font-size: var(--typography-small-size); color: var(--color-text-secondary); }
.inline-label select { width: auto; }
.live-chip { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--typography-small-size); color: var(--color-text-secondary); }
.who-cell { display: inline-flex; align-items: center; gap: var(--space-3); min-width: 0; }
.who-cell span { display: grid; min-width: 0; line-height: 1.25; }
.who-cell small { color: var(--color-text-secondary); font-size: 0.75rem; }
.who-cell .portrait { width: 34px; height: 34px; border-color: var(--color-border-subtle); }
.table-wrap { overflow-x: auto; border-radius: var(--radius-card); background: var(--color-surface-sheet); box-shadow: var(--shadow-sheet); }
.table { width: 100%; border-collapse: collapse; font-size: var(--typography-small-size); }
.table th { padding: var(--space-3) var(--space-4); text-align: left; font-size: 0.75rem; font-weight: var(--font-weight-semibold); text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-tertiary); border-bottom: var(--border-width-hair) solid var(--color-border-subtle); }
.table td { padding: var(--space-3) var(--space-4); border-bottom: var(--border-width-hair) solid var(--color-border-subtle); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--color-surface-app); }
.alert-text { color: var(--color-status-review-text); font-weight: var(--font-weight-semibold); }
.rule-list { display: grid; gap: var(--space-2); padding-left: var(--space-5); list-style: disc; font-size: var(--typography-small-size); }
.timeline .icon { color: var(--color-text-tertiary); }
.integration > button { justify-self: start; }

/* 3D extras */
.scene .pot.top { fill: var(--color-scene-desk-top); }
.scene .pot.front { fill: var(--color-scene-desk-front); }
.scene .pot.side { fill: var(--color-scene-desk-side); }
.scene .leaf { fill: var(--color-status-working-fill); stroke: color-mix(in oklch, var(--color-status-working-fill) 70%, black); stroke-width: .8; }
.scene .wall-screen .bezel { fill: var(--color-scene-monitor); }
.scene .wall-screen .panel { fill: var(--color-material-screen); }
.scene .wall-screen .land { fill: none; stroke: color-mix(in oklch, var(--color-scene-window) 60%, var(--color-material-screen)); stroke-width: 3; stroke-linecap: round; }
.scene .wall-screen .route { fill: none; stroke: var(--color-scene-brass); stroke-width: 1.4; stroke-dasharray: 3 2.5; }
.scene .wall-screen .port { fill: var(--color-scene-ring-white); }
.scene .wall-screen .ship { fill: var(--color-status-working-fill); }
.scene .sign-live { fill: var(--color-status-working-fill); stroke: var(--color-scene-tag); stroke-width: 2; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-right: 0; border-bottom: var(--border-width-hair) solid var(--color-border-subtle); }
  .nav { display: flex; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  .nav a, .nav button { white-space: nowrap; min-height: 40px; }
  .sidebar-foot { display: none; }
  .appbar { position: static; }
}
@media (max-width: 760px) {
  .appbar, .page { padding-left: var(--space-4); padding-right: var(--space-4); }
  .search input { width: 100%; }
  .appbar-tools { width: 100%; }
  .search { flex: 1; }
  .user-text { display: none; }
  .livebar { flex-wrap: wrap; }
  .livebar ol { flex-direction: column; gap: var(--space-2); width: 100%; }
  .livebar li + li { padding-left: 0; border-left: 0; }
}
/* compact desktop: keep the app bar on one line and the stats in one row */
.stat-cards { flex-wrap: nowrap; }
.stat { min-height: 52px; padding: var(--space-2) var(--space-4) var(--space-2) var(--space-2); gap: var(--space-2); }
.stat b { font-size: 1.125rem; }
.stat-icon { width: 34px; height: 34px; border-radius: 10px; }
.search input { width: 200px; }
@media (max-width: 1440px) {
  .user-text { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-5); padding-left: var(--space-5); padding-right: var(--space-5); }
  .appbar { padding-left: var(--space-5); padding-right: var(--space-5); gap: var(--space-3); }
  .page-title h1 { font-size: 1.5rem; }
  .stat small { font-size: 0.6875rem; }
}
@media (max-width: 1280px) { .stat-cards { flex-wrap: wrap; } .clock .utc small { display: inline; } .page-title p { display: none; } }

/* Brand: blue isometric cube with an orbit and a spark, on a deep-blue tile with a soft glow */
.brand-mark { display: block; padding: 4px; border-radius: 12px; background: linear-gradient(145deg, var(--color-brand-deep), var(--color-ink)); box-shadow: 0 0 14px var(--color-brand-glow); overflow: visible; }
.brand-mark use, .brand-mark path { stroke: none; }
.brand-mark .logo-top { fill: var(--color-brand-soft); } .brand-mark .logo-left { fill: var(--color-brand-mid); } .brand-mark .logo-right { fill: var(--color-brand-accent); } .brand-mark .logo-spark { fill: var(--color-brand-soft); } .brand-mark .logo-orbit { fill: none; stroke: var(--color-brand-light); stroke-width: 1.4; stroke-linecap: round; }
.brand-mark .logo-top, .brand-mark use { --top: var(--color-brand-soft); }
.logo-top { fill: var(--color-brand-soft); }
.logo-left { fill: var(--color-brand-mid); }
.logo-right { fill: var(--color-brand-accent); }
.logo-orbit { fill: none; stroke: var(--color-brand-light); stroke-width: 1.4; stroke-linecap: round; }
.logo-orbit.back { opacity: .55; }
.logo-spark { fill: var(--color-brand-soft); }
.auth-brand .brand-mark { width: 36px; height: 36px; }
.sidebar .brand .brand-mark { width: 44px; height: 44px; }
.nav a[aria-current="page"] { background: var(--color-action-primary); }
button.primary, button.ink { background: var(--color-action-primary); }
button.primary:hover:not(:disabled), button.ink:hover:not(:disabled) { background: var(--color-action-primary-hover); }
.avatar, .role-admin { background: var(--color-action-primary); }
.auth { background-color: var(--color-scene-backdrop); }
.demo-tag { background: var(--color-brand-soft); color: var(--color-brand-deep); }
.auth { min-height: 100dvh; }

/* Sign-in page, secrets, flags, toast */
.login-page .auth { display: grid; }
.login-page { margin: 0; }
.qr { justify-self: center; padding: var(--space-3); border-radius: var(--radius-control); background: #fff; box-shadow: var(--shadow-control); line-height: 0; }
.qr svg { width: 200px; height: 200px; }
.manual summary { cursor: pointer; font-size: var(--typography-small-size); color: var(--color-text-secondary); }
code.secret { display: block; margin-top: var(--space-2); padding: var(--space-3); border-radius: var(--radius-control); background: var(--color-surface-sunken); font-size: 0.875rem; letter-spacing: .04em; word-break: break-all; }
.secret-box { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-control); background: var(--color-brand-soft); }
.secret-box > p, .secret-box > .actions { grid-column: 1 / -1; }
.secret-box code { padding: var(--space-2) var(--space-3); border-radius: 8px; background: var(--color-surface-sheet); font-size: 0.9375rem; font-weight: var(--font-weight-semibold); letter-spacing: .03em; text-align: center; user-select: all; }
.flag { display: inline-block; margin-left: var(--space-1); padding: 1px var(--space-2); border-radius: var(--radius-pill); background: var(--color-surface-sunken); font-size: 0.6875rem; font-weight: var(--font-weight-semibold); color: var(--color-text-secondary); }
.flag.ok { background: var(--color-status-working-surface); color: var(--color-status-working-text); }
.flag.warn { background: var(--color-status-review-surface); color: var(--color-status-review-text); }
.actions.wrap { flex-wrap: wrap; }
.warn-row td { color: var(--color-status-review-text); }
.toast { position: fixed; left: 50%; bottom: var(--space-6); z-index: 10; transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px)); padding: var(--space-3) var(--space-5); border-radius: var(--radius-card); background: var(--color-ink); color: var(--color-text-on-ink); box-shadow: var(--shadow-sheet); font-size: var(--typography-small-size); }
.toast[hidden] { display: none; }

/* uploaded photos and rooms that have nobody yet */
.portrait.photo { background-size: cover; background-position: center; }
.photo-field { display: flex; align-items: end; gap: var(--space-4); flex-wrap: wrap; }
.photo-field input[type="file"] { max-width: 15rem; }
.scene .coming-soon rect { fill: var(--color-scene-feature); filter: drop-shadow(0 6px 14px var(--color-scene-shadow)); }
.scene .coming-soon text { font-size: 20px; font-weight: var(--font-weight-bold); fill: var(--color-scene-feature-ink); text-anchor: middle; letter-spacing: .02em; }
.coming-soon-plan {
  position: absolute; inset: 50% auto auto 50%; translate: -50% -50%; margin: 0; padding: var(--space-3) var(--space-6);
  border-radius: 999px; background: var(--color-scene-feature); color: var(--color-scene-feature-ink);
  font-size: 1.125rem; font-weight: var(--font-weight-bold); box-shadow: var(--shadow-sheet); pointer-events: none;
}

/* initials in the employee's colour, like a contact list */
.portrait.initials { background-color: color-mix(in oklch, var(--tint, var(--color-surface-sunken)) 30%, var(--color-surface-sheet)); color: color-mix(in oklch, var(--tint, var(--color-text-primary)) 45%, var(--color-text-primary)); }
.scene .initials-head { fill: color-mix(in oklch, var(--tint, var(--color-surface-sunken)) 35%, var(--color-surface-sheet)); }

/* Shadow test page */
.shadow-banner { border-left: 4px solid var(--color-status-working-fill); }
.shadow-banner h2 .icon { width: 20px; height: 20px; }
.shadow-banner p { max-width: 90ch; }
.shadow-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.shadow-detail { display: grid; gap: var(--space-5); position: sticky; top: calc(var(--space-9) + var(--space-5)); max-height: calc(100vh - var(--space-9) - var(--space-7)); overflow-y: auto; }
.shadow-table td.clip { max-width: 34ch; overflow: hidden; text-overflow: ellipsis; }
.shadow-table td.clip small { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 0.75rem; }
.shadow-table tr.is-open td { background: var(--color-surface-app); }
button.link { min-height: 0; padding: 0; background: none; box-shadow: none; font: inherit; color: var(--color-text-primary, inherit); text-align: left; text-decoration: underline; text-underline-offset: 3px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
pre.mail { margin: 0; padding: var(--space-4); max-height: 420px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; border-radius: var(--radius-control); background: var(--color-surface-sunken); font-family: var(--font-family-mono); font-size: 0.8125rem; line-height: 1.5; }
pre.mail.draft { max-height: none; background: var(--color-status-working-surface); }
.ai-note { padding: var(--space-3) var(--space-4); border-radius: var(--radius-control); background: var(--color-surface-app); }
.verdicts { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); border: 0; padding: 0; margin: 0; }
.verdicts legend { margin-bottom: var(--space-2); font-weight: var(--font-weight-semibold); }
@media (max-width: 1100px) { .shadow-layout { grid-template-columns: 1fr; } .shadow-detail { position: static; max-height: none; } }
