/* ==========================================================================
   Aurora — styles
   1. Theme tokens (light / dark / pink)   5. Tasks
   2. Base                                 6. Views
   3. Layout (sidebar, topbar, panel)      7. Feedback (toasts, dialog)
   4. Controls                             8. Responsive
   ========================================================================== */

/* ---------- 1. Theme tokens ---------- */

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --surface-3: #e7e7e3;
  --border: #e4e4df;
  --border-strong: #d0d0ca;
  --text: #1c1c1f;
  --text-2: #55555c;
  --text-3: #707077;
  --accent: #3355d6;
  --accent-soft: #eaeefc;
  --accent-contrast: #ffffff;
  --accent-ring: rgba(51, 85, 214, .25);
  --danger: #c4362f;
  --danger-soft: #fdeeed;
  --success: #1c8049;
  --success-soft: #e5f3eb;
  --sidebar-bg: #f0f0ec;
  --toast-bg: #232327;
  --toast-text: #f4f4f6;
  --shadow-sm: 0 1px 2px rgba(20, 20, 30, .05);
  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 8px 24px rgba(20, 20, 30, .07);
  --shadow-lg: 0 12px 40px rgba(20, 20, 30, .16);
  --backdrop: rgba(20, 20, 26, .32);

  --q1: #c4362f; --q1-bg: #fdeeed;
  --q2: #2d62cf; --q2-bg: #ebf1fd;
  --q3: #8a5d00; --q3-bg: #fcf2d9;
  --q4: #66666d; --q4-bg: #efefec;
  --important: #2d62cf; --important-bg: #ebf1fd;
  --urgent: #c7501b; --urgent-bg: #fdefe6;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141417;
  --surface: #1c1c20;
  --surface-2: #25252a;
  --surface-3: #2f2f35;
  --border: #2c2c32;
  --border-strong: #3d3d45;
  --text: #ececf0;
  --text-2: #adadb7;
  --text-3: #8b8b95;
  --accent: #8ea5ff;
  --accent-soft: rgba(142, 165, 255, .14);
  --accent-contrast: #111427;
  --accent-ring: rgba(142, 165, 255, .32);
  --danger: #ff7f78;
  --danger-soft: rgba(255, 127, 120, .12);
  --success: #62d392;
  --success-soft: rgba(98, 211, 146, .12);
  --sidebar-bg: #18181b;
  --toast-bg: #ececf0;
  --toast-text: #17171a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
  --backdrop: rgba(0, 0, 0, .55);

  --q1: #ff8a82; --q1-bg: rgba(255, 128, 120, .13);
  --q2: #8cb0ff; --q2-bg: rgba(130, 170, 255, .13);
  --q3: #f1c255; --q3-bg: rgba(241, 194, 85, .12);
  --q4: #a8a8b2; --q4-bg: rgba(255, 255, 255, .06);
  --important: #8cb0ff; --important-bg: rgba(130, 170, 255, .14);
  --urgent: #ffa066; --urgent-bg: rgba(255, 160, 102, .14);
}

:root[data-theme="pink"] {
  color-scheme: light;
  --bg: #fdf5f8;
  --surface: #fffbfc;
  --surface-2: #faebf1;
  --surface-3: #f4dde7;
  --border: #f0dbe4;
  --border-strong: #e3c3d1;
  --text: #2d1e25;
  --text-2: #69505b;
  --text-3: #866b77;
  --accent: #b43d70;
  --accent-soft: #fbe3ee;
  --accent-contrast: #ffffff;
  --accent-ring: rgba(180, 61, 112, .25);
  --danger: #bf2f4c;
  --danger-soft: #fde8ed;
  --success: #287f50;
  --success-soft: #e4f3ea;
  --sidebar-bg: #fbeef3;
  --toast-bg: #3a2530;
  --toast-text: #fff4f8;
  --shadow-sm: 0 1px 2px rgba(120, 40, 80, .06);
  --shadow: 0 1px 2px rgba(120, 40, 80, .05), 0 8px 24px rgba(120, 40, 80, .08);
  --shadow-lg: 0 12px 40px rgba(120, 40, 80, .18);
  --backdrop: rgba(60, 20, 40, .3);

  --q1: #bf2f4c; --q1-bg: #fde8ed;
  --q2: #3b5fc4; --q2-bg: #ebeffc;
  --q3: #8a5a00; --q3-bg: #fcf0da;
  --q4: #75626b; --q4-bg: #f5eaef;
  --important: #3b5fc4; --important-bg: #ebeffc;
  --urgent: #c24d1c; --urgent-bg: #fdede4;
}

/* Quadrant color hooks: every element tagged with a quadrant gets --qc / --qc-bg. */
.q-q1, .qbadge--q1, .quad--q1, .chip-btn--q1, .qmini__item--q1, .qpicker__cell--q1, .quad-accent--q1 { --qc: var(--q1); --qc-bg: var(--q1-bg); }
.q-q2, .qbadge--q2, .quad--q2, .chip-btn--q2, .qmini__item--q2, .qpicker__cell--q2, .quad-accent--q2 { --qc: var(--q2); --qc-bg: var(--q2-bg); }
.q-q3, .qbadge--q3, .quad--q3, .chip-btn--q3, .qmini__item--q3, .qpicker__cell--q3, .quad-accent--q3 { --qc: var(--q3); --qc-bg: var(--q3-bg); }
.q-q4, .qbadge--q4, .quad--q4, .chip-btn--q4, .qmini__item--q4, .qpicker__cell--q4, .quad-accent--q4 { --qc: var(--q4); --qc-bg: var(--q4-bg); }

/* ---------- 2. Base ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
ul, ol { margin: 0; padding: 0; }

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

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.skip-link {
  position: fixed; left: 12px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--accent-contrast);
  padding: 8px 14px; border-radius: 8px; text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; }

.sidebar, .panel { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

.muted { color: var(--text-3); }
.small { font-size: 13px; }
.hint { color: var(--text-3); font-size: 13px; margin-top: 14px; }

kbd {
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; background: var(--surface-2); color: var(--text-2);
}

/* ---------- 3. Layout ---------- */

.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
body.sidebar-collapsed .app { grid-template-columns: 68px minmax(0, 1fr); }

.sidebar {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 12px 10px;
  overflow-y: auto; overflow-x: hidden;
  z-index: 30;
}
.sidebar__top { display: flex; align-items: center; gap: 6px; padding: 2px 2px 14px; }
.sidebar__collapse { margin-left: auto; }
.sidebar .sidebar__close { display: none; margin-left: auto; }
.sidebar__bottom { margin-top: auto; padding-top: 12px; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text); border-radius: 10px; padding: 2px;
}
.brand__mark {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-contrast);
}
.brand__mark .icon { width: 20px; height: 20px; stroke-width: 2; }
.brand__name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand--compact { display: none; }

.nav__list { list-style: none; display: grid; gap: 2px; }
.nav__link {
  display: flex; align-items: center; gap: 11px;
  min-height: 36px; padding: 0 10px; border-radius: 9px;
  color: var(--text-2); text-decoration: none; font-size: 14px;
  white-space: nowrap;
}
.nav__link:hover { background: var(--surface-3); color: var(--text); }
.nav__link.is-active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
.nav__link.is-active .icon { color: var(--accent); }
.nav__label { overflow: hidden; text-overflow: ellipsis; }
.nav__count { margin-left: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav__section { display: flex; align-items: center; justify-content: space-between; margin: 20px 4px 6px 10px; }
.nav__heading { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }

body.sidebar-collapsed .brand__name,
body.sidebar-collapsed .nav__label,
body.sidebar-collapsed .nav__count,
body.sidebar-collapsed .nav__heading { display: none; }
body.sidebar-collapsed .sidebar__top { flex-direction: column; }
body.sidebar-collapsed .sidebar__collapse { margin-left: 0; }
body.sidebar-collapsed .nav__link { justify-content: center; padding: 0; }
body.sidebar-collapsed .nav__section { justify-content: center; margin: 16px 0 6px; }

.sidebar-backdrop { position: fixed; inset: 0; background: var(--backdrop); z-index: 55; }
.sidebar-backdrop[hidden] { display: none; }

.main-col { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.topbar .topbar__menu { display: none; }
.topbar__new { margin-left: auto; }

.search { position: relative; flex: 1; max-width: 440px; }
.search__icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search__input {
  width: 100%; height: 38px;
  padding: 0 36px 0 38px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface);
}
.search__input::placeholder { color: var(--text-3); }
.search__input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); outline: none; }
.search__input::-webkit-search-cancel-button { cursor: pointer; }
.search__kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search__input:focus ~ .search__kbd, .search__input:not(:placeholder-shown) ~ .search__kbd { display: none; }

