/* ==========================================================
   Everyday Tracking — warm journal aesthetic
   Designed for Windows + Android browsers
   ========================================================== */

/* ----- TYPE ----- */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Caveat:wght@400;500&display=swap');

:root {
  /* warm cream daylight palette — lightened & airy */
  --bg:        #fbf8f1;
  --bg-2:      #f5f0e6;
  --bg-3:      #ece5d6;
  --paper:     #fffefb;
  --paper-2:   #f8f4ea;
  --ink:       #342e24;
  --ink-2:     #5f5747;
  --ink-3:     #908871;
  --ink-4:     #c2b9a4;
  --line:      #ede6d6;
  --line-2:    #ded4c0;

  /* sage/moss primary */
  --accent:        #5e7a55;
  --accent-2:      #7d9c6f;
  --accent-3:      #c7d6b9;
  --accent-soft:   #e2eadb;
  --accent-wash:   #ecf2e3;

  /* terracotta / accent secondary */
  --warm:          #b8694a;
  --warm-2:        #ecb699;
  --warm-soft:     #f1d9c6;

  /* multi-pastel card tints (warm cream daylight) */
  --tint-sage-bg:   #d8e3c8;
  --tint-sage-soft: #e8efd8;
  --tint-sage-ink:  #5a7048;
  --tint-peach-bg:  #f4d6c0;
  --tint-peach-soft:#fae6d6;
  --tint-peach-ink: #a05a3e;
  --tint-butter-bg: #f7e5b3;
  --tint-butter-soft:#fbf0cf;
  --tint-butter-ink:#8a6e2a;
  --tint-lilac-bg:  #d9d2e8;
  --tint-lilac-soft:#e8e3f1;
  --tint-lilac-ink: #6a5d8e;
  --tint-sky-bg:    #c7dbe8;
  --tint-sky-soft:  #dde9f1;
  --tint-sky-ink:   #4a6a82;
  --tint-rose-bg:   #f1cdd1;
  --tint-rose-soft: #f8dee2;
  --tint-rose-ink:  #944751;

  /* contour line color for hand-drawn background */
  --contour: rgba(140, 128, 100, 0.12);

  /* status hues */
  --pri-high:  #c25a52;
  --pri-med:   #c89052;
  --pri-low:   #6f8db5;

  /* atmospheric blob colors — soft & light, no muddy grey */
  --blob-1: rgba(196, 214, 168, 0.32);
  --blob-2: rgba(240, 196, 168, 0.26);
  --blob-3: rgba(214, 204, 232, 0.24);

  --shadow-sm: 0 1px 2px rgba(80, 60, 30, 0.06);
  --shadow:    0 8px 30px -14px rgba(80, 60, 30, 0.18), 0 2px 4px rgba(80, 60, 30, 0.04);
  --shadow-lg: 0 35px 80px -25px rgba(80, 60, 30, 0.30), 0 12px 24px -12px rgba(80, 60, 30, 0.10);
  --shadow-inset: inset 0 0 0 1px rgba(255, 250, 235, 0.4);

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;
  --radius-xl: 32px;

  --row-h:     42px;
  --hour-h:    62px;

  /* per-user labels assigned in JS */
}

/* ----- DARK MODE: warm dusk (soft, not black) ----- */
[data-theme="dark"] {
  --bg:        #2b2922;
  --bg-2:      #332f27;
  --bg-3:      #3d3830;
  --paper:     #36322a;
  --paper-2:   #3e392f;
  --ink:       #f6efe0;
  --ink-2:     #ddd2bc;
  --ink-3:     #a89c84;
  --ink-4:     #79705c;
  --line:      #46402f;
  --line-2:    #564f3c;

  --accent:        #a6c596;
  --accent-2:      #bdd6ad;
  --accent-3:      #56684a;
  --accent-soft:   #3a4530;
  --accent-wash:   #343d2a;

  --warm:          #e8ad8e;
  --warm-2:        #f0bfa3;
  --warm-soft:     #463429;

  /* softer pastel tints for dusk */
  --tint-sage-bg:   #3a4730;
  --tint-sage-soft: #343f2b;
  --tint-sage-ink:  #c4d8b2;
  --tint-peach-bg:  #4a3528;
  --tint-peach-soft:#3f2e22;
  --tint-peach-ink: #f0b495;
  --tint-butter-bg: #3a2f1a;
  --tint-butter-bg: #463913;
  --tint-butter-soft:#3c3110;
  --tint-butter-ink:#ecce78;
  --tint-lilac-bg:  #383047;
  --tint-lilac-soft:#302a3c;
  --tint-lilac-ink: #d2c7e6;
  --tint-sky-bg:    #283844;
  --tint-sky-soft:  #233039;
  --tint-sky-ink:   #aecbe0;
  --tint-rose-bg:   #4a2c30;
  --tint-rose-soft: #3e2528;
  --tint-rose-ink:  #f4b2b9;

  --contour: rgba(230, 214, 170, 0.08);

  --pri-high:  #e8826c;
  --pri-med:   #e5a96c;
  --pri-low:   #93b1cc;

  --blob-1: rgba(150, 180, 120, 0.18);
  --blob-2: rgba(210, 150, 115, 0.15);
  --blob-3: rgba(150, 160, 200, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.20);
  --shadow:    0 10px 30px -10px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.50);
}

[data-density="compact"] { --row-h: 34px; --hour-h: 50px; }

/* ----- BASE ----- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Geist", ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  position: relative;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
/* "serif" class kept as the display family hook — now mono, since the user prefers no serif */
.serif { font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 500; letter-spacing: -0.03em; }
.serif-i { font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 500; font-style: normal; letter-spacing: -0.02em; color: var(--accent); }
.hand { font-family: "Caveat", "Brush Script MT", cursive; }

