/* ============================================================
   Daily Pages — "Almanac" theme  (neo-brutalist)
   Thick borders, hard sticker-shadows, bold flat color,
   Space Grotesk + Inter, graph-paper ground.
   ============================================================ */

:root {
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: #eceaf2;            /* cool light lilac-grey */
  --surface: #ffffff;
  --surface-2: #f3f1f8;
  --ink: #17161c;           /* text + borders + shadows */
  --muted: #6b6976;

  --primary: #3d5afe;       /* electric blue */
  --primary-ink: #ffffff;
  --primary-weak: #d9e0ff;

  --yellow: #ffd23f;
  --yellow-weak: #fff2c4;
  --pink: #ff5c8a;
  --pink-weak: #ffd9e4;
  --success: #16a34a;
  --danger: #ff4d4d;

  --grid: rgba(23, 22, 28, 0.05);
  --shadow-col: var(--ink);
  --edge: var(--ink);       /* border color (skins can soften this) */

  --bw: 2.5px;              /* border width */
  --radius: 12px;
  --radius-sm: 9px;
  --sh: 4px 4px 0 var(--shadow-col);
  --sh-lg: 6px 6px 0 var(--shadow-col);
  /* custom line-icon set (masked, inherit currentColor) — replaces emoji chrome */
  --logomark: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M12%206.5v13'/%3E%3Cpath%20d='M12%206.5C9.4%204.8%205.7%204.8%203.4%205.7v12.6c2.3-.9%206-.9%208.6.8'/%3E%3Cpath%20d='M12%206.5c2.6-1.7%206.3-1.7%208.6-.8v12.6c-2.3-.9-6-.9-8.6.8'/%3E%3C/svg%3E");
  --ic-chart: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M4%2020V11M10%2020V5M16%2020V14'/%3E%3Cpath%20d='M3%2020.5h18'/%3E%3C/svg%3E");
  --ic-download: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M12%204v10'/%3E%3Cpath%20d='M8%2010l4%204%204-4'/%3E%3Cpath%20d='M5%2020h14'/%3E%3C/svg%3E");
  --ic-settings: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M4%208h9'/%3E%3Cpath%20d='M17%208h3'/%3E%3Ccircle%20cx='15'%20cy='8'%20r='2.3'/%3E%3Cpath%20d='M4%2016h4'/%3E%3Cpath%20d='M12%2016h8'/%3E%3Ccircle%20cx='9'%20cy='16'%20r='2.3'/%3E%3C/svg%3E");
  --ic-moon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M21%2012.79%20A%209%209%200%201%201%2011.21%203%20A%207%207%200%200%200%2021%2012.79%20Z'/%3E%3C/svg%3E");
  --ic-sun: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='12'%20cy='12'%20r='4'/%3E%3Cpath%20d='M12%202v2M12%2020v2M2%2012h2M20%2012h2M5%205l1.4%201.4M17.6%2017.6L19%2019M19%205l-1.4%201.4M6.4%2017.6L5%2019'/%3E%3C/svg%3E");
  --ic-edit: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M17%203%20a2.83%202.83%200%200%201%204%204%20L7.5%2020.5%202%2022%20l1.5-5.5%20Z'/%3E%3Cpath%20d='M15%205%20l4%204'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] {
  --bg: #17161b;
  --surface: #232128;
  --surface-2: #2c2a33;
  --ink: #f1efe8;           /* light borders/text on dark */
  --muted: #a09eaa;

  --primary: #7c8cff;
  --primary-ink: #10101a;
  --primary-weak: #34345a;

  --yellow: #ffd23f;
  --yellow-weak: #4a4020;
  --pink: #ff7aa2;
  --pink-weak: #4d2436;
  --success: #4ade80;
  --danger: #ff6b6b;

  --grid: rgba(241, 239, 232, 0.05);
  --shadow-col: #000000;
}

/* ============================================================
   Skin: "Liquid Glass" — modern, serene, frosted glass
   ============================================================ */
:root[data-skin="glass"] {
  --bg: #e7edf7;
  --surface: rgba(255, 255, 255, 0.55);
  --surface-2: rgba(255, 255, 255, 0.38);
  --ink: #1b2436;
  --muted: #5c6780;
  --primary: #5b8def;
  --primary-ink: #ffffff;
  --primary-weak: rgba(91, 141, 239, 0.16);
  --yellow: #ffcf5a;
  --yellow-weak: rgba(255, 207, 90, 0.22);
  --pink: #f472a0;
  --pink-weak: rgba(244, 114, 160, 0.18);
  --success: #22a877;
  --danger: #ef6d6d;
  --grid: transparent;
  --edge: rgba(255, 255, 255, 0.6);
  --shadow-col: rgba(40, 55, 90, 0.18);
  --bw: 1px;
  --radius: 22px;
  --radius-sm: 14px;
  --sh: 0 6px 20px rgba(40, 55, 90, 0.12);
  --sh-lg: 0 16px 44px rgba(40, 55, 90, 0.16);
}
:root[data-skin="glass"][data-theme="dark"] {
  --bg: #0f1420;
  --surface: rgba(42, 50, 74, 0.46);
  --surface-2: rgba(66, 78, 112, 0.34);
  --ink: #e9edf8;
  --muted: #9aa4bd;
  --primary: #8aa5ff;
  --primary-ink: #0f1420;
  --primary-weak: rgba(138, 165, 255, 0.22);
  --yellow: #ffd67a;
  --yellow-weak: rgba(255, 214, 122, 0.16);
  --pink: #ff92b6;
  --pink-weak: rgba(255, 146, 182, 0.2);
  --success: #4fd0a0;
  --danger: #ff8a8a;
  --grid: transparent;
  --edge: rgba(255, 255, 255, 0.14);
  --shadow-col: rgba(0, 0, 0, 0.5);
  --sh: 0 6px 20px rgba(0, 0, 0, 0.35);
  --sh-lg: 0 16px 44px rgba(0, 0, 0, 0.45);
}
/* serene gradient ground */
:root[data-skin="glass"] body {
  background-color: var(--bg);
  background-repeat: no-repeat;
  background-size: cover;
  background-image:
    radial-gradient(60% 55% at 12% 8%, rgba(120, 170, 255, 0.40), transparent 60%),
    radial-gradient(55% 50% at 92% 18%, rgba(186, 150, 255, 0.34), transparent 60%),
    radial-gradient(60% 55% at 75% 98%, rgba(110, 220, 210, 0.30), transparent 60%);
}
:root[data-skin="glass"][data-theme="dark"] body {
  background-image:
    radial-gradient(60% 55% at 12% 8%, rgba(70, 110, 220, 0.45), transparent 60%),
    radial-gradient(55% 50% at 92% 18%, rgba(120, 80, 200, 0.40), transparent 60%),
    radial-gradient(60% 55% at 75% 98%, rgba(40, 150, 150, 0.32), transparent 60%);
}
/* frost the panels */
:root[data-skin="glass"] .card,
:root[data-skin="glass"] .appbar,
:root[data-skin="glass"] .stat,
:root[data-skin="glass"] .feature-card,
:root[data-skin="glass"] .plan-task-group,
:root[data-skin="glass"] .view-toggle,
:root[data-skin="glass"] .view-nav,
:root[data-skin="glass"] .streak-badge,
:root[data-skin="glass"] .dist-chip,
:root[data-skin="glass"] .prompt-chip,
:root[data-skin="glass"] .plan-focus,
:root[data-skin="glass"] .field input,
:root[data-skin="glass"] .compose-input,
:root[data-skin="glass"] .search,
:root[data-skin="glass"] .plan-add-input {
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
}
/* softer, non-brutalist interactions */
:root[data-skin="glass"] .btn:hover { transform: translateY(-1px); box-shadow: var(--sh-lg); }
:root[data-skin="glass"] .btn:active { transform: translateY(0); box-shadow: var(--sh); }
:root[data-skin="glass"] .icon-btn:hover { transform: none; box-shadow: none; background: var(--surface-2); }
:root[data-skin="glass"] .ghost-toggle:hover { transform: none; box-shadow: var(--sh); }
:root[data-skin="glass"] .field input:focus,
:root[data-skin="glass"] .compose-input:focus,
:root[data-skin="glass"] .search:focus,
:root[data-skin="glass"] .plan-add-input:focus,
:root[data-skin="glass"] .plan-focus:focus { transform: none; box-shadow: 0 0 0 3px var(--primary-weak); }
:root[data-skin="glass"] .entry-item:hover,
:root[data-skin="glass"] .cal-cell.selected { transform: none; }
:root[data-skin="glass"] .editor-pane::before { opacity: 0.5; }

/* ============================================================
   Skin: "Retro 95" — classic desktop (teal ground, gray panels,
   3D bevels, navy title bars). Widgets read like program windows.
   ============================================================ */
