/* TaskWeight design system
   Brand palette (4 colors):
     navy      #002E4D  primary  - buttons, links, active states, dark panels
     caramel   #D4995A  accent   - highlights and the "under / warning" signal
     blue-gray #8096A6  neutral  - muted text, borders, the ink scale
     beige     #E9CCAC  soft     - warm fills (avatars, soft tints)
   Green and red are retained ONLY as functional status signals on the weight
   meter (balanced / over). The signature element is that allocation meter. */

:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #0f2231;
  --muted: #526572;
  --faint: #7c93a1;
  --line: #dde3e8;
  --line-strong: #c4cfd6;
  --primary: #002e4d;
  --primary-dark: #00223a;
  --primary-soft: #e1e9ef;
  --accent: #d4995a;
  --accent-dark: #b87d3f;
  --accent-soft: #f2e2cd;
  --good: #14a05a;
  --good-soft: #e6f6ee;
  --warn: #d4995a;
  --warn-soft: #f7ecdc;
  --bad: #d63a3f;
  --bad-soft: #fbe9ea;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(0, 46, 77, 0.06), 0 6px 20px rgba(0, 46, 77, 0.06);
  --ring: 0 0 0 3px rgba(0, 46, 77, 0.28);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: "Space Grotesk", "Inter", -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 0.4em;
}

h1 { font-size: 1.6rem; font-weight: 600; }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.num { font-family: "Space Grotesk", monospace; font-variant-numeric: tabular-nums; }

/* ----- top navigation ----- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  display: inline-block;
  position: relative;
  flex: none;
}
.brand .mark::after {
  content: "";
  position: absolute; left: 4px; bottom: 4px; right: 9px;
  height: 4px; border-radius: 2px; background: rgba(255,255,255,0.9);
  box-shadow: 0 6px 0 rgba(255,255,255,0.55);
}
.topbar .search { flex: 0 1 520px; max-width: 520px; position: relative; }

/* live search typeahead dropdown */
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px; max-height: 60vh; overflow-y: auto;
}
.search-result {
  display: flex; flex-direction: column; gap: 1px;
  padding: 7px 10px; border-radius: 7px; text-decoration: none; color: var(--ink);
}
.search-result:hover { background: var(--surface-2); text-decoration: none; }
.search-result .sr-name { font-weight: 500; font-size: 0.92rem; }
.search-result .sr-project { color: var(--faint); font-size: 0.78rem; }
.search-empty { padding: 10px; color: var(--muted); font-size: 0.88rem; text-align: center; }
.topbar .spacer { flex: 1 1 auto; }
.topbar .nav-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 17px;
  text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); text-decoration: none; }
.badge-count {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px;
  background: var(--bad); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center;
  font-family: "Space Grotesk", sans-serif;
}

/* user menu */
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: 46px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 190px;
  padding: 6px;
  display: none;
}
.menu.open .menu-panel { display: block; }
.menu-panel a, .menu-panel button {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 7px;
  color: var(--ink); background: none; border: none;
  font: inherit; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); text-decoration: none; }
.menu-panel .sep { height: 1px; background: var(--line); margin: 5px 2px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  font-family: "Space Grotesk", sans-serif;
}