/* ----- ATMOSPHERIC BACKGROUND ----- */
.atmosphere {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* hand-drawn contour lines — wraps the screen like a topo map */
.contours {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
  color: var(--contour);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'><g fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' opacity='0.18'><path d='M-50,120 C 180,80 320,170 520,110 S 880,160 1100,100 S 1400,150 1700,90'/><path d='M-50,210 C 200,170 340,260 540,200 S 900,240 1120,180 S 1420,230 1700,190'/><path d='M-50,310 C 220,260 380,360 600,300 S 920,340 1140,290 S 1430,330 1700,290'/><path d='M-50,420 C 240,380 400,470 620,400 S 940,450 1160,400 S 1450,440 1700,400'/><path d='M-50,540 C 200,500 380,580 600,520 S 960,560 1180,510 S 1470,550 1700,520'/><path d='M-50,660 C 220,610 400,700 620,630 S 980,680 1200,620 S 1490,660 1700,630'/><path d='M-50,790 C 240,740 420,820 640,750 S 1000,790 1220,740 S 1510,780 1700,750'/><path d='M-50,920 C 260,870 440,950 660,870 S 1020,900 1240,860 S 1530,900 1700,860'/></g><g fill='none' stroke='%23000' stroke-width='1.2' stroke-linecap='round' opacity='0.12'><path d='M-50,60  C 140,30 280,90 470,50 S 820,80 1040,40 S 1340,70 1700,30'/><path d='M-50,160 C 160,120 290,180 480,140 S 840,170 1060,130 S 1360,160 1700,120'/></g></svg>");
  background-size: 1600px 1000px;
  background-position: center;
  background-repeat: no-repeat;
  animation: contour-drift 60s ease-in-out infinite alternate;
}
@keyframes contour-drift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}
[data-theme="dark"] .contours { opacity: 0.45; }

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.8;
  animation: drift 25s ease-in-out infinite alternate;
  will-change: transform;
}
.blob.b1 { width: 520px; height: 520px; background: var(--blob-1); top: -160px; left: -140px; }
.blob.b2 { width: 460px; height: 460px; background: var(--blob-2); top: 22%; right: -160px; animation-delay: -8s; animation-duration: 32s; }
.blob.b3 { width: 520px; height: 520px; background: var(--blob-3); bottom: -180px; left: 12%; animation-delay: -15s; animation-duration: 38s; }
@keyframes drift {
  0%   { transform: translate(0, 0)         scale(1); }
  50%  { transform: translate(40px, -30px)  scale(1.07); }
  100% { transform: translate(-30px, 40px)  scale(0.96); }
}

/* paper grain */
.grain {
  position: fixed; inset: 0; z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.2  0 0 0 0 0.15  0 0 0 0 0.05  0 0 0 0.07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.32;
  mix-blend-mode: multiply;
}
[data-theme="dark"] .grain { opacity: 0.25; mix-blend-mode: overlay; }

/* ----- APP LAYOUT ----- */
#root, .app { height: 100vh; position: relative; z-index: 2; }
.app {
  display: grid;
  grid-template-columns: clamp(244px, 18vw, 300px) 1fr;
  height: 100vh;
  transition: grid-template-columns 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.app.rail-collapsed {
  grid-template-columns: 76px 1fr;
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
}

/* ----- RAIL (desktop sidebar) ----- */
.rail {
  background: linear-gradient(180deg, var(--paper-2), var(--bg-2));
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}
.rail::before {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, transparent, var(--line-2) 30%, var(--line-2) 70%, transparent);
}
.rail-head {
  padding: 20px 16px 14px;
  display: flex; align-items: center; gap: 12px;
}
.rail-collapse-btn {
  margin-left: auto; flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  color: var(--ink-3);
  border: 1px solid var(--line);
  background: var(--paper);
  transition: background 0.14s, color 0.14s;
}
.rail-collapse-btn:hover { background: var(--paper-2); color: var(--ink); }

/* scroll area between profile switcher and footer */
.rail-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }
.rail-scroll::-webkit-scrollbar { width: 8px; }

/* ── Profile switcher ── */
.profile-switch-wrap { padding: 4px 12px 10px; position: relative; }
.profile-switch {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 11px; border-radius: 13px;
  background: var(--paper); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: background 0.14s, box-shadow 0.14s;
}
.profile-switch:hover { background: var(--paper-2); box-shadow: var(--shadow); }
.avatar {
  width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center;
  color: #fff; font-family: "JetBrains Mono", monospace;
  font-size: 13px; font-weight: 600; letter-spacing: -0.02em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 11px; }
.avatar.ghost { background: var(--bg-3) !important; color: var(--ink-3); }
.profile-switch .who { display: flex; flex-direction: column; min-width: 0; flex: 1; text-align: left; }
.profile-switch .who-name { font-size: 13.5px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-switch .who-sub { font-size: 10.5px; color: var(--ink-3); }
.profile-switch .who-caret { color: var(--ink-3); flex-shrink: 0; transform: rotate(90deg); }

.profile-menu {
  position: absolute; left: 12px; right: 12px; top: calc(100% - 4px);
  z-index: 30;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 13px; box-shadow: var(--shadow-lg);
  padding: 6px; animation: pop 0.16s ease;
}
.profile-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px; border-radius: 9px;
  text-align: left; transition: background 0.12s;
}
.profile-menu-item:hover { background: var(--paper-2); }
.profile-menu-item.active { background: var(--accent-wash); }
.profile-menu-item .who-name { font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }

.label-dot { width: 11px; height: 11px; border-radius: 4px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }

/* ── Collapsed sidebar ── */
.rail.collapsed .brand,
.rail.collapsed .rail-section-label,
.rail.collapsed .rail-item .lbl,
.rail.collapsed .rail-item .count,
.rail.collapsed .profile-switch .who,
.rail.collapsed .profile-switch .who-caret,
.rail.collapsed .rt-detail {
  display: none;
}
.rail.collapsed .rail-head { flex-direction: column; gap: 10px; padding: 18px 10px 12px; }
.rail.collapsed .rail-collapse-btn { margin-left: 0; }
.rail.collapsed .profile-switch-wrap { padding: 4px 10px 10px; }
.rail.collapsed .profile-switch { justify-content: center; padding: 8px; }
.rail.collapsed .rail-section { padding: 8px 10px 4px; }
.rail.collapsed .rail-item { justify-content: center; padding: 10px; gap: 0; }
.rail.collapsed .rail-item.active::before { left: -10px; }
.rail.collapsed .running-timer { justify-content: center; padding: 10px; }
.rail.collapsed .label-dot { width: 14px; height: 14px; }

