/* =========================================================
   日札 · RIZHA
   A quiet, paper-like diary. No frameworks, no dependencies.
   ========================================================= */

:root {
  color-scheme: light;
  --paper: #f3eee4;
  --paper-deep: #ebe3d4;
  --paper-warm: #f7f2e9;
  --surface: #fbf8f1;
  --surface-raised: #fffdf8;
  --surface-soft: #f6f0e5;
  --ink: #2e2923;
  --ink-soft: #5c5348;
  --muted: #766a5b;
  --faint: #8a7e6d;
  --line: rgba(70, 56, 40, 0.13);
  --line-strong: rgba(70, 56, 40, 0.23);
  --accent: #a94a29;
  --accent-deep: #8e3d22;
  --accent-soft: #f0ddcf;
  --accent-ink: #8e3d22;
  --sage: #778166;
  --sage-soft: #e5e8db;
  --gold: #b98a4c;
  --gold-soft: #f2e5ce;
  --danger: #a33f34;
  --danger-soft: #f4ded9;
  --shadow-sm: 0 1px 2px rgba(65, 48, 29, 0.05), 0 6px 18px rgba(65, 48, 29, 0.035);
  --shadow-md: 0 12px 34px rgba(65, 48, 29, 0.08), 0 2px 5px rgba(65, 48, 29, 0.04);
  --shadow-lg: 0 32px 80px rgba(45, 31, 18, 0.18), 0 8px 24px rgba(45, 31, 18, 0.08);
  --serif: "Songti SC", "Noto Serif SC", "STSong", "SimSun", Georgia, "Times New Roman", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --hand: "Kaiti SC", "KaiTi", "STKaiti", "Songti SC", serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Consolas", monospace;
  --radius-sm: 9px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --sidebar-w: 272px;
  --mood-joy: #a3621a;
  --mood-calm: #5f7259;
  --mood-excited: #a64d35;
  --mood-tired: #6d6788;
  --mood-down: #506a81;
  --mood-angry: #97483e;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #181512;
  --paper-deep: #13110e;
  --paper-warm: #1b1713;
  --surface: #211d18;
  --surface-raised: #27221c;
  --surface-soft: #1d1915;
  --ink: #efe6d8;
  --ink-soft: #c8bcab;
  --muted: #9b8e7d;
  --faint: #766a5b;
  --line: rgba(239, 225, 204, 0.11);
  --line-strong: rgba(239, 225, 204, 0.21);
  --accent: #dd8963;
  --accent-deep: #f0a57f;
  --accent-soft: #3a241b;
  --accent-ink: #f0a57f;
  --sage: #a1aa8b;
  --sage-soft: #293023;
  --gold: #d6a968;
  --gold-soft: #372d1f;
  --danger: #e18b7d;
  --danger-soft: #3a201d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.18), 0 8px 22px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 14px 38px rgba(0, 0, 0, 0.26), 0 2px 5px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 34px 90px rgba(0, 0, 0, 0.54), 0 8px 24px rgba(0, 0, 0, 0.32);
  --mood-joy: #dfa24c;
  --mood-calm: #9aac8e;
  --mood-excited: #de8262;
  --mood-tired: #a8a2c1;
  --mood-down: #8fa8bf;
  --mood-angry: #d17d72;
}

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

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

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(1100px 650px at 82% -12%, rgba(255, 252, 244, 0.8), transparent 65%),
    radial-gradient(800px 600px at 8% 105%, rgba(213, 198, 175, 0.22), transparent 70%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[data-theme="dark"] body {
  background:
    radial-gradient(1000px 620px at 82% -12%, rgba(221, 137, 99, 0.075), transparent 66%),
    radial-gradient(800px 600px at 8% 105%, rgba(92, 74, 54, 0.13), transparent 70%),
    var(--paper);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: multiply;
}

[data-theme="dark"] body::before {
  opacity: 0.045;
  mix-blend-mode: screen;
}

body.overlay-open {
  overflow: hidden;
}

body.sidebar-open {
  overflow: hidden;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

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

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 400;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  transform: translateY(-160%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------------------------------------------------------
   App shell
   --------------------------------------------------------- */

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.scrim {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  height: 100vh;
  padding: 28px 22px 22px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.44), transparent 28%),
    var(--paper-warm);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  z-index: 40;
}

[data-theme="dark"] .sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 28%),
    var(--paper-warm);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  border-radius: 8px;
}

.brand-seal {
  position: relative;
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1;
  transform: rotate(-2.5deg);
  box-shadow: inset 0 0 0 3px var(--paper-warm);
}

.brand-seal::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid currentColor;
  border-radius: 2px;
  opacity: 0.4;
}

.brand-type {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-type strong {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1.1;
}

.brand-type small {
  color: var(--muted);
  font-family: var(--hand);
  font-size: 11px;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.sidebar-close {
  display: none;
}

.today-card {
  position: relative;
  margin: 26px 0 18px;
  padding: 15px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), transparent 58%),
    var(--surface-soft);
  overflow: hidden;
}

