/* ============================================================
   The Crimson Floor v3 — premium 2.5D headquarters shell.
   Tokens from docs/DESIGN_SYSTEM.md + OFFICE_DESIGN_SPEC.md §5.
   The STAGE is 1600×900 logical units, uniformly scaled; all
   scene geometry lives in js/office-v3/layout.js, not here.
   ============================================================ */

@font-face { font-family: "Space Grotesk"; src: url("/assets/fonts/space-grotesk-latin.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: Inter; src: url("/assets/fonts/inter-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --crimson: #7A0F1A; --crimson-deep: #4A0A10; --crimson-bright: #D42B2B;
  --amber: #C9891B; --amber-soft: #FBBF24;
  --cream: #FBF8F2; --paper: #fff; --ink: #1A110E; --ink-2: #241614;
  --muted: #6B5B54; --line: #E8E0D8;
  --ok: #2E9E5B; --warn: #D42B2B; --idle: #8A7F76;
  --wall: #EFE4D6; --wall-dark: #E2D3C0; --floor: #D9C4A8;
  --wood: #A87C4F; --wood-dark: #8A6340;
  --font-d: "Space Grotesk", Inter, sans-serif;
  --font-b: Inter, system-ui, sans-serif;
  --r: 12px;
  --hdr-h: 58px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-b); background: var(--ink); color: var(--cream);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--amber-soft); outline-offset: 2px; }
.skip { position: absolute; top: -60px; left: 1rem; z-index: 99; padding: .6rem 1rem; background: var(--amber); color: var(--ink); font-weight: 600; border-radius: 8px; transition: top .15s; }
.skip:focus { top: .6rem; }
.muted, .muted * { color: rgba(251, 248, 242, .55); }

/* ── top navigation ── */
.hdr {
  position: fixed; inset: 0 0 auto 0; height: var(--hdr-h); z-index: 50;
  background: rgba(26, 17, 14, .96); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  display: flex; align-items: center; gap: 1rem; padding: 0 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.brand img { height: 32px; width: 32px; }
.brand-txt { font-family: var(--font-d); font-weight: 700; font-size: .95rem; line-height: 1.05; letter-spacing: -.02em; white-space: nowrap; }
.brand-txt span { display: block; font-weight: 400; font-size: .6rem; letter-spacing: .16em; text-transform: uppercase; color: var(--amber); }
.divider { width: 1px; height: 30px; background: rgba(255, 255, 255, .14); flex: none; }
.topnav { display: flex; gap: .15rem; margin-left: .25rem; overflow: hidden; }
.topnav button {
  font-family: var(--font-d); font-size: .72rem; font-weight: 600; letter-spacing: .06em;
  padding: .45rem .7rem; border-radius: 999px; color: rgba(251, 248, 242, .72);
  display: flex; align-items: center; gap: .35rem; white-space: nowrap;
}
.topnav button:hover { background: rgba(255, 255, 255, .07); color: var(--cream); }
.topnav button.active { background: var(--crimson); color: #fff; }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.live-pill {
  display: flex; align-items: center; gap: .4rem; font-family: var(--font-d);
  font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: #7ee2a8; background: rgba(46, 158, 91, .12); border: 1px solid rgba(46, 158, 91, .35);
  padding: .3rem .6rem; border-radius: 999px;
}
.live-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
.live-pill.stale { color: #f3b3b3; background: rgba(212, 43, 43, .12); border-color: rgba(212, 43, 43, .4); }
.live-pill.stale .dot { background: var(--warn); animation: none; }
#live-clock { font-size: .68rem; color: rgba(251, 248, 242, .55); font-variant-numeric: tabular-nums; white-space: nowrap; }
#live-ago { font-size: .64rem; color: rgba(251, 248, 242, .4); font-variant-numeric: tabular-nums; }
.icon-btn {
  position: relative; width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; color: rgba(251, 248, 242, .75);
}
.icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
#bell-count {
  position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px;
  border-radius: 8px; background: var(--crimson-bright); color: #fff;
  font-size: .6rem; font-weight: 700; display: grid; place-items: center; padding: 0 3px;
}
.owner-wrap { position: relative; }
#owner-menu-btn {
  display: flex; align-items: center; gap: .4rem; font-family: var(--font-d);
  font-size: .72rem; font-weight: 600; padding: .4rem .7rem;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px;
  color: rgba(251, 248, 242, .85);
}
#owner-menu-btn:hover { border-color: var(--amber); color: #fff; }
#owner-pop {
  position: absolute; right: 0; top: calc(100% + 8px); width: 240px;
  background: var(--ink-2); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px; padding: .6rem; z-index: 60;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
}
#owner-pop .pop-title { font-family: var(--font-d); font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--amber); margin-bottom: .35rem; }
#owner-pop .pop-note { font-size: .74rem; line-height: 1.45; color: rgba(251, 248, 242, .7); }