.rail-section { padding: 8px 12px 4px; }

.logomark {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--paper);
  display: grid; place-items: center;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 18px; font-weight: 600; line-height: 1; letter-spacing: -0.04em;
  box-shadow: 0 4px 14px -4px var(--accent), inset 0 1px 0 rgba(255,255,255,0.3);
}
.brand { display: flex; flex-direction: column; gap: 0; }
.brand .name {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 600; letter-spacing: -0.04em; font-size: 16px;
  line-height: 1.05;
}
.brand .sub {
  font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.10em;
  text-transform: uppercase; font-weight: 500;
}

.rail-section { padding: 8px 12px 4px; }
.rail-section-label {
  padding: 8px 10px 6px;
  font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600;
}
.rail-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 11px; border-radius: 11px;
  color: var(--ink-2);
  width: 100%; text-align: left;
  transition: background 0.15s, color 0.15s, transform 0.05s;
  position: relative;
}
.rail-item:hover { background: var(--paper); color: var(--ink); }
.rail-item:active { transform: scale(0.99); }
.rail-item.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line);
}
.rail-item.active::before {
  content: ""; position: absolute; left: -12px; top: 11px; bottom: 11px;
  width: 3px; background: var(--accent); border-radius: 3px;
}
.rail-item .ic { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.rail-item .lbl { flex: 1; font-size: 13.5px; font-weight: 500; }
.rail-item .count {
  font-size: 10.5px; color: var(--ink-3);
  background: var(--bg-2); padding: 2px 7px; border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
}
.rail-item.active .count { background: var(--accent-soft); color: var(--accent); }

.rail-foot {
  margin-top: auto; padding: 14px; border-top: 1px solid var(--line);
}
.running-timer {
  background: linear-gradient(135deg, var(--ink), color-mix(in oklab, var(--ink) 80%, var(--accent)));
  color: var(--paper);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 11px;
  margin-bottom: 10px;
  box-shadow: 0 8px 24px -10px rgba(0,0,0,0.25);
}
.running-timer .pulse {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 var(--accent-2);
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-2); }
  70%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.rt-task { font-size: 11.5px; opacity: 0.80; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-time { font-size: 17px; font-weight: 500; line-height: 1; margin-top: 3px; }

/* mobile bottom nav */
.mobile-nav {
  display: none;
  background: color-mix(in oklab, var(--paper-2) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(env(safe-area-inset-bottom, 0px) + 6px);
}
.mobile-nav-inner {
  display: flex; gap: 2px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mobile-nav-inner::-webkit-scrollbar { display: none; }
.mobile-nav button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 6px; border-radius: 12px;
  color: var(--ink-3); font-size: 10px; font-weight: 500;
  flex: 1 0 auto; min-width: 60px;
  scroll-snap-align: center;
  transition: background 0.15s, color 0.15s;
}
.mobile-nav button.active { color: var(--accent); background: var(--accent-soft); }
.mobile-nav button:active { transform: scale(0.94); }
.mobile-nav button svg { width: 21px; height: 21px; }
.mobile-nav .lbl { white-space: nowrap; }

@media (max-width: 900px) {
  .rail { display: none; }
  .mobile-nav { display: block; }
  .mobile-running {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px;
    background: var(--ink); color: var(--paper);
    margin: 0 12px 6px; border-radius: 12px;
  }
}

/* ----- MAIN ----- */
.main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
  min-height: 64px; flex-shrink: 0;
  display: flex; align-items: center;
  padding: 14px 28px;
  gap: 16px;
  background: transparent;
  position: relative;
  z-index: 3;
}
.topbar .crumb {
  font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.10em; font-weight: 600;
  margin-bottom: 3px;
}
.topbar h1 {
  margin: 0; font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(18px, 1.8vw, 26px); font-weight: 600; letter-spacing: -0.035em;
  line-height: 1.05;
}
.topbar .spacer { flex: 1; }
@media (max-width: 700px) {
  .topbar { padding: 10px 16px; }
  .topbar h1 { font-size: 22px; }
}

.btn {
  height: 36px; padding: 0 14px;
  border-radius: 11px;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500;
  background: var(--paper); color: var(--ink-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: background 0.14s, transform 0.06s, box-shadow 0.14s;
  white-space: nowrap;
}
.btn:hover { background: var(--paper-2); color: var(--ink); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(160deg, var(--accent), color-mix(in oklab, var(--accent) 75%, var(--ink)));
  color: var(--paper); border-color: var(--accent);
  box-shadow: 0 4px 14px -4px var(--accent);
}
.btn.primary:hover { box-shadow: 0 6px 20px -5px var(--accent); }
.btn.warm {
  background: linear-gradient(160deg, var(--warm), var(--warm-2));
  color: var(--paper); border-color: var(--warm);
}
.btn.ghost { background: transparent; border: 1px solid transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--paper); border-color: var(--line); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.icon { width: 36px; padding: 0; justify-content: center; }
.btn.icon.sm { width: 30px; }
.btn .kbd {
  font-family: "JetBrains Mono", monospace; font-size: 10.5px;
  opacity: 0.7; padding-left: 4px;
}

.canvas { flex: 1; overflow: auto; position: relative; }
.canvas-inner {
  padding: 8px clamp(20px, 3vw, 48px) 80px;
  max-width: 1500px;
  margin: 0;
}
.canvas-wide { padding: 0; max-width: 100%; }
@media (max-width: 700px) {
  .canvas-inner { padding: 4px 16px 80px; }
}

/* ----- PAGE TITLE ----- */
.page-title {
  margin-bottom: 24px;
  position: relative;
}
.page-title .eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--ink-3); font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.page-title .eyebrow::before {
  content: ""; width: 18px; height: 1px; background: var(--ink-4);
}
/* page title — fluid type */
.page-title h2 {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 600;
  font-size: clamp(24px, 3.2vw, 40px);
  letter-spacing: -0.04em;
  margin: 6px 0 2px;
  line-height: 1.05;
}
.page-title .sub {
  font-size: clamp(13px, 1.05vw, 15.5px);
  color: var(--ink-3); margin-top: 6px;
  max-width: 64ch;
}
@media (max-width: 700px) {
  .page-title h2 { font-size: clamp(23px, 6vw, 30px); }
}

/* ----- CARDS ----- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.card.warm-tint { background: linear-gradient(180deg, var(--paper), var(--paper-2)); }
.card.sage-tint { background: linear-gradient(165deg, var(--accent-wash), var(--paper)); border-color: var(--accent-3); }
.card .card-h {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.card .card-h h3 {
  margin: 0; font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 17px; font-weight: 600; letter-spacing: -0.035em;
  flex-shrink: 0; white-space: nowrap;
}
.card .card-h .sub { font-size: 12px; color: var(--ink-3); }
.card .card-b { padding: 18px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.divider.dashed { background: none; border-top: 1px dashed var(--line-2); }

/* ----- CHIPS & LABELS ----- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
  background: var(--bg-2); color: var(--ink-2);
  line-height: 1; white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-lab {
  background: color-mix(in oklab, var(--chip-color) 14%, var(--paper));
  color: var(--chip-color);
}

/* priority diamond */
.pri { width: 9px; height: 9px; transform: rotate(45deg); border-radius: 2px; flex-shrink: 0; }
.pri.high { background: var(--pri-high); }
.pri.med  { background: var(--pri-med); }
.pri.low  { background: var(--pri-low); }
.pri.none { background: transparent; border: 1.5px solid var(--ink-4); }

/* ----- TASK ROW ----- */
.task-row {
  display: grid;
  grid-template-columns: 24px 14px 1fr auto auto auto;
  align-items: center; gap: 12px;
  padding: 0 10px; height: var(--row-h);
  border-radius: 10px;
  transition: background 0.12s;
  cursor: pointer;
}
.task-row:hover { background: var(--paper-2); }
.task-row.done .title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-4); text-decoration-thickness: 1px; }
.task-row .check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--ink-4);
  display: grid; place-items: center;
  transition: all 0.15s;
  background: var(--paper);
}
.task-row .check:hover { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.task-row.done .check {
  background: var(--accent); border-color: var(--accent); color: var(--paper);
}
.task-row .title { font-size: 14px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row .meta  { display: flex; gap: 7px; align-items: center; }
.task-row .est   { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--ink-3); }
.task-row .task-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.12s; }
.task-row:hover .task-actions, .task-row:focus-within .task-actions { opacity: 1; }
.task-row .task-actions .btn.danger:hover { color: var(--pri-high); background: color-mix(in oklab, var(--pri-high) 12%, transparent); }
@media (max-width: 600px) {
  .task-row { grid-template-columns: 24px 14px 1fr auto auto; }
  .task-row .est { display: none; }
  .task-row .task-actions { opacity: 1; }
}
@media (hover: none) {
  .task-row .task-actions { opacity: 1; }
}

