/* =========================================================================
   Planner — design system
   Aesthetic: editorial-calm productivity. Warm off-white paper / deep ink,
   serif display + geometric sans, subtle grain, generous radius, restrained
   motion. Not a corporate dashboard.
   ========================================================================= */

/* ---- Tokens ------------------------------------------------------------ */
:root {
  /* Surfaces */
  --paper:        #F7F4EE;
  --paper-2:      #FBF8F2;
  --paper-3:      #FFFDF7;
  --ink:          #15151B;
  --ink-2:        #2A2A33;
  --ink-3:        #4A4A55;
  --mute:         #8A8A95;
  --line:         rgba(21, 21, 27, 0.08);
  --line-strong:  rgba(21, 21, 27, 0.16);
  --shadow-sm:    0 1px 2px rgba(21,21,27,.04), 0 1px 1px rgba(21,21,27,.03);
  --shadow:       0 4px 14px -6px rgba(21,21,27,.10), 0 2px 6px -3px rgba(21,21,27,.06);
  --shadow-lg:    0 24px 60px -24px rgba(21,21,27,.22), 0 8px 20px -10px rgba(21,21,27,.10);

  /* Brand / roles */
  --ali:        #4F46E5;
  --ali-soft:   #EEF0FF;
  --fatima:     #EC4899;
  --fatima-soft:#FDEFF6;
  --personal:   #10B981;
  --personal-soft:#E6F8F0;
  --work:       #F59E0B;
  --work-soft:  #FCF1DC;
  --overdue:    #E5484D;
  --overdue-soft:#FCEDEE;
  --done:       #8A8A95;

  --accent:     var(--ali);          /* set per-user via [data-user] */
  --accent-soft:var(--ali-soft);

  /* Radii */
  --r-sm: 10px;
  --r:    16px;
  --r-lg: 22px;
  --r-pill: 999px;

  /* Type */
  --font-display: "Fraunces", "Iowan Old Style", "Apple Garamond", Georgia, serif;
  --font-body:    "Geist", "Söhne", "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "Geist Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="dark"] {
  --paper:        #0E0E12;
  --paper-2:      #14141A;
  --paper-3:      #1A1A22;
  --ink:          #F2F0EA;
  --ink-2:        #D6D4CE;
  --ink-3:        #A6A4A0;
  --mute:         #7A7A85;
  --line:         rgba(242, 240, 234, 0.08);
  --line-strong:  rgba(242, 240, 234, 0.16);
  --shadow-sm:    0 1px 2px rgba(0,0,0,.4);
  --shadow:       0 6px 20px -8px rgba(0,0,0,.6);
  --shadow-lg:    0 30px 80px -30px rgba(0,0,0,.8);
  --ali-soft:     rgba(79,70,229,.16);
  --fatima-soft:  rgba(236,72,153,.16);
  --personal-soft:rgba(16,185,129,.14);
  --work-soft:    rgba(245,158,11,.14);
  --overdue-soft: rgba(229,72,77,.18);
}

[data-user="fatima"] { --accent: var(--fatima); --accent-soft: var(--fatima-soft); }
[data-user="ali"]    { --accent: var(--ali);    --accent-soft: var(--ali-soft); }

/* ---- Reset ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  /* warm paper background with a hint of gradient + grain */
  background-image:
    radial-gradient(900px 600px at 100% -10%, color-mix(in oklab, var(--accent) 8%, transparent), transparent 60%),
    radial-gradient(700px 500px at -5% 100%, color-mix(in oklab, var(--accent) 5%, transparent), transparent 55%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.045 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1,h2,h3,h4 { margin: 0; font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; line-height: 1.08; }
h1 { font-size: clamp(28px, 4.4vw, 44px); font-variation-settings: "SOFT" 30, "WONK" 0, "opsz" 144; }
h2 { font-size: clamp(20px, 2.6vw, 28px); font-variation-settings: "opsz" 80; }
h3 { font-size: 18px; font-variation-settings: "opsz" 36; }
.display-num { font-family: var(--font-display); font-weight: 400; font-variation-settings: "opsz" 144, "SOFT" 50; letter-spacing: -0.04em; }

/* Scrollbar polish */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--mute); }