/* ----- layout ----- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 18px 60px; }
.wrap-narrow { max-width: 680px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.85rem; }

/* ----- left project nav ----- */
.app-shell { display: flex; align-items: flex-start; }
.app-shell > .wrap { flex: 1 1 auto; min-width: 0; }
.sidebar {
  flex: none; width: 224px;
  position: sticky; top: 58px; align-self: flex-start;
  height: calc(100vh - 58px); overflow-y: auto;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.side-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 6px 2px 10px; margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.side-head-link {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em;
  color: var(--primary);
}
.side-head-link:hover { text-decoration: underline; }
.side-add {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  color: var(--muted); font-size: 1.15rem; line-height: 1; text-decoration: none;
}
.side-add:hover { background: var(--surface-2); color: var(--primary); text-decoration: none; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  padding: 8px 10px; border-radius: 8px;
  color: var(--ink); font-size: 0.92rem; font-weight: 500; text-decoration: none;
}
.side-link:hover { background: var(--surface-2); text-decoration: none; }
.side-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-shared { flex: none; font-size: 0.72rem; line-height: 1; opacity: 0.8; }
.side-count {
  flex: none; min-width: 20px; text-align: center; padding: 0 6px;
  font-size: 0.74rem; font-weight: 600; line-height: 18px;
  color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px;
}
.side-link.active .side-count { color: var(--primary); border-color: var(--line-strong); }
.side-link.overdue .side-name { color: var(--bad); font-weight: 600; }
.side-link.overdue .side-count {
  color: var(--bad); background: var(--bad-soft); border-color: #f2c9cb;
}
.side-empty { color: var(--faint); font-size: 0.85rem; padding: 4px 10px; }

/* ----- projects overview: clickable cards ----- */
.project-card { position: relative; transition: box-shadow .12s ease, border-color .12s ease; }
.project-card:hover { border-color: var(--line-strong); box-shadow: 0 1px 2px rgba(0,46,77,.08), 0 10px 28px rgba(0,46,77,.10); }
/* The project name link stretches to cover the whole card... */
.project-card .stretched::after { content: ""; position: absolute; inset: 0; z-index: 1; }
/* ...while the inner links and buttons stay clickable above it. */
.project-card .btn, .project-card .tree a { position: relative; z-index: 2; }

/* ----- projects overview: overdue alert ----- */
.card.has-overdue { border-left: 3px solid var(--bad); }
.badge-overdue {
  display: inline-flex; align-items: center; gap: 4px; vertical-align: middle;
  margin-left: 8px; padding: 2px 9px; border-radius: 999px;
  font-family: "Inter", sans-serif; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0; text-transform: none;
  color: var(--bad); background: var(--bad-soft); border: 1px solid #f2c9cb;
}

/* ----- project tree (projects overview) ----- */
.tree { margin-top: 14px; }
.tree-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 600; margin-bottom: 4px;
}
.tree ul { list-style: none; margin: 0; padding-left: 8px; }
.tree li {
  position: relative; padding: 8px 0 8px 24px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.tree li::before {
  content: ""; position: absolute; left: 6px; top: 0; height: 20px; width: 14px;
  border-left: 2px solid var(--line-strong);
  border-bottom: 2px solid var(--line-strong);
  border-bottom-left-radius: 7px;
}
.tree li::after {
  content: ""; position: absolute; left: 6px; top: 20px; bottom: 0;
  border-left: 2px solid var(--line-strong);
}
.tree li:last-child::after { display: none; }
.tree .tree-name { font-weight: 500; }

/* ----- cards ----- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card-header { margin-bottom: 12px; }

/* ----- buttons ----- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary {
  background: var(--primary); border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #bf3237; border-color: #bf3237; }
.btn-accent { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--primary); }
.btn-accent:hover { background: #ecd6b8; border-color: #ecd6b8; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 11px; font-size: 0.86rem; }
.btn:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: none; box-shadow: var(--ring);
}

/* ----- forms ----- */
label { font-weight: 500; font-size: 0.9rem; color: var(--ink); }
.field { margin-bottom: 14px; }
.field > label { display: block; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
textarea { resize: vertical; }
.search input { border-radius: 9px; background: var(--surface-2); }
.help { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--bad); font-size: 0.85rem; }
.form-error {
  background: var(--bad-soft); border: 1px solid #f2c9cb;
  color: #9a2a2e; padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 0.9rem; margin-bottom: 12px;
}

/* ----- messages ----- */
.messages { margin-bottom: 16px; }
.flash {
  padding: 11px 14px; border-radius: var(--radius-sm);
  margin-bottom: 8px; font-size: 0.92rem;
  border: 1px solid transparent;
}
.flash.success { background: var(--good-soft); border-color: #bfe6cf; color: #10673b; }
.flash.info { background: var(--primary-soft); border-color: #cdd9e3; color: var(--primary-dark); }
.flash.warning { background: var(--warn-soft); border-color: #e8cfa6; color: #8a541d; }
.flash.error { background: var(--bad-soft); border-color: #f2c9cb; color: #9a2a2e; }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--warn-soft); border: 1px solid #e8cfa6;
  color: #7a4a17; padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.notice .dot { flex: none; font-size: 1rem; line-height: 1.2; }

/* ----- chips / pills ----- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--line);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.chip-shared { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-dark); }
a.chip-shared:hover { text-decoration: none; filter: brightness(0.97); }
.pill-score {
  font-family: "Space Grotesk", sans-serif; font-variant-numeric: tabular-nums;
  background: var(--primary-soft); color: var(--primary-dark);
  padding: 2px 9px; border-radius: 999px; font-size: 0.82rem; font-weight: 600;
}

/* ----- task list ----- */
.filters {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 16px;
}
.seg {
  display: inline-flex; border: 1px solid var(--line-strong);
  border-radius: 9px; overflow: hidden; background: var(--surface);
}
.seg a {
  padding: 7px 13px; color: var(--muted); font-size: 0.88rem; font-weight: 500;
}
.seg a:hover { background: var(--surface-2); text-decoration: none; }
.seg a.active { background: var(--primary); color: #fff; }

.group-title {
  display: flex; align-items: center; gap: 9px;
  margin: 22px 0 10px; font-size: 0.82rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.group-title .count { color: var(--faint); font-weight: 500; }

.task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: 8px;
  text-decoration: none; color: var(--ink);
}
.task-row:hover { border-color: var(--line-strong); text-decoration: none; box-shadow: var(--shadow); }
.task-row .task-name { font-weight: 500; flex: 1 1 auto; min-width: 0; }
.task-row .task-meta { display: flex; align-items: center; gap: 12px; flex: none; }
.task-row .meta { color: var(--muted); font-size: 0.83rem; white-space: nowrap; }
.subtask-flag {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  font-size: 0.76rem; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 8px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.task-row.done .task-name { color: var(--muted); text-decoration: line-through; }
.due.overdue { color: var(--bad); font-weight: 600; }
.due.soon { color: var(--warn); font-weight: 600; }

.empty {
  text-align: center; padding: 46px 20px; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2);
}

/* ----- detail two column ----- */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 0.92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.subtask {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.subtask:last-child { border-bottom: none; }
.subtask .name { flex: 1 1 auto; }
.subtask.done .name { text-decoration: line-through; color: var(--muted); }
.subtask select { width: auto; padding: 5px 8px; font-size: 0.84rem; }

.comment { padding: 10px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: none; }
.comment .who { font-weight: 600; font-size: 0.88rem; }
.comment .when { color: var(--faint); font-size: 0.78rem; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li {
  position: relative; padding: 0 0 14px 20px; font-size: 0.88rem; color: var(--ink);
  border-left: 2px solid var(--line); margin-left: 4px;
}
.feed li:last-child { padding-bottom: 0; }
.feed li::before {
  content: ""; position: absolute; left: -6px; top: 3px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--primary);
}
.feed .when { color: var(--faint); font-size: 0.76rem; }
.feed .note {
  margin-top: 4px; padding: 7px 10px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--muted);
}

/* ----- WEIGHTED SORTING: the signature allocation meter ----- */
.alloc {
  background: linear-gradient(180deg, #002438 0%, #003a5e 100%);
  color: #fff; border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow);
}
.alloc .alloc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.alloc .readout {
  font-family: "Space Grotesk", sans-serif; font-variant-numeric: tabular-nums;
  font-size: 2.1rem; font-weight: 600; line-height: 1;
}
.alloc .readout .used { transition: color .15s ease; }
.alloc .readout .sep { opacity: 0.5; margin: 0 4px; }
.alloc .state-label {
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em;
  padding: 4px 10px; border-radius: 999px; text-transform: uppercase;
}
.alloc .state-balanced { background: rgba(20,160,90,0.22); color: #7ff0b4; }
.alloc .state-under { background: rgba(212,153,90,0.24); color: #f0c48f; }
.alloc .state-over { background: rgba(214,58,63,0.24); color: #ff9ea1; }

.meter {
  margin-top: 16px; height: 12px; border-radius: 999px;
  background: rgba(255,255,255,0.14); overflow: hidden;
}
.meter .fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: var(--accent); transition: width .18s ease, background .18s ease;
}
.meter .fill.balanced { background: #2ed47a; }
.meter .fill.over { background: #ff6b6f; }
.alloc .hint { margin-top: 12px; font-size: 0.84rem; color: rgba(255,255,255,0.72); }

.weight-table { width: 100%; border-collapse: collapse; }
.weight-table th, .weight-table td {
  text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.weight-table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.weight-table td.wt { width: 130px; }
.weight-table input[type=number] { width: 100px; text-align: right; font-family: "Space Grotesk", sans-serif; }
.weight-table .ftype {
  font-size: 0.72rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em;
}

/* ----- generic table ----- */
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
/* Wide tables scroll sideways within their card instead of overflowing the
   page, so narrow screens never get a horizontally scrolling body. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap .table { min-width: 520px; }

.switch-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.switch-row:last-child { border-bottom: none; }
.switch-row .fname { flex: 1 1 auto; font-weight: 500; }
.switch-row .toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }

/* ----- auth screens ----- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-aside {
  background: linear-gradient(160deg, #00223a 0%, #003a5e 55%, #0a5075 120%);
  color: #fff; padding: 48px 44px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-aside .lede { font-family: "Space Grotesk", sans-serif; font-size: 1.9rem; font-weight: 600; line-height: 1.2; max-width: 22ch; }
.auth-aside .sub { color: rgba(255,255,255,0.78); margin-top: 14px; max-width: 34ch; }
.auth-aside .demo-meter { margin-top: 30px; max-width: 300px; }
.auth-aside .demo-meter .bar { height: 10px; border-radius: 999px; background: rgba(255,255,255,0.16); overflow: hidden; }
.auth-aside .demo-meter .bar i { display: block; height: 100%; width: 100%; background: #2ed47a; }
.auth-aside .demo-meter .lbl { font-size: 0.8rem; color: rgba(255,255,255,0.7); margin-top: 8px; font-family: "Space Grotesk", sans-serif; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); margin-bottom: 22px; }
.auth-alt { margin-top: 18px; font-size: 0.9rem; color: var(--muted); text-align: center; }

/* ----- offline overlay ----- */
.offline-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: none; align-items: center; gap: 10px;
  background: var(--primary); color: #fff; padding: 12px 18px; font-size: 0.9rem;
}
body.is-offline .offline-banner { display: flex; }
.offline-banner .dot { width: 8px; height: 8px; border-radius: 50%; background: #ff6b6f; }

/* ----- responsive ----- */
@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  /* Sidebar becomes a horizontal strip: the Projects link stays put on the
     left while the project chips scroll beside it. */
  .app-shell { flex-direction: column; }
  .sidebar {
    position: static; width: auto; height: auto;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .side-head { flex: none; margin-bottom: 0; padding: 0; border-bottom: none; }
  .side-nav { flex: 1 1 auto; min-width: 0; flex-direction: row; gap: 6px; overflow-x: auto; }
  .side-link {
    flex: none; padding: 6px 12px;
    border: 1px solid var(--line-strong); border-radius: 999px;
    font-size: 0.86rem;
  }
  .side-link.active { border-color: var(--primary); background: var(--primary-soft); }
}
@media (max-width: 560px) {
  .topbar { gap: 8px; padding: 8px 12px; flex-wrap: wrap; }
  .topbar .search { order: 3; flex-basis: 100%; max-width: none; }
  .brand span.word { display: none; }
  .wrap { padding: 18px 12px 48px; }
  .kv { grid-template-columns: 1fr; }
  /* Stack the task name over its chips so long names get the full width. */
  .task-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .task-row .task-meta { flex-wrap: wrap; gap: 8px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