.today-eyebrow {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.today-main {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.today-main strong {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.today-caption {
  padding-top: 3px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.today-year {
  position: absolute;
  right: 15px;
  bottom: 13px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.13em;
}

.today-orbit {
  position: absolute;
  right: -29px;
  top: -34px;
  width: 92px;
  height: 92px;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.today-orbit::after {
  content: "";
  position: absolute;
  right: 20px;
  bottom: 12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.write-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 8px 12px;
  border-radius: 11px;
  background: var(--ink);
  color: var(--surface);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 20px rgba(46, 41, 35, 0.16);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

[data-theme="dark"] .write-btn {
  background: var(--accent);
  color: #201711;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.26);
}

.write-btn:hover {
  transform: translateY(-1px);
  background: #17130f;
  box-shadow: 0 11px 25px rgba(46, 41, 35, 0.23);
}

[data-theme="dark"] .write-btn:hover {
  background: var(--accent-deep);
}

.write-btn-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.write-btn kbd,
.search-trigger kbd {
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: inherit;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
  opacity: 0.55;
}

.write-btn kbd {
  margin-left: auto;
}

.write-btn .icon {
  width: 17px;
  height: 17px;
}

.sidebar-nav {
  margin-top: 28px;
}

.nav-label {
  margin: 0 0 8px 11px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 41px;
  padding: 8px 11px;
  border-radius: 9px;
  color: var(--ink-soft);
  font-size: 13px;
  transition: color 160ms ease, background 160ms ease;
}

.nav-item .icon {
  width: 18px;
  height: 18px;
  opacity: 0.68;
}

.nav-item:hover {
  background: rgba(70, 56, 40, 0.045);
  color: var(--ink);
}

[data-theme="dark"] .nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.is-active {
  background: var(--surface-raised);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.nav-item.is-active .icon {
  color: var(--accent);
  opacity: 1;
}

.nav-count {
  min-width: 20px;
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 20px;
  background: rgba(70, 56, 40, 0.06);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  text-align: center;
}

[data-theme="dark"] .nav-count {
  background: rgba(255, 255, 255, 0.055);
}

.sidebar-tags {
  margin-top: 27px;
}

.nav-label-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 10px;
}

.nav-label-row .nav-label {
  flex: none;
}

.label-line {
  width: 100%;
  height: 1px;
  background: var(--line);
}

.tag-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tag-link {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  padding: 5px 11px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  transition: color 160ms ease, background 160ms ease;
}

.tag-link-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tag-link:hover,
.tag-link.is-active {
  background: rgba(70, 56, 40, 0.045);
  color: var(--ink);
}

[data-theme="dark"] .tag-link:hover,
[data-theme="dark"] .tag-link.is-active {
  background: rgba(255, 255, 255, 0.04);
}

.tag-link::before {
  content: "#";
  color: var(--faint);
  font-family: var(--serif);
  font-size: 13px;
}

.tag-link-count {
  margin-left: auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
}

.tag-nav-empty {
  padding: 4px 11px;
  color: var(--faint);
  font-family: var(--hand);
  font-size: 12px;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 26px;
}

.local-note {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px 10px;
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.03em;
}

.local-note .icon {
  width: 12px;
  height: 12px;
  margin-left: auto;
  opacity: 0.6;
}

.local-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 0 3px rgba(119, 129, 102, 0.12);
}

.settings-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 4px 2px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  text-align: left;
  transition: color 160ms ease;
}

.settings-link:hover {
  color: var(--ink);
}

.settings-link .icon {
  width: 15px;
  height: 15px;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 72px;
  padding: 0 clamp(24px, 3.4vw, 52px);
  border-bottom: 1px solid var(--line);
  background: rgba(243, 238, 228, 0.82);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  backdrop-filter: blur(18px) saturate(1.1);
}

[data-theme="dark"] .topbar {
  background: rgba(24, 21, 18, 0.82);
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.crumb-sep {
  width: 11px;
  height: 11px;
  opacity: 0.6;
}

.crumb-current {
  color: var(--ink-soft);
  font-weight: 500;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--ink-soft);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.icon-btn:hover {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.icon-btn .icon {
  width: 18px;
  height: 18px;
}

.menu-btn {
  display: none;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 186px;
  height: 37px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 253, 248, 0.46);
  color: var(--muted);
  font-size: 11.5px;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

[data-theme="dark"] .search-trigger {
  background: rgba(255, 255, 255, 0.025);
}

.search-trigger:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
}

.search-trigger .icon {
  width: 15px;
  height: 15px;
}

.search-trigger kbd {
  margin-left: auto;
  border-color: var(--line);
  color: var(--faint);
  opacity: 1;
}

.theme-btn {
  position: relative;
}

[data-theme="light"] .theme-icon-moon,
[data-theme="dark"] .theme-icon-sun {
  display: none;
}

.view {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: clamp(32px, 3.6vw, 50px) clamp(24px, 3.4vw, 52px) 80px;
  outline: none;
}

/* ---------------------------------------------------------
   Shared typography & controls
   --------------------------------------------------------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--accent);
}

.eyebrow-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 41px;
  padding: 9px 17px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--ink);
  color: var(--surface);
  box-shadow: 0 7px 18px rgba(46, 41, 35, 0.14);
}

[data-theme="dark"] .btn-primary {
  background: var(--accent);
  color: #211710;
}

.btn-primary:hover {
  background: #18140f;
}

[data-theme="dark"] .btn-primary:hover {
  background: var(--accent-deep);
}

.btn-outline {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
}

.btn-soft {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

.btn-soft:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-quiet {
  min-height: 32px;
  padding: 5px 9px;
  color: var(--muted);
  font-size: 11.5px;
}

.btn-quiet:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.btn-danger {
  background: var(--danger);
  color: #fff8f4;
}

.btn-danger:hover {
  filter: brightness(0.94);
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 11.5px;
  transition: color 160ms ease;
}

.link-btn .icon {
  width: 13px;
  height: 13px;
  transition: transform 160ms ease;
}

.link-btn:hover {
  color: var(--accent);
}

.link-btn:hover .icon {
  transform: translateX(2px);
}

/* ---------------------------------------------------------
   Home
   --------------------------------------------------------- */

.home {
  animation: page-in 480ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero {
  position: relative;
  padding: 5px 0 33px;
  border-bottom: 1px solid var(--line);
}

.hero-kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.08em;
}

.hero-kicker .greeting {
  color: var(--accent);
  font-family: var(--hand);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.hero-kicker .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
}

.hero-title {
  max-width: 810px;
  margin: 20px 0 17px;
  font-family: var(--serif);
  font-size: clamp(42px, 4.6vw, 66px);
  font-weight: 500;
  line-height: 1.23;
  letter-spacing: -0.035em;
}

.hero-title em {
  position: relative;
  display: inline-block;
  color: var(--accent);
  font-style: normal;
}

.hero-title em::after {
  content: "";
  position: absolute;
  left: 1%;
  right: 0;
  bottom: 1px;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 8' preserveAspectRatio='none'%3E%3Cpath d='M1 6.2C48 2.1 99 2.4 179 4.6' fill='none' stroke='%23a94a29' stroke-width='1.15' stroke-linecap='round' opacity='.55'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  opacity: 0.8;
}

[data-theme="dark"] .hero-title em::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 8' preserveAspectRatio='none'%3E%3Cpath d='M1 6.2C48 2.1 99 2.4 179 4.6' fill='none' stroke='%23dd8963' stroke-width='1.15' stroke-linecap='round' opacity='.5'/%3E%3C/svg%3E");
  opacity: 0.65;
}

.hero-copy {
  max-width: 485px;
  color: var(--ink-soft);
  font-family: var(--hand);
  font-size: 15.5px;
  line-height: 1.95;
  letter-spacing: 0.025em;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-meta {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 32px;
}

.hero-stat {
  padding: 0 25px;
  border-left: 1px solid var(--line);
}

.hero-stat:first-child {
  padding-left: 0;
  border-left: 0;
}

.hero-stat strong {
  display: block;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero-stat strong small {
  margin-left: 2px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0;
}

.hero-stat span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.08em;
}

.hero-stamp {
  position: absolute;
  top: 0;
  right: clamp(0px, 2.2vw, 34px);
  width: 158px;
  height: 158px;
  color: var(--accent);
  transform: rotate(5deg);
  opacity: 0.9;
  pointer-events: none;
}

.stamp-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 0.9;
}

.stamp-ring .ring-outer {
  opacity: 0.55;
}

.stamp-ring .ring-inner {
  stroke-dasharray: 1.5 4.5;
  opacity: 0.4;
}

.stamp-content {
  position: absolute;
  inset: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.stamp-month {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.2em;
}

.stamp-day {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: 54px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.08em;
}

.stamp-week {
  margin-top: 3px;
  font-family: var(--hand);
  font-size: 11px;
  letter-spacing: 0.14em;
}

.stamp-leaf {
  position: absolute;
  right: -12px;
  bottom: 3px;
  width: 58px;
  height: 58px;
  fill: none;
  stroke: currentColor;
  stroke-width: 0.85;
  opacity: 0.5;
  transform: rotate(-13deg);
}

.welcome-note {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 22px;
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.3);
  color: var(--muted);
  font-size: 11.5px;
}

[data-theme="dark"] .welcome-note {
  background: rgba(255, 255, 255, 0.018);
}

.welcome-note .icon {
  width: 15px;
  height: 15px;
  color: var(--gold);
}

.welcome-note p {
  flex: 1;
}

.welcome-note .link-btn {
  color: var(--ink-soft);
}

.welcome-close {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: var(--faint);
  border-radius: 5px;
}

.welcome-close:hover {
  color: var(--ink);
  background: var(--surface);
}

.welcome-close .icon {
  width: 12px;
  height: 12px;
  color: currentColor;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 294px;
  gap: clamp(28px, 3.2vw, 44px);
  margin-top: 38px;
  align-items: start;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 17px;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.section-title small {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.12em;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.entry-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 218px;
  padding: 20px 20px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.28), transparent 55%),
    var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  overflow: hidden;
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1), border-color 220ms ease, box-shadow 220ms ease;
}

[data-theme="dark"] .entry-card {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 55%),
    var(--surface);
}

.entry-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20px;
  width: 2px;
  height: 28px;
  border-radius: 0 2px 2px 0;
  background: var(--mood-color, var(--accent));
  opacity: 0.8;
}