/* ---- Layout ----------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: color-mix(in oklab, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 20;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 18px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 14px;
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 10px;
  background:
    conic-gradient(from 200deg, var(--accent) 0deg, color-mix(in oklab, var(--accent) 60%, #fff) 120deg, var(--ink) 320deg);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 8px;
  border-radius: 6px; background: var(--paper);
}
.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-variation-settings: "opsz" 60, "SOFT" 40;
  font-style: italic;
  letter-spacing: -0.02em;
}
.brand-name em { font-style: normal; color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 14.5px;
  color: var(--ink-2);
  position: relative;
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}
.nav a:hover { background: color-mix(in oklab, var(--accent-soft) 60%, transparent); color: var(--ink); }
.nav a.is-active {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 500;
}
.nav a.is-active::before {
  content: ""; position: absolute; left: -18px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav a .badge {
  margin-left: auto;
  font-size: 11px; font-variant-numeric: tabular-nums;
  background: var(--overdue);
  color: #fff;
  border-radius: var(--r-pill);
  padding: 2px 7px;
  position: relative;
}
.nav a .badge.is-pulse::after {
  content: ""; position: absolute; inset: -2px; border-radius: inherit;
  border: 2px solid var(--overdue);
  opacity: .5;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(.85); opacity: .6; } 70% { transform: scale(1.4); opacity: 0; } 100% { opacity: 0; } }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.side-foot {
  border-top: 1px dashed var(--line);
  padding-top: 14px;
  display: flex; align-items: center; gap: 10px;
}
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  display: grid; place-items: center;
  transition: background .15s ease;
}
.theme-toggle:hover { background: color-mix(in oklab, var(--ink) 6%, transparent); }

/* Main column */
.main {
  display: flex; flex-direction: column;
  min-width: 0;
}
.topbar {
  position: sticky; top: 0; z-index: 15;
  background: color-mix(in oklab, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex; align-items: center; gap: 16px;
}
.crumbs { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.crumbs .date { color: var(--mute); font-size: 13px; letter-spacing: .02em; }
.crumbs .page-title {
  font-family: var(--font-display); font-style: italic; font-size: 18px;
  font-variation-settings: "SOFT" 50, "opsz" 36;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--accent);
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500;
  border: 1px solid var(--line-strong);
  background: var(--paper-3);
  color: var(--ink);
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--paper-2); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-2); }
.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-accent:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: color-mix(in oklab, var(--ink) 6%, transparent); }
.btn-icon { padding: 9px; width: 36px; height: 36px; justify-content: center; }
.btn-sm { padding: 6px 10px; font-size: 13px; }

