:root {
  color-scheme: light;
  --navy: #1F3A5F;
  --coral: #C8402F;
  --coral-soft: #FBE9E6;
  --sage: #2F6B4F;
  --sage-soft: #E5F1EA;
  --sky-soft: #E3F2F8;
  --butter-soft: #FCF3D4;
  --blush-soft: #FBE9EC;
  --cream: #FBF7F1;
  --ink: #1F2933;
  --muted: #5F6B76;
  --line: #E6DFD4;
  --white: #FFFFFF;
}
@font-face { font-family: 'Inter'; src: url(fonts/inter.woff2) format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url(fonts/space-grotesk.woff2) format('woff2'); font-weight: 500 700; font-display: swap; }
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--cream); color: var(--ink); font: 16px/1.5 'Inter', system-ui, sans-serif; }
h1, h2, h3 { font-family: 'Space Grotesk', 'Inter', sans-serif; color: var(--navy); line-height: 1.2; }
a { color: var(--navy); }
.main:focus { outline: none; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* header + navigation */
.top { background: var(--navy); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { color: #fff; font: 700 18px 'Space Grotesk', sans-serif; text-decoration: none; }
.saved { font-size: 13px; opacity: .85; }
.layout { max-width: 1160px; margin: 0 auto; }
.nav { display: flex; gap: 6px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line); padding: 8px 12px; position: sticky; top: 0; z-index: 10; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav h2 { display: none; }
.nav a { flex: none; padding: 8px 12px; min-height: 40px; border-radius: 20px; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.nav a[aria-current="page"] { background: var(--navy); color: #fff; }
.main { padding: 20px 16px 64px; min-width: 0; }
@media (min-width: 860px) {
  .layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; padding: 0 20px; }
  .nav { display: block; position: sticky; top: 12px; align-self: start; margin-top: 20px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; overflow: visible; }
  .nav h2 { display: block; font: 600 12px 'Inter', sans-serif; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 10px 10px 4px; }
  .nav a { display: block; border-radius: 8px; min-height: 0; padding: 7px 10px; }
}

/* page structure */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 28px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.block { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.block > h2 { font-size: 19px; margin-bottom: 4px; }
.block > .hint, .hint { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.empty { color: var(--muted); font-size: 15px; padding: 10px 0; }

/* controls */
button { font: inherit; cursor: pointer; }
.btn { background: var(--navy); color: #fff; border: 1px solid var(--navy); border-radius: 8px; padding: 9px 14px; min-height: 42px; font-weight: 600; font-size: 15px; }
.btn:hover { background: #162C49; }
.btn.ghost { background: #fff; color: var(--navy); }
.btn.ghost:hover { background: var(--cream); }
.btn.danger { background: #fff; color: var(--coral); border-color: var(--coral); }
.btn.small { min-height: 36px; padding: 5px 10px; font-size: 14px; }
.x { background: none; border: none; color: var(--muted); font-size: 22px; line-height: 1; width: 40px; height: 40px; flex: none; border-radius: 8px; }
.x:hover { background: var(--coral-soft); color: var(--coral); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.field { display: block; min-width: 0; }
.field > span { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 3px; }
input[type=text], input[type=number], input[type=date], input[type=time], select, textarea { width: 100%; min-width: 0; font: inherit; color: var(--ink); background: #fff; border: 1px solid #CFC7BA; border-radius: 8px; padding: 9px 10px; min-height: 42px; }
input[type=date] { -webkit-appearance: none; appearance: none; }
textarea { resize: vertical; min-height: 84px; display: block; }
.check { display: flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--sage); flex: none; }
.check input:checked + span.strike { text-decoration: line-through; color: var(--muted); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* rows */
.row { display: grid; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); position: relative; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding-right: 40px; }
.row:first-of-type { border-top: 0; }
.row .wide { grid-column: 1 / -1; }
.row > .x { position: absolute; right: 0; top: 12px; }
@media (min-width: 720px) { .row.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .row.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.simple { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.simple .grow { flex: 1; min-width: 0; }
.task-add { display: flex; gap: 8px; margin-top: 8px; }
.task-add input { flex: 1; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font: 700 24px 'Space Grotesk', sans-serif; color: var(--navy); overflow-wrap: anywhere; }
.stat > span { font-size: 13px; color: var(--muted); }
.stat.neg b { color: var(--coral); }
progress { width: 100%; height: 10px; accent-color: var(--sage); display: block; }

/* home */
.hero { background: var(--navy); color: #fff; border-radius: 14px; padding: 22px; margin-bottom: 16px; }
.hero b { display: block; font: 700 46px/1 'Space Grotesk', sans-serif; color: #fff; }
.hero span { display: block; margin-top: 6px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-decoration: none; color: var(--ink); }
.tile:hover { border-color: var(--navy); }
.tile b { display: block; color: var(--navy); font-family: 'Space Grotesk', sans-serif; font-size: 16px; }
.tile small { color: var(--muted); font-size: 13px; }
.tile.b { background: var(--butter-soft); }
.tiles-title { font-size: 19px; margin: 20px 0 10px; }

/* person + day + recipe cards */
.card { border: 1px solid var(--line); border-radius: 10px; margin-top: 10px; background: #fff; }
.card > summary { cursor: pointer; padding: 12px; font-weight: 600; list-style-position: inside; }
.card > div { padding: 0 12px 12px; }
.card.today { border: 2px solid var(--sage); background: var(--sage-soft); }
.count { color: var(--muted); font-weight: 400; font-size: 14px; }
.person { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 12px; background: var(--blush-soft); }
.person .row { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 44px 10px 10px; margin-top: 8px; }
.person .row > .x { top: 8px; right: 4px; }
.person-head { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 40px; gap: 8px; align-items: end; }
.left { font-size: 14px; font-weight: 600; margin-top: 8px; color: var(--sage); }
.left.over { color: var(--coral); }
.status { font-size: 13px; font-weight: 600; }
.status.late { color: var(--coral); }
.status.ok { color: var(--sage); }
.search { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.search input { flex: 1 1 200px; width: auto; }
.search select { flex: 0 1 200px; width: auto; }
.recipe-meta { color: var(--muted); font-size: 14px; }
.recipe h3 { font-size: 15px; margin: 12px 0 4px; }
.recipe ul, .recipe ol { padding-left: 20px; }
.recipe li { margin: 3px 0; }

/* month grid */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.month .dow { font-size: 11px; font-weight: 600; text-align: center; color: var(--muted); padding: 3px 0; }
.month .d { background: var(--cream); border: 1px solid var(--line); min-height: 52px; border-radius: 6px; padding: 3px; font-size: 12px; text-align: left; color: var(--ink); overflow: hidden; overflow-wrap: anywhere; display: block; width: 100%; }
.month button.d.has { background: var(--sky-soft); }
.month .d.sel { outline: 2px solid var(--navy); }
.month .d.off { visibility: hidden; }
.month .d small { display: block; font-size: 10px; line-height: 1.2; color: var(--navy); margin-top: 1px; }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.month-nav b { font-family: 'Space Grotesk', sans-serif; font-size: 18px; color: var(--navy); }

/* gift tags */
.tags { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .tags { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tag { border: 1.5px dashed #8E9AA6; border-radius: 10px; padding: 10px; text-align: center; color: var(--ink); break-inside: avoid; min-height: 138px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; }
.tag svg { width: 28px; height: 28px; }
.tag b { font: 700 15px/1.2 'Space Grotesk', sans-serif; }
.tag span { font-size: 12px; width: 100%; text-align: left; }
.tc0 { background: var(--coral-soft); } .tc1 { background: var(--sage-soft); } .tc2 { background: var(--sky-soft); } .tc3 { background: var(--butter-soft); } .tc4 { background: var(--blush-soft); } .tc5 { background: #EFEAF8; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 10px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; z-index: 30; max-width: calc(100vw - 32px); font-size: 14px; }
.toast[hidden] { display: none; }
.toast button { background: none; border: 0; color: #fff; font-weight: 700; text-decoration: underline; }

@media print {
  body { background: #fff; font-size: 12pt; }
  .no-print, .x, .btn, .task-add, .search { display: none !important; }
  .layout { display: block; max-width: none; }
  .main { padding: 0; }
  .block, .card, .person, .tag, .stat { break-inside: avoid; box-shadow: none; }
  input, textarea, select { border-color: #bbb; }
  .tags { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .tag { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  a { text-decoration: none; }
}
