:root {
  color-scheme: light;
  --paper: #f8f4ee;
  --white: #fffdfa;
  --ink: #2d251f;
  --subtle: #695b51;
  --sidebar: #30231c;
  --edge: #e9ded3;
  --accent: #9b452d;
  --accent-soft: #f5e4d9;
  --green: #38624c;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .56; }
:focus-visible { outline: 2px solid #b64a2e; outline-offset: 3px; }
svg { display: inline-block; width: 21px; height: 21px; flex: none; vertical-align: middle; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -.027em; }
h1 { font-size: clamp(2.35rem, 4vw, 4.1rem); line-height: 1.05; }
h2 { font-size: 1.85rem; line-height: 1.14; }
h3 { font-size: 1.45rem; }
p, .body-copy { line-height: 1.58; }
small, .subtle { color: var(--subtle); }
.layout { min-height: 100vh; display: grid; grid-template-columns: 234px minmax(0, 1fr); }
.sidebar { background: var(--sidebar); color: #f8eee4; display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0; padding: 29px 18px 22px; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 1.9rem; line-height: 1; letter-spacing: -.04em; width: max-content; }
.brand img { width: 45px; height: 45px; object-fit: cover; }
.brand small { display: block; font: 500 .76rem/1.2 'Segoe UI', sans-serif; letter-spacing: .045em; color: #dac5b4; margin-top: 5px; }
.sidebar .brand { margin: 0 6px 46px; }
#nav { display: grid; gap: 7px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 48px; color: #ead8c9; padding: 8px 13px; border-radius: 9px; font-size: .94rem; }
.nav-link:hover, .nav-link[aria-current] { background: #4c372b; color: #fff6ea; }
.nav-link[aria-current] svg { color: #f4a984; }
.profile { border-top: 1px solid #634b3b; margin-top: auto; display: flex; align-items: center; padding: 19px 1px 1px; gap: 9px; min-width: 0; }
.profile strong { font-size: .88rem; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 33px; height: 33px; border-radius: 50%; background: #624332; color: #f8dfcc; display: grid; place-items: center; font: 1.05rem var(--serif); flex: none; }
.profile button { margin-left: auto; }
.main { width: 100%; max-width: 1450px; padding: 31px clamp(22px, 4vw, 65px) 45px; margin: 0 auto; }
.topbar { min-height: 37px; display: flex; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.breadcrumb, .date-label { font-size: .88rem; font-weight: 600; color: var(--subtle); }
.date-label { display: flex; align-items: center; gap: 8px; }
.date-label svg { width: 17px; height: 17px; color: var(--accent); }
.hero { position: relative; min-height: 312px; padding: clamp(28px, 4.5vw, 61px); border-radius: 18px; overflow: hidden; color: #fff8e9; background: linear-gradient(90deg, #241912 0%, #241912ed 28%, #24191278 56%, #24191205 90%), url('/hero.webp') center 54%/cover; }
.hero h1 { margin: 11px 0 15px; max-width: 11ch; }
.hero h1 em { color: #f3ba96; font-weight: 400; }
.hero p { color: #f1ddcd; max-width: 34ch; }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; font-size: .8rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.hero .eyebrow { color: #f6c5a7; }
.hero .eyebrow svg { width: 18px; height: 18px; }
.hero .button { margin-top: 20px; }
.dashboard { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(275px, 1fr); gap: 22px; margin-top: 23px; align-items: start; }
.stack { display: grid; gap: 18px; }
.card { background: var(--white); border: 1px solid var(--edge); border-radius: 15px; padding: 23px; min-width: 0; box-shadow: 0 3px 9px #40271506; }
.section-head, .inline-actions { display: flex; justify-content: space-between; align-items: center; gap: 13px; }
.section-head { margin-bottom: 16px; }
.section-head p { color: var(--subtle); margin-top: 6px; }
.fine { font-size: .87rem; color: var(--subtle); }
.button, .icon-button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 8px; font-weight: 630; font-size: .89rem; min-height: 43px; padding: 8px 13px; background: none; color: inherit; white-space: nowrap; }
.button svg { width: 18px; height: 18px; }
.button.primary { background: var(--accent); color: #fff8ed; }
.button.primary:hover { background: #793621; }
.button.cream { background: #f7e6d7; color: #41271d; }
.button.cream:hover { background: #fff3e7; }
.button.outline, .icon-button.outline { border-color: var(--edge); background: var(--white); }
.button.outline:hover, .icon-button.outline:hover, .icon-button:hover { background: var(--accent-soft); color: #73301e; }
.button.link { color: var(--accent); padding-inline: 6px; }
.button.link:hover { background: var(--accent-soft); }
.icon-button { width: 43px; padding: 0; }
.progress-line { height: 5px; border: 0; width: 100%; background: #f1e6dc; border-radius: 20px; margin: 0 0 9px; accent-color: #b45e3d; }
.progress-line::-webkit-progress-bar { background: #f1e6dc; border-radius: 20px; }
.progress-line::-webkit-progress-value { background: #b45e3d; border-radius: 20px; }
.meal { display: grid; grid-template-columns: 45px minmax(0, 1fr) auto auto; gap: 11px; align-items: center; padding: 12px 0; border-bottom: 1px solid #efe7dd; }
.meal:last-child { border: 0; padding-bottom: 2px; }
.meal-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: #f5e9d4; color: #75502b; }
.meal-icon.plate { background: #f5e3d9; color: #943f2a; }
.meal-icon.moon { background: #eee6f0; color: #6b4c76; }
.meal-icon.fruit { background: #e4eddf; color: #456245; }
.meal strong, .meal small { display: block; overflow-wrap: anywhere; }
.meal strong { font-weight: 675; }
.meal small { font-size: .86rem; margin-top: 4px; }
.meal .done-toggle { border-color: #e7dbd0; color: var(--subtle); }
.meal .done-toggle[aria-pressed="true"] { background: #e8f1e8; color: var(--green); border-color: #d3e4d6; }
.doc-card { background: #f1e4d7; border-color: #eee0d2; }
.doc-top { display: flex; gap: 14px; align-items: center; }
.doc-top h2 { margin: 5px 0; }
.doc-icon { display: grid; place-items: center; width: 46px; height: 54px; border-radius: 7px; color: var(--accent); background: #fcf5e9; border: 1px solid #dfc6b6; flex: none; }
.doc-card .button { margin-top: 16px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 10px; }
.week button { background: none; color: var(--subtle); border: 1px solid transparent; border-radius: 8px; padding: 5px 0; min-height: 52px; }
.week button:hover { background: var(--accent-soft); }
.week button[aria-current="date"] { background: var(--accent-soft); border-color: #eed0bd; color: #743823; }
.week button span { display: block; font-size: .77rem; margin-bottom: 4px; }
.week button strong { font-size: .94rem; }
.week .tracked { color: var(--green); }
.page-head { margin: 13px 0 23px; }
.page-head p { margin-top: 11px; color: var(--subtle); }
.page-content { display: grid; gap: 18px; }
.day-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.day-controls input { max-width: 11rem; }
.note-preview { color: var(--subtle); white-space: pre-wrap; overflow-wrap: anywhere; }
.file-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pdf-frame { width: 100%; height: min(75vh, 850px); display: block; background: var(--white); border: 1px solid var(--edge); border-radius: 10px; margin-top: 16px; }
.history { list-style: none; margin: 0; padding: 0; display: grid; }
.history .button { justify-content: space-between; width: 100%; text-align: left; white-space: normal; min-height: 51px; border-bottom: 1px solid var(--edge); border-radius: 0; padding-inline: 0; }
.history .button:hover { color: var(--accent); }
label { display: block; font-size: .9rem; font-weight: 650; }
input:not([type="checkbox"]), select, textarea { border: 1px solid #e3d5c9; color: var(--ink); background: #fffcf8; border-radius: 8px; padding: 10px 11px; min-height: 44px; width: 100%; }
textarea { resize: vertical; line-height: 1.55; }
input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; vertical-align: middle; }
.edit-list { display: grid; gap: 10px; margin: 16px 0; }
.settings-row { display: grid; grid-template-columns: minmax(125px,1.5fr) minmax(108px,.7fr) minmax(104px,.85fr) auto auto; align-items: end; gap: 9px; }
.settings-row label span { display: block; margin-bottom: 5px; }
.settings-row .checkbox { display: flex; align-items: center; min-height: 44px; gap: 5px; }
.settings-row .checkbox span { margin: 0; }
.setting-name { max-width: 340px; display: grid; gap: 5px; }
.button-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
dialog { background: var(--white); color: var(--ink); border: 1px solid var(--edge); border-radius: 17px; width: min(calc(100% - 26px), 525px); padding: 22px; box-shadow: 0 20px 90px #2d251f44; }
dialog::backdrop { background: #261a14a0; }
dialog form { display: grid; gap: 11px; }
dialog .button-group { justify-content: flex-end; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 8; background: var(--sidebar); color: #fff4e6; border: 1px solid #786454; padding: 12px 17px; border-radius: 9px; max-width: min(390px, calc(100% - 48px)); font-size: .92rem; box-shadow: 0 4px 22px #24150e25; }
.error { color: #9d2c1d; margin: 3px 0; }
#startup { padding: 28px; }
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--white); }
.login-form { margin: auto; padding: 45px 24px; width: min(100%, 405px); }
.login-form .brand { margin-bottom: 55px; }
.login-form .brand img { border-radius: 12px; }
.login-form .brand small { color: var(--subtle); }
.login-form h1 { margin-bottom: 11px; }
.login-form p { color: var(--subtle); }
.login-form form { display: grid; gap: 10px; margin-top: 24px; }
.login-form form .button { margin-top: 7px; }
.login-photo { background: #251910 url('/hero.webp') 77% 50%/cover; }
@media (max-width: 1040px) {
  .layout { grid-template-columns: 186px minmax(0, 1fr); }
  .main { padding-inline: 26px; }
  .dashboard { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .layout { display: block; }
  .sidebar { position: fixed; top: auto; bottom: 0; height: auto; left: 0; right: 0; padding: 3px 6px max(4px, env(safe-area-inset-bottom)); }
  .sidebar .brand, .profile { display: none; }
  #nav { grid-template-columns: repeat(5, 1fr); gap: 2px; }
  .nav-link { flex-direction: column; justify-content: center; font-size: .71rem; min-height: 54px; padding: 3px 1px; gap: 3px; }
  .nav-link svg { width: 19px; height: 19px; }
  .main { padding: 17px 13px calc(84px + env(safe-area-inset-bottom)); }
  .topbar { margin-bottom: 13px; }
  .topbar .breadcrumb { font-size: .82rem; }
  .date-label { font-size: .78rem; gap: 4px; }
  .hero { padding: 26px 19px; min-height: 292px; background-image: linear-gradient(90deg, #251a13 0%, #251a13ea 43%, #251a1360 83%, #251a1320), url('/hero.webp'); background-position: 69% 50%; }
  .dashboard { margin-top: 13px; gap: 13px; }
  .stack, .page-content { gap: 13px; }
  .card { padding: 15px; border-radius: 13px; }
  .meal { gap: 7px; grid-template-columns: 38px minmax(0,1fr) auto auto; }
  .meal-icon { width: 36px; height: 38px; }
  .settings-row { grid-template-columns: minmax(115px, 2fr) minmax(97px, 1fr) 43px; border-bottom: 1px solid var(--edge); padding-bottom: 12px; }
  .settings-row .icon-field { grid-row: 2; }
  .settings-row .delete-row { grid-column: 3; grid-row: 1; }
  .toast { bottom: calc(68px + env(safe-area-inset-bottom)); right: 13px; }
  .login { grid-template-columns: 1fr; }
  .login-photo, .pdf-frame { display: none; }
  .section-head { align-items: flex-start; }
  .doc-top h2 { font-size: 1.65rem; }
}