/* Content frame */
.content {
  padding: 28px clamp(20px, 4vw, 48px);
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.section { margin-bottom: 36px; }
.section-head {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 18px;
}
.section-head h2 + .muted { color: var(--mute); font-size: 13px; }
.eyebrow {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 500;
}

/* ---- Cards ------------------------------------------------------------ */
.card {
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.card.padded-lg { padding: 28px; }
.card.elevate:hover { box-shadow: var(--shadow); transform: translateY(-1px); transition: all .2s ease; }
.card .card-eyebrow {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 10px;
}
.card .card-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ---- Grid helpers ---------------------------------------------------- */
.grid { display: grid; gap: 18px; }
.grid-stats { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-dash { grid-template-columns: 1.4fr 1fr; }

/* ---- Stat cards ------------------------------------------------------- */
.stat {
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.stat .label { font-size: 12px; letter-spacing: .15em; text-transform: uppercase; color: var(--mute); }
.stat .value { font-size: 56px; line-height: 1; margin-top: 14px; }
.stat .sub { margin-top: 12px; font-size: 13px; color: var(--ink-3); }
.stat--accent { background: var(--accent-soft); border-color: transparent; }
.stat--overdue { background: var(--overdue-soft); border-color: transparent; }
.stat--overdue .value { color: var(--overdue); }
.stat--overdue .label { color: color-mix(in oklab, var(--overdue) 75%, var(--mute)); }
.stat .scribble {
  position: absolute; right: -12px; bottom: -16px; width: 86px; height: 86px;
  opacity: .12; pointer-events: none;
}

/* ---- Task list ------------------------------------------------------- */
.tasks { display: flex; flex-direction: column; gap: 8px; }
.task {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--paper-3);
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
  position: relative;
}
.task:hover { box-shadow: var(--shadow-sm); }
.task .check {
  width: 22px; height: 22px;
  border-radius: 7px;
  border: 1.5px solid var(--line-strong);
  display: grid; place-items: center;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.task .check:hover { border-color: var(--accent); }
.task[data-status="done"] .check {
  background: var(--accent);
  border-color: var(--accent);
}
.task[data-status="done"] .check svg { stroke: #fff; stroke-dasharray: 20; stroke-dashoffset: 0; }
.task .title { font-weight: 500; color: var(--ink); }
.task .meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--mute); margin-top: 2px; }
.task .meta .chip { padding: 2px 7px; border-radius: var(--r-pill); background: var(--paper-2); }
.task[data-status="done"] .title { color: var(--done); }
.task[data-status="done"] .title::after {
  content: ""; display: block; height: 1.5px; background: var(--done); margin-top: -10px; transform: scaleX(1); transform-origin: left;
}
.task .pri {
  width: 6px; height: 6px; border-radius: 50%; background: var(--mute); display: inline-block;
}
.task[data-priority="high"] .pri { background: var(--overdue); }
.task[data-priority="medium"] .pri { background: var(--work); }
.task[data-priority="low"] .pri { background: var(--personal); }
.task[data-overdue="1"] {
  border-left: 3px solid var(--overdue);
  background: linear-gradient(90deg, var(--overdue-soft) 0%, var(--paper-3) 32%);
}
.task[data-overdue="1"] .meta { color: var(--overdue); }
.task[data-overdue="1"] .meta .warn { display: inline-flex; align-items: center; gap: 4px; }
.task-actions { display: flex; gap: 6px; align-items: center; opacity: 0; transition: opacity .15s; }
.task:hover .task-actions { opacity: 1; }
.task .icon-btn {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center; color: var(--ink-3);
}
.task .icon-btn:hover { background: color-mix(in oklab, var(--ink) 7%, transparent); color: var(--ink); }
.cat-tag {
  font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--r-pill);
}
.cat-tag.personal { background: var(--personal-soft); color: var(--personal); }
.cat-tag.work     { background: var(--work-soft);     color: var(--work); }

/* ---- Inline add ----------------------------------------------------- */
.inline-add {
  display: grid;
  grid-template-columns: 1fr 130px 160px auto;
  gap: 10px;
  padding: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  background: color-mix(in oklab, var(--paper-3) 70%, transparent);
}
.inline-add input, .inline-add select {
  border: 1px solid var(--line);
  background: var(--paper-3);
  border-radius: var(--r-sm);
  padding: 9px 12px;
}
.inline-add input:focus, .inline-add select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- Login ----------------------------------------------------------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.login-art {
  background:
    radial-gradient(700px 500px at 20% 30%, var(--ali-soft), transparent 60%),
    radial-gradient(700px 500px at 80% 80%, var(--fatima-soft), transparent 60%),
    var(--paper-2);
  border-right: 1px solid var(--line);
  padding: 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-art .stamp {
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: "SOFT" 80, "opsz" 144, "WONK" 1;
  font-size: clamp(48px, 9vw, 120px);
  line-height: .95;
  letter-spacing: -0.04em;
}
.login-art .stamp .accent { color: var(--ali); }
.login-art .stamp .accent2 { color: var(--fatima); }
.login-art .note {
  font-size: 13.5px; max-width: 380px; color: var(--ink-3);
}
.login-form {
  padding: 56px;
  display: flex; flex-direction: column; justify-content: center;
  max-width: 480px;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; letter-spacing: .15em; text-transform: uppercase; color: var(--mute); }
.field input {
  border: 1px solid var(--line-strong);
  background: var(--paper-3);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 15px;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.who-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.who-card {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: 12.5px;
}
.who-card:hover { background: var(--accent-soft); border-color: var(--accent); }
.who-card strong { display: block; font-family: var(--font-display); font-size: 18px; font-style: italic; }

/* ---- Charts wrapper -------------------------------------------------- */
.chart-card { padding: 22px; min-height: 260px; }
.chart-wrap { position: relative; height: 220px; }

/* ---- Kanban / week --------------------------------------------------- */
.kanban {
  display: grid;
  grid-template-columns: repeat(7, minmax(180px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.kanban .col {
  background: color-mix(in oklab, var(--paper-3) 80%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  min-height: 240px;
}
.kanban .col h4 {
  font-family: var(--font-body); font-weight: 500; font-size: 13px;
  text-transform: uppercase; letter-spacing: .12em; color: var(--mute);
  margin-bottom: 10px;
  display: flex; align-items: baseline; gap: 6px;
}
.kanban .col h4 .day-num { font-family: var(--font-display); font-size: 26px; color: var(--ink); letter-spacing: -0.03em; }
.kanban .col.is-today { border-color: var(--accent); background: var(--accent-soft); }
.kanban .col .task { padding: 8px 10px; font-size: 13.5px; }

/* ---- Three-day Day view --------------------------------------------- */
.three-day {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.day-col {
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.day-col.is-today {
  border-color: color-mix(in oklab, var(--accent) 50%, var(--line-strong));
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--paper-3) 60%);
}
.day-col-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.day-col-bucket {
  font-family: var(--font-display);
  font-size: 22px;
  font-style: italic;
  font-variation-settings: "SOFT" 40, "opsz" 80;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.day-col.is-today .day-col-bucket { color: var(--accent); }
.day-col-date {
  font-size: 12px; color: var(--mute);
  letter-spacing: .04em;
  margin-top: 2px;
}
.day-col-counts {
  display: flex; flex-wrap: wrap; gap: 4px;
  justify-content: flex-end;
  max-width: 60%;
}
.pchip {
  display: inline-flex; align-items: center;
  font-size: 10.5px; letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  color: var(--ink-3);
  font-weight: 500;
}
.pchip-high  { background: color-mix(in oklab, var(--overdue)  20%, var(--paper-2)); color: var(--overdue); }
.pchip-med   { background: color-mix(in oklab, var(--work)     22%, var(--paper-2)); color: var(--work); }
.pchip-low   { background: color-mix(in oklab, var(--personal) 22%, var(--paper-2)); color: var(--personal); }
.pchip-empty { background: var(--paper-2); color: var(--mute); }

@media (max-width: 1100px) {
  .three-day { grid-template-columns: 1fr 1fr; }
  .three-day .day-col:first-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .three-day { grid-template-columns: 1fr; }
  .day-col { padding: 14px; }
}

/* ---- Month calendar -------------------------------------------------- */
.month {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--line);
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
}
.month .day {
  background: var(--paper-3);
  min-height: 128px;
  padding: 6px 6px 6px 8px;
  position: relative;
  cursor: pointer;
  transition: background .15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.month .day:hover { background: var(--paper-2); }
.month .day .num {
  font-family: var(--font-display);
  font-size: 14px; color: var(--ink-2);
  align-self: flex-start;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
}
.month .day.is-today .num {
  color: #fff;
  background: var(--accent);
  font-weight: 600;
}
.month .day.is-outside { background: color-mix(in oklab, var(--paper-3) 60%, transparent); }
.month .day.is-outside .num { color: var(--mute); }
.month .day .mday-list {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.month .day .mday-task {
  display: flex; align-items: center;
  min-width: 0;
  gap: 4px;
  padding: 2px 4px 2px 0;
  border-radius: 4px;
  font-size: 10.5px;
  line-height: 1.25;
  color: var(--ink-2);
  background: color-mix(in oklab, var(--paper-2) 80%, transparent);
  cursor: pointer;
  transition: background .12s ease, transform .12s ease;
}
.month .day .mday-task:hover {
  background: color-mix(in oklab, var(--accent) 14%, var(--paper-2));
  transform: translateX(1px);
}
.month .day .mday-task .mday-bar {
  flex-shrink: 0;
  width: 3px;
  align-self: stretch;
  border-radius: 2px;
  background: var(--personal);
}
.month .day .mday-task[data-cat="work"] .mday-bar { background: var(--work); }
.month .day .mday-task[data-overdue="1"] .mday-bar { background: var(--overdue); }
.month .day .mday-task[data-overdue="1"] { color: var(--overdue); background: var(--overdue-soft); }
.month .day .mday-task[data-status="done"] { color: var(--mute); }
.month .day .mday-task[data-status="done"] .mday-text { text-decoration: line-through; text-decoration-thickness: 1px; }
.month .day .mday-task[data-status="done"] .mday-bar { background: var(--done); }
.month .day .mday-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.month .day .mday-more {
  font-size: 10px;
  color: var(--mute);
  padding: 0 4px;
  letter-spacing: .04em;
}
.month .head {
  background: var(--paper-2);
  font-size: 11px; text-transform: uppercase; letter-spacing: .15em;
  padding: 8px 10px; color: var(--mute);
}

@media (max-width: 768px) {
  .month .day { min-height: 88px; padding: 4px; }
  .month .day .num { font-size: 12px; }
  .month .day .mday-task { font-size: 9.5px; padding: 1px 3px 1px 0; }
}

/* ---- Shared goals --------------------------------------------------- */
.goal {
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  position: relative;
}
.goal.is-overdue { border-color: var(--overdue); background: color-mix(in oklab, var(--overdue-soft) 70%, var(--paper-3)); }
.goal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.goal-head h3 { font-size: 22px; }
.goal-desc { color: var(--ink-3); font-size: 14px; max-width: 60ch; margin-bottom: 14px; }
.goal-meta { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--mute); margin-bottom: 18px; }
.goal-meta .pill {
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--paper-2); font-size: 12px;
}
.goal.is-overdue .pill.deadline { background: var(--overdue); color: #fff; }
.progress {
  height: 8px;
  background: var(--paper-2);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin: 8px 0 18px;
}
.progress > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--ali), var(--fatima));
  border-radius: inherit;
  transition: width .5s ease;
}
.goal-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.goal-col {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  padding: 12px;
}
.goal-col h4 {
  font-family: var(--font-body); font-weight: 500; font-size: 13px;
  text-transform: uppercase; letter-spacing: .12em; color: var(--mute);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.goal-col h4 .dot { width: 8px; height: 8px; border-radius: 50%; }
.goal-col .task { padding: 8px 10px; font-size: 13.5px; }
.goal-col[data-locked="1"] .task .check { cursor: not-allowed; opacity: .5; }

/* ---- Plans (long-term) --------------------------------------------- */
.plan {
  position: relative;
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px 24px 18px;
  overflow: hidden;
  --plan-color: var(--accent);
}
.plan .plan-bar {
  position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: var(--plan-color);
}
.plan-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
  margin-bottom: 14px;
}
.plan-eyebrow {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--mute);
}
.plan-eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; }
.plan-eyebrow .sep { opacity: .5; }
.plan-meta { text-align: right; }
.plan-pct {
  font-size: 56px; line-height: 1; letter-spacing: -0.04em;
}
.pace {
  display: inline-block;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--r-pill);
  background: var(--paper-2); color: var(--ink-3);
  margin-top: 6px;
}
.pace.pace-ahead  { background: color-mix(in oklab, var(--personal) 22%, var(--paper-2)); color: var(--personal); }
.pace.pace-on     { background: color-mix(in oklab, var(--accent)   18%, var(--paper-2)); color: var(--accent); }
.pace.pace-behind { background: color-mix(in oklab, var(--work)     22%, var(--paper-2)); color: var(--work); }
.pace.pace-over   { background: var(--overdue); color: #fff; }
.pace.pace-done   { background: color-mix(in oklab, var(--personal) 30%, var(--paper-2)); color: var(--personal); }

.plan-progress { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 16px; }
.pl-row {
  display: grid;
  grid-template-columns: 70px 1fr 56px;
  align-items: center;
  gap: 12px;
}
.pl-label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.pl-track {
  position: relative;
  height: 10px;
  background: var(--paper-2);
  border-radius: var(--r-pill);
  overflow: hidden;
  border: 1px solid var(--line);
}
.pl-track-soft { background: color-mix(in oklab, var(--paper-2) 70%, transparent); }
.pl-fill { display: block; height: 100%; background: var(--plan-color); border-radius: inherit; transition: width .6s cubic-bezier(.2,.7,.2,1); position: relative; }
.pl-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.25) 50%, rgba(255,255,255,0) 100%);
  background-size: 200% 100%;
  animation: shimmer 2.4s linear infinite;
}
.pl-fill-soft {
  background: repeating-linear-gradient(45deg, var(--line-strong) 0 6px, transparent 6px 12px);
}
.pl-fill-soft::after { display: none; }
.pl-num { font-family: var(--font-display); font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }
@keyframes shimmer { from { background-position: -100% 0; } to { background-position: 100% 0; } }

.milestones { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.mi {
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--paper-3);
  transition: background .15s ease;
}
.mi:hover { background: var(--paper-2); }
.mi[data-overdue="1"] {
  border-left: 3px solid var(--overdue);
  background: linear-gradient(90deg, var(--overdue-soft) 0%, var(--paper-3) 38%);
}
.mi[data-status="done"] .mi-title { color: var(--done); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.mi .check {
  width: 22px; height: 22px;
  border-radius: 7px;
  border: 1.5px solid var(--line-strong);
  display: grid; place-items: center;
  transition: background-color .15s, border-color .15s;
}
.mi .check:hover { border-color: var(--plan-color); }
.mi[data-status="done"] .check { background: var(--plan-color); border-color: var(--plan-color); }
.mi .check:disabled { opacity: .4; cursor: not-allowed; }
.mi-title { font-weight: 500; color: var(--ink); }
.mi-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--mute); margin-top: 3px; flex-wrap: wrap; }
.mi-fill {
  flex: 1; min-width: 80px; max-width: 220px;
  height: 5px;
  background: var(--paper-2);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.mi-fill > span { display: block; height: 100%; border-radius: inherit; transition: width .45s ease; }
.mi-pct { font-variant-numeric: tabular-nums; }
.mi-owner {
  padding: 2px 8px; border-radius: var(--r-pill);
  font-size: 11px; letter-spacing: .06em; font-weight: 500;
}
.mi-target {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 3px 4px;
  font-size: 12.5px;
}
.mi-step {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--paper-3);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-weight: 700;
  color: var(--ink-2);
}
.mi-step:hover:not(:disabled) { background: var(--plan-color); color: #fff; border-color: var(--plan-color); }
.mi-step:disabled { opacity: .4; cursor: not-allowed; }
.mi-num { font-variant-numeric: tabular-nums; padding: 0 6px; }
.mi-num span:last-child { color: var(--mute); }
.mi-actions { display: inline-flex; gap: 4px; }
.mi .icon-btn { opacity: 0; transition: opacity .15s; }
.mi:hover .icon-btn,
.mi:focus-within .icon-btn { opacity: 1; }
@media (hover: none) { .mi .icon-btn { opacity: 1; } }
.mi .warn { color: var(--overdue); }
.plan-foot { display: flex; justify-content: space-between; margin-top: 12px; }

@media (max-width: 900px) {
  .plan-head { grid-template-columns: 1fr; }
  .plan-meta { text-align: left; }
  .pl-row { grid-template-columns: 64px 1fr 48px; gap: 8px; }
  .pl-row .pl-label { font-size: 11px; }
  .mi { grid-template-columns: 22px 1fr; }
  .mi-target, .mi .icon-btn { grid-column: 1 / -1; justify-self: start; opacity: 1; }
}

/* ---- Everyday habits ------------------------------------------------ */
.habit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.habit {
  --hb-color: var(--accent);
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex; flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.habit::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--hb-color);
}
.habit.is-done-today {
  background: color-mix(in oklab, var(--hb-color) 8%, var(--paper-3));
}
.hb-head {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: start;
}
.hb-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--hb-color) 14%, var(--paper-2));
  display: grid; place-items: center;
  font-size: 22px;
}
.hb-titles { min-width: 0; }
.hb-title {
  font-family: var(--font-display); font-size: 19px; line-height: 1.2;
  letter-spacing: -0.01em;
  font-variation-settings: "SOFT" 30, "opsz" 60;
}
.hb-desc {
  margin-top: 4px; font-size: 13px; color: var(--ink-3); max-width: 36ch;
}
.hb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.hb-target {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--hb-color);
  background: color-mix(in oklab, var(--hb-color) 14%, var(--paper-2));
  padding: 2px 8px; border-radius: var(--r-pill);
}
.hb-tag.shared {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  background: var(--paper-2); color: var(--ink-3);
  padding: 2px 8px; border-radius: var(--r-pill);
}
.hb-actions { display: inline-flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.habit:hover .hb-actions,
.habit:focus-within .hb-actions { opacity: 1; }
@media (hover: none) { .hb-actions { opacity: 1; } }

.hb-progress { display: flex; align-items: center; gap: 12px; }
.hb-bar {
  flex: 1; min-width: 0;
  height: 8px; background: var(--paper-2);
  border-radius: var(--r-pill);
  overflow: hidden;
  border: 1px solid var(--line);
}
.hb-bar > span {
  display: block; height: 100%;
  background: var(--hb-color);
  border-radius: inherit;
  transition: width .5s cubic-bezier(.2,.7,.2,1);
}
.hb-current { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.hb-foot {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  background: color-mix(in oklab, var(--paper-2) 50%, transparent);
  border-radius: var(--r);
}
.hb-streak, .hb-rate {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-size: 12.5px; color: var(--ink-3);
}
.hb-streak strong, .hb-rate strong {
  font-family: var(--font-display);
  font-size: 22px; color: var(--ink); line-height: 1; letter-spacing: -0.02em;
}
.hb-streak-flame { font-size: 16px; }
.hb-strip { display: flex; gap: 3px; justify-content: center; flex-wrap: wrap; min-width: 0; }
.hb-dot {
  width: 10px; height: 10px;
  border-radius: 3px;
  background: var(--paper-3);
  border: 1px solid var(--line);
  transition: transform .15s ease;
}
.hb-dot.is-done {
  background: var(--hb-color);
  border-color: var(--hb-color);
}
.hb-dot.is-today {
  outline: 2px solid var(--hb-color);
  outline-offset: 1px;
}
.hb-dot:hover { transform: scale(1.3); }

.hb-action-row { display: flex; justify-content: center; }
.hb-toggle {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--paper-2);
  border: 2px solid var(--line-strong);
  color: var(--ink-3);
  display: grid; place-items: center;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.hb-toggle:hover { border-color: var(--hb-color); color: var(--hb-color); transform: translateY(-2px); }
.hb-toggle.is-done {
  background: var(--hb-color);
  border-color: var(--hb-color);
  color: #fff;
}
.hb-counter {
  display: inline-flex; align-items: stretch;
  background: var(--paper-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 4px;
  gap: 4px;
  min-width: 200px;
}
.hb-step {
  min-width: 38px; height: 38px;
  border-radius: var(--r-pill);
  background: var(--paper-3);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 18px; font-weight: 600; color: var(--ink-2);
  transition: background .12s, border-color .12s, color .12s;
}
.hb-step:hover { background: var(--hb-color); border-color: var(--hb-color); color: #fff; }
.hb-mark {
  flex: 1; gap: 6px;
  flex-direction: row;
  padding: 0 14px;
  font-family: var(--font-display);
  font-size: 16px; font-weight: 500;
  white-space: nowrap;
}
.hb-mark .hb-mark-num { font-size: 18px; letter-spacing: -0.02em; }
.hb-mark .hb-mark-of { color: var(--mute); font-size: 12.5px; }
.hb-mark:hover .hb-mark-of { color: rgba(255,255,255,.8); }

/* color picker */
.color-pick {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.color-pick .cp {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s ease;
}
.color-pick .cp:hover { transform: scale(1.1); }
.color-pick .cp.is-active { border-color: var(--ink); box-shadow: 0 0 0 2px var(--paper-3) inset; }

@media (max-width: 520px) {
  .habit-grid { grid-template-columns: 1fr; }
  .hb-head { grid-template-columns: 36px 1fr auto; }
  .hb-icon { width: 36px; height: 36px; font-size: 18px; }
  .hb-title { font-size: 17px; }
  .hb-foot {
    grid-template-columns: auto 1fr;
    gap: 8px;
    padding: 8px 10px;
  }
  .hb-rate { grid-column: 1 / -1; justify-content: flex-end; border-top: 1px dashed var(--line); padding-top: 6px; }
}

/* ---- Analytics ------------------------------------------------------- */
.heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14px, 14px));
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 14px);
  gap: 3px;
  padding: 10px 4px;
}
.heatmap .cell {
  width: 14px; height: 14px;
  border-radius: 3px;
  background: var(--paper-2);
  position: relative;
}
.heatmap .cell[data-level="1"] { background: color-mix(in oklab, var(--accent) 18%, var(--paper-2)); }
.heatmap .cell[data-level="2"] { background: color-mix(in oklab, var(--accent) 38%, var(--paper-2)); }
.heatmap .cell[data-level="3"] { background: color-mix(in oklab, var(--accent) 62%, var(--paper-2)); }
.heatmap .cell[data-level="4"] { background: var(--accent); }
.heatmap .cell:hover { outline: 2px solid var(--ink); outline-offset: 1px; }

/* ---- Modal ---------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,15,20,.45);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: 20px; z-index: 100;
  animation: fadein .15s ease;
}
.modal {
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 26px;
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: pop .2s cubic-bezier(.2,.7,.3,1.1);
}
.modal.is-wide { width: min(760px, calc(100vw - 32px)); }
.modal h3 { margin-bottom: 14px; }
.modal .field { margin-bottom: 12px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.modal-grid { display: grid; gap: 10px; }
.modal-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.modal-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.modal input[type="text"],
.modal input[type="number"],
.modal input[type="email"],
.modal input[type="password"],
.modal input[type="date"],
.modal input[type="datetime-local"],
.modal input[type="color"],
.modal select,
.modal textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  background: var(--paper-3);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font: inherit;
  color: inherit;
}
.modal input[type="color"] { padding: 4px; height: 38px; }
.modal input:focus, .modal select:focus, .modal textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

/* repeatable row with title + a few small fields (milestones, subtasks) */
.repeat-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}
.repeat-row:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.repeat-row > .rr-title { grid-column: 1 / -1; }
.repeat-row .rr-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 640px) {
  .modal-grid.cols-2-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .repeat-row {
    grid-template-columns: 1.4fr 1fr;
    align-items: start;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 8px;
  }
  .repeat-row > .rr-title { grid-column: auto; }
  .repeat-row .rr-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .modal-grid.cols-2,
  .modal-grid.cols-3,
  .modal-grid.cols-4 {
    grid-template-columns: 1fr;
  }
  .modal { padding: 20px; border-radius: 16px; }
  .modal-footer .btn { flex: 1; justify-content: center; }
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---- Confetti / sparkle --------------------------------------------- */
.spark {
  position: fixed; pointer-events: none;
  width: 8px; height: 8px;
  border-radius: 50%;
  z-index: 999;
}

/* ---- Toast ---------------------------------------------------------- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: var(--r-pill);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  z-index: 200;
  animation: pop .2s ease;
}

/* ---- Utility -------------------------------------------------------- */
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.muted { color: var(--mute); }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--r-pill);
  background: var(--paper-2); color: var(--ink-3);
}
.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  padding: 36px;
  text-align: center;
  color: var(--mute);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
}

