/* ============================================================
 * TaskManager web — premium dark UI
 * Design tokens: every color comes from :root. 8px spacing scale.
 * ============================================================ */

:root {
  --bg: #0A0C10;
  --surface: #12151D;
  --surface2: #181D27;
  --border: rgba(255, 255, 255, .08);
  --primary: #8B7CFF;
  --primary-deep: #6A5CFF;
  --accent: #67E8F9;
  --text: #F2F4F8;
  --dim: #9AA3B2;
  --success: #34D399;
  --warning: #FBBF24;
  --danger: #F87171;
  --r-card: 16px;
  --r-input: 12px;
  --r-pill: 999px;
  --font-body: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Poppins", "Instrument Sans", -apple-system, "Segoe UI", sans-serif;
  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, .04), 0 12px 32px rgba(0, 0, 0, .35);
  --ease: 200ms ease;
}

/* ---------- reset / base ---------- */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand-name { font-family: var(--font-display); letter-spacing: -0.01em; }

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

::selection { background: rgba(139, 124, 255, .35); }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #262c3a; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

.boot {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  color: var(--dim); font-size: 15px;
}

/* ---------- buttons ---------- */

.btn {
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  padding: 13px 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform var(--ease), box-shadow var(--ease), filter var(--ease), background var(--ease);
}

.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  box-shadow: 0 8px 20px rgba(139, 124, 255, .35), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: rgba(139, 124, 255, .5); }

.btn-danger {
  background: rgba(248, 113, 113, .12);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, .35);
}
.btn-danger:hover { background: rgba(248, 113, 113, .2); }

.btn-sm { padding: 9px 16px; font-size: 13px; border-radius: 10px; }

/* ---------- inputs ---------- */

.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 13px; color: var(--dim); font-weight: 600; }

input, textarea, select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}

input::placeholder, textarea::placeholder { color: #5b6373; }

input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 124, 255, .22);
}

textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
select option { background: var(--surface2); }

input[type="datetime-local"] { color-scheme: dark; }

.error-banner {
  background: rgba(248, 113, 113, .1);
  border: 1px solid rgba(248, 113, 113, .35);
  color: #fca5a5;
  border-radius: var(--r-input);
  padding: 12px 16px;
  font-size: 14px;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(104px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  z-index: 100;
  max-width: min(92vw, 420px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease, transform 250ms ease;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.toast-icon { display: inline-flex; flex: none; }
.toast-icon svg { width: 18px; height: 18px; }
.toast-icon.ok { color: var(--success); }
.toast-icon.err { color: var(--danger); }
.toast-icon.info { color: var(--primary); }

/* ---------- auth: split layout ---------- */

.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; }

.auth-brand {
  position: relative;
  overflow: hidden;
  background: var(--bg);
  padding: 48px 40px;
  display: flex;
}

.mesh {
  position: absolute; inset: 0;
  background:
    radial-gradient(560px 420px at 18% 16%, rgba(139, 124, 255, .32), transparent 62%),
    radial-gradient(480px 480px at 82% 74%, rgba(103, 232, 249, .14), transparent 60%),
    radial-gradient(420px 320px at 62% 8%, rgba(106, 92, 255, .22), transparent 60%);
}
.mesh::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent);
}

.auth-brand-inner { position: relative; z-index: 1; max-width: 440px; margin: auto 0; width: 100%; }

.brand-lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 56px; }