/* ----- GROUP HEADER ----- */
.group-h {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 10px 8px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px; font-weight: 600; letter-spacing: -0.02em; text-transform: uppercase; color: var(--ink-3);
}
.group-h::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}
.group-h .count {
  background: var(--bg-2); padding: 1px 8px; border-radius: 999px;
  font-family: "JetBrains Mono", monospace; font-weight: 500;
  font-size: 10.5px; color: var(--ink-3);
}
.group-h.overdue { color: var(--pri-high); }
.group-h.overdue .count { background: color-mix(in oklab, var(--pri-high) 14%, var(--paper)); color: var(--pri-high); }

/* ----- PROGRESS ----- */
.progress {
  height: 7px; border-radius: 4px;
  background: var(--bg-2); overflow: hidden;
  position: relative;
}
.progress .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 4px; transition: width 0.4s;
}

/* ----- MODAL ----- */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(30, 22, 12, 0.40);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: grid; place-items: center;
  animation: fade 0.18s;
  padding: 24px;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--paper); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  width: 560px; max-width: 100%;
  overflow: hidden;
  animation: pop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes pop { from { transform: scale(0.96) translateY(8px); opacity: 0; } }
.modal .m-h {
  padding: 16px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
  background: var(--paper-2);
}
.modal .m-h .eyebrow { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.10em; font-weight: 600; }
.modal .m-b { padding: 22px; }
.modal input.q-input {
  width: 100%; border: none; outline: none; background: transparent;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 20px; font-weight: 500; letter-spacing: -0.03em; padding: 10px 0;
  color: var(--ink); letter-spacing: -0.01em;
}
.modal input.q-input::placeholder { color: var(--ink-4); }
.modal .m-f {
  padding: 12px 22px; background: var(--paper-2); border-top: 1px solid var(--line);
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-3);
}
.kbd-hint {
  font-family: "JetBrains Mono", monospace; font-size: 10.5px;
  padding: 2px 6px; border-radius: 5px;
  background: var(--paper); color: var(--ink-2);
  border: 1px solid var(--line);
}

