/* Family Vault web app. Calm, card-based, light and dark. No external fonts or assets. */
:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --surface-2: #f0ede7;
  --text: #1d1d1f;
  --muted: #5c6064;
  --border: #e0dbd2;
  --accent: #247a6f;
  --accent-hover: #1c6259;
  --accent-soft: #e2f1ee;
  --on-accent: #ffffff;
  --amber: #f2a638;
  --amber-soft: #fdf0d9;
  --amber-text: #6b4100;
  --red: #b3261e;
  --red-soft: #fbe3e1;
  --orange: #a14a00;
  --orange-soft: #fde9d6;
  --green: #22693a;
  --green-soft: #def2e3;
  --info-soft: #e7eef6;
  --info: #28507a;
  --focus: #1b6fd1;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 2px 8px rgba(0, 0, 0, .04);
  --radius: 14px;
  --radius-sm: 9px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1413;
    --surface: #182120;
    --surface-2: #212b2a;
    --text: #eaefee;
    --muted: #a3adab;
    --border: #2e3a38;
    --accent: #5dbfb0;
    --accent-hover: #7fd0c3;
    --accent-soft: #1d3834;
    --on-accent: #062420;
    --amber: #f2a638;
    --amber-soft: #3a2c14;
    --amber-text: #f7cf8f;
    --red: #ff8a80;
    --red-soft: #3d1d1b;
    --orange: #ffb870;
    --orange-soft: #3a2816;
    --green: #86d69b;
    --green-soft: #183322;
    --info-soft: #1b2a3a;
    --info: #9cc3ec;
    --focus: #8ab8ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
code { font: .85em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; word-break: break-all; }
kbd { font: 12px ui-monospace, Menlo, monospace; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--surface); color: var(--text); }
.kbd-group { display: inline-flex; gap: 4px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.icon { flex: none; }
.flip .icon { transform: rotate(180deg); }
[hidden] { display: none !important; }

/* ---- buttons and inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px;
  padding: 7px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.active, .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-danger { color: #2a0c0a; } }
.btn-danger:hover { filter: brightness(1.08); background: var(--red); color: #fff; }
.btn-danger-text { color: var(--red); }
.btn-small { min-height: 32px; padding: 4px 10px; font-size: .88rem; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: none;
  border: 0; border-radius: 10px; background: transparent; color: var(--text); cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--surface-2); }
.linklike { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-align: left; text-decoration: underline; text-underline-offset: 2px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 11px; min-height: 40px; max-width: 100%; min-width: 0;
}
textarea { resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 0; }
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
input:disabled, select:disabled, textarea:disabled { opacity: .7; }
input.narrow { width: 90px; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-weight: 600; font-size: .9rem; }
.field input:not([type=checkbox]), .field select { width: 100%; }
.hint { color: var(--muted); font-size: .85rem; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.chips { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips legend { font-weight: 600; font-size: .9rem; margin-bottom: 6px; padding: 0; }
.chip { border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px; background: var(--surface); font-size: .88rem; }
.chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 8px; }
.form-status { color: var(--red); min-height: 1.2em; margin-top: 8px; }
.notice { background: var(--info-soft); color: var(--text); border-radius: var(--radius-sm); padding: 10px 12px; }
.notice-error { background: var(--red-soft); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }

/* ---- pills and avatars */
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 9px; font-size: .78rem; font-weight: 650; white-space: nowrap; }
.pill-overdue { background: var(--red-soft); color: var(--red); }
.pill-dueSoon { background: var(--orange-soft); color: var(--orange); }
.pill-upToDate { background: var(--green-soft); color: var(--green); }
.pill-info { background: var(--info-soft); color: var(--info); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 650;
  flex: none; box-shadow: 0 0 0 2px var(--surface); letter-spacing: .02em;
}
.avatars { display: inline-flex; align-items: center; }
.avatars .avatar + .avatar { margin-left: -6px; }
.avatars-more { font-size: .75rem; color: var(--muted); margin-left: 4px; }