.entry-card::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -38px;
  width: 105px;
  height: 105px;
  border: 1px solid var(--line);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 220ms ease, transform 300ms ease;
  pointer-events: none;
}

.entry-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.entry-card:hover::after {
  opacity: 1;
  transform: scale(1.08);
}

.entry-card:focus-visible {
  outline-offset: 2px;
}

.entry-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
}

.entry-date {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.entry-weekday {
  color: var(--faint);
  font-family: var(--hand);
  font-size: 10.5px;
}

.entry-mood {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  padding: 3px 7px 3px 5px;
  border-radius: 20px;
  background: var(--mood-tint, var(--surface-soft));
  color: var(--mood-color, var(--muted));
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.entry-mood svg {
  width: 14px;
  height: 14px;
}

.fav-btn {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  margin-right: -4px;
  border-radius: 6px;
  color: var(--faint);
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.fav-btn .icon {
  width: 15px;
  height: 15px;
}

.fav-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.06);
}

.fav-btn.is-fav {
  color: var(--accent);
}

.fav-btn.is-fav .icon {
  fill: currentColor;
  stroke-width: 1.2;
}

.entry-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.015em;
}

.entry-excerpt {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  margin-top: 8px;
  color: var(--ink-soft);
  font-family: var(--hand);
  font-size: 13.5px;
  line-height: 1.85;
}

