/* The work screens added on top of app.css: Messages, Concerns, the to-do panel and Projects,
   Readings, Internal notes, Residents, the inspector view, the work settings pages and the
   assistant rail. Tokens only (tokens.css), so light and dark both hold. */

.show-sm { display: none !important; }
@media (max-width: 900px) { .show-sm { display: inline-flex !important; } }
@media (max-width: 1199px) { .hide-md { display: none !important; } }

/* Long menus (the to-do Filter menu) scroll inside the popover. */
.popover .menu-list { max-height: min(70vh, 560px); overflow-y: auto; overscroll-behavior: contain; }

/* ---------- the assistant rail (Lance's copilot: frosted, neutral, 353 px, 280 to 560) ---------- */
.copilot-col { display: none; }
.copilot-scrim { display: none; }
.app:is([data-copilot="open"], [data-copilot="full"]) .copilot-col { display: block; }
@media (min-width: 1280px) {
  .app[data-copilot="open"] { grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--cp-w, 353px); }
  .app[data-copilot="open"][data-collapsed="true"] { grid-template-columns: var(--rail-collapsed) minmax(0, 1fr) var(--cp-w, 353px); }
  .app[data-copilot="open"] .copilot-col { position: sticky; top: 0; height: 100vh; height: 100dvh; min-width: 0; z-index: 30; }
}
/* With the assistant open, a to-do or call panel slides over the list instead of squeezing it. */
@media (min-width: 1280px) and (max-width: 1679px) {
  .app[data-copilot="open"] .split:has(> .side-panel-wrap) { grid-template-columns: minmax(0, 1fr); }
  .app[data-copilot="open"] .side-scrim { display: block; position: fixed; inset: 0 var(--cp-w, 353px) 0 0; background: var(--scrim); z-index: 1090; }
  .app[data-copilot="open"] .side-panel { position: fixed; top: 0; right: var(--cp-w, 353px); bottom: 0; max-height: none; height: auto !important; width: min(460px, 100vw); z-index: 1100; border-radius: 0; border-width: 0 1px 0 1px; box-shadow: var(--shadow-dialog); }
  .app[data-copilot="open"] .split:has(> .side-panel-wrap) .hide-split { display: revert; }
}
/* Narrower windows: the rail floats over the page from the right, with a light scrim to close it. */
@media (max-width: 1279px) {
  .app[data-copilot="open"] .copilot-col { position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--cp-w, 353px), 100vw); z-index: 1150; }
  .app[data-copilot="open"] .copilot { box-shadow: var(--glass-shadow); }
  .app[data-copilot="open"] .copilot-scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.12); z-index: 1140; }
}
@media (max-width: 900px) {
  .app[data-copilot="open"] .copilot-col { width: 100vw; }
  .cp-resize, .cp-hbtn.hide-phone { display: none !important; }
}
/* Fullscreen: the rail takes the page area beside the left rail; the conversation stays readable width. */
.app[data-copilot="full"] .copilot-col { position: fixed; top: 0; right: 0; bottom: 0; left: var(--rail-w); z-index: 1150; }
.app[data-copilot="full"][data-collapsed="true"] .copilot-col { left: var(--rail-collapsed); }
@media (max-width: 900px) { .app[data-copilot="full"] .copilot-col { left: 0; } }
.app[data-copilot="full"] .copilot { border-left-color: var(--line); }

.copilot {
  position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0;
  background: var(--glass-bg); -webkit-backdrop-filter: blur(24px) saturate(1.5); backdrop-filter: blur(24px) saturate(1.5);
  border-left: 1px solid var(--glass-edge); color: var(--q-body);
}
.cp-resize { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 3; touch-action: none; }
.cp-resize::after { content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px; background: transparent; transition: background var(--dur-1) var(--ease); }
.cp-resize:hover::after, .cp-resize:focus-visible::after, .is-resizing .cp-resize::after { background: var(--q-dim); }
.cp-resize:focus-visible { box-shadow: none; }
.is-resizing, .is-resizing * { cursor: col-resize !important; user-select: none !important; }

