/* The Guluks — shell + components borrowed from the store dashboard (section_base / store_home / kalender_live),
   warmed up for a family site. */
:root {
  --bg: #f6f5f2; --surface: #ffffff; --line: #e8e6e1; --ink: #141414; --muted: #6b7280;
  --brand: #c8642a; --brand-soft: #fbeee6; --brand-ink: #9a4718; --good: #0a7a3a; --warn: #b7791f; --danger: #d8472b;
  --sidebar: #edebe6; --sidebar-w: 216px; --soft: #f3f1ec;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131313; --surface: #1d1d1f; --line: #2c2c2f; --ink: #f2f2f2; --muted: #a1a1a6;
    --brand: #e08a4e; --brand-soft: #2e2119; --brand-ink: #f0b48a; --sidebar: #191919; --soft: #262628; color-scheme: dark;
  }
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a.link { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
.serif { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }

/* shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100dvh; overflow-y: auto; padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
.sb-brand { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-weight: 600; font-size: 20px; letter-spacing: -.01em; padding: 4px 8px 0; }
.sb-sub { font-size: 12px; color: var(--muted); padding: 0 8px 14px; }
.nav-item { display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 10px; border-radius: 8px; color: var(--ink); font-size: 13.5px; font-weight: 500;
  border: none; background: transparent; cursor: pointer; text-align: left; transition: background .12s; }
.nav-item:hover { background: rgba(0,0,0,.05); }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item.ghost { color: var(--muted); }
.nav-badge { margin-left: auto; background: var(--brand); color: #fff; border-radius: 999px; font-size: 10.5px; font-weight: 700; padding: 1px 7px; line-height: 1.5; }
.nav-item.active .nav-badge { background: #fff; color: var(--brand); }
.sb-spacer { flex: 1; }
.main { min-width: 0; }
.wrap { max-width: 900px; margin: 0 auto; padding: 22px 22px 64px; }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; gap: 4px; padding: 8px 10px; align-items: center; }
  .sb-brand, .sb-sub, .sb-spacer { display: none; }
  .nav-item { height: 34px; white-space: nowrap; }
  .wrap { padding: 16px 16px 56px; }
}

/* shared */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.card.clip { overflow: hidden; }
.welcome { margin: 6px 2px 16px; }
.welcome h1 { font-size: 26px; font-weight: 680; letter-spacing: -.02em; }
.welcome .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.sec { font-size: 13px; font-weight: 660; letter-spacing: -.01em; margin: 24px 2px 8px; color: var(--ink); }
.sec .sec-sub { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 4px; }
.sec.wk-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: 8px; padding: 9px 16px; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.ghost { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); margin-right: 4px; vertical-align: middle; white-space: nowrap; }
.muted { color: var(--muted); }
input, select, textarea { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 999px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 60; }
.toast.on { opacity: 1; }