.entry-foot {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  max-width: 145px;
  padding: 2.5px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

a.tag:hover,
button.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.entry-weather {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  color: var(--faint);
  font-size: 9px;
  white-space: nowrap;
}

.entry-weather .icon {
  width: 13px;
  height: 13px;
}

.entry-time {
  margin-left: auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.home-aside {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.prompt-card {
  position: relative;
  padding: 23px 21px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    radial-gradient(140px 100px at 90% 0%, rgba(185, 138, 76, 0.12), transparent 70%),
    var(--surface-soft);
  overflow: hidden;
}

.prompt-card::after {
  content: "”";
  position: absolute;
  right: 11px;
  bottom: -31px;
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 120px;
  line-height: 1;
  opacity: 0.08;
  pointer-events: none;
}

.prompt-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--gold);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.prompt-label::before {
  content: "";
  width: 13px;
  height: 1px;
  background: currentColor;
}

.prompt-text {
  min-height: 83px;
  margin: 14px 0 17px;
  font-family: var(--hand);
  font-size: 17px;
  line-height: 1.8;
  letter-spacing: 0.02em;
  transition: opacity 240ms ease, transform 240ms ease;
}

.prompt-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.prompt-shuffle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.prompt-shuffle:hover {
  color: var(--accent);
}

.prompt-shuffle .icon {
  width: 12px;
  height: 12px;
}

.prompt-write {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 500;
}

.prompt-write .icon {
  width: 12px;
  height: 12px;
  transition: transform 160ms ease;
}

.prompt-write:hover .icon {
  transform: translateX(2px);
}

.mini-calendar {
  padding: 18px 18px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.mini-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.mini-cal-title {
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.mini-cal-title span {
  margin-left: 4px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
}

.mini-cal-link {
  color: var(--faint);
  font-size: 9px;
}

.mini-cal-link:hover {
  color: var(--accent);
}

.mini-weekdays,
.mini-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}

.mini-weekdays {
  margin-bottom: 4px;
  color: var(--faint);
  font-size: 9px;
}

.mini-weekdays span {
  padding: 3px 0;
}

.mini-day {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
  transition: background 150ms ease, color 150ms ease;
}

.mini-day:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.mini-day.is-blank {
  pointer-events: none;
}

.mini-day.has-entry::after {
  content: "";
  position: absolute;
  bottom: 2px;
  width: 2.5px;
  height: 2.5px;
  border-radius: 50%;
  background: var(--accent);
}

.mini-day.is-today {
  background: var(--ink);
  color: var(--surface);
}

[data-theme="dark"] .mini-day.is-today {
  background: var(--accent);
  color: #211710;
}

.mini-day.is-today::after {
  background: currentColor;
}

.mini-cal-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9px;
}

.mini-cal-foot strong {
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 500;
}

.aside-note {
  padding: 1px 5px;
  color: var(--faint);
  font-family: var(--hand);
  font-size: 11.5px;
  line-height: 1.8;
  text-align: center;
}

/* ---------------------------------------------------------
   Page headers / archive
   --------------------------------------------------------- */

.page {
  animation: page-in 420ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 27px;
  border-bottom: 1px solid var(--line);
}

.page-eyebrow {
  margin-bottom: 11px;
}

.page-title {
  font-family: var(--serif);
  font-size: clamp(34px, 3.3vw, 47px);
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -0.035em;
}

.page-desc {
  max-width: 490px;
  margin-top: 9px;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 13.5px;
  line-height: 1.8;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
  padding-bottom: 4px;
}

.archive-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 25px 0 22px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 245px;
  max-width: 380px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-field .icon {
  width: 15px;
  height: 15px;
}

.search-field input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.search-field input::placeholder {
  color: var(--faint);
}

.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 11px;
  width: 5px;
  height: 5px;
  border-right: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  pointer-events: none;
}

.filter-select {
  height: 38px;
  min-width: 110px;
  padding: 0 28px 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 11.5px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 160ms ease;
}

.filter-select:focus {
  border-color: var(--accent);
}

.archive-meta {
  margin-left: auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.active-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 18px;
  padding: 5px 7px 5px 10px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 10.5px;
}

.active-filter button {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 4px;
  color: currentColor;
}

.active-filter button:hover {
  background: rgba(180, 83, 47, 0.12);
}

.active-filter .icon {
  width: 11px;
  height: 11px;
}

.archive-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.archive-grid .entry-card {
  min-height: 230px;
}

.archive-empty {
  grid-column: 1 / -1;
}

/* ---------------------------------------------------------
   Empty states
   --------------------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 290px;
  padding: 38px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 248, 0.24);
  text-align: center;
}

[data-theme="dark"] .empty-state {
  background: rgba(255, 255, 255, 0.015);
}

.empty-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 15px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--faint);
}

.empty-art .icon {
  width: 25px;
  height: 25px;
}

.empty-art::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.65;
}

.empty-state h3 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
}

.empty-state p {
  max-width: 310px;
  margin: 6px 0 16px;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 12.5px;
  line-height: 1.8;
}

/* ---------------------------------------------------------
   Calendar
   --------------------------------------------------------- */

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(270px, 0.72fr);
  gap: 22px;
  margin-top: 28px;
  align-items: start;
}

.calendar-card,
.day-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.calendar-card {
  padding: 23px clamp(16px, 2vw, 27px) 22px;
}

.calendar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 17px;
  margin-bottom: 19px;
}

.calendar-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.calendar-heading strong {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.calendar-heading span {
  color: var(--faint);
  font-family: var(--hand);
  font-size: 12px;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.month-nav .icon-btn {
  width: 31px;
  height: 31px;
}

.month-nav .icon-btn .icon {
  width: 15px;
  height: 15px;
}

.today-btn {
  height: 31px;
  margin-right: 4px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 10px;
  transition: color 150ms ease, border-color 150ms ease;
}

.today-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  text-align: center;
  font-size: 9.5px;
  letter-spacing: 0.08em;
}

.calendar-weekdays span {
  padding: 9px 0;
}

.calendar-weekdays span:nth-child(6),
.calendar-weekdays span:nth-child(7) {
  color: var(--accent);
  opacity: 0.8;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: 78px;
  padding: 9px 10px 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  text-align: left;
  transition: background 150ms ease;
}

.cal-day:nth-child(7n) {
  border-right: 0;
}

.cal-day:nth-last-child(-n + 7) {
  border-bottom: 0;
}

.cal-day:hover {
  background: var(--surface-soft);
}

.cal-day.other-month {
  color: var(--faint);
  background: rgba(70, 56, 40, 0.012);
}

[data-theme="dark"] .cal-day.other-month {
  background: rgba(255, 255, 255, 0.008);
}

.cal-day.other-month .cal-num {
  opacity: 0.5;
}

.cal-num {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 10.5px;
  transition: background 150ms ease, color 150ms ease;
}

.cal-day.is-today .cal-num {
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent);
}

.cal-day.is-selected {
  background: var(--accent-soft);
}

.cal-day.is-selected .cal-num {
  background: var(--accent);
  color: #fff8f3;
  box-shadow: none;
}

[data-theme="dark"] .cal-day.is-selected .cal-num {
  color: #211710;
}

.cal-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: auto;
  padding-top: 6px;
}

.cal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--mood-color, var(--accent));
}

.cal-more {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1;
}