/* ── app frame ── */
.app {
  position: fixed; inset: var(--hdr-h) 0 0 0;
  display: grid; grid-template-columns: 64px 1fr 330px;
}
/* side rail */
.rail {
  background: rgba(20, 13, 11, .9); border-right: 1px solid rgba(255, 255, 255, .07);
  display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .8rem 0;
}
.rail button {
  width: 48px; padding: .45rem 0 .3rem; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  color: rgba(251, 248, 242, .6); font-size: .54rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; font-family: var(--font-d);
}
.rail button svg { width: 18px; height: 18px; }
.rail button:hover { background: rgba(255, 255, 255, .07); color: var(--cream); }
.rail button.active { background: var(--crimson); color: #fff; }

/* centre view */
.view { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.stage-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #14100d; }

/* quick actions */
.quick {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem;
  padding: .6rem .8rem; background: rgba(20, 13, 11, .92);
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.quick button {
  display: flex; align-items: center; gap: .6rem; text-align: left;
  background: linear-gradient(180deg, rgba(122, 15, 26, .35), rgba(122, 15, 26, .16));
  border: 1px solid rgba(212, 43, 43, .3); border-radius: 10px; padding: .5rem .7rem;
  min-width: 0;
}
.quick button:hover { border-color: var(--amber); background: rgba(122, 15, 26, .5); }
.quick .q-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--crimson); display: grid; place-items: center; flex: none; }
.quick .q-ico svg { width: 15px; height: 15px; }
.quick .q-txt { min-width: 0; }
.quick .q-txt b { display: block; font-family: var(--font-d); font-size: .74rem; font-weight: 700; }
.quick .q-txt span { display: block; font-size: .64rem; color: rgba(251, 248, 242, .55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* right side panel */
.side {
  background: rgba(20, 13, 11, .92); border-left: 1px solid rgba(255, 255, 255, .07);
  padding: .9rem; overflow-y: auto; display: flex; flex-direction: column; gap: .9rem;
}
.side h2 {
  font-family: var(--font-d); font-size: .66rem; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--amber); display: flex; align-items: center; gap: .4rem;
}
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.metric { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); border-radius: 10px; padding: .55rem .65rem; }
.metric.wide { grid-column: span 2; }
.metric .n { font-family: var(--font-d); font-size: 1.35rem; font-weight: 700; color: var(--amber-soft); line-height: 1; }
.metric.alert .n { color: var(--crimson-bright); }
.metric .l { font-size: .6rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(251, 248, 242, .5); margin-top: .2rem; }
.side ol { list-style: none; display: flex; flex-direction: column; gap: .45rem; }
.side li { display: flex; gap: .45rem; font-size: .74rem; line-height: 1.35; animation: slideIn .35s ease; }
.side .who { font-weight: 700; color: var(--amber-soft); white-space: nowrap; }
.side .what { color: rgba(251, 248, 242, .85); }
.side .when { margin-left: auto; color: rgba(251, 248, 242, .4); white-space: nowrap; font-variant-numeric: tabular-nums; }
.overview { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.ov { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); border-radius: 10px; padding: .5rem .6rem; display: flex; gap: .45rem; align-items: center; }
.ov b { font-family: var(--font-d); font-size: 1.1rem; color: var(--cream); }
.ov span { font-size: .64rem; color: rgba(251, 248, 242, .55); line-height: 1.2; }

/* ── stage ── */
.stage {
  position: absolute; left: 0; top: 0; width: 1600px; height: 900px;
  transform-origin: 0 0; user-select: none;
}
.layer { position: absolute; inset: 0; }
.layer-floor { z-index: 0; }
.layer-walls { z-index: 10; pointer-events: none; }
.layer-zones { z-index: 30; }
.layer-depth { z-index: 100; }
.layer-chips { z-index: 600; pointer-events: none; }
.layer-overlay { z-index: 700; pointer-events: none; }

/* interim architectural planes — replaced by TEX/ENV assets in Phase 7 QA */
.floor-plane {
  position: absolute; left: 0; right: 0; top: 270px; bottom: 0;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.05) 0 2px, transparent 2px 86px),
    repeating-linear-gradient(0deg, rgba(0,0,0,.06) 0 1px, transparent 1px 44px),
    linear-gradient(180deg, #C9AE8A 0%, var(--floor) 30%, #CDB693 100%);
  box-shadow: inset 0 40px 60px rgba(0, 0, 0, .18);
}
.wall-back {
  position: absolute; left: 0; right: 0; top: 0; height: 272px;
  background: linear-gradient(180deg, #F4EBDF 0%, var(--wall) 70%, var(--wall-dark) 100%);
  border-bottom: 5px solid var(--wood-dark);
}
.wall-left {
  position: absolute; left: 0; top: 0; bottom: 0; width: 96px;
  background: linear-gradient(90deg, #E7D9C6, var(--wall-dark));
  border-right: 3px solid rgba(138, 99, 64, .5);
}
.wall-right {
  position: absolute; right: 0; top: 0; bottom: 0; width: 112px;
  background: linear-gradient(270deg, #E7D9C6, var(--wall-dark));
  border-left: 3px solid rgba(138, 99, 64, .5);
}

/* zones (invisible hit areas) */
.zone { position: absolute; background: transparent; border-radius: 14px; }
.zone:hover { background: rgba(201, 137, 27, .08); box-shadow: inset 0 0 0 1px rgba(201, 137, 27, .4); }

/* sprites */
.sprite {
  position: absolute; left: var(--sx); top: var(--sy);
  width: var(--sw); height: var(--sh);
  transform: translate(-50%, -100%);
  pointer-events: none; background: none; border: 0; padding: 0;
}
.sprite.interactive { pointer-events: auto; cursor: pointer; border-radius: 8px; }
.sprite.interactive:hover { filter: brightness(1.06); }
.sprite-img { display: block; width: 100%; height: 100%; object-fit: contain; }
.sprite.missing .sprite-img { display: none; }

/* room chips */
.chip {
  position: absolute; transform: translate(-50%, 0);
  background: rgba(26, 17, 14, .9); border: 1px solid rgba(212, 43, 43, .55);
  border-radius: 999px; padding: .3rem .75rem; text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35); white-space: nowrap;
}
.chip-label { display: block; font-family: var(--font-d); font-weight: 700; font-size: 15px; color: #fff; letter-spacing: -.01em; }
.chip-sub { display: block; font-size: 10px; color: var(--amber-soft); letter-spacing: .1em; text-transform: uppercase; }

/* ── characters ── */
.char {
  position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 100;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.char .fig {
  position: absolute; left: 0; bottom: 0; transform: translateX(-50%);
  padding: 6px;                 /* clickable hit area around the sprite */
}
.char-img {
  display: block; width: 110px; height: auto; max-height: 180px;
  transition: opacity .13s ease;
}
.char.sitting .char-img { width: 122px; }
.char-img.flip { transform: scaleX(-1); }
.char-img.fade { opacity: 0; }
.char.walking .char-img { animation: bob .46s ease-in-out infinite; }
.char.talking .char-img { animation: none; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.char.walking .char-img.flip { animation: bobf .46s ease-in-out infinite; }
@keyframes bobf { 0%, 100% { transform: scaleX(-1) translateY(0); } 50% { transform: scaleX(-1) translateY(-3px); } }

.char .tag {
  position: absolute; left: 0; bottom: calc(var(--head, 175px) + 8px);
  transform: translateX(-50%); display: flex; align-items: center; gap: .3rem;
  background: rgba(26, 17, 14, .92); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px; padding: .18rem .55rem; white-space: nowrap;
  font-family: var(--font-d); font-size: 13px; font-weight: 700; color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
.sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); flex: none; display: inline-block; }
.sdot.working { background: var(--ok); }
.sdot.blocked { background: var(--warn); }
.sdot.idle { background: var(--idle); }

.char .bubble {
  position: absolute; left: 0; bottom: calc(var(--head, 175px) + 40px);
  transform: translateX(-50%) scale(.9); opacity: 0; pointer-events: none;
  max-width: 240px; background: var(--cream); color: var(--ink);
  border-radius: 12px; padding: .35rem .6rem; font-size: 12.5px; line-height: 1.35;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .35); transition: opacity .18s ease, transform .18s ease;
  white-space: normal; width: max-content;
}
.char .bubble.show { opacity: 1; transform: translateX(-50%) scale(1); }
.char .bubble.warn { background: #FFE9E9; color: var(--crimson-deep); box-shadow: 0 0 0 2px rgba(212, 43, 43, .35), 0 8px 22px rgba(0, 0, 0, .35); }
.char .bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--cream); border-bottom: 0;
}
.char .bubble.warn::after { border-top-color: #FFE9E9; }

/* ── drawer ── */
.drawer {
  position: fixed; top: var(--hdr-h); right: 0; bottom: 0; width: min(560px, 94vw);
  background: #17100d; border-left: 1px solid rgba(255, 255, 255, .12);
  transform: translateX(105%); transition: transform .32s cubic-bezier(.2, .8, .25, 1);
  z-index: 80; display: flex; flex-direction: column; box-shadow: -24px 0 60px rgba(0, 0, 0, .5);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.drawer-head .avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--crimson);
  display: grid; place-items: center; font-family: var(--font-d); font-weight: 700; font-size: .85rem;
  flex: none; overflow: hidden;
}
.drawer-id { min-width: 0; flex: 1; }
.drawer-id h2 { font-family: var(--font-d); font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }
.drawer-id .sub { font-size: .74rem; color: rgba(251, 248, 242, .55); }
.drawer-state {
  font-family: var(--font-d); font-size: .64rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; padding: .28rem .6rem; border-radius: 999px;
  background: rgba(255, 255, 255, .08); color: rgba(251, 248, 242, .8); white-space: nowrap;
}
.drawer-state.working { background: rgba(46, 158, 91, .18); color: #7ee2a8; }
.drawer-state.blocked { background: rgba(212, 43, 43, .18); color: #f3b3b3; }
.drawer-close {
  font-family: var(--font-d); font-size: .7rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; padding: .4rem .75rem; border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 8px; color: rgba(251, 248, 242, .85);
}
.drawer-close:hover { border-color: var(--amber); color: #fff; }
.drawer-body { flex: 1; overflow-y: auto; padding: 1rem; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.panel {
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 10px; padding: .7rem .8rem;
}
.panel.wide { grid-column: 1 / -1; }
.panel.wish { border-color: rgba(201, 137, 27, .4); }
.panel h3 {
  font-family: var(--font-d); font-size: .64rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--amber); margin-bottom: .5rem;
}
.panel h3 small { color: rgba(251, 248, 242, .4); letter-spacing: .06em; }
.panel .line { font-size: .8rem; line-height: 1.5; color: rgba(251, 248, 242, .82); margin-bottom: .35rem; }
.list { display: flex; flex-direction: column; gap: .4rem; }
.item { display: flex; gap: .45rem; align-items: baseline; font-size: .78rem; line-height: 1.4; color: rgba(251, 248, 242, .85); }
.item .time { margin-left: auto; color: rgba(251, 248, 242, .4); font-size: .7rem; white-space: nowrap; }
.item .who { font-weight: 700; color: var(--amber-soft); }
.empty { font-size: .78rem; color: rgba(251, 248, 242, .45); font-style: italic; }
.pill {
  font-family: var(--font-d); font-size: .58rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: .14rem .42rem; border-radius: 999px;
  background: rgba(255, 255, 255, .1); color: rgba(251, 248, 242, .8); flex: none;
}
.pill.blocked, .pill.failed { background: rgba(212, 43, 43, .22); color: #f3b3b3; }
.pill.completed { background: rgba(46, 158, 91, .2); color: #7ee2a8; }
.pill.running, .pill.queued { background: rgba(201, 137, 27, .2); color: var(--amber-soft); }
.pill.handoff { background: rgba(122, 15, 26, .35); color: #f0c9cd; }
.tick { color: var(--ok); font-weight: 700; }

.emp-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; }
.emp-portrait { width: 84px; height: 84px; border-radius: 14px; object-fit: cover; border: 2px solid rgba(255, 255, 255, .15); }

.compose { margin-top: .9rem; background: rgba(122, 15, 26, .14); border: 1px solid rgba(212, 43, 43, .3); border-radius: 10px; padding: .8rem; }
.compose label { display: block; font-family: var(--font-d); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--amber-soft); margin-bottom: .45rem; }
.compose-row { display: flex; gap: .5rem; }
.compose textarea {
  flex: 1; resize: vertical; min-height: 54px; background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 8px; color: var(--cream);
  padding: .5rem .6rem; font: inherit; font-size: .84rem;
}
.compose textarea:focus { outline: none; border-color: var(--amber); }
.btn {
  font-family: var(--font-d); font-size: .74rem; font-weight: 700; letter-spacing: .06em;
  background: var(--crimson); color: #fff; border-radius: 8px; padding: .55rem 1rem;
  border: 1px solid rgba(255, 255, 255, .1); align-self: stretch;
}
.btn:hover { background: var(--crimson-bright); }
.btn:disabled { opacity: .55; cursor: default; }
.key-row { display: flex; gap: .5rem; margin-top: .5rem; }
.key-row input {
  flex: 1; background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px; color: var(--cream); padding: .45rem .6rem; font: inherit; font-size: .84rem;
}
.note-status { font-size: .76rem; margin-top: .45rem; color: var(--amber-soft); min-height: 1em; }
.hint { font-size: .7rem; color: rgba(251, 248, 242, .5); margin-top: .4rem; line-height: 1.45; }

.list.people { gap: .5rem; }
.person {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "dot name state" "dot role task";
  gap: .1rem .55rem; text-align: left; width: 100%;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 10px; padding: .6rem .75rem; align-items: center;
}
.person:hover { border-color: rgba(201, 137, 27, .5); background: rgba(255, 255, 255, .07); }
.person .sdot { grid-area: dot; width: 10px; height: 10px; }
.p-name { grid-area: name; font-family: var(--font-d); font-weight: 700; font-size: .9rem; }
.p-role { grid-area: role; font-size: .72rem; color: rgba(251, 248, 242, .55); }
.p-task { grid-area: task; font-size: .7rem; color: var(--amber-soft); text-align: right; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(16px);
  background: var(--ink-2); border: 1px solid rgba(201, 137, 27, .5); color: var(--cream);
  padding: .6rem 1rem; border-radius: 10px; font-size: .82rem; z-index: 90;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  max-width: min(480px, 90vw); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── debug mode (?debug=1) ── */
body.debug .zone { box-shadow: inset 0 0 0 1.5px rgba(201, 137, 27, .55); }
body.debug .zone-tag {
  position: absolute; left: 4px; top: 4px; font: 700 11px/1 var(--font-d);
  color: var(--amber-soft); background: rgba(0, 0, 0, .55); padding: 2px 5px; border-radius: 4px;
}
body.debug .sprite.missing { box-shadow: inset 0 0 0 1.5px rgba(212, 43, 43, .6); background: rgba(212, 43, 43, .05); }
body.debug .missing-tag {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font: 700 10px/1.2 var(--font-d); color: #ffb3b3; text-align: center;
  background: rgba(0, 0, 0, .6); padding: 3px 5px; border-radius: 4px; max-width: 95%;
}
.debug-graph { position: absolute; inset: 0; width: 100%; height: 100%; }
.debug-edge { stroke: rgba(46, 158, 91, .75); stroke-width: 2; stroke-dasharray: 6 5; }
.debug-node { fill: rgba(46, 158, 91, .9); stroke: #0b3d1f; stroke-width: 1.5; }
.debug-node-label { font: 700 11px var(--font-d); fill: #9ff0c0; paint-order: stroke; stroke: rgba(0, 0, 0, .75); stroke-width: 3px; }
body.debug .char .tag { border-color: var(--amber); }

/* ── responsive ── */
@media (max-width: 1180px) {
  .app { grid-template-columns: 64px 1fr; }
  .side { display: none; }
}
@media (max-width: 900px) {
  .topnav { display: none; }
  .quick { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  #live-clock, #live-ago { display: none; }
  .brand-txt span { display: none; }
  .drawer { width: 100vw; }
  .grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .char.walking .char-img, .char.walking .char-img.flip { animation: none; }
  .live-pill .dot { animation: none; }
  .drawer { transition: none; }
}

/* ── boardroom meeting box ── */
.meeting-box { display: flex; flex-direction: column; gap: .55rem; }
.meeting-box > label { font-family: var(--font-d); font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--amber-soft); }
.meeting-box input[type="text"] {
  background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.16); border-radius: 8px;
  color: var(--cream); padding: .55rem .7rem; font: inherit; font-size: .88rem;
}
.meeting-box input[type="text"]:focus { outline: none; border-color: var(--amber); }
.mt-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .35rem; }
.mt-p {
  display: flex; align-items: center; gap: .45rem; font-size: .8rem;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.09);
  border-radius: 8px; padding: .35rem .5rem; cursor: pointer;
}
.mt-p:hover { border-color: rgba(201,137,27,.5); }
.mt-p input { accent-color: var(--crimson-bright); }
.mt-row { display: flex; gap: .5rem; }
.btn-ghost {
  font-family: var(--font-d); font-size: .74rem; font-weight: 700; letter-spacing: .06em;
  background: none; border: 1px solid rgba(255,255,255,.25); color: rgba(251,248,242,.85);
  border-radius: 8px; padding: .55rem 1rem;
}
.btn-ghost:hover { border-color: var(--amber); color: #fff; }

/* ── executive data (owners / Martha offices) ── */
.exec-bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: .35rem; }
.exec-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--crimson-bright)); border-radius: 999px; }

/* collab zone form */
.cb-pair { display: flex; gap: .6rem; }
.cb-pair label { flex: 1; display: flex; flex-direction: column; gap: .25rem;
  font-family: var(--font-d); font-size: .64rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--amber-soft); }
.meeting-box select {
  background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.16); border-radius: 8px;
  color: var(--cream); padding: .5rem .55rem; font: inherit; font-size: .86rem; text-transform: none;
  letter-spacing: normal;
}
.meeting-box textarea {
  background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.16); border-radius: 8px;
  color: var(--cream); padding: .55rem .7rem; font: inherit; font-size: .86rem; resize: vertical;
}
.meeting-box textarea:focus, .meeting-box select:focus { outline: none; border-color: var(--amber); }
.mt-row .btn-ghost { padding: .3rem .6rem; font-size: .66rem; }