:root[data-skin="retro"] {
  --font-display: "Tahoma", "MS Sans Serif", Geneva, Verdana, sans-serif;
  --font-body: "Tahoma", "MS Sans Serif", Geneva, Verdana, sans-serif;
  --bg: #008080;            /* iconic desktop teal */
  --surface: #c0c0c0;       /* window gray */
  --surface-2: #d4d0c8;
  --ink: #000000;
  --muted: #40404a;
  --primary: #000080;       /* navy accent */
  --primary-ink: #ffffff;
  --primary-weak: #b0c4de;
  --yellow: #ffea61;
  --yellow-weak: #fff7c4;
  --pink: #c000c0;
  --pink-weak: #edc9ed;
  --success: #008000;
  --danger: #c00000;
  --grid: transparent;      /* solid teal desktop, no graph paper */
  --edge: #808080;
  --shadow-col: #808080;
  --bw: 2px;
  --radius: 0; --radius-sm: 0;
  /* 3D bevels (double-line, like classic window chrome) */
  --raise: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
  --sink:  inset -1px -1px #ffffff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
  --press: inset 1px 1px #0a0a0a, inset -1px -1px #ffffff, inset 2px 2px #808080, inset -2px -2px #dfdfdf;
  --sh: var(--raise);
  --sh-lg: var(--raise);
}
:root[data-skin="retro"][data-theme="dark"] {
  --bg: #1a1a1a;
  --surface: #3c3c3c;
  --surface-2: #4a4a4a;
  --ink: #f0f0f0;
  --muted: #b6b6be;
  --primary: #1084d0;
  --primary-ink: #ffffff;
  --primary-weak: #2a3f5a;
  --edge: #6a6a6a;
  --shadow-col: #000000;
  --raise: inset -1px -1px #000000, inset 1px 1px #6f6f6f, inset -2px -2px #1f1f1f, inset 2px 2px #545454;
  --sink:  inset -1px -1px #6f6f6f, inset 1px 1px #1f1f1f, inset -2px -2px #545454, inset 2px 2px #000000;
  --press: inset 1px 1px #000000, inset -1px -1px #6f6f6f, inset 2px 2px #1f1f1f, inset -2px -2px #545454;
}
/* square everything */
:root[data-skin="retro"] * { border-radius: 0 !important; }
/* solid desktop ground */
:root[data-skin="retro"] body { background-image: none; background-color: var(--bg); }

/* raised panels — drop the flat border, use the bevel */
:root[data-skin="retro"] .card,
:root[data-skin="retro"] .appbar,
:root[data-skin="retro"] .modal-card,
:root[data-skin="retro"] .stat,
:root[data-skin="retro"] .feature-card,
:root[data-skin="retro"] .plan-task-group,
:root[data-skin="retro"] .summary-card,
:root[data-skin="retro"] .streak-badge,
:root[data-skin="retro"] .dist-chip,
:root[data-skin="retro"] .prompt-chip {
  border: none; box-shadow: var(--raise); background: var(--surface);
}
:root[data-skin="retro"] .appbar { border-bottom: 2px solid var(--edge); box-shadow: none; }

/* buttons — raised, and pressed-in when active */
:root[data-skin="retro"] .btn,
:root[data-skin="retro"] .icon-btn,
:root[data-skin="retro"] .ghost-toggle {
  border: none; box-shadow: var(--raise); background: var(--surface); color: var(--ink);
  transition: none;
}
:root[data-skin="retro"] .btn-primary { background: var(--surface); color: var(--ink); }
:root[data-skin="retro"] .btn:hover,
:root[data-skin="retro"] .icon-btn:hover,
:root[data-skin="retro"] .ghost-toggle:hover { transform: none; box-shadow: var(--raise); background: var(--surface); }
:root[data-skin="retro"] .btn:active,
:root[data-skin="retro"] .icon-btn:active,
:root[data-skin="retro"] .ghost-toggle:active { transform: none; box-shadow: var(--press); }
:root[data-skin="retro"] .btn:focus-visible { outline: 1px dotted var(--ink); outline-offset: -4px; }