.main { flex: 1; padding: 4px 28px 96px; outline: none; }
.view { max-width: 760px; margin: 0 auto; }
.view--wide { max-width: 1120px; }

.panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 40;
  outline: none;
  animation: panel-in .18s ease-out;
}
.panel[hidden] { display: none; }
@keyframes panel-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 4. Controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border: 1px solid transparent; border-radius: 9px;
  font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn .icon { width: 16px; height: 16px; }
.btn--primary { background: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn--secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn--secondary:hover, .btn--secondary.is-on { background: var(--surface-2); }
.btn--ghost { background: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn--danger-text { color: var(--danger); }
.btn--sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn--block { width: 100%; margin-top: 8px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn--sm { width: 26px; height: 26px; border-radius: 6px; }
.icon-btn--sm .icon { width: 15px; height: 15px; }
.icon-btn--danger:hover { color: var(--danger); background: var(--danger-soft); }

.input {
  width: 100%; height: 36px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 14px;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); outline: none; }
.input::placeholder { color: var(--text-3); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input.is-overdue { border-color: var(--danger); color: var(--danger); }
.input--sm { width: auto; height: 30px; font-size: 13px; padding: 0 8px; }
.input--lg { height: 42px; font-size: 16px; }
.input--bare { border: 0; background: transparent; height: 32px; padding: 0 4px; box-shadow: none !important; }
.textarea { height: auto; min-height: 60px; padding: 8px 10px; line-height: 1.5; resize: vertical; }
.select { padding-right: 6px; }

.field { display: grid; gap: 6px; margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field__label { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: .02em; padding: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.inline-row--tight { margin-top: 6px; }
.inline-row--nowrap { flex-wrap: nowrap; }

.toggle {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); color: var(--text-2); font-size: 13px;
}
.toggle .icon { width: 15px; height: 15px; }
.toggle:hover { background: var(--surface-2); }
.toggle--important.is-on { background: var(--important-bg); color: var(--important); border-color: color-mix(in srgb, var(--important) 40%, transparent); font-weight: 600; }
.toggle--urgent.is-on { background: var(--urgent-bg); color: var(--urgent); border-color: color-mix(in srgb, var(--urgent) 40%, transparent); font-weight: 600; }
.toggle.is-on .icon { fill: currentColor; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); color: var(--text-2); font-size: 12.5px; white-space: nowrap;
}
.chip-btn:hover { background: var(--surface-2); color: var(--text); }
.chip-btn.is-on { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); font-weight: 600; }
.chip-btn[class*="chip-btn--q"].is-on { background: var(--qc-bg); color: var(--qc); border-color: color-mix(in srgb, var(--qc) 45%, transparent); }

.switch {
  position: relative; flex: none;
  width: 42px; height: 24px; padding: 0;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface-3);
  transition: background-color .15s;
}
.switch__thumb {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: transform .15s;
}
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"] .switch__thumb { transform: translateX(18px); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 10px; }
.segmented__opt {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2); font-size: 13px;
}
.segmented__opt .icon { width: 15px; height: 15px; }
.segmented__opt.is-on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }

/* ---------- 5. Tasks ---------- */

.tasks { list-style: none; display: grid; gap: 6px; }

.task {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 8px 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--qc);
  border-radius: 10px;
  transition: border-color .12s, background-color .12s, opacity .2s;
}
.task:hover { border-color: var(--border-strong); border-left-color: var(--qc); }
.task.is-selected { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); border-left-color: var(--qc); }
.task.is-done { border-left-color: var(--border-strong); }
.task.is-dragging { opacity: .45; }

.check {
  flex: none; display: grid; place-items: center;
  width: 22px; height: 22px; margin-top: 1px; padding: 0;
  border: 1.6px solid var(--text-3); border-radius: 50%;
  background: transparent; color: var(--accent-contrast);
  transition: background-color .15s, border-color .15s;
}
.check .icon { width: 13px; height: 13px; stroke-width: 3; opacity: 0; transition: opacity .12s; }
.check:hover { border-color: var(--success); }
.check:hover .icon { opacity: .9; color: var(--success); }
.check.is-checked { background: var(--success); border-color: var(--success); }
.check.is-checked .icon { opacity: 1; color: #fff; }
.check--sm { width: 18px; height: 18px; }
.check--sm .icon { width: 11px; height: 11px; }
.check--lg { width: 26px; height: 26px; margin-top: 4px; }

.task__body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 5px;
  padding: 0; border: 0; background: none; text-align: left;
}
.task__title { font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.task.is-done .task__title { text-decoration: line-through; color: var(--text-3); }
.task__desc {
  display: block; margin-top: 1px; font-size: 13px; line-height: 1.4; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.task.is-done .task__desc { color: var(--text-3); }
.chip--rolled { color: var(--warning, #b7791f); font-weight: 600; }
.task__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--text-2); }

.chip { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip .icon { width: 13px; height: 13px; }
.chip--due.is-overdue { color: var(--danger); font-weight: 600; }
.chip--due.is-today { color: var(--accent); font-weight: 600; }
.chip--done { color: var(--success); }
.chip--tag { color: var(--text-3); }
.chip--muted { color: var(--text-3); font-style: italic; }

.qbadge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 8px 1px 3px; border-radius: 999px;
  background: var(--qc-bg); color: var(--qc);
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.qbadge__code { padding: 0 5px; border-radius: 999px; background: var(--qc); color: var(--surface); font-size: 10.5px; letter-spacing: .02em; }

.task__flags { display: flex; gap: 0; margin-top: -3px; }
.flag {
  display: grid; place-items: center;
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-3);
  opacity: 0; transition: opacity .12s;
}
.flag .icon { width: 16px; height: 16px; }
.task:hover .flag, .flag:focus-visible, .flag.is-on { opacity: 1; }
.flag:hover { background: var(--surface-2); color: var(--text); }
.flag--important.is-on { color: var(--important); }
.flag--urgent.is-on { color: var(--urgent); }
.flag--delete:hover { color: var(--danger); background: var(--danger-soft); }
.flag.is-on .icon { fill: currentColor; }

.task--compact { padding: 6px 6px 6px 8px; border: 0; border-left: 0; background: transparent; gap: 8px; }
.task--compact:hover { background: var(--surface-2); }
.task--compact .check { width: 18px; height: 18px; }
.task--compact .check .icon { width: 11px; height: 11px; }
.task--compact .task__title { font-size: 14px; }
.task--compact .task__meta { font-size: 12px; }
.task--compact[draggable="true"] { cursor: grab; }

/* ---------- 6. Views ---------- */

.view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 22px 0 18px; }
.view-title { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; outline: none; }
.view-subtitle { color: var(--text-2); margin-top: 3px; }
.view-eyebrow { color: var(--text-3); font-size: 13px; margin-bottom: 2px; }
.view-header__actions { display: flex; gap: 6px; }
.view-header--quad { border-left: 4px solid var(--qc); padding-left: 14px; margin-top: 10px; }
.view-header--quad .view-eyebrow { color: var(--qc); font-weight: 600; }
.backlink { display: inline-flex; align-items: center; gap: 2px; margin-top: 16px; font-size: 13px; color: var(--text-2); text-decoration: none; }
.backlink:hover { color: var(--text); }
.backlink .icon { width: 16px; height: 16px; }

.section { margin-top: 26px; }
.section__head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; min-height: 24px; }
.section__title { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-2); outline: none; }
.section__title .icon { width: 15px; height: 15px; }
.section__title--alert { color: var(--danger); }
.section__count { font-size: 12px; color: var(--text-3); background: var(--surface-2); padding: 0 7px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.section__link { margin-left: auto; font-size: 13px; text-decoration: none; }
.section__link:hover { text-decoration: underline; }
.section__hint { margin-left: auto; font-size: 12px; color: var(--text-3); }

.fold { margin-top: 12px; }
.fold__summary {
  display: inline-flex; align-items: center; gap: 6px;
  list-style: none; cursor: pointer; user-select: none;
  padding: 5px 8px 5px 4px; margin-bottom: 6px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-2);
}
.fold__summary::-webkit-details-marker { display: none; }
.fold__summary:hover { background: var(--surface-2); }
.fold__summary .icon { width: 15px; height: 15px; transition: transform .15s; }
.fold[open] > .fold__summary .icon:first-child { transform: rotate(90deg); }