/* ---- Page entry animation ------------------------------------------- */
.fadein > * { opacity: 0; transform: translateY(8px); animation: rise .5s cubic-bezier(.2,.7,.2,1) forwards; }
.fadein > *:nth-child(1) { animation-delay: 0ms; }
.fadein > *:nth-child(2) { animation-delay: 60ms; }
.fadein > *:nth-child(3) { animation-delay: 120ms; }
.fadein > *:nth-child(4) { animation-delay: 180ms; }
.fadein > *:nth-child(5) { animation-delay: 240ms; }
.fadein > *:nth-child(6) { animation-delay: 300ms; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---- View toggle ---------------------------------------------------- */
.seg {
  display: inline-flex;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}
.seg button {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 500;
}
.seg button.is-active {
  background: var(--paper-3);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ---- Profile page --------------------------------------------------- */
.profile-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: start;
}
.profile-grid .profile-meta { grid-column: 1 / -1; }
.profile-card { padding: 24px; }
.profile-avatar-wrap {
  display: flex; flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}
.profile-avatar {
  width: 156px; height: 156px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 64px;
  letter-spacing: -0.02em;
  position: relative;
  box-shadow: 0 0 0 6px var(--paper-3), 0 0 0 7px var(--line);
  overflow: hidden;
}
.profile-avatar img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.profile-avatar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }

/* Sidebar user card → link */
.side-user {
  display: flex; align-items: center; gap: 10px;
  flex: 1;
  padding: 4px;
  border-radius: var(--r-sm);
  transition: background .15s ease;
  min-width: 0;
}
.side-user:hover { background: color-mix(in oklab, var(--accent-soft) 60%, transparent); }
.side-user > div { min-width: 0; }
.side-user > div > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-link { cursor: pointer; }
.avatar-link:hover { transform: scale(1.04); transition: transform .15s ease; }

@media (max-width: 980px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-avatar { width: 132px; height: 132px; font-size: 52px; }
}

/* ---- Daily note card ----------------------------------------------- */
.note-card { background: linear-gradient(180deg, var(--paper-3), color-mix(in oklab, var(--accent-soft) 22%, var(--paper-3))); }
.note-textarea {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--line);
  background: var(--paper-3);
  border-radius: var(--r);
  padding: 14px 16px;
  resize: vertical;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  box-sizing: border-box;
}
.note-textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.note-status {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mute);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  transition: background .2s ease, color .2s ease;
}
.note-status.is-saving { background: var(--paper-2); color: var(--ink-3); }
.note-status.is-ok     { background: color-mix(in oklab, var(--personal) 22%, var(--paper-2)); color: var(--personal); }
.note-status.is-editing{ background: color-mix(in oklab, var(--accent)   18%, var(--paper-2)); color: var(--accent); }
.note-status.is-err    { background: var(--overdue); color: #fff; }

/* ---- Hamburger + sidebar drawer ------------------------------------- */
.hamburger {
  display: none;
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  align-items: center; justify-content: center;
  border: 1px solid var(--line-strong);
  background: var(--paper-3);
  color: var(--ink);
  flex: 0 0 auto;
}
.hamburger:hover { background: var(--paper-2); }
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 15, 20, .42);
  backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 0;
  transition: opacity .2s ease;
}
.app.sidebar-open .sidebar-backdrop { display: block; opacity: 1; }