/* sunken fields */
:root[data-skin="retro"] .field input,
:root[data-skin="retro"] .compose-input,
:root[data-skin="retro"] .search,
:root[data-skin="retro"] .plan-add-input,
:root[data-skin="retro"] .plan-focus,
:root[data-skin="retro"] .list-add-input2 {
  border: none; box-shadow: var(--sink); background: #ffffff; color: #000000; transition: none;
}
:root[data-skin="retro"][data-theme="dark"] .field input,
:root[data-skin="retro"][data-theme="dark"] .compose-input,
:root[data-skin="retro"][data-theme="dark"] .search,
:root[data-skin="retro"][data-theme="dark"] .plan-add-input,
:root[data-skin="retro"][data-theme="dark"] .plan-focus,
:root[data-skin="retro"][data-theme="dark"] .list-add-input2 { background: #2a2a2a; color: #f0f0f0; }
:root[data-skin="retro"] .field input:focus,
:root[data-skin="retro"] .compose-input:focus,
:root[data-skin="retro"] .search:focus,
:root[data-skin="retro"] .plan-add-input:focus,
:root[data-skin="retro"] .plan-focus:focus,
:root[data-skin="retro"] .list-add-input2:focus { transform: none; box-shadow: var(--sink); outline: 1px dotted var(--muted); outline-offset: -4px; }

/* 3-way page switch → sunken well with a raised active "tab" */
:root[data-skin="retro"] .view-toggle { border: none; box-shadow: var(--sink); background: var(--surface); padding: 3px; }
:root[data-skin="retro"] .view-toggle-thumb { border: none; box-shadow: var(--raise); background: var(--surface); }
:root[data-skin="retro"] .view-toggle-opt { color: var(--ink); font-weight: 700; }

/* Lists widgets → program windows: navy title bar + close box */
:root[data-skin="retro"] .list-window { padding: 2px; }
:root[data-skin="retro"] .list-widget-head {
  background: linear-gradient(90deg, #000080, #1084d0); color: #ffffff;
  margin: 0 0 4px; padding: 3px 3px 3px 6px;
}
:root[data-skin="retro"].lists-canvas .list-widget-head,
:root[data-skin="retro"] .lists-canvas .list-widget-head { cursor: grab; }
:root[data-skin="retro"] .list-title { color: #ffffff; font-weight: 700; }
:root[data-skin="retro"] .list-title-edit { color: #000; background: #fff; box-shadow: var(--sink); }
:root[data-skin="retro"] .list-del {
  color: #000; background: var(--surface); box-shadow: var(--raise);
  width: 18px; height: 16px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.72rem;
}
:root[data-skin="retro"] .list-del:hover { background: var(--surface); color: #000; }
:root[data-skin="retro"] .list-del:active { box-shadow: var(--press); }
:root[data-skin="retro"] .list-items { padding: 0 4px; }
:root[data-skin="retro"] .list-add { padding: 0 4px 4px; }

/* checkboxes → sunken white wells with a black tick */
:root[data-skin="retro"] .list-check { border: none; box-shadow: var(--sink); background: #ffffff; }
:root[data-skin="retro"] .list-check.checked { background: #ffffff; }
:root[data-skin="retro"] .list-check.checked::after { color: #000000; }

/* kill the neo-brutalist lift on misc hovers */
:root[data-skin="retro"] .entry-item:hover,
:root[data-skin="retro"] .cal-cell:hover,
:root[data-skin="retro"] .cal-cell.selected,
:root[data-skin="retro"] .feature-card:hover,
:root[data-skin="retro"] .stat:hover { transform: none; }

/* ============================================================
   Skin: "Editorial" — a personal almanac / periodical.
   Warm paper + ink, Newsreader serif over Hanken Grotesk,
   hairline rules, small-caps labels, oxblood accent.
   ============================================================ */
:root[data-skin="editorial"] {
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #f2ede3;            /* warm paper */
  --surface: #fbf8f1;       /* lighter paper for cards */
  --surface-2: #ece4d5;
  --ink: #211d18;           /* warm near-black */
  --muted: #6f6656;
  --primary: #8c2f24;       /* oxblood */
  --primary-ink: #fbf8f1;
  --primary-weak: #ecd7d3;
  --yellow: #b8893a;        /* aged gold */
  --yellow-weak: #efe2c3;
  --pink: #9c4667;
  --pink-weak: #ecd6de;
  --success: #4f6b3a;
  --danger: #a3372b;
  --grid: transparent;
  --edge: #d9cdb6;          /* hairline rule */
  --shadow-col: rgba(60, 50, 35, 0.14);
  --bw: 1px;
  --radius: 4px; --radius-sm: 3px;
  --sh: 0 1px 2px rgba(60, 50, 35, 0.10);
  --sh-lg: 0 10px 34px rgba(60, 50, 35, 0.12);
}
:root[data-skin="editorial"][data-theme="dark"] {
  --bg: #17130d;            /* night edition */
  --surface: #201b13;
  --surface-2: #2a2318;
  --ink: #ece3d2;
  --muted: #a99c85;
  --primary: #d97a63;       /* lighter brick on dark */
  --primary-ink: #17130d;
  --primary-weak: #45291f;
  --yellow: #d3a24e;
  --yellow-weak: #3c3115;
  --success: #8aa86a;
  --danger: #e07a68;
  --grid: transparent;
  --edge: #3a3124;
  --shadow-col: rgba(0, 0, 0, 0.5);
  --sh: 0 1px 2px rgba(0, 0, 0, 0.4);
  --sh-lg: 0 12px 36px rgba(0, 0, 0, 0.5);
}
/* faint paper grain */
:root[data-skin="editorial"] body {
  background-image:
    radial-gradient(rgba(120, 100, 70, 0.05) 0.5px, transparent 0.6px),
    radial-gradient(rgba(120, 100, 70, 0.04) 0.5px, transparent 0.6px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 2px 3px;
}
:root[data-skin="editorial"][data-theme="dark"] body {
  background-image:
    radial-gradient(rgba(255, 240, 210, 0.03) 0.5px, transparent 0.6px),
    radial-gradient(rgba(255, 240, 210, 0.025) 0.5px, transparent 0.6px);
}
/* headings: serif with a little more air */
:root[data-skin="editorial"] h1,
:root[data-skin="editorial"] h2,
:root[data-skin="editorial"] h3,
:root[data-skin="editorial"] .hero-title,
:root[data-skin="editorial"] .entry-date { letter-spacing: -0.01em; font-weight: 600; }
/* cards: flat paper with a hairline, not brutalist offset */
:root[data-skin="editorial"] .card { box-shadow: var(--sh); }
/* buttons: quiet, print-like; no offset shadow, no lift */
:root[data-skin="editorial"] .btn {
  box-shadow: none; border: 1px solid var(--edge); background: var(--surface);
  font-family: var(--font-body); font-weight: 600; letter-spacing: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
:root[data-skin="editorial"] .btn:hover { transform: none; box-shadow: none; background: var(--surface-2); }
:root[data-skin="editorial"] .btn:active { transform: none; box-shadow: none; }
:root[data-skin="editorial"] .btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
:root[data-skin="editorial"] .btn-primary:hover { background: #75261d; color: var(--primary-ink); }
:root[data-skin="editorial"][data-theme="dark"] .btn-primary:hover { background: #e08a74; }
/* inputs: hairline box, quiet focus ring */
:root[data-skin="editorial"] .field input,
:root[data-skin="editorial"] .compose-input,
:root[data-skin="editorial"] .search,
:root[data-skin="editorial"] .plan-add-input,
:root[data-skin="editorial"] .plan-focus,
:root[data-skin="editorial"] .list-add-input2,
:root[data-skin="editorial"] .list-title-edit {
  border: 1px solid var(--edge); box-shadow: none; background: var(--surface); transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
:root[data-skin="editorial"] .field input:focus,
:root[data-skin="editorial"] .compose-input:focus,
:root[data-skin="editorial"] .search:focus,
:root[data-skin="editorial"] .plan-add-input:focus,
:root[data-skin="editorial"] .plan-focus:focus,
:root[data-skin="editorial"] .list-add-input2:focus,
:root[data-skin="editorial"] .list-title-edit:focus { transform: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }
/* page switch: clean segmented control */
:root[data-skin="editorial"] .view-toggle { background: var(--surface-2); border-color: var(--edge); }
:root[data-skin="editorial"] .view-toggle-thumb { background: var(--surface); border: 1px solid var(--edge); box-shadow: var(--sh); }
:root[data-skin="editorial"] .view-toggle-opt { font-family: var(--font-body); }
:root[data-skin="editorial"] .view-toggle[data-view="journal"] .view-toggle-opt[data-view="journal"],
:root[data-skin="editorial"] .view-toggle[data-view="planner"] .view-toggle-opt[data-view="planner"],
:root[data-skin="editorial"] .view-toggle[data-view="lists"] .view-toggle-opt[data-view="lists"] { color: var(--ink); }
/* list windows: title bar as a ruled masthead strip */
:root[data-skin="editorial"] .list-widget-head { border-bottom: 1px solid var(--edge); padding-bottom: 0.35rem; }
:root[data-skin="editorial"] .list-title { font-family: var(--font-display); font-weight: 600; }

* { box-sizing: border-box; }
html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* graph-paper ground painted on the body itself, so it tiles the whole
     page and is captured by full-page screenshots (Firefox included) */
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 26px 26px;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--surface-2);
  border: 1.5px solid var(--edge);
  padding: 0.02em 0.38em;
  border-radius: 5px;
  font-size: 0.88em;
}

.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: var(--bw) solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--sh-lg);
}

/* ---------- Brand ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand.small { font-size: 1.15rem; }
.brand-mark {
  display: inline-block; width: 1.05em; height: 1.05em; flex: none;
  background-color: currentColor;
  -webkit-mask: var(--logomark) center / contain no-repeat;
  mask: var(--logomark) center / contain no-repeat;
}
/* masked line-icons (replace emoji on buttons); each .ic-* sets --_m */
.ic::before {
  content: ""; display: inline-block; width: 1.2em; height: 1.2em; flex: none;
  background-color: currentColor;
  -webkit-mask: var(--_m) center / contain no-repeat;
  mask: var(--_m) center / contain no-repeat;
  vertical-align: -0.2em;
}
.btn.ic { display: inline-flex; align-items: center; }
.btn.ic::before { width: 1.05em; height: 1.05em; margin-right: 0.45em; vertical-align: baseline; }
.ic-chart { --_m: var(--ic-chart); }
.ic-download { --_m: var(--ic-download); }
.ic-settings { --_m: var(--ic-settings); }
.ic-book { --_m: var(--logomark); }
.ic-edit { --_m: var(--ic-edit); }
.ic-theme { --_m: var(--ic-moon); }
:root[data-theme="dark"] .ic-theme { --_m: var(--ic-sun); }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  border: var(--bw) solid var(--edge);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  cursor: pointer;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--sh);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease;
  white-space: nowrap;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--shadow-col); }
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--shadow-col); }
.btn:disabled { opacity: 0.55; cursor: default; box-shadow: var(--sh); transform: none; }
.btn-block { width: 100%; padding: 0.8rem; font-size: 1.05rem; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-danger { background: var(--surface); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* quieter buttons: no border/shadow (logout, back-to-today) */
.btn-ghost {
  font-family: var(--font-display);
  font-weight: 600;
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); transform: none; box-shadow: none; }
.btn-ghost:active { transform: translateY(1px); box-shadow: none; }

.icon-btn {
  font-size: 1.1rem;
  line-height: 1;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: var(--bw) solid transparent;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.08s ease, box-shadow 0.08s ease;
}
.icon-btn:hover { background: var(--surface); border-color: var(--ink); box-shadow: var(--sh); transform: translate(-1px, -1px); }
.icon-btn:active { transform: translate(1px, 1px); box-shadow: 0 0 0; }

/* ---------- Overlay / setup notice ---------- */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 1.5rem; background: var(--bg); }
.overlay-card { max-width: 520px; padding: 2rem; }
.overlay-card h1 { font-family: var(--font-display); font-weight: 700; margin: 1rem 0 0.4rem; }
.steps { padding-left: 1.2rem; line-height: 1.8; }
.steps li { margin-bottom: 0.2rem; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; position: relative; }
.auth-card {
  width: 100%;
  max-width: 410px;
  padding: 2.3rem 2rem;
  text-align: center;
  box-shadow: var(--sh-lg);
  animation: pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.auth-card .brand { justify-content: center; font-size: 1.85rem; }
.tagline { color: var(--muted); margin: 0.5rem 0 1.5rem; font-size: 0.98rem; font-weight: 500; }

.seg {
  display: flex;
  background: var(--surface-2);
  border: var(--bw) solid var(--edge);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 1.4rem;
  gap: 4px;
}
.seg-btn {
  flex: 1;
  font-family: var(--font-display);
  font-weight: 600;
  padding: 0.5rem;
  border: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.seg-btn.is-active { background: var(--yellow); color: #17161c; border-color: var(--ink); }

.field { display: block; text-align: left; margin-bottom: 1rem; }
.field span { display: block; font-family: var(--font-display); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink); margin-bottom: 0.35rem; }
.field input {
  width: 100%;
  font: inherit;
  padding: 0.72rem 0.85rem;
  border: var(--bw) solid var(--edge);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition: box-shadow 0.12s ease, transform 0.08s ease;
}
.field input:focus { outline: none; box-shadow: var(--sh); transform: translate(-1px, -1px); }

.msg { margin: 1rem 0 0; padding: 0.7rem 0.85rem; border-radius: var(--radius-sm); border: var(--bw) solid var(--edge); font-size: 0.9rem; text-align: left; font-weight: 600; }
.msg-err { background: var(--pink-weak); color: var(--ink); }
.msg-ok { background: var(--yellow-weak); color: var(--ink); }

.ghost-toggle {
  position: absolute; top: 1.25rem; right: 1.25rem;
  font-size: 1.2rem; width: 44px; height: 44px;
  background: var(--surface);
  border: var(--bw) solid var(--edge);
  border-radius: 10px;
  box-shadow: var(--sh);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.ghost-toggle:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--shadow-col); }
.ghost-toggle:active { transform: translate(2px, 2px); box-shadow: 0 0 0; }

/* ---------- Topbar ---------- */
/* ---------- Landing (marketing) ---------- */
.landing { min-height: 100dvh; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 1080px; margin: 0 auto; padding: 1rem 1.4rem; }
.landing-nav .brand { font-size: 1.3rem; }
.landing-nav-actions { display: flex; align-items: center; gap: 0.5rem; }
.btn-lg { font-size: 1.05rem; padding: 0.8rem 1.4rem; }

/* Masthead — the front page of the almanac (asymmetric, left-aligned) */
.masthead { max-width: 1080px; margin: 0 auto; padding: 2.2rem 1.4rem 0; }
.masthead-rule { height: 3px; background: var(--ink); }
.masthead-line { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin: 0.55rem 0 0; font-family: var(--font-body); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.masthead-main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 2.4rem; align-items: start; margin-top: 2rem; padding-bottom: 1.8rem; border-bottom: 1px solid var(--edge); }
.masthead-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.4rem, 6.2vw, 4.4rem); line-height: 1.03; letter-spacing: -0.02em; margin: 0; }
.masthead-title em { font-style: italic; color: var(--primary); }
.masthead-sub { font-size: 1.12rem; line-height: 1.65; color: var(--muted); max-width: 46ch; margin: 1.2rem 0 0; }
.masthead-cta { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.6rem; }
.masthead-aside { border-left: 1px solid var(--edge); padding-left: 1.6rem; }
.masthead-aside-label { font-family: var(--font-body); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin-bottom: 0.8rem; }
.masthead-aside-note { font-size: 0.9rem; line-height: 1.55; color: var(--muted); margin: 1rem 0 0; }
.hero-moods { display: flex; gap: 0.5rem; flex-wrap: wrap; color: var(--ink); }

/* Edition — the sections as a ruled contents index (no identical cards, no emoji) */
.edition { max-width: 1080px; margin: 2.8rem auto 0; padding: 0 1.4rem; }
.edition-head { display: flex; align-items: baseline; gap: 1rem; }
.edition-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.12em; margin: 0; white-space: nowrap; }
.edition-rule { flex: 1; height: 1px; background: var(--edge); }
.edition-list { list-style: none; margin: 1.3rem 0 0; padding: 0; }
.edition-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.4rem; align-items: baseline; padding: 1.3rem 0; border-top: 1px solid var(--edge); }
.edition-item:last-child { border-bottom: 1px solid var(--edge); }
.edition-num { font-family: var(--font-display); font-weight: 600; font-size: 1.7rem; color: var(--primary); line-height: 1; font-variant-numeric: tabular-nums; }
.edition-body h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; margin: 0 0 0.35rem; letter-spacing: -0.01em; }
.edition-body p { color: var(--muted); line-height: 1.6; margin: 0; max-width: 62ch; }

