/* Inter, bundled with the app (SIL Open Font License, see fonts/OFL-Inter.txt): the same look on every machine */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/inter-latin-800-normal.woff2') format('woff2'); }
/* Project Tracker v2 -- one stylesheet for the shell and every page.
   Same brand as the classic UI (dark, coral accent, the 14px/4px corner
   signature); new: a sidebar layout, a shared page header, one task panel. */
:root {
  --accent: #fd8455;
  --accent-ink: #1a1208;
  --bg: #14161b;
  --side-bg: #101216;
  --card-bg: #1d2027;
  --card-2: #232730;
  --card-border: #2a2e37;
  --text: #eef0f3;
  --text-dim: #a7adb8;
  --text-faint: #6b7280;
  --critical: #ef4444;
  --high: #f59e0b;
  --medium: #60a5fa;
  --low: #6b7280;
  --ok: #34d399;
  --review: #a78bfa;
  --side-w: 236px;
  --radius: 14px 4px 14px 4px;
  --radius-sm: 10px 4px 10px 4px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif; font-size: 15px; line-height: 1.45;
}
body.booting #page { visibility: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.dim { color: var(--text-faint); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---- controls ---- */
button, .btn {
  background: var(--accent); color: var(--accent-ink); border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 8px 15px; font-weight: 700; cursor: pointer;
  font-size: 0.85rem; font-family: inherit; display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; line-height: 1.2;
}
button:hover, .btn:hover { filter: brightness(1.06); text-decoration: none; }
button:disabled { opacity: .5; cursor: default; }
button.secondary, .btn.secondary { background: var(--card-bg); color: var(--text); border-color: var(--card-border); }
button.secondary:hover, .btn.secondary:hover { background: var(--card-2); filter: none; }
button.ghost { background: transparent; color: var(--text-dim); border-color: transparent; padding: 6px 10px; }
button.ghost:hover { background: var(--card-2); color: var(--text); filter: none; }
button.danger, .btn.danger { background: var(--critical); color: #fff; }
button.small, .btn.small { font-size: 0.75rem; padding: 5px 11px; }
input, select, textarea {
  background: var(--bg); border: 1px solid var(--card-border); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 0.85rem; font-family: inherit; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 0; border-color: var(--accent); }
textarea { width: 100%; resize: vertical; min-height: 70px; }
#tpNotes { resize: none; }
label { display: block; font-size: 0.74rem; color: var(--text-dim); margin: 0 0 4px; font-weight: 600; }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 0.82rem; color: var(--text-dim); margin: 0; font-weight: 500; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row.center { align-items: center; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.error { color: var(--critical); font-size: 0.82rem; margin-top: 8px; min-height: 1em; }
.meta { color: var(--text-faint); font-size: 0.78rem; margin-top: 2px; }
.seg { display: inline-flex; border: 1px solid var(--card-border); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); }
.seg button { border: 0; border-radius: 0; background: transparent; color: var(--text-dim); font-size: 0.78rem; padding: 6px 13px; font-weight: 600; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.seg button:hover:not(.on) { background: var(--card-2); filter: none; }

/* ---- shell ---- */
#shell { display: flex; min-height: 100vh; }
#side {
  width: var(--side-w); flex: none; background: var(--side-bg); border-right: 1px solid var(--card-border);
  display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; z-index: 40;
}
/* (dvh: on a phone 100vh is taller than what shows above the browser bar, which pushed the account menu and Log out out of sight) */
.brand { font-weight: 800; font-size: 1.1rem; padding: 4px 10px 14px; letter-spacing: -.01em; color: var(--text); display: block; }
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }
.company { font-size: 0.74rem; color: var(--text-faint); padding: 0 10px 12px; margin-top: -10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#side .newtask { width: 100%; justify-content: center; margin-bottom: 10px; padding: 10px; }
#side .find {
  width: 100%; justify-content: space-between; background: var(--bg); border: 1px solid var(--card-border); color: var(--text-faint);
  font-weight: 500; padding: 8px 10px; margin-bottom: 14px;
}
#side .find kbd { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 5px; padding: 0 6px; font-size: 0.68rem; color: var(--text-dim); font-family: inherit; }
.navgroup { font-size: 0.66rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-faint); padding: 14px 10px 6px; font-weight: 700; }
.navlink {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--text-dim);
  font-weight: 600; font-size: 0.88rem; margin-bottom: 2px;
}
.navlink svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.navlink:hover { background: var(--card-bg); color: var(--text); text-decoration: none; }
.navlink.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--card-border); position: relative; }
.userchip { width: 100%; justify-content: flex-start; background: transparent; color: var(--text); border: 0; padding: 8px 10px; font-weight: 600; gap: 10px; }
.userchip:hover { background: var(--card-bg); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 0.8rem; flex: none; }
#userMenu { position: absolute; bottom: 58px; left: 4px; right: 4px; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; padding: 6px; box-shadow: 0 12px 30px rgba(0,0,0,.5); }
.navpending { visibility: hidden; }
#userMenu .menu-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); padding: 6px 10px 2px; font-weight: 700; }
#userMenu .menu-sep { height: 1px; background: var(--card-border); margin: 6px 4px; }
#userMenu a, #userMenu button { display: flex; width: 100%; text-align: left; background: transparent; color: var(--text); border: 0; padding: 8px 10px; border-radius: 8px; font-weight: 600; font-size: 0.84rem; }
#userMenu a:hover, #userMenu button:hover { background: var(--card-2); text-decoration: none; filter: none; }
.previewnote { font-size: 0.72rem; color: var(--text-faint); padding: 10px 10px 0; }
#content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar { display: none; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--card-border); background: var(--side-bg); position: sticky; top: 0; z-index: 30; }
#topbar .brand { padding: 0; flex: 1; }
#page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 32px 90px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; }
.page-head .sub { color: var(--text-faint); font-size: 0.85rem; margin-top: 2px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- cards & sections ---- */
.card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card > h2, .section-title { margin: 0 0 4px; font-size: 1rem; font-weight: 800; }
.card .lead { color: var(--text-dim); font-size: 0.82rem; margin: 0 0 12px; }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.empty { color: var(--text-faint); font-size: 0.85rem; padding: 14px 4px; }
.group-title { margin: 22px 0 8px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); font-weight: 800; }
.project-title { margin: 14px 0 6px; font-weight: 800; color: var(--accent); font-size: 0.95rem; }
.project-title a { color: inherit; }
.filterbar { display: flex; gap: 10px 12px; flex-wrap: wrap; align-items: end; padding: 14px 16px; margin-bottom: 16px; }
.filterbar > div { min-width: 130px; }
.filterbar select, .filterbar input[type=search], .filterbar input[type=text] { width: 100%; }