.empty { text-align: center; padding: 34px 16px; color: var(--text-2); }
.empty__icon { width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); }
.empty__icon .icon { width: 22px; height: 22px; }
.empty__title { font-weight: 600; color: var(--text); }
.empty__body { font-size: 14px; margin-top: 4px; }
.empty .btn { margin-top: 14px; }

/* Quick add */
.quickadd {
  margin: 16px 0 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color .12s, box-shadow .12s;
}
.quickadd:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.quickadd__row { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; }
.quickadd__plus { color: var(--accent); display: grid; }
.quickadd__input { flex: 1; min-width: 0; height: 40px; border: 0; background: transparent; font-size: 15px; outline: none !important; }
.quickadd__input::placeholder { color: var(--text-3); }
.quickadd__submit { opacity: 0; pointer-events: none; transition: opacity .12s; }
.quickadd.is-open .quickadd__submit, .quickadd:focus-within .quickadd__submit { opacity: 1; pointer-events: auto; }
.quickadd__desc { padding: 0 10px 6px 36px; }
.quickadd__desc .input { width: 100%; }
.quickadd__options { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 2px 10px 10px 36px; }
.quickadd__chips { display: inline-flex; gap: 6px; }
.quickadd__q { margin-left: auto; }

.quickdlg__q { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); margin-left: 4px; }
.quickdlg__more summary { cursor: pointer; color: var(--text-2); font-size: 13px; margin-bottom: 10px; }

/* Today */
.focus {
  display: flex; gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  --tone: var(--accent);
  box-shadow: inset 3px 0 0 var(--tone);
}
.focus--alert { --tone: var(--danger); }
.focus--critical { --tone: var(--q1); }
.focus--warn { --tone: var(--q3); }
.focus--done { --tone: var(--success); }
.focus__icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent); }
.focus__body { min-width: 0; }
.focus__label { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }
.focus__msg { font-size: 16px; font-weight: 500; margin-top: 3px; line-height: 1.45; }
.focus__sec { color: var(--text-2); font-size: 14px; margin-top: 3px; }
.focus__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 16px 0 0; }
.summary__line { color: var(--text-2); font-size: 14px; }
.summary__overdue { color: var(--danger); font-weight: 600; text-decoration: none; }
.summary__overdue:hover { text-decoration: underline; }
.qmini { display: flex; flex-wrap: wrap; gap: 6px; }
.qmini__item {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 10px; border-radius: 8px;
  background: var(--qc-bg); color: var(--qc);
  font-size: 13px; font-weight: 600; text-decoration: none;
}
.qmini__item:hover { box-shadow: inset 0 0 0 1px var(--qc); }
.qmini__code { font-size: 11px; opacity: .85; }
.qmini__n { font-variant-numeric: tabular-nums; }
.qmini__link { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: 8px; color: var(--text-2); font-size: 13px; text-decoration: none; }
.qmini__link:hover { background: var(--surface-2); color: var(--text); }
.qmini__link .icon { width: 15px; height: 15px; }