.landing-cta { max-width: 800px; margin: 2.8rem auto; padding: 2.6rem 1.4rem; text-align: center; background: var(--primary); color: var(--primary-ink); border: var(--bw) solid var(--edge); border-radius: var(--radius); box-shadow: var(--sh-lg); }
.landing-cta h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.9rem; margin: 0 0 1.3rem; }
.landing-cta .btn { background: var(--surface); color: var(--ink); border-color: var(--ink); }

.landing-foot { max-width: 980px; margin: 0 auto; padding: 1.6rem 1.4rem 2.5rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.8rem; color: var(--muted); font-size: 0.9rem; }

.auth-back { position: absolute; top: 1.25rem; left: 1.25rem; }

.appbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: var(--bw) solid var(--edge); }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; padding: 0.6rem 1.1rem; }
.topbar-left { flex: 1 1 0; display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.topbar-right { flex: 1 1 0; display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; min-width: 0; }

/* Sliding Journal/Planner toggle — one button, animated pill */
.view-toggle {
  position: relative; flex: 0 0 auto; display: inline-flex; align-items: center;
  border: 2px solid var(--edge); background: var(--surface-2); border-radius: 999px;
  padding: 3px; user-select: none;
  font-family: var(--font-display); font-weight: 600; font-size: 0.9rem;
}
.view-toggle-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(33.333% - 2px);
  background: var(--yellow); border: 2px solid var(--edge); border-radius: 999px; z-index: 0;
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.view-toggle[data-view="planner"] .view-toggle-thumb { transform: translateX(100%); }
.view-toggle[data-view="lists"] .view-toggle-thumb { transform: translateX(200%); }
.view-toggle-opt {
  position: relative; z-index: 1; flex: 1 1 0; text-align: center;
  padding: 0.36rem 0.85rem; border: none; background: transparent; cursor: pointer;
  font: inherit; color: var(--muted); white-space: nowrap; transition: color 0.2s ease;
}
.view-toggle[data-view="journal"] .view-toggle-opt[data-view="journal"],
.view-toggle[data-view="planner"] .view-toggle-opt[data-view="planner"],
.view-toggle[data-view="lists"] .view-toggle-opt[data-view="lists"] { color: #17161c; }
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 2px solid var(--edge); background: var(--primary); color: var(--primary-ink); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; box-shadow: var(--sh); }
.streak-badge {
  display: inline-flex; align-items: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: 0.95rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--yellow); color: #17161c;
  border: 2px solid var(--edge);
}
.user-menu { display: flex; align-items: center; gap: 0.5rem; }
.user-email { color: var(--muted); font-size: 0.85rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Layout ---------- */
.layout {
  max-width: 1080px; margin: 0 auto;
  padding: 1.5rem 1.1rem 3rem;
  display: grid; grid-template-columns: minmax(0, 1fr) 330px;
  gap: 1.25rem; align-items: start;
}

/* ---------- Editor ---------- */
.editor-pane { padding: 1.7rem 1.8rem; display: flex; flex-direction: column; min-height: 70vh; min-width: 0; }
.editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.entry-daylabel {
  display: inline-block;
  font-family: var(--font-display); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--yellow); color: #17161c;
  border: 2px solid var(--edge); border-radius: 5px;
  padding: 0.12em 0.45em;
}
.entry-date { font-family: var(--font-display); font-weight: 700; font-size: 1.75rem; letter-spacing: -0.02em; margin: 0.4rem 0 0; }

.prompt-chip {
  margin-top: 1.1rem;
  padding: 0.75rem 0.95rem;
  background: var(--yellow-weak);
  border: var(--bw) solid var(--edge);
  border-radius: var(--radius-sm);
  box-shadow: var(--sh);
  color: var(--ink);
  font-weight: 500;
  font-size: 0.96rem;
  transform: rotate(-1deg);
}

.mood-block { display: flex; align-items: center; gap: 0.75rem; margin: 1.4rem 0 0.3rem; flex-wrap: wrap; }
.mood-label { font-family: var(--font-display); font-size: 0.82rem; color: var(--ink); font-weight: 600; }
.mood-row { display: flex; gap: 0.4rem; }
.mood-btn {
  width: 46px; height: 46px;
  border-radius: 12px;
  border: var(--bw) solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: all 0.12s ease;
}
.mood-btn .mood-face { opacity: 0.65; transition: opacity 0.12s ease, transform 0.12s ease; }
.mood-btn:hover { background: var(--surface-2); border-color: var(--ink); }
.mood-btn:hover .mood-face { opacity: 1; }
.mood-btn.active { background: var(--primary-weak); border-color: var(--ink); box-shadow: var(--sh); }
.mood-btn.active .mood-face { opacity: 1; }
.mood-face { display: block; color: var(--ink); }
.mood-face-wrap { display: inline-flex; align-items: center; }

.entry-title {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 600;
  border: none; background: transparent; color: var(--ink);
  padding: 1.1rem 0 0.6rem; margin-top: 0.7rem;
  border-bottom: 2px solid var(--edge);
}
.entry-title:focus { outline: none; }
.entry-title::placeholder { color: var(--muted); opacity: 0.6; }

.entry-content {
  flex: 1; min-height: 320px; resize: vertical;
  border: none; background: transparent; color: var(--ink);
  font-family: var(--font-body); font-size: 1.1rem; line-height: 1.75;
  padding: 1rem 0 0; margin-top: 0.3rem;
}
.entry-content:focus { outline: none; }
.entry-content::placeholder { color: var(--muted); opacity: 0.6; }

.editor-foot { display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; padding-top: 0.9rem; border-top: 2px dashed var(--edge); }
.wordcount { font-family: var(--font-display); font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.save-status { font-family: var(--font-display); font-size: 0.82rem; color: var(--muted); font-weight: 600; transition: color 0.2s ease; }
.save-status.saved { color: var(--success); }

/* ---------- Sidebar ---------- */
.side { display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: 74px; }

/* stats become three separate chunky boxes */
.stats { background: transparent; border: none; box-shadow: none; border-radius: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; padding: 0; }
.stat { background: var(--surface); border: var(--bw) solid var(--edge); border-radius: var(--radius-sm); box-shadow: var(--sh); padding: 0.8rem 0.3rem; text-align: center; }
.stat-num { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--primary); line-height: 1.1; }
.stat-label { font-family: var(--font-display); font-size: 0.66rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }

/* Calendar */
.calendar { padding: 1.1rem 1.2rem 1.3rem; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.cal-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-family: var(--font-display); font-size: 0.66rem; color: var(--muted); font-weight: 600; margin-bottom: 0.4rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  position: relative; aspect-ratio: 1 / 1;
  border: 2px solid transparent; background: transparent;
  border-radius: 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font: inherit; color: var(--ink); padding: 0;
  transition: background 0.1s ease, border-color 0.1s ease, transform 0.08s ease, box-shadow 0.08s ease;
}
.cal-cell.empty { cursor: default; }
.cal-cell:not(.empty):not(.future):hover { background: var(--surface-2); border-color: var(--ink); }
.cal-day { font-family: var(--font-display); font-size: 0.8rem; font-weight: 500; }
.cal-cell.has { background: var(--primary-weak); border-color: var(--ink); }
.cal-cell.has .cal-day { font-weight: 700; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--edge); }
.cal-cell.today { background: var(--yellow); border-color: var(--ink); }
.cal-cell.selected { border-color: var(--ink); box-shadow: inset 0 0 0 2.5px var(--ink); }
.cal-cell.future { color: var(--muted); opacity: 0.4; cursor: default; }