/* ── persistent chat thread ── */
.chat-list { max-height: 220px; overflow-y: auto; gap: .4rem; }
.chat-msg {
  display: flex; flex-direction: column; gap: .1rem; padding: .45rem .6rem;
  border-radius: 10px; font-size: .8rem; line-height: 1.4; max-width: 92%;
}
.chat-msg.from-us { background: rgba(122, 15, 26, .35); border: 1px solid rgba(212, 43, 43, .35); align-self: flex-end; margin-left: auto; }
.chat-msg.from-them { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.cm-who { font-family: var(--font-d); font-size: .6rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--amber-soft); }
.cm-text { color: rgba(251,248,242,.92); word-break: break-word; }
.cm-time { font-size: .64rem; color: rgba(251,248,242,.4); }

/* ── learned memories ── */
.mem-item { flex-wrap: wrap; }
.mem-text { flex: 1; min-width: 140px; }
.mem-propose { display: flex; gap: .45rem; margin-top: .55rem; align-items: flex-start; }
.mem-propose textarea {
  flex: 1; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px; color: var(--cream); padding: .45rem .6rem; font: inherit; font-size: .82rem;
  resize: vertical; min-height: 46px;
}
.mem-propose textarea:focus { outline: none; border-color: var(--amber); }
.nc-label small { color: rgba(251,248,242,.45); font-weight: 400; letter-spacing: 0; text-transform: none; }