.cp-head { display: flex; align-items: center; gap: 2px; height: 48px; flex: none; padding: 0 8px 0 16px; border-bottom: 1px solid var(--q-line); }
.cp-title { display: inline-flex; align-items: center; gap: 7px; font-size: var(--t-sm); font-weight: 500; color: var(--q-dim); }
.cp-title svg { color: var(--q-ink); }
.cp-hbtn { width: 30px; height: 30px; border: 0; border-radius: var(--r); background: transparent; color: var(--q-dim); display: grid; place-items: center; cursor: pointer; transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.cp-hbtn:hover:not([disabled]) { background: var(--q-hover); color: var(--q-ink); }
.cp-hbtn[disabled] { opacity: 0.4; cursor: default; }

.cp-log { flex: 1; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.cp-inner { width: 100%; max-width: 760px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; align-content: start; }
.cp-foot { flex: none; }
.cp-foot .cp-inner { padding: 6px 12px 12px; gap: 8px; }

.cp-empty { display: grid; gap: 14px; padding: 24px 2px 4px; justify-items: start; }
.cp-spark { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--q-bubble); color: var(--q-ink); }
.cp-hello { font-size: var(--t-xl); font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; color: var(--q-ink); }

.cp-shortcuts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cp-short { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: var(--r-pill); border: 1px solid var(--q-field-line); background: transparent; color: var(--q-body); font: inherit; font-size: var(--t-xs); font-weight: 500; cursor: pointer; white-space: nowrap; }
.cp-short svg { color: var(--q-dim); }
.cp-short:hover { background: var(--q-hover); color: var(--q-ink); }
.cp-short.is-off { border-style: dashed; color: var(--q-dim); }
.cp-edit { height: 28px; padding: 0 6px; border: 0; background: none; color: var(--q-dim); font: inherit; font-size: var(--t-xs); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.cp-edit:hover { color: var(--q-ink); }

.cp-suggest { list-style: none; margin: 4px 0 0; padding: 0; width: 100%; display: grid; }
.cp-suggest li + li { border-top: 1px solid var(--q-line); }
.cp-suggest button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 2px; border: 0; background: none; color: var(--q-body); font: inherit; font-size: var(--t-base); text-align: left; cursor: pointer; border-radius: var(--r-control); }
.cp-suggest button svg { color: var(--q-dim); flex: none; transition: transform var(--dur-1) var(--ease); }
.cp-suggest button:hover { color: var(--q-ink); }
.cp-suggest button:hover svg { transform: translateX(2px); color: var(--q-ink); }

.cp-you { display: flex; justify-content: flex-end; }
.cp-you p { max-width: 85%; margin: 0; padding: 8px 13px; border-radius: 18px; background: var(--q-bubble); color: var(--q-ink); font-size: var(--t-base); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.cp-reply { display: grid; gap: 10px; font-size: var(--t-md); line-height: 1.55; color: var(--q-body); }
.cp-reply p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cp-dim { color: var(--q-dim); }
.cp-calm { color: var(--q-body); }
.cp-done { grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 10px; }
.cp-done-ico { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--q-send); color: var(--q-send-ink); margin-top: 3px; }
.cp-link { color: var(--q-ink); text-decoration: underline; text-underline-offset: 2px; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.cp-list { list-style: none; margin: 0; padding: 0; display: grid; border: 1px solid var(--q-field-line); border-radius: var(--r-lg); overflow: hidden; background: var(--q-card); }
.cp-list li + li { border-top: 1px solid var(--q-field-line); }
.cp-list a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; color: var(--q-ink); text-decoration: none; font-size: var(--t-sm); line-height: 1.4; }
.cp-list a > svg { color: var(--q-dim); flex: none; }
.cp-list a:hover { background: var(--q-hover); }
.cp-list a:focus-visible { box-shadow: inset 0 0 0 2px var(--q-ink); border-radius: 0; }
.cp-row-title { display: block; font-weight: 500; }
.cp-row-detail { display: block; color: var(--q-dim); font-size: var(--t-xs); margin-top: 1px; }
.cp-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: currentColor; }

