/* KomoreDo. One stylesheet, one typeface, six colours.
   Weights: 300 light, 400 regular, 500 medium. No bold anywhere. */

:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --soft: #eef2f1;
  --text: #1c2733;
  --muted: #6b7a86;
  --faint: #9aa7b1;
  --border: #dce3e1;
  --brand: #0e7c86;
  --brand-ink: #0b616a;
  --brand-soft: #e2f1f2;
  --danger: #c3432f;
  --danger-soft: #fbe9e6;
  --ok: #2f7a52;
  --ok-soft: #e5f3ea;
  --warn: #b07a1c;
  --warn-soft: #faf0dc;
  --info: #3b6fb6;
  --info-soft: #e6eef9;
  --input-bg: #ffffff;
  --radius: 10px;
  --radius-sm: 6px;
  --font: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --bg: #121a20;
  --surface: #1a242c;
  --soft: #222e37;
  --text: #e4eaee;
  --muted: #98a6b1;
  --faint: #6f7f8b;
  --border: #2b3942;
  --brand: #4fb3bd;
  --brand-ink: #7fcbd3;
  --brand-soft: #173238;
  --danger: #ef8575;
  --danger-soft: #3a211e;
  --ok: #6cc592;
  --ok-soft: #173126;
  --warn: #e0b35a;
  --warn-soft: #3a2f16;
  --info: #8db4ec;
  --info-soft: #1e2d44;
  --input-bg: #141d24;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-size: 15px; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
strong { font-weight: 500; }
h1 { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; margin: 0 0 12px; }
h2 { font-size: 15px; font-weight: 500; margin: 0 0 10px; }
h3 { font-size: 13px; font-weight: 500; margin: 0; }

/* ---- top bar ----------------------------------------------------------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  height: 52px;
}
.topbar .logo {
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.topbar .logo::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--brand); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: var(--muted); padding: 6px 10px; border-radius: var(--radius-sm); }
.topbar nav a:hover { color: var(--text); background: var(--soft); text-decoration: none; }
.topbar nav a.active { color: var(--text); background: var(--soft); }
.topbar .user { font-size: 13px; color: var(--muted); }
.topbar .user strong { color: var(--text); font-weight: 500; }
.topbar button.topbar-btn { color: var(--muted); background: transparent; border: 1px solid var(--border); font-weight: 400; }
.topbar button.topbar-btn:hover { color: var(--text); background: var(--soft); filter: none; }
.topbar button.topbar-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* ---- layout ------------------------------------------------------------ */

.page { max-width: 1240px; margin: 0 auto; padding: 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 16px; }

/* ---- forms and buttons ------------------------------------------------- */

label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  width: 100%;
  transition: border-color 0.12s;
}
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 12px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; margin: 0; }
label.check input { width: auto; margin: 0; accent-color: var(--brand); }