/* ----- PLANNER ----- */
.planner {
  display: grid;
  grid-template-columns: clamp(240px, 22vw, 320px) minmax(0, 1fr) clamp(280px, 24vw, 360px);
  height: 100%;
}
@media (max-width: 1200px) {
  .planner { grid-template-columns: clamp(220px, 24vw, 280px) minmax(0, 1fr); }
  .planner-digest { display: none; }
}
@media (max-width: 900px) {
  .planner { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .planner-side { max-height: 240px; }
}
.planner-side {
  border-right: 1px solid var(--line); overflow: auto;
  padding: 18px 16px;
  background: linear-gradient(180deg, var(--paper-2), var(--bg-2));
}
.planner-side h4 {
  margin: 14px 4px 8px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.10em; color: var(--ink-3); font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.pside-task {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 12px;
  margin-bottom: 7px;
  cursor: grab; user-select: none;
  transition: box-shadow 0.14s, transform 0.07s, border-color 0.14s;
}
.pside-task:hover { box-shadow: var(--shadow); border-color: var(--line-2); }
.pside-task:active { cursor: grabbing; transform: scale(0.98); }
.pside-task .t-title { font-size: 13px; font-weight: 500; line-height: 1.35; }
.pside-task .t-meta { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.schedule-select {
  height: 24px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--paper-2); color: var(--accent);
  font-size: 11px; font-weight: 600; padding: 0 4px; cursor: pointer;
  font-family: "JetBrains Mono", monospace;
}
.schedule-select:hover { background: var(--accent-soft); border-color: var(--accent-3); }

.planner-grid { overflow: auto; background: var(--paper); position: relative; }
.pday-head {
  position: sticky; top: 0; z-index: 5;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.pday-head .date {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 18px; font-weight: 600; letter-spacing: -0.035em;
  display: inline-flex; align-items: baseline; gap: 8px;
}
.pday-head .date .day-num { font-size: 28px; color: var(--accent); font-weight: 600; letter-spacing: -0.03em; }
.hours-col {
  display: grid;
  grid-template-columns: 64px 1fr;
  position: relative;
}
.hour-lbl {
  grid-column: 1; padding: 4px 10px 0 0;
  font-family: "JetBrains Mono", monospace; font-size: 10.5px;
  color: var(--ink-3); text-align: right;
  border-right: 1px solid var(--line);
  background: var(--paper-2);
  height: var(--hour-h);
  border-bottom: 1px dashed var(--line);
}
.hour-track { position: relative; height: var(--hour-h); border-bottom: 1px dashed var(--line); transition: background 0.1s; }
.hour-track:hover { background: var(--paper-2); }
.now-line {
  position: absolute; left: 64px; right: 0;
  border-top: 2px solid var(--warm);
  z-index: 4; pointer-events: none;
}
.now-line::before {
  content: ""; position: absolute; left: -6px; top: -6px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--warm);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--warm) 30%, transparent);
}
.now-line .now-lbl {
  position: absolute; left: -64px; top: -9px; width: 64px;
  text-align: right; padding-right: 10px;
  font-family: "JetBrains Mono", monospace; font-size: 10px;
  color: var(--warm); font-weight: 700;
  background: var(--paper-2);
}
.block {
  position: absolute; left: 72px; right: 10px;
  border-radius: 11px;
  padding: 9px 11px;
  overflow: hidden;
  cursor: grab;
  border: 1px solid;
  transition: box-shadow 0.14s, transform 0.06s, opacity 0.12s;
  background-image: linear-gradient(165deg, rgba(255,255,255,0.4), transparent);
}
.block:active { cursor: grabbing; }
.block.dragging { opacity: 0.4; box-shadow: var(--shadow); }
.block:hover { box-shadow: var(--shadow); z-index: 3; }
.block .b-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.block .b-range { font-family: "JetBrains Mono", monospace; font-size: 10.5px; opacity: 0.75; margin-top: 3px; }
.block.running { box-shadow: 0 0 0 2px var(--accent), 0 8px 24px -8px var(--accent); }
.block.done { opacity: 0.55; }
.block.done .b-title { text-decoration: line-through; }
.b-play {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,0.10); display: grid; place-items: center;
  transition: background 0.12s; flex-shrink: 0;
}
.b-play:hover { background: rgba(0,0,0,0.20); }

.planner-digest {
  border-left: 1px solid var(--line); background: var(--paper-2);
  overflow: auto; padding: 22px;
}
.hour-track.drop { background: var(--accent-soft); }
.planner-side.drop-back {
  box-shadow: inset 0 0 0 2px var(--accent-3);
  background: linear-gradient(180deg, var(--accent-soft), var(--bg-2));
}

/* ----- BOOT / LOADING ----- */
.boot {
  position: fixed; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center;
}
.boot-orb {
  width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe4be, #f5b88a 55%, #d68d5c);
  box-shadow: 0 10px 32px -8px rgba(180, 100, 60, 0.4), inset 0 -8px 14px -4px rgba(0,0,0,0.15);
  animation: boot-bob 1.4s ease-in-out infinite;
}
.boot-orb.sad { background: radial-gradient(circle at 35% 30%, #e6dccb, #c9bda5 60%, #a8997f); animation: none; }
@keyframes boot-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.boot-title {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 20px; font-weight: 600; letter-spacing: -0.04em; color: var(--ink); }k); }
.boot-sub { font-size: 13px; color: var(--ink-3); }
.boot-btn {
  margin-top: 8px; height: 38px; padding: 0 18px; border-radius: 11px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 500;
  border: none; cursor: pointer;
}