.cp-card { border: 1px solid var(--q-field-line); border-radius: 14px; background: var(--q-card); padding: 12px; display: grid; gap: 10px; color: var(--q-ink); }
.cp-card-head { display: flex; align-items: center; gap: 7px; font-size: var(--t-sm); }
.cp-card-head svg { color: var(--q-dim); }
.cp-card-actions { display: flex; gap: 6px; justify-content: flex-end; }
.cp-form { gap: 8px; }
.cp-form .field .label { font-size: var(--t-xs); }

.cp-compose { display: flex; align-items: flex-end; gap: 8px; padding: 5px 5px 5px 14px; border-radius: 20px; background: var(--q-field); border: 1px solid var(--q-field-line); transition: border-color var(--dur-1) var(--ease); }
.cp-compose:focus-within { border-color: color-mix(in srgb, var(--q-ink) 28%, var(--q-field-line)); }
.cp-compose textarea { flex: 1; min-width: 0; resize: none; min-height: 32px; max-height: 140px; padding: 6px 0; border: 0; outline: none; background: transparent; color: var(--q-ink); font: inherit; font-size: var(--t-base); line-height: 20px; }
.cp-compose textarea:focus, .cp-compose textarea:focus-visible { outline: none; box-shadow: none; }
.cp-compose textarea::placeholder { color: var(--q-dim); }
.cp-send { width: 32px; height: 32px; flex: none; border: 0; border-radius: 50%; background: var(--q-send); color: var(--q-send-ink); display: grid; place-items: center; cursor: pointer; transition: opacity var(--dur-1) var(--ease); }
.cp-send[disabled] { opacity: 0.3; cursor: default; }

/* ---------- messages ---------- */
.chat-shell { height: calc(100vh - 32px); height: calc(100dvh - 32px); min-height: 520px; }
.chat-side-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 4px; }
.room-item { grid-template-columns: 36px minmax(0, 1fr); align-items: center; }
.room-ava { width: 34px; height: 34px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; background: var(--inverse); color: var(--ink-inverse); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.room-ava.is-person { background: var(--fill); color: var(--ink-muted); }
.chat-empty { display: grid; place-items: center; }
.chat-log { gap: 6px; background: var(--canvas); }
.day-sep { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; color: var(--ink-subtle); font-size: var(--t-xs); font-weight: 500; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.chat-msg { display: flex; align-items: flex-start; gap: 8px; max-width: min(78%, 620px); position: relative; }
.chat-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.chat-ava { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--fill); color: var(--ink-muted); font-size: 10px; font-weight: 600; margin-top: 19px; }
.chat-col { display: grid; gap: 3px; min-width: 0; }
.chat-msg.mine .chat-col { justify-items: end; }
.chat-name { font-size: var(--t-xs); font-weight: 600; color: var(--ink-muted); padding-left: 2px; }
.chat-bubble { padding: 8px 12px; border-radius: 16px 16px 16px 5px; background: var(--paper-0); border: 1px solid var(--line); font-size: var(--t-base); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; display: grid; gap: 6px; }
.chat-msg.mine .chat-bubble { background: var(--inverse); color: var(--ink-inverse); border-color: transparent; border-radius: 16px 16px 5px 16px; }
.chat-msg.mine .chat-bubble .tr-meta, .chat-msg.mine .chat-bubble .link { color: color-mix(in srgb, var(--ink-inverse) 72%, transparent); }
.chat-msg.is-announcement .chat-bubble { background: var(--accent-soft); border-color: var(--accent-line); color: var(--ink); }
.chat-msg.mine.is-announcement .chat-bubble .tr-meta, .chat-msg.mine.is-announcement .chat-bubble .link { color: var(--ink-subtle); }
.chat-bubble.is-deleted { background: transparent; border-style: dashed; color: var(--ink-subtle); font-size: var(--t-sm); display: flex; align-items: center; gap: 6px; }
.chat-meta { font-size: var(--t-2xs); color: var(--ink-subtle); display: inline-flex; align-items: center; gap: 3px; padding: 0 2px; }
.chat-actions { opacity: 0; transition: opacity var(--dur-1) var(--ease); }
.chat-msg:hover .chat-actions, .chat-msg:focus-within .chat-actions { opacity: 1; }
@media (pointer: coarse) { .chat-actions { opacity: 1; } }
.chat-system { align-self: center; font-size: var(--t-xs); color: var(--ink-subtle); }
.chat-pinned { padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--sunken); display: grid; gap: 4px; max-height: 180px; overflow-y: auto; }
.pin-row { display: flex; gap: 8px; align-items: center; font-size: var(--t-sm); }
.chat-composer { display: block; background: var(--paper-0); }
.chat-composer textarea { width: 100%; }
.people-pick { max-height: 340px; overflow-y: auto; display: grid; gap: 2px; }
.people-pick .person-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r); background: none; border: 0; width: 100%; color: var(--ink); cursor: pointer; font: inherit; }
.people-pick .person-row:hover { background: var(--state-hover); }
@media (max-width: 900px) {
  .chat-shell { height: auto; } .chat-msg { max-width: 92%; }
  /* An open conversation fills the phone screen down to the tab bar, composer at the bottom. */
  .chat-shell[data-view="thread"] { height: calc(100vh - 176px); height: calc(100dvh - 176px); min-height: 380px; }
  .chat-shell[data-view="thread"] .thread-view { height: 100%; }
}