.cal-day-label {
  margin-top: 3px;
  max-width: 100%;
  overflow: hidden;
  color: var(--faint);
  font-family: var(--hand);
  font-size: 9.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.day-panel {
  position: sticky;
  top: 94px;
  padding: 22px 19px;
}

.day-panel-head {
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.day-panel-date {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.day-panel-date strong {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.day-panel-date span {
  color: var(--muted);
  font-size: 10px;
}

.day-panel-sub {
  margin-top: 5px;
  color: var(--faint);
  font-family: var(--hand);
  font-size: 11.5px;
}

.day-entries {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 14px 0;
}

.day-entry {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease;
}

.day-entry:hover {
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

.day-entry-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  font-family: var(--serif);
  font-size: 13.5px;
  font-weight: 500;
}

.day-entry-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-size: 8.5px;
}

.day-entry-mood {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--mood-color, var(--muted));
}

.day-entry-mood i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.day-empty {
  padding: 24px 4px 16px;
  color: var(--faint);
  font-family: var(--hand);
  font-size: 12.5px;
  line-height: 1.9;
  text-align: center;
}

.add-day-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 38px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 10.5px;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.add-day-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.add-day-btn .icon {
  width: 14px;
  height: 14px;
}

/* ---------------------------------------------------------
   Insights
   --------------------------------------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-top: 28px;
}

.stat-card {
  position: relative;
  padding: 18px 17px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -30px;
  width: 82px;
  height: 82px;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.05em;
}

.stat-label .icon {
  width: 12px;
  height: 12px;
  color: var(--accent);
}

.stat-value {
  margin-top: 12px;
  font-family: var(--serif);
  font-size: 35px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
}

.stat-value small {
  margin-left: 4px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0;
}

.stat-note {
  margin-top: 7px;
  color: var(--faint);
  font-family: var(--hand);
  font-size: 10px;
}

.insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 21px 20px 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-wide {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
}

.panel-hint {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
}

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

.mood-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 35px;
  align-items: center;
  gap: 10px;
}

.mood-row-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 10.5px;
}

.mood-row-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mood-color);
}

.mood-track {
  height: 6px;
  border-radius: 10px;
  background: var(--surface-soft);
  overflow: hidden;
}

.mood-fill {
  width: var(--width, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--mood-color);
  opacity: 0.82;
  transform-origin: left center;
  animation: bar-grow 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes bar-grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.mood-row-count {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  text-align: right;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 7px;
}

.tag-cloud .tag {
  max-width: none;
  padding: 5px 9px;
  font-size: 10px;
}

.tag-cloud .tag-size-lg {
  font-size: 13px;
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

.tag-cloud .tag-size-md {
  font-size: 11px;
}

.heatmap-scroll {
  overflow-x: auto;
  padding-bottom: 2px;
}

.heat-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 12px);
  grid-auto-columns: 12px;
  gap: 4px;
  min-width: max-content;
}

.heat-cell {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--heat-0);
  border: 1px solid transparent;
  transition: transform 120ms ease, border-color 120ms ease;
}

.heat-cell:hover {
  transform: scale(1.22);
  border-color: var(--ink-soft);
}

.heat-cell.level-1 {
  background: var(--heat-1);
}

.heat-cell.level-2 {
  background: var(--heat-2);
}

.heat-cell.level-3 {
  background: var(--heat-3);
}

.heat-cell.level-4 {
  background: var(--heat-4);
}

.heat-cell.heat-empty {
  background: transparent;
  pointer-events: none;
}

:root {
  --heat-0: #ece4d7;
  --heat-1: #dfc4b2;
  --heat-2: #cb9478;
  --heat-3: #b76a49;
  --heat-4: #92442a;
}

[data-theme="dark"] {
  --heat-0: #2b2620;
  --heat-1: #493529;
  --heat-2: #79503d;
  --heat-3: #a66d50;
  --heat-4: #d08b64;
}

.heat-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 12px;
  color: var(--faint);
  font-size: 9px;
}

.heat-legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--heat-0);
}

.heat-legend i:nth-of-type(2) {
  background: var(--heat-1);
}

.heat-legend i:nth-of-type(3) {
  background: var(--heat-2);
}

.heat-legend i:nth-of-type(4) {
  background: var(--heat-3);
}

.heat-legend i:nth-of-type(5) {
  background: var(--heat-4);
}

.month-chart {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: end;
  gap: 8px;
  height: 150px;
  padding-top: 6px;
}

.month-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  height: 100%;
}

.month-count {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  opacity: 0;
  transition: opacity 160ms ease;
}

.month-col:hover .month-count {
  opacity: 1;
}

.month-bar {
  width: 100%;
  max-width: 22px;
  min-height: 3px;
  height: var(--height, 3px);
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--accent), #c97a58);
  opacity: 0.65;
  transition: opacity 160ms ease;
}

.month-col:hover .month-bar {
  opacity: 1;
}

.month-label {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
}

.insight-empty {
  padding: 20px 6px;
  color: var(--faint);
  font-family: var(--hand);
  font-size: 12px;
  text-align: center;
}

.rhythm-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 12px;
  line-height: 1.75;
}

.rhythm-note .icon {
  width: 14px;
  height: 14px;
  margin-top: 3px;
  color: var(--gold);
}

/* ---------------------------------------------------------
   Editor
   --------------------------------------------------------- */

.editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  animation: overlay-in 240ms ease both;
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  height: 66px;
  padding: 0 clamp(16px, 3.4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(243, 238, 228, 0.9);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  flex: none;
}

[data-theme="dark"] .editor-bar {
  background: rgba(24, 21, 18, 0.9);
}

.editor-bar-left,
.editor-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.editor-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 4px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 11.5px;
  transition: color 160ms ease, background 160ms ease;
}

.editor-back:hover {
  color: var(--ink);
  background: var(--surface);
}

.editor-back .icon {
  width: 17px;
  height: 17px;
}

.editor-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.06em;
}

.editor-status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sage);
}

.editor-status.is-dirty::before {
  background: var(--gold);
}

.editor-actions .icon-btn {
  width: 34px;
  height: 34px;
}

.editor-actions .icon-btn .icon {
  width: 16px;
  height: 16px;
}

.editor-save {
  min-height: 36px;
  padding: 7px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font-size: 11.5px;
  font-weight: 500;
  transition: background 160ms ease, transform 160ms ease;
}

[data-theme="dark"] .editor-save {
  background: var(--accent);
  color: #211710;
}

.editor-save:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