/* ---- sign in */
.signin { max-width: 440px; margin: 0 auto; padding: 8vh 16px 40px; }
.signin-brand { display: flex; align-items: center; gap: 12px; justify-content: center; font-size: 1.5rem; font-weight: 700; margin-bottom: 20px; }
.signin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.signin-card h1 { font-size: 1.35rem; }
.code-input { font-size: 1.5rem; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }

/* ---- shell */
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; height: 58px; padding: 0 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--text); }
.hh-select { min-height: 34px; padding: 4px 8px; max-width: 180px; }
.hh-name { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.shared-badge { display: inline-flex; align-items: center; gap: 5px; background: var(--amber-soft); color: var(--amber-text); border-radius: 999px; padding: 4px 10px; font-size: .8rem; font-weight: 600; }
.bell .badge { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
@media (prefers-color-scheme: dark) { .bell .badge { color: #2a0c0a; } }
.menu-btn { display: none; }
.layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: calc(100vh - 58px); }
.sidenav { position: sticky; top: 58px; align-self: start; height: calc(100vh - 58px); overflow-y: auto; padding: 14px 10px; border-right: 1px solid var(--border); }
.sidenav ul { list-style: none; margin: 0; padding: 0; }
.sidenav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 520; }
.sidenav a:hover { background: var(--surface-2); color: var(--text); }
.sidenav a.active { background: var(--accent-soft); color: var(--text); font-weight: 650; }
.sidenav a.active .icon { color: var(--accent); }
.nav-note { margin: 16px 12px 0; font-size: .8rem; color: var(--muted); }
.scrim { display: none; }
.content { min-width: 0; padding: 0 0 60px; }
.main { outline: none; }
.page { max-width: 1100px; margin: 0 auto; padding: 22px 24px; min-width: 0; }
.narrow-page { max-width: 760px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.page-head > div:first-child { min-width: 0; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crumb { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-size: .9rem; margin-bottom: 6px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.toolbar input[type=search] { flex: 1 1 220px; }
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 60vh; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } * { scroll-behavior: auto !important; transition: none !important; } }

/* ---- banner (renewal reminders) */
.banner-slot { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.banner { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 55%, transparent); border-left: 5px solid var(--amber); border-radius: var(--radius-sm); padding: 12px 12px 12px 14px; color: var(--text); }
.banner > .icon { color: var(--amber-text); margin-top: 2px; }
.banner ul { margin: 4px 0; padding-left: 18px; }
.banner a { color: var(--amber-text); font-weight: 600; }

/* ---- cards and lists */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card-alert { border-color: var(--amber); background: var(--amber-soft); }
.danger-card h2 { color: var(--red); }
details.card summary { cursor: pointer; font-weight: 600; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty h3 { color: var(--text); }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.drop-hint { color: var(--muted); font-size: .88rem; display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.dropping { outline: 3px dashed var(--accent); outline-offset: -6px; border-radius: var(--radius); background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }
.small-h { font-size: .9rem; color: var(--muted); text-transform: none; }

.doc-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card .doc-list { border: 0; border-radius: 0; margin: 0 -18px -18px; }
.doc-row { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--border); padding-right: 12px; flex-wrap: wrap; }
.doc-row:first-child { border-top: 0; }
.doc-link { flex: 1 1 280px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-width: 0; color: var(--text); text-decoration: none; }
.doc-link:hover { color: var(--text); background: var(--surface-2); }
.doc-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.doc-title { font-weight: 620; overflow-wrap: anywhere; display: inline-flex; align-items: center; gap: 6px; }
.doc-meta { color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-date { display: flex; flex-direction: column; align-items: flex-end; font-size: .88rem; white-space: nowrap; }
.doc-date small { color: var(--muted); }
.doc-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding: 0 0 0 14px; }
.doc-row .doc-side:empty { display: none; }
.fav { color: var(--amber); display: inline-flex; }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.cat-insurance { background: #3b7dd8; } .cat-vehicle { background: #e2743a; } .cat-home { background: #2f9e76; }
.cat-identity { background: #8757d6; } .cat-health { background: #d9475b; } .cat-finance { background: #c9a227; }
.cat-utilities { background: #1d9bb8; } .cat-warranties { background: #6b7c93; } .cat-education { background: #5b6ee1; }
.cat-legal { background: #7a5c3e; } .cat-pets { background: #d6813b; } .cat-other { background: #8a8f94; }
.folder-grid { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.folder-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.folder-card:hover { color: var(--text); border-color: var(--accent); }
.folder-card .icon { color: var(--accent); }
.folder-card small { display: block; color: var(--muted); }
.timeline-section { margin-bottom: 20px; }
.timeline-section > h2 { font-size: 1rem; color: var(--muted); margin-bottom: 8px; }
.overdue-h { color: var(--red) !important; }
details.timeline-section summary { cursor: pointer; font-weight: 600; color: var(--muted); margin-bottom: 8px; }

/* ---- home */
.search-wrap { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 6px 14px; box-shadow: var(--shadow); margin-bottom: 18px; }
.search-wrap:focus-within { border-color: var(--accent); }
.search-wrap .icon { color: var(--muted); }
.big-search { border: 0; flex: 1; font-size: 1.15rem; min-height: 48px; background: transparent; padding: 6px 0; outline: none !important; }
.greeting { margin-top: 4px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.result-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.result-list li + li { border-top: 1px solid var(--border); }
.result { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.result:hover, .result:focus-visible { background: var(--surface-2); }
.result strong { display: block; overflow-wrap: anywhere; }
.result small { color: var(--muted); }
.result-kind { font-size: .75rem; font-weight: 650; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 7px; flex: none; min-width: 74px; text-align: center; }

/* ---- document page */
.doc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.doc-grid > * { margin-bottom: 0; }
.facts { margin: 0; display: grid; gap: 10px; }
.facts > div { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.notes { margin-top: 14px; }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-row { display: flex; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: 10px; padding: 2px 4px 2px 2px; }
.file-open { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 8px 10px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; border-radius: 8px; }
.file-open:hover { background: var(--surface-2); }
.file-open .icon { color: var(--accent); }
.file-name { display: block; font-weight: 580; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-open small { color: var(--muted); }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.danger-zone { margin-top: 20px; }

/* ---- dialogs */
.dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dialog-wide { width: min(860px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(10, 15, 14, .45); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 6px 20px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dialog-head h2 { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.dialog-body { padding: 8px 20px 20px; }
.dialog-body h3 { margin-top: 18px; }
.dialog-viewer { width: min(1100px, calc(100vw - 24px)); }
.viewer-frame { width: 100%; height: min(78vh, 900px); border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.viewer-image { display: flex; justify-content: center; background: var(--surface-2); border-radius: 10px; padding: 8px; }
.viewer-image img { max-height: 75vh; object-fit: contain; }
.radio-group { border: 0; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 8px; }
.radio-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card small { display: block; color: var(--muted); }
.people-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.people-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.people-list li:first-child { border-top: 0; }
.people-list li > .grow > span, .people-list li > .grow > small { display: block; overflow-wrap: anywhere; }
.people-list small { color: var(--muted); }
.people-list.compact li { padding: 4px 0; border: 0; }
.who-list h3 { font-size: .95rem; }
.link-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.link-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.link-list small { color: var(--muted); }
.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.activity-list li { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.activity-list small { color: var(--muted); }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li + li { border-top: 1px solid var(--border); }
.notif-list .linklike { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px 4px; color: var(--text); text-decoration: none; }
.notif-list .unread strong::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; }
.notif-list small { color: var(--muted); }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.shortcuts dd { margin: 0; }
.scroll-box { max-height: 40vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.link-editor .row { margin-bottom: 8px; }
.link-editor input:first-child { width: 34%; }

/* ---- toasts */
.toasts { position: fixed; z-index: 1000; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--text); color: var(--bg); border-radius: 12px; padding: 10px 8px 10px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.toast-body { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.toast .icon-btn { color: inherit; width: 30px; height: 30px; }
.toast .icon-btn:hover { background: rgba(127, 127, 127, .25); }
.toast .btn { background: transparent; color: inherit; border-color: currentColor; }
.toast-error { background: var(--red); color: #fff; }
@media (prefers-color-scheme: dark) { .toast-error { color: #2a0c0a; } }

/* ---- launchpad */
.launchpad { display: flex; flex-direction: column; gap: 20px; }
.link-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 16px; }
.link-group.drop-target { border-color: var(--accent); }
.group-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.group-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.group-head.draggable { cursor: grab; }
.group-dot { width: 12px; height: 12px; border-radius: 4px; }
.tile-grid { list-style: none; margin: 0; padding: 4px; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; min-height: 40px; border-radius: 10px; }
.tile-grid.drop-target { background: var(--accent-soft); }
.tile-wrap { position: relative; }
.tile-wrap.dragging { opacity: .4; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px 10px; border-radius: 12px; color: var(--text); text-decoration: none; text-align: center; height: 100%; }
.tile:hover, .tile:focus-visible { background: var(--surface-2); color: var(--text); }
.tile-icon, .tile-letter { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex: none; }
.tile-icon { background: var(--surface-2); border: 1px solid var(--border); }
.tile-img { width: 32px; height: 32px; object-fit: contain; }
.tile-letter { color: #fff; font-weight: 700; font-size: 1.35rem; }
.tile-title { font-size: .84rem; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.tile-tools { position: absolute; top: 0; right: 0; display: flex; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); }
.tile-tools .icon-btn { width: 28px; height: 28px; }
.gc-teal { background: #247a6f; } .gc-blue { background: #2f6fc0; } .gc-purple { background: #7b52c7; } .gc-pink { background: #c2477f; }
.gc-red { background: #c0392b; } .gc-orange { background: #c8632a; } .gc-yellow { background: #a8840f; } .gc-green { background: #3a8a45; } .gc-grey { background: #6b7280; }

/* ---- to-dos and shopping */
.split { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.split-main { min-width: 0; }
.sublist ul { list-style: none; margin: 0 0 10px; padding: 0; }
.sublist button:not(.btn) { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 10px; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.sublist button:not(.btn):hover { background: var(--surface-2); }
.sublist button.active { background: var(--accent-soft); font-weight: 650; }
.count { font-size: .78rem; color: var(--muted); }
.quick-add { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 6px 6px 6px 12px; margin-bottom: 16px; }
.quick-add input { border: 0; background: transparent; outline: none !important; }
.quick-add .icon { color: var(--muted); }
.task-list, .shop-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.task, .shop-item { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--border); }
.task:first-child, .shop-item:first-child { border-top: 0; }
.task input[type=checkbox], .shop-item input[type=checkbox] { width: 22px; height: 22px; }
.task-main, .item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 6px 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.task-title, .item-name { font-weight: 560; overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .84rem; color: var(--muted); }
.task-meta .overdue { color: var(--red); font-weight: 600; }
.item-main small, .shop-item small { color: var(--muted); font-size: .84rem; }
.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.done-toggle { margin: 12px 0; }
.task-list.done { opacity: .85; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 6px 14px; font: inherit; cursor: pointer; }
.tabs button.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.aisle { margin-bottom: 18px; }
.aisle h2 { font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.shop-item.bought .item-name { color: var(--muted); }
.shop-item.bought .grow > * { display: block; }
.chip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 12px; font: inherit; cursor: pointer; }
.chip-btn:hover { border-color: var(--accent); }

/* ---- calendar */
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.segmented button { border: 0; background: var(--surface); color: var(--text); padding: 6px 12px; font: inherit; cursor: pointer; }
.segmented button.active { background: var(--accent); color: var(--on-accent); }
.month-name { min-width: 130px; text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 12px; }
.legend-item { border-left: 4px solid var(--person); padding-left: 6px; }
.legend-item input { accent-color: var(--person); }
.cal-grid { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head > div { padding: 8px; font-size: .8rem; font-weight: 650; color: var(--muted); text-align: center; border-bottom: 1px solid var(--border); }
.cal-cell { min-height: 108px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-row .cal-cell:nth-child(7n) { border-right: 0; }
.cal-row:last-child .cal-cell { border-bottom: 0; }
.cal-cell.other-month { background: var(--surface-2); }
.cal-cell.other-month .cal-day { color: var(--muted); }
.cal-day { align-self: flex-start; border: 0; background: none; color: var(--text); font: inherit; font-size: .85rem; font-weight: 600; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; }
.cal-day:hover { background: var(--accent-soft); }
.cal-cell.today .cal-day { background: var(--accent); color: var(--on-accent); }
.cal-chip { display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0; border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; font: inherit; font-size: .78rem; text-align: left; cursor: pointer; color: var(--text);
  background: color-mix(in srgb, var(--person) 18%, var(--surface)); }
.cal-chip:hover { background: color-mix(in srgb, var(--person) 30%, var(--surface)); }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--person); flex: none; }
.chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip.kind-task { background: transparent; border-color: color-mix(in srgb, var(--person) 60%, transparent); }
.cal-chip.kind-renewal { background: var(--amber-soft); border-color: var(--amber); }
.cal-chip.kind-shared { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--person) 16%, var(--surface)) 0 6px, var(--surface) 6px 12px); }
.more { font-size: .78rem; }
.agenda-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.agenda-day h2 { font-size: .95rem; }
.agenda-day ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.agenda-day li { display: flex; align-items: center; gap: 10px; }
.agenda-day .cal-chip { font-size: .9rem; padding: 6px 10px; }

/* ---- legacy */
.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 6px 0 16px; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.area-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.area-card { position: relative; display: flex; flex-direction: column; gap: 4px; width: 100%; height: 100%; text-align: left; padding: 14px 36px 14px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.area-card:hover { border-color: var(--accent); }
.area-card small { color: var(--muted); }
.area-card.started { background: var(--accent-soft); }
.area-card .icon { position: absolute; top: 12px; right: 12px; color: var(--accent); }
.entries { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.entry { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 0; }
.entry legend { font-weight: 650; padding: 0 6px; }
.entry .form-grid { margin-bottom: 8px; }
.entry-read { padding: 10px 0; border-top: 1px solid var(--border); }
.steps { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* ---- responsive */
@media (max-width: 1000px) {
  .doc-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: fixed; top: 58px; left: 0; bottom: 0; width: 260px; height: calc(100vh - 58px); height: calc(100dvh - 58px); z-index: 30; background: var(--surface); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); visibility: hidden; }
  body.nav-open .sidenav { transform: none; visibility: visible; }
  body.nav-open .scrim { display: block; position: fixed; inset: 58px 0 0 0; background: rgba(0, 0, 0, .3); z-index: 25; }
  .split { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .sublist ul { display: flex; flex-wrap: wrap; gap: 6px; }
  .sublist li { flex: none; }
  .sublist button:not(.btn) { border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; width: auto; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  h1 { font-size: 1.35rem; }
  .page { padding: 16px 16px; }
  .banner-slot { padding: 0 16px; }
  .topbar { padding: 0 6px; gap: 4px; }
  .brand span { display: none; }
  .hide-sm { display: none; }
  .hh-select { max-width: 130px; }
  .hh-name { max-width: 120px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .facts > div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .doc-link { flex-basis: 100%; padding: 10px 12px; }
  .doc-side { padding: 0 0 10px 34px; justify-content: flex-start; }
  .doc-row { padding-right: 0; }
  .card { padding: 14px; }
  .card .doc-list { margin: 0 -14px -14px; }
  .dialog-body { padding: 6px 14px 16px; }
  .dialog-head { padding: 10px 8px 4px 14px; }
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 4px; }
  .tile-icon, .tile-letter { width: 46px; height: 46px; }
  .cal-cell { min-height: 64px; padding: 2px; }
  .cal-chip.compact .chip-text { display: none; }
  .cal-chip.compact { width: auto; padding: 3px; border-radius: 50%; }
  .cal-head > div { padding: 6px 0; font-size: .72rem; }
  .month-name { min-width: 0; }
  .toasts { left: 16px; right: 16px; bottom: 12px; max-width: none; }
  .result-kind { min-width: 0; }
  .link-editor .row { flex-wrap: wrap; }
  .link-editor input:first-child { width: 100%; }
  .people-list select { max-width: 100%; }
}
.month-nav { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