/* Entries list */
.entries { padding: 1.1rem 1.1rem 1.2rem; }
.search {
  width: 100%; font: inherit; padding: 0.6rem 0.8rem;
  border: var(--bw) solid var(--edge); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); margin-bottom: 0.8rem;
  transition: box-shadow 0.12s ease, transform 0.08s ease;
}
.search:focus { outline: none; box-shadow: var(--sh); transform: translate(-1px, -1px); }
.entries-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 360px; overflow-y: auto; padding: 2px; }
.entry-item {
  text-align: left; border: 2px solid var(--edge); background: var(--surface);
  border-radius: var(--radius-sm); padding: 0.6rem 0.7rem; cursor: pointer;
  font: inherit; color: var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease;
}
.entry-item:hover { transform: translate(-1px, -1px); box-shadow: var(--sh); }
.entry-item.active { background: var(--yellow-weak); box-shadow: var(--sh); }
.entry-item-top { display: flex; align-items: center; gap: 0.4rem; }
.entry-item-mood { display: inline-flex; align-items: center; }
.entry-item-date { font-family: var(--font-display); font-size: 0.7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.entry-item-title { font-family: var(--font-display); font-weight: 600; margin-top: 0.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-item-preview { font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-hint { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 1.3rem 0.5rem; font-weight: 500; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 0.7rem 1.15rem; border-radius: 999px;
  font-family: var(--font-display); font-size: 0.9rem; font-weight: 600;
  border: 2px solid var(--edge); box-shadow: 4px 4px 0 var(--primary);
  z-index: 50;
}

/* ---------- Insights / review modal ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 1.2rem; background: rgba(0, 0, 0, 0.5); animation: fade 0.15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card { width: 100%; max-width: 640px; max-height: 90vh; padding: 0; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--sh-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.3rem; border-bottom: var(--bw) solid var(--edge); }
.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; margin: 0; }
.period-seg { margin: 1.1rem 1.3rem 0; }
.period-btn { flex: 1; font-family: var(--font-display); font-weight: 600; padding: 0.5rem; border: 2px solid transparent; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer; transition: all 0.12s ease; }
.period-btn.is-active { background: var(--primary); color: var(--primary-ink); border-color: var(--ink); }
.modal-scroll { overflow-y: auto; padding: 1.2rem 1.3rem 1.4rem; }
.insights-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; }
.insights-section { margin-top: 1.4rem; }
.insights-h { font-family: var(--font-display); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 0 0 0.6rem; }
.mood-chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding: 0.6rem; border: var(--bw) solid var(--edge); border-radius: var(--radius-sm); background: var(--surface-2); }
.mood-col { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; }
.mood-col.future { opacity: 0.3; }
.mood-fill { width: 100%; border: 1.5px solid var(--edge); border-radius: 4px 4px 0 0; min-height: 4px; }
.mood-dist { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.dist-chip { display: inline-flex; align-items: center; gap: 0.35rem; border: 2px solid var(--edge); border-radius: 999px; padding: 0.25rem 0.65rem; background: var(--surface); box-shadow: var(--sh); font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; }
.dist-chip .emoji { font-size: 1.05rem; }
.summary-box { border: var(--bw) solid var(--edge); border-radius: var(--radius-sm); background: var(--yellow-weak); padding: 0.9rem 1rem; line-height: 1.6; box-shadow: var(--sh); }
#ai-summary-wrap { margin-top: 0.9rem; }
.summary-box.ai { background: var(--primary-weak); margin-top: 0.8rem; }

/* ---------- Planner ---------- */
.planner { max-width: 680px; margin: 0 auto; padding: 1.5rem 1.1rem 3rem; }
.planner-pane { padding: 1.7rem 1.8rem; }
.planner-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.planner-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.plan-nav { display: flex; align-items: center; gap: 0.2rem; }
.mini-spinner { width: 16px; height: 16px; margin-left: 0.2rem; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: dp-spin 0.6s linear infinite; }
@keyframes dp-spin { to { transform: rotate(360deg); } }
.plan-progress { font-family: var(--font-display); font-weight: 700; font-size: 0.85rem; background: var(--primary-weak); border: 2px solid var(--edge); border-radius: 999px; padding: 0.28rem 0.7rem; white-space: nowrap; }
.plan-setup { margin-top: 1.2rem; border: var(--bw) solid var(--edge); border-radius: var(--radius-sm); background: var(--yellow-weak); padding: 1rem 1.1rem; box-shadow: var(--sh); line-height: 1.6; }
.plan-focus-label { display: block; font-family: var(--font-display); font-weight: 700; margin: 1.4rem 0 0.5rem; }
.plan-focus { width: 100%; font: inherit; font-size: 1.1rem; padding: 0.8rem 0.9rem; border: var(--bw) solid var(--edge); border-radius: var(--radius-sm); background: var(--yellow-weak); color: var(--ink); box-shadow: var(--sh); transition: transform 0.08s ease, box-shadow 0.08s ease; }
.plan-focus:focus { outline: none; transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--shadow-col); }
.plan-focus::placeholder { color: var(--muted); }
.plan-todo-head { display: flex; align-items: center; justify-content: space-between; margin: 1.7rem 0 0.7rem; }
.plan-h { font-family: var(--font-display); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 700; }
.plan-list { display: flex; flex-direction: column; gap: 0.5rem; }
.plan-task-group { border: 2px solid var(--edge); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--sh); padding: 0.4rem 0.5rem; }
.plan-item { display: flex; align-items: center; gap: 0.55rem; }
.plan-subadd-btn { flex: none; border: none; background: transparent; color: var(--muted); cursor: pointer; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; line-height: 1; padding: 0.15rem 0.4rem; border-radius: 6px; }
.plan-subadd-btn:hover { color: var(--primary); background: var(--surface-2); }
.plan-subs { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.45rem 0 0.15rem 34px; }
.plan-sub { display: flex; align-items: center; gap: 0.5rem; }
.plan-sub.done .plan-text { text-decoration: line-through; color: var(--muted); }
.plan-check.sub { width: 20px; height: 20px; border-radius: 6px; }
.plan-check.sub.checked::after { font-size: 0.78rem; }
.plan-text.sub { font-size: 0.92rem; }
.plan-check { flex: none; width: 26px; height: 26px; border: 2px solid var(--edge); border-radius: 7px; background: var(--surface); cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; padding: 0; }
.plan-check.checked { background: var(--primary); }
.plan-check.checked::after { content: "✓"; color: var(--primary-ink); font-family: var(--font-display); font-weight: 800; font-size: 0.95rem; }
.plan-text { flex: 1; min-width: 0; font: inherit; font-size: 1rem; border: none; background: transparent; color: var(--ink); padding: 0.3rem 0.2rem; }
.plan-text:focus { outline: none; }
.plan-item.done .plan-text { text-decoration: line-through; color: var(--muted); }
.plan-del { flex: none; border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 0.95rem; padding: 0.25rem 0.45rem; border-radius: 6px; line-height: 1; }
.plan-del:hover { color: var(--danger); background: var(--surface-2); }
.plan-empty { color: var(--muted); padding: 0.9rem 0.2rem; }
.plan-add { display: flex; gap: 0.5rem; margin-top: 0.9rem; }
.plan-add-input { flex: 1; min-width: 0; font: inherit; padding: 0.65rem 0.8rem; border: var(--bw) solid var(--edge); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); transition: transform 0.08s ease, box-shadow 0.08s ease; }
.plan-add-input:focus { outline: none; box-shadow: var(--sh); transform: translate(-1px, -1px); }
.plan-add-input::placeholder { color: var(--muted); }
.plan-add-btn { flex: none; }

/* ---------- Journal: timestamped feed + compose ---------- */
.editor-head-actions { display: flex; align-items: center; gap: 0.4rem; flex: none; }
.entry-feed { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 1rem; }
.feed-empty { color: var(--muted); padding: 0.8rem 0.2rem; }
.feed-entry { border-left: 3px solid var(--edge); padding: 0 0 0 0.9rem; }
.feed-head { display: flex; align-items: center; gap: 0.5rem; }
.feed-time { font-family: var(--font-display); font-weight: 700; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink); background: var(--primary-weak); border: 2px solid var(--edge); border-radius: 999px; padding: 0.08rem 0.55rem; }
.feed-del { margin-left: auto; border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 0.85rem; padding: 0.15rem 0.35rem; border-radius: 6px; line-height: 1; }
.feed-del:hover { color: var(--danger); background: var(--surface-2); }
.feed-text { width: 100%; border: none; background: transparent; color: var(--ink); font-family: var(--font-body); font-size: 1.05rem; line-height: 1.65; resize: none; overflow: hidden; padding: 0.35rem 0 0.1rem; margin: 0; }
.feed-text:focus { outline: none; }

.prev-peek { border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 0.7rem 0.85rem; background: var(--surface-2); }
.prev-peek-label { font-family: var(--font-display); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; margin-bottom: 0.3rem; }
.prev-peek-text { color: var(--muted); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.compose { margin-top: 1.2rem; border-top: 2px dashed var(--edge); padding-top: 1rem; }
.compose-input { width: 100%; min-height: 72px; font: inherit; font-size: 1.05rem; line-height: 1.6; padding: 0.7rem 0.8rem; border: var(--bw) solid var(--edge); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); resize: none; overflow: hidden; transition: box-shadow 0.1s ease, transform 0.08s ease; }
.compose-input:focus { outline: none; box-shadow: var(--sh); transform: translate(-1px, -1px); }
.compose-input::placeholder { color: var(--muted); }
.compose-foot { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.6rem; }
.compose-hint { font-family: var(--font-display); font-size: 0.72rem; color: var(--muted); }

