/* Layout idea: fixed sidebar + scrolling main; everything in soft paper cards on warm ivory. Single light theme by choice. */
:root {
  color-scheme: light;
  --ivory: #FAF4E8;
  --paper: #FFFDF8;
  --ink: #1F2B1E;
  --muted: #6A7163;
  --green: #3F5A3A;
  --green-deep: #2B4128;
  --sage: #A3A56E;
  --sand: #EFE1C6;
  --clay: #D98C70;
  --line: #EADFCB;
  --tile-events: #EDEFD8;
  --tile-tasks: #F8DFD2;
  --tile-meals: #DCE7EE;
  --tile-reset: #F6EBCB;
  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --body: "Inter", "Helvetica Neue", Arial, sans-serif;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(63, 52, 28, .05), 0 8px 24px rgba(63, 52, 28, .06);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--ivory); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.02em; margin: 0; text-wrap: balance; }
.ic { width: 22px; height: 22px; flex: none; }
.caps { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; }

/* Shell */
body { display: flex; flex-direction: column; }
#app { display: grid; grid-template-columns: 236px 1fr; flex: 1; min-height: 0; }
.side { background: var(--paper); border-right: 1px solid var(--line); padding: 26px 16px 18px; display: flex; flex-direction: column; gap: 22px; overflow-y: auto; }
.side > * { flex: none; }
.logo { width: 150px; height: auto; color: var(--green-deep); display: block; margin-left: 8px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--ivory); }
.nav a[aria-current="page"] { background: var(--green); color: #fff; box-shadow: 0 4px 12px rgba(63, 90, 58, .25); }
.fam { border-top: 1px solid var(--line); padding-top: 18px; display: flex; flex-direction: column; gap: 2px; }
.fam .caps { color: var(--muted); padding: 0 14px 8px; }
.fam button { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-radius: 10px; text-align: left; font-weight: 500; }
.fam button:hover { background: var(--ivory); }
.fam button[aria-pressed="false"] { opacity: .38; }
.dot { width: 20px; height: 20px; border-radius: 50%; background: var(--c, var(--sand)); flex: none; }
.dot.sm { width: 14px; height: 14px; }
.side-foot { margin-top: auto; }
.ghost { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; font-weight: 500; color: var(--muted); }
.ghost:hover { background: var(--ivory); color: var(--ink); }
.ghost .ic { width: 18px; height: 18px; }

.main { overflow-y: auto; padding: 30px 34px 44px; }
.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head h1 { font-size: clamp(36px, 4.6vw, 56px); line-height: 1.02; margin: 4px 0 8px; }
.head .sub { color: var(--muted); }
.week { display: flex; align-items: center; gap: 6px; }
.week .range { min-width: 150px; text-align: center; }
.round { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; }
.round:hover { background: var(--sand); }
.pill { padding: 7px 14px; border-radius: 99px; background: var(--sand); font-weight: 600; font-size: 13px; }
.pill:hover { background: #e6d5b4; }

/* Cards */
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 25px; }
.link { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; color: var(--ink); text-decoration: none; }
.link:hover { color: var(--green); text-decoration: underline; }
.count { color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.tile { border-radius: var(--radius); padding: 18px 20px; display: flex; gap: 16px; align-items: flex-start; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.tile:hover { transform: translateY(-1px); }
.tile .badge { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .55); }
.tile .badge .ic { width: 28px; height: 28px; }
.tile b { font-family: var(--display); font-weight: 600; font-size: 40px; line-height: 1; letter-spacing: -.02em; display: block; font-variant-numeric: tabular-nums; }
.tile span { display: block; font-size: 18px; margin-top: 2px; }
.tile small { display: block; margin-top: 6px; }
.t-events { background: var(--tile-events); } .t-tasks { background: var(--tile-tasks); }
.t-meals { background: var(--tile-meals); } .t-reset { background: var(--tile-reset); }
.t-tasks .badge { background: var(--clay); color: #fff; }
.t-meals .badge { background: #a9cfe6; }

.row2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.row2b { display: grid; grid-template-columns: 1fr 1.6fr; gap: 20px; }
.row2b.meals-layout { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }

/* Calendar grid */
.cal-scroll { overflow-x: auto; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(92px, 1fr)); min-width: 660px; }
.day { border-left: 1px solid var(--line); padding: 0 5px 6px; display: flex; flex-direction: column; gap: 6px; min-height: 170px; }
.day:first-child { border-left: 0; }
.cal.big .day { min-height: 420px; }
.day-head { text-align: center; padding: 4px 0 10px; border-bottom: 1px solid var(--line); margin: 0 -5px 4px; width: calc(100% + 10px); border-radius: 0; }
.day-head b { display: block; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.day-head small { display: block; margin-top: 3px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.day.today .day-head b { color: #fff; background: var(--green); border-radius: 99px; display: inline-block; padding: 1px 10px; }
.day-head:hover b { text-decoration: underline; }
.chip { display: block; width: 100%; text-align: left; border-radius: 10px; padding: 7px 9px; background: color-mix(in srgb, var(--c, var(--sand)) 58%, var(--paper)); font-size: 13.5px; line-height: 1.25; overflow-wrap: anywhere; }
.chip:hover { background: color-mix(in srgb, var(--c, var(--sand)) 80%, var(--paper)); }
.chip b { display: block; font-weight: 700; }
.chip .rep { opacity: .6; font-size: 11px; }
.add-day { margin-top: auto; opacity: 0; color: var(--muted); font-size: 13px; padding: 6px; border-radius: 8px; border: 1px dashed var(--line); }
.day:hover .add-day, .add-day:focus-visible { opacity: 1; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.cb { appearance: none; width: 24px; height: 24px; border: 1.5px solid #c9c2ae; border-radius: 6px; background: #fff; flex: none; cursor: pointer; display: grid; place-items: center; margin: 0; }
.cb:checked { background: var(--green); border-color: var(--green); }
.cb:checked::after { content: ""; width: 11px; height: 6px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(-45deg) translateY(-1px); }
.list label.t { flex: 1; font-size: 16px; cursor: pointer; min-width: 0; overflow-wrap: anywhere; }
.done .t, .done .inline { color: var(--muted); text-decoration: line-through; }
.who { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14.5px; white-space: nowrap; }
.inline { flex: 1; min-width: 0; border: 0; background: transparent; padding: 6px 8px; border-radius: 8px; font-size: 16px; }
.inline:hover { background: var(--ivory); }
.inline:focus { background: #fff; outline: 2px solid var(--sage); }
.sel { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 10px; max-width: 150px; }
.del { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); flex: none; }
.del:hover { background: var(--tile-tasks); color: #9c4a2d; }
.del .ic { width: 17px; height: 17px; }
.addrow { display: flex; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.field { flex: 1; min-width: 160px; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 14px; }
.btn { background: var(--green); color: #fff; border-radius: 12px; padding: 10px 18px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { background: var(--green-deep); }
.btn.soft { background: var(--sand); color: var(--ink); }
.btn.soft:hover { background: #e6d5b4; }
.btn.danger { background: transparent; color: #9c4a2d; padding-left: 4px; padding-right: 4px; }
.btn .ic { width: 18px; height: 18px; }
.bar { height: 10px; border-radius: 99px; background: var(--sand); overflow: hidden; margin-bottom: 14px; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width .25s; }

/* Meals */
.meals { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.meal { text-align: center; }
.meal .caps { display: block; margin-bottom: 8px; }
.meal .plate { border-radius: 14px; background: var(--ivory); border: 1px solid var(--line); min-height: 78px; display: grid; place-items: center; padding: 10px 4px; font-size: 13px; line-height: 1.25; overflow-wrap: break-word; min-width: 0; }
.meal .plate.none { color: var(--muted); border-style: dashed; background: transparent; }
.mealrows { display: flex; flex-direction: column; gap: 10px; }
.mealrow { display: grid; grid-template-columns: 62px 1fr; align-items: center; gap: 12px; }

/* Modal */
.back { position: fixed; inset: 0; background: rgba(31, 43, 30, .32); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal { background: var(--paper); border-radius: 22px; padding: 26px; width: min(520px, 100%); max-height: 100%; overflow-y: auto; box-shadow: 0 24px 60px rgba(31, 43, 30, .25); display: flex; flex-direction: column; gap: 14px; }
.modal h2 { font-size: 28px; }
.modal label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.modal .field { min-width: 0; color: var(--ink); font-weight: 400; font-size: 15px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; }
.actions { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }
.actions .grow { margin-right: auto; }
.mrow { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.swatches { grid-column: 1 / -1; display: flex; gap: 7px; flex-wrap: wrap; }
.swatches input { appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--c); margin: 0; cursor: pointer; border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--line); }
.swatches input:checked { box-shadow: 0 0 0 2px var(--ink); }
.note { color: var(--muted); font-size: 13px; margin: 0; }
textarea.field { min-height: 70px; resize: vertical; font-size: 12px; font-family: ui-monospace, Menlo, monospace; }
h3 { font-size: 19px; margin-top: 8px; }

@media (max-width: 1080px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .row2, .row2b, .row2b.meals-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .side { flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .logo { width: 104px; margin: 0; flex: none; }
  .nav { flex-direction: row; flex: 1; min-width: 0; overflow-x: auto; justify-content: space-between; }
  .nav a { padding: 10px 9px; white-space: nowrap; }
  .nav a span { display: none; }
  .fam { display: none; }
  .side-foot { margin: 0; flex: none; }
  .ghost { padding: 10px; }
  .logo { width: 92px !important; }
  input, select, .field { font-size: 16px !important; }
  .fchips { display: flex !important; }
  .side-foot span { display: none; }
  .main { padding: 20px 16px 36px; }
  .meals { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 460px) { .tiles { grid-template-columns: 1fr; } .two { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .tile:hover { transform: none; } }

/* Notices */
.notice { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; padding: 10px 18px; font-size: 14px; border-bottom: 1px solid var(--line); }
.notice.warn { background: var(--tile-tasks); color: #5a2a17; }
.notice.info { background: var(--tile-reset); }
.notice p { margin: 0; flex: 1; min-width: 220px; }
.notice .btn { padding: 7px 12px; font-size: 13px; }

/* First-run setup */
.ob { grid-column: 1 / -1; overflow-y: auto; padding: 32px 16px; display: grid; justify-items: center; align-content: start; }
.ob-card { width: min(560px, 100%); display: flex; flex-direction: column; gap: 14px; }
.ob-card .logo { width: 170px !important; margin: 0 0 4px; }
.ob-card h1 { font-size: 36px; line-height: 1.05; }
.ob-card label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ob-card label.f .field { color: var(--ink); font-weight: 400; font-size: 15px; }
.msg-err { color: #9c4a2d; }
.msg-list { margin: 6px 0 0; padding-left: 18px; }

/* Calendar: week / agenda switch, day strip, agenda rows */
.seg { display: inline-flex; background: var(--ivory); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--green); color: #fff; }
.tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dstrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 16px; }
.dstrip button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); min-height: 64px; }
.dstrip b { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.dstrip span { font-family: var(--display); font-size: 20px; font-weight: 600; line-height: 1.1; }
.dstrip i { width: 6px; height: 6px; border-radius: 50%; }
.dstrip .has i { background: var(--clay); }
.dstrip .today { border-color: var(--green); }
.dstrip button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.dstrip button[aria-pressed="true"].has i { background: #fff; }
.agenda { display: flex; flex-direction: column; gap: 8px; }
.agenda h3 { margin: 8px 0 2px; display: flex; align-items: baseline; gap: 10px; }
.agenda h3 small { font-family: var(--body); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; color: var(--green); }
.arow { display: grid; grid-template-columns: 66px 1fr; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 11px 14px; border-radius: 12px; min-height: 52px; background: color-mix(in srgb, var(--c, var(--sand)) 50%, var(--paper)); overflow-wrap: anywhere; }
.arow:hover { background: color-mix(in srgb, var(--c, var(--sand)) 72%, var(--paper)); }
.arow b { font-weight: 700; }
.arow small { display: block; color: var(--muted); font-size: 12.5px; }
.fchips { display: none; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin-bottom: 10px; }
.fchips button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--paper); white-space: nowrap; font-size: 13px; font-weight: 500; }
.fchips button[aria-pressed="false"] { opacity: .4; }

/* Calendar export dialog */
.callout { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--tile-reset); font-size: 14px; }
.how { border-top: 1px solid var(--line); padding-top: 12px; font-size: 14px; }
.how summary { cursor: pointer; font-weight: 600; }
.how ol { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.modal .check { align-items: flex-start; }
.modal .check .cb { margin-top: 1px; }