/* ---- task rows (shared by Today, Tasks, Projects) ---- */
.task { padding: 11px 0 11px 10px; border-bottom: 1px solid var(--card-border); border-left: 3px solid transparent; }
.task:last-child { border-bottom: none; }
.task.is-review { border-left-color: var(--review); background: color-mix(in srgb, var(--review) 6%, transparent); }
.task.is-archived { opacity: .55; }
.task-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.task-title { font-weight: 600; cursor: pointer; }
.task-title:hover { color: var(--accent); }
.task-id { color: var(--text-faint); font-family: ui-monospace, Menlo, monospace; font-size: 0.68rem; margin-right: 6px; }
.task-meta { color: var(--text-faint); font-size: 0.78rem; margin-top: 3px; display: flex; gap: 4px 10px; flex-wrap: wrap; align-items: center; }
.task-meta .due.late { color: var(--critical); font-weight: 700; }
.task-meta .due.soon { color: var(--high); font-weight: 700; }
.task-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.prio { font-size: 0.66rem; text-transform: uppercase; font-weight: 800; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.prio-critical { background: color-mix(in srgb, var(--critical) 20%, transparent); color: var(--critical); }
.prio-high { background: color-mix(in srgb, var(--high) 20%, transparent); color: var(--high); }
.prio-medium { background: color-mix(in srgb, var(--medium) 20%, transparent); color: var(--medium); }
.prio-low { background: color-mix(in srgb, var(--low) 30%, transparent); color: var(--text-dim); }
.pill { font-size: 0.66rem; text-transform: uppercase; font-weight: 800; letter-spacing: .04em; padding: 1px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--card-border); color: var(--text-dim); white-space: nowrap; }
.pill.review { background: color-mix(in srgb, var(--review) 22%, transparent); color: var(--review); border-color: transparent; }
.pill.done { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); border-color: transparent; }
.pill.active { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); border-color: transparent; }
.pill.blocked { background: color-mix(in srgb, var(--critical) 18%, transparent); color: var(--critical); border-color: transparent; }
.pill.archived { opacity: .8; }
.timer-dot { color: var(--accent); }