/* ----- DASHBOARD ----- */
.companion {
  position: absolute; top: 8px; right: 28px;
  z-index: 4;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.companion-orb {
  width: 84px; height: 84px; border-radius: 50%;
  position: relative;
  cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #ffd9a8, #f0a877 60%, #d18752);
  box-shadow:
    0 10px 32px -8px rgba(180, 100, 60, 0.5),
    inset 0 -10px 18px -4px rgba(0,0,0,0.18),
    inset 0 2px 4px rgba(255,255,255,0.5);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3), box-shadow 0.3s;
  animation: companion-bob 5s ease-in-out infinite;
}
.companion-orb:hover { transform: scale(1.08) rotate(-3deg); }
.companion-orb:active { transform: scale(0.95); }
@keyframes companion-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}
.companion[data-time-of-day="morning"]   .companion-orb { background: radial-gradient(circle at 35% 30%, #ffe4be, #f5b88a 55%, #d68d5c); }
.companion[data-time-of-day="afternoon"] .companion-orb { background: radial-gradient(circle at 35% 30%, #fff4cf, #f5cf6f 55%, #d8a945); }
.companion[data-time-of-day="evening"]   .companion-orb { background: radial-gradient(circle at 35% 30%, #f4a484, #c66f5b 55%, #8e3f3b); }
.companion[data-time-of-day="night"]     .companion-orb {
  background: radial-gradient(circle at 35% 30%, #e1e3f2, #a8aed8 55%, #6975a3);
  box-shadow:
    0 0 36px -4px #a8aed8,
    0 12px 30px -10px rgba(80, 90, 130, 0.55),
    inset 0 -10px 18px -4px rgba(0,0,0,0.18),
    inset 0 2px 4px rgba(255,255,255,0.4);
}
.companion[data-mood="tired"]    .companion-orb { animation-duration: 7s; }
.companion[data-mood="celebrate"] .companion-orb {
  animation: companion-jump 0.6s ease-in-out 3;
}
@keyframes companion-jump {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-14px) scale(1.05); }
}
.companion-bubble {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px 14px 4px 14px;
  padding: 9px 14px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13.5px; font-weight: 500; letter-spacing: -0.02em; color: var(--ink-2);
  box-shadow: var(--shadow);
  max-width: 240px; line-height: 1.25;
  transform-origin: 100% 100%;
  position: relative;
}
.companion-bubble::after {
  content: "";
  position: absolute; right: 12px; bottom: -6px;
  width: 0; height: 0;
  border: 6px solid transparent;
  border-top-color: var(--paper); border-bottom: none;
}
.companion-bubble.in  { animation: bubble-in  0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
.companion-bubble.out { animation: bubble-out 0.3s ease forwards; }
@keyframes bubble-in  { from { opacity: 0; transform: scale(0.6) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes bubble-out { from { opacity: 1; } to { opacity: 0; transform: scale(0.9); } }

@media (max-width: 700px) {
  .companion { right: 14px; top: 4px; }
  .companion-orb { width: 64px; height: 64px; }
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(12px, 1.5vw, 20px);
}

.stat {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 20px 18px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2), box-shadow 0.25s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.10em; color: var(--ink-3); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.stat .label-ic {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--paper);
  display: grid; place-items: center;
  position: absolute; top: 18px; right: 18px;
  box-shadow: var(--shadow-sm);
  color: var(--stat-ink, var(--ink-2));
}
.stat .num   {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(32px, 3.6vw, 46px); font-weight: 600; letter-spacing: -0.04em;
  margin-top: 10px; line-height: 0.95;
  color: var(--stat-ink, var(--ink));
}
.stat .num .unit { font-family: "Geist", sans-serif; font-size: 14px; color: var(--ink-3); margin-left: 4px; font-weight: 400; }
.stat .sub   { font-size: 12.5px; color: var(--ink-3); margin-top: 12px; line-height: 1.45; }
.stat .ring-deco {
  position: absolute; right: -30px; bottom: -30px;
  width: 110px; height: 110px; border-radius: 50%;
  background: var(--stat-ring, rgba(0,0,0,0.04));
  opacity: 0.7;
  pointer-events: none;
}
.stat.tint-sage   { background: linear-gradient(165deg, var(--tint-sage-bg), var(--tint-sage-soft)); border-color: color-mix(in oklab, var(--tint-sage-ink) 18%, var(--paper)); --stat-ink: var(--tint-sage-ink); --stat-ring: color-mix(in oklab, var(--tint-sage-ink) 18%, transparent); }
.stat.tint-peach  { background: linear-gradient(165deg, var(--tint-peach-bg), var(--tint-peach-soft)); border-color: color-mix(in oklab, var(--tint-peach-ink) 18%, var(--paper)); --stat-ink: var(--tint-peach-ink); --stat-ring: color-mix(in oklab, var(--tint-peach-ink) 18%, transparent); }
.stat.tint-butter { background: linear-gradient(165deg, var(--tint-butter-bg), var(--tint-butter-soft)); border-color: color-mix(in oklab, var(--tint-butter-ink) 18%, var(--paper)); --stat-ink: var(--tint-butter-ink); --stat-ring: color-mix(in oklab, var(--tint-butter-ink) 18%, transparent); }
.stat.tint-lilac  { background: linear-gradient(165deg, var(--tint-lilac-bg), var(--tint-lilac-soft)); border-color: color-mix(in oklab, var(--tint-lilac-ink) 18%, var(--paper)); --stat-ink: var(--tint-lilac-ink); --stat-ring: color-mix(in oklab, var(--tint-lilac-ink) 18%, transparent); }
.stat.tint-sky    { background: linear-gradient(165deg, var(--tint-sky-bg), var(--tint-sky-soft)); border-color: color-mix(in oklab, var(--tint-sky-ink) 18%, var(--paper)); --stat-ink: var(--tint-sky-ink); --stat-ring: color-mix(in oklab, var(--tint-sky-ink) 18%, transparent); }
.stat.tint-rose   { background: linear-gradient(165deg, var(--tint-rose-bg), var(--tint-rose-soft)); border-color: color-mix(in oklab, var(--tint-rose-ink) 18%, var(--paper)); --stat-ink: var(--tint-rose-ink); --stat-ring: color-mix(in oklab, var(--tint-rose-ink) 18%, transparent); }

.stat .progress { background: rgba(0,0,0,0.08); }
.stat.tint-sage .progress .fill   { background: linear-gradient(90deg, var(--tint-sage-ink),   color-mix(in oklab, var(--tint-sage-ink) 60%, white)); }
.stat.tint-peach .progress .fill  { background: linear-gradient(90deg, var(--tint-peach-ink),  color-mix(in oklab, var(--tint-peach-ink) 60%, white)); }
.stat.tint-butter .progress .fill { background: linear-gradient(90deg, var(--tint-butter-ink), color-mix(in oklab, var(--tint-butter-ink) 60%, white)); }
.stat.tint-lilac .progress .fill  { background: linear-gradient(90deg, var(--tint-lilac-ink),  color-mix(in oklab, var(--tint-lilac-ink) 60%, white)); }

.dash-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(12px, 1.5vw, 20px);
  margin-top: clamp(12px, 1.5vw, 20px);
}
.dash-grid-2-eq {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: clamp(12px, 1.5vw, 20px);
  margin-top: clamp(12px, 1.5vw, 20px);
}
@media (max-width: 980px) {
  .dash-grid-2 { grid-template-columns: 1fr; }
}

/* ----- ACHIEVEMENT BANNER ----- */
.achievement {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 16px; align-items: center;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--tint-sage-bg), var(--tint-butter-bg));
  border: 1px solid color-mix(in oklab, var(--tint-sage-ink) 20%, var(--paper));
  margin-top: 16px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm);
  animation: ach-in 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes ach-in {
  from { opacity: 0; transform: translateY(6px); }
}
.achievement .badge {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--paper);
  display: grid; place-items: center; font-size: 24px;
  box-shadow: var(--shadow-sm);
}
.achievement .ach-title {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 17px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.2; color: var(--tint-sage-ink);
}
.achievement .ach-sub {
  font-size: 13px; color: var(--ink-2); margin-top: 4px;
}

/* ----- WELLNESS TOAST ----- */
.toast-stack {
  position: fixed; top: 18px; right: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}
.toast {
  background: var(--paper);
  border: 1px solid color-mix(in oklab, var(--toast-color, var(--accent)) 25%, var(--line));
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px;
  align-items: start;
  box-shadow: var(--shadow);
  pointer-events: auto;
  opacity: 1;
  animation: toast-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  position: relative; overflow: hidden;
}
.toast::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--toast-color, var(--accent));
}
.toast.leaving { animation: toast-out 0.3s forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}
.toast .t-ic {
  width: 36px; height: 36px; border-radius: 50%;
  background: color-mix(in oklab, var(--toast-color, var(--accent)) 18%, var(--paper));
  color: var(--toast-color, var(--accent));
  display: grid; place-items: center; font-size: 18px;
  flex-shrink: 0;
}
.toast .t-body { min-width: 0; }
.toast .t-title { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 14.5px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; color: var(--toast-color, var(--accent)); }
.toast .t-msg   { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.4; }
.toast .t-actions { display: flex; gap: 6px; margin-top: 10px; }
.toast .t-close {
  width: 26px; height: 26px; border-radius: 7px;
  color: var(--ink-3); display: grid; place-items: center;
  transition: background 0.12s;
}
.toast .t-close:hover { background: var(--paper-2); color: var(--ink); }

.toast.water    { --toast-color: var(--tint-sky-ink); }
.toast.break    { --toast-color: var(--tint-peach-ink); }
.toast.standup  { --toast-color: var(--tint-butter-ink); }
.toast.eyes     { --toast-color: var(--tint-lilac-ink); }
.toast.celebrate { --toast-color: var(--tint-rose-ink); }

@media (max-width: 700px) {
  .toast-stack { left: 12px; right: 12px; max-width: none; top: 12px; }
}


.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--paper);
}
.cal-dow {
  text-align: center; padding: 10px;
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--ink-3);
  background: var(--paper-2);
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
}
.cal-dow:nth-child(7n) { border-right: none; }
.cal-cell {
  min-height: 96px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 9px;
  cursor: pointer;
  position: relative; transition: background 0.1s;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--paper-2); }