.editor-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 35px 24px 70px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.editor-paper {
  position: relative;
  width: 100%;
  max-width: 900px;
  min-height: calc(100vh - 170px);
  margin: 0 auto;
  padding: 43px clamp(28px, 5vw, 72px) 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background:
    linear-gradient(90deg, transparent 0, transparent calc(clamp(28px, 5vw, 72px) - 1px), rgba(180, 83, 47, 0.1) calc(clamp(28px, 5vw, 72px) - 1px), rgba(180, 83, 47, 0.1) clamp(28px, 5vw, 72px), transparent clamp(28px, 5vw, 72px)),
    var(--surface-raised);
  box-shadow: 0 1px 1px rgba(60, 45, 28, 0.03), 0 18px 50px rgba(60, 45, 28, 0.09);
}

[data-theme="dark"] .editor-paper {
  background:
    linear-gradient(90deg, transparent 0, transparent calc(clamp(28px, 5vw, 72px) - 1px), rgba(221, 137, 99, 0.13) calc(clamp(28px, 5vw, 72px) - 1px), rgba(221, 137, 99, 0.13) clamp(28px, 5vw, 72px), transparent clamp(28px, 5vw, 72px)),
    var(--surface-raised);
}

.editor-paper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold) 55%, transparent);
  opacity: 0.55;
}

.editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.editor-date-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-input {
  width: 132px;
  padding: 3px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.date-input:hover,
.date-input:focus {
  border-bottom-color: var(--line-strong);
}

.editor-weekday {
  color: var(--muted);
  font-family: var(--hand);
  font-size: 11.5px;
}

.editor-fav {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--faint);
  font-size: 9.5px;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.editor-fav .icon {
  width: 13px;
  height: 13px;
}

.editor-fav:hover,
.editor-fav.is-fav {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.editor-fav.is-fav .icon {
  fill: currentColor;
}

.meta-pickers {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 19px;
  margin-top: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.picker-group {
  display: flex;
  align-items: center;
  gap: 9px;
}

.picker-label {
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.mood-picker,
.weather-picker {
  display: flex;
  align-items: center;
  gap: 3px;
}

.mood-option {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--faint);
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.mood-option svg {
  width: 21px;
  height: 21px;
}

.mood-option:hover {
  color: var(--mood-color);
  background: var(--mood-tint);
  transform: translateY(-1px);
}

.mood-option.is-active {
  border-color: var(--mood-color);
  background: var(--mood-tint);
  color: var(--mood-color);
}

.weather-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--faint);
  font-size: 9px;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.weather-option .icon {
  width: 14px;
  height: 14px;
}

.weather-option:hover {
  color: var(--ink-soft);
  background: var(--surface-soft);
}

.weather-option.is-active {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  color: var(--ink);
}

.editor-title {
  width: 100%;
  margin-top: 26px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(28px, 3.3vw, 40px);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.03em;
}

.editor-title::placeholder {
  color: var(--faint);
  opacity: 0.72;
}

.editor-divider {
  width: 40px;
  height: 1px;
  margin: 23px 0 22px;
  background: var(--accent);
  opacity: 0.55;
}

.editor-body {
  display: block;
  width: 100%;
  min-height: 340px;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--hand);
  font-size: 16px;
  line-height: 2.05;
  letter-spacing: 0.015em;
  overflow: hidden;
}

.editor-body::placeholder {
  color: var(--faint);
  opacity: 0.72;
}

.tag-editor {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 23px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.tag-editor-label {
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 4px 3px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 9.5px;
}

.tag-chip button {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 3px;
  color: var(--faint);
}

.tag-chip button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.tag-chip .icon {
  width: 9px;
  height: 9px;
}

.tag-input {
  width: 118px;
  min-height: 24px;
  padding: 0 2px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 10px;
}

.tag-input::placeholder {
  color: var(--faint);
}

.tag-suggestions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.tag-suggestion {
  padding: 2px 6px;
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
  color: var(--faint);
  font-size: 8.5px;
}

.tag-suggestion:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 25px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9px;
}

.word-count {
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.editor-privacy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--hand);
  font-size: 10.5px;
}

.editor-privacy .icon {
  width: 11px;
  height: 11px;
}

/* ---------------------------------------------------------
   Modals
   --------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(18px, 8vh, 78px) 20px 24px;
  background: rgba(38, 28, 18, 0.34);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  animation: overlay-in 180ms ease both;
}

[data-theme="dark"] .overlay {
  background: rgba(0, 0, 0, 0.56);
}

.search-palette {
  width: 100%;
  max-width: 650px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: palette-in 220ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes palette-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 59px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.search-input-wrap > .icon {
  width: 19px;
  height: 19px;
  color: var(--muted);
}

.search-input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
}

.search-input::placeholder {
  color: var(--faint);
  font-family: var(--sans);
  font-size: 12.5px;
}

.search-input-wrap kbd {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  white-space: nowrap;
}

.search-results {
  max-height: min(59vh, 470px);
  overflow-y: auto;
  padding: 7px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.search-section-label {
  padding: 8px 10px 5px;
  color: var(--faint);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.search-result {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 11px 11px;
  border-radius: 8px;
  text-align: left;
  transition: background 140ms ease;
}

.search-result:hover,
.search-result.is-active {
  background: var(--surface-soft);
}

.search-result-date {
  flex: none;
  width: 47px;
  padding-top: 2px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.7;
}

.search-result-date strong {
  display: block;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
}

.search-result-body {
  min-width: 0;
  flex: 1;
}

.search-result-title {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.search-result-excerpt {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 10.5px;
  line-height: 1.7;
}

.search-result-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--faint);
  font-size: 9px;
}

.search-result-meta .mood-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--mood-color);
}

.search-result-meta .mood-inline i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.search-result-arrow {
  align-self: center;
  color: var(--faint);
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
}

.search-result-arrow .icon {
  width: 14px;
  height: 14px;
}

.search-result:hover .search-result-arrow {
  opacity: 1;
  transform: translateX(2px);
}

.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 42px 20px;
  color: var(--faint);
  text-align: center;
}

.search-empty .icon {
  width: 27px;
  height: 27px;
  margin-bottom: 10px;
  opacity: 0.6;
}

.search-empty p {
  font-family: var(--hand);
  font-size: 13px;
}

.search-empty small {
  margin-top: 4px;
  font-size: 9.5px;
}

.palette-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 35px;
  padding: 7px 15px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--faint);
  font-size: 9px;
}

.palette-foot kbd {
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 7.5px;
}

/* Settings */

.settings-dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: min(85vh, 730px);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: palette-in 220ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 19px 21px 17px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.modal-sub {
  margin-top: 3px;
  color: var(--faint);
  font-family: var(--hand);
  font-size: 11px;
}

.modal-body {
  overflow-y: auto;
  padding: 20px 21px 7px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.setting-section {
  padding: 0 0 21px;
  margin-bottom: 19px;
  border-bottom: 1px solid var(--line);
}

.setting-section:last-child {
  border-bottom: 0;
}

.setting-title {
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.setting-desc {
  margin: -3px 0 11px;
  color: var(--faint);
  font-family: var(--hand);
  font-size: 11.5px;
  line-height: 1.75;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.theme-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-size: 10px;
  text-align: left;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}

.theme-choice:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.theme-choice.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.theme-swatch {
  position: relative;
  display: block;
  width: 100%;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.theme-swatch.light {
  background: linear-gradient(135deg, #f3eee4 50%, #fbf8f1 50%);
}

.theme-swatch.dark {
  background: linear-gradient(135deg, #181512 50%, #27221c 50%);
}

.theme-swatch.system {
  background: linear-gradient(135deg, #f3eee4 0 49%, #181512 51% 100%);
}

.theme-swatch::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: 6px;
  width: 10px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.data-actions .btn {
  min-height: 36px;
  font-size: 10.5px;
}

.data-actions .btn .icon {
  width: 14px;
  height: 14px;
}

.storage-meter {
  margin-top: 11px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.storage-meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--faint);
  font-size: 8.5px;
}

.storage-meter-bar {
  height: 4px;
  border-radius: 4px;
  background: var(--paper-deep);
  overflow: hidden;
}

.storage-meter-bar i {
  display: block;
  width: var(--usage, 2%);
  height: 100%;
  border-radius: inherit;
  background: var(--sage);
}

.settings-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 11px;
  line-height: 1.8;
}

.settings-note .icon {
  width: 13px;
  height: 13px;
  flex: none;
  margin-top: 3px;
  color: var(--gold);
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--danger-soft);
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger-soft) 30%, transparent);
}

.danger-zone p {
  color: var(--muted);
  font-family: var(--hand);
  font-size: 10.5px;
  line-height: 1.7;
}

.danger-zone .btn {
  flex: none;
  min-height: 31px;
  padding: 5px 10px;
  border: 1px solid var(--danger-soft);
  background: transparent;
  color: var(--danger);
  font-size: 9.5px;
}

.danger-zone .btn:hover {
  background: var(--danger);
  color: #fff8f4;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 21px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.version-note {
  margin-right: auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
}

/* Confirm */

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(38, 28, 18, 0.38);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  animation: overlay-in 160ms ease both;
}

[data-theme="dark"] .confirm-overlay {
  background: rgba(0, 0, 0, 0.6);
}

.confirm-dialog {
  width: 100%;
  max-width: 370px;
  padding: 24px 24px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  animation: palette-in 190ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.confirm-dialog h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
}

.confirm-dialog p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 12.5px;
  line-height: 1.8;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.confirm-actions .btn {
  min-height: 35px;
  padding: 6px 14px;
  font-size: 10.5px;
}

/* Toasts */

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 22px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 330px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 11.5px;
  animation: toast-in 280ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

[data-theme="dark"] .toast {
  background: var(--surface-raised);
  color: var(--ink);
}

.toast .icon {
  width: 14px;
  height: 14px;
  color: var(--gold);
}

.toast.is-leaving {
  animation: toast-out 200ms ease both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(4px);
  }
}

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