/* ---- list rows (people, clients, sessions, accounts) ---- */
.listrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--card-border); font-size: 0.88rem; flex-wrap: wrap; }
.listrow:last-child { border-bottom: none; }
.listrow .main { flex: 1; min-width: 200px; }
.listrow .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-block; background: var(--bg); border: 1px solid var(--card-border); border-radius: 999px; padding: 2px 10px; font-size: 0.72rem; margin: 2px 4px 2px 0; color: var(--text-dim); }
.link-out { word-break: break-all; background: var(--bg); border: 1px solid var(--card-border); border-radius: 8px; padding: 10px; margin-top: 10px; font-size: 0.78rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
th { text-align: left; color: var(--text-faint); font-weight: 700; font-size: 0.7rem; text-transform: uppercase; letter-spacing: .05em; padding: 6px 8px; border-bottom: 1px solid var(--card-border); }
td { padding: 8px; border-bottom: 1px solid var(--card-border); vertical-align: top; }
tr:last-child td { border-bottom: none; }

/* ---- tabs (inside a page) ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--card-border); margin-bottom: 16px; overflow-x: auto; }
.tabs a, .tabs button { background: transparent; color: var(--text-dim); border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 9px 14px; font-weight: 700; font-size: 0.86rem; white-space: nowrap; }
.tabs .on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* ---- modal & slide-over ---- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 80; display: flex; }
.overlay.modal-wrap { align-items: flex-start; justify-content: center; padding: 8vh 16px; overflow-y: auto; }
.overlay.panel-wrap { justify-content: flex-end; }
.modal { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); width: min(560px, 100%); padding: 22px; position: relative; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.modal h2 { margin: 0 28px 14px 0; font-size: 1.1rem; }
.modal .x, .panel .x { position: absolute; top: 12px; right: 14px; background: transparent; color: var(--text-dim); border: 0; font-size: 1.5rem; padding: 0 8px; line-height: 1; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.fields .wide { grid-column: 1 / -1; }
.fields input, .fields select { width: 100%; }
.panel { width: min(520px, 100vw); height: 100%; background: var(--card-bg); border-left: 1px solid var(--card-border); overflow-y: auto; padding: 22px 22px 40px; position: relative; animation: slidein .16s ease-out; }
@keyframes slidein { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.panel .crumbs { font-size: 0.78rem; color: var(--text-faint); margin: 0 34px 8px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.panel h2.title { margin: 0 0 12px; font-size: 1.25rem; line-height: 1.25; cursor: text; border-radius: 6px; padding: 2px 4px; margin-left: -4px; }
.panel h2.title:hover { background: var(--card-2); }
.panel .title-input { font-size: 1.15rem; font-weight: 700; width: 100%; margin-bottom: 12px; }
.panel .sec { margin-top: 20px; }
.panel .sec > h3 { margin: 0 0 8px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); font-weight: 800; }
.panel .fields { grid-template-columns: 1fr 1fr; }
.entry { display: flex; flex-wrap: wrap; gap: 6px; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--card-border); font-size: 0.82rem; }
.cm { padding: 8px 0; border-bottom: 1px solid var(--card-border); font-size: 0.85rem; }
.cm .meta { margin-top: 2px; }
.notes-view { white-space: pre-wrap; font-size: 0.88rem; }

/* ---- command palette ---- */
.palette { width: min(620px, 100%); background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.55); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--card-border); border-radius: 0; padding: 16px 18px; font-size: 1rem; background: transparent; }
.palette input:focus { outline: none; }
.palette .results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette .grp { font-size: 0.66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); padding: 10px 12px 4px; font-weight: 800; }
.palette .item { display: flex; align-items: baseline; gap: 10px; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; }
.palette .item small { color: var(--text-faint); margin-left: auto; font-size: 0.74rem; white-space: nowrap; }
.palette .item.sel, .palette .item:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.palette .hint { padding: 8px 16px; font-size: 0.72rem; color: var(--text-faint); border-top: 1px solid var(--card-border); }