button, .btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
button:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button:disabled { opacity: 0.45; cursor: default; }
button.secondary, .btn.secondary { background: transparent; color: var(--brand-ink); }
button.secondary:hover, .btn.secondary:hover { background: var(--brand-soft); text-decoration: none; }
.btn.small { padding: 5px 10px; font-size: 13px; }
button.ghost { background: transparent; border-color: var(--border); color: var(--text); font-weight: 400; }
button.ghost:hover { background: var(--soft); border-color: var(--faint); }
button.small { padding: 5px 10px; font-size: 13px; }
/* Primary (filled) buttons need dark text on the light teal of the dark theme. Text-only buttons keep their colour. */
:root[data-theme="dark"] button:not(.ghost):not(.secondary):not(.topbar-btn):not(.sort):not(.plain) { color: #0f1a1c; }

.error { color: var(--danger); background: var(--danger-soft); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; }
.error:empty { display: none; }

/* ---- badges: outlined pills, colour only where it means something ----- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.badge[data-status="Pending"] { color: var(--muted); }
.badge[data-status="In Progress"] { color: var(--info); border-color: var(--info); background: var(--info-soft); }
.badge[data-status="In Review"] { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.badge[data-status="Completed"] { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.badge[data-status="Blocked"] { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.badge[data-status="Archived"] { color: var(--faint); border-style: dashed; }
.badge[data-status="Deleted"] { color: var(--danger); border-style: dashed; }
.badge.prio-Low { color: var(--faint); }
.badge.prio-Medium { color: var(--muted); }
.badge.prio-High { color: var(--warn); }
.badge.prio-Urgent { color: var(--danger); }
.badge.overdue { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.badge.origin-badge { color: var(--text); background: var(--soft); border-color: transparent; max-width: 130px; }
.badge.origin-badge span { overflow: hidden; text-overflow: ellipsis; }
.badge.origin-badge::before, .badge:not([data-status]):not(.overdue):not([class*="prio-"])::before { display: none; }
td .badge { font-size: 12px; }

/* ---- login ------------------------------------------------------------- */


/* ---- task table -------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
td.who { max-width: 170px; }
th { font-size: 12px; color: var(--muted); font-weight: 400; letter-spacing: 0.02em; }
th button.sort {
  font: inherit; color: inherit; background: none; border: none; padding: 0;
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap;
}
th button.sort:hover { color: var(--text); background: none; }
th button.sort.active { color: var(--text); }
th button.sort .arrow { font-size: 9px; min-width: 9px; display: inline-block; }
th button.sort:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--soft); }
#list { overflow-x: auto; }
td.title { max-width: 280px; }
td.title a { color: var(--text); font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Task titles take the tone of their status, the same tones as the status pills */
td.title a[data-status="In Progress"], .kcard a[data-status="In Progress"] { color: var(--info); }
td.title a[data-status="In Review"], .kcard a[data-status="In Review"] { color: var(--warn); }
td.title a[data-status="Completed"], .kcard a[data-status="Completed"] { color: var(--ok); }
td.title a[data-status="Blocked"], .kcard a[data-status="Blocked"] { color: var(--danger); }
td.title a[data-status="Archived"], .kcard a[data-status="Archived"] { color: var(--faint); font-weight: 400; }
.postponed { font-size: 11px; color: var(--warn); margin-left: 4px; }
.stale-mark { font-size: 11px; color: var(--warn); }
td.num { width: 36px; color: var(--faint); }
td.origin { white-space: nowrap; }
td.next { min-width: 150px; max-width: 260px; color: var(--muted); font-size: 13px; }
td.next div { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- kanban ------------------------------------------------------------ */

.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.column { min-height: 120px; }
.column h3 { font-size: 12.5px; color: var(--muted); font-weight: 400; padding: 0 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 10px; display: flex; justify-content: space-between; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.kcard a { color: var(--text); font-weight: 500; display: block; margin-bottom: 6px; }
.kcard .meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; }

/* ---- task detail ------------------------------------------------------- */

.task-header h1 { margin-bottom: 4px; }
.task-header h1 .muted { font-weight: 300; }
.meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; margin-top: 14px; }
.meta-grid .k { font-size: 12.5px; color: var(--muted); margin-bottom: 5px; display: flex; align-items: center; gap: 8px; }
.meta-grid .v { min-height: 38px; display: flex; align-items: center; }
.meta-grid .v select, .meta-grid .v input { width: 100%; height: 38px; font-weight: 400; }
.meta-grid .v.text { padding: 8px 0; }
.meta-grid .v .badge { font-size: 13px; padding: 6px 12px; }
.description { white-space: pre-wrap; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding: 0 0 18px; position: relative; }
.timeline li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); margin-top: 7px; margin-left: 1px; }
.timeline li::after { content: ""; position: absolute; left: 5px; top: 20px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.entry .who { font-size: 13px; color: var(--muted); margin-bottom: 3px; }
.timeline li.system::before, .timeline li.review::before { background: var(--border); }
.timeline li.deadline::before { background: var(--warn); }
.timeline li.delivery::before { background: var(--ok); }
.timeline li.system .text, .timeline li.review .text { color: var(--muted); font-size: 13.5px; }
.timeline li .kind { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.timeline li.deadline .kind { color: var(--warn); border-color: var(--warn); }
.timeline li.delivery .kind { color: var(--ok); border-color: var(--ok); }
.entry .who strong { color: var(--text); font-weight: 500; }
.entry .text { background: var(--soft); border-radius: var(--radius-sm); padding: 8px 12px; }
.entry .text p { margin: 0 0 6px; }
.entry .text p:last-child { margin-bottom: 0; }
.entry .text code { background: var(--surface); }
.entry .text code { font-family: var(--mono); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { font-size: 12.5px; border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; background: var(--surface); color: var(--text); }
.chip:hover { border-color: var(--brand); text-decoration: none; }

.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

/* ---- deliverables ------------------------------------------------------ */

.deliverables { list-style: none; margin: 0; padding: 0; }
.deliverable { display: grid; grid-template-columns: 28px auto 1fr auto auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.deliverable:last-child { border-bottom: none; }
.deliverable .tick { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; color: transparent; }
.deliverable.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.deliverable.done .desc { color: var(--muted); }
.deliverable .badge.kind { color: var(--muted); }
.deliverable .badge.kind::before { display: none; }
.deliverable .actions { display: flex; gap: 6px; }
.deliverable .edit-form { grid-column: 1 / -1; }
.deliv-row { margin-bottom: 8px; }
.deliv-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.deliv-pill.done { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }

/* ---- live indicator ---------------------------------------------------- */

.live { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.live[data-state="open"] { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

/* ---- uploader ---------------------------------------------------------- */

.dropzone {
  border: 1px dashed var(--faint);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.dropzone.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.dropzone input { display: none; }
.filelist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.filelist li { font-size: 12.5px; background: var(--brand-soft); color: var(--brand-ink); border-radius: 999px; padding: 3px 10px; display: flex; gap: 6px; align-items: center; }
.filelist button { background: none; border: none; color: inherit; padding: 0; font-size: 14px; line-height: 1; cursor: pointer; }

@keyframes flash { from { background: var(--warn-soft); } to { background: transparent; } }
.flash { animation: flash 1.5s ease-out; }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } * { transition: none !important; } }

/* ---- dashboard --------------------------------------------------------- */

.page.dash {
  height: calc(100vh - 52px);
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 24px;
}
.dash-head { flex: 0 0 auto; }
.page.dash .cards { flex: 0 0 auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat { display: block; color: inherit; padding: 12px 16px; }
.stat:hover { border-color: var(--brand); text-decoration: none; }
.stat .k { font-size: 12.5px; color: var(--muted); }
.stat .v { font-size: 30px; font-weight: 300; line-height: 1.1; margin-top: 4px; letter-spacing: -0.02em; }
.stat.danger .v { color: var(--danger); }
.stat.warn .v { color: var(--warn); }
.pack-link { font-size: 11px; color: var(--brand); border: 1px solid var(--brand); border-radius: 999px; padding: 1px 8px; margin-left: 8px; }
.pack-link:hover { background: var(--brand); color: #fff; }
.blocked-row { display: block; padding: 6px 0; border-top: 1px solid var(--border); color: inherit; font-size: 13.5px; }
.blocked-row:hover { text-decoration: none; color: var(--brand); }
.panel .panel-body h2.mt { margin-top: 14px; }

.dash-grid { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 14px; }
.panel { display: flex; flex-direction: column; min-height: 0; padding: 14px 18px; }
.panel h2 { margin: 0 0 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.panel h2 .muted { font-weight: 400; }
.panel-body { flex: 1 1 auto; min-height: 0; overflow: auto; }

#workload { overflow-x: auto; }
.chart { min-width: 480px; display: block; }
.chart .lbl { font-size: 12px; fill: var(--text); }
.chart .val { font-size: 12px; fill: var(--muted); }
.chart .bar { fill: var(--brand); opacity: 0.75; }
.chart .bar-overdue { fill: var(--danger); }
.chart .bar-archived { fill: var(--ok); }
.chart a:hover .bar { opacity: 1; }

.stream { list-style: none; margin: 0; padding: 0; }
.stream li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.stream li:last-child { border-bottom: none; }
.stream .who { font-size: 13px; }
.stream .who strong { font-weight: 500; }
.stream .text p { margin: 2px 0 0; color: var(--muted); }

.page.dash table { font-size: 13px; }
.page.dash table th, .page.dash table td { padding: 6px 6px; white-space: nowrap; }
.page.dash table thead th { position: sticky; top: 0; background: var(--surface); }
tr.past td { color: var(--muted); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--brand-soft); }
tr.clickable td a { color: var(--text); }

.origin-row { display: grid; grid-template-columns: 150px 1fr 36px auto; gap: 10px; align-items: center; padding: 4px 0; color: inherit; }
.origin-row:hover { text-decoration: none; color: var(--brand-ink); }
.origin-bar { height: 8px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.origin-bar span { display: block; height: 100%; background: var(--brand); opacity: 0.75; }
.origin-count { text-align: right; color: var(--muted); }

/* The next step is the one line that tells what has to happen now, so it stands out from the rest of the card */
.next-step { font-size: 16px; font-weight: 500; color: var(--brand-ink); background: var(--brand-soft);
  border-left: 4px solid var(--brand); border-radius: var(--radius-sm); padding: 12px 16px; line-height: 1.45; }
.next-step.muted { font-weight: 400; font-size: 14px; color: var(--muted); background: transparent; border-left-color: var(--border); }
button.danger { color: var(--danger); border-color: var(--danger); }
button.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
td.actions, th.actions { text-align: right; white-space: nowrap; width: 1%; }
.nav-row { margin-bottom: 12px; }
.task-nav { gap: 8px; align-items: center; }
.filters-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.filter-note { font-size: 13px; color: var(--brand-ink); background: var(--brand-soft); border-radius: var(--radius-sm); padding: 7px 12px; }

/* ---- dialog ------------------------------------------------------------ */

dialog { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--radius); padding: 0; width: min(560px, 92vw); box-shadow: 0 20px 60px rgba(10, 20, 30, 0.25); }
dialog::backdrop { background: rgba(12, 20, 28, 0.5); }
dialog .card { border: none; padding: 22px 24px; }

/* ---- responsive -------------------------------------------------------- */

@media (max-width: 900px) {
  .page.dash { height: auto; }
  .dash-grid { grid-template-columns: 1fr; grid-template-rows: none; }
  .panel-body { max-height: 320px; }
}
@media (max-width: 800px) {
  .kanban { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: repeat(2, 1fr); }
  .origin-row { grid-template-columns: 100px 1fr 36px auto; }
  table:not(.compact) thead { display: none; }
  table:not(.compact) tr { display: block; border-bottom: 1px solid var(--border); padding: 8px 0; }
  table:not(.compact) td { display: block; border: none; padding: 3px 0; }
  table:not(.compact) td::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; }
  table td.title::before { content: none; }
  td.title { max-width: none; }
  td.title a { white-space: normal; }
  .topbar .user span.email { display: none; }
  .topbar { padding: 0 16px; gap: 12px; }
}

/* ---- review mode ------------------------------------------------------- */

.review-wrap { max-width: 920px; margin: 0 auto; }
.review-progress { height: 6px; background: var(--soft); border-radius: 999px; overflow: hidden; margin: 10px 0 18px; }
.review-progress span { display: block; height: 100%; background: var(--brand); transition: width 0.2s; }
.review-card h1 { font-size: 20px; }
.review-card .last-note { background: var(--soft); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; }
.review-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; }
.review-list { font-size: 13px; max-height: 260px; overflow: auto; columns: 2; column-gap: 24px; }
.review-list a { display: block; padding: 3px 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review-list a.current { color: var(--text); font-weight: 500; }
.review-list a.done { text-decoration: line-through; color: var(--faint); }

/* ---- committee pack ---------------------------------------------------- */

.pack { max-width: 1000px; margin: 0 auto; }
.pack h1 { font-size: 24px; margin-top: 18px; }
.pack .totals { display: flex; gap: 20px; flex-wrap: wrap; margin: 12px 0 20px; }
.pack .totals div { font-size: 13px; color: var(--muted); }
.pack .totals strong { display: block; font-size: 22px; font-weight: 300; color: var(--text); }
.pack table { font-size: 13px; }
.pack .changes { margin: 0; padding-left: 16px; color: var(--muted); font-size: 12.5px; }
.pack .changes li { margin: 2px 0; }
@media print {
  .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .card { border: none; padding: 0; }
  .pack { max-width: none; }
  tr { page-break-inside: avoid; }
}

/* ---- tasks page: one-line toolbar, one line per task, only the list scrolls ---- */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.page.tasks-page {
  height: calc(100vh - 52px);
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 24px 16px;
  box-sizing: border-box;
}
.tasks-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tasks-head h1 { margin: 0; font-size: 22px; }

.tasks-filters {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--border));
  border-radius: var(--radius);
  padding: 8px 10px;
}
.tasks-filters input, .tasks-filters select { background: var(--surface); }
.tasks-filters select { width: auto; flex: 0 1 150px; min-width: 110px; padding: 7px 8px; font-size: 13.5px; }
.tasks-filters .tf-wrap { display: contents; }
.tf-search { position: relative; flex: 1 1 260px; min-width: 180px; }
.tf-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.tf-search input { width: 100%; box-sizing: border-box; padding: 7px 10px 7px 32px; font-size: 13.5px; }
.tf-archived { flex: 0 0 auto; white-space: nowrap; font-size: 13px; }
.tasks-filters #clear-filters { flex: 0 0 auto; }
.tf-count { flex: 0 0 auto; margin-left: auto; white-space: nowrap; padding-left: 4px; }

.tasks-page > .error:empty, .tasks-page > .filter-note[hidden] { display: none; }
.tasks-page > .filter-note { flex: 0 0 auto; }

.tasks-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0;
}
.tasks-list table { font-size: 13.5px; table-layout: fixed; width: 100%; }
/* fixed layout: the narrow columns get set widths, Title and Next step share the rest and shrink with ellipses */
.tasks-list th.col-number { width: 44px; }
.tasks-list th.col-origin { width: 104px; }
.tasks-list th.col-status { width: 120px; }
.tasks-list th.col-priority { width: 96px; }
.tasks-list th.col-deadline { width: 134px; }
.tasks-list th.col-delegate { width: 124px; }
.tasks-list th.col-next_step { width: 16%; }
.tasks-list th.col-deliv { width: 88px; }
.tasks-list th.col-age { width: 50px; }
.tasks-list th.col-entry_count { width: 64px; }
.tasks-list th.actions { width: 90px; }
/* on narrower screens Days and Entries step aside so the title keeps its room; both remain on the task page */
@media (max-width: 1360px) {
  .tasks-list th.col-age, .tasks-list td.age,
  .tasks-list th.col-entry_count, .tasks-list td.entries { display: none; }
}
.tasks-list th button.sort { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tasks-list thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--border);
  border-bottom: 0;
  padding: 8px 8px;
}
.tasks-list th, .tasks-list td { white-space: nowrap; vertical-align: middle; }
.tasks-list td { padding: 6px 8px; overflow: hidden; text-overflow: ellipsis; }
.tasks-list tbody tr:hover td { background: var(--soft); }
.tasks-list td.num { width: 1%; text-align: right; }
.tasks-list td.title a { overflow: hidden; text-overflow: ellipsis; }
.tasks-list td.next { min-width: 0; max-width: none; }
.tasks-list td.next div { display: block; -webkit-line-clamp: unset; }
.tasks-list td .badge { vertical-align: middle; }
.tasks-list .postponed { margin-left: 4px; }
.tasks-list .deliv-pill { padding: 1px 8px; font-size: 12px; line-height: 18px; }
.tasks-list tbody td { height: 36px; box-sizing: border-box; line-height: 22px; }
.tasks-list th:first-child, .tasks-list td:first-child { padding-left: 14px; }
.tasks-list th:last-child, .tasks-list td:last-child { padding-right: 14px; }

/* kanban inside the same scrolling box: the board fills it, each column scrolls on its own */
.tasks-list .kanban { height: 100%; padding: 12px; box-sizing: border-box; align-items: stretch; }
.tasks-list .kanban .column { overflow-y: auto; min-height: 0; }

@media (max-width: 1100px) {
  .tasks-filters { flex-wrap: wrap; }
  .tf-search { flex-basis: 100%; }
  .tf-count { margin-left: 0; }
}
@media (max-width: 800px) {
  .page.tasks-page { height: auto; padding: 12px; }
  .tasks-list { overflow: visible; }
  .tasks-list th, .tasks-list td { white-space: normal; }
  .tasks-list .kanban { height: auto; }
}

/* ---- task page: fits the window, left column and timeline scroll on their own ---- */

.page.task-page {
  height: calc(100vh - 52px);
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 24px 16px;
  box-sizing: border-box;
}
.task-page .nav-row { margin: 0; flex: 0 0 auto; }
.task-page > .error:empty { display: none; }

.task-page .task-header { flex: 0 0 auto; padding: 14px 18px 12px; }
.th-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.th-top h1 { margin: 0; font-size: 22px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-top #owner-actions { flex: 0 0 auto; flex-wrap: nowrap; }

.meta-line { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; }
.meta-line .m { display: flex; flex-direction: column; gap: 4px; flex: 1 1 0; min-width: 0; }
.meta-line .m-status { flex-grow: 1.1; }
.meta-line .m-deadline { flex-grow: 1.2; }
.meta-line .k { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.meta-line .k .badge { font-size: 11px; padding: 0 7px; }
.meta-line .k .postponed { font-size: 11px; }
.meta-line .v { height: 34px; display: flex; align-items: center; min-width: 0; }
.meta-line .v select, .meta-line .v input { width: 100%; height: 34px; padding: 5px 8px; font-size: 13.5px; box-sizing: border-box; }
.meta-line .v .text, .meta-line .v.text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0; }
.meta-line .v .badge { font-size: 12.5px; }

.meta-sub { margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta-sub .ms-v { color: var(--text); }
.meta-sub .ms-v .muted { color: var(--muted); }
.meta-sub .sep { margin: 0 8px; color: var(--faint); }

.task-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 12px; }
.task-main { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.task-main > .card { margin: 0; flex: 0 0 auto; padding: 14px 18px; }
.task-main .card h2 { margin: 0 0 8px; }
.task-main .description { max-height: 9.5em; overflow-y: auto; line-height: 1.45; }
.task-main .description.muted { font-style: italic; }

/* deliverables: one line each */
.task-page .deliverable { grid-template-columns: 22px auto minmax(0, 1fr) auto auto; gap: 8px; padding: 5px 0; }
.task-page .deliverable .tick { width: 20px; height: 20px; font-size: 12px; }
.task-page .deliverable .badge.kind { white-space: nowrap; font-size: 11.5px; }
.task-page .deliverable .desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-page .deliverable .file .chip { display: inline-block; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; padding: 1px 9px; font-size: 12px; }
.task-page .deliverable .actions { flex-wrap: nowrap; gap: 4px; }
.task-page .deliverable .actions button { padding: 2px 8px; font-size: 12px; white-space: nowrap; }
.deliv-add { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.deliv-add input { flex: 1 1 auto; min-width: 0; padding: 6px 10px; font-size: 13.5px; }
.deliv-add select { flex: 0 0 150px; width: 150px; padding: 6px 8px; font-size: 13.5px; }
.deliv-add[hidden] { display: none; }

/* timeline: its own scroll, newest at the bottom */
.task-page .task-timeline { min-height: 0; display: flex; flex-direction: column; padding: 0; margin: 0; }
.tl-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.tl-head h2 { margin: 0; }
.tl-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 16px 2px; }
.tl-body .timeline li { padding-bottom: 14px; }

/* each section carries its own faint tint so it is recognisable at a glance */
.task-page .task-header      { --sec: var(--brand); }
.task-page #blocked-row      { --sec: var(--danger); }
.task-page #description-card { --sec: var(--info); }
.task-page #next-step-card   { --sec: var(--warn); }
.task-page #deliverables-card{ --sec: var(--ok); }
.task-page .task-timeline    { --sec: #7a5cc0; }
:root[data-theme="dark"] .task-page .task-timeline { --sec: #b39ddb; }

.task-page .task-header,
.task-page .task-main > .card,
.task-page .task-timeline {
  background: color-mix(in srgb, var(--sec) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--sec) 28%, var(--border));
}
:root[data-theme="dark"] .task-page .task-header,
:root[data-theme="dark"] .task-page .task-main > .card,
:root[data-theme="dark"] .task-page .task-timeline {
  background: color-mix(in srgb, var(--sec) 8%, var(--surface));
}
.task-page .task-main .card h2,
.task-page .tl-head h2 { color: color-mix(in srgb, var(--sec) 70%, var(--text)); }
.task-page .tl-head { border-bottom-color: color-mix(in srgb, var(--sec) 25%, var(--border)); }

/* controls and inner boxes stay on the plain surface so they read clearly on the tint */
.task-page .meta-line select, .task-page .meta-line input,
.task-page .deliv-add input, .task-page .deliv-add select,
.task-page .tl-body .entry .text { background: var(--surface); }
.task-page #next-step-card .next-step:not(.muted) {
  background: var(--surface);
  color: var(--text);
  border-left-color: var(--warn);
}

dialog#entry-dialog { width: min(640px, 92vw); }
dialog#entry-dialog textarea { min-height: 130px; }

@media (max-width: 1000px) {
  .page.task-page { height: auto; }
  .task-body { grid-template-columns: 1fr; }
  .task-main { overflow: visible; }
  .tl-body { max-height: 60vh; }
  .meta-line { flex-wrap: wrap; }
  .meta-line .m { flex: 1 1 140px; }
  .meta-sub { white-space: normal; }
}

/* ---- login page ---------------------------------------------------------- */

.login-body { margin: 0; }

.login-stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 12% 8%, rgba(255,255,255,0.14), transparent 60%),
    radial-gradient(800px 600px at 92% 95%, rgba(0,0,0,0.25), transparent 60%),
    linear-gradient(160deg, #0e7c86 0%, #0b616a 55%, #083f47 100%);
}
:root[data-theme="dark"] .login-stage {
  background:
    radial-gradient(900px 600px at 12% 8%, rgba(79,179,189,0.2), transparent 60%),
    radial-gradient(800px 600px at 92% 95%, rgba(0,0,0,0.4), transparent 60%),
    linear-gradient(160deg, #173238 0%, #11262b 55%, #0c1a1e 100%);
}

/* the line drawing: full stage, faded out behind the card so it never competes with text */
.login-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 34% 48% at 50% 50%, transparent 55%, #000 100%);
  -webkit-mask-image: radial-gradient(ellipse 34% 48% at 50% 50%, transparent 55%, #000 100%);
}
.login-bg g[class^="bg-"] { opacity: 0.2; animation: bg-breathe 14s ease-in-out infinite; }
.login-bg g.bg-a { animation-delay: 0s; }
.login-bg g.bg-b { animation-delay: -3s; animation-duration: 17s; }
.login-bg g.bg-c { animation-delay: -6s; animation-duration: 12s; }
.login-bg g.bg-d { animation-delay: -9s; animation-duration: 19s; }
.login-bg g.bg-e { animation-delay: -4s; animation-duration: 23s; }
/* the people network breathes per person, from the script, so the group itself stays steady */
.login-bg g.bg-c { animation: none; opacity: 1; }
@keyframes bg-breathe {
  0%, 100% { opacity: 0.02; }
  50% { opacity: 0.3; }
}
@media (prefers-reduced-motion: reduce) {
  .login-bg g[class^="bg-"] { animation: none; opacity: 0.22; }
  .login-bg g.bg-c { opacity: 0.22; }
}

/* the card */
.login-card2 {
  position: relative; z-index: 1;
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 36px 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.12);
}
.login-card-top { display: flex; justify-content: flex-end; }

.login-hero { text-align: center; padding: 6px 0 10px; }
.login-mark { color: var(--brand); display: inline-block; margin-bottom: 12px; }
.login-mark svg { display: block; }
.login-wordmark { margin: 0 0 6px; font-size: 40px; line-height: 1; font-weight: 500; letter-spacing: -0.02em; color: var(--text); }
.login-wordmark span { font-weight: 300; color: var(--brand-ink); }
.login-tagline { margin: 0; color: var(--muted); font-size: 15px; font-weight: 300; }

.login-form { padding-top: 18px; }
.login-form .field { margin-bottom: 14px; }
.login-form input { padding: 12px 14px; font-size: 15px; width: 100%; box-sizing: border-box; }

.login-pw { position: relative; }
.login-pw input { padding-right: 68px; }
.login-pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; color: var(--muted);
  font-size: 12.5px; font-weight: 500; padding: 6px 10px; border-radius: var(--radius-sm);
}
.login-pw-toggle:hover { background: var(--soft); color: var(--text); border: 0; }

.login-submit {
  width: 100%;
  margin-top: 6px;
  padding: 13px 16px;
  font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: var(--radius-sm);
  transition: transform 0.08s ease, box-shadow 0.15s ease;
  box-shadow: 0 6px 16px rgba(14,124,134,0.25);
}
:root[data-theme="dark"] .login-submit { box-shadow: 0 6px 16px rgba(79,179,189,0.2); }
.login-submit:hover { transform: translateY(-1px); }
.login-submit:active { transform: translateY(0); box-shadow: none; }
.login-submit svg { transition: transform 0.15s ease; }
.login-submit:hover svg { transform: translateX(3px); }

.login-help { margin: 16px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.login-version { margin: 18px 0 0; font-size: 12px; color: var(--faint); text-align: center; }

@media (max-width: 480px) {
  .login-stage { padding: 12px; }
  .login-card2 { padding: 16px 20px 20px; border-radius: 14px; }
  .login-wordmark { font-size: 34px; }
}
