/* Family Care Hub — styles. Mobile first; sidebar layout from 900px. */
/* Colours come from the 44 house logo: green #45E51A → teal #00C89B → blue #078FE8 → deep blue #0750D8.
   Buttons and text links use a deeper blue so white/black text on them stays easy to read. */
:root {
  --bg: #f2f6fa; --surface: #ffffff; --surface-2: #e9f0f6; --border: #d7e2ec;
  --text: #11223a; --muted: #586a7f; --primary: #0863c4; --primary-hover: #0752a6; --primary-ink: #ffffff; --primary-soft: #e1eefc;
  --accent: #00a88a; --accent-soft: #dcf6ee;
  --brand: linear-gradient(110deg, #45E51A 0%, #00C89B 38%, #078FE8 72%, #0750D8 100%);
  --danger: #b3412f; --danger-soft: #f9e4df; --warn: #8a5d00; --warn-soft: #fbefd2; --ok: #1f7f3e; --ok-soft: #dff3e4;
  --info-soft: #e4effb; --shadow: 0 1px 2px rgba(17, 34, 58, .05), 0 3px 10px rgba(17, 34, 58, .05);
  --radius: 14px; --radius-sm: 10px; --top: 56px; --tabbar: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1320; --surface: #121d2c; --surface-2: #1a2737; --border: #263649; --text: #e3ecf6; --muted: #93a5ba;
    --primary: #4ba6ff; --primary-hover: #6fb8ff; --primary-ink: #04172b; --primary-soft: #11304f; --accent: #2fd6b2; --accent-soft: #0f3330;
    --danger: #ec8a78; --danger-soft: #3a2320; --warn: #e3b555; --warn-soft: #362c17; --ok: #6fdb8f; --ok-soft: #133222; --info-soft: #142a42;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1320; --surface: #121d2c; --surface-2: #1a2737; --border: #263649; --text: #e3ecf6; --muted: #93a5ba;
  --primary: #4ba6ff; --primary-hover: #6fb8ff; --primary-ink: #04172b; --primary-soft: #11304f; --accent: #2fd6b2; --accent-soft: #0f3330;
  --danger: #ec8a78; --danger-soft: #3a2320; --warn: #e3b555; --warn-soft: #362c17; --ok: #6fdb8f; --ok-soft: #133222; --info-soft: #142a42;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
body.modal-open { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h3 { font-size: 1.02rem; }
p { margin: .4rem 0; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.clamp { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic { width: 20px; height: 20px; flex: none; }
.logo { width: 48px; height: 36px; flex: none; } /* logo is wider than tall (832 × 632) */
.brand-strip, .visit, .login { position: relative; overflow: hidden; }
.brand-strip::before, .visit::before, .login::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--brand); }

/* ---------- layout ---------- */
.layout { min-height: 100vh; min-height: 100dvh; }
.sidebar { display: none; }
.content { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; height: calc(var(--top) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0; display: flex; align-items: center; gap: 12px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .logo { width: 40px; height: 30px; }
.topbar-title { font-size: 1.08rem; flex: 1; }
.acct { position: relative; }
.topbar-me { display: flex; align-items: center; gap: 2px; padding: 4px 4px 4px 4px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; color: var(--muted); }
.topbar-me:hover { background: var(--surface-2); }
.acct-chev { width: 16px; height: 16px; transform: rotate(90deg); }
.acct-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; width: 230px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.acct-menu[hidden] { display: none; }
.acct-who { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.acct-who small { display: block; color: var(--muted); font-size: .78rem; }
.acct-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); text-decoration: none; font-size: .95rem; cursor: pointer; text-align: left; }
.acct-item:hover { background: var(--surface-2); }
.acct-item.danger { color: var(--danger); font-weight: 600; }
.signout { margin-top: 10px; }
.main { padding: 16px 16px calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; }
.bottomnav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.tab { position: relative; height: var(--tabbar); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .72rem; color: var(--muted); text-decoration: none; }
.tab .ic { width: 23px; height: 23px; }
.tab.active { color: var(--primary); font-weight: 600; }
.tab .badge { position: absolute; top: 7px; left: calc(50% + 6px); }

@media (min-width: 900px) {
  .layout { display: grid; grid-template-columns: 252px minmax(0, 1fr); }
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px; background: var(--surface); border-right: 1px solid var(--border); }
  .bottomnav, .topbar { display: none; }
  .main { padding: 28px 32px 48px; }
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand small { display: block; color: var(--muted); font-size: .78rem; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: .95rem; }
.nav-item:hover { background: var(--surface-2); }
.nav-item { position: relative; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 4px; background: linear-gradient(180deg, #45E51A, #00C89B 45%, #078FE8); }
.nav-item .badge { margin-left: auto; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; }
.me { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.me > div { flex: 1; min-width: 0; }
.me small { display: block; color: var(--muted); font-size: .78rem; }
.proto-note { font-size: .75rem; color: var(--muted); padding: 8px 6px 0; margin: 0; }

/* ---------- primitives ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 0; }
.card h3 { margin-bottom: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h3 { margin: 0; }
.card-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 6px; padding: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface-2); cursor: pointer; text-decoration: none; font-weight: 600; font-size: .95rem; color: var(--text); white-space: nowrap; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: .87rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm .ic { width: 18px; height: 18px; }
.icon-btn.primary { background: var(--primary); color: var(--primary-ink); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.link { background: none; border: 0; padding: 0; color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: none; font-size: .9rem; }
.link:hover { text-decoration: underline; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .78rem; font-weight: 600; white-space: nowrap; }
.tag.sm { font-size: .72rem; padding: 1px 7px; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.avatar { --c: var(--primary); display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--c); color: #fff; font-weight: 700; font-size: .85rem; flex: none; }
.avatar.xs { width: 22px; height: 22px; font-size: .62rem; }
.avatar.sm { width: 28px; height: 28px; font-size: .72rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar.empty { background: var(--surface-2); color: var(--muted); }
.avatar.group { background: var(--primary-soft); color: var(--primary); }
.avatar.group .ic { width: 20px; height: 20px; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; transition: width .3s; }
.progress.big { height: 12px; }
.progress.sm { height: 6px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); margin: 0 0 14px; background: var(--info-soft); }
.alert .ic { margin-top: 2px; }
.alert.danger { background: var(--danger-soft); color: var(--danger); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.small { font-size: .88rem; padding: 8px 12px; margin: 8px 0; display: block; }
.empty { padding: 24px 8px; text-align: center; color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: .9rem; white-space: nowrap; }
.chip small { color: var(--muted); }
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chip.active small { color: inherit; opacity: .8; }
.banner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 14px; border-radius: var(--radius); background: var(--primary-soft); color: var(--primary); }
.banner span { flex: 1; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 4px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; flex: 1; }
.field > span { font-size: .88rem; font-weight: 600; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
textarea { resize: vertical; min-height: 60px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
input:disabled { background: var(--surface-2); color: var(--muted); }
input[type=file] { font-size: .9rem; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 20px; height: 20px; flex: none; margin: 0; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .field { min-width: 180px; }
.field-warn textarea { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.field .link { align-self: flex-start; }
.check-inline { display: flex; gap: 10px; align-items: center; font-size: .92rem; margin: 4px 0 14px; }
.seg { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }
.seg legend { margin-bottom: 6px; }
.seg label { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.search { max-width: 320px; }
.add-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; padding: 10px; }
.add-bar input { flex: 2 1 180px; }
.add-bar select { flex: 1 1 160px; width: auto; }
.add-bar.inline { padding: 0; margin: 10px 0 0; }
.add-bar.inline input { min-height: 38px; }

/* ---------- page heads ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.page-title { font-size: 1.45rem; }
.page-head p { margin: 4px 0 0; }
.date-nav { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.date-nav .btn { border: 0; min-width: 104px; }
@media (max-width: 899px) { .view-dashboard .page-title, .view-more .page-title { font-size: 1.25rem; } .page-head .page-title { display: none; } .view-dashboard .page-head .page-title { display: block; } }

/* ---------- dashboard ---------- */
.dash-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .dash-grid { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: span 2; } }
@media (min-width: 1150px) { .dash-grid { grid-template-columns: repeat(3, 1fr); } .span-2 { grid-column: span 2; } }
.visit { background: linear-gradient(140deg, var(--accent-soft), var(--primary-soft) 45%, var(--surface) 85%); }
.visit.mine { border-color: var(--primary); }
.visit-who { display: flex; align-items: center; gap: 14px; margin: 12px 0 4px; }
.visit-name { font-size: 1.35rem; font-weight: 700; }
.section-progress { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 9px; }
.section-progress li { display: grid; grid-template-columns: 1fr 80px 36px; align-items: center; gap: 10px; font-size: .9rem; }
.section-progress .num { text-align: right; }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.alert-list a { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--text); text-decoration: none; font-size: .9rem; }
.alert-list .ic { width: 18px; height: 18px; margin-top: 2px; }
.alert-list .warn a { background: var(--warn-soft); }
.alert-list .warn .ic { color: var(--warn); }
.alert-list .danger a { background: var(--danger-soft); }
.alert-list .danger .ic { color: var(--danger); }
.mini-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.upcoming { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.upcoming li { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: var(--radius-sm); }
.upcoming li.mine { background: var(--primary-soft); }
.up-day { width: 58px; font-weight: 600; font-size: .9rem; line-height: 1.15; }
.up-day small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 360px; overflow-y: auto; }
.timeline li { display: flex; align-items: center; gap: 10px; padding: 6px 4px; font-size: .9rem; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.tl-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .8rem; width: 40px; flex: none; }

/* ---------- two column pages ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.two-col .col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; }
@media (min-width: 1000px) { .two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); } .two-col .col-wide { grid-column: 2; grid-row: 1 / span 3; } .view-handover .two-col { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } .view-handover .two-col .col-wide { grid-column: 1; } }

/* ---------- rota ---------- */
.pattern { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pattern li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pattern li > span:first-child { font-weight: 600; width: 110px; }
.pattern select { max-width: 200px; min-height: 38px; padding: 6px 10px; }
.rd-who { display: inline-flex; align-items: center; gap: 8px; }
.req-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.req { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.req > div:first-child { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.req > div:first-child > span { flex: 1; min-width: 0; }
.req p { width: 100%; margin: 2px 0 0 28px; }
.req .btn-row { margin-top: 8px; }
.rota-week + .rota-week { margin-top: 16px; }
.rota-week h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.rota-days { list-style: none; margin: 0; padding: 0; }
.rota-days li { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; grid-template-areas: "date who actions" "date tags actions"; align-items: center; column-gap: 10px; padding: 7px 8px; border-radius: var(--radius-sm); min-height: 48px; }
.rota-days li + li { border-top: 1px solid var(--border); }
.rota-days .rd-date { grid-area: date; font-size: .9rem; }
.rota-days .rd-who { grid-area: who; }
.rota-days .rd-tags { grid-area: tags; display: flex; gap: 4px; }
.rota-days .rd-tags:empty { display: none; }
.rota-days .rd-actions { grid-area: actions; display: flex; gap: 4px; align-items: center; }
.rota-days li.past { opacity: .5; }
.rota-days li.today { background: var(--primary-soft); }
.rota-days li.mine .rd-who { font-weight: 700; }

/* ---------- checklist ---------- */
.sticky-progress { position: sticky; top: calc(var(--top) + env(safe-area-inset-top) + 6px); z-index: 10; margin-bottom: 14px; padding: 12px 16px; }
@media (min-width: 900px) { .sticky-progress { top: 8px; } }
.sticky-progress .card-head { margin-bottom: 6px; }
.check-grid { display: grid; gap: 14px; }
@media (min-width: 800px) { .check-grid { grid-template-columns: 1fr 1fr; } }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li + li { border-top: 1px solid var(--border); }
.check-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; cursor: pointer; min-height: 48px; flex: 1; }
.check-row .txt { flex: 1; }
.check-row.done .txt { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.check-row input { width: 22px; height: 22px; }
.check-row .who { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.checklist.spaced { margin-top: 10px; }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.narrow { max-width: 720px; }

/* ---------- handover ---------- */
.ho-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.ho-item { display: block; width: 100%; overflow: hidden; text-align: left; background: var(--surface-2); border: 0; border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; }
.ho-item:hover { background: var(--primary-soft); }

/* ---------- inventory ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .chips { margin: 0; flex: 1 1 300px; min-width: 0; }
.toolbar .search { flex: 1 1 200px; }
.inv-area + .inv-area { margin-top: 14px; }
.inv-list { list-style: none; margin: 0; padding: 0; }
.inv-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "main actions" "date actions"; gap: 2px 10px; align-items: center; padding: 9px 2px; }
.inv-row + .inv-row { border-top: 1px solid var(--border); }
.inv-main { grid-area: main; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.inv-date { grid-area: date; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-actions { grid-area: actions; display: flex; gap: 2px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (min-width: 700px) { .inv-row { grid-template-columns: 1.4fr 1fr auto; grid-template-areas: "main date actions"; } }

/* ---------- shopping ---------- */
.shop-grid { display: grid; gap: 14px; margin-bottom: 14px; }
@media (min-width: 800px) { .shop-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1150px) { .shop-grid { grid-template-columns: repeat(3, 1fr); } }
.shop-row { display: flex; align-items: center; gap: 4px; }
.shop-row .check-row { flex-wrap: wrap; row-gap: 0; }
.shop-row .who { width: 100%; padding-left: 34px; margin-top: -4px; white-space: normal; }
.muted-card { background: var(--surface-2); box-shadow: none; }

/* ---------- chat ---------- */
.chat { display: grid; gap: 14px; }
.chat-list { padding: 6px; display: flex; flex-direction: column; gap: 2px; align-self: start; }
.chan { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; min-width: 0; }
.chan:hover { background: var(--surface-2); }
.chan.active { background: var(--primary-soft); }
.chan-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat.has-active .chat-list { display: none; }
.chat-pane { display: flex; flex-direction: column; padding: 0; overflow: hidden; height: calc(100dvh - var(--top) - env(safe-area-inset-top) - var(--tabbar) - env(safe-area-inset-bottom) - 28px); }
.view-chat .main { padding-bottom: calc(var(--tabbar) + 12px + env(safe-area-inset-bottom)); padding-top: 12px; }
@media (min-width: 900px) {
  .chat, .chat.has-active { grid-template-columns: 300px 1fr; }
  .chat.has-active .chat-list { display: flex; }
  .chat-pane { height: calc(100dvh - 28px - 32px - 70px); }
  .view-chat .main { padding-bottom: 32px; }
  .chat-head .back { display: none; }
}
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.chat-head small { display: block; font-size: .78rem; }
.messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.day-sep { text-align: center; margin: 10px 0 4px; }
.day-sep span { font-size: .75rem; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 2px 10px; border-radius: 99px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 82%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 16px 16px 16px 4px; padding: 7px 12px 5px; min-width: 0; }
.msg.mine .bubble { background: var(--primary); color: var(--primary-ink); border-color: transparent; border-radius: 16px 16px 4px 16px; }
.msg.system .bubble { background: var(--warn-soft); color: var(--text); border-color: transparent; }
.bubble p { margin: 0; white-space: normal; overflow-wrap: anywhere; }
.bubble .from { display: block; font-size: .75rem; font-weight: 700; color: var(--primary); }
.bubble .time { display: block; text-align: right; font-size: .68rem; opacity: .7; margin-top: 2px; }
.att-img { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; margin: 4px 0; }
.att-img img { display: block; max-width: min(260px, 100%); max-height: 260px; border-radius: 10px; }
.att-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 4px 0; border-radius: 10px; border: 0; cursor: pointer; background: color-mix(in srgb, currentColor 10%, transparent); color: inherit; text-align: left; }
.att-file span { display: flex; flex-direction: column; min-width: 0; }
.att-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.composer { border-top: 1px solid var(--border); padding: 8px; background: var(--surface); }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea { min-height: 42px; max-height: 140px; resize: none; border-radius: 21px; padding: 9px 14px; }
.attach-preview { display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin-bottom: 6px; border-radius: var(--radius-sm); background: var(--surface-2); }
.attach-preview img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.attach-preview span { flex: 1; min-width: 0; }

/* ---------- expenses ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.stat strong { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.exp-list { list-style: none; margin: 0; padding: 0; }
.exp-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 11px 0; }
.exp-row + .exp-row { border-top: 1px solid var(--border); }
.exp-main { flex: 1 1 200px; display: flex; flex-direction: column; min-width: 0; }
.exp-amt { font-variant-numeric: tabular-nums; }
.exp-row .row-actions { margin-left: auto; gap: 6px; }

/* ---------- settings / more ---------- */
.settings-body { display: grid; gap: 14px; max-width: 760px; }
.user-list, .edit-list { list-style: none; margin: 0; padding: 0; }
.user-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.user-list li + li, .edit-list li + li { border-top: 1px solid var(--border); }
.user-list .ic { color: var(--muted); }
.edit-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: .95rem; }
.install-card .btn { margin-top: 6px; }
.list-intro { margin: 6px 2px 0; align-items: flex-start; }
.list-intro p { margin: 2px 0 0; }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.edit-list li .grow { overflow-wrap: anywhere; }
.install-steps { margin: 4px 0 12px; padding-left: 22px; display: grid; gap: 10px; }
.install-steps li { padding-left: 4px; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-decoration: none; color: var(--text); font-weight: 600; }
.tile .ic { width: 26px; height: 26px; color: var(--primary); }
.tile .badge { position: absolute; top: 12px; right: 12px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 420px; padding: 24px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.login-brand .logo { width: 70px; height: 53px; }
.login-brand h1 { font-size: 1.4rem; }
.login-brand p { margin: 2px 0 0; }
.demo-box { margin-top: 18px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .88rem; }
.demo-box .chips { margin: 10px 0 0; }

/* ---------- modal / toast ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(15, 22, 20, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { width: 100%; max-width: 560px; max-height: 92dvh; display: flex; flex-direction: column; background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); animation: up .2s; padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 640px) { .modal-backdrop { align-items: center; padding: 24px; } .modal { border-radius: 18px; } }
.modal header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 6px 20px; }
.modal header h2 { font-size: 1.12rem; }
.modal-body { padding: 8px 20px 12px; overflow-y: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
.viewer { display: block; max-width: 100%; max-height: 65dvh; margin: 0 auto; border-radius: 10px; }
.viewer.pdf { width: 100%; height: 65dvh; border: 1px solid var(--border); }
#toast-root { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
@media (min-width: 900px) { #toast-root { bottom: 24px; } }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .92rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); animation: up .2s; transition: opacity .3s; }
.toast.danger { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