/* ---- toast ---- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card-bg); border: 1px solid var(--card-border); color: var(--text);
  border-radius: var(--radius-sm); padding: 12px 20px; font-size: 0.85rem; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 120; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; max-width: min(560px, 92vw);
}
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { border-color: var(--critical); color: var(--critical); }
#toast.has-action.visible { pointer-events: auto; }

/* ---- login ---- */
#login { position: fixed; inset: 0; background: var(--bg); z-index: 200; display: grid; place-items: center; padding: 20px; }
#login .box { width: min(360px, 100%); text-align: center; }
#login input { width: 100%; margin-bottom: 10px; padding: 11px 12px; }
#login button { width: 100%; justify-content: center; padding: 11px; }
#login h1 { font-size: 1.5rem; margin: 0 0 18px; }
#login h1 span { color: var(--accent); }

/* ---- waterfall (Projects) ---- */
#waterfallScroll { overflow-x: auto; overflow-y: hidden; border-radius: 10px; }
#waterfallSvg { display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--text-dim); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.wf-node rect { stroke-width: 1.5; cursor: pointer; }
.wf-node text { fill: var(--text); font-size: 11px; font-family: Inter, sans-serif; pointer-events: none; }
.wf-node .wf-meta { fill: var(--text-faint); font-size: 9px; }
.wf-edge { stroke: var(--card-border); stroke-width: 1.5; fill: none; }
.wf-edge.wf-edge-active { stroke: var(--accent); stroke-width: 2; }
.wf-tier-done rect { fill: color-mix(in srgb, var(--ok) 10%, var(--card-bg)); stroke: color-mix(in srgb, var(--ok) 40%, var(--card-border)); opacity: 0.55; }
.wf-tier-active rect { fill: color-mix(in srgb, var(--accent) 16%, var(--card-bg)); stroke: var(--accent); }
.wf-tier-ready rect { fill: var(--card-bg); stroke: var(--ok); }
.wf-tier-ready .wf-pulse { animation: wfPulse 1.8s ease-in-out infinite; }
.wf-tier-scheduled rect { fill: var(--card-bg); stroke: var(--medium); stroke-dasharray: 3 3; opacity: 0.8; }
.wf-tier-locked rect { fill: var(--card-bg); stroke: var(--card-border); opacity: 0.55; }
.wf-tier-blocked rect { fill: color-mix(in srgb, var(--critical) 14%, var(--card-bg)); stroke: var(--critical); }
.wf-tier-ready_for_review rect { fill: var(--card-bg); stroke: var(--review); stroke-dasharray: 2 3; }
.wf-tier-reviewed rect { fill: color-mix(in srgb, var(--review) 14%, var(--card-bg)); stroke: var(--review); }
@keyframes wfPulse { 0%, 100% { opacity: .15; } 50% { opacity: .55; } }
.wf-progress-track { fill: var(--card-border); }
.wf-progress-fill { fill: var(--accent); }
.wf-timer-dot { fill: var(--accent); animation: wfPulse 1.3s ease-in-out infinite; }
.wf-overrun-badge rect { fill: var(--critical); }
.wf-overrun-badge text { fill: white; font-size: 9px; font-weight: 800; }

/* ---- responsive: sidebar becomes a slide-in menu under a top bar ---- */
@media (max-width: 880px) {
  #topbar { display: flex; }
  #side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .18s ease; box-shadow: 0 0 40px rgba(0,0,0,.6); }
  body.navopen #side { transform: none; }
  .side-foot { position: sticky; bottom: 0; background: var(--side-bg); padding-bottom: 8px; } /* the menu is taller than a phone screen: keep the account chip (and Log out) in view, not at the end of a scroll */
  body.navopen::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }
  #page { padding: 18px 14px 90px; }
  .page-head h1 { font-size: 1.3rem; }
  .panel { width: 100vw; }
  .panel .fields { grid-template-columns: 1fr 1fr; }
}

