/* Hatato HQ: a warm, dark office at night, a lighter one by day. Claude's terracotta for actions. */
:root {
  color-scheme: dark light;
  --bg: light-dark(#f4f1ea, #16171b);
  --stage: light-dark(#e9e3d7, #101114);
  --panel: light-dark(#fbf9f5, #1c1d22);
  --card: light-dark(#ffffff, #23252b);
  --sunken: light-dark(#f0ece4, #2a2c33);
  --ink: light-dark(#1b1a17, #f2efe9);
  --ink-2: light-dark(#4a463f, #cfcac0);
  --ink-3: light-dark(#6b665d, #9c978d);
  --line: light-dark(#e2ddd2, #31333a);
  --line-2: light-dark(#d1cbbf, #41444d);
  --accent: #d97757;
  --accent-ink: light-dark(#a8482b, #f09b7d);
  --accent-tint: light-dark(#f8e6dd, #3a2620);
  --ok: light-dark(#17803d, #5fcf86);
  --ok-tint: light-dark(#e3f4e8, #1d3326);
  --warn: light-dark(#9a6200, #f2c260);
  --warn-tint: light-dark(#fbf0d9, #3a2f17);
  --bad: light-dark(#b42318, #f4877b);
  --bad-tint: light-dark(#fbe5e2, #3b1f1d);
  --work: light-dark(#1f6fd0, #7cb4ff);
  --radius: 14px;
  --radius-s: 9px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 8px 24px rgb(0 0 0 / .08);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pixel: "Pixelify Sans", "Manrope", system-ui, sans-serif;
  accent-color: var(--accent);
  scrollbar-color: var(--line-2) transparent;
}
@supports not (color: light-dark(white, black)) {
  :root { --bg: #16171b; --stage: #101114; --panel: #1c1d22; --card: #23252b; --sunken: #2a2c33; --ink: #f2efe9; --ink-2: #cfcac0; --ink-3: #9c978d; --line: #31333a; --line-2: #41444d; --accent-ink: #f09b7d; --accent-tint: #3a2620; --ok: #5fcf86; --ok-tint: #1d3326; --warn: #f2c260; --warn-tint: #3a2f17; --bad: #f4877b; --bad-tint: #3b1f1d; --work: #7cb4ff; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 15px/1.5 var(--font); }
h1, h2, h3, h4, p { margin: 0; }
h2 { font-size: 1.1rem; font-weight: 800; letter-spacing: -.01em; }
h3 { font-size: .98rem; font-weight: 750; }
a { color: var(--accent-ink); }
code { font-size: .88em; background: var(--sunken); padding: .1em .35em; border-radius: 5px; }
small { font-size: .8rem; }
.small { font-size: .86rem; }
.muted { color: var(--ink-3); }
.err { color: var(--bad); }
.warn { color: var(--warn); }
.center { text-align: center; }
.loading { padding: 40px; text-align: center; color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- buttons and fields ---------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font: 700 .9rem var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #c96646; }
.btn.danger { color: var(--bad); border-color: color-mix(in oklab, var(--bad) 45%, var(--line)); }
.btn.danger.send { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunken); }
.btn.small { min-height: 32px; padding: 0 11px; font-size: .84rem; border-radius: 8px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.btn-col { display: grid; gap: 6px; align-content: start; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-3); cursor: pointer; }
.linkish:hover { color: var(--ink); text-decoration: underline; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.field { display: grid; gap: 5px; font-weight: 700; font-size: .86rem; }
.field small { font-weight: 500; color: var(--ink-3); }
input, select, textarea { width: 100%; font: 500 .95rem var(--font); color: var(--ink); background: var(--bg); border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 11px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { resize: vertical; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: .9rem; cursor: pointer; }
.check input { width: auto; margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 99px; font-size: .76rem; font-weight: 750; background: var(--sunken); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-tint); color: var(--ok); }
.pill.bad { background: var(--bad-tint); color: var(--bad); }
.pill.warn { background: var(--warn-tint); color: var(--warn); }
.pill.work { background: color-mix(in oklab, var(--work) 15%, var(--card)); color: var(--work); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.empty { padding: 22px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line-2); border-radius: var(--radius); font-size: .9rem; }
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.switch-row small { display: block; color: var(--ink-3); font-weight: 500; }
.spin { display: inline-block; width: 11px; height: 11px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- the shell --------------------------------------------------------------------------- */
.hq { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: 100dvh; }
.hq > *, .floor > * { min-width: 0; }
.top { display: flex; align-items: center; gap: 10px; padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em; color: var(--ink); text-decoration: none; flex: none; }
.chips { display: flex; gap: 6px; margin-inline-start: auto; align-items: center; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 99px; background: var(--sunken); color: var(--ink-2); font-size: .82rem; font-weight: 700; text-decoration: none; white-space: nowrap; border: 1px solid transparent; }
.chip small { color: var(--ink-3); font-weight: 600; }
.chip.hot { background: var(--accent-tint); color: var(--accent-ink); border-color: color-mix(in oklab, var(--accent) 40%, transparent); }
.chip.ai i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.chip.ai.ok i { background: var(--ok); }
.chip.ai.work i { background: var(--work); animation: pulse 1.2s ease-in-out infinite; }
.chip.ai.bad i { background: var(--bad); }
.chip.ai.bad { color: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }
.meter { width: 34px; height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); }
.meter i.high { background: var(--warn); }
.meter i.over { background: var(--bad); }
.offline .top::after { content: "Reconnecting…"; font-size: .78rem; color: var(--warn); font-weight: 700; }

.floor { display: grid; grid-template-columns: minmax(0, 1fr) clamp(380px, 32vw, 470px); min-height: 0; }
.stage { min-width: 0; min-height: 0; padding: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: radial-gradient(ellipse at 50% 40%, color-mix(in oklab, var(--stage) 70%, #2a2420), var(--stage)); }
#office { width: 100%; max-width: calc((100dvh - 120px) * 1.6); }
.stage-hint { font-size: .78rem; color: var(--ink-3); text-align: center; }
.panel { display: flex; flex-direction: column; min-height: 0; border-inline-start: 1px solid var(--line); background: var(--panel); }
.tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs a { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: .84rem; white-space: nowrap; position: relative; }
.tabs a:hover { background: var(--sunken); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--panel); }
.tabs svg { width: 17px; height: 17px; flex: none; }
.badge { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: .7rem; line-height: 18px; text-align: center; }
.view { flex: 1; min-height: 0; overflow: auto; }
.v-chat { height: 100%; }
.pane { padding: 16px; display: grid; gap: 14px; }
.pane-head p { margin-top: 2px; }
.stack { display: grid; gap: 10px; }
.sub { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-top: 6px; }

/* ---- the office floor ---------------------------------------------------------------------- */
.office-frame { position: relative; width: 100%; aspect-ratio: 384 / 240; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px rgb(0 0 0 / .25), 0 18px 50px rgb(0 0 0 / .35); background: #1a1b20; --s: 2; }
.office-canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; cursor: pointer; }
.office-canvas.three { image-rendering: auto; touch-action: pan-y; cursor: grab; }
.office-frame[data-mode="3d"] { background: radial-gradient(ellipse at 50% 38%, light-dark(#f4efe6, #2c2f37) 0%, light-dark(#e2dace, #17181c) 72%); }
.office-mode { position: absolute; top: 8px; right: 8px; z-index: 2000; display: flex; padding: 2px; border-radius: 99px; background: rgb(18 20 26 / .62); backdrop-filter: blur(6px); }
.office-mode button { border: 0; background: transparent; color: #e8e4dc; font: 750 .72rem var(--font); padding: 3px 10px; border-radius: 99px; cursor: pointer; }
.office-mode button[aria-pressed="true"] { background: #fffdf8; color: #1d1c1a; }
.office-ctl { position: absolute; right: 8px; bottom: 8px; z-index: 2000; display: flex; gap: 4px; }
.office-ctl button { width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgb(18 20 26 / .62); backdrop-filter: blur(6px); color: #fff; font: 700 15px/1 var(--font); cursor: pointer; }
.office-ctl button:hover, .office-mode button:hover { filter: brightness(1.2); }
.office-mode button:focus-visible, .office-ctl button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.office-frame[data-mode="3d"] .tag { font-family: var(--font); font-weight: 700; }
.office-ov { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.office-ov > * { position: absolute; left: 0; top: 0; }
.tag { pointer-events: auto; display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px 1px 5px; border-radius: 99px; border: 0; background: rgb(18 20 26 / .78); color: #fff; font: 600 clamp(9px, calc(var(--s) * 4.3px), 13px)/1.4 var(--pixel); white-space: nowrap; cursor: pointer; }
.tag i { width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 0 1.5px rgb(255 255 255 / .6); }
.tag[data-state="working"] i { animation: pulse 1s ease-in-out infinite; }
.tag[data-state="waiting"] { background: rgb(154 98 0 / .9); }
.tag[data-state="off"] { opacity: .5; }
.tag.sel { background: var(--accent); }
.office-ov .bubble { pointer-events: none; max-width: clamp(120px, calc(var(--s) * 74px), 230px); padding: 4px 9px; border-radius: 10px; background: #fffdf8; color: #1d1c1a; font: 650 clamp(10px, calc(var(--s) * 4.4px), 13px)/1.3 var(--font); box-shadow: 0 2px 8px rgb(0 0 0 / .3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.office-ov .bubble::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px; background: inherit; transform: translateX(-50%) rotate(45deg); }
.office-ov .bubble.work { background: #e9f2ff; }
.office-ov .bubble.work::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-inline-end: 5px; border-radius: 50%; background: #1f6fd0; animation: pulse 1s ease-in-out infinite; vertical-align: 1px; }
.office-ov .bubble.wait { background: #fff2cf; }
.office-ov .bubble.icon { padding: 1px 6px; }
.office-ov .bubble.done { background: #e2f6e8; }
.office-ov .bubble.bad { background: #fde4e1; }
.tv { pointer-events: none; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 0 4px; color: #bfe3ff; font-family: var(--pixel); line-height: 1.15; overflow: hidden; text-shadow: 0 0 4px rgb(120 190 255 / .5); }
.tv b { color: #ffd9c7; font-weight: 600; letter-spacing: .04em; }
.tv .dots i { display: inline-block; width: .55em; height: .55em; border-radius: 50%; background: #6b7280; margin-inline-end: .2em; }
.tv .dots i.ok { background: #5fcf86; }
.tv .dots i.bad { background: #f4877b; }
.tray-hit, .tv-hit { pointer-events: auto; border: 0; background: transparent; cursor: pointer; border-radius: 4px; }
.tray-hit:focus-visible, .tv-hit:focus-visible { outline: 2px solid var(--accent); }
.tray-count { position: absolute; right: -6px; top: -8px; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--accent); color: #fff; font: 800 11px/18px var(--font); box-shadow: 0 1px 4px rgb(0 0 0 / .4); white-space: nowrap; }

/* ---- chat --------------------------------------------------------------------------------- */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.who-row { display: flex; gap: 6px; padding: 10px 10px 4px; overflow-x: auto; scrollbar-width: none; flex: none; }
.who { position: relative; display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; text-align: start; flex: none; }
.who .pic { width: 30px; height: 36px; border-radius: 8px; background: color-mix(in oklab, var(--c) 22%, var(--sunken)); display: grid; place-items: center; overflow: hidden; }
.who .pic canvas { width: 18px; height: 30px; image-rendering: pixelated; }
.who .nm { display: grid; font-weight: 750; font-size: .85rem; line-height: 1.15; }
.who .nm small { color: var(--ink-3); font-weight: 600; font-size: .72rem; }
.who.on { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.who .dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; }
.dot.work { background: var(--work); animation: pulse 1s infinite; }
.dot.wait { background: var(--warn); }
.thread-bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px 8px; border-bottom: 1px solid var(--line); flex: none; }
.thread-title { display: grid; min-width: 0; flex: 1; }
.thread-title b { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-title small { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-btns { display: flex; gap: 4px; flex: none; }
.notices { display: grid; gap: 6px; padding: 0 12px; flex: none; }
.notices:not(:empty) { padding-top: 8px; }
.notice { padding: 8px 11px; border-radius: 10px; background: var(--warn-tint); color: var(--ink); font-size: .84rem; }
.notice.bad { background: var(--bad-tint); }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; }
.msg.me { align-self: flex-end; max-width: 86%; }
.msg.me .bubble { background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me.routine .bubble { background: var(--sunken); color: var(--ink-2); border: 1px dashed var(--line-2); }
.msg.ai { display: grid; gap: 6px; max-width: 100%; }
.msg-head { display: flex; align-items: center; gap: 7px; font-size: .84rem; }
.av { display: inline-grid; place-items: center; width: 26px; height: 30px; border-radius: 7px; background: color-mix(in oklab, var(--c, #888) 22%, var(--sunken)); overflow: hidden; flex: none; }
.av canvas { width: 14px; height: 24px; image-rendering: pixelated; }
.parts { display: grid; gap: 8px; padding-inline-start: 33px; min-width: 0; }
.note { font-size: .82rem; color: var(--ink-3); font-style: italic; padding-inline-start: 10px; border-inline-start: 2px solid var(--line-2); }
.tools { display: flex; flex-wrap: wrap; gap: 5px; }
.tool { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; background: var(--sunken); font-size: .76rem; font-weight: 650; color: var(--ink-2); }
.tool.ok::before { content: "✓"; color: var(--ok); }
.tool.err::before { content: "✗"; color: var(--bad); }
.tool.run::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--work); animation: pulse 1s infinite; }
.md { font-size: .93rem; line-height: 1.55; overflow-wrap: anywhere; }
.md p + p, .md ul, .md ol, .md table, .md h3, .md h4 { margin-top: 8px; }
.md ul, .md ol { padding-inline-start: 20px; margin-bottom: 0; }
.md table { border-collapse: collapse; font-size: .84rem; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 4px 8px; text-align: start; }
.md th { background: var(--sunken); }
.meta { font-size: .74rem; color: var(--ink-3); }
.livestat { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--work); }
.parts > * { min-width: 0; }
.deleg { border: 1px solid var(--line); border-inline-start: 3px solid var(--c); border-radius: 11px; background: var(--card); min-width: 0; }
.deleg summary { display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; list-style: none; min-width: 0; }
.deleg summary .av, .deleg summary .dn { flex: none; }
.deleg summary::-webkit-details-marker { display: none; }
.deleg .dn { display: grid; line-height: 1.15; font-size: .86rem; }
.deleg .dn small { color: var(--ink-3); font-size: .72rem; }
.deleg .st { margin-inline-start: auto; font-size: .76rem; font-weight: 700; text-align: end; color: var(--ink-3); min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deleg .st.work { color: var(--work); }
.deleg .st.work i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--work); animation: pulse 1s infinite; margin-inline-end: 5px; }
.deleg .st.ok { color: var(--ok); }
.deleg .st.bad { color: var(--bad); }
.deleg-body { padding: 0 12px 12px; display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.task { font-size: .82rem; color: var(--ink-2); }
.steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; font-size: .8rem; color: var(--ink-2); }
.steps li.error { color: var(--bad); }
.steps small { color: var(--ink-3); }
.report { background: var(--sunken); border-radius: 9px; padding: 10px 12px; font-size: .88rem; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); flex: none; }
.composer textarea { resize: none; min-height: 42px; max-height: 180px; border-radius: 12px; }
.send { min-height: 42px; padding: 0 14px; border-radius: 12px; }
.empty-chat { margin: auto; display: grid; justify-items: center; gap: 6px; text-align: center; max-width: 360px; padding: 20px 0; }
.empty-chat canvas { image-rendering: pixelated; width: 36px; height: 60px; }
.suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 8px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font: 650 .82rem var(--font); cursor: pointer; text-align: start; }
.chip-btn:hover { border-color: var(--accent); }
.chip-btn.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.chip-btn i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

/* ---- dialogs ------------------------------------------------------------------------------- */
dialog { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); box-shadow: 0 24px 60px rgb(0 0 0 / .35); }
dialog.wide { width: min(640px, calc(100vw - 24px)); }
dialog::backdrop { background: rgb(10 10 14 / .55); }
dialog h2 { margin-bottom: 12px; }
dialog .body { display: grid; gap: 12px; }
.hist-list { display: grid; gap: 4px; max-height: 60dvh; overflow: auto; margin-bottom: 12px; }
.hist-row { display: flex; align-items: center; gap: 4px; }
.hist-open { flex: 1; min-width: 0; display: grid; text-align: start; padding: 8px 10px; border-radius: 9px; border: 0; background: transparent; color: var(--ink); cursor: pointer; font: inherit; }
.hist-open:hover { background: var(--sunken); }
.hist-open b { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-open small { color: var(--ink-3); }

/* ---- inbox, activity, team, routines ------------------------------------------------------- */
.item { border-inline-start: 4px solid var(--c); display: grid; gap: 10px; }
.item header { display: flex; gap: 10px; align-items: flex-start; }
.item h3 { margin-top: 1px; }
.item header small { color: var(--ink-3); }
.kind { font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.facts { display: grid; gap: 4px; margin: 0; font-size: .86rem; }
.facts div { display: flex; gap: 10px; }
.facts dt { width: 84px; flex: none; color: var(--ink-3); }
.facts dd { margin: 0; font-weight: 650; }
blockquote { margin: 0; padding: 8px 12px; border-radius: 9px; background: var(--sunken); color: var(--ink-2); }
.list { display: grid; gap: 2px; }
.row { display: flex; gap: 10px; align-items: center; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: .86rem; }
.row .grow { flex: 1; min-width: 0; display: grid; }
.row .grow b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 650; }
.row .grow small { color: var(--ink-3); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.log li { display: grid; grid-template-columns: 44px 18px 1fr; gap: 6px; align-items: baseline; font-size: .85rem; padding: 4px 6px; border-radius: 7px; }
.log li:hover { background: var(--sunken); }
.log li.day { display: block; font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding-top: 10px; }
.log li.empty { display: block; }
.log time { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: .78rem; }
.log i { font-style: normal; color: var(--c); text-align: center; }
.log li.step { color: var(--ink-2); font-size: .8rem; }
.log li.bad, .log li.failed { color: var(--bad); }
.agent { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: start; border-inline-start: 4px solid var(--c); }
.agent .pic { width: 64px; height: 80px; border-radius: 10px; background: color-mix(in oklab, var(--c) 20%, var(--sunken)); display: grid; place-items: center; }
.agent .pic canvas { width: 36px; height: 60px; image-rendering: pixelated; }
.agent h3 small { display: block; color: var(--ink-3); font-weight: 600; font-size: .76rem; }
.agent .info { display: grid; gap: 4px; }
.kits { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; display: grid; gap: 6px; }
.kits legend { font-weight: 700; font-size: .84rem; padding: 0 4px; }
.look-box, .notes-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.look-box summary, .notes-box summary { cursor: pointer; font-weight: 700; font-size: .88rem; }
.look { display: grid; grid-template-columns: 90px 1fr; gap: 12px; margin-top: 10px; }
.look-pic { display: grid; place-items: start center; }
.look-pic canvas { width: 72px; height: 120px; image-rendering: pixelated; }
.look-opts { display: grid; gap: 8px; }
.opt { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; font-size: .82rem; font-weight: 700; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.sw { position: relative; cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 22px; height: 22px; margin: 0; cursor: pointer; }
.sw span { display: block; width: 22px; height: 22px; border-radius: 6px; background: var(--sw); border: 2px solid var(--line); }
.sw input:checked + span { border-color: var(--ink); box-shadow: 0 0 0 2px var(--accent); }
.sw input:focus-visible + span { outline: 2px solid var(--accent); }
.notes { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 4px; }
.notes li { display: flex; gap: 6px; align-items: flex-start; font-size: .86rem; }
.notes li span { flex: 1; display: grid; }
.notes li small { color: var(--ink-3); }
.inline { display: flex; gap: 6px; }
.templates { display: grid; gap: 6px; }
.tpl { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.tpl input { width: auto; margin-top: 4px; }
.tpl span { display: grid; }
.tpl small { color: var(--ink-3); }
.tpl:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.routine { border-inline-start: 4px solid var(--c); display: grid; gap: 8px; }
.routine-head { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); }
.days { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.days legend { font-weight: 700; font-size: .84rem; padding: 0 4px; }
.day { position: relative; }
.day input { position: absolute; opacity: 0; }
.day span { display: inline-block; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line-2); font-size: .84rem; font-weight: 700; cursor: pointer; }
.day input:checked + span { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.day input:focus-visible + span { outline: 2px solid var(--accent); }

/* ---- settings ------------------------------------------------------------------------------- */
.settings .card { display: grid; gap: 12px; }
.link { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.link-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.link-head small { color: var(--ink-3); font-weight: 600; }
ol.steps { padding-inline-start: 20px; margin: 0; display: grid; gap: 2px; }
.chart { width: 100%; height: auto; display: block; }
.chart rect { fill: #3d7fd0; }
.chart rect.over { fill: var(--bad); }
.chart .budget-line { stroke: var(--ink-3); stroke-dasharray: 3 3; stroke-width: 1; }
.chart text { fill: var(--ink-3); font: 600 8px var(--font); }
table.mini { border-collapse: collapse; font-size: .85rem; width: 100%; }
table.mini th, table.mini td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: start; }
table.mini .n { text-align: end; font-variant-numeric: tabular-nums; }
table.mini .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 6px; }

/* ---- sign-in ------------------------------------------------------------------------------- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 50% 30%, #2a221e, var(--bg)); }
.gate .card { width: min(400px, 100%); display: grid; gap: 14px; padding: 24px; }
.gate .brand { font-size: 1.2rem; }
.steps-list, .gate ol { padding-inline-start: 20px; margin: 0; font-size: .88rem; }
.qr-box { display: grid; place-items: center; background: #fff; border-radius: 12px; padding: 10px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.codes code { text-align: center; padding: 6px; }
.setup-key { letter-spacing: .05em; }

/* ---- toasts -------------------------------------------------------------------------------- */
#toasts { position: fixed; z-index: 50; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { padding: 11px 15px; border-radius: 12px; background: var(--ink); color: var(--panel); font-weight: 650; font-size: .9rem; box-shadow: 0 10px 30px rgb(0 0 0 / .3); animation: up .2s ease-out; }
.toast.error { background: var(--bad); color: #fff; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* ---- phones and small tablets: the office on top, the panel below -------------------------- */
@media (max-width: 1000px) {
  .hq { height: auto; min-height: 100dvh; grid-template-rows: auto 1fr; }
  .floor { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .stage { padding: 8px; }
  #office { max-width: 720px; }
  .stage-hint { display: none; }
  .panel { border-inline-start: 0; border-top: 1px solid var(--line); min-height: 60dvh; }
  .tabs { position: sticky; top: 0; z-index: 5; background: var(--panel); }
  .view { overflow: visible; }
  .v-chat { height: auto; }
  .chat { height: calc(100dvh - 120px); min-height: 420px; }
  .top .brand span { display: none; }
  #clock { display: none; }
}
@media (max-width: 520px) {
  .chip { padding: 0 9px; }
  .chip small { display: none; }
  .tabs a span { display: none; }
  .tabs a { padding: 8px 12px; }
  .tabs a[aria-current="page"] span { display: inline; }
  .msg.me { max-width: 92%; }
  .parts { padding-inline-start: 0; }
  .agent { grid-template-columns: 54px minmax(0, 1fr); }
  .agent .btn-col { grid-column: 1 / -1; grid-auto-flow: column; justify-content: start; }
  .look { grid-template-columns: 1fr; }
  .look-pic { place-items: center; }
  .pane { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