.brand-mark {
  width: 42px; height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 8px 22px rgba(139, 124, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-mark svg { width: 22px; height: 22px; }

.brand-name { font-size: 21px; font-weight: 700; }

.auth-brand h1 {
  font-size: 36px;
  line-height: 1.18;
  font-weight: 700;
  margin-bottom: 16px;
}
.auth-brand h1 span {
  background: linear-gradient(120deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede { color: var(--dim); font-size: 16px; margin-bottom: 44px; max-width: 380px; }

.feat { list-style: none; display: flex; flex-direction: column; gap: 20px; }
.feat li { display: flex; gap: 14px; align-items: flex-start; }
.feat .fi {
  width: 42px; height: 42px; flex: none;
  border-radius: 13px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.feat .fi svg { width: 20px; height: 20px; }
.feat strong { display: block; font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.feat span { font-size: 13px; color: var(--dim); }

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow-card);
}

.auth-card h2 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.auth-card .sub { color: var(--dim); font-size: 14px; margin-bottom: 24px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card .btn-primary { width: 100%; margin-top: 8px; }
.auth-switch { text-align: center; font-size: 14px; color: var(--dim); margin-top: 20px; }

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

.layout { min-height: 100vh; }

.main { padding: 24px 16px 120px; }
.container { max-width: 720px; margin: 0 auto; }

.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 20px;
}
.page-head h2 { font-size: 26px; font-weight: 700; }
.page-head h2 .grad-text {
  background: linear-gradient(120deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* side nav (desktop) */
.sidenav { display: none; }

/* bottom nav (mobile) */
.bottomnav {
  position: fixed;
  left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  background: rgba(18, 21, 29, .92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px;
  z-index: 40;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}

.nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 2px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
  border-radius: 14px;
  transition: color var(--ease), background var(--ease);
}
.nav-item:hover { text-decoration: none; color: var(--text); background: rgba(255, 255, 255, .04); }
.nav-item.active { color: var(--primary); }
.nav-item svg { width: 22px; height: 22px; }

/* ---------- cards & lists ---------- */

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

.list { display: flex; flex-direction: column; gap: 12px; }

/* ---------- tasks ---------- */

.task-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 16px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease);
}

.task-row:hover {
  transform: translateY(-1px);
  border-color: rgba(139, 124, 255, .45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 12px 32px rgba(0, 0, 0, .35);
}

.task-row.done .task-title { text-decoration: line-through; color: var(--dim); }

.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 15px; }
.task-meta {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--dim);
}

/* animated custom checkbox */
.checkbox {
  flex: none;
  width: 26px; height: 26px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid #3a4152;
  background: transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  transition: border-color var(--ease), background var(--ease), transform var(--ease), box-shadow var(--ease);
}
.checkbox:hover { border-color: var(--primary); transform: scale(1.07); }
.checkbox:active { transform: scale(.9); }
.checkbox .check { width: 14px; height: 14px; }
.checkbox .check path {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  transition: stroke-dashoffset 240ms ease 60ms;
}
.checkbox[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(139, 124, 255, .45);
}
.checkbox[aria-pressed="true"] .check path { stroke-dashoffset: 0; }

.pill {
  display: inline-flex; align-items: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
}

.pill-high { background: rgba(248, 113, 113, .14); color: #fca5a5; border-color: rgba(248, 113, 113, .3); }
.pill-medium { background: rgba(251, 191, 36, .13); color: #fcd34d; border-color: rgba(251, 191, 36, .28); }
.pill-low { background: rgba(103, 232, 249, .12); color: #a5f3fc; border-color: rgba(103, 232, 249, .28); }
.pill-neutral { background: var(--surface2); color: var(--dim); border-color: var(--border); }

.due { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; }
.due svg { width: 13px; height: 13px; flex: none; }
.due.overdue { color: var(--danger); font-weight: 600; }

/* segmented filter control */
.chips {
  display: inline-flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 4px;
  margin-bottom: 20px;
  max-width: 100%;
  overflow-x: auto;
}

.chip {
  border: none;
  background: transparent;
  color: var(--dim);
  border-radius: var(--r-pill);
  padding: 9px 20px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--ease), color var(--ease), box-shadow var(--ease);
}
.chip:hover:not(.active) { color: var(--text); }
.chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  box-shadow: 0 4px 12px rgba(139, 124, 255, .4);
}

/* FAB */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  width: 60px; height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 28px rgba(139, 124, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform var(--ease), box-shadow var(--ease), filter var(--ease);
  z-index: 30;
}
.fab:hover { transform: translateY(-2px) scale(1.04); filter: brightness(1.07); }
.fab:active { transform: scale(.93); }
.fab svg { width: 24px; height: 24px; }

/* ---------- forms ---------- */

.form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: flex; gap: 12px; }
.form-row .btn, .form-row a.btn { flex: 1; }

.subtask-list { display: flex; flex-direction: column; gap: 8px; }
.subtask-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  padding: 10px 12px;
  transition: border-color var(--ease);
}
.subtask-row:hover { border-color: rgba(139, 124, 255, .35); }
.subtask-row span { flex: 1; font-size: 14px; }
.subtask-row span.done { text-decoration: line-through; color: var(--dim); }

.icon-btn {
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  line-height: 0;
  display: inline-flex;
  transition: color var(--ease), background var(--ease), transform var(--ease);
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--danger); background: rgba(248, 113, 113, .12); }
.icon-btn:active { transform: scale(.9); }

.add-row { display: flex; gap: 8px; margin-top: 12px; }
.add-row input { flex: 1; }

.section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--dim);
  margin: 24px 0 4px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- notes ---------- */

.searchbar { position: relative; margin-bottom: 16px; }
.searchbar svg {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 17px; height: 17px;
  color: var(--dim);
  pointer-events: none;
}
.searchbar input { padding-left: 42px; border-radius: var(--r-pill); }

.notes-masonry { columns: 2; column-gap: 12px; }