/* ---- bulk edit (Tasks) ---- */
.task-line { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.selbox { margin: 0; flex: none; width: 16px; height: 16px; cursor: pointer; transform: translateY(2px); }
.task.selected { background: color-mix(in srgb, var(--accent) 9%, transparent); border-left-color: var(--accent); }
.bulkbar {
  position: fixed; left: var(--side-w); right: 0; bottom: 0; z-index: 60; background: var(--card-bg); border-top: 1px solid var(--accent);
  box-shadow: 0 -10px 30px rgba(0,0,0,.45); padding: 12px 24px; display: flex; gap: 10px 12px; flex-wrap: wrap; align-items: end;
}
.bulkbar .count { font-weight: 800; align-self: center; margin-right: 6px; }
.bulkbar select, .bulkbar input[type=date] { font-size: 0.82rem; padding: 6px 8px; }
.bulkbar .sep { flex: 1; }
@media (max-width: 880px) { .bulkbar { left: 0; padding: 10px 14px; } }

/* ---- the "More details" fold in the task panel ---- */
.more { margin-top: 20px; border-top: 1px solid var(--card-border); }
.more > summary { cursor: pointer; font-weight: 700; font-size: 0.88rem; padding: 12px 0; list-style: none; user-select: none; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: '▸'; display: inline-block; width: 16px; color: var(--text-faint); }
.more[open] > summary::before { content: '▾'; }
.more > summary .meta { display: inline; margin-left: 6px; font-weight: 500; }


/* ---- tags (coloured chips) and subtasks ---- */
.tag { --tc: #94a3b8; display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; margin: 2px 4px 2px 0; border-radius: 999px; font-size: 0.72rem; line-height: 1.4; color: var(--text);
  background: color-mix(in srgb, var(--tc) 16%, transparent); border: 1px solid color-mix(in srgb, var(--tc) 42%, transparent); white-space: nowrap; }
.tag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--tc); flex: none; }
.tag .tagx { all: unset; cursor: pointer; color: var(--text-faint); font-size: 0.9rem; line-height: 1; padding: 0 0 1px 2px; }
.tag .tagx:hover { color: var(--critical); }
.tag.sm { font-size: 0.66rem; padding: 1px 7px; margin: 0; }
.task-tags { margin-top: 5px; }
.tagedit { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.tagedit .taginput { width: 120px; padding: 3px 8px; font-size: 0.8rem; }
.subprog { font-size: 0.75rem; color: var(--text-dim); border: 1px solid var(--card-border); border-radius: 999px; padding: 0 8px; }
.subprog.all { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.subof { font-size: 0.75rem; color: var(--text-faint); cursor: pointer; }
.subof:hover { color: var(--accent); }
.task.is-sub { margin-left: 26px; border-left: 2px solid var(--card-border); padding-left: 12px; }
.subrow { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--card-border); }
.subrow.isdone .ttl { text-decoration: line-through; color: var(--text-faint); }
.subrow .ttl { cursor: pointer; flex: 1; min-width: 0; }
.subrow .ttl:hover { color: var(--accent); }
.subbar { height: 4px; border-radius: 4px; background: var(--card-border); margin: 6px 0 8px; overflow: hidden; }
.subbar > i { display: block; height: 100%; background: var(--ok); }

/* ---- documents editor ---- */
.doc-panel { width: min(780px, 100vw) !important; }

/* ---- help: (i) buttons, topic pages, the tour ---- */
button.info { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; margin-left: 7px; padding: 0; border-radius: 50%; border: 1.5px solid var(--text-faint); background: transparent; color: var(--text-dim);
  font: italic 700 11px/1 Georgia, serif; cursor: pointer; vertical-align: middle; text-transform: none; letter-spacing: 0; }
button.info:hover, button.info:focus-visible { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); filter: none; }
.help-img { display: block; width: 100%; height: auto; border-radius: 12px; margin: 10px 0 12px; border: 1px solid var(--card-border); }
.help-body p { margin: 0 0 10px; color: var(--text-dim); line-height: 1.55; }
.help-body ul, .help-body ol { margin: 0 0 10px; padding-left: 20px; color: var(--text-dim); line-height: 1.6; }
.help-body b { color: var(--text); }
kbd { font: 600 0.75rem ui-monospace, Menlo, Consolas, monospace; padding: 1px 6px; border: 1px solid var(--card-border); border-bottom-width: 2px; border-radius: 5px; background: var(--bg); color: var(--text); }
.helplink { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin: 0 0 8px; border-radius: 9px; color: var(--text-dim); font-size: 0.85rem; font-weight: 600; }
.helplink .q { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid currentColor; display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem; }
.helplink:hover { background: var(--card-2); color: var(--text); text-decoration: none; }
#tour { position: fixed; inset: 0; z-index: 9000; }
#tour .tour-dim { position: absolute; inset: 0; }
#tour.plain .tour-dim { background: rgba(8, 10, 14, .74); }
#tour .tour-hole { position: absolute; display: none; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(8, 10, 14, .74); outline: 2px solid var(--accent); pointer-events: none; transition: all .2s ease; }
#tour .tour-card { position: absolute; width: min(340px, calc(100vw - 24px)); background: var(--card-bg); border: 1px solid var(--accent); border-radius: var(--radius); padding: 16px 18px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
.tour-card h3 { margin: 2px 0 6px; font-size: 1.05rem; }
.tour-card p { margin: 0 0 14px; color: var(--text-dim); line-height: 1.5; font-size: 0.9rem; }
.tour-step { font-size: 0.7rem; color: var(--text-faint); font-weight: 700; letter-spacing: .06em; }
.tour-nav { display: flex; gap: 8px; align-items: center; }
.tourbanner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: color-mix(in srgb, var(--accent) 10%, var(--card-bg)); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 16px; font-size: 0.9rem; }
.sr { position: absolute; left: -9999px; }