/* Toolbar & filters */
.toolbar { margin: 14px 0 12px; }
.toolbar__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar__spacer { flex: 1; }
.toolbar__sort { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.filters { display: grid; gap: 10px; margin-top: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.filters__group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filters__label { width: 88px; flex: none; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }

/* Matrix */
.matrix {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  gap: 12px;
}
.matrix__axis { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }
.matrix__axis .icon { width: 13px; height: 13px; }
.matrix__axis--row span { display: inline-flex; align-items: center; gap: 6px; writing-mode: vertical-rl; transform: rotate(180deg); }
.matrix__axis--row .icon { transform: rotate(90deg); }

.quad {
  display: flex; flex-direction: column;
  min-height: 250px; padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: inset 0 3px 0 var(--qc);
  transition: background-color .12s, box-shadow .12s;
}
.quad.is-drop { background: var(--qc-bg); box-shadow: inset 0 3px 0 var(--qc), 0 0 0 2px var(--qc); }
.quad__head { display: flex; align-items: center; gap: 12px; padding: 4px; margin: -4px; border-radius: 10px; color: inherit; text-decoration: none; }
.quad__head:hover { background: var(--surface-2); }
.quad__count { min-width: 38px; font-size: 30px; font-weight: 700; line-height: 1; color: var(--qc); font-variant-numeric: tabular-nums; }
.quad__titles { display: grid; min-width: 0; }
.quad__name { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 650; }
.quad__code { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--qc-bg); color: var(--qc); }
.quad__axis { font-size: 12px; color: var(--text-3); }
.quad__chev { margin-left: auto; color: var(--text-3); }
.quad__desc { font-size: 13px; color: var(--text-2); margin: 10px 0 8px; }
.quad .tasks { gap: 1px; margin: 0 -6px; }
.quad__empty { color: var(--text-3); font-size: 13px; padding: 14px 0; }
.quad__more { margin-top: 8px; font-size: 13px; color: var(--qc); text-decoration: none; font-weight: 600; }
.quad__more:hover { text-decoration: underline; }

/* Month navigation / calendars */
.monthnav { display: flex; align-items: center; gap: 4px; }
.monthnav__title { font-size: 15px; font-weight: 650; min-width: 150px; text-align: center; }

.calendar { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.cal { padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.cal__top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal__legend { display: flex; gap: 12px; margin-left: auto; font-size: 12px; color: var(--text-2); }
.cal__legend > span { display: inline-flex; align-items: center; gap: 5px; }
.cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal__wd { padding: 4px 0; text-align: center; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; }
.cal__day {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px;
  min-height: 94px; padding: 5px; min-width: 0;
  border: 1px solid var(--border); border-radius: 9px;
  background: transparent; text-align: left; color: var(--text); overflow: hidden;
}
.cal__day:hover { background: var(--surface-2); }
.cal__day.is-out { opacity: .45; }
.cal__day.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal__num { align-self: flex-start; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal__day.is-today .cal__num { background: var(--accent); color: var(--accent-contrast); }
.cal__items { display: grid; gap: 2px; min-width: 0; }
.cal__item { display: block; padding: 1px 5px; border-radius: 4px; background: var(--qc-bg); color: var(--qc); font-size: 11px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal__item.is-done { text-decoration: line-through; opacity: .6; }
.cal__item.is-overdue { box-shadow: inset 2px 0 0 var(--danger); }
.cal__more { font-size: 11px; color: var(--text-3); padding-left: 4px; }
.cal__dots { display: none; gap: 3px; justify-content: center; }
.cal__dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.cal__dot.is-overdue { background: var(--danger); }
.cal__dot.is-done { background: var(--success); }
.calendar__date { font-size: 17px; font-weight: 650; }
.calendar__day .quickadd { margin-top: 12px; }
.calendar__day .section { margin-top: 18px; }

.history { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
.minical { position: sticky; top: 76px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.minical .monthnav { justify-content: space-between; margin-bottom: 8px; }
.minical .monthnav__title { min-width: 0; }
.minical__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.minical__wd { text-align: center; font-size: 10.5px; font-weight: 600; color: var(--text-3); padding: 4px 0; text-transform: uppercase; }
.minical__day {
  position: relative; height: 34px; padding: 0 0 4px;
  border: 0; border-radius: 8px; background: transparent;
  font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text);
}
.minical__day:hover { background: var(--surface-2); }
.minical__day.is-out { color: var(--text-3); opacity: .6; }
.minical__day.is-today { box-shadow: inset 0 0 0 1.5px var(--accent); font-weight: 700; }
.minical__day.is-selected { background: var(--accent); color: var(--accent-contrast); font-weight: 700; }
.minical__dot { position: absolute; left: 50%; bottom: 4px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--text-3); }
.minical__dot.is-done { background: var(--success); }
.minical__day.is-selected .minical__dot { background: var(--accent-contrast); }
.minical__totals { margin-top: 10px; font-size: 12.5px; color: var(--text-2); }

.daynav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.daynav__title { display: grid; }
.daynav__date { font-size: 18px; font-weight: 650; }
.daynav__rel { font-size: 12px; color: var(--text-3); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 16px 0 4px; }
.stat { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.stat__n { display: block; font-size: 22px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat__label { font-size: 12px; color: var(--text-2); }
.stat--done .stat__n { color: var(--success); }
.stat--alert .stat__n { color: var(--danger); }

.hist { list-style: none; display: grid; gap: 6px; }
.hist-item__btn {
  display: flex; flex-direction: column; gap: 4px; width: 100%;
  padding: 9px 12px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
button.hist-item__btn:hover { border-color: var(--border-strong); }
.hist-item.is-gone .task__title { color: var(--text-3); }

.timeline { list-style: none; }
.timeline__item {
  display: grid; grid-template-columns: 22px 64px minmax(0, 1fr); gap: 8px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.timeline__item:last-child { border-bottom: 0; }
.timeline__icon { color: var(--text-3); align-self: center; display: grid; }
.timeline__icon .icon { width: 15px; height: 15px; }
.timeline__item--completed .timeline__icon { color: var(--success); }
.timeline__item--deleted .timeline__icon { color: var(--danger); }
.timeline__time { color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.timeline__text { color: var(--text-2); overflow-wrap: anywhere; }
.timeline__text strong { color: var(--text); font-weight: 600; }
.timeline--compact .timeline__item { grid-template-columns: 20px minmax(96px, auto) minmax(0, 1fr); font-size: 13px; }

/* Lists */
.listcards { list-style: none; display: grid; gap: 8px; }
.listcard { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.listcard:hover { border-color: var(--border-strong); }
.listcard__main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 4px 0; border-radius: 8px; }
.listcard__icon { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.listcard__text { display: grid; min-width: 0; }
.listcard__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listcard__counts { font-size: 13px; color: var(--text-2); }
.listcard__hint { font-size: 12px; color: var(--text-3); text-align: right; }
.listcard__actions { display: flex; gap: 2px; }

/* Settings */
.card { margin-bottom: 16px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.card__title { font-size: 15px; font-weight: 650; margin-bottom: 12px; }
.card__desc { color: var(--text-2); font-size: 14px; }
.themecards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.themecard { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; background: var(--surface); }
.themecard:hover { background: var(--surface-2); }
.themecard.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.themecard:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.themecard__preview { display: grid; grid-template-columns: 1fr 2fr; grid-template-rows: 1fr 10px; gap: 4px; height: 56px; padding: 6px; border-radius: 8px; border: 1px solid rgba(0, 0, 0, .08); }
.themecard__preview span { border-radius: 4px; }
.themecard__preview span:nth-child(1) { grid-row: span 2; }
.themecard__preview span:nth-child(3) { grid-column: 2; width: 50%; }
.themecard--light .themecard__preview { background: #f7f7f5; }
.themecard--light .themecard__preview span:nth-child(1) { background: #ebebe7; }
.themecard--light .themecard__preview span:nth-child(2) { background: #ffffff; border: 1px solid #e4e4df; }
.themecard--light .themecard__preview span:nth-child(3) { background: #3355d6; }
.themecard--dark .themecard__preview { background: #141417; }
.themecard--dark .themecard__preview span:nth-child(1) { background: #202024; }
.themecard--dark .themecard__preview span:nth-child(2) { background: #26262b; }
.themecard--dark .themecard__preview span:nth-child(3) { background: #8ea5ff; }
.themecard--pink .themecard__preview { background: #fdf5f8; }
.themecard--pink .themecard__preview span:nth-child(1) { background: #f7e1ea; }
.themecard--pink .themecard__preview span:nth-child(2) { background: #fffbfc; border: 1px solid #f0dbe4; }
.themecard--pink .themecard__preview span:nth-child(3) { background: #b43d70; }
.themecard__name { font-size: 13px; font-weight: 600; }

.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.card__title + .setting { border-top: 0; padding-top: 0; }
.setting--block { flex-wrap: wrap; }
.setting__text { display: grid; gap: 2px; min-width: 0; }
.setting__label { font-size: 14px; font-weight: 550; }
.setting__desc { font-size: 13px; color: var(--text-2); }
.setting__status { font-size: 13px; color: var(--text-2); background: var(--surface-2); padding: 8px 10px; border-radius: 8px; margin: 0 0 4px; }
.setting__status.is-ok { color: var(--success); background: var(--success-soft); }
.setting__status .icon { width: 14px; height: 14px; vertical-align: -2px; }
.q1alerts { margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--border, rgba(127,127,127,.25)); }
.q1alerts .field-row { margin: 4px 0 8px; }
.field--end { display: flex; align-items: flex-end; }
.shortcuts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; align-items: center; }
.shortcuts dd { margin: 0; color: var(--text-2); font-size: 14px; }

/* Detail panel */
.panel__inner { padding: 12px 20px 32px; }
.panel__top { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.panel__status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.panel__status .icon { width: 16px; height: 16px; }
.panel__status.is-done { color: var(--success); }
.panel__head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.panel__title-input {
  flex: 1; min-width: 0;
  padding: 2px 6px; margin: 0 -6px;
  border: 0; border-radius: 8px; background: transparent;
  font-size: 20px; font-weight: 650; line-height: 1.35; letter-spacing: -.01em;
  resize: none; overflow: hidden;
}
.panel__title-input:hover { background: var(--surface-2); }
.panel__title-input:focus { background: var(--surface-2); outline: 2px solid var(--accent); outline-offset: 0; }
.panel__done { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--success); margin: -2px 0 10px 36px; }
.panel__done .icon { width: 14px; height: 14px; }
.panel__rolled { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--warning, #b7791f); margin: -2px 0 10px 36px; }
.panel__rolled .icon { width: 14px; height: 14px; }
.panel__section { display: grid; gap: 10px; padding: 14px 0 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 8px 0 16px; }
.panel__qdesc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.panel__grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.inline-row--nowrap > .input { min-width: 0; }
.panel__dates { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 6px 0 12px; font-size: 13px; }
.panel__dates dt { color: var(--text-3); }
.panel__dates dd { margin: 0; color: var(--text-2); }
.panel__footer { display: flex; justify-content: space-between; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

.qpicker { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.qpicker__cell {
  display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text-2); text-align: left; font-size: 13px;
}
.qpicker__cell:hover { background: var(--surface-2); }
.qpicker__cell.is-on { background: var(--qc-bg); color: var(--qc); border-color: color-mix(in srgb, var(--qc) 55%, transparent); font-weight: 600; }
.qpicker__code { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.qpicker__cell.is-on .qpicker__code { background: var(--qc); color: var(--surface); }

.q3box { display: grid; gap: 8px; padding: 12px; border-radius: 10px; background: var(--q3-bg); }
.q3box .field { margin: 4px 0 0; }

.subtasks__list { list-style: none; display: grid; gap: 2px; margin-bottom: 4px; }
.subtask { display: flex; align-items: center; gap: 10px; padding: 4px 2px; border-radius: 8px; }
.subtask:hover { background: var(--surface-2); }
.subtask__title { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.subtask.is-done .subtask__title { text-decoration: line-through; color: var(--text-3); }
.subtasks__add { display: flex; align-items: center; gap: 8px; padding: 0 2px; border-bottom: 1px dashed var(--border-strong); }
.subtasks__plus { color: var(--text-3); display: grid; }
.subtasks__plus .icon { width: 16px; height: 16px; }
.fold--panel { margin: 4px 0 0; }

/* ---------- 7. Feedback ---------- */

.toasts {
  position: fixed; left: 50%; bottom: 24px; z-index: 90;
  transform: translateX(-50%);
  display: grid; gap: 8px; justify-items: center;
  width: max-content; max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  max-width: 480px; padding: 9px 8px 9px 14px;
  background: var(--toast-bg); color: var(--toast-text);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  font-size: 14px; pointer-events: auto;
  animation: toast-in .18s ease-out;
}
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; }
.toast__icon { width: 17px; height: 17px; }
.toast--success .toast__icon { color: #4fd18b; }
.toast--error .toast__icon { color: #ff8a80; }
.toast--reminder .toast__icon { color: #ffc861; }
.toast--urgent { box-shadow: 0 0 0 2px #e5484d, 0 10px 30px rgba(0, 0, 0, .3); animation: toast-pulse 1.4s ease-in-out 3; }
.toast--urgent .toast__icon { color: #ff6b6b; }
@keyframes toast-pulse { 50% { box-shadow: 0 0 0 5px rgba(229, 72, 77, .45), 0 10px 30px rgba(0, 0, 0, .3); } }
@media (prefers-reduced-motion: reduce) { .toast--urgent { animation: none; } }
.toast__msg { flex: 1; }
.toast__action { border: 0; background: transparent; color: inherit; font-weight: 700; padding: 4px 8px; border-radius: 6px; text-decoration: underline; text-underline-offset: 2px; }
.toast__action:hover { background: rgba(127, 127, 127, .2); }
.toast__close { color: inherit; opacity: .7; }
.toast__close:hover { opacity: 1; background: rgba(127, 127, 127, .2); color: inherit; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0; border: 0; border-radius: 16px;
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg);
}
.dialog--wide { width: min(540px, calc(100vw - 32px)); }
.dialog::backdrop { background: var(--backdrop); }
.dialog[open] { animation: dialog-in .16s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog__form { padding: 22px 22px 18px; }
.dialog__title { font-size: 18px; font-weight: 650; margin-bottom: 8px; }
.dialog__body { color: var(--text-2); font-size: 14px; margin-bottom: 4px; }
.dialog__form > .field:first-of-type, .quickdlg { margin-top: 14px; }
.dialog__actions { display: flex; flex-direction: row-reverse; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

/* ---------- Widget (Hoy y mañana) ---------- */

.topbar__pull { margin-left: auto; }
/* In the Android app the home-screen widget replaces the popup widget. */
.is-android .topbar__widget { display: none; }
body.is-cloud .topbar__pull, body.is-cloud .topbar__sync { display: none; }
body.is-cloud .topbar__done { margin-left: auto; }
body.is-syncing .topbar__sync .icon, body.is-syncing .topbar__pull .icon { animation: pulse 1s ease-in-out infinite; color: var(--accent); }
.btn-row--tight { margin: 0; }
@keyframes pulse { 50% { opacity: .35; } }
.setting__desc--strong { color: var(--text); font-weight: 500; }
.topbar__done ~ .topbar__new { margin-left: 0; }
.topbar__done.is-on, .widget__toggle.is-on { color: var(--accent); background: var(--accent-soft); }

body.widget-page { background: var(--bg); overflow: hidden; }
.widget { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.widget__head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 8px 16px; }
.widget__icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.widget__titles { flex: 1; min-width: 0; }
.widget__title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: var(--accent); }
.widget__sub { font-size: 12px; color: var(--text-3); }
.widget__scroll { flex: 1; overflow-y: auto; padding: 0 12px 6px; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.wsec { margin-top: 10px; }
.wsec__title { display: flex; align-items: baseline; gap: 8px; margin: 4px 4px 8px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-2); }
.wsec__date { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-3); }
.wsec__title .section__count { margin-left: auto; }
.wsec__empty { padding: 10px 6px; font-size: 13px; color: var(--text-3); }
.wlist { list-style: none; display: grid; gap: 5px; }
.wtask {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--qc);
  border-radius: 9px;
}
.wtask.is-done { border-left-color: var(--border-strong); }
.wtask .check { margin-top: 2px; }
.wtask__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 0; border: 0; background: none; text-align: left; }
.wtask__title { font-size: 14px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.wtask.is-done .wtask__title { text-decoration: line-through; color: var(--text-3); }
.wtask__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 11.5px; color: var(--text-2); }
.wtask__meta .icon { width: 12px; height: 12px; }
.wtask__star { flex: none; color: var(--important); margin-top: 1px; }
.wtask__star .icon { width: 16px; height: 16px; fill: currentColor; }
.wtask.is-done .wtask__star { opacity: .5; }
.wtask__del { flex: none; margin: -2px -4px 0 0; color: var(--text-3); opacity: 0; transition: opacity .12s; }
.wtask:hover .wtask__del, .wtask:focus-within .wtask__del { opacity: 1; }
.wundo { display: flex; align-items: center; gap: 8px; margin: 6px 12px 0; padding: 7px 8px 7px 12px; border-radius: 10px; background: var(--toast-bg); color: var(--toast-text); font-size: 13px; animation: toast-in .18s ease-out; }
.wundo__icon { width: 15px; height: 15px; opacity: .8; }
.wundo__msg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wundo__btn { border: 0; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; padding: 3px 6px; border-radius: 6px; }
.wundo__btn:hover { background: rgba(127, 127, 127, .2); }
.wadd {
  display: flex; flex-direction: column; gap: 4px;
  margin: 6px 12px 12px; padding: 6px 4px 3px 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.wadd__when { align-self: flex-start; padding: 2px; }
.wadd__when .segmented__opt { height: 24px; padding: 0 10px; font-size: 12px; }
.wadd__row { display: flex; align-items: center; gap: 2px; padding-left: 6px; }
.wadd:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.wadd__plus { color: var(--accent); }
.wadd__input { flex: 1; min-width: 0; height: 36px; padding: 0 6px; border: 0; background: transparent; font-size: 14px; outline: none !important; }
.wadd__input::placeholder { color: var(--text-3); }
.wadd .flag { opacity: 1; }

/* ---------- Accounts: login screens, user chip ---------- */

body.is-locked .app, body.is-locked .bnav, body.is-locked .fab { display: none !important; }
.auth[hidden] { display: none; }
.auth {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(900px 420px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.auth__wrap { width: min(400px, 100%); display: grid; gap: 18px; }
.auth__brand { display: flex; align-items: center; justify-content: center; gap: 10px; }
.auth__brand .brand__mark { width: 40px; height: 40px; border-radius: 12px; }
.auth__brand .brand__mark .icon { width: 24px; height: 24px; }
.auth__brand .brand__name { font-size: 22px; }
.auth__card {
  display: grid; gap: 4px;
  padding: 26px 24px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.auth__title { font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.auth__text { color: var(--text-2); font-size: 14px; margin-bottom: 14px; }
.auth__card .field { margin-bottom: 12px; }
.auth__pw { position: relative; }
.auth__pw .input { padding-right: 44px; }
.auth__eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.auth__check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); margin: 2px 0 14px; cursor: pointer; }
.auth__check input { width: 16px; height: 16px; accent-color: var(--accent); }
.auth__error { color: var(--danger); background: var(--danger-soft); border-radius: 9px; padding: 9px 12px; font-size: 13.5px; margin-bottom: 12px; }
.auth__error[hidden] { display: none; }
.auth__hint { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border-radius: 9px; padding: 9px 11px; margin: 2px 0 14px; }
.auth__hint .icon { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--accent); }
.auth__dialog { margin-top: 12px; }
.auth__top { position: fixed; top: 14px; right: 16px; z-index: 2; }
.auth__theme .icon { width: 16px; height: 16px; }
.auth__card--wide { width: 100%; }
.auth__wrap:has(.auth__card--wide) { width: min(520px, 100%); }
.auth__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 2px 0 12px; }
.auth__row .auth__check { margin: 0; }
.auth__link { border: 0; background: none; padding: 2px 0; color: var(--accent); font-size: 13.5px; font-weight: 600; text-decoration: none; cursor: pointer; }
.auth__link:hover { text-decoration: underline; }
.auth__alt { margin-top: 14px; text-align: center; font-size: 13.5px; color: var(--text-2); }
.auth__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.auth__questions { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 4px; margin: 4px 0 14px; min-width: 0; }
.auth__legend { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--text); }
.auth__legend .icon { width: 16px; height: 16px; color: var(--accent); }
.auth__hint--plain { background: none; padding: 0; margin: 2px 0 12px; }
.sq { display: grid; gap: 0; padding-bottom: 6px; }
.sq + .sq { border-top: 1px dashed var(--border); padding-top: 12px; }
.sq .select { width: 100%; }
.sq input[hidden] { display: none; }
.sq input:not([hidden]) + .input, .sq .select + .input:not([hidden]) { margin-top: 6px; }
.field__hint { font-size: 12px; color: var(--text-3); margin-top: 2px; }
@media (max-width: 520px) { .auth__pair { grid-template-columns: 1fr; } .auth { padding-top: 64px; } }
.auth__card--loading { place-items: center; padding: 34px; }
.auth__spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn--lg { height: 44px; font-size: 15px; border-radius: 11px; }
.btn--block.btn--lg { margin-top: 2px; }

.userchip { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 6px 8px 10px; border-top: 1px solid var(--border); }
.userchip__avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-contrast); font-size: 13px; font-weight: 700; }
.userchip__avatar--lg { width: 40px; height: 40px; font-size: 17px; }
.userchip__text { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.userchip__name { min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userchip__user { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.sidebar-collapsed .userchip { flex-direction: column; padding: 8px 0; }
body.sidebar-collapsed .userchip__text { display: none; }
.account { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }

.widget--empty { align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; }

/* Mobile-only controls (hidden on desktop) */
.bnav, .fab { display: none; }

/* ---------- 8. Responsive ---------- */

@media (min-width: 1280px) {
  body.has-panel .main-col { margin-right: 420px; }
  body.has-panel .panel { box-shadow: none; animation: none; }
}

@media (max-width: 1100px) {
  .calendar { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .history { grid-template-columns: 1fr; }
  .minical { position: static; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .app { grid-template-columns: 68px minmax(0, 1fr); }
  .sidebar .brand__name, .sidebar .nav__label, .sidebar .nav__count, .sidebar .nav__heading, .sidebar .sidebar__collapse { display: none; }
  .sidebar .userchip { flex-direction: column; padding: 8px 0; }
  .sidebar .userchip__text { display: none; }
  .sidebar__top { flex-direction: column; }
  .sidebar .nav__link { justify-content: center; padding: 0; }
  .sidebar .nav__section { justify-content: center; margin: 16px 0 6px; }
}

@media (max-width: 767px) {
  body { font-size: 15px; }
  .app, body.sidebar-collapsed .app { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: min(300px, 86vw); height: auto;
    transform: translateX(-104%);
    transition: transform .2s ease;
    z-index: 60;
    box-shadow: var(--shadow-lg);
    visibility: hidden;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  body.sidebar-collapsed .sidebar .brand__name,
  body.sidebar-collapsed .sidebar .nav__label,
  body.sidebar-collapsed .sidebar .nav__count,
  body.sidebar-collapsed .sidebar .nav__heading { display: revert; }
  body.sidebar-collapsed .sidebar__top { flex-direction: row; }
  body.sidebar-collapsed .nav__link { justify-content: flex-start; padding: 0 10px; }
  body.sidebar-collapsed .nav__section { justify-content: space-between; margin: 20px 4px 6px 10px; }
  .sidebar .sidebar__collapse { display: none; }
  .sidebar .sidebar__close { display: inline-grid; }
  .nav__link { min-height: 42px; }

  .topbar { height: 56px; padding: 0 12px 0 16px; gap: 10px; }
  .brand--compact { display: inline-flex; }
  .brand--compact .brand__mark { width: 30px; height: 30px; }
  .search { max-width: none; }
  .search__kbd { display: none; }
  .topbar__new { display: none; }
  .topbar__widget { display: none; }

  .main { padding: 0 16px calc(104px + env(safe-area-inset-bottom)); }
  .view-header { margin: 14px 0 14px; flex-wrap: wrap; align-items: flex-start; }
  .view-title { font-size: 23px; }

  .bnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(62px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
  }
  .bnav__item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: transparent; color: var(--text-3);
    font-size: 11px; text-decoration: none; min-width: 0;
  }
  .bnav__item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .bnav__item .icon { width: 21px; height: 21px; }
  .bnav__item.is-active { color: var(--accent); font-weight: 600; }

  .fab {
    position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 45;
    display: grid; place-items: center;
    width: 54px; height: 54px; border: 0; border-radius: 18px;
    background: var(--accent); color: var(--accent-contrast);
    box-shadow: var(--shadow-lg);
  }
  .fab .icon { width: 24px; height: 24px; stroke-width: 2.2; }
  body.has-panel .fab, body.nav-open .fab { display: none; }

  .panel { width: 100%; border-left: 0; z-index: 70; animation: panel-up .2s ease-out; }
  @keyframes panel-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  .panel__inner { padding: 8px 16px calc(32px + env(safe-area-inset-bottom)); }

  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }

  .flag { opacity: 1; }
  .task__flags { flex-direction: column; margin: -4px -2px -4px 0; }
  .task__flags .flag--delete { display: none; }
  .task__flags .flag:not(.is-on) { color: color-mix(in srgb, var(--text-3) 60%, transparent); }
  .task { padding: 10px 6px 10px 10px; }

  .quickadd__options, .quickadd__desc { padding-left: 12px; }
  .quickadd__q { margin-left: 0; }

  .matrix { grid-template-columns: minmax(0, 1fr); }
  .matrix__axis { display: none; }
  .quad { min-height: 0; }
  .hint--desktop { display: none; }

  .summary { flex-direction: column; align-items: flex-start; }

  .cal { padding: 10px 8px; }
  .cal__grid { gap: 2px; }
  .cal__day { min-height: 50px; align-items: center; padding: 4px 2px; }
  .cal__num { align-self: center; }
  .cal__items { display: none; }
  .cal__dots { display: flex; }
  .cal__legend { margin-left: 0; width: 100%; }
  .monthnav__title { min-width: 0; flex: 1; }
  .cal__top .monthnav { flex: 1; }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline__item { grid-template-columns: 20px 52px minmax(0, 1fr); }
  .themecards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .field-row { grid-template-columns: 1fr; }
  .filters__label { width: 100%; }
  .toolbar__sort-label { display: none; }
  .card { padding: 16px; }
  .listcard__hint { display: none; }
}

@media (hover: none) {
  .flag { opacity: 1; }
  .wtask__del { opacity: 1; }
  .hint--desktop { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .task { border-left-width: 3px; }
  .check.is-checked { background: Highlight; }
}

/* ======================= Habits ======================= */
.view--habits { max-width: 980px; }
.hweek { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin: 4px 0 14px; }
.hweek__nav { display: flex; align-items: center; gap: 6px; }
.hweek__label { display: flex; flex-direction: column; min-width: 150px; text-align: center; line-height: 1.25; }
.hweek__total { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); min-width: 240px; }
.hweek__pct { font-variant-numeric: tabular-nums; color: var(--text); }

.hbar { position: relative; display: inline-block; width: 56px; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; flex: none; }
.hbar--lg { width: 120px; height: 8px; }
.htabs { margin: 0 0 14px; }
.htabs .icon { width: 15px; height: 15px; }
.hbar__fill { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--accent); transition: width .25s ease; }

.htable { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.htable__row { display: grid; grid-template-columns: minmax(200px, 1fr) repeat(7, 44px) 132px; align-items: center; gap: 0 4px; min-height: 58px; padding: 6px 12px; border-top: 1px solid var(--border); transition: background-color .15s ease; }
/* Hover: a slightly different tone (lighter on dark, darker on light/pink), never a size change. */
.htable__row:not(.htable__head):hover { background: color-mix(in srgb, var(--text) 5%, var(--surface)); }
.htable__row:first-child { border-top: 0; }
.htable__head { background: var(--surface-2); font-size: 12px; color: var(--text-3); min-height: 0; padding-top: 6px; padding-bottom: 6px; }
.htable__day { display: flex; flex-direction: column; align-items: center; line-height: 1.2; text-transform: capitalize; }
.htable__day.is-today { color: var(--accent); font-weight: 700; }
.htable__num { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.htable__day.is-today .htable__num { color: var(--accent); }
.htable__cell { display: flex; justify-content: center; }
.htable__name { display: flex; align-items: center; gap: 4px; min-width: 0; }
.htable__week { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 13px; }
.htable__row.is-paused .hname__title, .htable__row.is-paused .hcheck { opacity: .55; }

.hname { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; flex: 1; padding: 4px 6px; margin-left: -6px; border: 0; border-radius: 8px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.hname:hover { background: var(--surface-2); }
.hname { max-width: 100%; }
.hname__title { font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hname__meta { font-size: 12px; color: var(--text-3); text-transform: none; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Always laid out (so the row never grows); only visible on hover or keyboard focus. */
.hname__move { display: inline-flex; flex-direction: column; flex: none; visibility: hidden; }
.htable__row:hover .hname__move, .hname__move:focus-within { visibility: visible; }
.hname__move .icon-btn { width: 22px; height: 18px; }
.hname__move .icon { transform: rotate(90deg); width: 14px; height: 14px; }

.hcheck { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--border-strong); background: var(--surface); color: transparent; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; }
.hcheck .icon { width: 16px; height: 16px; }
.hcheck:hover:not(:disabled) { border-color: var(--accent); }
.hcheck:active:not(:disabled) { transform: scale(.92); }
.hcheck.is-off { border-style: dashed; border-color: var(--surface-3); }
.hcheck.is-today { box-shadow: 0 0 0 3px var(--accent-ring); }
.hcheck.is-done { background: var(--accent); border-color: var(--accent); border-style: solid; color: var(--accent-contrast); }
.hcheck:disabled { opacity: .35; cursor: default; }

.hprog__count { font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 28px; text-align: right; }
.hprog.is-met .hprog__count { color: var(--success); font-weight: 700; }
.hprog.is-met .hbar__fill { background: var(--success); }
.hprog__streak { display: inline-flex; align-items: center; gap: 2px; color: #e8770f; font-weight: 700; font-variant-numeric: tabular-nums; }
.hprog__streak .icon { width: 15px; height: 15px; }
.hhint { margin-top: 10px; }
.hsuggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 6px; }

/* Today: "Today's habits" */
.hlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.hitem { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; background: var(--surface); }
.hitem__check.check { border-radius: 6px; }
.hitem__check.is-checked { background: var(--accent); border-color: var(--accent); }
.hitem__body { display: flex; flex-direction: column; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.hitem__title { font-weight: 500; overflow-wrap: anywhere; }
.hitem.is-done .hitem__title { color: var(--text-3); text-decoration: line-through; }
.hitem__meta { font-size: 12px; color: var(--text-3); }

/* Editor */
.dialog--habit { width: min(460px, calc(100vw - 32px)); }
.hbform__row { display: grid; grid-template-columns: 76px 1fr; gap: 10px; }
.hb-emoji { display: grid; place-items: center; width: 100%; font-size: 22px; line-height: 1; cursor: pointer; padding: 0; }
.hb-emoji.is-empty { opacity: .55; }
.hb-emoji:hover { border-color: var(--accent); }
.hpicker { margin: -4px 0 12px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.hpicker[hidden] { display: none; }
.hpicker__grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.hpicker__icon { display: grid; place-items: center; aspect-ratio: 1; border: 0; border-radius: 8px; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; }
.hpicker__icon:hover, .hpicker__icon:focus-visible { background: var(--surface-3); }
.hpicker__foot { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.hb-emoji-custom { flex: 1; min-width: 0; }
.hdays { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hday { width: 40px; height: 36px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-weight: 600; text-transform: capitalize; cursor: pointer; }
.hday.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.hbform__active { margin: 4px 0 2px; }
.field__error { color: var(--danger); font-size: 13px; min-height: 1em; margin: 4px 0 0; }

@media (max-width: 720px) {
  .htable__row { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px 2px; padding: 10px; }
  .htable__name { grid-column: 1 / -1; }
  .htable__week { grid-column: 1 / -1; justify-content: flex-start; }
  .htable__head .htable__name, .htable__head .htable__week { display: none; }
  .hcheck { width: 32px; height: 32px; }
  .hname__move { visibility: visible; }
  .htable__row { min-height: 0; }
  .hweek { justify-content: center; }
  .hweek__total { min-width: 0; justify-content: center; }
}
.whabit { border-left-color: var(--accent) !important; }
.whabit .wtask__body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.whabit.is-done .wtask__title { color: var(--text-3); text-decoration: line-through; }

/* ======================= Habit statistics ======================= */
/* Chart palette (fixed categorical order + one-hue sequential ramp) for light and pink... */
:root {
  --viz-1: #2a78d6; --viz-2: #eb6834; --viz-3: #1baf7a; --viz-4: #eda100;
  --viz-5: #e87ba4; --viz-6: #008300; --viz-7: #6250d6; --viz-8: #e34948;
  --hm-1: var(--surface-3); --hm-2: #b7d3f6; --hm-3: #6da7ec; --hm-4: #2a78d6; --hm-5: #184f95;
}
/* ...and the steps chosen for the dark surface. */
:root[data-theme="dark"] {
  --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500;
  --viz-5: #d55181; --viz-6: #0ca30c; --viz-7: #9085e9; --viz-8: #e66767;
  --hm-1: #2c2d33; --hm-2: #104281; --hm-3: #1c5cab; --hm-4: #3987e5; --hm-5: #86b6ef;
}
.hstats { display: grid; gap: 14px; }
.hstats__picker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hstats__picker .select { width: auto; text-transform: capitalize; }
.hstats__cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.hstat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); min-width: 0; }
.hstat__value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; text-transform: capitalize; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hstat__label { font-size: 12.5px; color: var(--text-2); }
.hstat__sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hstats__card { margin: 0; }
.hstats__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; }
.hstats__head .card__title { margin: 0; }
.hstats__headtools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.segmented--sm .segmented__opt { padding: 4px 10px; font-size: 12.5px; }
.hstats__weeknav { display: flex; align-items: center; gap: 4px; color: var(--text-2); }
.hstats__maps { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2.4fr); gap: 14px; align-items: start; }

.vlegend { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-bottom: 8px; }
.vlegend__item { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 12.5px; cursor: pointer; }
.vlegend__item.is-off { opacity: .45; text-decoration: line-through; }
.vlegend__item { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vkey { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.vkey--line { width: 16px; height: 3px; border-radius: 2px; background: var(--c); }
.vchart__plot { position: relative; }
.hline { display: block; width: 100%; height: auto; overflow: visible; }
.hline__grid { stroke: var(--border); stroke-width: 1; }
.hline__grid.is-base { stroke: var(--border-strong); }
.hline__tick { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.hline__path { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.hline__dot { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.hline__series:not(.is-strong) .hline__path { stroke-width: 1.6; opacity: .8; }
.hline__series.is-strong .hline__path { stroke-width: 2.5; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hbars__row { display: grid; grid-template-columns: minmax(120px, 220px) minmax(0, 1fr) 96px; align-items: center; gap: 12px; }
.hbars__name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbars__track { position: relative; height: 12px; border-radius: 999px; background: var(--surface-2); }
.hbars__fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--viz-1); transition: width .3s ease; }
.hbars__fill.is-full { background: var(--success); }
.hbars__prev { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--text); opacity: .55; }
.hbars__prev--key { position: static; display: inline-block; height: 12px; margin: 0 6px 0 0; vertical-align: middle; }
.hbars__val { display: flex; flex-direction: column; align-items: flex-end; font-weight: 700; font-variant-numeric: tabular-nums; }
.hbars__val small { font-weight: 400; font-size: 11.5px; color: var(--text-3); }
.vscale--left { justify-content: flex-start; }
@media (max-width: 640px) {
  .hbars__row { grid-template-columns: minmax(0, 1fr) 72px; }
  .hbars__track { grid-column: 1 / -1; grid-row: 2; }
}
.hline__cross { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.hline__hit { fill: transparent; cursor: crosshair; outline: none; }
.vtip { position: absolute; top: 4px; transform: translateX(-50%); min-width: 170px; max-width: 260px; padding: 8px 10px; border-radius: 10px; background: var(--toast-bg); color: var(--toast-text); font-size: 12px; box-shadow: var(--shadow-lg); pointer-events: none; z-index: 2; display: grid; gap: 4px; }
.vtip[hidden] { display: none; }
.vtip { width: 250px; grid-template-columns: minmax(0, 1fr); }
.vtip__row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.vtip__val { flex: none; }
.vtip__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vtip__val { font-variant-numeric: tabular-nums; font-weight: 700; }
.vtable { margin-top: 8px; font-size: 12.5px; color: var(--text-2); }
.vtable summary { cursor: pointer; }
.vtable table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.vtable th, .vtable td { padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: left; font-variant-numeric: tabular-nums; }

.hm { display: block; border-radius: 3px; background: var(--hm-1); }
.hm--0 { background: var(--surface-2); }
.hm--1 { background: var(--hm-1); }
.hm--2 { background: var(--hm-2); }
.hm--3 { background: var(--hm-3); }
.hm--4 { background: var(--hm-4); }
.hm--5 { background: var(--hm-5); }
.hm--future, .hm.is-out { background: transparent; }
.hm--future { outline: 1px dashed var(--border); outline-offset: -1px; }
.hm.is-today { box-shadow: 0 0 0 2px var(--text); }
.vscale { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 10px; font-size: 11.5px; color: var(--text-3); }
.vscale .hm { width: 12px; height: 12px; }

.hmonth__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.hmonth__head { font-size: 11px; color: var(--text-3); text-align: center; text-transform: capitalize; }
.hmonth__cell { display: grid; place-items: center; aspect-ratio: 1; border-radius: 6px; font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hmonth__cell.hm--4, .hmonth__cell.hm--5 { color: #fff; }
:root[data-theme="dark"] .hmonth__cell.hm--5 { color: #0d1b2e; }
.hmonth__cell.is-out { background: transparent; }

.hyear__scroll { overflow-x: auto; padding-bottom: 4px; }
.hyear__grid { display: grid; grid-auto-flow: column; grid-template-rows: 14px repeat(7, auto); gap: 3px; min-width: 560px; }
.hyear__grid .hm { width: 100%; aspect-ratio: 1; border-radius: 2px; }
.hyear__corner { display: block; }
.hyear__day { font-size: 10px; line-height: 1; color: var(--text-3); text-transform: capitalize; align-self: center; }
.hyear__month { font-size: 10.5px; line-height: 14px; color: var(--text-3); white-space: nowrap; overflow: visible; text-transform: capitalize; }

@media (max-width: 900px) {
  .hstats__maps { grid-template-columns: minmax(0, 1fr); }
  .hstats__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ======================= Landing page (visitors without a session) ======================= */
.auth.auth--landing { display: block; padding: 0; place-items: initial; min-height: 100vh; }
.auth__top { display: flex; gap: 8px; }
.auth__back .icon { width: 16px; height: 16px; }
.lnd { color: var(--text); }
.lnd-wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.lnd-nav { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.lnd-nav__inner { display: flex; align-items: center; gap: 20px; height: 62px; }
.lnd-nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.lnd-nav .brand__mark { width: 32px; height: 32px; border-radius: 9px; }
.lnd-nav__links { display: flex; gap: 22px; margin-left: auto; font-size: 14px; }
.lnd-nav__links a { color: var(--text-2); text-decoration: none; }
.lnd-nav__links a:hover { color: var(--text); }
.lnd-nav__tools { display: flex; align-items: center; gap: 8px; }

.lnd-hero { position: relative; overflow: hidden; padding: clamp(56px, 10vh, 110px) 0 clamp(48px, 8vh, 90px);
  background: radial-gradient(800px 380px at 15% 0%, var(--accent-soft), transparent 70%), radial-gradient(600px 320px at 90% 20%, color-mix(in srgb, var(--q2) 14%, transparent), transparent 70%); }
.lnd-hero__grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.lnd-eyebrow { display: inline-flex; align-items: center; gap: 9px; padding: 5px 13px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 13px; }
.lnd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 22%, transparent); }
.lnd-title { font-size: clamp(2.3rem, 5.4vw, 4rem); line-height: 1.05; letter-spacing: -.035em; font-weight: 780; margin: 18px 0 0; }
.lnd-lead { margin-top: 18px; max-width: 560px; color: var(--text-2); font-size: 1.08rem; line-height: 1.6; }
.lnd-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.lnd-cta--center { justify-content: center; }
.lnd-cta .btn--lg { padding: 0 20px; }
.lnd-note { display: flex; align-items: center; gap: 7px; margin-top: 16px; font-size: 13px; color: var(--text-3); }
.lnd-note .icon { width: 14px; height: 14px; }

/* App preview */
.lnd-preview { perspective: 1200px; }
.lnd-window { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; transform: rotateY(-6deg) rotateX(3deg); }
.lnd-window__bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.lnd-window__bar > span { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); }
.lnd-window__bar em { margin-left: 10px; font-style: normal; font-size: 11.5px; color: var(--text-3); }
.lnd-matrix { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; }
.lnd-q { padding: 10px; border-radius: 12px; min-height: 92px; }
.lnd-q--q1 { background: var(--q1-bg); }
.lnd-q--q2 { background: var(--q2-bg); }
.lnd-q--q3 { background: var(--q3-bg); }
.lnd-q--q4 { background: var(--q4-bg); }
.lnd-q__name { font-size: 11.5px; color: var(--text-2); }
.lnd-q--q1 b { color: var(--q1); }
.lnd-q--q2 b { color: var(--q2); }
.lnd-q--q3 b { color: var(--q3); }
.lnd-q--q4 b { color: var(--q4); }
.lnd-q ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; }
.lnd-task { display: flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 6px 8px; border-radius: 8px; background: var(--surface); }
.lnd-task.is-done span:last-child { color: var(--text-3); text-decoration: line-through; }
.lnd-task__check { display: grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--text-3); flex: none; }
.lnd-task.is-done .lnd-task__check { background: var(--success); border-color: var(--success); color: #fff; }
.lnd-task__check .icon { width: 9px; height: 9px; stroke-width: 3; }
.lnd-habits { margin: 0 12px 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; display: grid; gap: 7px; }
.lnd-habits__title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.lnd-habit { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.lnd-habit__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lnd-habit__days { display: flex; gap: 4px; flex: none; }
.lnd-sq { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--border-strong); }
.lnd-sq.is-on { background: var(--accent); border-color: var(--accent); }

.lnd-section { padding: clamp(56px, 9vh, 96px) 0; border-top: 1px solid var(--border); scroll-margin-top: 62px; }
.lnd-kicker { font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.lnd-h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); letter-spacing: -.02em; line-height: 1.15; margin: 0; max-width: 720px; }
.lnd-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 30px; }
.lnd-feature, .lnd-platform { padding: 22px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); transition: transform .2s ease, box-shadow .2s ease; }
.lnd-feature:hover, .lnd-platform:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.lnd-feature__icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
.lnd-feature__icon .icon { width: 21px; height: 21px; }
.lnd-feature h3, .lnd-platform h3 { font-size: 1.05rem; margin: 0 0 6px; }
.lnd-feature p, .lnd-platform p { margin: 0; color: var(--text-2); font-size: .94rem; line-height: 1.55; }
.lnd-platforms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 30px; }
.lnd-platform { display: flex; flex-direction: column; }
.lnd-platform p { flex: 1; margin-bottom: 16px; }
.lnd-platform .btn { align-self: flex-start; }
.lnd-privacy__inner { display: flex; gap: 20px; align-items: flex-start; padding: 28px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); }
.lnd-privacy__inner p { margin: 12px 0 0; color: var(--text-2); line-height: 1.65; max-width: 760px; }
.lnd-privacy__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--success-soft); color: var(--success); flex: none; }
.lnd-privacy__icon .icon { width: 26px; height: 26px; }
.lnd-final { text-align: center; }
.lnd-final .lnd-h2 { margin-inline: auto; }
.lnd-footer { border-top: 1px solid var(--border); padding: 24px 0; font-size: 13px; color: var(--text-3); }
.lnd-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; }
.lnd-footer a { color: var(--text-2); }
.lnd-steps { margin: 4px 0 8px; padding-left: 20px; display: grid; gap: 8px; color: var(--text-2); line-height: 1.5; }

.lnd .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1); }
.lnd .reveal.is-in { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .lnd-hero__grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .lnd-window { transform: none; }
  .lnd-features, .lnd-platforms { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .lnd-nav__links { display: none; }
  .lnd-nav__tools { margin-left: auto; }
  .lnd-nav__tools .auth__theme span { display: none; }
  .lnd-features, .lnd-platforms { grid-template-columns: minmax(0, 1fr); }
  .lnd-cta .btn--lg { flex: 1 1 100%; justify-content: center; }
  .lnd-privacy__inner { flex-direction: column; padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .lnd .reveal { opacity: 1; transform: none; transition: none; }
  .lnd-feature, .lnd-platform { transition: none; }
}