.note-card {
  position: relative;
  break-inside: avoid;
  margin-bottom: 12px;
  border-radius: var(--r-card);
  padding: 16px;
  padding-bottom: 16px;
  color: #202124;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, .1);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  transition: transform var(--ease), box-shadow var(--ease);
}
.note-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .4);
}
.note-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; word-break: break-word; padding-right: 28px; }
.note-card p { font-size: 13px; white-space: pre-wrap; word-break: break-word; opacity: .8; line-height: 1.55; }

.pin-ribbon {
  position: absolute;
  top: 12px; right: 12px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .16);
  color: #202124;
  display: inline-flex; align-items: center; justify-content: center;
}
.pin-ribbon svg { width: 14px; height: 14px; }

.note-actions {
  position: absolute;
  left: 12px; bottom: 12px;
  display: flex; gap: 6px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--ease), transform var(--ease);
}
.note-card:hover .note-actions,
.note-card:focus-within .note-actions { opacity: 1; transform: none; }

.note-act {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .3);
  color: #202124;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), transform var(--ease);
}
.note-act:hover { background: rgba(0, 0, 0, .5); color: #fff; }
.note-act:active { transform: scale(.9); }
.note-act svg { width: 15px; height: 15px; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--ease), box-shadow var(--ease);
}
.swatch:hover { transform: scale(1.1); }
.swatch.selected { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }

.toggle-row { display: flex; gap: 12px; align-items: center; font-size: 14px; cursor: pointer; }
.toggle-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }

/* ---------- schedule timeline ---------- */

.timeline { position: relative; }

.tl-day {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 16px;
  position: relative;
  padding-bottom: 28px;
}
.tl-day::before {
  content: "";
  position: absolute;
  left: 29px; top: 64px; bottom: 4px;
  width: 2px;
  background: linear-gradient(var(--border), transparent);
}
.tl-day:last-child::before { display: none; }
.tl-day:last-child { padding-bottom: 0; }

.tl-badge {
  width: 60px; height: 60px;
  border-radius: 18px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 1;
}
.tl-badge .d { font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 1.1; }
.tl-badge .m { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.tl-day.today .tl-badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(139, 124, 255, .4);
}
.tl-day.today .tl-badge .m { color: rgba(255, 255, 255, .75); }

.tl-body { min-width: 0; }

.tl-date {
  position: sticky;
  top: 8px;
  z-index: 5;
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--dim);
  background: rgba(10, 12, 16, .85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  margin-bottom: 12px;
}

/* ---------- profile ---------- */

.profile-card { text-align: center; padding: 40px 24px; }