/* ---------- Settings ---------- */
.skin-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 0.7rem; }
.skin-option { text-align: left; border: var(--bw) solid var(--edge); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--sh); padding: 0.8rem; cursor: pointer; display: flex; flex-direction: column; }
.skin-option.active { outline: 3px solid var(--primary); outline-offset: 1px; }
.skin-swatch { height: 46px; border-radius: 9px; margin-bottom: 0.55rem; }
.skin-swatch-almanac { background: #ffd23f; border: 2px solid #17161c; box-shadow: 3px 3px 0 #17161c; }
.skin-swatch-glass { background: linear-gradient(135deg, rgba(120, 170, 255, 0.8), rgba(186, 150, 255, 0.65)); border: 1px solid rgba(255, 255, 255, 0.75); box-shadow: 0 6px 16px rgba(40, 55, 90, 0.22); }
.skin-swatch-retro { background: linear-gradient(#000080 0 34%, #c0c0c0 34% 100%); border-radius: 0; border: 2px solid; border-color: #ffffff #808080 #808080 #ffffff; }
.skin-swatch-editorial {
  background-color: #f4efe5;
  background-image: linear-gradient(#8c2f24, #8c2f24), repeating-linear-gradient(#cabfa8 0 1px, transparent 1px 5px);
  background-size: 58% 3px, 100% 100%;
  background-position: 9px 9px, 0 20px;
  background-repeat: no-repeat, no-repeat;
  border: 1px solid #cdbca0;
}
.skin-name { font-family: var(--font-display); font-weight: 700; }
.skin-desc { font-size: 0.82rem; color: var(--muted); }
.mode-btn { flex: 1; font-family: var(--font-display); font-weight: 600; padding: 0.5rem; border: 2px solid transparent; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; }
.mode-btn.active { background: var(--surface); color: var(--ink); box-shadow: var(--sh); }

/* ---------- Weekly reflection popup ---------- */
.summary-sub { font-family: var(--font-display); font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }
.summary-reflection { font-family: var(--font-body); font-size: 1.08rem; line-height: 1.72; white-space: pre-wrap; }
.summary-foot { padding: 0.9rem 1.3rem; border-top: var(--bw) solid var(--edge); display: flex; justify-content: flex-end; }

/* ---------- Reader mode ---------- */
.reader { max-width: 720px; margin: 0 auto; padding: 1.5rem 1.1rem 4rem; }
.reader-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.reader-title { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; margin: 0; }
.reader-body { display: flex; flex-direction: column; gap: 2rem; }
.reader-day { border-top: 2px solid var(--edge); padding-top: 1rem; }
.reader-date { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; margin: 0 0 0.9rem; }
.reader-entry { margin-bottom: 1.3rem; }
.reader-time { font-family: var(--font-display); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.3rem; }
.reader-text { font-family: var(--font-body); font-size: 1.12rem; line-height: 1.75; white-space: pre-wrap; }

/* ---------- Lists dashboard ---------- */
.lists-page { max-width: 1120px; margin: 0 auto; padding: 1.2rem 1.1rem 3rem; }
.lists-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.lists-title { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; margin: 0; }
/* Desktop: free-floating "windows" dragged/dropped anywhere on a canvas */
.lists-canvas { position: relative; min-height: 70vh; }
.lists-canvas .list-window { position: absolute; }
.list-window { display: flex; flex-direction: column; overflow: hidden; padding: 0.55rem 0.7rem 0.7rem; }
.list-window.dragging { user-select: none; }
/* Mobile: a tidy single-column stack, no dragging */
.lists-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.9rem; align-items: start; }
.lists-stack .list-window { position: static; width: auto !important; height: auto !important; min-height: 220px; }
.lists-stack .list-resize { display: none; }
/* corner resize handle */
.list-resize { position: absolute; right: 0; bottom: 0; width: 20px; height: 20px; cursor: se-resize; touch-action: none; z-index: 2; }
.list-resize::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); opacity: 0.55; }

.list-widget-head { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; }
.lists-canvas .list-widget-head { cursor: grab; touch-action: none; }
.lists-canvas .list-window.dragging .list-widget-head { cursor: grabbing; }
.list-title-wrap { flex: 1; min-width: 0; display: flex; }
.list-title { flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; color: var(--ink); padding: 0.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-title-edit { flex: 1; min-width: 0; font: inherit; font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; border: none; background: var(--surface-2); color: var(--ink); padding: 0.2rem; border-radius: 5px; }
.list-title-edit:focus { outline: none; box-shadow: 0 0 0 2px var(--primary-weak); }
.list-del { flex: none; border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 0.85rem; padding: 0.15rem 0.4rem; border-radius: 6px; line-height: 1; }
.list-del:hover { color: var(--danger); background: var(--surface-2); }
.list-items { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.3rem; padding-right: 0.15rem; }
.list-item { display: flex; align-items: center; gap: 0.4rem; }
.list-item.done .list-item-text { text-decoration: line-through; color: var(--muted); }
.list-check { flex: none; width: 18px; height: 18px; border: 2px solid var(--edge); border-radius: 5px; background: var(--surface); cursor: pointer; padding: 0; }
.list-check.checked { background: var(--primary); }
.list-check.checked::after { content: "✓"; display: block; text-align: center; line-height: 14px; font-size: 0.72rem; color: var(--primary-ink); }
.list-item-text { flex: 1; min-width: 0; font: inherit; font-size: 0.9rem; border: none; background: transparent; color: var(--ink); padding: 0.15rem; }
.list-item-text:focus { outline: none; }
.list-item-del { flex: none; border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 0.72rem; padding: 0.1rem 0.3rem; opacity: 0.55; }
.list-item-del:hover { color: var(--danger); opacity: 1; }
.list-add { margin-top: 0.45rem; display: flex; }
.list-add-input2 { flex: 1; min-width: 0; font: inherit; font-size: 0.85rem; padding: 0.4rem 0.55rem; border: 1.5px solid var(--edge); border-radius: 8px; background: var(--surface); color: var(--ink); }
.list-add-input2:focus { outline: none; box-shadow: 0 0 0 3px var(--primary-weak); }

/* ============================================================
   "Sanctuary" skin  +  the two-column Journal workspace
   Warm-soft minimalism: Plus Jakarta Sans, mineral navy on
   porcelain, hairline borders, ultra-diffused shadows.
   (Replaces the old open-notebook journal.)
   ============================================================ */

/* ---------- Sanctuary skin tokens ---------- */
:root[data-skin="sanctuary"] {
  --font-display: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --bg: #f7f7f5;            /* warm porcelain (per reference) */
  --surface: #ffffff;
  --surface-2: #efeee9;     /* warm light grey */
  --ink: #1e293b;
  --muted: #64748b;

  --primary: #1b3b5f;
  --primary-ink: #ffffff;
  --primary-weak: #eef3f8;

  --edge: #e7e5df;          /* warm hairline */
  --grid: transparent;
  --shadow-col: transparent;

  --bw: 1px;
  --radius: 16px;
  --radius-sm: 12px;
  --sh: 0 1px 3px rgba(60, 55, 45, 0.05);
  --sh-lg: 0 8px 24px -4px rgba(60, 55, 45, 0.08), 0 2px 8px -2px rgba(60, 55, 45, 0.05);

  /* journal-specific */
  --dpj-navy: #1b3b5f;
  --dpj-ink: #1e293b;
  --dpj-muted: #64748b;
  --dpj-faint: #94a3b8;
  --dpj-line: #e6e4dd;
  --dpj-divider: #efede7;
  --dpj-cardline: #e2e0d8;
  --dpj-editorline: #e0ddd3;
  --dpj-side-bg: #f7f7f5;
  --dpj-pill: #efeee8;
  --dpj-pill-hover: #e8e6de;
  --dpj-avatar-bg: #e7e4dd;
  --dpj-avatar-ink: #475569;
  --dpj-menu-hover: #f2f1ec;
}
:root[data-skin="sanctuary"][data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #24344a;
  --ink: #e2e8f0;
  --muted: #94a3b8;

  --primary: #9ec1e6;
  --primary-ink: #0f172a;
  --primary-weak: #1e2f45;

  --edge: #263449;
  --sh: 0 1px 3px rgba(0, 0, 0, 0.35);
  --sh-lg: 0 10px 30px -6px rgba(0, 0, 0, 0.5);

  --dpj-navy: #cfe0f2;
  --dpj-ink: #e2e8f0;
  --dpj-muted: #94a3b8;
  --dpj-faint: #64748b;
  --dpj-line: #263449;
  --dpj-divider: #1c2940;
  --dpj-cardline: #2a3b54;
  --dpj-editorline: #2a3b54;
  --dpj-side-bg: #0f172a;
  --dpj-pill: #1e2f45;
  --dpj-pill-hover: #26384f;
  --dpj-avatar-bg: #334155;
  --dpj-avatar-ink: #e2e8f0;
  --dpj-menu-hover: #24344a;
}
:root[data-skin="sanctuary"] body {
  background-image: none;
  background-color: var(--bg);
}
:root[data-skin="sanctuary"] .appbar { background: var(--bg); box-shadow: none; }

/* ============================================================
   Header chrome (token-driven so every skin can wear it)
   ============================================================ */
.appbar { position: sticky; top: 0; z-index: 40; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: 0.65rem 1.5rem; flex-wrap: nowrap; max-width: 1280px; width: 100%; margin: 0 auto; }
.topbar-left { flex: 1 1 0; min-width: 0; }
.topbar-right { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; }

.brand-wave { width: 1.7rem; height: 1.7rem; flex: none; color: var(--primary); }
.brand.small { font-size: 1.06rem; font-weight: 700; letter-spacing: -0.01em; color: var(--primary); gap: 0.55rem; }
.brand.small .brand-name { color: var(--primary); }

/* Nav tabs (reuse #view-toggle / .view-toggle-opt ids used by JS) */
.view-toggle {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 2rem;
  border: none; background: transparent; border-radius: 0; padding: 0;
  font-family: var(--font-display); font-weight: 600; font-size: 0.9rem;
}
.view-toggle-thumb { display: none; }
.view-toggle-opt {
  position: relative; flex: none; padding: 0.3rem 0; border: none; background: transparent;
  cursor: pointer; font: inherit; font-weight: 500; color: var(--muted);
  transition: color 0.15s ease;
}
.view-toggle-opt::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -0.5rem; height: 2.5px;
  border-radius: 999px; background: var(--primary); opacity: 0; transition: opacity 0.15s ease;
}
.view-toggle-opt:hover { color: var(--primary); }
.view-toggle[data-view="journal"] .view-toggle-opt[data-view="journal"],
.view-toggle[data-view="planner"] .view-toggle-opt[data-view="planner"],
.view-toggle[data-view="lists"] .view-toggle-opt[data-view="lists"] { color: var(--primary); font-weight: 700; }
.view-toggle[data-view="journal"] .view-toggle-opt[data-view="journal"]::after,
.view-toggle[data-view="planner"] .view-toggle-opt[data-view="planner"]::after,
.view-toggle[data-view="lists"] .view-toggle-opt[data-view="lists"]::after { opacity: 1; }

/* Search icon button */
.topbar-icon {
  width: 38px; height: 38px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--muted); border-radius: 10px; cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.topbar-icon svg { width: 20px; height: 20px; }
.topbar-icon:hover { color: var(--primary); background: var(--surface-2); }

/* Writing-streak pill (top bar, beside search) */
.topbar-streak {
  display: inline-flex; align-items: center; gap: 0.28rem; flex: none;
  font-family: var(--font-display); font-weight: 600; font-size: 0.8rem; color: var(--muted);
  padding: 0.32rem 0.62rem; border-radius: 999px; background: var(--surface-2); white-space: nowrap;
}
.topbar-streak .streak-flame { font-size: 0.85rem; line-height: 1; }

/* Avatar + dropdown menu */
.user-menu { position: relative; display: flex; align-items: center; }
.avatar-btn { border: none; background: transparent; padding: 0; cursor: pointer; border-radius: 50%; }
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%; border: none;
  background: var(--dpj-avatar-bg, var(--surface-2)); color: var(--dpj-avatar-ink, var(--ink));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600; font-size: 0.8rem;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}
.avatar-btn:hover .avatar { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04), 0 0 0 3px var(--primary-weak); }