.cal-cell.other { color: var(--ink-4); background: var(--bg-2); opacity: 0.55; }
.cal-cell.today { background: linear-gradient(145deg, var(--accent-soft), var(--paper)); }
.cal-cell .cd { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 16px; line-height: 1; font-weight: 500; letter-spacing: -0.02em; }
.cal-cell.today .cd { color: var(--accent); font-weight: 700; }
.cal-cell .dots { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.cal-cell .dots .d { width: 6px; height: 6px; border-radius: 50%; }
.cal-cell .special { position: absolute; top: 8px; right: 10px; font-size: 14px; }
.cal-cell .density {
  position: absolute; bottom: 6px; left: 9px; right: 9px;
  height: 3px; border-radius: 2px;
  background: var(--bg-2);
  overflow: hidden;
}
.cal-cell .density .fill { height: 100%; background: var(--accent); border-radius: 2px; }
@media (max-width: 700px) {
  .cal-cell { min-height: 64px; padding: 6px; }
  .cal-cell .cd { font-size: 14px; }
  .cal-cell .dots .d { width: 4px; height: 4px; }
}

/* ----- FILTER (SAVED VIEWS) ----- */
.filter-layout {
  display: grid;
  grid-template-columns: clamp(240px, 22vw, 300px) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 28px);
}
@media (max-width: 900px) {
  .filter-layout { grid-template-columns: 1fr; }
}
.filter-section { padding: 12px 0; border-bottom: 1px dashed var(--line-2); }
.filter-section:last-child { border: none; }
.filter-section h5 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.10em; color: var(--ink-3); font-weight: 600; }
.filter-opt {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: 8px;
  cursor: pointer; font-size: 13px;
}
.filter-opt:hover { background: var(--paper-2); }
.filter-opt input { accent-color: var(--accent); }
.filter-opt .ct { margin-left: auto; font-size: 11px; color: var(--ink-3); font-family: "JetBrains Mono", monospace; }
.preset {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 11px;
  background: var(--paper); border: 1px solid var(--line);
  margin-bottom: 7px; cursor: pointer; font-size: 12.5px;
  transition: all 0.12s;
}
.preset:hover { background: var(--paper-2); }
.preset.active { background: var(--accent-soft); border-color: var(--accent-3); color: var(--accent); font-weight: 600; }

/* ----- INBOX ----- */
.note-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start;
  margin-bottom: 10px;
  position: relative;
}
.note-card::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px;
  background: var(--accent-3); border-radius: 0 3px 3px 0;
}
.note-card .stamp { font-family: "JetBrains Mono", monospace; font-size: 10px; color: var(--ink-3); margin-bottom: 7px; }
.note-card .body { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 15.5px; line-height: 1.5; letter-spacing: -0.01em; }
.note-actions { display: flex; gap: 4px; align-items: center; opacity: 0.7; transition: opacity 0.12s; }
.note-card:hover .note-actions { opacity: 1; }