/* ---- Responsive ----------------------------------------------------- */

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

@media (max-width: 1100px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Login adjustments */
@media (max-width: 980px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { padding: 36px; min-height: 240px; }
  .login-form { padding: 32px; max-width: 100%; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .goal-cols { grid-template-columns: 1fr; }
}

/* Tablet + mobile: drawer behaviour.
   Single column layout, sidebar slides over from the left when toggled. */
@media (max-width: 1023px) {
  body { font-size: 14.5px; }
  .app { grid-template-columns: 1fr; }
  .main { width: 100%; min-width: 0; }
  .content { padding: 20px 18px; max-width: 100%; }

  .hamburger { display: inline-flex; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    height: 100vh;
    width: min(280px, 82vw);
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.2,.7,.2,1);
    z-index: 50;
    border-right: 1px solid var(--line-strong);
    background: var(--paper);
    box-shadow: var(--shadow-lg);
    padding: 18px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .app.sidebar-open .sidebar { transform: translateX(0); }

  .topbar {
    padding: 10px 14px;
    gap: 12px;
    position: sticky; top: 0;
  }
  .topbar-right { gap: 8px; }
  .crumbs { flex-direction: column; gap: 2px; align-items: flex-start; min-width: 0; flex: 1; }
  .crumbs .date { font-size: 12px; }
  .crumbs .page-title { font-size: 16px; }

  .section-head { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
  .section { margin-bottom: 28px; }
  .row { flex-wrap: wrap; }
  h1 { font-size: clamp(24px, 5.6vw, 36px); }

  .stat { padding: 18px; }
  .stat .value { font-size: 44px; margin-top: 10px; }
  .card { padding: 18px; border-radius: 16px; }
  .card.padded-lg { padding: 20px; }

  .kanban { grid-template-columns: repeat(7, 78vw); scroll-snap-type: x mandatory; }
  .kanban .col { scroll-snap-align: start; }

  .inline-add { grid-template-columns: 1fr; }
  .inline-add input, .inline-add select, .inline-add button { width: 100%; }
  .seg button { padding: 7px 12px; font-size: 12.5px; }

  .btn { padding: 9px 14px; min-height: 38px; }
  .btn-sm { min-height: 32px; padding: 6px 10px; }
  .btn-icon { min-height: 38px; min-width: 38px; }

  /* Tap-friendly: always show row action buttons that were hover-only */
  .task-actions, .mi .icon-btn, .habit .hb-actions { opacity: 1 !important; }

  .heatmap { overflow-x: auto; padding-bottom: 10px; }
  .plan-pct { font-size: 42px; }
  .pl-row { grid-template-columns: 64px 1fr 48px; gap: 10px; }
  .pl-label { font-size: 11px; }
  .goal { padding: 18px; }
  .goal-head h3 { font-size: 19px; }
  .goal-cols { gap: 10px; }
  .goal-col { padding: 12px; }
  .hb-toggle { width: 56px; height: 56px; }
}

/* Phones */
@media (max-width: 600px) {
  .topbar { padding: 10px 12px; }
  .topbar-right .avatar { display: none; }
  .content { padding: 14px 12px; }

  .stat { padding: 14px; }
  .stat .value { font-size: 36px; }

  .plan-pct { font-size: 36px; }
  .pl-row { grid-template-columns: 56px 1fr 44px; gap: 8px; }
  .mi { padding: 8px 10px; grid-template-columns: 22px 1fr; }
  .mi-target, .mi-actions { grid-column: 1 / -1; justify-self: start; }

  .topbar #quickAddBtn .qa-label { display: none; }
  .topbar #quickAddBtn { padding: 0; width: 38px; min-width: 38px; height: 38px; justify-content: center; }

  .hb-counter { width: 100%; }
}

@media (max-width: 420px) {
  .grid-stats { grid-template-columns: 1fr 1fr; }
  .modal { padding: 18px; }
  .modal h3 { font-size: 18px; }
  .plan-pct { font-size: 30px; }
  .day-col-bucket { font-size: 18px; }
  .crumbs .date { display: none; }      /* keep page title only */
  .crumbs .page-title { font-size: 15px; }
}

/* Lock body scroll while drawer is open (mobile + tablet) */
@media (max-width: 1023px) {
  .app.sidebar-open { overflow: hidden; height: 100vh; }
  .app.sidebar-open .main { pointer-events: none; }
}

/* Accessibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