.user-dropdown {
  position: absolute; top: calc(100% + 0.6rem); right: 0; z-index: 60;
  min-width: 232px; padding: 0.4rem; display: flex; flex-direction: column; gap: 1px;
  background: var(--surface); border: 1px solid var(--edge); border-radius: 14px; box-shadow: var(--sh-lg);
}
.user-dropdown-head { padding: 0.55rem 0.65rem 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.user-dropdown-email { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown .streak-badge {
  align-self: flex-start; display: inline-flex; align-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 0.74rem;
  padding: 0.16rem 0.55rem; border-radius: 999px; border: none;
  background: var(--primary-weak); color: var(--primary);
}
.menu-item {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left;
  padding: 0.55rem 0.65rem; border: none; background: transparent; border-radius: 9px; cursor: pointer;
  font-family: var(--font-display); font-weight: 500; font-size: 0.88rem; color: var(--ink);
  transition: background 0.12s ease;
}
.menu-item:hover { background: var(--dpj-menu-hover, var(--surface-2)); }
.menu-item .ic::before { width: 1.05rem; height: 1.05rem; opacity: 0.8; }
.menu-sep { height: 1px; background: var(--edge); margin: 0.25rem 0.4rem; }

/* ============================================================
   Journal — two-column writing workspace
   ============================================================ */
#journal-view.dpj {
  display: block; padding: 0; min-height: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--dpj-ink, var(--ink));
}
.dpj-wrap { display: flex; max-width: 1280px; width: 100%; margin: 0 auto; align-items: stretch; }
.dpj-main { flex: 1 1 auto; min-width: 0; max-width: 56rem; padding: 2rem 2rem 3rem; }
@media (min-width: 1024px) { .dpj-main { padding: 2rem 3.5rem 3rem; } }

.dpj-h { font-size: 0.875rem; font-weight: 600; color: var(--dpj-navy, var(--primary)); margin: 0 0 1rem; }

/* Date bar */
.dpj-datebar { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 2.5rem; }
.dpj-date-left { display: flex; align-items: flex-start; gap: 0.75rem; min-width: 0; }
.dpj-navback {
  margin-top: 0.9rem; padding: 0.25rem; border: none; background: transparent; cursor: pointer;
  color: var(--dpj-muted, var(--muted)); display: inline-flex; transition: color 0.15s ease;
}
.dpj-navback svg { width: 1rem; height: 1rem; }
.dpj-navback:hover { color: var(--dpj-navy, var(--primary)); }
.dpj-weekday { display: block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.01em; color: var(--dpj-muted, var(--muted)); margin-bottom: 0.15rem; }
.dpj-date { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; color: var(--dpj-navy, var(--primary)); margin: 0; line-height: 1.15; }

.dpj-date-actions { display: flex; align-items: center; gap: 0.5rem; flex: none; }
.dpj-today {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.8rem;
  font-family: inherit; font-size: 0.75rem; font-weight: 500; color: var(--dpj-avatar-ink, var(--muted));
  background: var(--dpj-pill, var(--surface-2)); border: none; border-radius: 999px; cursor: pointer;
  transition: background 0.15s ease;
}
.dpj-today svg { width: 0.85rem; height: 0.85rem; }
.dpj-today:hover { background: var(--dpj-pill-hover, var(--surface-2)); }
.dpj-dayarrow {
  padding: 0.35rem; border: none; background: transparent; cursor: pointer; color: var(--dpj-muted, var(--muted));
  display: inline-flex; border-radius: 8px; transition: color 0.15s ease, background 0.15s ease;
}
.dpj-dayarrow svg { width: 0.9rem; height: 0.9rem; }
.dpj-dayarrow:hover { color: var(--dpj-navy, var(--primary)); }
.dpj-dayarrow:disabled { opacity: 0.35; cursor: default; }

