:root {
  --bg: #f6efe9; --card: #ffffff; --ink: #1f2430; --muted: #5f6675; --line: #eadfd6;
  --emerald: #047857; --emerald-soft: #d1fae5; --amber: #d97706; --amber-soft: #fef3c7; --red: #b91c1c; --red-soft: #fee2e2; --teal: #0f766e; --blue: #2f6bff; --pill: #1b2130;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; display: flex; flex-direction: column; overflow: hidden; }
button { font: inherit; cursor: pointer; color: inherit; }
.top { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); flex-wrap: wrap; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { margin: 0; font-size: 16px; } .brand p { margin: 0; color: var(--muted); font-size: 12px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--emerald); position: relative; }
.logo::after { content: ""; position: absolute; inset: 7px; background: #fbbf24; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.chip b { font-weight: 700; } .chip.warn { background: var(--amber-soft); border-color: #f5d28a; } .chip.bad { background: var(--red-soft); border-color: #f2b1b1; } .chip.good { background: var(--emerald-soft); border-color: #a7e3c7; }
.conn { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.dot { flex: none; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #9ca3af; } .dot.ok { background: #10b981; } .dot.err { background: #dc2626; } .dot.warn { background: #f59e0b; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; } .ghost:hover { background: var(--bg); }

/* the office fills everything below the header */
.stage { position: relative; flex: 1; min-height: 0; background: radial-gradient(120% 100% at 50% 0%, #fbf3ee 0%, #f1e2da 100%); overflow: hidden; }
#office { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; outline-offset: -3px; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.labels > * { position: absolute; left: 0; top: 0; pointer-events: auto; will-change: transform; transform-origin: 50% 100%; }

.tag { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.94); border: 1px solid rgba(0,0,0,.06); border-radius: 999px; padding: 3px 10px 3px 8px; box-shadow: 0 2px 8px rgba(60,40,30,.16); font-size: 12px; white-space: nowrap; }
.tag i { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,.9); }
.tag b, .tag .tag-name { font-weight: 700; } .tag small { color: var(--muted); font-size: 11px; display: none; } .labels.close .tag small, .tag.sel small { display: inline; } .tag.sel { outline: 2px solid var(--amber); }
.zone { display: flex; align-items: center; gap: 7px; background: rgba(255,255,255,.7); border: 1px solid rgba(0,0,0,.05); backdrop-filter: blur(4px); border-radius: 10px; padding: 3px 10px; font-size: 12px; white-space: nowrap; box-shadow: 0 1px 6px rgba(60,40,30,.1); }
.zone i { width: 10px; height: 10px; border-radius: 3px; } .zone small { color: var(--muted); }
.objchip { display: flex; flex-direction: column; align-items: center; background: rgba(255,255,255,.95); border: 1px solid rgba(0,0,0,.06); border-radius: 12px; padding: 3px 10px; font-size: 11.5px; line-height: 1.25; box-shadow: 0 2px 8px rgba(60,40,30,.16); white-space: nowrap; }
.objchip small { color: var(--muted); } .objchip.off { background: rgba(240,240,242,.95); border-style: dashed; border-color: #9ca3af; color: #6b7280; } .objchip.off small { color: #6b7280; font-weight: 700; }

/* floating notification pills */
.bubble { background: var(--pill); color: #fff; border-radius: 16px; padding: 6px 7px 6px 11px; width: max-content; max-width: 210px; box-shadow: 0 6px 18px rgba(20,24,40,.38); }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; background: var(--pill); transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.bubble .who { display: block; color: #9fb0d0; font-size: 10.5px; letter-spacing: .02em; margin-bottom: 1px; }
.bubble .row { display: flex; align-items: center; gap: 8px; }
.bubble .txt { font-size: 12.5px; font-weight: 650; line-height: 1.25; text-align: left; overflow-wrap: anywhere; }
.bubble .act { background: var(--blue); color: #fff; border: 0; border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 700; flex: none; } .bubble .act:hover { background: #4a80ff; }
.bubble.alert { background: #5b1620; } .bubble.alert::after { background: #5b1620; } .bubble.done { background: #0b4a3a; } .bubble.done::after { background: #0b4a3a; }

.toolbar { position: absolute; right: 12px; top: 12px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; background: rgba(255,255,255,.88); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 4px 14px rgba(60,40,30,.12); z-index: 12; max-width: calc(100% - 24px); }
.toolbar button { min-width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: #fff; padding: 0 10px; font-weight: 600; }
.toolbar button:hover { border-color: var(--emerald); } .toolbar .sep { width: 1px; background: var(--line); margin: 3px 2px; }
.rooms { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 12; max-width: 55%; }
.rooms button { background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: 12.5px; box-shadow: 0 2px 8px rgba(60,40,30,.1); display: flex; gap: 6px; align-items: center; }
.rooms button i { width: 9px; height: 9px; border-radius: 3px; } .rooms button:hover, .rooms button.on { border-color: var(--emerald); }
.hover { position: absolute; pointer-events: none; background: #111827; color: #fff; padding: 6px 9px; border-radius: 8px; font-size: 12px; max-width: 260px; z-index: 45; }
.legend { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 10px; flex-wrap: wrap; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 10px; padding: 5px 10px; font-size: 11.5px; max-width: 60%; z-index: 11; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(246,239,233,.93); padding: 24px; text-align: center; z-index: 60; }
.overlay .box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; max-width: 420px; box-shadow: 0 10px 30px rgba(0,0,0,.06); }
.overlay h2 { margin: 0 0 8px; font-size: 18px; } .overlay p { color: var(--muted); margin: 6px 0; }
.overlay form { display: grid; gap: 8px; margin-top: 12px; text-align: left; } .overlay input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.primary { background: var(--emerald); color: #fff; border: 0; border-radius: 9px; padding: 8px 14px; font-weight: 600; } .primary:hover { background: #065f46; }

/* detail panel floats over the right side of the office */
.panel { position: absolute; right: 12px; top: 64px; bottom: 44px; width: 372px; background: rgba(255,255,255,.97); border: 1px solid var(--line); border-radius: 18px; display: flex; flex-direction: column; min-height: 0; box-shadow: 0 14px 40px rgba(60,40,30,.22); z-index: 25; overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--line); } .tabs button { flex: 1; padding: 10px 2px; background: none; border: 0; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 600; font-size: 13px; }
.tabs button[aria-selected="true"] { color: var(--emerald); border-bottom-color: var(--amber); } .tabs .x { flex: 0 0 38px; font-size: 20px; line-height: 1; }
.count { background: var(--amber); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11px; margin-left: 4px; }
.view { padding: 14px; overflow: auto; flex: 1; }
.view h2 { margin: 0 0 2px; font-size: 18px; } .view h3 { margin: 16px 0 6px; font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); } .sub { color: var(--muted); margin: 0 0 10px; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; background: var(--bg); border: 1px solid var(--line); }
.pill.working { background: var(--emerald-soft); color: var(--emerald); } .pill.awaiting_approval { background: var(--amber-soft); color: #92400e; } .pill.alert { background: var(--red-soft); color: var(--red); } .pill.awaiting_review { background: #ccfbf1; color: var(--teal); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; margin: 10px 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; } .item.click { width: 100%; text-align: left; display: block; } .item.click:hover, .item.click:focus-visible { border-color: var(--emerald); }
.item small { color: var(--muted); display: block; } .item .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.empty { color: var(--muted); padding: 12px; border: 1px dashed var(--line); border-radius: 10px; }
.feed li { border-left: 3px solid var(--line); padding: 2px 0 2px 9px; } .feed li.new { border-left-color: var(--amber); }
.feed time { color: var(--muted); font-size: 11px; display: block; }
.err { background: var(--red-soft); color: var(--red); border: 1px solid #f2b1b1; border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; }
.ok { background: var(--emerald-soft); color: var(--emerald); border: 1px solid #a7e3c7; border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; }
.foot { display: flex; justify-content: space-between; gap: 12px; padding: 5px 16px; border-top: 1px solid var(--line); background: rgba(255,255,255,.92); color: var(--muted); font-size: 12px; flex-wrap: wrap; z-index: 20; }

/* employee card */
.emp-head { display: flex; gap: 12px; align-items: center; }
.avatar { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: #fff; font-size: 22px; font-weight: 800; flex: none; box-shadow: inset 0 -4px 0 rgba(0,0,0,.12); }
.chiprow { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.now { background: #f7f2ec; border-radius: 12px; padding: 10px 12px; margin: 10px 0; } .now small { display: block; color: var(--muted); font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; } .now b { display: block; margin-top: 2px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 6px; text-align: center; } .tile b { display: block; font-size: 20px; } .tile span { color: var(--muted); font-size: 11px; line-height: 1.2; display: block; }
.tile.na b { color: #9ca3af; font-size: 16px; padding-top: 3px; }
.graph { width: 100%; height: 86px; display: block; background: #fbf8f4; border: 1px solid var(--line); border-radius: 10px; }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 3px; }
.actions { display: grid; gap: 8px; margin: 14px 0 4px; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 12px; font-weight: 700; text-align: left; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.btn:hover:not(:disabled) { border-color: var(--emerald); } .btn:disabled { color: #8b92a0; background: #f4f1ed; cursor: not-allowed; } .btn small { font-weight: 500; color: #7a8190; }
.btn.go { background: var(--emerald); color: #fff; border-color: var(--emerald); } .btn.pause { background: var(--amber-soft); border-color: #f5d28a; }
.navs, .zoomc { display: flex; gap: 6px; } .handle { display: none; }
@media (max-width: 820px) {
  .top { padding: 6px 10px; gap: 6px 8px; flex-wrap: wrap; } .brand { flex: none; } .brand p, .brand h1 + p { display: none; } .brand h1 { font-size: 15px; }
  .logo { width: 26px; height: 26px; } .conn { margin-left: auto; min-width: 0; gap: 6px; font-size: 11.5px; } #conn-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
  .chips { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; } .chip { flex: none; white-space: nowrap; }
  body { --dock: 56px; }
  .toolbar { display: contents; } .toolbar .sep { display: none; }
  .zoomc { position: absolute; right: 8px; top: 8px; flex-direction: column; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 14px; padding: 4px; box-shadow: 0 4px 14px rgba(60,40,30,.12); z-index: 14; }
  .zoomc button { min-width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 700; padding: 0; }
  .navs { position: absolute; left: 8px; right: 8px; bottom: 8px; justify-content: space-between; background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 16px; padding: 5px; box-shadow: 0 6px 18px rgba(60,40,30,.18); z-index: 13; }
  .navs button { flex: 1; height: 42px; border-radius: 11px; border: 1px solid var(--line); background: #fff; font-weight: 650; font-size: 13.5px; padding: 0 6px; }
  .rooms { top: 8px; bottom: auto; left: 8px; right: 62px; max-width: none; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; } .rooms::-webkit-scrollbar { display: none; } .rooms button { flex: none; white-space: nowrap; padding: 7px 12px; }
  .legend { display: none; } .hover { display: none; }
  .labels.mini .bubble { max-width: 130px; padding: 4px 10px 4px 8px; border-radius: 999px; cursor: pointer; } .labels.mini .bubble .row { display: none; } .labels.mini .bubble .who { color: #fff; font-size: 11px; font-weight: 700; margin: 0; white-space: nowrap; }
  .labels.mini .bubble .who::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; margin-right: 6px; } .labels.mini .bubble.alert .who::before { background: #fca5a5; } .labels.mini .bubble.done .who::before { background: #6ee7b7; } .labels.mini .bubble.review .who::before { background: #5eead4; }
  .labels.mini .tag small, .labels.mini .objchip { display: none; }
  .stage .stale { left: 8px; right: 62px; top: 52px; bottom: auto; height: auto; transform: none; max-width: none; font-size: 12px; padding: 5px 6px 5px 10px; justify-content: space-between; }
  .panel { left: 0; right: 0; width: auto; top: auto; bottom: 0; height: 44%; border-radius: 20px 20px 0 0; z-index: 25; box-shadow: 0 -10px 30px rgba(60,40,30,.22); transition: height .22s ease; padding-top: 0; }
  .panel.expanded { height: 86%; }
  .handle { display: block; flex: none; width: 100%; height: 26px; border: 0; background: transparent; padding: 0; touch-action: none; cursor: grab; } .handle span { display: block; width: 44px; height: 5px; border-radius: 3px; background: #cdbfb6; margin: 9px auto 0; }
  .foot span:last-child { display: none; } .foot { padding: 3px 12px; }
  /* compact floating notifications and name tags so they never cover each other or the controls */
  .bubble { max-width: 150px; padding: 4px 5px 4px 8px; border-radius: 13px; } .bubble .who { font-size: 9.5px; } .bubble .txt { font-size: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .bubble .act { padding: 3px 8px; font-size: 11px; } .tag { padding: 2px 8px 2px 6px; font-size: 11px; } .objchip { display: none; } .labels.close .objchip { display: flex; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* not-live states are visible on the stage itself, never just in the header */
.stale { position: absolute; left: 50%; bottom: 58px; transform: translateX(-50%); z-index: 30; background: #fff7e6; border: 1px solid #f5d28a; color: #7a4a05; border-radius: 12px; padding: 6px 8px 6px 12px; display: flex; gap: 10px; align-items: center; font-weight: 600; box-shadow: 0 4px 14px rgba(60,40,30,.18); max-width: calc(100% - 24px); }
body[data-conn="cached"] #office { filter: grayscale(.55) brightness(.97); }
body[data-conn="cached"] .labels .bubble { opacity: .6; } body[data-conn="cached"] .labels .tag i { filter: grayscale(1); }

/* ---------------- DEMO MODE ---------------- */
.demo-banner { background: #b45309; color: #fff; font-weight: 700; font-size: 12.5px; letter-spacing: .02em; text-align: center; padding: 5px 12px; z-index: 40; }
.demo-bar { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: #fff7e6; border-bottom: 1px solid #f5d28a; flex-wrap: wrap; z-index: 19; }
.demo-bar button, .demo-bar select { height: 32px; border-radius: 9px; border: 1px solid var(--line); background: #fff; padding: 0 10px; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.demo-bar button.primary { background: var(--emerald, #047857); border-color: var(--emerald, #047857); color: #fff; }
.demo-bar button:disabled { opacity: .45; cursor: not-allowed; }
.demo-bar .speed { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.demo-status { flex: 1 1 220px; min-width: 160px; font-size: 12.5px; color: #7a4a05; font-weight: 600; }
.demo-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.demo-nav .count { background: var(--amber, #d97706); color: #fff; border-radius: 999px; padding: 0 6px; margin-left: 5px; font-size: 11px; }
.tabs { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; } .tabs::-webkit-scrollbar { display: none; } .tabs button { flex: none; white-space: nowrap; }
.cmdform textarea, .noteform textarea, .noteform input, .msgform input, .filters input, .filters select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; background: #fff; }
.cmdform textarea { resize: vertical; margin: 8px 0; } .noteform input { margin: 6px 0; } .noteform textarea { margin-bottom: 6px; }
.actions.inline { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.plan { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: #fffdf9; margin: 12px 0; }
.quote { font-style: italic; color: #5b4a3d; margin: 4px 0 8px; }
.steps { padding-left: 20px; margin: 8px 0; } .steps li { margin-bottom: 6px; } .steps .block { display: block; color: var(--muted); }
.list.progress .item { padding: 8px 10px; }
.kv.small dt { font-size: 11px; } .kv.small dd { font-size: 12.5px; }
.item.approval { border-left: 4px solid var(--amber, #d97706); }
.subtabs { display: flex; gap: 4px; overflow-x: auto; margin: 8px 0; scrollbar-width: none; } .subtabs::-webkit-scrollbar { display: none; }
.subtabs button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 10px; font-weight: 600; font-size: 12px; } .subtabs button[aria-selected="true"] { background: var(--emerald, #047857); color: #fff; border-color: transparent; } .subtabs .n { opacity: .8; }
.filters { display: grid; grid-template-columns: 1.6fr 1fr; gap: 6px; margin-bottom: 8px; }
.item.lead select { border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; background: #fff; font-size: 12px; }
.pipe .prow { display: grid; grid-template-columns: 110px 1fr 28px; gap: 8px; align-items: center; margin: 6px 0; font-size: 12.5px; } .bar { background: #efe6dc; border-radius: 6px; height: 12px; } .bar i { display: block; height: 100%; background: var(--emerald, #047857); border-radius: 6px; }
.mail { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fff; margin: 8px 0; } .mail pre { white-space: pre-wrap; font: inherit; margin: 8px 0 0; } .mail .subject b { display: block; }
.checks li { margin: 3px 0; font-size: 13px; }
.report { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; } .metric { background: #fffdf9; border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; display: flex; flex-direction: column-reverse; } .metric dd { margin: 0; font-size: 26px; font-weight: 800; color: var(--emerald, #047857); } .metric dt { font-size: 11.5px; color: var(--muted); }
.msgs .msg { padding: 6px 10px; border-radius: 12px; margin: 4px 0; max-width: 90%; font-size: 13px; } .msgs .msg.founder { background: #e6f6ee; margin-left: auto; } .msgs .msg.employee { background: #fff3dc; }
.msgform { display: flex; gap: 6px; margin: 8px 0; } .msgform .btn { flex: none; }
.linkbtn { background: none; border: 0; color: var(--emerald, #047857); font-weight: 600; cursor: pointer; padding: 0 2px; }
.btn.go { background: #047857; color: #fff; border-color: #047857; } .btn.pause { background: #fff; }
@media (max-width: 820px) {
  .demo-banner { font-size: 11px; padding: 4px 8px; }
  .demo-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 5px 8px; } .demo-bar::-webkit-scrollbar { display: none; } .demo-bar > * { flex: none; } .demo-status { flex: 0 0 240px; white-space: normal; font-size: 11.5px; } .demo-nav { margin-left: 0; flex-wrap: nowrap; }
  .filters { grid-template-columns: 1fr; }
}
@media (min-width: 821px) { body.demo .panel { width: 430px; } }