/* ── conversations viewer ── */
.conv-item {
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.09);
  border-radius: 10px; padding: .55rem .65rem; display: flex; flex-direction: column; gap: .35rem;
}
.conv-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.conv-who { font-family: var(--font-d); font-weight: 700; font-size: .84rem; color: var(--amber-soft); }
.conv-topic { font-size: .72rem; color: rgba(251,248,242,.55); font-style: italic; }
.conv-item .chat-msg { max-width: 100%; }

/* ── Phase 10 login + account menu ── */
.login-screen {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: radial-gradient(1200px 700px at 30% 20%, rgba(122,15,26,.35), transparent 60%),
              linear-gradient(180deg, #1A110E 0%, #14100d 100%);
}
.login-card {
  width: min(400px, 92vw); background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.12); border-radius: 16px;
  padding: 2rem 2.2rem; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.login-card img { margin-bottom: .6rem; }
.login-card h1 { font-family: var(--font-d); font-size: 1.5rem; letter-spacing: -.02em; }
.login-sub { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--amber); margin: .3rem 0 1.3rem; }
.login-card form { display: flex; flex-direction: column; gap: .5rem; text-align: left; }
.login-card label { font-family: var(--font-d); font-size: .64rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(251,248,242,.7); }
.login-card input {
  background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.18); border-radius: 8px;
  color: var(--cream); padding: .65rem .75rem; font: inherit; font-size: .95rem;
}
.login-card input:focus { outline: none; border-color: var(--amber); }
.login-card .btn { margin-top: .5rem; padding: .7rem; font-size: .9rem; }
.login-hint { font-size: .7rem; color: rgba(251,248,242,.45); margin-top: 1rem; line-height: 1.5; }
.pop-actions { display: flex; gap: .45rem; margin-top: .5rem; }
#owner-chpw { display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; }
#owner-chpw input {
  background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.18); border-radius: 8px;
  color: var(--cream); padding: .45rem .6rem; font: inherit; font-size: .85rem;
}
#owner-chpw input:focus { outline: none; border-color: var(--amber); }

/* ── hidden must always win (author display rules beat the UA [hidden] rule) ── */
[hidden] { display: none !important; }