/* Mood selector */
.dpj-mood { margin-bottom: 3rem; }
.dpj-mood-row { display: flex; align-items: flex-start; gap: 2rem; padding-left: 0.25rem; flex-wrap: wrap; }
.dpj-mood-row .mood-btn {
  --m: #86ce9b;
  position: relative; width: auto; height: auto; padding: 0; border: none; background: transparent;
  display: flex; flex-direction: column; align-items: center; gap: 0; cursor: pointer; box-shadow: none;
}
.dpj-mood-glyph { position: relative; width: 3rem; height: 3rem; display: flex; align-items: center; justify-content: center; transition: transform 0.15s ease; }
.dpj-mood-row .mood-btn:hover .dpj-mood-glyph { transform: scale(1.06); }
.dpj-mood-glyph svg { width: 3rem; height: 2.75rem; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.05)); }
.dpj-mood-num { margin-top: 0.5rem; font-size: 0.75rem; font-weight: 600; color: var(--dpj-muted, var(--muted)); line-height: 1.25rem; }
/* selected */
.dpj-mood-row .mood-btn.active .dpj-mood-glyph::before {
  content: ""; position: absolute; inset: -0.6rem; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--m), transparent 45%);
  background: color-mix(in srgb, var(--m), transparent 86%); z-index: -1;
}
.dpj-mood-row .mood-btn.active .dpj-mood-glyph::after {
  content: ""; position: absolute; top: -0.75rem; left: 50%; width: 1.4rem; height: 0.5rem; transform: translateX(-50%);
  background:
    linear-gradient(color-mix(in srgb, var(--m), black 5%), color-mix(in srgb, var(--m), black 5%)) 0 0 / 2px 0.5rem no-repeat,
    linear-gradient(color-mix(in srgb, var(--m), black 5%), color-mix(in srgb, var(--m), black 5%)) 50% -0.1rem / 2px 0.55rem no-repeat,
    linear-gradient(color-mix(in srgb, var(--m), black 5%), color-mix(in srgb, var(--m), black 5%)) 100% 0 / 2px 0.5rem no-repeat;
  transform-origin: center; opacity: 0.7;
}
.dpj-mood-row .mood-btn.active .dpj-mood-num {
  width: 1.25rem; height: 1.25rem; border-radius: 999px; margin-top: 0.5rem;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.7rem; font-weight: 700;
  background: color-mix(in srgb, var(--m), #1b3b5f 12%); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* Daily prompt (gentle nudge) */
.dpj-prompt {
  margin: -1.5rem 0 2.5rem; padding: 0.85rem 1rem; border-radius: 12px;
  background: var(--surface-2); color: var(--dpj-navy, var(--primary));
  font-size: 0.9rem; line-height: 1.5; border: 1px solid var(--edge);
}

/* Timeline of entries */
.dpj-timeline { position: relative; margin-bottom: 2.5rem; }
.entry-feed { position: relative; padding-left: 1.75rem; display: block; margin: 0; }
.entry-feed::before { content: ""; position: absolute; left: 3px; top: 0.6rem; bottom: 1.5rem; width: 1.5px; background: var(--dpj-line, var(--edge)); }
.feed-empty { color: var(--dpj-muted, var(--muted)); font-size: 0.9rem; padding: 0.5rem 0; }
.feed-entry {
  position: relative; margin-bottom: 2rem; padding: 0 0 1.5rem; border-bottom: 1px solid var(--dpj-divider, var(--edge));
  border-left: none;
}
.feed-entry:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.feed-node {
  position: absolute; left: -1.75rem; top: 0.35rem; width: 0.75rem; height: 0.75rem; border-radius: 999px;
  background: var(--dpj-navy, var(--primary));
  box-shadow: 0 0 0 4px var(--bg);
}
.feed-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.feed-time { font-size: 0.75rem; font-weight: 600; color: var(--dpj-muted, var(--muted)); background: transparent; border: none; padding: 0; letter-spacing: 0; text-transform: none; }
.feed-del { margin-left: auto; border: none; background: transparent; color: var(--dpj-faint, var(--muted)); cursor: pointer; font-size: 0.8rem; padding: 0.15rem 0.35rem; border-radius: 6px; line-height: 1; opacity: 0; transition: opacity 0.12s ease, color 0.12s ease; }
.feed-entry:hover .feed-del { opacity: 1; }
.feed-del:hover { color: var(--danger, #ef4444); }
.feed-text {
  width: 100%; border: none; background: transparent; color: var(--dpj-ink, var(--ink));
  font-family: inherit; font-size: 0.875rem; line-height: 1.7; resize: none; overflow: hidden; padding: 0; margin: 0;
}
.feed-text:focus { outline: none; }
.prev-peek { border: 1px dashed var(--dpj-cardline, var(--edge)); border-radius: 12px; padding: 0.8rem 0.95rem; background: var(--surface-2); }
.prev-peek-label { font-size: 0.72rem; font-weight: 600; color: var(--dpj-muted, var(--muted)); text-transform: none; letter-spacing: 0; margin-bottom: 0.3rem; }
.prev-peek-text { color: var(--dpj-muted, var(--muted)); font-size: 0.875rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Entry editor */
.dpj-editor { margin-bottom: 1rem; }
.dpj-composer {
  border: 1px solid var(--dpj-editorline, var(--edge)); border-radius: 16px; background: var(--surface);
  padding: 1.25rem; box-shadow: var(--sh); transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dpj-composer:focus-within { border-color: color-mix(in srgb, var(--primary), transparent 30%); box-shadow: 0 0 0 3px var(--primary-weak); }
.dpj-composer-input {
  width: 100%; border: none; background: transparent; resize: none; overflow: hidden;
  font-family: inherit; font-size: 0.875rem; line-height: 1.7; color: var(--dpj-ink, var(--ink)); padding: 0; min-height: 3.6rem;
}
.dpj-composer-input:focus { outline: none; }
.dpj-composer-input::placeholder { color: var(--dpj-faint, var(--muted)); }
.dpj-composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding-top: 0.4rem; flex-wrap: wrap; }
.dpj-toolbar { display: flex; align-items: center; gap: 1rem; color: var(--dpj-muted, var(--muted)); }
.dpj-tool { border: none; background: transparent; color: inherit; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; line-height: 1; transition: color 0.12s ease; }
.dpj-tool svg { width: 1rem; height: 1rem; }
.dpj-tool:hover { color: var(--dpj-navy, var(--primary)); }
.dpj-tool-b { font-weight: 700; font-size: 0.9rem; }
.dpj-tool-i { font-style: italic; font-family: Georgia, "Times New Roman", serif; font-size: 0.9rem; }
.dpj-composer-actions { display: flex; align-items: center; gap: 1rem; }
.dpj-words { font-size: 0.75rem; color: var(--dpj-faint, var(--muted)); }
.dpj-add-btn {
  padding: 0.5rem 1.25rem; border: none; border-radius: 999px; cursor: pointer;
  background: var(--primary); color: var(--primary-ink); font-family: inherit; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.01em;
  box-shadow: var(--sh); transition: background 0.15s ease, transform 0.08s ease;
}
.dpj-add-btn:hover { background: color-mix(in srgb, var(--primary), black 12%); }
.dpj-add-btn:active { transform: translateY(1px); }
.dpj-saved { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem; font-size: 0.75rem; color: var(--dpj-muted, var(--muted)); }
.dpj-saved .save-status { font-family: inherit; font-weight: 400; font-size: 0.75rem; color: var(--dpj-muted, var(--muted)); }
.dpj-saved .save-status.saved { color: var(--dpj-muted, var(--muted)); }
.dpj-saved-dot { width: 0.5rem; height: 0.5rem; border-radius: 999px; background: #419e68; flex: none; }

/* ---------- Right sidebar ---------- */
.dpj-side {
  width: 24rem; flex: none; border-left: 1px solid var(--edge); background: var(--dpj-side-bg, var(--bg));
  padding: 2rem 1.75rem;
}
.dpj-side-title { font-size: 1rem; font-weight: 700; color: var(--dpj-navy, var(--primary)); margin: 0 0 1.5rem; }

/* Calendar */
.dpj-cal { margin-bottom: 2rem; }
.dpj-cal-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0.25rem 1.25rem; }
.dpj-cal-title { font-size: 0.875rem; font-weight: 700; color: var(--dpj-navy, var(--primary)); }
.dpj-cal-arrow { border: none; background: transparent; color: var(--dpj-muted, var(--muted)); cursor: pointer; padding: 0.25rem; display: inline-flex; border-radius: 6px; transition: color 0.15s ease; }
.dpj-cal-arrow svg { width: 0.85rem; height: 0.85rem; }
.dpj-cal-arrow:hover { color: var(--dpj-navy, var(--primary)); }
.dpj-cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 0.6875rem; font-weight: 500; color: var(--dpj-muted, var(--muted)); margin-bottom: 0.5rem; }
.dpj-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); column-gap: 0.35rem; row-gap: 0.5rem; text-align: center; font-size: 0.75rem; font-weight: 500; color: var(--dpj-ink, var(--ink)); }
.dpj-cal-grid .cal-cell {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 2.4rem; border: none; background: transparent; border-radius: 10px; cursor: pointer;
  font: inherit; color: inherit; aspect-ratio: auto; transition: background 0.12s ease;
}
.dpj-cal-grid .cal-cell.empty { cursor: default; }
.dpj-cal-grid .cal-day { font-size: 0.75rem; font-weight: 500; line-height: 1; }
.dpj-cal-grid .cal-cell:not(.empty):not(.future):not(.has):hover { background: var(--surface-2); }
/* today, when it isn't the selected day: just a bolder navy number */
.dpj-cal-grid .cal-cell.today:not(.selected):not(.has) .cal-day { font-weight: 700; color: var(--dpj-navy, var(--primary)); }
/* entry days: the whole cell fills with the mood colour, number knocks out in the bg colour */
.dpj-cal-grid .cal-cell.has .cal-day { color: var(--bg); font-weight: 700; }
/* selected day: a soft haloed ring — no hard outline */
.dpj-cal-grid .cal-cell.selected { box-shadow: 0 0 0 2px var(--dpj-side-bg, var(--bg)), 0 0 0 3.5px color-mix(in srgb, var(--dpj-navy, var(--primary)), transparent 55%); }
.dpj-cal-grid .cal-cell.selected .cal-day { font-weight: 700; }
.dpj-cal-grid .cal-cell.future .cal-day { color: var(--dpj-faint, var(--muted)); }
.dpj-cal-grid .cal-cell.future { cursor: default; }

/* Mood legend */
.dpj-cal-legend { display: flex; align-items: flex-end; justify-content: space-between; margin: 1.5rem 0.75rem 0; }
.dpj-legend-item { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.dpj-legend-item svg { width: 1.5rem; height: 1.25rem; }
.dpj-legend-item span { font-size: 0.625rem; color: var(--dpj-muted, var(--muted)); }

/* Insights panel */
.dpj-insights { border: 1px solid var(--dpj-cardline, var(--edge)); border-radius: 16px; padding: 1.25rem; background: var(--surface); box-shadow: var(--sh); }
:root[data-skin="sanctuary"] .dpj-insights { background: color-mix(in srgb, var(--surface), transparent 60%); }
.dpj-insights-head { width: 100%; display: flex; align-items: center; justify-content: space-between; border: none; background: transparent; cursor: pointer; padding: 0; margin-bottom: 0.75rem; font-family: inherit; font-size: 0.875rem; font-weight: 700; color: var(--dpj-navy, var(--primary)); }
.dpj-insights-head svg { width: 1rem; height: 1rem; color: var(--dpj-muted, var(--muted)); }
.dpj-insights-month { display: block; font-size: 0.75rem; font-weight: 600; color: var(--dpj-navy, var(--primary)); margin-bottom: 0.75rem; }
.dpj-stats { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: 1.25rem; }
.dpj-stat-row { display: flex; align-items: center; justify-content: space-between; font-size: 0.75rem; color: var(--dpj-muted, var(--muted)); }
.dpj-stat-row b { font-weight: 700; color: var(--dpj-navy, var(--primary)); }
.dpj-mini-h { display: block; font-size: 0.75rem; font-weight: 700; color: var(--dpj-navy, var(--primary)); margin-bottom: 0.5rem; }
.dpj-mooddist { margin-bottom: 1.5rem; }
.dpj-mooddist-bars { display: flex; flex-direction: column; gap: 0.5rem; }
.dpj-dist-row { display: flex; align-items: center; font-size: 0.75rem; }
.dpj-dist-row .dpj-dist-lvl { width: 1rem; color: var(--dpj-muted, var(--muted)); }
.dpj-dist-track { flex: 1; height: 0.625rem; border-radius: 999px; background: var(--dpj-divider, var(--surface-2)); overflow: hidden; margin: 0 0.625rem; }
.dpj-dist-fill { height: 100%; border-radius: 999px; }
.dpj-dist-pct { width: 1.75rem; text-align: right; font-size: 0.6875rem; color: var(--dpj-muted, var(--muted)); }
.dpj-bestdays-body { }
.dpj-bestdays-track { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 0 0.5rem; margin-bottom: 0.5rem; }
.dpj-bestdays-track::before { content: ""; position: absolute; left: 0.75rem; right: 0.75rem; top: 50%; transform: translateY(-50%); border-top: 1px dashed var(--dpj-cardline, var(--edge)); z-index: 0; }
.dpj-bestdays-dot { position: relative; z-index: 1; width: 0.625rem; height: 0.625rem; border-radius: 2px; background: #86ce9b; }
.dpj-bestdays-dates { display: flex; align-items: center; justify-content: space-between; font-size: 0.6875rem; color: var(--dpj-muted, var(--muted)); }
.dpj-bestdays-dates .sep { color: var(--dpj-cardline, var(--edge)); }
.dpj-bestdays-empty { font-size: 0.75rem; color: var(--dpj-muted, var(--muted)); }

/* Settings swatch */
.skin-swatch-sanctuary {
  background: #f8fafc;
  background-image: linear-gradient(135deg, #1b3b5f 0 40%, #79b7f7 40% 62%, #86ce9b 62% 82%, #f5ce66 82% 100%);
  border: 1px solid #d8e2ec;
}

/* ============================================================
   Journal responsive
   ============================================================ */
@media (max-width: 900px) {
  .dpj-wrap { flex-direction: column; }
  .dpj-main { max-width: none; width: 100%; padding: 1.5rem 1.25rem 2rem; }
  .dpj-side { width: auto; border-left: none; border-top: 1px solid var(--edge); }
}
@media (max-width: 640px) {
  .topbar { padding: 0.6rem 1rem; gap: 0.6rem; }
  .brand.small .brand-name { display: none; }
  .view-toggle { gap: 1.1rem; font-size: 0.85rem; }
  .dpj-mood-row { gap: 1.25rem; }
  .dpj-date { font-size: 1.5rem; }
  .dpj-side { padding: 1.5rem 1.25rem; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; order: 2; min-width: 0; }
  .editor-pane { min-height: 60vh; order: 1; }
  .user-email { display: none; }
  .masthead-main { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; }
  .masthead-aside { border-left: none; border-top: 1px solid var(--edge); padding-left: 0; padding-top: 1.4rem; }
}
@media (max-width: 520px) {
  .editor-pane { padding: 1.3rem 1.2rem; }
  .entry-content { font-size: 1.05rem; }
  .modal { padding: 0.6rem; }
  .modal-scroll { padding: 1rem; }
  .insights-stats { grid-template-columns: repeat(2, 1fr); }
  .mood-chart { height: 120px; }
  .planner { padding: 1.2rem 0.9rem 2.5rem; }
  .planner-pane { padding: 1.3rem 1.2rem; }
  .reader { padding: 1.2rem 0.9rem 3rem; }
  .reader-text { font-size: 1.05rem; }
  .compose-input { font-size: 1rem; }
  .features { grid-template-columns: 1fr; }
  .hero { padding-top: 1.8rem; }
  .landing-nav { padding: 0.8rem 1rem; }
  .landing-nav .landing-start { display: none; }
}

[hidden] { display: none !important; }
