/* Tell HQ — application stylesheet.
   One design for every internal page: system type, square-shouldered controls,
   white panels on a light gray canvas, hairline dividers, one accent (Tell teal).
   The printable call sheet uses sheet-base.css; the client portal is self-contained. */
* { box-sizing: border-box; }
:root {
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --ink: #1C2028;
  --ink-2: #39404D;
  --muted: #667080;
  --faint: #9AA2AF;
  --line: #E3E6EB;
  --line-2: #D2D7DE;        /* control borders */
  --line-soft: #EEF0F3;     /* table row rules */
  --hover: #F1F3F6;
  --accent: #0A7D90;        /* Tell teal, darkened for text contrast */
  --accent-strong: #086A7A;
  --accent-soft: #E2F1F4;
  --warn: #C5382C;
  --warn-soft: #FBECEA;
  --hold: #8A6A0C;
  --hold-soft: #FAF2D8;
  --ok: #2B7A57;
  --ok-soft: #E3F1EA;
  --blue: #3A5A8A;
  --blue-soft: #E8EDF5;
  --orange: #B7641B;
  --orange-soft: #FBEEDF;
  --purple: #6B4A94;
  --purple-soft: #EFE8F6;
  --nav: #16191E;
  --r: 4px;
  --r-lg: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
html, body { margin: 0; padding: 0; }
/* the hidden attribute always wins, even over display rules on forms and buttons */
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font); font-weight: 600; line-height: 1.25; color: var(--ink); }
h1 { font-size: 20px; letter-spacing: -.01em; margin: 0 0 6px; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 13.5px; margin: 14px 0 6px; }
p { margin: 0 0 10px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* entity names (project, task) are links that read as text until hovered */
a > strong { color: var(--ink); font-weight: 600; }
a:hover > strong { color: var(--accent); }
strong, b { font-weight: 600; }
hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
summary { cursor: pointer; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px 80px; }
.wrap.wide { max-width: 1560px; }

/* inline icons */
.ic { display: inline-block; vertical-align: -2px; flex: none; }

/* ---------- top bar ---------- */
nav.topbar { background: var(--nav); padding: 0 16px; margin-bottom: 24px; position: relative; }
nav.topbar .inner { display: flex; align-items: center; gap: 6px; height: 48px; }
nav.topbar .logo { display: flex; align-items: center; gap: 9px; flex-shrink: 0; margin-right: 6px; text-decoration: none; }
nav.topbar .logo img { display: block; height: 19px; width: auto; }
nav.topbar .logo .logo-hq {
  font-size: 12px; font-weight: 600; letter-spacing: .1em; color: rgba(255,255,255,.6);
  border-left: 1px solid rgba(255,255,255,.22); padding-left: 9px; line-height: 1.2;
}
nav.topbar .nav-primary { display: flex; align-items: stretch; align-self: stretch; gap: 2px; margin-left: 6px; }
nav.topbar a.navlink {
  display: flex; align-items: center; color: rgba(255,255,255,.66); font-size: 13.5px; font-weight: 500;
  padding: 0 11px; white-space: nowrap; text-decoration: none;
}
nav.topbar a.navlink:hover { color: #fff; text-decoration: none; }
nav.topbar a.navlink.active { color: #fff; box-shadow: inset 0 -2px 0 #2BB5CB; }
nav.topbar .spacer { flex: 1; }
nav.topbar select { max-width: 160px; }
nav.topbar .nav-new { flex-shrink: 0; text-decoration: none; margin-right: 4px; }
nav.topbar .nav-new:hover { text-decoration: none; }
nav.topbar .btn.ghost { background: transparent; border-color: transparent; color: rgba(255,255,255,.86); }
nav.topbar .btn.ghost:hover { background: rgba(255,255,255,.09); color: #fff; }

/* searchable dropdown */
.ssel { position: relative; }
.ssel-menu {
  position: absolute; top: calc(100% + 3px); left: 0; right: 0; z-index: 70;
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(20,25,35,.14); max-height: 280px; overflow-y: auto; padding: 3px;
}
.ssel-menu[hidden] { display: none; }
.ssel-item { padding: 6px 9px; border-radius: 3px; cursor: pointer; font-size: 13.5px; }
.ssel-item:hover { background: var(--hover); }
.ssel-sub { color: var(--muted); font-size: 12.5px; }
.ssel-none { padding: 6px 9px; color: var(--muted); font-size: 13px; }

/* announcement bar (admin-set, dismissible) */
.annc-bar {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: #0E3F48; color: #E6F4F6; padding: 7px 44px 7px 20px; position: relative;
  font-size: 13px; font-weight: 500; text-align: center;
}
.annc-bar .annc-text { min-width: 0; }
.annc-bar .annc-x {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: rgba(255,255,255,.75); font-size: 13px;
  cursor: pointer; padding: 3px 7px; border-radius: 3px;
}
.annc-bar .annc-x:hover { background: rgba(255,255,255,.14); color: #fff; }

/* app switcher (waffle) */
.app-switcher { position: relative; display: flex; align-items: center; flex-shrink: 0; }
.app-switch { background: none; border: none; cursor: pointer; padding: 7px; border-radius: var(--r); display: inline-flex; color: rgba(255,255,255,.55); }
.app-switch:hover { background: rgba(255,255,255,.09); color: #fff; }
.waffle { display: grid; grid-template-columns: repeat(3, 3px); gap: 3px; }
.waffle i { width: 3px; height: 3px; border-radius: 1px; background: currentColor; }
.app-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; width: 270px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: 0 10px 30px rgba(20,25,35,.16); padding: 5px;
}
.app-menu[hidden] { display: none; }
.app-menu-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 6px 8px 6px; }
.app-tile { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r); text-decoration: none; color: var(--ink); }
.app-tile:hover { background: var(--hover); text-decoration: none; }
.app-tile.current { background: var(--hover); }
.app-ico {
  width: 30px; height: 30px; border-radius: var(--r); background: var(--nav); color: #fff;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.app-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.app-name { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.app-tag { font-size: 12px; color: var(--muted); }
.app-flag { font-size: 11.5px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

/* account menu (right side, desktop) */
.account { position: relative; }
.acct-btn { display: inline-flex; align-items: center; gap: 7px; }
.acct-btn .caret { opacity: .6; display: inline-flex; }
.acct-btn .acct-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.acct-btn .acct-initials {
  width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff;
  font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.acct-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 210px; z-index: 40;
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: 0 10px 30px rgba(20,25,35,.16); padding: 5px; display: flex; flex-direction: column;
}
.acct-menu[hidden] { display: none; }
.acct-item {
  display: block; text-align: left; background: none; border: none; cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--ink); padding: 6px 10px; border-radius: 3px; width: 100%;
  text-decoration: none;
}
.acct-item:hover { background: var(--hover); text-decoration: none; }
.acct-sep { height: 1px; background: var(--line); margin: 5px 0; }
.acct-head { padding: 6px 10px 2px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }

/* hamburger + mobile drawer (hidden on desktop) */
nav.topbar .menu-toggle {
  display: none; background: none; border: none; border-radius: var(--r);
  padding: 8px; cursor: pointer; color: rgba(255,255,255,.86); flex-shrink: 0;
}
nav.topbar .menu-toggle:hover { background: rgba(255,255,255,.09); }
nav.topbar .nav-drawer { display: none; }

@media (max-width: 760px) {
  nav.topbar .nav-primary,
  nav.topbar #theme-btn,
  nav.topbar #account-slot { display: none; }
  nav.topbar .menu-toggle { display: inline-flex; }
  nav.topbar.open .nav-drawer {
    display: flex; flex-direction: column;
    position: absolute; top: 48px; left: 0; right: 0; z-index: 45;
    background: var(--card); border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(20,25,35,.14); padding: 6px 12px 12px;
  }
  nav.topbar .nav-drawer a.navlink,
  nav.topbar .nav-drawer .acct-action {
    display: block; padding: 10px 6px; font: inherit; font-size: 15px; font-weight: 500;
    text-align: left; background: none; border: none; width: 100%; cursor: pointer; color: var(--ink);
    box-shadow: none;
  }
  nav.topbar .nav-drawer a.navlink.active { color: var(--accent); box-shadow: none; }
  nav.topbar .nav-drawer-account { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
  nav.topbar .nav-drawer .drawer-me { font-size: 12.5px; color: var(--muted); padding: 6px 6px 2px; }
}

/* avatars */
.hq-av { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #E3E6EB; color: var(--muted); font-size: 11px; font-weight: 600; overflow: hidden; }
.hq-av img { width: 100%; height: 100%; object-fit: cover; }
.av-up { cursor: pointer; display: inline-flex; }
.av-up:hover .hq-av { outline: 2px solid var(--accent); outline-offset: 1px; }
.adm { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.adm input { margin: 0; }
/* person chip: photo or initials on the person's color */
.p-av {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; color: #fff; flex-shrink: 0;
  font-size: 9.5px; font-weight: 700; letter-spacing: .02em; object-fit: cover; vertical-align: -5px;
}

/* ---------- panels & layout ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px; margin-bottom: 16px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.mt0 { margin-top: 0; }
.flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* a list of rows in one panel, ruled by hairlines (project lists, update lists) */
.row-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 16px; }
.row-panel > .card { border: none; border-bottom: 1px solid var(--line-soft); border-radius: 0; margin: 0; background: transparent; }
.row-panel > .card:first-child { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.row-panel > .card:last-child { border-bottom: none; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.row-panel > .card:hover { background: #FAFBFC; }
.row-panel > .empty { padding: 10px 14px; margin: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }

/* page help: the explainer for a page or panel lives behind a small info button */
.help-btn {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: 2px;
  width: 16px; height: 16px; margin-left: 7px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--card); color: var(--muted);
  font: 600 10px/1 var(--font); cursor: pointer;
}
.help-btn:hover, .help-btn.on { border-color: var(--accent); color: var(--accent); }
.page-help { display: none; }
.page-help.show {
  display: block; max-width: 760px; margin: 2px 0 14px; padding: 8px 12px;
  background: var(--card); border: 1px solid var(--line); border-left: 2px solid var(--accent);
  border-radius: var(--r); font-size: 13px; color: var(--ink-2);
}
@media print { .help-btn { display: none !important; } }

/* section label (group headings above lists) */
.sec-label, .upd-head, .plist-head, .bud-head, .grp-head, .cap-week-h {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}

/* ---------- tags ---------- */
.badge {
  display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 11.5px; font-weight: 500;
  white-space: nowrap; line-height: 1.5;
}
.badge.todo { background: #EDEFF2; color: #566070; }
.badge.na { background: #F3F4F6; color: var(--faint); text-decoration: line-through; }
.badge.in_progress { background: var(--blue-soft); color: var(--blue); }
.badge.stuck { background: var(--warn-soft); color: var(--warn); }
.badge.on_hold { background: var(--hold-soft); color: var(--hold); }
.badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.long-lead { background: var(--purple-soft); color: var(--purple); }
.badge.overdue { background: var(--warn-soft); color: var(--warn); }
.badge.internal { background: var(--hold-soft); color: var(--hold); }
.badge.phase { background: #EDEFF2; color: #566070; }
.badge.blocked { background: var(--purple-soft); color: var(--purple); }
/* severity dot (replaces colored emoji) */
.sev-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.sev-dot.red { background: var(--warn); }
.sev-dot.orange { background: #D4792B; }
.sev-dot.yellow { background: #D3A91C; }
.sev-dot.grey { background: #B4BAC4; }
.sev-dot.green { background: #3B946C; }

/* reminder-style tasks: pointers back to another tab, not real checklist items */
.task-reminder td { background: #FAFBFC; }
.task-reminder em { color: var(--muted); }
/* links: draggable rows */
.link-row { display: flex; align-items: center; gap: 8px; padding: 5px 2px; border-bottom: 1px solid var(--line-soft); }
.link-row:last-child { border-bottom: none; }
.link-row.dragging { opacity: .45; }
.drag-grip { cursor: grab; color: #B9BFC9; user-select: none; }
.link-row .drag-grip { cursor: grab; color: #B9BFC9; user-select: none; }
/* client versions table inside a deliverable card */
.dv-vtable { font-size: 12.5px; }
.dv-vtable th { font-size: 10.5px; padding: 2px 6px; }
.dv-vtable td { padding: 3px 6px; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--ink); color: #fff; border: 1px solid transparent; cursor: pointer;
  border-radius: var(--r); padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 500; line-height: 1.35;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: #2D333E; text-decoration: none; }
.btn.green { background: var(--accent); }
.btn.green:hover { background: var(--accent-strong); }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--hover); }
.btn.small { padding: 3px 9px; font-size: 12.5px; }
.btn.danger { background: var(--warn); }
.btn.danger:hover { background: #A92E24; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  font: inherit; font-size: 13.5px; color: var(--ink); background: #fff; border: 1px solid var(--line-2);
  border-radius: var(--r); padding: 6px 9px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(10,125,144,.16); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: auto; padding: 0; margin: 0; flex: none; }
input[type="checkbox"]:focus, input[type="radio"]:focus { box-shadow: none; }
/* placeholders must read as hints, not data — light + italic */
input::placeholder, textarea::placeholder { color: #AEB5C0; opacity: 1; font-style: italic; font-weight: 400; }
/* pulse a required-but-empty field when its Add button is clicked (see flashField) */
@keyframes flashEmpty {
  0%, 100% { box-shadow: 0 0 0 0 rgba(10,125,144,0); }
  25%, 60% { box-shadow: 0 0 0 3px rgba(10,125,144,.35); }
}
.flash-empty { animation: flashEmpty .6s ease; border-color: var(--accent) !important; }
label { font-size: 12px; font-weight: 500; color: var(--muted); display: block; margin-bottom: 3px; }
label.btn { margin-bottom: 0; }
.field { margin-bottom: 12px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; }

/* remove / delete: one quiet control everywhere */
.x-btn {
  background: none; border: none; cursor: pointer; color: var(--faint); font: inherit; font-size: 12px; line-height: 1;
  padding: 5px 7px; border-radius: 3px;
}
.x-btn:hover { background: var(--warn-soft); color: var(--warn); }
/* empty inline date fields stay quiet until they hold a date or are being edited */
td input.mini[type="date"][value=""]:not(:focus) { color: #B4BAC4; }
td input.mini[type="date"]::-webkit-calendar-picker-indicator { opacity: .3; cursor: pointer; }
td input.mini[type="date"]:hover::-webkit-calendar-picker-indicator { opacity: .8; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line);
}
td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td .mini { border-color: transparent; background: transparent; padding: 3px 4px; width: auto; }
td .mini:hover { border-color: var(--line-2); }
td .mini:focus { background: #fff; }
td select.mini { max-width: 130px; }
td input.mini[type="date"] { max-width: 140px; }

/* task rows */
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-row.done .task-title strong { font-weight: 500; color: var(--muted); }
input.task-check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* dashboard */
.dash-section h2 { display: flex; align-items: center; gap: 8px; }
.count-pill {
  display: inline-block; background: #E9ECF0; color: var(--muted); border-radius: 3px;
  font-size: 11.5px; font-weight: 600; padding: 0 5px; line-height: 1.55; letter-spacing: 0;
  font-variant-numeric: tabular-nums; vertical-align: 1px; text-transform: none;
}
.empty { color: var(--muted); padding: 6px 0; font-size: 13px; }

/* project cards */
.proj-card { display: block; color: inherit; }
.proj-card:hover { text-decoration: none; border-color: var(--line-2); }
.proj-meta { display: flex; gap: 18px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.bar { height: 4px; background: #E9ECF0; border-radius: 2px; overflow: hidden; margin: 8px 0 4px; }
.bar > div { height: 100%; background: var(--accent); border-radius: 2px; }
.bar > div.over { background: var(--warn); }

/* chat (intake + assistants) */
.chat-box { display: flex; flex-direction: column; gap: 10px; min-height: 300px; }
.msg { max-width: 82%; padding: 9px 12px; border-radius: var(--r-lg); white-space: pre-wrap; font-size: 13.5px; }
.msg.user { align-self: flex-end; background: var(--ink); color: #fff; }
.msg.ai { align-self: flex-start; background: var(--hover); }
.msg.ai.thinking { color: var(--muted); }
.chat-input { display: flex; gap: 8px; margin-top: 14px; align-items: flex-end; }
.chat-input textarea { resize: none; height: 70px; }

/* plan preview */
.plan-preview { border-color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }

/* review markdown-ish */
.review-body h2 { font-size: 14px; margin: 14px 0 6px; }
.review-body ul { margin: 4px 0 10px; padding-left: 20px; }
.review-body li { margin-bottom: 3px; }

/* login */
.login-wrap { max-width: 360px; margin: 14vh auto 0; }
.login-wrap .logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; }
.login-wrap .logo img { height: 24px; }
.login-wrap .logo .logo-hq {
  font-size: 13px; font-weight: 600; letter-spacing: .1em; color: var(--muted);
  border-left: 1px solid var(--line-2); padding-left: 10px; line-height: 1.2;
}

.err { color: var(--warn); font-size: 13px; margin-top: 8px; }

/* ---------- assistants: a docked launcher + a right-hand drawer ---------- */
#hq-asst-fab, #hq-ask-fab {
  position: fixed; right: 16px; bottom: 16px; height: 34px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: var(--r); background: var(--ink); color: #fff; border: 1px solid rgba(255,255,255,.08);
  font: 500 13px/1 var(--font); cursor: pointer; box-shadow: 0 4px 14px rgba(20,25,35,.22);
}
#hq-asst-fab { z-index: 899; }
#hq-ask-fab { z-index: 897; }
#hq-asst-fab:hover, #hq-ask-fab:hover { background: #2D333E; }
body:has(#hq-asst-fab) #hq-ask-fab { bottom: 58px; }
#hq-asst-panel, #hq-ask-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100vw;
  background: var(--card); border-left: 1px solid var(--line-2);
  box-shadow: -12px 0 32px rgba(20,25,35,.10);
  flex-direction: column; overflow: hidden;
}
#hq-asst-panel { z-index: 901; }
#hq-ask-panel { z-index: 900; display: flex; }
#hq-ask-panel[hidden] { display: none; }
.asst-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 10px 0 14px; height: 48px; flex: none; border-bottom: 1px solid var(--line); }
.asst-head strong { font-size: 13.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asst-head button { background: none; border: none; cursor: pointer; font-size: 13px; color: var(--muted); padding: 6px 8px; border-radius: 3px; }
.asst-head button:hover { background: var(--hover); color: var(--ink); }
.asst-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.asst-log .msg { max-width: 92%; }
.asst-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; flex: none; }
.asst-input textarea { resize: vertical; height: 84px; min-height: 56px; max-height: 260px; }
body.production-scope #hq-ask-fab, body.production-scope #hq-ask-panel { display: none; }
@media print { #hq-ask-fab, #hq-ask-panel, #hq-asst-fab, #hq-asst-panel { display: none !important; } }

/* undo toast */
#undo-toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: var(--r); padding: 8px 14px;
  display: flex; gap: 14px; align-items: center; z-index: 1000;
  box-shadow: 0 6px 20px rgba(20,25,35,.28); font-size: 13px; max-width: 90vw;
}
#undo-toast button { background: none; border: none; cursor: pointer; font: inherit; padding: 0; }
#undo-toast .undo-btn { color: #7FD6E4; font-weight: 600; }
#undo-toast .undo-x { color: #A7AEBA; }

/* project page tabs */
.tabbar { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 14px 0 18px; flex-wrap: wrap; }
.tabbar button {
  font: inherit; font-size: 13.5px; font-weight: 500; color: var(--muted);
  background: none; border: none; cursor: pointer; padding: 8px 12px 9px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabbar button:hover { color: var(--ink); }
.tabbar button.active { color: var(--ink); border-bottom-color: var(--ink); }
.tabbar button .count-pill { margin-left: 4px; }
[data-tab-panel] { display: none; }
[data-tab-panel].tab-show { display: block; }

/* segmented view toggle */
.view-toggle { display: inline-flex; }
.view-toggle .btn { border-radius: 0; margin-left: -1px; }
.view-toggle .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.view-toggle .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.view-toggle .btn.active { background: var(--ink); color: #fff; border-color: var(--ink); position: relative; }

/* board view */
.board { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 12px; align-items: flex-start; }
.board-col {
  flex: 1 0 190px; min-width: 190px; background: #ECEEF2; border-radius: var(--r-lg);
  padding: 8px; min-height: 120px; transition: background .15s;
}
.board-col.drag-over { background: #E1E5EA; outline: 1px dashed var(--accent); outline-offset: -1px; }
.board-col-head {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  margin: 2px 2px 8px; display: flex; justify-content: space-between; font-variant-numeric: tabular-nums;
}
.board-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px;
  margin-bottom: 6px; cursor: grab; font-size: 13px;
}
.board-card:hover { border-color: var(--line-2); }
.board-card { overflow-wrap: anywhere; }
.card { overflow-wrap: break-word; }
.board-card:active { cursor: grabbing; }
.board-card .bc-title { font-weight: 600; margin-bottom: 3px; }
.board-card.done .bc-title { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.board-card .badge { font-size: 11px; }
.bc-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* modals */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(22,25,30,.42); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto;
}
.modal {
  background: var(--card); border-radius: 8px; max-width: 640px; width: 100%;
  padding: 20px 22px; box-shadow: 0 20px 60px rgba(20,25,35,.28); position: relative;
}
.modal .close-x {
  position: absolute; top: 10px; right: 10px; background: none; border: none;
  font-size: 18px; line-height: 1; color: var(--muted); cursor: pointer; padding: 6px 9px; border-radius: 3px;
}
.modal .close-x:hover { background: var(--hover); color: var(--ink); }
.modal h2 { font-size: 16px; padding-right: 30px; }
.modal h2[contenteditable] { outline: none; border-bottom: 1px dashed transparent; }
.modal h2[contenteditable]:focus { border-bottom-color: var(--line-2); }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.grid2m { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 640px) { .grid3, .grid2m { grid-template-columns: 1fr; } }
.comment { border-top: 1px solid var(--line); padding: 8px 0; }
.comment .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; }

/* ---------- calendar: one ruled grid ---------- */
.cal-daynames {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 0;
  border: 1px solid var(--line); border-bottom: none; border-radius: var(--r) var(--r) 0 0; background: #FAFBFC;
}
.cal-daynames span {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  padding: 5px 7px; border-right: 1px solid var(--line);
}
.cal-daynames span:last-child { border-right: none; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-cell {
  background: #fff; border: none; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  border-radius: 0; min-height: 96px; padding: 5px 6px; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
}
.cal-cell:hover { background: #FAFBFC; }
.cal-cell.other-month { background: #F7F8FA; cursor: default; }
.cal-cell.other-month > * { opacity: .5; }
.cal-cell.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell .cal-daynum { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-cell.today .cal-daynum {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff;
}
.cal-pill {
  font-size: 11.5px; padding: 1px 5px; border-radius: 3px; background: var(--accent-soft); color: var(--accent-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.5;
}
.cal-pill.overdue { background: var(--warn-soft); color: var(--warn); }
.cal-pill.more { background: none; color: var(--muted); }
.cal-legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }
.cal-list-item { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.cal-list-item:last-child { border-bottom: none; }

/* ---------- deliverables ---------- */
.dv-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 14px; margin-bottom: 10px; background: var(--card); }
.dv-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dv-head .dv-title { font-weight: 600; font-size: 14.5px; border-color: transparent; background: transparent; padding: 3px 4px; min-width: 150px; flex: 1; }
.dv-head .dv-title:hover { border-color: var(--line-2); }
.dv-head .dv-title:focus { background: #fff; }
.dv-head .dv-format { width: 60px; }
.dv-head .dv-due { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.dv-head select { width: auto; min-width: 130px; flex: 0 0 auto; }
.dv-head .dv-stage { font-weight: 500; }
.dv-sub { margin-top: 8px; font-size: 12.5px; }
.dv-link-wrap { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.dv-link { flex: 1; min-width: 140px; color: var(--accent); }
.dv-link-open { white-space: nowrap; font-weight: 500; }
.dv-versions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.dv-versions-label { align-self: center; }
.dv-version { display: inline-flex; align-items: center; gap: 6px; background: #FAFBFC; border: 1px solid var(--line); border-radius: var(--r); padding: 3px 8px; }
.dv-version-label { font-weight: 600; font-size: 12.5px; color: var(--ink); }
.dv-version-field { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); margin: 0; }
.dv-version-field input { padding: 2px 4px; }
.dv-version-x { padding: 2px 6px; }
.dv-comments { margin-top: 10px; }
.dv-comments > summary { cursor: pointer; color: var(--muted); font-weight: 500; list-style: none; }
.dv-comments > summary::-webkit-details-marker { display: none; }
.dv-comments > summary:hover { color: var(--ink); }
.dv-comments-body { margin-top: 8px; }
.dv-cmt-list .comment { border-top: 1px solid var(--line); padding: 8px 0; }
.dv-cmt-add { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.dv-cmt-add .dv-cmt-text { flex: 1; }
.dv-cmt-as { width: auto; min-width: 90px; }
.dv-cmt-x { padding: 1px 6px; float: right; }

/* deliverables board (cross-project) */
.deliv-board { align-items: stretch; }
.deliv-board .board-col { flex: 1 0 210px; min-width: 210px; }
.deliv-card { cursor: pointer; }
.deliv-card.dragging { opacity: .5; }
.deliv-card .dc-client { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 2px; }
.deliv-card .dc-flags { display: flex; flex-wrap: wrap; gap: 4px; margin: 5px 0 2px; }
.dc-flag { font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 3px; line-height: 1.5; }
.dc-flag.overdue { background: var(--warn-soft); color: var(--warn); }
.dc-flag.waiting { background: var(--hold-soft); color: var(--hold); }
.dc-flag.unassigned { background: #EDEFF2; color: #566070; }
.deliv-card .dc-editor {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border-radius: 50%; border: 1px dashed #B4BAC4; color: var(--faint); font-size: 10px; font-weight: 600;
  margin-right: 2px; vertical-align: -5px;
}
.deliv-card .dc-due-over { color: var(--warn); font-weight: 600; }
.dc-empty { min-height: 8px; }

/* production-only crew logins: nav is stripped to Production; hide app-wide actions */
body.production-scope .nav-new,
body.production-scope #hq-asst-fab,
body.production-scope #hq-asst-panel,
body.production-scope .team-note { display: none !important; }

/* production hub */
.shoot-past td { opacity: .55; }
.prod-docs-row { display: flex; gap: 16px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.prod-docs-row:last-child { border-bottom: none; }
.prod-docs-project { flex: 0 0 200px; }
.prod-docs-links { display: flex; gap: 6px; flex-wrap: wrap; }
.prod-doc {
  display: inline-block; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 2px 8px; font-size: 12.5px; font-weight: 500; color: var(--ink);
}
.prod-doc:hover { background: var(--hover); text-decoration: none; }

/* needs attention: severity is a dot, not a color wash */
.conflict-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.conflict-row:last-child { border-bottom: none; }
.conflict-icon { flex-shrink: 0; line-height: 1.5; }
.attn-row { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.attn-row:last-child { border-bottom: none; }
.attn-row.grey { color: var(--muted); }
.attn-row.grey a > strong { color: var(--ink-2); font-weight: 500; }
.attn-icon { flex-shrink: 0; display: inline-flex; align-items: center; height: 21px; }
.attn-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin: -4px 0 8px; }
.attn-key span { display: inline-flex; align-items: center; gap: 6px; }

/* dashboard project-update rows */
.upd-head { margin: 18px 0 8px; }
.upd-card { padding: 9px 14px 10px; margin-bottom: 6px; }
.upd-card.dragging { opacity: .45; }
.upd-card .drag-grip { margin-right: 6px; }
.inv-line { font-size: 12px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.stepper { display: flex; gap: 3px; margin: 8px 0 2px; }
.step { flex: 1; }
.step-bar { height: 3px; border-radius: 1px; background: #E3E6EB; }
.step.on .step-bar { background: var(--accent); }
.step.cur .step-lbl { color: var(--ink); font-weight: 600; }
.step-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); margin-top: 4px; white-space: nowrap; }
.stepper-unset .step-bar { background: #EEF0F3; }
/* editable status note */
.status-note { margin-top: 4px; padding: 3px 6px; margin-left: -6px; border-radius: 3px; border: 1px solid transparent; }
.status-note:hover { border-color: var(--line-2); background: #fff; cursor: text; }
.status-note:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(10,125,144,.16); background: #fff; }
td.status-note { margin-left: 0; }

/* capacity snapshot */
.cap-legend { display: flex; gap: 14px; margin: 2px 0 10px; }
.cap-legend .seg, .cap-bar .seg { display: inline-block; }
.cap-legend i.seg { width: 9px; height: 9px; border-radius: 2px; vertical-align: -1px; margin-right: 5px; }
.seg.client { background: #C2524A; } .seg.internal { background: #4C6FA8; }
.seg.free { background: #6FA583; } .seg.pto { background: #BFC4CC; }
.cap-week-h { margin: 12px 0 6px; }
.cap-row { padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.cap-row:last-child { border-bottom: none; }
.cap-bar { display: flex; gap: 1px; height: 6px; border-radius: 2px; overflow: hidden; margin: 5px 0 3px; background: #EEF0F3; }
.cap-bar .seg { height: 100%; }
.cap-edit { padding: 0 6px; font-size: 11.5px; }
.cap-form { margin-top: 8px; }
.cap-form[hidden] { display: none; }

/* summary strip (dashboard counts) */
.stat-chips { display: inline-flex; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); margin: 4px 0 18px; }
.stat-chip { display: inline-flex; align-items: baseline; gap: 8px; padding: 9px 20px 9px 16px; border-right: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.stat-chip:last-child { border-right: none; }
.stat-chip b { font-size: 19px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-chip .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; align-self: center; }
.empty-state { text-align: center; padding: 22px 16px; color: var(--muted); }
.empty-state .es-title { font-weight: 600; color: var(--ink-2); font-size: 13.5px; margin-bottom: 2px; }
.empty-state .es-sub { font-size: 12.5px; }

/* presenter highlight — click a project card while screen-sharing so the room knows
   which project is being discussed; the assistant follows the highlighted card */
.upd-card[data-pid] { cursor: pointer; }
.upd-card.presenting, .row-panel > .upd-card.presenting { box-shadow: inset 0 0 0 2px #D8452F; background: #FFF8F6; }
.upd-card.presenting a > strong::after {
  content: 'Presenting'; margin-left: 8px; background: #D8452F; color: #fff; vertical-align: 1px;
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 3px; letter-spacing: .05em; text-transform: uppercase;
}

/* calendar day-zoom modal */
.dayzoom-backdrop { position: fixed; inset: 0; background: rgba(22,25,30,.42); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px; }
.dayzoom { background: var(--card); border-radius: 8px; max-width: 640px; width: 100%; max-height: 82vh; overflow-y: auto; padding: 18px 22px; box-shadow: 0 20px 60px rgba(20,25,35,.28); }
.dayzoom h2 { margin: 0 0 4px; font-size: 16px; }
.dayzoom .dz-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.dayzoom .dz-item:last-child { border-bottom: none; }

/* styled dropdown menus where the browser supports it (Chromium); others keep the native picker */
@media (hover: hover) and (pointer: fine) {
  select, ::picker(select) { appearance: base-select; }
  select { display: inline-flex; align-items: center; justify-content: space-between; gap: 6px; white-space: nowrap; }
  select::picker-icon { color: var(--muted); font-size: 9px; }
  ::picker(select) {
    border: 1px solid var(--line-2); border-radius: var(--r); background: var(--card);
    box-shadow: 0 8px 24px rgba(20,25,35,.14); padding: 3px; margin-top: 3px;
  }
  select option {
    padding: 5px 10px; border-radius: 3px; font-size: 13px; color: var(--ink);
    display: flex; align-items: center; gap: 8px;
  }
  select option:hover, select option:focus { background: var(--hover); }
  select option:checked { background: var(--accent-soft); color: var(--accent-strong); font-weight: 500; }
  select option:disabled { color: var(--faint); }
}

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .wrap { padding: 0 14px 70px; }
  nav.topbar { margin-bottom: 16px; }
  h1 { font-size: 18px; }
  .card { padding: 14px; }
  .grid2 { grid-template-columns: 1fr; }
  #hq-asst-panel, #hq-ask-panel { width: 100vw; border-left: none; }
  /* calendar is dense — tiles collapse to thin color bars (tap a day for the list) */
  .cal-cell { min-height: 54px; padding: 3px; }
  .cal-cell .cal-pill { font-size: 0; height: 4px; padding: 0; border-radius: 1px; overflow: hidden; }
  .cal-cell .cal-pill.more { display: none; }
  .cal-daynames span { padding: 4px 3px; text-align: center; }
  .modal { padding: 18px 14px; }
  .stat-chips { display: flex; flex-wrap: nowrap; }
  .stat-chip { flex: 1 1 0; flex-direction: column; align-items: flex-start; gap: 0; padding: 8px 12px; min-width: 0; }
  .stat-chip .dot, .stat-chip .sev-dot { display: none; }
  /* task tables scroll sideways instead of squeezing the title column */
  .table-scroll td:first-child { min-width: 170px; }
}

/* print / save-as-PDF: strip the app chrome so boards print clean */
@media print {
  nav.topbar, .annc-bar, .btn, button, .inline-form,
  .menu-toggle, .nav-drawer, select.cat-select, .drag-grip { display: none !important; }
  body { background: #fff !important; padding: 0; }
  .card { border: 1px solid #ddd; break-inside: avoid; }
  a { text-decoration: none; color: inherit; }
}