/* ---- progress counter ---- */
.progbadge { position: relative; display: inline-flex; align-items: center; min-width: 96px; height: 18px; border-radius: 9px; overflow: hidden; border: 1px solid var(--card-border); background: var(--bg); vertical-align: middle; }
.progbadge i { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 38%, transparent); }
.progbadge.full i { background: color-mix(in srgb, var(--ok) 45%, transparent); }
.progbadge b { position: relative; padding: 0 8px; font-size: 0.7rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.progbig { height: 14px; border-radius: 7px; background: var(--card-border); overflow: hidden; margin: 8px 0; }
.progbig i { display: block; height: 100%; background: var(--accent); }
.progbig.full i { background: var(--ok); }

.robanner { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--critical) 50%, transparent); background: color-mix(in srgb, var(--critical) 9%, var(--card-bg)); font-size: 0.92rem; }

/* a gentle notice (not an error): something to know or ask for */
.notebox { margin: 10px 0; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 8%, var(--card-bg)); font-size: 0.9rem; }
.warnbox { margin: 10px 0; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, var(--critical) 45%, transparent); background: color-mix(in srgb, var(--critical) 8%, var(--card-bg)); font-size: 0.9rem; }
/* an empty date in a table row shows nothing until you point at it */
input.cell.empty:not(:focus):not(:hover)::-webkit-datetime-edit { color: transparent; }
input.cell.empty:not(:focus):not(:hover)::-webkit-calendar-picker-indicator { opacity: .2; }
/* the first-time tour steps aside while the search palette is open */
body:has(.palette-wrap) #tour { display: none; }
/* on a phone the filters hide behind a button, so the first screen is the work itself */
.filter-toggle { display: none; }
@media (max-width: 700px) {
  .filter-toggle { display: inline-flex; }
  .filterbar.collapsed > :not(.seg):not(.filter-toggle) { display: none !important; }
}