@media (max-width: 1260px) {
  :root {
    --sidebar-w: 250px;
  }

  .home-grid {
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 28px;
  }

  .archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-stamp {
    width: 140px;
    height: 140px;
  }

  .stamp-day {
    font-size: 48px;
  }
}

@media (max-width: 1080px) {
  .sidebar {
    padding-left: 18px;
    padding-right: 18px;
  }

  .home-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-aside {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .aside-note {
    grid-column: 1 / -1;
  }

  .prompt-card {
    min-height: 100%;
  }

  .prompt-text {
    min-height: 60px;
  }

  .calendar-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .day-panel {
    position: static;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .insight-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel-wide {
    grid-column: auto;
  }

  .hero-stamp {
    opacity: 0.58;
  }
}

@media (max-width: 900px) {
  .app {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(82vw, 300px);
    height: 100dvh;
    padding: 25px 22px 20px;
    transform: translateX(-103%);
    transition: transform 280ms cubic-bezier(0.2, 0.7, 0.2, 1);
    box-shadow: var(--shadow-lg);
    z-index: 60;
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(38, 28, 18, 0.34);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: overlay-in 180ms ease both;
  }

  .sidebar-close {
    display: grid;
  }

  .menu-btn {
    display: grid;
  }

  .topbar {
    height: 64px;
  }

  .view {
    padding-top: 32px;
  }

  .hero-stamp {
    right: 8px;
    top: -8px;
    width: 122px;
    height: 122px;
    opacity: 0.35;
  }

  .stamp-day {
    font-size: 42px;
  }

  .stamp-content {
    inset: 16px;
  }

  .hero-title {
    max-width: 650px;
    font-size: clamp(40px, 7vw, 56px);
  }

  .hero-copy {
    max-width: 510px;
  }

  .archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .topbar {
    padding: 0 17px;
  }

  .view {
    padding: 25px 18px 58px;
  }

  .crumb-root,
  .crumb-sep {
    display: none;
  }

  .crumb {
    font-size: 11px;
  }

  .search-trigger {
    min-width: 37px;
    width: 37px;
    padding: 0;
    justify-content: center;
    border-color: transparent;
    background: transparent;
  }

  .search-trigger span,
  .search-trigger kbd {
    display: none;
  }

  .topbar-actions {
    gap: 2px;
  }

  .hero {
    padding-top: 2px;
  }

  .hero-kicker {
    gap: 7px;
    font-size: 9.5px;
  }

  .hero-kicker .greeting {
    font-size: 13px;
  }

  .hero-title {
    margin: 17px 0 14px;
    font-size: clamp(35px, 10vw, 46px);
    line-height: 1.3;
  }

  .hero-copy {
    max-width: 390px;
    font-size: 14px;
  }

  .hero-actions {
    margin-top: 21px;
  }

  .hero-actions .btn {
    min-height: 39px;
    padding: 8px 14px;
  }

  .hero-stamp {
    display: none;
  }

  .hero-meta {
    margin-top: 27px;
    gap: 16px 0;
  }

  .hero-stat {
    padding: 0 15px;
  }

  .hero-stat strong {
    font-size: 19px;
  }

  .hero-stat span {
    font-size: 8.5px;
  }

  .welcome-note {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 10.5px;
    line-height: 1.7;
  }

  .welcome-note p {
    flex: 1 1 calc(100% - 50px);
  }

  .welcome-note .link-btn {
    margin-left: 27px;
  }

  .home-grid {
    margin-top: 30px;
  }

  .entry-grid,
  .archive-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .entry-card {
    min-height: 195px;
  }

  .home-aside {
    grid-template-columns: minmax(0, 1fr);
  }

  .aside-note {
    grid-column: auto;
  }

  .page-head {
    display: block;
    padding-bottom: 22px;
  }

  .page-title {
    font-size: 36px;
  }

  .page-desc {
    font-size: 12.5px;
  }

  .page-actions {
    margin-top: 17px;
  }

  .archive-toolbar {
    gap: 7px;
    margin-bottom: 17px;
  }

  .search-field {
    flex-basis: 100%;
    max-width: none;
  }

  .filter-select {
    min-width: 104px;
  }

  .archive-meta {
    margin-left: auto;
    font-size: 8.5px;
  }

  .section-head {
    align-items: center;
  }

  .section-title {
    font-size: 20px;
  }

  .calendar-card {
    padding: 16px 10px 12px;
  }

  .calendar-heading strong {
    font-size: 23px;
  }

  .calendar-weekdays span {
    padding: 7px 0;
    font-size: 8px;
  }

  .cal-day {
    min-height: 53px;
    padding: 5px 5px 4px;
  }

  .cal-num {
    width: 21px;
    height: 21px;
    font-size: 9px;
  }

  .cal-dots {
    gap: 2px;
    padding-top: 2px;
  }

  .cal-dot {
    width: 3px;
    height: 3px;
  }

  .cal-day-label {
    display: none;
  }

  .month-nav {
    gap: 1px;
  }

  .month-nav .icon-btn {
    width: 28px;
    height: 28px;
  }

  .today-btn {
    margin-right: 0;
    padding: 0 7px;
    font-size: 9px;
  }

  .day-panel {
    padding: 18px 15px;
  }

  .stat-grid {
    gap: 9px;
  }

  .stat-card {
    padding: 14px 13px 13px;
  }

  .stat-value {
    font-size: 30px;
  }

  .panel {
    padding: 17px 15px;
  }

  .month-chart {
    gap: 4px;
    height: 125px;
  }

  .month-label {
    font-size: 6.5px;
  }

  .editor-bar {
    height: 58px;
    padding: 0 12px;
    gap: 9px;
  }

  .editor-status {
    display: none;
  }

  .editor-scroll {
    padding: 16px 10px 40px;
  }

  .editor-paper {
    min-height: calc(100vh - 110px);
    padding: 27px 22px 24px;
    background: var(--surface-raised);
  }

  [data-theme="dark"] .editor-paper {
    background: var(--surface-raised);
  }

  .editor-paper::before {
    height: 2px;
  }

  .editor-head {
    gap: 10px;
  }

  .editor-fav {
    padding: 5px 7px;
  }

  .editor-fav span {
    display: none;
  }

  .meta-pickers {
    gap: 12px;
    margin-top: 16px;
    padding-bottom: 15px;
  }

  .picker-group {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .mood-option {
    width: 28px;
    height: 28px;
  }

  .mood-option svg {
    width: 19px;
    height: 19px;
  }

  .weather-option {
    min-height: 26px;
    padding: 3px 5px;
  }

  .weather-option span {
    display: none;
  }

  .editor-title {
    margin-top: 21px;
    font-size: 27px;
  }

  .editor-divider {
    margin: 18px 0;
  }

  .editor-body {
    min-height: 290px;
    font-size: 15.5px;
    line-height: 2;
  }

  .overlay {
    padding: 16px 10px;
    align-items: flex-start;
  }

  .search-palette {
    margin-top: 4vh;
    border-radius: 12px;
  }

  .search-input-wrap {
    min-height: 54px;
    padding: 0 13px;
  }

  .search-input {
    font-size: 16px;
  }

  .search-results {
    max-height: 62vh;
  }

  .settings-dialog {
    max-height: calc(100dvh - 32px);
    border-radius: 13px;
  }

  .modal-head {
    padding: 16px 16px 14px;
  }

  .modal-body {
    padding: 16px 16px 3px;
  }

  .modal-footer {
    padding: 11px 16px;
  }

  .theme-options {
    gap: 5px;
  }

  .theme-choice {
    padding: 8px;
    font-size: 9px;
  }

  .theme-swatch {
    height: 24px;
  }

  .toast-host {
    right: 12px;
    bottom: 14px;
    left: 12px;
    align-items: stretch;
  }

  .toast {
    max-width: none;
  }

  .palette-foot {
    padding: 6px 12px;
  }

  .palette-foot span:last-child {
    display: none;
  }

  .heat-grid {
    grid-template-rows: repeat(7, 10px);
    grid-auto-columns: 10px;
    gap: 3px;
  }

  .heat-cell {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 400px) {
  .hero-stat {
    padding: 0 11px;
  }

  .hero-stat strong {
    font-size: 17px;
  }

  .entry-card {
    padding: 17px 16px 14px;
  }

  .entry-title {
    font-size: 19px;
  }

  .brand-type strong {
    font-size: 23px;
  }

  .editor-back span {
    display: none;
  }

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

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

/* Print: a clean page of the current view */
@media print {
  .sidebar,
  .topbar,
  .hero-actions,
  .welcome-note,
  .home-aside,
  .toast-host,
  .scrim {
    display: none !important;
  }

  .app {
    display: block;
  }

  body {
    background: #fff;
  }

  .view {
    padding: 0;
  }

  .entry-card {
    break-inside: avoid;
    box-shadow: none;
  }
}