.avatar {
  width: 92px; height: 92px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 0 0 5px rgba(139, 124, 255, .16), 0 14px 30px rgba(139, 124, 255, .4), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.profile-card h2 { font-size: 22px; font-weight: 700; }
.profile-card .email { color: var(--dim); font-size: 14px; margin: 6px 0 20px; }
.profile-card .btn-danger { width: 100%; }

/* ---------- skeleton loading ---------- */

.skel {
  position: relative;
  overflow: hidden;
  background: var(--surface2);
  border: 1px solid var(--border);
}
.skel::after {
  content: "";
  position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

.skel-row { height: 78px; border-radius: var(--r-card); margin-bottom: 12px; }
.skel-note { height: 128px; border-radius: var(--r-card); margin-bottom: 12px; break-inside: avoid; }
.skel-line { height: 16px; border-radius: 8px; margin-bottom: 12px; }

/* ---------- empty states ---------- */

.empty { text-align: center; padding: 64px 24px; color: var(--dim); }
.empty-ill {
  width: 88px; height: 88px;
  border-radius: 28px;
  background: rgba(139, 124, 255, .1);
  border: 1px solid rgba(139, 124, 255, .25);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
  color: var(--primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.empty-ill svg { width: 40px; height: 40px; }
.empty h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty p { font-size: 14px; max-width: 320px; margin: 0 auto 16px; line-height: 1.6; }
.empty a.btn { margin-top: 4px; }

/* ---------- desktop ---------- */

@media (min-width: 900px) {
  .auth { grid-template-columns: 1.05fr 1fr; }

  .layout { display: grid; grid-template-columns: 248px 1fr; }

  .sidenav {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--border);
    background: var(--surface);
    padding: 20px 14px;
  }
  .sidenav .brand-lockup { margin-bottom: 28px; padding: 0 8px; }
  .sidenav nav { display: flex; flex-direction: column; gap: 4px; }
  .sidenav .nav-item {
    flex-direction: row;
    gap: 12px;
    padding: 12px 14px;
    font-size: 14px;
    border-radius: 12px;
  }
  .sidenav .nav-item.active { background: var(--surface2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); }

  .bottomnav { display: none; }

  .main { padding: 40px 48px 64px; }
  .container { max-width: 880px; }
  .notes-masonry { columns: 3; }
  .fab { bottom: 40px; right: 40px; }
  .toast { bottom: 40px; }
}

@media (max-width: 899px) {
  .auth-brand { padding: 40px 24px 32px; }
  .auth-brand h1 { font-size: 27px; }
  .brand-lockup { margin-bottom: 32px; }
  .lede { margin-bottom: 0; }
  .feat { display: none; }
  .auth-main { padding: 8px 20px 48px; align-items: flex-start; }
}

/* ============================================================
 * Contract v2 features: search, projects, labels, trash,
 * recurrence badges, checklist notes
 * ============================================================ */

[hidden] { display: none !important; }

/* ---------- global search topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 12px 0 10px;
  margin-bottom: 6px;
  background: linear-gradient(var(--bg) 78%, transparent);
}

.gsearch { position: relative; max-width: 520px; }
.gsearch > svg {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 17px; height: 17px;
  color: var(--dim);
  pointer-events: none;
}
.gsearch input { padding-left: 42px; padding-right: 46px; border-radius: var(--r-pill); }
.gsearch kbd {
  position: absolute;
  right: 15px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 8px;
  background: var(--surface);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  overflow: hidden;
  max-height: 62vh;
  overflow-y: auto;
  z-index: 50;
}

.sr-group {
  padding: 12px 16px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--dim);
  font-weight: 700;
}

.sr-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  padding: 10px 16px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  transition: background var(--ease);
}
.sr-row:hover { background: rgba(139, 124, 255, .1); }
.sr-row strong { display: block; font-weight: 600; font-size: 14px; }

.sr-ic {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex: none;
}
.sr-ic svg { width: 16px; height: 16px; }

.sr-snip { display: block; font-size: 12px; color: var(--dim); margin-top: 2px; line-height: 1.5; }
.sr-empty { padding: 20px; text-align: center; color: var(--dim); font-size: 14px; }

/* ---------- filter bar (project select + label chips) ---------- */

.filterbar { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.filterbar:empty { display: none; }
.filterbar select { width: auto; min-width: 170px; }

/* ---------- projects ---------- */

.proj-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

.proj-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  padding: 14px 16px;
  transition: border-color var(--ease);
}
.proj-row:hover { border-color: rgba(139, 124, 255, .35); }

.proj-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .06);
}

.proj-name {
  font-weight: 600;
  font-size: 15px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.proj-name:hover { color: var(--primary); }

/* ---------- chips, pills, badges ---------- */

.ld { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

.proj-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  background: rgba(139, 124, 255, .12);
  border: 1px solid rgba(139, 124, 255, .3);
  color: #c9c1ff;
}

.label-pills { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.note-card .label-pills { display: flex; margin-top: 10px; }

.label-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}
.note-card .label-pill {
  background: rgba(0, 0, 0, .16);
  border: 1px solid rgba(0, 0, 0, .14);
  color: #202124;
}

.recur-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(103, 232, 249, .1);
  border: 1px solid rgba(103, 232, 249, .3);
  padding: 4px 11px;
  border-radius: var(--r-pill);
}
.recur-badge svg { width: 12px; height: 12px; }

.mchips { display: flex; flex-wrap: wrap; gap: 8px; }

.mchip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--dim);
  border-radius: var(--r-pill);
  padding: 8px 15px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease), background var(--ease), box-shadow var(--ease);
}
.mchip:hover { color: var(--text); border-color: rgba(139, 124, 255, .4); }
.mchip.selected {
  border-color: var(--primary);
  color: #fff;
  background: rgba(139, 124, 255, .18);
  box-shadow: 0 0 0 3px rgba(139, 124, 255, .15);
}

.hint { font-size: 13px; color: var(--dim); line-height: 1.5; }

.chips.flat { margin-bottom: 0; }

/* ---------- checklist notes ---------- */

.checklist { display: flex; flex-direction: column; gap: 8px; }

.cl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  padding: 10px 12px;
  transition: border-color var(--ease);
}
.cl-row:hover { border-color: rgba(139, 124, 255, .35); }

.cl-text { flex: 1; font-size: 14px; word-break: break-word; }
.cl-text.done { text-decoration: line-through; color: var(--dim); }

.clprog {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #202124;
  opacity: .75;
  margin-top: 10px;
}
.clprog svg { width: 14px; height: 14px; }
.clprog:empty { display: none; }

/* ---------- trash ---------- */

.trash-row {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.trash-info { flex: 1; min-width: 0; }

.trash-kind {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--dim);
  font-weight: 700;
  margin-bottom: 2px;
}

.trash-title {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trash-sub { font-size: 12px; color: var(--dim); margin-top: 4px; }

.trash-actions { display: flex; gap: 8px; flex: none; }

.btn svg { width: 16px; height: 16px; flex: none; }
