:root {
  color-scheme: light;
  --bg: #f8f1e6;
  --surface: #fffaf2;
  --surface-2: #eadccb;
  --peach: #efb889;
  --pumpkin: #d97836;
  --pumpkin-deep: #a94f20;
  --plum: #6d5875;
  --cocoa: #45372f;
  --sage: #a9aa8d;
  --ink: #2d2724;
  --muted: #756a63;
  --line: rgba(69, 55, 47, 0.15);
  --shadow: 0 14px 36px rgba(69, 55, 47, 0.1);
  --radius: 24px;
  --radius-sm: 15px;
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: Inter, ui-rounded, "Segoe UI", system-ui, sans-serif;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 10% 0%, rgba(239,184,137,.22), transparent 28rem), var(--bg); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--font-display); color: var(--cocoa); }
h1 { font-size: clamp(1.65rem, 6vw, 2.3rem); line-height: 1.05; margin-bottom: .35rem; }
h2 { font-size: 1.35rem; margin-bottom: .8rem; }
h3 { font-size: 1.05rem; margin-bottom: .35rem; }
p { line-height: 1.55; }
.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 100; background: var(--ink); color: white; padding: .7rem 1rem; border-radius: .7rem; }
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 3px solid var(--plum); outline-offset: 3px; }
.app-shell { width: min(100%, 1120px); min-height: 100vh; margin: 0 auto; position: relative; }
.app-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: .8rem; min-height: 72px; padding: max(.8rem, env(safe-area-inset-top)) 1rem .7rem; background: rgba(248,241,230,.92); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(69,55,47,.08); }
.brand { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.brand-mark { width: 38px; height: 38px; flex: 0 0 auto; }
.brand-copy { min-width: 0; }
.eyebrow { margin: 0 0 .1rem; color: var(--pumpkin-deep); font-weight: 800; font-size: .71rem; letter-spacing: .13em; text-transform: uppercase; }
.brand-title { margin: 0; font-size: 1.25rem; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: .4rem; }
.main-content { padding: 1rem 1rem 7.2rem; }
.bottom-nav { position: fixed; left: 50%; bottom: 0; z-index: 30; transform: translateX(-50%); width: min(100%, 1120px); display: grid; grid-template-columns: repeat(5,1fr); padding: .55rem .45rem max(.55rem, env(safe-area-inset-bottom)); background: rgba(255,250,242,.96); backdrop-filter: blur(18px); border-top: 1px solid var(--line); box-shadow: 0 -10px 30px rgba(69,55,47,.08); }
.nav-link { min-width: 0; border: 0; background: transparent; color: var(--muted); display: grid; justify-items: center; gap: .2rem; padding: .4rem .1rem; border-radius: 14px; font-size: .66rem; font-weight: 700; cursor: pointer; }
.nav-link.active { color: var(--plum); background: rgba(109,88,117,.1); }
.icon { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface); cursor: pointer; position: relative; }
.icon-button:hover { background: var(--surface-2); }
.badge { position: absolute; top: -2px; right: -1px; min-width: 18px; height: 18px; border-radius: 999px; padding: 0 4px; display: grid; place-items: center; background: var(--pumpkin-deep); color: white; font-size: .65rem; font-weight: 800; border: 2px solid var(--bg); }
.btn { min-height: 46px; border: 0; border-radius: 999px; padding: .72rem 1.15rem; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font-weight: 800; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--pumpkin-deep); color: white; box-shadow: 0 8px 18px rgba(169,79,32,.22); }
.btn-secondary { background: var(--surface-2); color: var(--cocoa); }
.btn-plum { background: var(--plum); color: white; }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-danger { background: #8d463b; color: white; }
.btn-small { min-height: 38px; padding: .5rem .85rem; font-size: .82rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.button-row { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.section { margin-top: 1.2rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.section-heading h2 { margin: 0; }
.card { background: rgba(255,250,242,.94); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.card-flat { box-shadow: none; }
.hero { min-height: 290px; overflow: hidden; display: grid; grid-template-columns: minmax(0,1fr) minmax(155px,42%); align-items: center; background: linear-gradient(140deg, #fffaf2 5%, #f1dfc9 100%); position: relative; }
.hero::after { content: "✦"; position: absolute; right: 46%; top: 13%; color: var(--pumpkin); opacity: .55; font-size: 1.2rem; }
.hero-copy { position: relative; z-index: 1; }
.hero-copy p { color: var(--muted); max-width: 31rem; }
.hero-art { align-self: end; width: min(100%, 420px); justify-self: end; filter: drop-shadow(0 12px 12px rgba(69,55,47,.12)); }
.quick-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: .75rem; }
.quick-card { border: 0; border-radius: 20px; min-height: 96px; padding: .9rem; background: var(--surface); text-align: left; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; box-shadow: 0 7px 20px rgba(69,55,47,.07); }
.quick-card:nth-child(2) { background: #f4dfc8; }
.quick-card:nth-child(3) { background: #e4dfd0; }
.quick-card:nth-child(4) { background: #ded5e2; }
.quick-card strong { font-family: var(--font-display); font-size: 1rem; }
.quick-card .icon { color: var(--plum); }
.screen-intro { position: relative; min-height: 126px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; overflow: hidden; background: linear-gradient(130deg, #fffaf2, #f2dfca); }
.screen-intro p { color: var(--muted); margin-bottom: 0; }
.screen-art { width: 115px; max-height: 110px; object-fit: contain; flex: 0 0 auto; }
.toolbar { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.toolbar .field { flex: 1 1 190px; }
.search-wrap { position: relative; }
.search-wrap .icon { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-wrap input { padding-left: 2.8rem; }
.chips { display: flex; gap: .45rem; overflow-x: auto; padding: .15rem 0 .35rem; scrollbar-width: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: .55rem .85rem; font-size: .78rem; font-weight: 750; cursor: pointer; }
.chip.active { background: var(--plum); color: white; border-color: var(--plum); }
.list { display: grid; gap: .65rem; }
.list-item { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: .85rem; display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: .75rem; align-items: center; }
.list-item-main { min-width: 0; }
.list-item h3, .list-item p { overflow-wrap: anywhere; }
.list-item h3 { margin-bottom: .2rem; }
.list-item p { color: var(--muted); margin-bottom: 0; font-size: .83rem; }
.list-item.completed h3 { text-decoration: line-through; color: var(--muted); }
.check-button { width: 28px; height: 28px; border-radius: 9px; border: 1.5px solid var(--sage); background: transparent; display: grid; place-items: center; cursor: pointer; }
.check-button.checked { background: var(--sage); color: white; }
.check-button .icon { width: 17px; height: 17px; }
.item-actions { display: flex; gap: .25rem; }
.item-actions .icon-button { width: 38px; height: 38px; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; }
.tag { display: inline-flex; align-items: center; gap: .25rem; background: rgba(217,120,54,.1); color: #8b4a20; border-radius: 999px; padding: .25rem .55rem; font-size: .7rem; font-weight: 800; }
.tag.plum { background: rgba(109,88,117,.12); color: var(--plum); }
.empty { text-align: center; padding: 2.3rem 1rem; color: var(--muted); }
.empty-symbol { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto .8rem; border-radius: 50%; background: var(--surface-2); color: var(--plum); }
.empty-symbol .icon { width: 30px; height: 30px; }
.calendar-card { padding: .8rem; }
.month-nav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; text-align: center; margin-bottom: .8rem; }
.month-nav h2 { margin: 0; }
.calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: .22rem; }
.weekday { text-align: center; font-size: .67rem; color: var(--muted); font-weight: 800; padding: .35rem 0; }
.day { aspect-ratio: 1; min-width: 0; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; position: relative; cursor: pointer; font-size: .83rem; }
.day.outside { opacity: .35; }
.day.today { box-shadow: inset 0 0 0 1px var(--pumpkin); }
.day.selected { background: var(--plum); color: white; }
.day.has-items::after { content: ""; position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--pumpkin); }
.day.selected::after { background: var(--peach); }
.notes-grid { display: grid; gap: .75rem; }
.note-card { min-height: 150px; position: relative; overflow: hidden; }
.note-card[data-color="peach"] { background: #f7dfc8; }
.note-card[data-color="sage"] { background: #e5e5d5; }
.note-card[data-color="plum"] { background: #e5dce7; }
.pin { position: absolute; right: .75rem; top: .75rem; color: var(--plum); }
.note-body { white-space: pre-wrap; color: var(--muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.fab { position: fixed; z-index: 29; right: max(1rem, calc((100vw - 1120px)/2 + 1rem)); bottom: calc(78px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border: 0; border-radius: 50%; background: var(--pumpkin-deep); color: white; display: grid; place-items: center; box-shadow: 0 10px 24px rgba(169,79,32,.3); cursor: pointer; }
.fab .icon { width: 27px; height: 27px; }
.form-card { max-width: 760px; margin-inline: auto; }
.type-tabs { display: grid; grid-template-columns: repeat(4,1fr); gap: .35rem; margin-bottom: 1rem; }
.type-tab { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: .65rem .25rem; font-weight: 750; font-size: .75rem; cursor: pointer; }
.type-tab.active { background: var(--plum); color: white; }
.form-grid { display: grid; gap: .9rem; }
.form-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
.field { display: grid; gap: .38rem; }
.field label, .field-label { font-weight: 800; font-size: .8rem; color: var(--cocoa); }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); background: #fffdf8; color: var(--ink); border-radius: 14px; padding: .78rem .85rem; min-height: 46px; }
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--plum); box-shadow: 0 0 0 3px rgba(109,88,117,.12); outline: none; }
.field-error { color: #8d463b; font-size: .75rem; min-height: 1em; }
.toggle-line { display: flex; align-items: center; gap: .65rem; }
.toggle-line input { width: 1.2rem; height: 1.2rem; accent-color: var(--plum); }
.modal-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: end center; padding: 1rem; background: rgba(45,39,36,.48); }
.modal { width: min(100%, 620px); max-height: min(86vh,800px); overflow: auto; background: var(--bg); border-radius: 28px 28px 20px 20px; padding: 1.1rem; box-shadow: 0 24px 60px rgba(45,39,36,.3); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.modal-header h2 { margin: 0; }
.modal-section { padding: 1rem 0; border-top: 1px solid var(--line); }
.modal-section:first-of-type { border-top: 0; }
.notice { border-left: 4px solid var(--pumpkin); background: rgba(239,184,137,.18); padding: .8rem; border-radius: 0 12px 12px 0; color: var(--muted); font-size: .84rem; }
.danger-zone { border: 1px solid rgba(141,70,59,.25); border-radius: 16px; padding: 1rem; background: rgba(141,70,59,.05); }
.toast-root { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 2rem),460px); z-index: 100; pointer-events: none; }
.toast { background: var(--ink); color: white; padding: .8rem 1rem; border-radius: 14px; box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.reminder-banner { position: fixed; top: 82px; left: 50%; transform: translateX(-50%); z-index: 60; width: min(calc(100% - 2rem),560px); background: var(--plum); color: white; border-radius: 18px; padding: .85rem; box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr auto; gap: .8rem; align-items: center; }
.reminder-banner strong { display: block; }
.reminder-banner p { margin: .15rem 0 0; font-size: .8rem; opacity: .82; }
.reminder-banner .btn { background: white; color: var(--plum); }
.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; }

@media (min-width: 700px) {
  .main-content { padding: 1.4rem 1.5rem 7.5rem; }
  .quick-grid { grid-template-columns: repeat(4,1fr); }
  .notes-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hero { padding: 1.7rem 2rem; min-height: 350px; }
  .modal-backdrop { place-items: center; }
  .modal { border-radius: 28px; }
}

@media (min-width: 960px) {
  .home-layout { display: grid; grid-template-columns: 1.25fr .75fr; gap: 1rem; align-items: start; }
  .home-layout .hero { grid-row: span 2; }
  .notes-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .bottom-nav { width: min(calc(100% - 2rem),760px); bottom: 1rem; border: 1px solid var(--line); border-radius: 24px; padding-bottom: .55rem; }
  .fab { bottom: 98px; }
}

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