/* To do feed — ONE urgency signal per row (store spec 2026-08-18) */
.feed-row { display: flex; align-items: center; gap: 13px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.feed-row:last-child { border-bottom: none; }
.feed-row.u-warn { box-shadow: inset 3px 0 0 var(--warn); }
.feed-row.u-crit { box-shadow: inset 3px 0 0 var(--danger); }
.feed-main { flex: 1; min-width: 0; }
.feed-head { font-size: 14.5px; }
.feed-ctx { font-size: 12.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-due { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.feed-due.u-warn { color: var(--warn); font-weight: 600; }
.feed-due.u-crit { color: var(--danger); font-weight: 600; }
.feed-empty { padding: 16px; color: var(--muted); font-size: 13.5px; }
.feed-time { min-width: 48px; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--brand); font-size: 13px; }

/* to-dos */
.todo-add { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.todo-add input[type=text], .todo-add input:not([type]) { flex: 1; min-width: 160px; }
.todo-add button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 8px; padding: 6px 14px; font-size: 15px; font-weight: 600; cursor: pointer; }
.todo-add button:hover { background: var(--soft); color: var(--ink); }
.todo-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.todo-item:last-child { border-bottom: none; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--muted); }
.todo-check { width: 19px; height: 19px; border: 1.6px solid var(--line); border-radius: 6px; flex: 0 0 auto; cursor: pointer; display: grid; place-items: center; font-size: 12px; color: transparent; background: transparent; }
.todo-item.done .todo-check { background: var(--good); border-color: var(--good); color: #fff; }
.todo-text { flex: 1; font-size: 14.5px; }
.todo-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.todo-del { border: none; background: transparent; color: var(--muted); cursor: pointer; opacity: 0; font-size: 16px; }
.todo-item:hover .todo-del { opacity: 1; }
@media (hover: none) { .todo-del { opacity: 1; } }

/* week strip */
.wk-nav { font-size: 12px; font-weight: 700; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; width: 22px; height: 22px; cursor: pointer; color: var(--ink); line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.wk-nav:hover { background: var(--soft); }
.wk-nav.wk-today { width: auto; padding: 0 9px; color: var(--brand); }
.wk { display: grid; grid-template-columns: repeat(7, 1fr); }
.wk .wday { border-right: 1px solid var(--line); min-height: 150px; padding: 7px 8px; position: relative; min-width: 0; }
.wk .wday:last-child { border-right: none; }
.wk .wday.today { background: var(--brand-soft); }
.wk .wd-h { display: flex; align-items: baseline; gap: 5px; margin-bottom: 4px; white-space: nowrap; padding-right: 22px; }
.wk .wd-h b { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.wk .wd-h span { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--muted); }
.wk .wday.today .wd-h b, .wk .wday.today .wd-h span { color: var(--brand); }
.wk .wd-add { position: absolute; top: 5px; right: 6px; font-size: 15px; font-weight: 700; border: none; background: var(--soft); color: var(--brand); cursor: pointer; width: 22px; height: 22px; border-radius: 6px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.wk .wd-add:hover { background: var(--brand); color: #fff; }
.wev { display: block; max-width: 100%; font-size: 11px; font-weight: 600; background: var(--brand-soft); color: var(--brand-ink); border-radius: 5px; padding: 2px 6px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border: none; width: 100%; text-align: left; }
.wev.bd { background: #fdf3e2; color: #8a5a10; }
.wev .t { font-weight: 500; opacity: .75; }
.wev-more { font-size: 10px; color: var(--muted); display: block; margin-top: 1px; }
@media (max-width: 760px) { .wk { grid-template-columns: 1fr; } .wk .wday { border-right: none; border-bottom: 1px solid var(--line); min-height: 0; padding-bottom: 10px; }
  .wk .wday:last-child { border-bottom: none; } .wk.cur .wday:not(.today):not(.has-ev) { display: none; } }

/* month grid (kalender_live) */
.k-head { display: flex; align-items: center; gap: 12px; margin: 6px 2px 14px; flex-wrap: wrap; }
.k-head h1 { font-size: 22px; font-weight: 680; letter-spacing: -.02em; flex: 1; }
.k-nav { display: inline-flex; gap: 4px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.cal .wd { padding: 6px 8px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--soft); }
.cal .day { min-height: 96px; padding: 6px 7px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); position: relative; min-width: 0; }
.cal .day.other { background: var(--soft); color: var(--muted); }
.cal .day.today { background: var(--brand-soft); }
.cal .day .dn { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal .day.today .dn { color: var(--brand); }
.cal .day .wd-add { position: absolute; top: 4px; right: 5px; font-size: 14px; font-weight: 700; border: none; background: transparent; color: var(--muted); cursor: pointer; width: 20px; height: 20px; border-radius: 5px; line-height: 1; opacity: 0; }
.cal .day:hover .wd-add { opacity: 1; }
@media (max-width: 760px) { .cal { grid-template-columns: 1fr; } .cal .wd { display: none; } .cal .day.other { display: none; } .cal .day .dn::after { content: attr(data-wd); margin-left: 6px; color: var(--muted); font-weight: 500; } }

/* upcoming list / today list */
.ev-row { display: flex; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.ev-row:last-child { border-bottom: none; }
.ev-when { min-width: 58px; text-align: center; background: var(--soft); border-radius: 8px; padding: 4px 2px; line-height: 1.15; flex: 0 0 auto; }
.ev-when .d { font-size: 18px; font-weight: 600; }
.ev-when .m { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ev-main { flex: 1; min-width: 0; }
.ev-title { font-weight: 500; }
.ev-sub { font-size: 12.5px; color: var(--muted); }
.ev-notes { font-size: 12.5px; color: var(--muted); margin-top: 3px; white-space: pre-wrap; }
.ev-act { display: flex; gap: 2px; opacity: 0; }
.ev-row:hover .ev-act { opacity: 1; }
@media (hover: none) { .ev-act { opacity: 1; } }
.icon-btn { border: none; background: transparent; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; font-size: 14px; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }

/* family */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.person { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 18px; flex: none; font-family: "Iowan Old Style", Palatino, Georgia, serif; }
.person .main { flex: 1; min-width: 0; }
.person .title { font-weight: 600; }
.person .sub { font-size: 13px; color: var(--muted); }
.facts { white-space: pre-wrap; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.facts.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.person .ev-act { flex-direction: column; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.42); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal .box { width: min(520px, 100%); background: var(--surface); border-radius: 16px; padding: 20px 22px; box-shadow: 0 18px 50px rgba(0,0,0,.28); max-height: 90dvh; overflow-y: auto; }
.modal h3 { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.modal form { display: grid; gap: 10px; }
.modal .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal .foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.modal .foot .right { display: flex; gap: 8px; margin-left: auto; }
label.f { display: grid; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); }
label.f input, label.f select, label.f textarea { font-size: 14px; font-weight: 400; color: var(--ink); }
textarea { min-height: 72px; resize: vertical; }
.btn.danger { background: transparent; border: 1px solid var(--line); color: var(--danger); }
.who { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13.5px; }
.who label { display: inline-flex; gap: 5px; align-items: center; }
.who input { width: auto; }

/* ---- v3: icons, snapshot cards, detail pages, house ---- */
.ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
.ic.lg { width: 22px; height: 22px; }
.sb-me { font-size: 12px; color: var(--muted); padding: 6px 10px; display: flex; gap: 6px; align-items: center; }
.sb-me select { flex: 1; padding: 3px 6px; font-size: 12px; }
.feed-ico { color: var(--muted); display: grid; place-items: center; width: 22px; flex: none; }
.feed-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; white-space: pre-wrap; }
.feed-row.open .feed-desc { display: block; } .feed-row .feed-desc.hide { display: none; }
.owner-pill { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); margin-left: 6px; }
/* snapshot cards */
.snap { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.snap:hover { box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.snap .head { display: flex; gap: 12px; align-items: center; }
.snap .head .main { flex: 1; min-width: 0; }
.snap .ctx { font-size: 12.5px; color: var(--muted); }
.snap .line { display: flex; gap: 8px; align-items: center; font-size: 13px; min-width: 0; }
.snap .line .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snap .line .when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.snap .pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pill.warn { background: #fdf3e2; color: var(--warn); } .pill.crit { background: #fde8e4; color: var(--danger); }
.snap .none { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.snap .more { font-size: 12px; color: var(--brand); }
/* detail page */
.detail-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 14px; flex-wrap: wrap; }
.detail-head h1 { font-size: 22px; font-weight: 680; letter-spacing: -.02em; }
.detail-head .sub { color: var(--muted); font-size: 13.5px; }
.tabs { display: inline-flex; background: var(--soft); border-radius: 8px; padding: 2px; gap: 2px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { border: none; background: transparent; padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; }
.tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.seg { display: inline-flex; background: var(--soft); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { border: none; background: transparent; padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.fact-grp { padding: 10px 14px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fact { display: flex; gap: 10px; align-items: baseline; padding: 8px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.fact:last-child { border-bottom: none; }
.fact .lbl { width: 150px; font-size: 13px; color: var(--muted); flex: none; }
.fact .val { flex: 1; min-width: 160px; font-size: 14px; }
.fact .ct { font-size: 12.5px; color: var(--brand); cursor: pointer; white-space: nowrap; display: inline-flex; gap: 4px; align-items: center; margin-right: 10px; }
.fact .ct:hover { text-decoration: underline; }
.log-row { display: flex; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.log-row:last-child { border-bottom: none; }
.log-row .d { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); white-space: nowrap; width: 84px; flex: none; }
.log-row .t { flex: 1; white-space: pre-wrap; font-size: 14px; }
.add-row { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.add-row input, .add-row select { flex: 1; min-width: 120px; }
.add-row textarea { flex: 1 1 100%; min-height: 56px; }
.add-row button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 14px; cursor: pointer; }
.doc-row { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: none; }
.doc-row .main { flex: 1; min-width: 0; }
.doc-row .meta { font-size: 12.5px; color: var(--muted); }
.notes-area { width: 100%; min-height: 120px; }
/* house */
.break-row { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.break-row:last-child { border-bottom: none; }
.break-row:hover { background: var(--soft); }
.break-row .main { flex: 1; min-width: 0; }
.break-row .who { font-size: 13px; color: var(--muted); }
.break-row .tel { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.break-row .tel a { color: var(--brand); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--soft); }
.status-ok { color: var(--good); } .status-warn { color: var(--warn); } .status-bad { color: var(--danger); }
@media (max-width: 760px) { .fact .lbl { width: 100%; } .tbl { display: block; overflow-x: auto; } }