/* translated text */
.tr { display: grid; gap: 3px; }
.tr-meta { display: inline-flex; align-items: center; gap: 5px; font-size: var(--t-2xs); color: var(--ink-subtle); flex-wrap: wrap; }
.lang-tag { font-size: 10px; font-weight: 600; letter-spacing: 0.04em; padding: 0 5px; border-radius: var(--r-sm); background: var(--fill); color: var(--ink-muted); }

/* ---------- photos ---------- */
.photo-pick { display: grid; gap: 6px; }
.photo-row { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-thumb { position: relative; width: 72px; height: 72px; border-radius: var(--r); overflow: hidden; background: var(--sunken); border: 1px solid var(--line); flex: none; padding: 0; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-btn { cursor: zoom-in; }
.photo-x { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.62); color: #fff; display: grid; place-items: center; cursor: pointer; }
.photo-add { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--r-control); border: 1px dashed var(--line-control); background: var(--paper-0); color: var(--ink-muted); font: inherit; font-size: var(--t-sm); cursor: pointer; align-self: center; }
.photo-add:hover { background: var(--state-hover); color: var(--ink); }
.photo-full { max-width: 100%; max-height: 70vh; border-radius: var(--r); display: block; margin: 0 auto; }
.chat-bubble .photo-thumb { width: 180px; height: 135px; }

/* ---------- concerns ---------- */
.mood { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); white-space: nowrap; }
.mood .dot, .mood-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); flex: none; display: inline-block; }
.mood-moderately_upset .dot, .mood-dot.mood-moderately_upset { background: var(--tone-amber); }
.mood-extremely_upset .dot, .mood-dot.mood-extremely_upset { background: var(--tone-red); }
.mood-extremely_upset { color: var(--tone-red); font-weight: 600; }
.resolved-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; display: grid; gap: 8px; background: var(--tone-green-bg); }
.quote-list { display: grid; gap: 6px; }
.quote { margin: 0; padding: 8px 12px; border-left: 2px solid var(--line-strong); color: var(--ink-muted); font-size: var(--t-sm); background: var(--sunken); border-radius: 0 var(--r) var(--r) 0; }
.choice-row { display: flex; flex-wrap: wrap; gap: 6px; }
.choice-card { flex: 1; min-width: 140px; display: grid; gap: 2px; text-align: left; padding: 10px 12px; border-radius: var(--r-lg); border: 1px solid var(--line-control); background: var(--paper-0); color: var(--ink); cursor: pointer; font: inherit; }
.choice-card[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* missed calls */
.missed-card { border-radius: var(--r-lg); padding: 12px 14px; display: grid; gap: 8px; border: 1px solid var(--line); }
.missed-card.is-open { background: var(--tone-red-bg); border-color: transparent; }
.missed-card .eyebrow { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- to-dos ---------- */
.table-todos .col-unit { width: 64px; }
.table-todos .col-title { min-width: 180px; max-width: 460px; }
.table-todos .col-pri { width: 1%; white-space: nowrap; }
.table-todos .col-status { width: 1%; white-space: nowrap; }
.table-todos .col-who { width: 1%; white-space: nowrap; max-width: 170px; }
.table-todos .col-due { width: 1%; white-space: nowrap; text-align: right; padding-right: 16px; }
.reason-line { display: flex; gap: 8px; align-items: flex-start; font-size: var(--t-sm); color: var(--ink-muted); padding: 8px 12px; border-radius: var(--r); background: var(--sunken); margin: 0; }
.reason-line .ico { flex: none; margin-top: 2px; }
.seen-list { display: flex; flex-wrap: wrap; gap: 6px; }
.seen { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: var(--r-pill); background: var(--fill); font-size: var(--t-xs); }
.time-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.time-list li { display: flex; align-items: center; gap: 8px; font-size: var(--t-sm); }
.timeline .t-dot.t-sys { background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
.punch { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.punch li { display: flex; align-items: flex-start; gap: 10px; padding: 6px 4px; border-radius: var(--r); }
.punch li:hover { background: var(--state-hover); }
.punch-check { width: 20px; height: 20px; margin-top: 2px; border-radius: 50%; border: 1.5px solid var(--line-control); background: var(--paper-0); display: grid; place-items: center; cursor: pointer; flex: none; color: #fff; padding: 0; }
.punch-check:hover:not(:disabled) { border-color: var(--ink); }
.punch li.is-done .punch-check { background: var(--tone-green); border-color: var(--tone-green); }
.punch li.is-done .punch-main .strong { text-decoration: line-through; color: var(--ink-subtle); }
.punch li.is-cancelled { opacity: 0.6; }
.punch-main { background: none; border: 0; padding: 0; text-align: left; color: var(--ink); cursor: pointer; font: inherit; min-width: 0; flex: 1; }
.punch-add { display: grid; gap: 6px; padding-top: 4px; }
.suggest-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.suggest { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper-0); min-width: 0; }
@media (max-width: 900px) { .suggest-row { grid-template-columns: minmax(0, 1fr); } }
.switch-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.switch-row input[type="checkbox"] { margin-top: 3px; }

/* ---------- internal notes ---------- */
.note-list { display: grid; gap: 8px; min-width: 0; }
.note-card { display: grid; gap: 8px; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper-0); color: var(--ink); cursor: pointer; font: inherit; min-width: 0; }
.note-card:hover { border-color: var(--line-control); }
.note-card.is-open { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.note-card.is-unread { box-shadow: inset 3px 0 0 var(--tone-blue); }
.note-card.is-open.is-unread { box-shadow: inset 0 0 0 1px var(--ink), inset 3px 0 0 var(--tone-blue); }
.note-body { font-size: var(--t-sm); color: var(--ink-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.note-full { white-space: pre-wrap; line-height: 1.55; margin: 0; }

/* ---------- residents ---------- */
.contact-list, .hist-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.contact-list li { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.hist-list a { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: var(--r); color: var(--ink); text-decoration: none; }
.hist-list a:hover { background: var(--state-hover); }

/* ---------- readings ---------- */
.reading-hist { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.reading-hist li { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.reading-hist li.is-out { background: color-mix(in srgb, var(--tone-red-bg) 60%, transparent); }
.spark { margin: 0; display: grid; gap: 4px; }
.spark svg { width: 100%; height: 56px; display: block; }
.spark-band { fill: var(--tone-green-bg); }
.spark-line { stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark-out { fill: var(--tone-red); }
.input.is-bad { border-color: var(--tone-red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone-red) 16%, transparent); }

/* ---------- board: flags, clean state, inspector view ---------- */
.uflag { font-size: 10px; font-weight: 600; line-height: 1; padding: 3px 6px; border-radius: var(--r-pill); background: var(--fill); color: var(--ink-muted); white-space: nowrap; }
.bstate { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: var(--r-pill); margin-left: 4px; vertical-align: 1px; }
.bstate-cleaned { background: var(--tone-blue-bg); color: var(--tone-blue); }
.bstate-sent_back { background: var(--tone-red-bg); color: var(--tone-red); }
.bstate-inspected { background: var(--tone-green-bg); color: var(--tone-green); }
.insp-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); align-items: start; }
@media (max-width: 900px) { .insp-cols { grid-template-columns: minmax(0, 1fr); } }
.insp-line { padding: 8px 10px; border-radius: var(--r); background: var(--sunken); gap: 8px; }
.insp-hist { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px; display: grid; gap: 6px; }
.fail-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; font-size: var(--t-sm); color: var(--tone-red); }
.fail-list li { display: flex; align-items: center; gap: 6px; }
.check-sec { display: grid; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.check-sec:last-of-type { border-bottom: 0; }
.check-q { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.check-q .seg button.is-fail[aria-pressed="true"] { background: var(--tone-red); color: #fff; }

/* ---------- home ---------- */
.mini-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--t-sm); color: var(--ink-muted); padding: 2px 0 6px; }
.mini-stats strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* knowledge */
.variant { display: inline-flex; align-items: center; gap: 6px; justify-self: start; padding: 4px 6px 4px 10px; border-radius: var(--r-pill); background: var(--fill); font-size: var(--t-sm); }
.variant button { border: 0; background: none; color: var(--ink-subtle); cursor: pointer; display: grid; place-items: center; padding: 2px; border-radius: 50%; }
.col-check { width: 32px; }

/* ---------- settings ---------- */
.cat-tree, .cat-tree ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cat-tree > li { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px 10px; background: var(--paper-0); }
.cat-tree ul { padding: 6px 0 2px 18px; border-left: 1px solid var(--line); margin-left: 6px; margin-top: 4px; }
.cat-node { display: flex; align-items: center; gap: 4px; font-size: var(--t-sm); font-weight: 600; min-height: 28px; }
.cat-item > .cat-node { font-weight: 500; }
.cat-details { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 2px 0 6px; }
.cat-detail { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border-radius: var(--r-pill); background: var(--fill); font-size: var(--t-xs); }
.cat-detail button { border: 0; background: none; color: var(--ink-subtle); cursor: pointer; display: grid; place-items: center; padding: 2px; border-radius: 50%; }
.cat-detail button:hover { color: var(--tone-red); }
.cat-add { max-width: 360px; }
.cat-details .cat-add { max-width: 240px; }
.esc-table td, .esc-table th { white-space: nowrap; }
.input-unit { display: inline-flex; align-items: center; gap: 4px; }
.input-unit .input { width: 72px; text-align: right; }
.input-unit span { font-size: var(--t-xs); color: var(--ink-subtle); }
.rule-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper-0); }
.rule-row > .input { flex: 1 1 160px; }
.quality { padding: 10px 12px; border-radius: var(--r); background: var(--sunken); display: grid; gap: 4px; }
.plan-area { display: grid; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.plan-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.plan-row { display: grid; grid-template-columns: 64px auto minmax(0, 1fr); align-items: center; gap: 12px; min-width: 0; }
@media (max-width: 600px) { .plan-row { grid-template-columns: 56px minmax(0, 1fr); } .plan-row > :last-child { grid-column: 2; } .plan-row .day-btn { min-width: 30px; padding: 0 3px; } }
.day-btn { height: 24px; min-width: 34px; padding: 0 6px; border-radius: var(--r-sm); border: 1px solid var(--line-control); background: var(--paper-0); color: var(--ink-muted); font: inherit; font-size: var(--t-xs); cursor: pointer; }
.day-btn:hover { background: var(--state-hover); }
.day-btn[aria-pressed="true"] { background: var(--inverse); color: var(--ink-inverse); border-color: transparent; }
.save-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 4px; }
.check-item { padding: 2px 0 2px 4px; }
.check-item .input { flex: 1; }
.field-row .input:first-child { flex: 1; }
tr.is-off td { color: var(--ink-subtle); }

/* Calls: the kind over its channel on a wide table; side by side, read as one value, in a phone card. */
.type-cell { display: grid; }
@media (max-width: 900px) { .table.table-cards .type-cell { display: inline-flex; gap: 6px; align-items: baseline; } .table.table-cards .type-cell .faint::before { content: "· "; } }

/* A table cell holding a small form stacks under its label in a phone card. */
@media (max-width: 900px) {
  .table.table-cards td.td-stack { display: grid; gap: 6px; text-align: left; }
  .table.table-cards td.td-stack .row > * { flex: 1 1 140px; max-width: none !important; }
}

/* focus on the new controls */
.cp-short:focus-visible, .note-card:focus-visible, .choice-card:focus-visible, .punch-check:focus-visible, .punch-main:focus-visible,
.day-btn:focus-visible, .photo-btn:focus-visible, .photo-add:focus-visible, .people-pick .person-row:focus-visible, .hist-list a:focus-visible {
  outline: none; box-shadow: var(--focus-ring);
}

@media print {
  .copilot-col, .copilot-scrim { display: none !important; }
  .note-card { break-inside: avoid; }
  .note-body { -webkit-line-clamp: unset; display: block; }
}
@media (prefers-reduced-motion: reduce) { .chat-actions { transition: none; } }

/* Possible emergencies at the top of Home */
.emergency-banner { display: grid; gap: 6px; margin-bottom: var(--s-3); }
.emergency-row { display: flex; align-items: center; gap: var(--s-3); padding: 12px 14px; border-radius: var(--r-lg); background: var(--tone-red-bg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--tone-red) 35%, transparent); text-decoration: none; }
.emergency-row strong { color: var(--tone-red); }
.emergency-row:hover { border-color: var(--tone-red); }
.emergency-row:focus-visible { outline: 2px solid var(--tone-red); outline-offset: 2px; }
.emergency-icon { width: 30px; height: 30px; border-radius: 999px; background: var(--tone-red-solid); color: #fff; display: grid; place-items: center; flex: none; }
.emergency-go { font-weight: 600; color: var(--tone-red); white-space: nowrap; }

/* Getting started on a new workspace's Home */
.getting-started { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper-0); padding: 14px 16px; margin-bottom: var(--s-3); display: grid; gap: 10px; }
.gs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.gs-list li { display: flex; gap: 10px; align-items: flex-start; }
.gs-mark { width: 18px; height: 18px; border-radius: 999px; border: 1.5px solid var(--line-control); display: grid; place-items: center; flex: none; margin-top: 1px; }
.gs-done .gs-mark { background: var(--tone-green); border-color: var(--tone-green); color: #fff; }
.gs-done .gs-title { color: var(--ink-subtle); text-decoration: line-through; }
.gs-title { font-weight: 600; font-size: var(--t-sm); }