/* task rows: the title leads; status and priority are icons, the assignee an avatar, the rest sits quietly beside or below */
.task-top { align-items: flex-start; }
.task-line { align-items: flex-start; flex: 1; }
.task-title { font-weight: 600; font-size: 0.98rem; line-height: 1.35; }
.task-id { font-size: 0.7rem; margin-right: 8px; opacity: .8; }
.task-side { display: flex; align-items: center; gap: 12px; flex: none; margin-top: 1px; }
.task-side .due { font-size: 0.76rem; color: var(--text-faint); white-space: nowrap; }
.task-side .due.late { color: var(--critical); font-weight: 700; }
.task-side .due.soon { color: var(--high); font-weight: 700; }
.task-meta { margin-top: 2px; margin-left: 24px; font-size: 0.75rem; }
.task-tags { margin-left: 24px; }
.stat-ico { flex: none; display: inline-flex; margin-top: 2px; color: var(--text-faint); }
.stat-ico.st-in_progress { color: var(--accent); }
.stat-ico.st-ready_for_review, .stat-ico.st-reviewed { color: var(--review); }
.stat-ico.st-blocked { color: var(--critical); }
.stat-ico.st-done { color: var(--ok); }
.task:has(.st-done) .task-title { color: var(--text-dim); }
.prio-ico { display: inline-flex; color: var(--text-faint); }
.prio-ico .b1, .prio-ico .b2, .prio-ico .b3 { fill: currentColor; }
.prio-ico.pr-low .b2, .prio-ico.pr-low .b3 { opacity: .2; }
.prio-ico.pr-medium { color: var(--text-dim); }
.prio-ico.pr-medium .b3 { opacity: .2; }
.prio-ico.pr-high { color: var(--high); }
.prio-ico.pr-critical { color: var(--critical); }
.avatar.sm { width: 22px; height: 22px; font-size: 0.64rem; }
.avatar.none { background: var(--card-border); color: var(--text-faint); }
/* the task panel: status and priority as a row you read at a glance */
.stateRow { margin: 0 0 12px; }
.seg.states { display: flex; flex-wrap: wrap; border-radius: var(--radius-sm); }
.seg.states button { flex: 1 1 auto; padding: 7px 10px; font-size: 0.78rem; white-space: nowrap; }
.seg.states button.on { color: #fff; }
.seg.states button.on[data-v="todo"] { background: #6b7280; }
.seg.states button.on[data-v="in_progress"] { background: var(--accent); color: var(--accent-ink); }
.seg.states button.on[data-v="ready_for_review"], .seg.states button.on[data-v="reviewed"] { background: var(--review); }
.seg.states button.on[data-v="blocked"], .seg.states button.on[data-v="critical"] { background: var(--critical); }
.seg.states button.on[data-v="done"] { background: var(--ok); }
.seg.states button.on[data-v="high"] { background: var(--high); color: #1a1208; }
.seg.states button.on[data-v="medium"] { background: var(--medium); }
.seg.states button.on[data-v="low"] { background: #6b7280; }
.seg.states.prios button { text-transform: capitalize; }

/* "With your AI assistant" box inside help topics */
.help-ai { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft, rgba(124,92,255,.08)); border: 1px solid var(--border); }
.help-ai-h { font-weight: 700; font-size: .85rem; margin-bottom: 6px; }
.help-ai-h span { font-weight: 500; color: var(--text-dim); margin-left: 6px; font-size: .75rem; }
.help-ai p { margin: 0 0 6px; color: var(--text); font-size: .9rem; }
.help-ai q { display: block; margin: 4px 0; padding: 6px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); color: var(--text); font-size: .88rem; quotes: none; }

.choice .rec { font-style: normal; font-weight: 600; font-size: .72rem; margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }

/* Today: a focus card -- where it lives (with its tags) on top, the task number in the corner, the buttons in a column on the right */
.fcard { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 8px 22px; align-items: center; padding: 14px 0 14px; border-bottom: 1px solid var(--card-border); }
.fcard:last-child { border-bottom: 0; }
.fc-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; padding-right: 54px; font-size: .78rem; color: var(--text-faint); }
.fc-where { font-weight: 600; margin-right: 4px; }
.fc-top .tag { font-size: .68rem; padding: 1px 7px; }
.fc-title { display: flex; align-items: baseline; gap: 8px; font-weight: 700; font-size: 1.02rem; line-height: 1.35; cursor: pointer; }
.fc-title:hover { color: var(--accent); }
.fc-title .stat-ico { flex: none; transform: translateY(2px); }
.fcard .focus-why { margin: 3px 0 0 24px; }
.fc-facts { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 7px 0 0 24px; font-size: .78rem; color: var(--text-dim); }
.fc-id { position: absolute; top: 12px; right: 0; font-family: ui-monospace, Menlo, monospace; font-size: .68rem; color: var(--text-faint); opacity: .8; }
.fc-actions { display: flex; flex-direction: column; gap: 6px; min-width: 104px; }
.fc-actions button { width: 100%; justify-content: center; }
.fcard.is-review .fc-title { color: var(--review); }
@media (max-width: 640px) {
  .fcard { grid-template-columns: 1fr; }
  .fc-actions { flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .fc-actions button { width: auto; }
}

/* the bell: a button beside the name in the sidebar (and in the phone top bar) with a count, and the list it opens */
.brandrow { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-right: 6px; }
.brandrow .brand { flex: 1; }
.bell { position: relative; flex: none; width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--text-dim); border-radius: 8px; }
.bell:hover { background: var(--card-bg); color: var(--text); }
.bell svg { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bell.has-unread { color: var(--accent); }
.bellbadge { position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff; font-size: .66rem; font-weight: 800; line-height: 17px; text-align: center; box-sizing: border-box; }
.npanel { position: fixed; z-index: 90; width: 380px; max-width: calc(100vw - 16px); max-height: min(560px, calc(100vh - 80px)); display: flex; flex-direction: column; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.35); }
.nhead { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--card-border); }
.nhead .grow { flex: 1; }
.nlist { overflow-y: auto; flex: 1; }
.nrow { all: unset; box-sizing: border-box; display: flex; gap: 10px; width: 100%; padding: 11px 14px; cursor: pointer; border-bottom: 1px solid var(--card-border); }
.nrow:hover, .nrow:focus-visible { background: color-mix(in srgb, var(--accent) 7%, var(--card-bg)); }
.ndot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: transparent; }
.nrow.unread .ndot { background: var(--accent); }
.nbody { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ntext { font-size: .88rem; line-height: 1.4; color: var(--text); }
.nrow:not(.unread) .ntext { color: var(--text-dim); }
.nexcerpt { font-size: .8rem; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nmeta { font-size: .72rem; color: var(--text-faint); }
.nfoot { padding: 10px 14px; font-size: .82rem; border-top: 1px solid var(--card-border); }
@media (max-width: 640px) { .npanel { left: 8px; right: 8px; top: 56px; width: auto; max-width: none; } }

/* files on a task */
.files { display: flex; flex-direction: column; gap: 6px; }
.frow { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--card-border); border-radius: 8px; background: var(--bg); }
.fthumb { flex: none; width: 44px; height: 44px; border-radius: 6px; overflow: hidden; display: block; background: var(--card-border); }
.fthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fico { flex: none; width: 44px; height: 44px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: .66rem; font-weight: 800; color: var(--text-dim); background: var(--card-border); }
.fmain { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.fmain > a { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel.dropping, .card.dropping { outline: 2px dashed var(--accent); outline-offset: -6px; }

/* the document viewer */
.overlay.preview-wrap { padding: 4vh 12px; align-items: center; z-index: 95; }
.preview-modal { width: min(1040px, 100%); height: min(92vh, 940px); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.phead { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--card-border); flex: none; }
.phead .grow { flex: 1; }
.ptitle { display: flex; flex-direction: column; min-width: 0; }
.ptitle b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbody { flex: 1; min-height: 0; overflow: auto; background: var(--bg); display: flex; flex-direction: column; }
.pbody.pimage { overflow: hidden; }
.pimgarea { flex: 1; min-height: 0; position: relative; overflow: hidden; touch-action: none; user-select: none; background: color-mix(in srgb, var(--bg) 70%, #000); }
.pimgarea img { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; max-height: none; -webkit-user-drag: none; image-rendering: auto; }
.pimgarea.pannable { cursor: grab; }
.pimgarea.pannable.grabbing { cursor: grabbing; }
.pbody.ptext pre { margin: 0; padding: 14px 18px; font: .82rem/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; color: var(--text); }
.pbody.pnone { align-items: center; justify-content: center; }
.pbody.ppdf { overflow: hidden; }
.pbar { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-bottom: 1px solid var(--card-border); background: var(--card-bg); flex: none; }
.ppages { flex: 1; min-height: 0; overflow: auto; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; background: color-mix(in srgb, var(--bg) 70%, #000); }
.ppage { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.35); flex: none; max-width: none; }
.ppage canvas { display: block; }
.fdl { padding: 2px 8px; text-decoration: none; }
@media (max-width: 640px) { .overlay.preview-wrap { padding: 0; } .preview-modal { height: 100vh; border-radius: 0; width: 100%; } }

/* @mentions: the list while typing, and a mention in a posted comment */
.mentionbox { position: fixed; z-index: 120; max-width: min(360px, calc(100vw - 16px)); background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.4); padding: 4px; }
.mopt { padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: .9rem; }
.mopt.on, .mopt:hover { background: color-mix(in srgb, var(--accent) 16%, var(--card-bg)); }
.mention { color: var(--accent); font-weight: 700; }
