/* ============ Tokens ============ */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #e2e5ea;
  --border-strong: #cfd4db;
  --primary: #2350d0;
  --primary-ink: #ffffff;
  --primary-soft: #e8eefc;
  --danger: #c62828;
  --focus: 0 0 0 3px rgba(35, 80, 208, 0.28);

  --st-active: #2e7d32;
  --st-stalled: #c62828;
  --st-ready: #00838f;
  --st-hold: #6a4fc7;
  --st-finished: #607d8b;

  --pri-high: #d84315;
  --pri-medium: #f2a900;
  --pri-low: #8796a5;

  --board-bg: #fbfbf9;
  --board-dot: #d9dcd6;

  --radius: 8px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-2: 0 8px 24px rgba(16, 24, 40, 0.14);
  --topbar-h: 56px;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
main { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; overflow: auto; }
.view[hidden] { display: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
p { margin: 0; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
:focus-visible { outline: none; box-shadow: var(--focus); }

/* ============ Buttons & inputs ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--text);
  font-weight: 500; transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-2); border-color: #b9c0ca; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #1c44b8; border-color: #1c44b8; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a91f1f; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(0, 0, 0, 0.05); border-color: transparent; }
.btn-small { height: 28px; padding: 0 10px; font-size: 13px; }
.danger-text { color: var(--danger); }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; border: 0;
  background: transparent; cursor: pointer; color: inherit; flex: none;
}
.icon-btn:hover { background: rgba(0, 0, 0, 0.07); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn.small { width: 24px; height: 24px; }
.icon-btn-spacer { width: 30px; flex: none; }

input[type='text'], input[type='password'], input:not([type]), input[type='search'], input[type='number'], input[type='date'], select, textarea {
  height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface);
  min-width: 0;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
select { padding-right: 6px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; user-select: none; }
.check input, .radio input { accent-color: var(--primary); margin: 0; }

/* ============ Top bar ============ */
.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 18px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 3px; background: linear-gradient(135deg, #ffe066 0 70%, #f9c02a 70%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transform: rotate(-4deg);
}
.tabs { display: flex; gap: 2px; }
.tabs a {
  padding: 7px 12px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap;
}
.tabs a:hover { background: var(--surface-2); color: var(--text); }
.tabs a.active { background: var(--primary-soft); color: var(--primary); }
.search { position: relative; flex: 1; max-width: 380px; margin-left: auto; }
.search input { width: 100%; padding-left: 12px; background: var(--surface-2); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 320px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 4px; max-height: 60vh; overflow: auto;
}
.sr-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; background: none; border-radius: 6px;
  text-align: left; cursor: pointer;
}
.sr-item.active, .sr-item:hover { background: var(--primary-soft); }
.sr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sr-text b, .sr-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-text small { color: var(--muted); }
.sr-total { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.sr-empty { padding: 12px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.presence { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.presence .dot { width: 8px; height: 8px; border-radius: 50%; background: #2e9d4a; box-shadow: 0 0 0 3px rgba(46, 157, 74, 0.15); }
.presence.offline .dot { background: #e0a800; box-shadow: 0 0 0 3px rgba(224, 168, 0, 0.18); }
.user-btn { max-width: 180px; }
.user-btn span { overflow: hidden; text-overflow: ellipsis; }

/* ============ Shared chips & badges ============ */
.pri {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex: none;
  font-weight: 700; font-size: 12px; color: #fff; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.pri-sm { width: 20px; height: 20px; font-size: 11px; }
.pri-high { background: var(--pri-high); }
.pri-medium { background: var(--pri-medium); color: #2b2100; }
.pri-low { background: var(--pri-low); }

.status-chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 10px; font-size: 11px;
  font-weight: 600; color: #fff; white-space: nowrap; letter-spacing: 0.01em;
}
.status-chip.sm { height: 18px; font-size: 10.5px; padding: 0 6px; }
.status-chip.st-active, .st-bg-active { background: var(--st-active); }
.status-chip.st-stalled, .st-bg-stalled { background: var(--st-stalled); }
.status-chip.st-ready, .st-bg-ready { background: var(--st-ready); }
.status-chip.st-hold, .st-bg-hold { background: var(--st-hold); }
.status-chip.st-finished, .st-bg-finished { background: var(--st-finished); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; flex: none; }
.status-dot.st-active { background: var(--st-active); }
.status-dot.st-stalled { background: var(--st-stalled); }
.status-dot.st-ready { background: var(--st-ready); }
.status-dot.st-hold { background: var(--st-hold); }
.status-dot.st-finished { background: var(--st-finished); }

.cat-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11px;
  font-weight: 600; background: rgba(255, 255, 255, 0.72); color: #2a2a2a; white-space: nowrap;
  border: 1px solid rgba(0, 0, 0, 0.06); max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.cat-chip::before { content: ''; width: 7px; height: 7px; border-radius: 2px; background: var(--cat); flex: none; }

.avatar {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 10px;
  font-weight: 700; flex: none; letter-spacing: 0.02em; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}
.avatar.sm { width: 20px; height: 20px; font-size: 9px; box-shadow: none; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; box-shadow: none; }
.avatar.more { background: #555; }
.avatar.ghost { background: #e5e7eb; color: #6b7280; }
.color-dot { width: 12px; height: 12px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }

/* ============ Board ============ */
#view-board { display: flex; flex-direction: column; overflow: hidden; }
.board-toolbar {
  flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.board-toolbar select { height: 30px; }
.tb-field { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 7px; padding: 2px; background: var(--surface-2); gap: 2px; }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: 5px;
  background: transparent; cursor: pointer; color: var(--muted); font-weight: 500;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.zoom { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--border-strong); border-radius: 7px; padding: 2px; }
.zoom .icon-btn { width: 28px; height: 28px; }
.zoom-label { min-width: 52px; height: 28px; border: 0; background: none; cursor: pointer; font-variant-numeric: tabular-nums; border-radius: 5px; }
.zoom-label:hover { background: rgba(0, 0, 0, 0.06); }

.board-viewport {
  flex: 1; position: relative; overflow: hidden; cursor: grab; touch-action: none; user-select: none;
  background-color: var(--board-bg);
  background-image: radial-gradient(circle, var(--board-dot) 1.2px, transparent 1.3px);
}
.board-viewport.panning { cursor: grabbing; }
.board-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.notes-layer, .grid-layer { position: absolute; left: 0; top: 0; }

.board-empty {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: var(--muted); gap: 6px;
  pointer-events: none;
}

/* Sticky notes */
.note {
  position: absolute; width: 210px; height: 170px; padding: 10px 11px 9px; display: flex; flex-direction: column; gap: 6px;
  background: var(--note-bg); color: var(--note-fg); border-radius: 2px 2px 10px 2px; cursor: pointer;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.1);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 30%);
  transition: box-shadow 0.15s, opacity 0.2s, transform 0.15s;
}
.mode-grid .note { transition: left 0.35s ease, top 0.35s ease, box-shadow 0.15s, opacity 0.2s; }
.note:hover { box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1), 0 10px 22px rgba(0, 0, 0, 0.16); z-index: 5; }
.note:focus-visible { box-shadow: var(--focus), 0 4px 10px rgba(0, 0, 0, 0.12); }
.note.dragging { cursor: grabbing; transform: rotate(-1.5deg) scale(1.03); box-shadow: 0 18px 36px rgba(0, 0, 0, 0.25); transition: none; }
.note.dimmed { opacity: 0.22; }
.note.is-finished { filter: saturate(0.55); }
.note.is-finished .note-name { text-decoration: line-through; text-decoration-thickness: 1px; opacity: 0.75; }
.note.flash { animation: flash 2s ease-out; }
@keyframes flash {
  0%, 30%, 60% { box-shadow: 0 0 0 6px rgba(35, 80, 208, 0.55), 0 8px 24px rgba(0, 0, 0, 0.2); }
  15%, 45% { box-shadow: 0 0 0 14px rgba(35, 80, 208, 0.12), 0 8px 24px rgba(0, 0, 0, 0.2); }
  100% { box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.1); }
}
/* Stalled notes get louder the longer they're stuck */
.note.age-1 { box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.45), 0 4px 10px rgba(0, 0, 0, 0.1); }
.note.age-2 { box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.75), 0 4px 12px rgba(198, 40, 40, 0.25); }
.note.age-3 { box-shadow: 0 0 0 3px var(--st-stalled), 0 4px 14px rgba(198, 40, 40, 0.35); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse {
  50% { box-shadow: 0 0 0 6px rgba(198, 40, 40, 0.55), 0 4px 18px rgba(198, 40, 40, 0.45); }
}
.note-head { display: flex; gap: 8px; align-items: flex-start; }
.note-name {
  font-size: 14.5px; font-weight: 700; line-height: 1.25; margin-top: 2px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word;
}
.note-desc {
  font-size: 12.5px; line-height: 1.35; opacity: 0.88; overflow: hidden; flex: 0 1 auto; min-height: 0; margin-bottom: auto;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; word-break: break-word;
}
.note-cats { display: flex; gap: 4px; flex-wrap: nowrap; overflow: hidden; flex: none; }
.note-cats:empty { display: none; }
.note-foot { display: flex; align-items: center; gap: 6px; flex: none; }
.note-total { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.note-flags { display: inline-flex; gap: 3px; align-items: center; margin-left: auto; }
.note-flags .flag { display: inline-flex; align-items: center; gap: 1px; opacity: 0.85; }
.note-flags .flag svg { width: 14px; height: 14px; }
.note-flags small { font-size: 10px; font-weight: 700; }
.flag-overdue { color: #b71c1c; }
.note-people { display: inline-flex; }
.note-people .avatar { margin-left: -6px; width: 22px; height: 22px; font-size: 9px; }
.note-people .avatar:first-child { margin-left: 0; }
.note-flags:empty + .note-people { margin-left: auto; }

/* Grid layout */
.grid-colhead {
  position: absolute; display: flex; align-items: center; gap: 4px; padding: 0 14px; font-weight: 700; font-size: 16px;
  border-radius: 8px; background: rgba(255, 255, 255, 0.9); border: 1px solid var(--border);
}
.grid-colhead small { color: var(--muted); font-weight: 600; margin-left: 4px; }
.grid-rowhead {
  position: absolute; display: grid; place-items: center; border-radius: 8px; color: #fff; font-weight: 700;
}
.grid-rowhead span { transform: rotate(-90deg); white-space: nowrap; font-size: 15px; }
.grid-rowhead small { opacity: 0.85; font-weight: 600; margin-left: 4px; }
.grid-rowhead.pri-medium { color: #2b2100; }
.grid-cell {
  position: absolute; border-radius: 10px; background: rgba(255, 255, 255, 0.55); border: 1.5px dashed #d3d7dc;
  transition: background 0.15s, border-color 0.15s;
}
.grid-cell.drop-target { background: rgba(35, 80, 208, 0.07); border-color: var(--primary); border-style: solid; }
.grid-cell-label { position: absolute; left: 14px; top: 9px; font-size: 12px; color: var(--muted); font-weight: 600; }
.grid-cell-label b { margin-left: 4px; color: var(--text); }

/* Legend */
.legend {
  position: absolute; left: 12px; bottom: 12px; background: rgba(255, 255, 255, 0.95); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-1); font-size: 12px; cursor: default; max-width: 260px; z-index: 10000;
}
.legend-toggle { border: 0; background: none; padding: 6px 10px; cursor: pointer; color: var(--muted); font-weight: 600; width: 100%; text-align: left; }
.legend-body { padding: 0 10px 8px; display: flex; flex-direction: column; gap: 8px; }
.legend-sec { display: flex; flex-direction: column; gap: 4px; }
.legend-sec + .legend-sec { border-top: 1px solid var(--border); padding-top: 8px; }
.legend-row { display: flex; align-items: center; gap: 8px; }
.legend-row .pri { width: 18px; height: 18px; font-size: 10px; }
.legend-row .status-dot { margin-right: 0; }
.legend-sw { width: 16px; height: 16px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); flex: none; }

/* ============ Drawer ============ */
.drawer {
  position: fixed; top: var(--topbar-h); right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface);
  border-left: 1px solid var(--border); box-shadow: -12px 0 32px rgba(16, 24, 40, 0.12); z-index: 40;
  display: flex; flex-direction: column; transform: translateX(105%); transition: transform 0.22s ease; visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-head { padding: 14px 18px 12px; background: var(--note-bg); color: var(--note-fg); flex: none; }
.drawer-head-top { display: flex; align-items: flex-start; gap: 4px; }
.drawer-title { flex: 1; font-size: 19px; word-break: break-word; padding-top: 3px; }
.drawer-head .icon-btn:hover { background: rgba(0, 0, 0, 0.1); }
.drawer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; }
.drawer-meta.sub { margin-top: 4px; font-size: 12px; opacity: 0.8; }
.banner {
  display: flex; gap: 10px; align-items: center; padding: 10px 18px; background: #fff7e0; border-bottom: 1px solid #f1d98a;
  font-size: 13px; color: #5a4300;
}
.banner > div { flex: 1; }
.drawer-tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--border); flex: none; }
.drawer-tabs button {
  border: 0; background: none; padding: 11px 10px 9px; cursor: pointer; color: var(--muted); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px;
}
.drawer-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.count { background: var(--primary-soft); color: var(--primary); border-radius: 9px; padding: 0 6px; font-size: 11px; line-height: 18px; }
.drawer-body { flex: 1; overflow: auto; padding: 16px 18px 24px; }
.drawer-foot {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.dirty-note { flex: 1; text-align: right; color: var(--muted); font-size: 12.5px; }
.loading, .empty { color: var(--muted); padding: 12px 0; list-style: none; }

/* Form */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .field > .label { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.field input, .field textarea { width: 100%; }
.field-narrow input { width: 200px; }
.req { color: var(--danger); }
.hint { margin-left: auto; font-weight: 400; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.field-error { color: var(--danger); font-size: 12.5px; }
.field-error:empty { display: none; }
.has-error input, .has-error textarea { border-color: var(--danger); }
.group { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.group > legend { font-weight: 700; padding: 0 6px; font-size: 13px; }
.pri-row { display: flex; align-items: center; gap: 14px; }
.pri-row input[type='range'] { flex: 1; accent-color: var(--primary); }
.pri-readout { display: inline-flex; align-items: center; gap: 6px; min-width: 96px; font-weight: 600; }
.seg-status { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; }
.seg-status button { flex-direction: column; justify-content: center; gap: 0; height: 44px; line-height: 1.15; }
.seg-status button small { font-size: 11px; opacity: 0.8; }
.seg-status button.active { color: #fff; box-shadow: var(--shadow-1); }
.seg-status button.st-active.active { background: var(--st-active); }
.seg-status button.st-stalled.active { background: var(--st-stalled); }
.seg-status button.st-ready.active { background: var(--st-ready); }
.seg-status button.st-hold.active { background: var(--st-hold); }
.seg-status button.st-finished.active { background: var(--st-finished); }
.total-box { font-size: 13.5px; }
.total-box b { font-size: 15px; margin: 0 4px; }
.status-box { border-left: 3px solid; padding: 2px 0 2px 12px; display: flex; flex-direction: column; gap: 12px; }
.status-box.st-stalled { border-color: var(--st-stalled); }
.status-box.st-ready { border-color: var(--st-ready); }
.status-box.st-hold { border-color: var(--st-hold); }
.radio-list { display: flex; flex-direction: column; gap: 6px; }
.radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 400; }
.radio.small { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.swatch-row { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 30px; height: 30px; border-radius: 6px; border: 0; cursor: pointer; position: relative; flex: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}
.swatch.active { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
.swatch.static { cursor: default; }
.swatch-custom { display: inline-grid; place-items: center; background: conic-gradient(#f88, #fd8, #8f8, #8df, #a8f, #f8c, #f88); overflow: hidden; }
.swatch-custom span { font-weight: 700; color: #333; background: rgba(255, 255, 255, 0.8); width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; line-height: 1; }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.swatch-meaning { font-size: 12.5px; color: var(--muted); min-height: 16px; margin-top: 2px; }
.sw-inline { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }

.links { display: flex; flex-direction: column; gap: 6px; }
.links:empty { display: none; }
.link-row { display: flex; gap: 6px; align-items: center; }
.link-row input:first-child { flex: 0 0 34%; }
.link-row input:nth-child(2) { flex: 1; }
.field > .btn-small { align-self: flex-start; }

/* Picker */
.picker { position: relative; }
.picker-box {
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-height: 36px; padding: 4px 6px; cursor: text;
  border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface);
}
.picker-box:focus-within { border-color: var(--primary); box-shadow: var(--focus); }
.picker-chips { display: contents; }
.picker-input { border: 0 !important; box-shadow: none !important; height: 26px !important; padding: 0 4px !important; flex: 1; min-width: 120px; background: transparent !important; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 4px 0 9px; border-radius: 13px;
  background: #eef0f3; font-size: 13px; font-weight: 500;
}
.chip-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--cat); flex: none; }
.chip-x { border: 0; background: none; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; color: var(--muted); font-size: 15px; line-height: 1; }
.chip-x:hover { background: rgba(0, 0, 0, 0.1); color: var(--text); }
.picker-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-2); padding: 4px; max-height: 240px; overflow: auto;
}
.picker-opt { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 7px 9px; border: 0; background: none; border-radius: 5px; cursor: pointer; }
.picker-opt.active, .picker-opt:hover { background: var(--primary-soft); }
.picker-opt.create { color: var(--primary); font-weight: 600; }
.picker-empty { padding: 8px 9px; color: var(--muted); }

/* Updates */
.comment-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.comment-form textarea { width: 100%; }
.comment-form-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.comment { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.comment-head .icon-btn { margin-left: auto; opacity: 0; color: var(--muted); }
.comment:hover .comment-head .icon-btn, .comment-head .icon-btn:focus-visible { opacity: 1; }
.comment-body { margin: 6px 0 0 32px; white-space: pre-wrap; word-break: break-word; line-height: 1.45; }

/* History */
.timeline h3, .drawer-body section > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 10px; }
.timeline { margin-bottom: 22px; }
.timeline-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--border); }
.timeline-bar span { min-width: 4px; }
.timeline-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.timeline-list li { display: flex; align-items: center; gap: 8px; }
.timeline-list li .muted { margin-left: auto; font-size: 12px; }
.versions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.version details { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.version summary { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 9px 12px; cursor: pointer; list-style: none; }
.version summary::-webkit-details-marker { display: none; }
.v-num { grid-row: span 2; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary); background: var(--primary-soft); border-radius: 5px; padding: 2px 7px; align-self: start; font-size: 12px; }
.v-what { font-weight: 500; }
.v-meta { font-size: 12px; color: var(--muted); }
.v-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.diff { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
.diff th, .diff td { border-top: 1px solid var(--border); padding: 6px 8px 6px 0; text-align: left; vertical-align: top; }
.diff thead th { border-top: 0; color: var(--muted); font-weight: 600; }
.diff tbody th { width: 28%; color: var(--muted); font-weight: 600; }
.diff td { word-break: break-word; }
.pre { white-space: pre-wrap; display: block; max-height: 160px; overflow: auto; }

/* ============ List ============ */
.list-wrap { display: flex; flex-direction: column; height: 100%; }
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex: none;
}
.filter-q { width: 260px; }
.filters select { height: 30px; }
.chip-group { display: inline-flex; gap: 4px; }
.toggle {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 15px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font-weight: 500;
}
.toggle .status-dot { margin-right: 0; }
.toggle .pri-sm { width: 16px; height: 16px; font-size: 9px; }
.toggle.on { background: var(--primary-soft); border-color: #b8c7f3; color: var(--text); }
.toggle:not(.on) .status-dot, .toggle:not(.on) .pri { opacity: 0.35; }
.result-count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.table-scroll { flex: 1; overflow: auto; }
.projects-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); }
.projects-table th {
  position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--border); z-index: 1; padding: 0; white-space: nowrap;
}
.projects-table th button { border: 0; background: none; padding: 10px 12px; width: 100%; text-align: left; cursor: pointer; color: inherit; font-weight: inherit; display: flex; align-items: center; gap: 4px; }
.projects-table th.sorted { color: var(--text); }
.projects-table th.sorted.asc .sort-ind::after { content: '▲'; font-size: 9px; }
.projects-table th.sorted.desc .sort-ind::after { content: '▼'; font-size: 9px; }
.projects-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.projects-table tbody tr { cursor: pointer; }
.projects-table tbody tr:hover td { background: #f6f8fd; }
.projects-table tbody tr:focus-visible td { background: var(--primary-soft); }
.projects-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.projects-table th.col-days button, .projects-table th.col-total button { justify-content: flex-end; }
.col-name { min-width: 220px; max-width: 360px; }
.col-categories { max-width: 220px; }
.col-categories .cat-chip { background: #f1f2f4; margin: 0 4px 4px 0; }
.col-people { min-width: 140px; }
.col-status { min-width: 110px; max-width: 220px; }
.col-priority { white-space: nowrap; }
.col-target, .col-updated { white-space: nowrap; }
.name-cell { display: flex; gap: 10px; align-items: flex-start; }
.name-cell .color-dot { margin-top: 3px; }
.pname { font-weight: 600; }
.psub { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.psub.reason { -webkit-line-clamp: 1; }
.person { display: inline-flex; align-items: center; gap: 5px; margin: 0 8px 4px 0; white-space: nowrap; }
.overdue { color: var(--danger); font-weight: 600; }
.stale { color: #a15c00; font-weight: 600; }
.empty-row td { text-align: center; color: var(--muted); padding: 40px; cursor: default; }

/* ============ People ============ */
.people-wrap { padding: 20px 24px 40px; max-width: 1400px; margin: 0 auto; }
.people-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.people-head h2 { font-size: 20px; margin-bottom: 4px; }
.people-stats { display: flex; gap: 10px; }
.people-stats div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; display: flex; flex-direction: column; min-width: 90px; }
.people-stats b { font-size: 20px; font-variant-numeric: tabular-nums; }
.people-stats span { color: var(--muted); font-size: 12px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.person-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: 10px; }
.person-card.unassigned { border-style: dashed; background: var(--surface-2); }
.person-card header { display: flex; gap: 12px; align-items: center; }
.pc-title { flex: 1; min-width: 0; }
.pc-title h3 { font-size: 15px; }
.pc-counts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.pc-counts span { display: inline-flex; align-items: center; gap: 4px; }
.pc-counts .status-dot { margin-right: 0; }
.pc-load { text-align: right; display: flex; flex-direction: column; }
.pc-load span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.pc-load b { font-size: 20px; font-variant-numeric: tabular-nums; }
.load-bar { height: 6px; background: #eef0f3; border-radius: 3px; overflow: hidden; }
.load-bar span { display: block; height: 100%; background: linear-gradient(90deg, #4f7cf0, var(--primary)); border-radius: 3px; }
.pp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pp-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: 6px; cursor: pointer; }
.pp-row:hover, .pp-row:focus-visible { background: var(--surface-2); }
.pp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-total { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.pp-empty { padding: 6px; font-size: 13px; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 10px; }

/* ============ Settings ============ */
.settings-wrap { padding: 20px 24px 60px; max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; box-shadow: var(--shadow-1); }
.card h2 { font-size: 16px; margin-bottom: 4px; }
.card h3 { font-size: 14px; margin: 18px 0 4px; }
.card > p.muted { font-size: 13px; margin-bottom: 12px; }
.set-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.set-list li { display: flex; align-items: center; gap: 10px; }
.set-list li > input[type='text'] { flex: 1; }
.set-list.compact li { gap: 14px; }
.usage { font-size: 12.5px; min-width: 76px; text-align: right; white-space: nowrap; }
.color-input { width: 30px; height: 30px; border-radius: 6px; position: relative; overflow: hidden; cursor: pointer; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); display: inline-block; }
.color-input.big { width: 34px; height: 34px; background: conic-gradient(#f88, #fd8, #8f8, #8df, #a8f, #f8c, #f88); }
.color-input input { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); opacity: 0; cursor: pointer; }
.add-row { display: flex; gap: 8px; align-items: center; }
.add-row input[type='text'] { flex: 1; max-width: 360px; }
.set-grid { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: center; margin-top: 10px; }
.set-grid input[type='number'] { width: 80px; }
.data-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 10px; }
.data-actions label.btn { cursor: pointer; }
.trash-name { flex: 1; min-width: 0; }
.backups { margin: 8px 0 10px; }

/* ============ Modals & toasts ============ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(17, 24, 39, 0.4); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; padding: 20px 22px; width: min(440px, 100%); box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: 12px; }
.modal h2 { font-size: 17px; }
.modal p { color: var(--muted); line-height: 1.45; }
.modal input { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 200; pointer-events: none; }
.toast {
  background: #1f2328; color: #fff; padding: 9px 16px; border-radius: 8px; box-shadow: var(--shadow-2); font-size: 13.5px;
  opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; max-width: 90vw;
}
.toast.show { opacity: 1; transform: none; }
.toast-success { background: #1e6b34; }
.toast-error { background: #a32020; }
.toast-warn { background: #8a5a00; }
.fatal { display: grid; place-content: center; gap: 10px; height: 100%; text-align: center; }

/* ============ Small screens ============ */
@media (max-width: 900px) {
  :root { --topbar-h: auto; }
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .brand-name { display: none; }
  .search { order: 5; flex-basis: 100%; max-width: none; margin: 0; }
  .topbar-right { margin-left: auto; }
  .presence, .user-btn span { display: none; }
  .drawer { top: 0; width: 100vw; z-index: 60; }
  .filter-q { width: 100%; }
}

/* ============ v2: simple notes, snap, color key & filters ============ */
.tb-sep { width: 1px; height: 22px; background: var(--border); }

.note.simple { padding: 14px 14px 12px; gap: 8px; }
.note.simple .note-name { font-size: 16.5px; -webkit-line-clamp: 3; margin-top: 0; }
.note.simple .note-desc { font-size: 13.5px; line-height: 1.4; -webkit-line-clamp: 4; }

.snap-ghost {
  position: absolute; width: 210px; height: 170px; border: 2px dashed var(--primary); border-radius: 4px;
  background: rgba(35, 80, 208, 0.06); pointer-events: none;
}

.legend { max-width: 300px; max-height: calc(100% - 24px); overflow: auto; }
.legend-head { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text); display: flex; gap: 6px; align-items: baseline; margin-bottom: 2px; }
.legend-head .muted { font-weight: 500; text-transform: none; letter-spacing: 0; }
.legend-color {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 4px 4px; margin: 0 -4px;
  border-radius: 5px; cursor: pointer; text-align: left; font-size: 12.5px;
}
.legend-color:hover { background: rgba(0, 0, 0, 0.05); }
.legend-color.off { opacity: 0.4; }
.legend-color.off .lc-text b { text-decoration: line-through; }
.lc-text { flex: 1; min-width: 0; line-height: 1.3; }
.lc-text span { color: var(--muted); }
.lc-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend-sw.swatch-custom, .color-toggle .swatch-custom { background: conic-gradient(#f88, #fd8, #8f8, #8df, #a8f, #f8c, #f88); }
.legend-link { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 2px 0; font-size: 12px; text-align: left; }

/* Color picker in the project drawer */
.color-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.color-option {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); cursor: pointer; text-align: left; position: relative; min-height: 42px;
}
.color-option:hover { border-color: var(--border-strong); background: var(--surface-2); }
.color-option.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--primary-soft); }
.color-option .swatch { width: 24px; height: 24px; }
.color-option.active .swatch { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); }
.co-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; font-size: 13px; }
.co-text small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.color-option.custom input[type='color'] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.status-box.st-active { border-color: var(--st-active); }
.status-box.st-finished { border-color: var(--st-finished); }

/* Color filter toggles in the list view */
.color-chips { gap: 3px; }
.color-toggle { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; padding: 0; }
.color-toggle .swatch { width: 18px; height: 18px; border-radius: 4px; cursor: pointer; }
.color-toggle.on { border-color: #b8c7f3; background: var(--primary-soft); }
.color-toggle:not(.on) .swatch { opacity: 0.25; }

/* Import */
.import-drop { display: block; margin-top: 12px; border: 2px dashed var(--border-strong); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; }
.import-drop:hover { border-color: var(--primary); color: var(--text); }
.import-drop.over { border-color: var(--primary); background: var(--primary-soft); }
.import-files { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.import-file { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.import-summary { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0; font-size: 13px; }
.import-summary b { font-size: 15px; }
.import-table-wrap { max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; margin: 8px 0 12px; }
.import-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.import-table th, .import-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.import-table th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 600; }
.import-table tr.bad td { background: #fdecec; }
.import-table tr.skip td { color: var(--muted); }
.import-table .msg { color: #8a5a00; font-size: 12px; }
.import-table tr.bad .msg { color: var(--danger); }
.import-options { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.template-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }

.pal-name { flex: 0 0 130px !important; }
.import-file { padding: 2px 0; }
.board-toolbar select { max-width: 210px; }

/* v3 */
.legend-color { cursor: default; }
.legend-color:hover { background: none; }
.legend-sw.swatch-other, .color-toggle .swatch-other {
  background: repeating-linear-gradient(45deg, #d5d8dc 0 4px, #f3f4f6 4px 8px);
}
.clamp2 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hint-line { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.field > label .hint { font-weight: 400; }
.legend-body { min-width: 170px; }
.legend-color .lc-count { flex-shrink: 0; min-width: 14px; padding-left: 6px; text-align: right; }

/* Edit access: the view-only mode hides anything that changes data */
body.read-only .edit-only { display: none !important; }
body.view-only .progress-only { display: none !important; }
body:not(.read-only) .student-only, body.view-only .student-only { display: none !important; }
body.read-only .note { cursor: pointer; }
.access-btn { gap: 6px; }
.access-btn.viewing { background: #fff8e1; border-color: #f3d27a; color: #6b4e00; }
.access-btn.viewing b { color: var(--primary); font-weight: 600; }
.access-btn.viewing span { padding-right: 6px; border-right: 1px solid #f3d27a; }
@media (max-width: 760px) { .access-btn.viewing span { display: none; } }

/* Read-only project summary (view-only mode) */
.ro-view { display: flex; flex-direction: column; gap: 16px; }
.ro-note { display: flex; align-items: center; gap: 8px; background: #fff8e1; border: 1px solid #f3d27a; color: #6b4e00; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.ro-desc { white-space: pre-wrap; line-height: 1.5; font-size: 14.5px; overflow-wrap: anywhere; }
.ro-grid { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; margin: 0; align-items: baseline; }
.ro-grid dt { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.ro-grid dd { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ro-grid dd.ro-pre { white-space: pre-wrap; display: block; line-height: 1.45; }
.ro-person { display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; }
.ro-swatch { width: 18px; height: 18px; }

/* Settings: edit password */
#access-card h2 { display: flex; align-items: center; gap: 8px; }
#access-card p { margin: 6px 0; }
.access-state { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; margin-right: 6px; }
.access-state.on { background: #e3f2e5; color: #1b5e20; }
.access-state.off { background: #fdecea; color: #b71c1c; }
.access-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.access-form input { flex: 1 1 180px; }

/* Hidden (finished) notes fade in while you drag a note, so you can see why a spot is taken */
.hidden-notes-layer { position: absolute; left: 0; top: 0; pointer-events: none; }
.note.hidden-note { opacity: 0.3; pointer-events: none; box-shadow: none; outline: 2px dashed rgba(0, 0, 0, 0.35); outline-offset: -2px; animation: hidden-note-in 0.15s ease-out; }
@keyframes hidden-note-in { from { opacity: 0; } to { opacity: 0.3; } }

/* Percent complete */
.progress-meter { display: inline-block; position: relative; width: 120px; height: 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.1); overflow: hidden; vertical-align: middle; }
.progress-meter > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--st-active); border-radius: 4px; }
.progress-meter.sm { width: 64px; height: 6px; }
.pct-input { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.pct-input input { width: 70px; }
.progress-row input[type='range'] { accent-color: var(--st-active); }
.hours-left { font-size: 13px; min-height: 1em; }
/* Meter along the bottom of a sticky note */
.note-progress { position: absolute; left: 12px; right: 12px; bottom: 9px; display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--note-fg, #222); }
.note-progress .bar { flex: 1; height: 6px; border-radius: 3px; background: rgba(0, 0, 0, 0.12); overflow: hidden; position: relative; }
.note-progress .bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(0, 0, 0, 0.55); border-radius: 3px; }
.note-progress .hrs { font-weight: 500; opacity: 0.75; }
.note.simple.has-progress { padding-bottom: 26px; }
.note.simple.has-progress .note-desc { -webkit-line-clamp: 3; }
.note:not(.simple) .note-progress { position: static; flex: none; margin: 0; }
.note.has-progress:not(.simple) .note-desc { -webkit-line-clamp: 2; }

/* List: progress/hours columns and person groups */
.col-progress { white-space: nowrap; font-variant-numeric: tabular-nums; }
.col-hours { white-space: nowrap; }
.projects-table th.col-hours button { justify-content: flex-end; }
.stale svg { width: 13px; height: 13px; vertical-align: -2px; }
.group-row td { background: #f3f4f7; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.projects-table tbody tr.group-row:not(:first-child) td { border-top: 10px solid var(--surface); }
.group-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.group-head b { font-size: 14.5px; }
.group-bits { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.group-bits > span { display: inline-flex; align-items: center; }
.group-bits .stale { color: #a15c00; }
.pp-name small.pp-sub { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.pp-name small.pp-sub.stale { color: #a15c00; }
.pp-sub svg, .pc-extra svg { width: 12px; height: 12px; vertical-align: -2px; }
.pc-extra { margin-top: 2px; }

.toasts .toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; }
.toast-action { border: 0; background: rgba(255, 255, 255, 0.18); color: #fff; font: inherit; font-weight: 700; padding: 3px 10px; border-radius: 5px; cursor: pointer; }
.toast-action:hover { background: rgba(255, 255, 255, 0.3); }

/* Checklist tab */
.ck { display: flex; flex-direction: column; gap: 12px; }
.ck-summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.ck-summary .muted { font-size: 12.5px; }
.ck-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ck-list .empty, .ck-list .loading { color: var(--muted); padding: 8px 0; }
.ck-row { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 6px; border-bottom: 1px solid var(--border); }
.ck-row:hover { background: var(--surface-2); }
.ck-item.dragging { opacity: 0.4; }
.ck-grip { color: var(--muted); cursor: grab; display: inline-flex; opacity: 0.5; flex: none; }
.ck-row:hover .ck-grip { opacity: 1; }
.ck-box { width: 17px; height: 17px; flex: none; accent-color: var(--st-active); cursor: pointer; margin: 0; }
.ck-box:disabled { cursor: default; }
.ck-text { flex: 1; min-width: 0; line-height: 1.4; overflow-wrap: anywhere; cursor: text; padding: 2px 0; }
body.view-only .ck-text { cursor: default; }
.ck-item.done > .ck-row .ck-text { text-decoration: line-through; color: var(--muted); }
.ck-item.has-kids > .ck-row .ck-text { font-weight: 600; }
.ck-edit { flex: 1; height: 30px !important; }
.ck-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ck-kids { font-size: 11.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 0 6px; line-height: 17px; font-variant-numeric: tabular-nums; }
.ck-item.done > .ck-row .ck-kids { color: var(--st-active); border-color: #a5d6a7; background: #e8f5e9; }
.ck-actions { display: inline-flex; gap: 2px; flex: none; opacity: 0; }
.ck-row:hover .ck-actions, .ck-actions:focus-within { opacity: 1; }
@media (hover: none) { .ck-actions { opacity: 0.6; } }
.ck-sub { margin: 0 0 4px 30px; padding-left: 8px; border-left: 2px solid var(--border); }
.ck-sub .ck-row { padding-top: 3px; padding-bottom: 3px; font-size: 13.5px; }
.ck-sub > .ck-item:last-child > .ck-row { border-bottom: none; }
.ck-sub-add { padding: 6px 0 4px; }
.ck-sub-add input { height: 30px; }
.ck-tip { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; margin: -4px 0 0; }
.ck-tip svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.ck-add-form { display: flex; gap: 8px; }
.ck-add-form input { flex: 1; }
.ck-hint { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.ck-hint:empty { display: none; }
.ck-hint svg { width: 15px; height: 15px; }
/* "3/5" checklist badge on notes */
.note-check { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.note-check svg { width: 13px; height: 13px; }
.note-check.all-done { color: #1b5e20; }
.col-progress .psub svg { width: 12px; height: 12px; vertical-align: -2px; }

.access-btn.student { background: #e0f2f1; border-color: #80cbc4; color: #00594f; }
.access-btn .role-chip { font-weight: 700; }

/* Progress tab and Assign me */
.progress-tab { display: flex; flex-direction: column; gap: 18px; }
.ck-section h3, .updates-section h3 { font-size: 14px; margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
.updates-section { border-top: 1px solid var(--border); padding-top: 16px; }
.people-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.people-row-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.people-row .ro-wrap { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.people-row .self-assign { margin-left: auto; }
.self-assign { gap: 5px; }
.self-assign svg { width: 14px; height: 14px; }
.self-assign.on { background: var(--primary-soft); border-color: #b8c7f3; }
.ro-grid dd .self-assign { margin-left: auto; }
.ro-note.student { background: #e0f2f1; border-color: #80cbc4; color: #00594f; }
#access-card h3 { font-size: 14px; margin: 16px 0 4px; }
.role-list { margin: 6px 0; padding-left: 18px; line-height: 1.5; font-size: 13.5px; }

/* Sign-in screen for a private dashboard (view password on) */
body.signed-out > :not(.signin-screen):not(.toasts):not(script) { display: none !important; }
.signin-screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: var(--bg); z-index: 200; }
.signin-card {
  width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-2); padding: 28px 26px; display: flex; flex-direction: column; gap: 12px;
}
.signin-card h1 { font-size: 22px; margin: 4px 0 0; }
.signin-card p { margin: 0; }
.signin-card input { width: 100%; }
.signin-card .btn { justify-content: center; height: 38px; }
.signin-card .field-error:empty { display: none; }
.signin-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--muted); }
.modal-actions .modal-left { margin-right: auto; }