/* ----- SPECIAL DATES ----- */
.sd-row {
  display: grid; grid-template-columns: 56px 1fr auto auto; gap: 18px; align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.sd-row:last-child { border-bottom: none; }
.sd-row:hover { background: var(--paper-2); }
.sd-icon {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--accent-wash); display: grid; place-items: center; font-size: 22px;
}
.sd-name { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 15px; font-weight: 600; letter-spacing: -0.025em; }
.sd-when { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.sd-count { font-family: "JetBrains Mono", monospace; font-size: 13px; color: var(--ink-2); text-align: right; }
.sd-count .num { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 26px; color: var(--accent); line-height: 1; font-weight: 600; letter-spacing: -0.03em; }
.sd-count .lbl { font-size: 10px; color: var(--ink-3); display: block; text-transform: uppercase; letter-spacing: 0.08em; }

/* ----- CHARTS ----- */
.bar-row { display: grid; grid-template-columns: 120px 1fr 56px; align-items: center; gap: 12px; padding: 7px 0; }
.bar-row .name { font-size: 12.5px; }
.bar-row .bar { height: 10px; border-radius: 4px; background: var(--bg-2); position: relative; overflow: hidden; }
.bar-row .bar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: linear-gradient(90deg, var(--bar-color, var(--accent)) 0%, color-mix(in oklab, var(--bar-color, var(--accent)) 70%, white) 100%); }
.bar-row .val { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--ink-3); text-align: right; }

/* ----- SETTINGS ----- */
.settings-grid { display: grid; grid-template-columns: 1fr; gap: 18px; max-width: 760px; }
.setting-row {
  display: flex; align-items: center; gap: 18px;
  padding: 16px 0; border-bottom: 1px dashed var(--line-2);
}
.setting-row:last-child { border: none; }
.setting-row .info { flex: 1; }
.setting-row .info .t { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 15px; font-weight: 600; letter-spacing: -0.025em; }
.setting-row .info .d { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.seg {
  display: inline-flex; gap: 0; background: var(--bg-2); border-radius: 11px; padding: 3px;
  border: 1px solid var(--line);
}
.seg button {
  padding: 6px 14px; border-radius: 9px; font-size: 12.5px; font-weight: 500; color: var(--ink-3);
  transition: all 0.12s;
}
.seg button.active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); }

.label-edit {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 8px;
}
.label-swatch {
  width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0;
  cursor: pointer; border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--line);
}
.label-swatch.picking { box-shadow: 0 0 0 2px var(--accent); }
.label-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 14px; padding: 4px 0;
}
.color-picker {
  display: flex; gap: 6px; padding: 8px 10px;
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: 10px; margin: 6px 0 12px;
}
.color-picker .swatch {
  width: 22px; height: 22px; border-radius: 7px; cursor: pointer;
  border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--line);
}

/* misc */
.empty {
  padding: 50px 24px; text-align: center;
  color: var(--ink-3); font-size: 14px;
}
.empty .em-ico { font-size: 36px; margin-bottom: 10px; opacity: 0.6; }
.sm { font-size: 12.5px; color: var(--ink-3); }
.sm-mono { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--ink-3); }

/* scrollbars - subtle */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-4); background-clip: padding-box; border: 2px solid transparent; }

/* ==========================================================
   MOBILE TUNING — phones & small tablets
   ========================================================== */
@media (max-width: 900px) {
  /* keyboard hints are meaningless on touch devices */
  .btn .kbd, .kbd-hint { display: none; }

  /* planner becomes a vertical stack: scrollable backlog above the timeline */
  .planner-side {
    max-height: 32vh;
    border-right: none; border-bottom: 1px solid var(--line);
    padding: 12px 14px;
  }
  .pday-head { padding: 12px 16px; }
}

@media (max-width: 700px) {
  /* topbar: keep title + actions tidy */
  .topbar { min-height: 52px; gap: 10px; }

  /* companion shouldn't crowd the heading — let it sit smaller, inline-flow top-right */
  .companion { right: 12px; top: 0; }
  .companion-orb { width: 56px; height: 56px; }
  .page-title { padding-right: 64px; }

  /* stat cards a touch tighter */
  .stat { padding: 16px; border-radius: var(--radius); }
  .stat .label-ic { top: 14px; right: 14px; width: 24px; height: 24px; }

  /* cards & grids */
  .card .card-h { padding: 12px 14px; }
  .card .card-b { padding: 14px; }

  /* settings: stack the control to the right of each row underneath */
  .setting-row {
    flex-wrap: wrap; gap: 10px;
    grid-template-columns: 1fr !important;
  }
  .setting-row .seg { width: 100%; }
  .setting-row .seg button { flex: 1; }

  /* wellness slider rows stack */
  .setting-row[style*="grid"] { display: flex !important; flex-direction: column; align-items: stretch !important; }

  /* achievement banner stacks the CTA */
  .achievement { grid-template-columns: 44px 1fr; gap: 12px; padding: 14px 16px; }
  .achievement .btn { grid-column: 2; justify-self: start; }

  /* toasts span the width */
  .toast-stack { left: 10px; right: 10px; top: 10px; width: auto; }

  /* special date rows reflow */
  .sd-row { grid-template-columns: 44px 1fr auto; gap: 12px; row-gap: 4px; }
  .sd-row .sd-icon { width: 40px; height: 40px; font-size: 19px; }
  .sd-row > div:last-child { grid-column: 1 / -1; justify-self: end; }

  /* calendar: keep tap targets but compact */
  .cal-cell { min-height: 56px; padding: 5px; }

  /* master-list filter bar: full-width controls */
  .canvas-inner .card-b select,
  .canvas-inner .card-b input[type="date"] { flex: 1 0 auto; }

  /* note cards */
  .note-card { grid-template-columns: 1fr; }
  .note-actions { justify-content: flex-end; }

  /* modal sits a bit higher and fills width */
  .modal-bg { align-items: flex-start; padding-top: 12vh; }
}

/* very small phones */
@media (max-width: 380px) {
  .mobile-nav button { min-width: 54px; font-size: 9.5px; }
  .mobile-nav button svg { width: 19px; height: 19px; }
  .page-title h2 { font-size: 22px; }
}
