/* ============================================================
  KinKeep — application stylesheet
   ============================================================ */
:root {
  --bg: #f3f5fb;
  --panel: #ffffff;
  --ink: #21274a;
  --ink-soft: #6b7191;
  --ink-faint: #9aa0bd;
  --line: #e4e7f2;
  --brand: #4a7cff;
  --brand-ink: #ffffff;
  --accent: #ffb02e;
  --danger: #e5484d;
  --ok: #2bb3a3;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 28px rgba(33, 39, 74, 0.09);
  --shadow-sm: 0 2px 8px rgba(33, 39, 74, 0.07);
  --sidebar-w: 232px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
button, .avatar, .nav-btn { touch-action: manipulation; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}

/* ============ First-paint boot gate ============ */
body.boot-pending #app { visibility: hidden; }
.boot-screen { position: fixed; inset: 0; z-index: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; padding: 20px; background-color: #eef1f7; background-image: linear-gradient(rgba(38,48,92,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(38,48,92,.045) 1px, transparent 1px); background-size: 28px 28px; }
body:not(.boot-pending) .boot-screen { display: none; }
.boot-brand { display: flex; align-items: center; gap: 11px; color: #26305c; font-size: 1.2rem; font-weight: 900; }
.boot-progress { width: min(220px, 65vw); height: 4px; overflow: hidden; border-radius: 2px; background: #dfe3ef; }
.boot-progress span { display: block; width: 42%; height: 100%; border-radius: inherit; background: var(--brand); animation: boot-slide 1.1s ease-in-out infinite alternate; }
.boot-screen p { margin: 0; color: var(--ink-soft); font-size: .76rem; font-weight: 700; }
@keyframes boot-slide { from { transform: translateX(-10%); } to { transform: translateX(150%); } }

/* ============ Main account login ============ */
.login-screen { position: fixed; inset: 0; z-index: 600; display: grid; place-items: center; padding: 18px; overflow-y: auto; background-color: #eef1f7; background-image: linear-gradient(rgba(38,48,92,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(38,48,92,.045) 1px, transparent 1px); background-size: 28px 28px; }
.login-panel { width: min(420px, 100%); padding: 28px; border: 1px solid #dfe3ef; border-radius: 8px; background: #fff; box-shadow: 0 18px 60px rgba(32,40,73,.16); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 25px; color: #26305c; font-size: 1.08rem; font-weight: 900; }
.login-panel h1 { font-size: 1.55rem; }
.login-panel > p { margin: 6px 0 20px; color: var(--ink-soft); font-size: .86rem; }
.login-panel form { display: flex; flex-direction: column; gap: 7px; }
.login-panel form > label:not(.login-remember) { margin-top: 6px; color: var(--ink-soft); font-size: .75rem; font-weight: 800; }
.login-panel input[type="text"], .login-panel input[type="password"] { width: 100%; border: 1.5px solid var(--line); border-radius: 8px; padding: 11px 12px; background: #fafbff; outline: none; }
.login-panel input:focus { border-color: var(--brand); }
.login-remember { display: flex; align-items: center; gap: 8px; margin: 8px 0; color: var(--ink-soft); font-size: .8rem; font-weight: 750; cursor: pointer; }
.login-remember input { width: 18px; height: 18px; accent-color: var(--brand); }
.login-error { padding: 9px 11px; border-left: 3px solid var(--danger); color: #9c292d; background: #fff0f0; font-size: .76rem; line-height: 1.4; }
#loginSubmit { min-height: 43px; margin-top: 4px; border-radius: 8px; color: #fff; background: var(--brand); font-weight: 850; }
#loginSubmit:disabled { opacity: .55; cursor: default; }

/* ============ First-run onboarding ============ */
.onboarding { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 18px; overflow-y: auto; background-color: #eef1f7; background-image: linear-gradient(rgba(38,48,92,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(38,48,92,.045) 1px, transparent 1px); background-size: 28px 28px; }
.onboarding-panel { width: min(720px, 100%); max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px); overflow-y: auto; padding: 22px 26px 24px; border: 1px solid #dfe3ef; border-radius: 8px; background: #fff; box-shadow: 0 18px 60px rgba(32,40,73,.16); }
.onboarding-brand { display: flex; align-items: center; gap: 9px; color: #26305c; font-size: 1rem; font-weight: 900; }
.onboarding-progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 21px 0 24px; }
.onboarding-progress span { height: 5px; border-radius: 3px; background: #e4e7f0; }
.onboarding-progress span.done, .onboarding-progress span.current { background: var(--brand); }
.onboarding-progress span.current { box-shadow: 0 0 0 3px rgba(74,124,255,.12); }
.onboarding-step-label { color: var(--brand); font-size: .72rem; font-weight: 900; text-transform: uppercase; }
.onboarding h1 { margin: 5px 0 7px; font-size: 1.55rem; line-height: 1.15; }
.onboarding-copy { max-width: 580px; margin: 0 0 20px; color: var(--ink-soft); font-size: .9rem; line-height: 1.5; }
.onboarding-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.onboarding-field { min-width: 0; }
.onboarding-field.wide { grid-column: 1 / -1; }
.onboarding-field label { display: block; margin-bottom: 5px; color: var(--ink-soft); font-size: .76rem; font-weight: 800; }
.onboarding-field input, .onboarding-field select { width: 100%; border: 1.5px solid var(--line); border-radius: 8px; padding: 10px 11px; color: var(--ink); background: #fafbff; font: inherit; outline: none; }
.onboarding-field input:focus, .onboarding-field select:focus { border-color: var(--brand); }
.onboarding-optional { color: var(--ink-faint); font-weight: 600; }
.onboarding-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.onboarding-list { min-width: 0; }
.onboarding-list-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.onboarding-list-head h2 { flex: 1; font-size: .9rem; }
.onboarding-list-head button { border: 0; border-radius: 7px; padding: 6px 9px; color: var(--brand); background: #eef2ff; font-weight: 800; cursor: pointer; }
.onboarding-row { display: flex; gap: 7px; margin-bottom: 7px; }
.onboarding-row input, .onboarding-row select { min-width: 0; border: 1.5px solid var(--line); border-radius: 8px; padding: 9px; color: var(--ink); background: #fafbff; font: inherit; outline: none; }
.onboarding-row input { flex: 1; }
.onboarding-row select { width: 104px; }
.onboarding-row button { width: 36px; height: 38px; border: 0; border-radius: 8px; color: var(--danger); background: #fdeceb; cursor: pointer; }
.onboarding-empty { padding: 13px; border: 1px dashed var(--line); border-radius: 8px; color: var(--ink-faint); font-size: .78rem; font-weight: 700; text-align: center; }
.onboarding-security { margin-top: 15px; padding: 12px; border-left: 4px solid var(--accent); background: #fff8e9; color: #7a5612; font-size: .78rem; line-height: 1.45; }
.onboarding-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.onboarding-summary div { padding: 11px; border-radius: 8px; background: #f5f7fb; }
.onboarding-summary small, .onboarding-summary b { display: block; }
.onboarding-summary small { color: var(--ink-faint); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.onboarding-summary b { margin-top: 3px; font-size: .9rem; overflow-wrap: anywhere; }
.onboarding-actions { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.onboarding-actions .spacer { flex: 1; }
.onboarding-actions button { border: 0; border-radius: 8px; padding: 9px 14px; font-weight: 800; cursor: pointer; }
.onboarding-back, .onboarding-skip { color: var(--ink-soft); background: #f0f2f7; }
.onboarding-next, .onboarding-finish { color: #fff; background: var(--brand); }
.onboarding-actions button:disabled { opacity: .55; cursor: default; }

@media (max-width: 620px) {
  .onboarding { align-items: start; padding: 0; }
  .onboarding-panel { min-height: 100vh; min-height: 100dvh; max-height: none; padding: 18px 16px 24px; border: 0; border-radius: 0; }
  .onboarding-fields, .onboarding-columns, .onboarding-summary { grid-template-columns: 1fr; }
  .onboarding-field.wide { grid-column: auto; }
  .onboarding-actions { flex-wrap: wrap; }
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
input, select, textarea { font: inherit; color: var(--ink); }
h1, h2, h3 { margin: 0; font-weight: 700; }
.i { width: 20px; height: 20px; fill: currentColor; flex: none; }

#app { display: flex; height: 100vh; height: 100dvh; }

/* ============ Sidebar ============ */
#sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: linear-gradient(180deg, #232a52 0%, #1b2140 100%);
  color: #dfe4ff;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  gap: 18px;
  position: relative;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1), padding 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-name { font-weight: 800; font-size: 1.12rem; letter-spacing: 0.2px; color: #fff; }
.brand-name, .nav-btn > span {
  display: inline-block; max-width: 150px; overflow: hidden; white-space: nowrap;
  transition: max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s ease;
}

/* Edge handle — collapses / expands the sidebar on desktop */
.side-toggle {
  position: absolute; right: -13px; top: 34px; z-index: 20;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--panel); color: var(--ink-soft); box-shadow: 0 2px 10px rgba(23, 27, 52, 0.25);
  display: flex; align-items: center; justify-content: center;
}
.side-toggle:hover { color: var(--brand); }
.side-toggle .i { width: 14px; height: 14px; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

/* Burger (mobile only) + drawer scrim */
.icon-btn.burger { display: none; flex: none; }
.scrim {
  position: fixed; inset: 0; z-index: 205; background: rgba(14, 18, 44, 0.5);
  opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(2px);
}
body.side-open .scrim { opacity: 1; visibility: visible; }

.clock { padding: 4px 6px 0; }
.clock-time { font-size: 2.1rem; font-weight: 800; color: #fff; line-height: 1; font-variant-numeric: tabular-nums; }
.clock-date { font-size: 0.85rem; color: #aab2e0; margin-top: 4px; }

.nav-section { min-height: 0; display: flex; flex: 1; flex-direction: column; }
.nav-list-head { min-height: 28px; display: flex; align-items: center; gap: 8px; padding: 0 6px; color: #7f88ba; font-size: .64rem; font-weight: 850; text-transform: uppercase; }
.nav-list-head > span { flex: 1; }
.nav-list-head button { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 6px; color: #aab2e0; font-size: .62rem; font-weight: 800; text-transform: none; }
.nav-list-head button:hover, body.nav-reordering .nav-list-head button { color: #fff; background: rgba(255, 255, 255, .1); }
.nav-list-head .i { width: 13px; height: 13px; }
.nav-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; scrollbar-width: none; }
.nav-list > li { position: relative; }
.nav-list > li.nav-hidden { display: none !important; }
.nav-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 11px 12px;
  border-radius: 12px; color: #b9c1ea;
  font-weight: 600; font-size: 0.95rem;
  transition: background 0.15s, color 0.15s, gap 0.25s cubic-bezier(0.4, 0, 0.2, 1), padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-btn.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(74, 124, 255, 0.35); }
.nav-lock { width: 13px; height: 13px; margin-left: auto; opacity: .72; }
.nav-move-controls { display: none; align-items: center; gap: 2px; }
body.nav-reordering .nav-list > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border: 1px dashed rgba(185, 193, 234, .28); border-radius: 10px; cursor: grab; }
body.nav-reordering .nav-list > li.nav-dragging { opacity: .45; }
body.nav-reordering .nav-btn { pointer-events: none; border-radius: 9px 0 0 9px; box-shadow: none; }
body.nav-reordering .nav-move-controls { display: flex; padding-right: 3px; }
.nav-move-controls button { width: 25px; height: 30px; display: grid; place-items: center; border-radius: 6px; color: #aab2e0; }
.nav-move-controls button:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.nav-move-controls button:first-child .i { transform: rotate(90deg); }
.nav-move-controls button:last-child .i { transform: rotate(90deg); }
.nav-move-controls .i { width: 13px; height: 13px; }

.sidebar-foot { display: flex; flex-direction: column; gap: 8px; padding: 0 6px; }
.sidebar-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .1); }
.sidebar-tool { position: relative; min-width: 0; height: 34px; display: flex; align-items: center; justify-content: flex-start; gap: 7px; padding: 0 8px; border-radius: 8px; color: #b9c1ea; background: rgba(255, 255, 255, .06); font-size: .72rem; font-weight: 750; }
.sidebar-tool:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.sidebar-tool.active { color: #fff; background: rgba(43, 179, 163, .24); box-shadow: inset 0 0 0 1px rgba(127, 224, 200, .3); }
.sidebar-tool .i { width: 16px; height: 16px; }
.sidebar-tool .tool-badge { top: -5px; right: -5px; border-color: #1b2140; }
.sidebar-tool-wide { grid-column: 1 / -1; justify-content: center; }
.member-strip { display: flex; }
.member-strip .avatar { margin-right: -8px; border: 2px solid #232a52; }
.family-name { font-size: 0.8rem; color: #8f97c6; font-weight: 600; }

/* ============ Main / topbar ============ */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 24px 12px; flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#viewTitle { font-size: 1.5rem; font-weight: 800; }

.period-nav { display: flex; align-items: center; gap: 6px; }
.period-label { font-weight: 700; color: var(--ink-soft); margin-left: 8px; white-space: nowrap; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-soft); background: var(--panel); box-shadow: var(--shadow-sm);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { color: var(--brand); }
.tool-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg); border-radius: 9px; color: #fff; background: var(--danger); font-size: .58rem; font-weight: 900; line-height: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 12px; font-weight: 700; font-size: 0.92rem;
  transition: filter 0.15s, background 0.15s;
}
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 16px rgba(74, 124, 255, 0.3); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: var(--panel); color: var(--ink-soft); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { color: var(--brand); }
.btn-danger { background: #fdeceb; color: var(--danger); }
.btn-danger:hover { background: #fbdad9; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; border-radius: 10px; }

.seg {
  display: inline-flex; background: var(--panel); border-radius: 12px;
  padding: 3px; box-shadow: var(--shadow-sm);
}
.seg button {
  padding: 7px 14px; border-radius: 9px; font-weight: 700; font-size: 0.88rem; color: var(--ink-soft);
}
.seg button.active { background: var(--brand); color: #fff; }

.member-filter { display: flex; align-items: center; }
.member-filter .avatar { margin-left: -6px; cursor: pointer; border: 2.5px solid var(--bg); transition: transform 0.12s, opacity 0.12s; }
.member-filter .avatar:first-child { margin-left: 0; }
.member-filter .avatar:hover { transform: translateY(-2px); }
.member-filter.filtering .avatar { opacity: 0.35; }
.member-filter.filtering .avatar.on { opacity: 1; transform: scale(1.1); }

/* ============ Avatars ============ */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; flex: none;
}
.avatar svg { width: 100%; height: 100%; }
.avatar.sm { width: 24px; height: 24px; }
.avatar.lg { width: 52px; height: 52px; }

/* ============ View root ============ */
#viewRoot { flex: 1; overflow: auto; padding: 4px 24px 24px; min-height: 0; }

/* ============ Dashboard ============ */
.dashboard-wrap { width: 100%; max-width: 1600px; margin: 0 auto; padding-bottom: 8px; }
.dashboard-toolbar { min-height: 36px; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dashboard-toolbar .spacer, .dashboard-widget-controls .spacer { flex: 1; }
.dashboard-layout { min-height: 76px; margin: -7px; }
.dashboard-layout.dashboard-editing { padding-bottom: 38px; border-radius: 8px; background-image: linear-gradient(to right, rgba(74, 124, 255, .07) 1px, transparent 1px), linear-gradient(to bottom, rgba(74, 124, 255, .07) 1px, transparent 1px); background-size: calc(100% / 12) 38px; }
.dashboard-widget { min-width: 0; }
.dashboard-widget > .grid-stack-item-content { display: flex; flex-direction: column; overflow: hidden; border-radius: 8px; background: transparent; transition: box-shadow .18s ease, opacity .18s ease; }
.dashboard-widget-content { min-height: 0; display: flex; flex: 1; overflow: hidden; }
.dashboard-widget-content > :is(.dashboard-brief, .dash-stat, .dash-panel) { width: 100%; height: 100%; margin: 0; }
.dashboard-widget-content > .dash-panel { min-height: 0; display: flex; flex-direction: column; }
.dashboard-widget-content > .dash-panel .dash-panel-body { min-height: 0; flex: 1; overflow: auto; }
.dashboard-widget-controls { min-height: 40px; display: flex; align-items: center; gap: 7px; padding: 5px 6px; flex: none; border: 1px solid #cfd6e9; border-bottom: 0; border-radius: 8px 8px 0 0; background: #edf1fb; }
.dashboard-widget-controls + .dashboard-widget-content > :is(.dashboard-brief, .dash-stat, .dash-panel) { border-radius: 0 0 8px 8px; }
.dashboard-widget-controls .icon-btn { width: 28px; height: 28px; box-shadow: none; background: #fff; }
.dashboard-widget-controls .icon-btn .i { width: 14px; height: 14px; }
.dashboard-widget-controls strong { min-width: 0; overflow: hidden; color: var(--ink-soft); font-size: .69rem; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-drag { width: 24px; height: 28px; display: grid; place-items: center; flex: none; color: var(--ink-faint); cursor: grab; }
.dashboard-drag .i { width: 15px; height: 15px; }
.dashboard-drag:active { cursor: grabbing; }
.dashboard-editing .dashboard-widget > .grid-stack-item-content { box-shadow: 0 0 0 2px rgba(74, 124, 255, .2); }
.dashboard-editing .dashboard-widget-content { opacity: .86; }
.dashboard-grid-interacting .dashboard-widget:not(.ui-draggable-dragging):not(.ui-resizable-resizing) > .grid-stack-item-content { opacity: .72; }
.dashboard-layout .grid-stack-placeholder > .placeholder-content { border: 2px dashed var(--brand); border-radius: 8px; background: rgba(74, 124, 255, .1); }
.dashboard-editing .ui-resizable-handle { opacity: .72; }
.dashboard-editing .ui-resizable-handle:hover { opacity: 1; }
.dashboard-editing .ui-resizable-se { width: 20px; height: 20px; }
.dashboard-item-picker { display: flex; flex-direction: column; gap: 7px; }
.dashboard-item-picker > label { min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fafbff; cursor: pointer; }
.dashboard-item-picker input { width: 18px; height: 18px; flex: none; accent-color: var(--brand); }
.dashboard-item-picker label span { min-width: 0; flex: 1; }
.dashboard-item-picker label b, .dashboard-item-picker label small { display: block; }
.dashboard-item-picker label b { font-size: .82rem; }
.dashboard-item-picker label small { margin-top: 2px; color: var(--ink-faint); font-size: .68rem; }
@media (max-width: 560px) {
  .dashboard-widget-controls strong { font-size: .66rem; }
}
.dashboard-brief { min-height: 54px; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 9px 12px; border: 1px solid #d8deef; border-radius: 8px; background: #edf1ff; }
.dashboard-brief > span { width: 34px; height: 34px; display: grid; place-items: center; flex: none; border-radius: 7px; color: #315cbe; background: #fff; }
.dashboard-brief > div { min-width: 0; flex: 1; }
.dashboard-brief b, .dashboard-brief small { display: block; }
.dashboard-brief b { font-size: .82rem; }
.dashboard-brief small { margin-top: 2px; color: var(--ink-soft); font-size: .67rem; font-weight: 650; }
.dash-stat {
  position: relative; min-width: 0; min-height: 92px; display: flex; align-items: center; gap: 12px;
  padding: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); box-shadow: var(--shadow-sm); text-align: left;
}
.dash-stat:hover { border-color: #cdd4e8; box-shadow: var(--shadow); }
.dash-stat > span:nth-child(2) { min-width: 0; }
.dash-stat b, .dash-stat small { display: block; }
.dash-stat b { font-size: 1.35rem; line-height: 1; font-variant-numeric: tabular-nums; }
.dash-stat small { margin-top: 5px; color: var(--ink-soft); font-size: .73rem; font-weight: 750; line-height: 1.25; }
.dash-stat > i { position: absolute; left: 0; bottom: 0; width: var(--progress, 0); height: 3px; background: var(--ok); }
.dash-stat-icon { width: 42px; height: 42px; display: grid; place-items: center; flex: none; border-radius: 8px; }
.dash-stat-icon .i { width: 21px; height: 21px; }
.dash-stat-icon.coral { color: #b63c3c; background: #ffebe8; }
.dash-stat-icon.gold { color: #956000; background: #fff3d7; }
.dash-stat-icon.teal { color: #087668; background: #dcf5f0; }
.dash-stat-icon.blue { color: #315cbe; background: #e7edff; }

.dash-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow-sm); }
.dash-panel-head { min-height: 68px; display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.dash-panel-head > div { min-width: 0; flex: 1; }
.dash-panel-head span:not(.dash-count) { display: block; margin-bottom: 2px; color: var(--ink-faint); font-size: .67rem; font-weight: 850; text-transform: uppercase; }
.dash-panel-head h2 { font-size: 1rem; line-height: 1.2; letter-spacing: 0; }
.dash-panel-head .link-btn { flex: none; }
.dash-count { min-width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; color: #9e2f35; background: #fde8e8; font-size: .76rem; font-weight: 850; }
.dash-panel-body { padding: 6px 12px 10px; }
.dash-alert, .dash-event, .dash-meal { width: 100%; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid #edf0f6; text-align: left; }
.dash-alert:last-child, .dash-event:last-child, .dash-meal:last-child { border-bottom: 0; }
.dash-alert { min-height: 57px; padding: 8px 4px; }
.dash-alert > span:first-child { width: 34px; height: 34px; display: grid; place-items: center; flex: none; border-radius: 8px; }
.dash-alert > span:nth-child(2), .dash-event-main { min-width: 0; flex: 1; }
.dash-alert b, .dash-alert small, .dash-event b, .dash-event small, .dash-meal b, .dash-meal small { display: block; }
.dash-alert b, .dash-event b, .dash-meal b { font-size: .82rem; overflow-wrap: anywhere; }
.dash-alert small, .dash-event small, .dash-meal small { margin-top: 2px; color: var(--ink-faint); font-size: .7rem; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.dash-alert.danger > span:first-child { color: #b7353d; background: #fde8e8; }
.dash-alert.warn > span:first-child { color: #976100; background: #fff2d5; }
.dash-alert.info > span:first-child { color: #315cbe; background: #e8eeff; }
.dash-arrow { width: 15px; height: 15px; color: var(--ink-faint); }
.dash-clear { min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: var(--ink-faint); text-align: center; }
.dash-clear .i { width: 34px; height: 34px; margin-bottom: 3px; color: var(--ok); }
.dash-clear b { color: var(--ink); }
.dash-clear span { font-size: .76rem; font-weight: 650; }
.dash-event { min-height: 61px; padding: 8px 4px; }
.dash-date { width: 40px; height: 43px; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; border-radius: 7px; color: #315cbe; background: #e8eeff; font-size: .6rem; font-weight: 850; text-transform: uppercase; }
.dash-date b { font-size: 1.05rem; line-height: 1; }
.dash-meal { min-height: 54px; padding: 7px 4px; }
.dash-meal > span:first-child { width: 32px; font-size: 1.2rem; text-align: center; }
.dash-meal > span:last-child { min-width: 0; flex: 1; }
.dash-empty { padding: 24px 8px; color: var(--ink-faint); font-size: .78rem; font-weight: 650; text-align: center; }
.dash-trophy { color: #d49416; }
.leader-row { display: flex; align-items: center; gap: 9px; min-height: 56px; padding: 7px 3px; border-bottom: 1px solid #edf0f6; }
.leader-row:last-child { border-bottom: 0; }
.leader-place { width: 22px; color: var(--ink-faint); font-size: .76rem; font-weight: 850; text-align: center; }
.leader-row:first-child .leader-place { color: #b47700; }
.leader-name { min-width: 0; flex: 1; }
.leader-name b, .leader-name small { display: block; }
.leader-name b { font-size: .84rem; overflow-wrap: anywhere; }
.leader-name small { color: var(--ink-faint); font-size: .67rem; font-weight: 650; }
.leader-stars { display: inline-flex; align-items: center; gap: 4px; color: #a66b00; font-size: .82rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.leader-stars .i { width: 14px; height: 14px; }
.dash-weather .dash-panel-head .icon-btn { width: 30px; height: 30px; box-shadow: none; background: #f2f4f9; }
.dash-weather .dash-panel-head .icon-btn .i { width: 15px; height: 15px; }
.dashboard-weather-current { min-height: 92px; display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 4px 12px; }
.dashboard-weather-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 8px; color: #b47700; background: #fff3d7; }
.dashboard-weather-icon .i { width: 34px; height: 34px; }
.dashboard-weather-current > span:nth-child(2) { min-width: 0; }
.dashboard-weather-current b, .dashboard-weather-current small { display: block; }
.dashboard-weather-current b { font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.dashboard-weather-current small { margin-top: 5px; color: var(--ink-soft); font-size: .72rem; font-weight: 750; }
.dashboard-weather-current em { max-width: 150px; color: var(--ink-faint); font-size: .68rem; font-style: normal; font-weight: 750; overflow-wrap: anywhere; text-align: right; }
.dashboard-forecast { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); border-top: 1px solid var(--line); }
.dashboard-forecast > div { min-width: 0; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 6px; padding: 10px 8px; border-right: 1px solid var(--line); }
.dashboard-forecast > div:last-child { border-right: 0; }
.dashboard-forecast span { grid-column: 1 / -1; color: var(--ink-faint); font-size: .62rem; font-weight: 850; text-transform: uppercase; }
.dashboard-forecast .i { width: 21px; height: 21px; color: #315cbe; }
.dashboard-forecast b { font-size: .84rem; }
.dashboard-forecast small { color: var(--ink-faint); font-size: .68rem; font-weight: 700; }
.dashboard-weather-empty { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--ink-faint); text-align: center; }
.dashboard-weather-empty > .i { width: 38px; height: 38px; color: #315cbe; }
.dashboard-weather-empty b { color: var(--ink-soft); font-size: .8rem; }

/* Center view content — neat, consistent max widths across the app */
.month-wrap, .week-wrap, .day-wrap, .chore-week-strip, .chore-board,
.rewards-wrap, .meals-grid, .fav-strip, .recipes-wrap, .lists-wrap,
.pets-wrap, .emp-wrap, .settings-wrap, .fin-wrap, .chat-wrap,
.photo-toolbar, .photo-grid { margin-left: auto; margin-right: auto; }
.month-wrap, .week-wrap { max-width: 1500px; }
.day-wrap, .chore-week-strip, .chore-board, .rewards-wrap, .meals-grid,
.fav-strip, .recipes-wrap, .lists-wrap, .pets-wrap, .fin-wrap,
.chat-wrap, .photo-toolbar, .photo-grid { max-width: 1200px; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

/* ============ Month grid ============ */
.month-wrap { display: flex; flex-direction: column; height: 100%; }
.dow-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; padding: 0 0 8px; }
.dow { text-align: center; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.6px; color: var(--ink-faint); text-transform: uppercase; }
.month-grid { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; gap: 8px; min-height: 0; }
.mcell {
  background: var(--panel); border-radius: var(--radius-sm); padding: 6px;
  display: flex; flex-direction: column; gap: 4px; overflow: hidden;
  box-shadow: var(--shadow-sm); cursor: pointer; min-height: 84px;
  transition: box-shadow 0.15s;
}
.mcell:hover { box-shadow: var(--shadow); }
.mcell.other { opacity: 0.45; }
.mcell .dnum {
  font-size: 0.8rem; font-weight: 800; color: var(--ink-soft);
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.mcell .birthday-mark { position: absolute; left: 26px; top: 3px; font-size: .72rem; line-height: 1; }
.mcell.today .dnum { background: var(--brand); color: #fff; }
.mcell .pills { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.pill {
  font-size: 0.72rem; font-weight: 700; color: #fff; border-radius: 6px;
  padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pill.more { background: var(--line); color: var(--ink-soft); }

/* ============ Week grid ============ */
.week-wrap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; height: 100%; align-items: stretch; }
.wcol { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wcol-head {
  text-align: center; padding: 10px 4px; border-radius: var(--radius-sm);
  background: var(--panel); box-shadow: var(--shadow-sm); cursor: pointer;
}
.wcol-head .wd { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.8px; color: var(--ink-faint); text-transform: uppercase; }
.wcol-head .dn { font-size: 1.3rem; font-weight: 800; margin-top: 2px; }
.wcol-head .birthday-mark { display: inline-block; margin-left: 3px; font-size: .78rem; vertical-align: 2px; }
.wcol-head.today { background: var(--brand); }
.wcol-head.today .wd, .wcol-head.today .dn { color: #fff; }
.wcol-body { flex: 1; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding-bottom: 4px; }

.evt {
  border-radius: var(--radius-sm); background: var(--panel); box-shadow: var(--shadow-sm);
  padding: 8px 10px 8px 12px; position: relative; cursor: pointer; overflow: hidden;
  transition: transform 0.12s, box-shadow 0.15s;
}
.evt:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.evt::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--evc, var(--brand)); }
.evt .et { font-size: 0.72rem; font-weight: 800; color: var(--evc, var(--brand)); text-transform: uppercase; letter-spacing: 0.3px; }
.evt .en { font-size: 0.86rem; font-weight: 700; margin-top: 1px; overflow-wrap: anywhere; }
.evt .el { font-size: 0.74rem; color: var(--ink-faint); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.evt .el .i { width: 12px; height: 12px; }
.evt .eavs { display: flex; margin-top: 6px; }
.evt .eavs .avatar { margin-right: -6px; border: 2px solid #fff; }

/* ============ Day view ============ */
.day-wrap { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; height: 100%; min-height: 0; }
.day-col { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding-bottom: 8px; }
.day-side { display: flex; flex-direction: column; gap: 16px; overflow-y: auto; padding-bottom: 8px; }
.day-evt { display: flex; gap: 14px; padding: 14px 16px; }
.day-evt .time-block { width: 84px; flex: none; text-align: right; }
.day-evt .time-block .t1 { font-weight: 800; font-size: 0.95rem; color: var(--evc, var(--brand)); }
.day-evt .time-block .t2 { font-size: 0.78rem; color: var(--ink-faint); margin-top: 2px; }
.day-evt .en { font-size: 1.02rem; }

.side-card { padding: 16px; }
.side-card h3 { font-size: 0.95rem; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.side-card h3 .i { color: var(--brand); }

.countdown-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.countdown-row:first-of-type { border-top: none; }
.cd-days {
  min-width: 54px; text-align: center; background: #fff4e0; color: #b26a00;
  border-radius: 10px; padding: 6px 8px; font-weight: 800; font-size: 1.05rem; line-height: 1;
}
.cd-days small { display: block; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; margin-top: 2px; }
.cd-title { font-weight: 700; font-size: 0.9rem; }
.cd-date { font-size: 0.76rem; color: var(--ink-faint); }

/* ============ Chores ============ */
.chore-week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 16px; }
.cws-day { text-align: center; padding: 10px 6px; border-radius: var(--radius-sm); background: var(--panel); box-shadow: var(--shadow-sm); cursor: pointer; }
.cws-day.sel { outline: 2.5px solid var(--brand); }
.cws-day .lbl { font-size: 0.7rem; font-weight: 800; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.5px; }
.cws-day .num { font-weight: 800; font-size: 1.05rem; margin: 2px 0 6px; }
.cws-day.today .num { color: var(--brand); }
.cws-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.cws-bar span { display: block; height: 100%; background: var(--ok); border-radius: 3px; }

.chore-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; align-items: start; }
.chore-lane { padding: 14px; }
.chore-lane-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.chore-lane-head .who { font-weight: 800; font-size: 1rem; flex: 1; }
.star-chip {
  display: inline-flex; align-items: center; gap: 4px; background: #fff4e0; color: #b26a00;
  font-weight: 800; font-size: 0.85rem; border-radius: 999px; padding: 4px 10px;
}
.star-chip .i { width: 14px; height: 14px; fill: var(--accent); }

.chore-item {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: var(--radius-sm); border: 1.5px solid var(--line); margin-bottom: 8px;
  cursor: pointer; transition: background 0.15s, border-color 0.15s; user-select: none;
}
.chore-item:hover { border-color: var(--brand); }
.chore-item .cbox {
  width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center; flex: none;
  color: transparent; transition: all 0.15s;
}
.chore-item.done .cbox { background: var(--ok); border-color: var(--ok); color: #fff; }
.chore-item .cbox .i { width: 16px; height: 16px; }
.chore-item .cic { color: var(--ink-soft); }
.chore-item .ct { flex: 1; font-weight: 700; font-size: 0.9rem; }
.chore-item.done .ct { text-decoration: line-through; color: var(--ink-faint); }
.chore-item .cstars { display: flex; align-items: center; gap: 2px; font-weight: 800; font-size: 0.8rem; color: #b26a00; }
.chore-item .cstars .i { width: 13px; height: 13px; fill: var(--accent); }

.chore-all-done { text-align: center; padding: 14px 8px; color: var(--ok); font-weight: 700; font-size: 0.9rem; }

/* ============ Rewards ============ */
.rewards-wrap { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.reward-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.reward-card { padding: 16px; text-align: center; position: relative; }
.reward-card .rem { font-size: 2.1rem; line-height: 1; }
.reward-card .rt { font-weight: 700; font-size: 0.92rem; margin: 8px 0 4px; }
.reward-card .rc { display: inline-flex; align-items: center; gap: 4px; color: #b26a00; font-weight: 800; font-size: 0.9rem; }
.reward-card .rc .i { width: 14px; height: 14px; fill: var(--accent); }
.reward-card .redeem-row { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.reward-card .redeem-row .avatar { cursor: pointer; opacity: 0.85; transition: transform 0.12s; }
.reward-card .redeem-row .avatar:hover { transform: scale(1.12); opacity: 1; }
.reward-card .redeem-row .avatar.cant { opacity: 0.25; cursor: not-allowed; }
.reward-card .rx { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity 0.15s; }
.reward-card:hover .rx { opacity: 1; }

.star-bank { padding: 16px; }
.bank-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.bank-row:first-of-type { border-top: none; }
.bank-row .bn { font-weight: 700; flex: 1; }
.bank-row .earned { font-size: 0.75rem; color: var(--ink-faint); }
.history-item { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; font-size: 0.85rem; border-top: 1px solid var(--line); }
.history-item:first-of-type { border-top: none; }
.history-item .hw { color: var(--ink-faint); }

/* ============ Meals ============ */
.meals-grid { display: grid; grid-template-columns: 90px repeat(7, 1fr); gap: 8px; }
.meals-grid .mg-corner { }
.mg-day { text-align: center; padding: 8px 4px; border-radius: var(--radius-sm); background: var(--panel); box-shadow: var(--shadow-sm); }
.mg-day.today { background: var(--brand); color: #fff; }
.mg-day .wd { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.75; }
.mg-day .dn { font-weight: 800; }
.mg-slot { display: flex; align-items: center; font-weight: 800; font-size: 0.8rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.5px; }
.meal-cell {
  min-height: 74px; border-radius: var(--radius-sm); background: var(--panel); box-shadow: var(--shadow-sm);
  padding: 8px; cursor: pointer; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  border: 1.5px dashed transparent; transition: border-color 0.15s;
}
.meal-cell:hover { border-color: var(--brand); }
.meal-cell.empty { justify-content: center; align-items: center; color: var(--ink-faint); }
.meal-cell.empty .i { width: 16px; height: 16px; }
.meal-cell .mt { font-weight: 700; font-size: 0.84rem; }
.meal-cell .mn { font-size: 0.72rem; color: var(--ink-faint); }
.meal-stock-use { display: flex; align-items: center; gap: 3px; margin-top: 4px; color: #087668; font-size: .62rem; font-weight: 800; }
.meal-stock-use .i { width: 11px; height: 11px; }
.meal-attribution { margin-top: 3px; color: #956000; font-size: .6rem; font-weight: 800; }
.fav-strip { margin-top: 16px; padding: 14px 16px; }
.fav-strip h3 { font-size: 0.95rem; margin-bottom: 10px; }
.fav-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fav-chip {
  background: #eef2ff; color: #3d5fc4; font-weight: 700; font-size: 0.82rem;
  padding: 6px 12px; border-radius: 999px; cursor: grab; user-select: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.fav-chip button { color: #8fa2e0; display: inline-flex; }
.fav-chip button:hover { color: var(--danger); }
.fav-chip button .i { width: 12px; height: 12px; }

/* ============ Lists ============ */
.lists-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.list-card { padding: 16px; border-top: 5px solid var(--lc, var(--ok)); }
.list-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.list-head h3 { flex: 1; font-size: 1.02rem; overflow-wrap: anywhere; }
.list-head .count { font-size: 0.78rem; color: var(--ink-faint); font-weight: 700; white-space: nowrap; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 7px 2px; border-radius: 8px; }
.list-item .lt { overflow-wrap: anywhere; }
.list-item:hover { background: #f7f8fd; }
.list-item .lbox {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none;
  display: flex; align-items: center; justify-content: center; color: transparent; cursor: pointer;
  transition: all 0.15s;
}
.list-item.done .lbox { background: var(--lc, var(--ok)); border-color: var(--lc, var(--ok)); color: #fff; }
.list-item .lbox .i { width: 13px; height: 13px; }
.list-item .lt { flex: 1; font-size: 0.92rem; font-weight: 600; }
.list-item.done .lt { text-decoration: line-through; color: var(--ink-faint); }
.list-item .lx { opacity: 0; color: var(--ink-faint); display: inline-flex; }
.list-item:hover .lx { opacity: 1; }
.list-item .lx:hover { color: var(--danger); }
.list-item .lx .i { width: 15px; height: 15px; }
.list-add { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.list-add input {
  flex: 1 1 150px; min-width: 0; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 0.9rem;
  background: #fafbff; outline: none;
}
.list-add input:focus { border-color: var(--brand); }
.list-foot { display: flex; justify-content: space-between; margin-top: 10px; }
.link-btn { color: var(--ink-faint); font-weight: 700; font-size: 0.8rem; }
.link-btn:hover { color: var(--brand); }
.link-btn.danger:hover { color: var(--danger); }

.new-list-card {
  border: 2px dashed var(--line); border-radius: var(--radius); min-height: 130px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--ink-faint); font-weight: 700; cursor: pointer; background: transparent;
  transition: border-color 0.15s, color 0.15s;
}
.new-list-card:hover { border-color: var(--brand); color: var(--brand); }

/* ============ Home assets & maintenance ============ */
.assets-wrap { max-width: 1100px; margin: 0 auto; }
.asset-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 13px; }
.asset-summary > div { min-height: 72px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow-sm); }
.asset-summary b, .asset-summary span { display: block; }
.asset-summary b { font-size: 1.2rem; }
.asset-summary span { margin-top: 3px; color: var(--ink-faint); font-size: .68rem; font-weight: 750; }
.asset-summary .warning b { color: #976100; }
.asset-summary .danger b { color: var(--danger); }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 11px; }
.asset-card { min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 10px; padding: 13px; border: 1px solid var(--line); border-top: 4px solid var(--ok); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow-sm); cursor: pointer; }
.asset-card:hover { box-shadow: var(--shadow); }
.asset-card.retired, .asset-card.disposed { opacity: .62; border-top-color: var(--ink-faint); }
.asset-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 8px; color: #315cbe; background: #e8eeff; }
.asset-main { min-width: 0; }
.asset-main > div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.asset-main h3 { font-size: .88rem; overflow-wrap: anywhere; }
.asset-main > div > span { padding: 2px 5px; border-radius: 5px; color: #087668; background: #e2f6f0; font-size: .58rem; font-weight: 850; }
.asset-main p, .asset-main small { display: block; margin: 3px 0 0; color: var(--ink-soft); font-size: .68rem; font-weight: 650; overflow-wrap: anywhere; }
.asset-main small { color: var(--ink-faint); }
.asset-dates, .asset-counts { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; color: var(--ink-faint); font-size: .63rem; font-weight: 750; }
.asset-dates b.expired, .asset-dates b.today { color: var(--danger); }
.asset-dates b.soon, .asset-dates b.week { color: #976100; }
.asset-counts { padding-top: 7px; border-top: 1px solid var(--line); }
.asset-empty { min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px dashed var(--line); border-radius: 8px; color: var(--ink-faint); }
.asset-empty .i { width: 38px; height: 38px; color: var(--brand); }
.asset-empty b { color: var(--ink); }
.asset-empty span { font-size: .72rem; font-weight: 650; }
.asset-detail { display: flex; flex-direction: column; gap: 12px; }
.asset-detail-head { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 11px; align-items: center; }
.asset-detail-head > span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px; color: #315cbe; background: #e8eeff; }
.asset-detail-head > div { min-width: 0; }
.asset-detail-head h2 { font-size: 1rem; }
.asset-detail-head p { margin: 3px 0 0; color: var(--ink-soft); font-size: .7rem; font-weight: 650; overflow-wrap: anywhere; }
.asset-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.asset-facts > div { min-width: 0; padding: 9px; border-radius: 7px; background: #f5f7fb; }
.asset-facts span, .asset-facts b { display: block; }
.asset-facts span { color: var(--ink-faint); font-size: .58rem; font-weight: 800; text-transform: uppercase; }
.asset-facts b { margin-top: 3px; font-size: .72rem; overflow-wrap: anywhere; }
.asset-notes { margin: 0; padding: 10px; border-left: 4px solid var(--brand); background: #f3f6ff; font-size: .75rem; line-height: 1.45; }
.asset-section { padding-top: 10px; border-top: 1px solid var(--line); }
.asset-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.asset-section-head h3 { min-width: 0; flex: 1; font-size: .84rem; }
.service-row { display: grid; grid-template-columns: minmax(0, 1fr) 32px 32px; gap: 6px; align-items: center; min-height: 51px; border-top: 1px solid #edf0f6; }
.service-row:first-of-type { border-top: 0; }
.service-row > div { min-width: 0; }
.service-row b, .service-row span, .service-row small, .service-row em { display: block; overflow-wrap: anywhere; }
.service-row b { font-size: .76rem; }
.service-row span, .service-row small, .service-row em { margin-top: 2px; color: var(--ink-faint); font-size: .63rem; font-weight: 650; font-style: normal; }
.service-row em { color: #976100; font-weight: 800; }
.service-row .icon-btn, .asset-document .icon-btn { width: 30px; height: 30px; box-shadow: none; background: #f2f4f9; }
.service-row .danger, .asset-document .danger { color: var(--danger); }
.asset-document { display: flex; align-items: center; gap: 7px; min-height: 42px; border-top: 1px solid #edf0f6; }
.asset-document:first-of-type { border-top: 0; }
.asset-document a { min-width: 0; flex: 1; display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.asset-document a > span { min-width: 0; }
.asset-document b, .asset-document small { display: block; overflow-wrap: anywhere; }
.asset-document b { font-size: .74rem; }
.asset-document small { color: var(--ink-faint); font-size: .61rem; }
.asset-section-empty { padding: 15px 5px; color: var(--ink-faint); font-size: .7rem; font-weight: 650; text-align: center; }

/* ============ Pets ============ */
.pets-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.pet-card {
  padding: 16px; text-align: left; cursor: pointer; position: relative;
  border-top: 5px solid var(--pc, var(--accent)); transition: transform 0.12s, box-shadow 0.15s;
}
.pet-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pet-profile { display: flex; align-items: center; gap: 12px; }
.pet-profile-main { flex: 1; min-width: 0; }
.pet-card .pem { width: 48px; height: 48px; display: grid; place-items: center; flex: none; font-size: 2rem; line-height: 1; background: #f5f6fb; border-radius: 10px; }
.pet-card .pt { font-weight: 800; font-size: 1.02rem; margin: 0 0 2px; }
.pet-card .pmeta { color: var(--ink-soft); font-size: 0.83rem; font-weight: 600; }
.pet-card .pbday { color: #b26a00; font-size: 0.76rem; font-weight: 700; margin-top: 4px; }
.pet-attribution { margin-top: 4px; color: #956000; font-size: .64rem; font-weight: 800; }
.pet-card .pnotes { color: var(--ink-faint); font-size: 0.8rem; line-height: 1.4; margin-top: 10px; }
.pet-care { border-top: 1px solid var(--line); margin-top: 13px; padding-top: 11px; }
.pet-care-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.pet-care-head > span { flex: 1; color: var(--ink-soft); font-size: 0.76rem; font-weight: 800; text-transform: uppercase; }
.pet-care-head .icon-btn { width: 28px; height: 28px; box-shadow: none; background: #eef2ff; color: var(--brand); }
.pet-care-head .pet-health-open { min-height: 30px; padding: 4px 8px; color: #9e2f35; background: #fde8e8; box-shadow: none; }
.pet-care-head .pet-health-open .i { width: 13px; height: 13px; }
.pet-care-head .i { width: 15px; height: 15px; }
.pet-care-list { display: flex; flex-direction: column; gap: 4px; }
.pet-care-row { display: flex; align-items: flex-start; gap: 5px; border-radius: 8px; background: #f8f9fd; }
.pet-care-row::before { content: ""; width: 6px; height: 6px; margin: 13px 0 0 10px; border-radius: 50%; flex: none; background: var(--pc, var(--accent)); }
.pet-care-text { flex: 1; min-width: 0; padding: 8px 3px; text-align: left; font-size: 0.8rem; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }
.pet-care-text small { display: block; margin-top: 2px; color: #956000; font-size: .6rem; font-weight: 800; }
.pet-health-centre { display: flex; flex-direction: column; gap: 12px; }
.pet-health-hero { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 11px; align-items: center; }
.pet-health-hero > span { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 9px; background: #f4f5fa; font-size: 1.8rem; }
.pet-health-hero > div { min-width: 0; }
.pet-health-hero h2 { font-size: 1.02rem; }
.pet-health-hero p { margin: 3px 0 0; color: var(--ink-soft); font-size: .7rem; font-weight: 650; }
.pet-handover { padding: 10px; border-left: 4px solid var(--accent); border-radius: 5px; background: #fff8e8; }
.pet-handover b { font-size: .72rem; }
.pet-handover p { margin: 3px 0 0; color: #765000; font-size: .7rem; line-height: 1.45; white-space: pre-wrap; }
.pet-health-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.pet-health-stats > div { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: #f8f9fd; }
.pet-health-stats b, .pet-health-stats span { display: block; }
.pet-health-stats b { font-size: .9rem; overflow-wrap: anywhere; }
.pet-health-stats span { margin-top: 2px; color: var(--ink-faint); font-size: .59rem; font-weight: 750; }
.pet-health-quick { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.pet-health-quick .btn { flex: none; }
.pet-health-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.pet-health-grid section { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 8px; }
.pet-health-grid h3 { margin-bottom: 6px; font-size: .78rem; }
.health-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: center; min-height: 45px; border-top: 1px solid #edf0f6; }
.health-row:first-of-type { border-top: 0; }
.health-row.inactive { opacity: .55; }
.health-row > div { min-width: 0; }
.health-row b, .health-row span, .health-row small { display: block; overflow-wrap: anywhere; }
.health-row b { font-size: .72rem; }
.health-row span, .health-row small { margin-top: 2px; color: var(--ink-faint); font-size: .61rem; font-weight: 650; }
.health-row small { color: #976100; font-weight: 800; }
.pet-health-actions { display: flex; gap: 4px; }
.pet-health-actions .icon-btn { width: 29px; height: 29px; box-shadow: none; background: #f2f4f9; }
.pet-health-actions .icon-btn .i { width: 12px; height: 12px; }
.pet-health-actions .danger { color: var(--danger); }
.health-empty { padding: 14px 4px; color: var(--ink-faint); font-size: .66rem; font-weight: 650; text-align: center; }
.pet-care-delete { width: 30px; height: 34px; display: grid; place-items: center; flex: none; color: var(--ink-faint); }
.pet-care-delete:hover { color: var(--danger); }
.pet-care-delete .i { width: 13px; height: 13px; }
.pet-care-empty { padding: 8px 4px; color: var(--ink-faint); font-size: 0.78rem; font-weight: 600; }

/* ============ Employees ============ */
.emp-wrap { display: flex; flex-direction: column; gap: 16px; max-width: 980px; }
.emp-card { padding: 18px; }
.emp-card.paused { opacity: 0.65; }
.emp-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.emp-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.02rem; letter-spacing: 0.5px;
}
.emp-info { flex: 1; min-width: 140px; }
.emp-info .en { font-weight: 800; font-size: 1.05rem; }
.emp-info .er { color: var(--ink-soft); font-size: 0.85rem; font-weight: 600; }
.emp-paused {
  font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--line); color: var(--ink-soft); border-radius: 6px; padding: 2px 7px; vertical-align: 2px;
}
.emp-notes { color: var(--ink-faint); font-size: 0.85rem; margin-top: 8px; }
.emp-lists {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px; align-items: start; margin-top: 14px;
}
.emp-list { background: #f8f9fe; border: 1px solid var(--line); border-top: 4px solid var(--lc, var(--ok)); border-radius: var(--radius-sm); }
.emp-new-list { min-height: 110px; font-size: 0.88rem; }


/* ============ Photos / settings ============ */
.photos-wrap { max-width: 560px; margin: 6vh auto 0; text-align: center; }
.photos-wrap img { width: 240px; height: auto; margin-bottom: 12px; }
.photos-wrap p { color: var(--ink-soft); line-height: 1.55; }

.settings-wrap { max-width: 720px; display: flex; flex-direction: column; gap: 16px; }
.settings-card { padding: 20px; }
.settings-card h3 { margin-bottom: 14px; font-size: 1.05rem; }
.nav-visibility-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 7px; }
.nav-visibility-grid label { min-height: 38px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fafbff; font-size: .78rem; font-weight: 750; cursor: pointer; }
.nav-visibility-grid input { width: 17px; height: 17px; flex: none; accent-color: var(--brand); }
.nav-visibility-grid label:has(input:disabled) { opacity: .65; cursor: default; }
.pwa-install-card {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center; gap: 14px;
}
.pwa-install-card > img { border-radius: 11px; }
.pwa-install-copy { min-width: 0; }
.pwa-install-copy h3 { margin: 0 0 3px; }
.pwa-install-copy p { margin: 0; color: var(--ink-soft); font-size: 0.85rem; line-height: 1.35; }
.pwa-install-card .btn { white-space: nowrap; justify-content: center; }
.pwa-install-card .btn:disabled { opacity: 0.58; cursor: default; box-shadow: none; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.member-row:first-of-type { border-top: none; }
.member-row .mn { font-weight: 700; flex: 1; }
.member-row .mn small { display: block; }
.member-access-badge { color: #0f7a60; font-size: 0.68rem; font-weight: 800; margin-top: 2px; }
.member-role-line { display: flex !important; align-items: center; gap: 4px; margin-top: 3px; color: var(--ink-faint); font-size: .64rem; font-weight: 700; }
.member-role-badge { display: inline-flex; padding: 2px 5px; border-radius: 5px; color: #315cbe; background: #e8eeff; font-size: .58rem; font-weight: 900; text-transform: uppercase; }
.member-role-badge.owner { color: #8a5600; background: #fff1cf; }
.member-role-badge.parent { color: #087668; background: #e2f6f0; }
.member-role-badge.roommate { color: #7a4b12; background: #fff0d8; }
.member-role-badge.guest, .member-role-badge.employee { color: var(--ink-soft); background: #eaecf3; }
.roommate-settings-card { border-left: 4px solid var(--accent); }
.roommate-settings-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.roommate-settings-head > div { min-width: 0; flex: 1; }
.roommate-settings-head h3 { margin: 0 0 3px; }
.roommate-settings-head p { margin: 0; color: var(--ink-soft); font-size: .75rem; font-weight: 650; line-height: 1.4; }
.roommate-row { background: #fffcf7; }
.roommate-empty { padding: 18px 10px; border: 1px dashed var(--line); border-radius: 8px; color: var(--ink-faint); font-size: .75rem; font-weight: 650; line-height: 1.45; text-align: center; }
.form-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.form-row label { font-weight: 700; font-size: 0.88rem; min-width: 110px; }
.oversight-card { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; }
.oversight-card > div { min-width: 0; }
.oversight-card h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 3px; }
.oversight-card h3 .i { color: var(--brand); }
.oversight-card p { margin: 0; color: var(--ink-soft); font-size: .76rem; font-weight: 650; line-height: 1.4; }
.oversight-count { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; color: #315cbe; background: #e8eeff; font-size: .72rem; font-weight: 900; }
.weekly-settings-card > label { color: var(--ink-soft); font-size: .68rem; font-weight: 800; }
.weekly-settings-card select { display: block; margin-top: 3px; border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; background: #fafbff; font-size: .75rem; }
.history-list { display: flex; flex-direction: column; gap: 7px; }
.history-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.history-row.undone { opacity: .55; }
.history-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; color: #315cbe; background: #e8eeff; }
.history-row > div { min-width: 0; }
.history-row b, .history-row small, .history-row span { display: block; overflow-wrap: anywhere; }
.history-row b { font-size: .82rem; }
.history-row small { margin-top: 2px; color: var(--ink-soft); font-size: .68rem; font-weight: 650; }
.history-row > div > span { margin-top: 3px; color: var(--ink-faint); font-size: .62rem; font-weight: 750; text-transform: capitalize; }
.history-row em { color: var(--ink-faint); font-size: .66rem; font-style: normal; font-weight: 800; }
.history-empty { padding: 50px 10px; color: var(--ink-faint); font-size: .78rem; font-weight: 650; text-align: center; }
.weekly-summary { display: flex; flex-direction: column; gap: 13px; }
.weekly-range { color: var(--ink-soft); font-size: .75rem; font-weight: 800; }
.weekly-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.weekly-stats > div { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8f9fd; }
.weekly-stats b, .weekly-stats span { display: block; }
.weekly-stats b { font-size: 1.15rem; }
.weekly-stats span { margin-top: 2px; color: var(--ink-faint); font-size: .65rem; font-weight: 750; }
.weekly-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.weekly-columns section { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.weekly-columns h3 { margin-bottom: 8px; font-size: .8rem; }
.weekly-columns p { color: var(--ink-faint); font-size: .7rem; }
.weekly-line { display: flex; align-items: center; gap: 8px; min-height: 30px; border-top: 1px solid #eef0f5; }
.weekly-line:first-of-type { border-top: 0; }
.weekly-line span { width: 52px; flex: none; color: var(--brand); font-size: .66rem; font-weight: 850; }
.weekly-line b { min-width: 0; font-size: .74rem; overflow-wrap: anywhere; }
.weekly-money { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.weekly-money span { color: var(--ink-faint); font-size: .64rem; font-weight: 750; }
.weekly-money b { display: block; margin-top: 3px; color: var(--ink); font-size: .78rem; }
.weekly-money b.neg { color: var(--danger); }
.weekly-narrative { margin: 0; padding: 12px; border-radius: 8px; color: var(--ink-soft); background: #f5f6fa; font-family: inherit; font-size: .72rem; font-weight: 650; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ============ Encrypted document vault ============ */
.documents-wrap { max-width: 980px; margin: 0 auto; }
.document-summary { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)) minmax(190px, 1.3fr); gap: 10px; margin-bottom: 14px; }
.document-summary > div, .document-summary > label { min-width: 0; min-height: 72px; display: flex; flex-direction: column; justify-content: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow-sm); }
.document-summary b { font-size: 1.25rem; }
.document-summary span, .document-summary label { color: var(--ink-soft); font-size: .7rem; font-weight: 750; }
.document-summary .danger b { color: var(--danger); }
.document-summary select { width: 100%; margin-top: 5px; border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; background: #fafbff; font-size: .78rem; }
.documents-list { display: flex; flex-direction: column; gap: 8px; }
.document-card { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 14px; border: 1px solid var(--line); border-radius: 8px; }
.document-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px; color: #315cbe; background: #e8eeff; }
.document-main { min-width: 0; }
.document-title { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.document-title h3 { font-size: .9rem; overflow-wrap: anywhere; }
.document-title span { padding: 3px 6px; border-radius: 5px; color: #087668; background: #e2f6f0; font-size: .6rem; font-weight: 850; }
.document-main p, .document-main small { display: block; margin: 3px 0 0; color: var(--ink-faint); font-size: .69rem; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }
.document-main small { color: var(--ink-soft); }
.document-expiry { display: inline-block; margin-top: 5px; color: var(--ink-soft); font-size: .66rem; }
.document-expiry.soon, .document-expiry.week { color: #976100; }
.document-expiry.expired, .document-expiry.today { color: var(--danger); }
.document-actions { display: flex; gap: 5px; }
.document-actions .icon-btn { width: 34px; height: 34px; box-shadow: none; background: #f2f4f9; text-decoration: none; }
.document-actions .icon-btn.danger { color: var(--danger); }
.document-empty { min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px dashed var(--line); border-radius: 8px; color: var(--ink-faint); }
.document-empty .i { width: 38px; height: 38px; color: var(--brand); }
.document-empty b { color: var(--ink); }
.document-empty span { font-size: .75rem; font-weight: 650; }
.document-picker { min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 14px; border: 1.5px dashed #bdc5dc; border-radius: 8px; background: #f8f9fd; text-align: center; }
.document-picker:hover { border-color: var(--brand); background: #f1f4ff; }
.document-picker .i { width: 30px; height: 30px; margin-bottom: 4px; color: var(--brand); }
.document-picker span { color: var(--ink-faint); font-size: .68rem; font-weight: 650; }
.document-upload-preview { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8f9fd; }
.document-preview-shell { display: flex; flex-direction: column; gap: 12px; }
.document-preview-meta { display: flex; align-items: center; gap: 12px; min-width: 0; }
.document-preview-meta > span { min-width: 0; flex: 1; }
.document-preview-meta b, .document-preview-meta small { display: block; overflow-wrap: anywhere; }
.document-preview-meta b { font-size: .82rem; }
.document-preview-meta small { margin-top: 2px; color: var(--ink-faint); font-size: .68rem; font-weight: 650; }
.document-preview-media { min-height: 340px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #eef0f5; }
.document-preview-media.local { min-height: 280px; }
.document-preview-image { display: block; width: 100%; height: min(62vh, 680px); object-fit: contain; }
.document-preview-media.local .document-preview-image { height: min(46vh, 480px); }
.document-preview-frame { width: 100%; height: min(62vh, 680px); border: 0; background: #fff; }
.document-preview-media.local .document-preview-frame { height: min(46vh, 480px); }
.document-file-note { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; color: #315cbe; background: #eef2ff; }
.document-file-note > span { min-width: 0; }
.document-file-note b, .document-file-note small { display: block; overflow-wrap: anywhere; }
.document-file-note small { margin-top: 2px; color: var(--ink-soft); font-size: .68rem; }

/* ============ Modal ============ */
.modal-wrap {
  position: fixed; inset: 0; background: rgba(23, 27, 52, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 150; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--panel); border-radius: 20px; box-shadow: var(--shadow);
  width: min(560px, 100%); max-height: 88vh; display: flex; flex-direction: column;
  animation: pop 0.18s ease-out;
}
.modal.modal-wide { width: min(1080px, 100%); }
@keyframes pop { from { transform: scale(0.96) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }
.modal-head h2 { font-size: 1.2rem; }
.modal-body { padding: 16px 20px 20px; overflow-y: auto; }
.edit-presence { margin-bottom: 11px; padding: 7px 9px; border-radius: 7px; color: #087668; background: #e2f6f0; font-size: .68rem; font-weight: 800; line-height: 1.35; }
.edit-presence.busy { color: #8a5600; background: #fff1cf; }
.comment-thread { display: flex; flex-direction: column; gap: 10px; }
.comment-list { max-height: 48vh; overflow-y: auto; }
.comment-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 9px; align-items: start; padding: 10px 2px; border-top: 1px solid var(--line); }
.comment-row:first-child { border-top: 0; }
.comment-avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: #315cbe; background: #e8eeff; font-size: .72rem; font-weight: 900; }
.comment-row > div { min-width: 0; }
.comment-meta { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.comment-meta b { font-size: .78rem; }
.comment-meta span { color: var(--ink-faint); font-size: .62rem; font-weight: 650; }
.comment-row p { margin: 4px 0 0; font-size: .78rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-row small { display: block; margin-top: 4px; color: #315cbe; font-size: .64rem; font-weight: 800; }
.comment-delete { width: 30px; height: 30px; box-shadow: none; color: var(--danger); background: #fdeceb; }
.comment-delete .i { width: 13px; height: 13px; }
.comment-empty { padding: 32px 10px; color: var(--ink-faint); font-size: .76rem; font-weight: 650; text-align: center; }
.mention-picker { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 2px; }
.mention-picker button { flex: none; padding: 4px 7px; border-radius: 6px; color: #315cbe; background: #e8eeff; font-size: .64rem; font-weight: 850; }
.comment-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; padding-top: 9px; border-top: 1px solid var(--line); }
.comment-form textarea { min-height: 72px; max-height: 180px; resize: vertical; border: 1.5px solid var(--line); border-radius: 8px; padding: 9px; background: #fafbff; outline: none; }
.comment-form textarea:focus { border-color: var(--brand); }
.inbox-list { display: flex; flex-direction: column; gap: 8px; }
.inbox-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 11px; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 8px; }
.inbox-row.warning { border-left-color: var(--accent); }
.inbox-row.danger { border-left-color: var(--danger); }
.inbox-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; color: var(--brand); background: #e8eeff; }
.inbox-row.warning .inbox-icon { color: #976100; background: #fff2d5; }
.inbox-row.danger .inbox-icon { color: var(--danger); background: #fde8e8; }
.inbox-row > div:nth-child(2) { min-width: 0; }
.inbox-row b, .inbox-row small { display: block; overflow-wrap: anywhere; }
.inbox-row b { font-size: .84rem; }
.inbox-row small { margin-top: 2px; color: var(--ink-soft); font-size: .72rem; font-weight: 650; line-height: 1.4; }
.inbox-actions { display: flex; align-items: center; gap: 5px; }
.inbox-actions .icon-btn { width: 32px; height: 32px; box-shadow: none; background: #f2f4f9; }
.inbox-actions .i { width: 14px; height: 14px; }
.inbox-empty { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: var(--ink-faint); }
.inbox-empty .i { width: 36px; height: 36px; color: var(--ok); }
.inbox-empty b { color: var(--ink); }
.inbox-empty span, .inbox-snoozed { font-size: .75rem; font-weight: 650; }
.inbox-snoozed { margin: 3px 0 0; color: var(--ink-faint); text-align: center; }
.global-search { min-height: 330px; }
.search-field { height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 13px; border: 1.5px solid var(--line); border-radius: 8px; background: #fafbff; }
.search-field:focus-within { border-color: var(--brand); }
.search-field .i { color: var(--ink-faint); }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; }
.search-results { display: flex; flex-direction: column; gap: 5px; margin-top: 9px; }
.search-result { width: 100%; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px; border-radius: 8px; text-align: left; }
.search-result:hover { background: #f1f4fb; }
.search-result > span:first-child { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; color: var(--brand); background: #e8eeff; }
.search-result > span:nth-child(2) { min-width: 0; }
.search-result b, .search-result small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result b { font-size: .84rem; }
.search-result small { margin-top: 2px; color: var(--ink-faint); font-size: .7rem; font-weight: 650; }
.search-result em { color: var(--ink-faint); font-size: .62rem; font-style: normal; font-weight: 850; text-transform: uppercase; }
.search-hint { padding: 42px 10px; color: var(--ink-faint); font-size: .78rem; font-weight: 650; text-align: center; }

/* In-app confirmations replace native browser alert/confirm/prompt UI. */
.action-dialog-wrap { position: fixed; inset: 0; z-index: 180; display: grid; place-items: center; padding: 18px; background: rgba(23,27,52,.55); backdrop-filter: blur(4px); }
.action-dialog { width: min(430px, 100%); display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 11px 13px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 18px 56px rgba(23,27,52,.25); animation: pop .16s ease-out; }
.action-dialog-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px; color: var(--danger); background: #fdeceb; }
.action-dialog-icon.neutral { color: var(--brand); background: #e8eeff; }
.action-dialog-copy { min-width: 0; align-self: center; }
.action-dialog-copy h2 { font-size: 1rem; }
.action-dialog-copy p { margin: 4px 0 0; color: var(--ink-soft); font-size: .8rem; font-weight: 650; line-height: 1.45; overflow-wrap: anywhere; }
.action-dialog-value { grid-column: 1 / -1; }
.action-dialog-value label { display: block; margin-bottom: 4px; color: var(--ink-soft); font-size: .7rem; font-weight: 800; }
.action-dialog-value input { width: 100%; border: 1.5px solid var(--line); border-radius: 8px; padding: 10px; background: #fafbff; outline: none; }
.action-dialog-value input:focus { border-color: var(--brand); }
.action-dialog-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 3px; }

@media (max-width: 560px) {
  .action-dialog-wrap { align-items: end; padding: 10px; }
  .action-dialog { padding: 16px; }
  .action-dialog-actions { flex-wrap: wrap; }
  .action-dialog-actions .btn { flex: 1 1 calc(50% - 4px); min-height: 42px; }
  .inbox-row { grid-template-columns: 36px minmax(0, 1fr); }
  .inbox-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .comment-form { grid-template-columns: 1fr; }
  .comment-form .btn { width: 100%; }
}

/* Receipt capture and review */
.receipt-source { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.receipt-source button { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 16px; border: 1.5px solid var(--line); border-radius: 8px; background: #f8f9fd; text-align: center; }
.receipt-source button:hover { border-color: var(--brand); background: #f2f5ff; }
.receipt-source button > span { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 4px; border-radius: 8px; color: var(--brand); background: #e7edff; }
.receipt-source button b { font-size: .88rem; }
.receipt-source button small { max-width: 160px; color: var(--ink-faint); font-size: .7rem; font-weight: 650; line-height: 1.35; }
.receipt-reading { min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.receipt-reading small { color: var(--ink-faint); font-size: .75rem; font-weight: 650; }
.receipt-preview-stage { display: flex; flex-direction: column; gap: 10px; }
.receipt-preview-stage > img { width: 100%; max-height: 52vh; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #f2f4f9; }
.receipt-preview-info { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.receipt-preview-info b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; }
.receipt-preview-info small { flex: none; color: var(--ink-faint); font-size: .7rem; font-weight: 700; }
.receipt-preview-error { margin: 0; padding: 9px 11px; border-left: 3px solid var(--danger); color: #9c292d; background: #fff0f0; font-size: .76rem; line-height: 1.4; }
.receipt-preview-actions { flex-wrap: wrap; }
.receipt-reading-preview { width: min(280px, 100%); max-height: 230px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #f2f4f9; opacity: .72; }
.receipt-review-preview { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: center; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.receipt-review-preview img { width: 112px; height: 112px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #f2f4f9; }
.receipt-review-preview b, .receipt-review-preview small { display: block; overflow-wrap: anywhere; }
.receipt-review-preview b { font-size: .84rem; }
.receipt-review-preview small { margin-top: 4px; color: var(--ink-faint); font-size: .72rem; line-height: 1.4; }
.receipt-scan { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 6px; border-radius: 8px; color: var(--brand); background: #e8eeff; animation: receipt-pulse 1.5s ease-in-out infinite; }
@keyframes receipt-pulse { 50% { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(74,124,255,.1); } }
.receipt-meta { display: grid; grid-template-columns: minmax(150px, 1.5fr) 140px 140px 130px 150px; gap: 10px; align-items: end; }
.receipt-table-head { display: flex; align-items: baseline; gap: 10px; margin: 18px 0 7px; padding-bottom: 7px; border-bottom: 2px solid var(--ink); }
.receipt-table-head span { font-size: .86rem; font-weight: 850; }
.receipt-table-head small { color: var(--ink-faint); font-size: .68rem; font-weight: 650; }
#receiptRows { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.receipt-row { display: grid; grid-template-columns: 54px minmax(140px, 1fr) 65px 72px 92px 132px 126px 78px 34px; gap: 7px; align-items: end; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcff; }
.receipt-row .f-field { min-width: 0; }
.receipt-row .f-field label { margin-bottom: 3px; font-size: .66rem; }
.receipt-row .f-field :is(input, select) { min-width: 0; padding: 7px 8px; border-radius: 7px; font-size: .78rem; }
.receipt-stock-wrap { min-height: 34px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink-soft); font-size: .62rem; font-weight: 800; cursor: pointer; }
.receipt-stock-wrap input { width: 18px; height: 18px; margin: 0; accent-color: var(--ok); }
.receipt-row.not-stock .receipt-stock-option { opacity: .38; }
.receipt-remove { width: 32px; height: 32px; margin-bottom: 1px; box-shadow: none; color: var(--ink-faint); background: transparent; }
.receipt-remove:hover { color: var(--danger); }
.receipt-remove .i { width: 15px; height: 15px; }
.receipt-save-note { align-self: center; color: var(--ink-faint); font-size: .7rem; font-weight: 650; }

.meal-usage-box { border: 1.5px solid var(--line); border-radius: 8px; padding: 11px; background: #f8f9fd; }
.meal-usage-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.meal-usage-head > div { min-width: 0; flex: 1; }
.meal-usage-head b, .meal-usage-head small { display: block; }
.meal-usage-head b { font-size: .84rem; }
.meal-usage-head small { margin-top: 2px; color: var(--ink-faint); font-size: .68rem; font-weight: 650; }
.meal-usage-head .btn:disabled { opacity: .45; cursor: default; }
#mlUsage { display: flex; flex-direction: column; gap: 6px; }
.meal-usage-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 80px 32px; gap: 7px; align-items: end; padding: 7px; border-radius: 7px; background: #fff; }
.meal-usage-row .f-field { min-width: 0; }
.meal-usage-row .f-field label { margin-bottom: 3px; font-size: .66rem; }
.meal-usage-row .f-field :is(input, select) { min-width: 0; padding: 7px 8px; border-radius: 7px; font-size: .76rem; }
.ml-remove-usage { width: 32px; height: 32px; box-shadow: none; color: var(--ink-faint); background: transparent; }
.ml-remove-usage .i { width: 14px; height: 14px; }
.ml-remove-usage:hover { color: var(--danger); }
.meal-usage-empty { padding: 10px 4px; color: var(--ink-faint); font-size: .72rem; font-weight: 650; text-align: center; }

.f-grid { display: flex; flex-direction: column; gap: 13px; }
.f-field label { display: block; font-weight: 700; font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 5px; }
.f-field input[type="text"], .f-field input[type="number"], .f-field input[type="date"],
.f-field input[type="time"], .f-field select, .f-field textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px;
  background: #fafbff; outline: none; transition: border-color 0.15s;
}
.f-field :is(input, select, textarea):focus { border-color: var(--brand); }
.f-field textarea { resize: vertical; min-height: 60px; }
.f-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.f-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.check-pill { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.88rem; cursor: pointer; user-select: none; }
.check-pill input { width: 17px; height: 17px; accent-color: var(--brand); }
.field-note { color: var(--ink-faint); font-size: .68rem; font-weight: 600; }
.member-profile-box { display: grid; grid-template-columns: minmax(150px, .75fr) minmax(0, 1.25fr); gap: 10px; padding: 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #f8f9fe; }
.member-permissions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }

.member-access-box { border: 1.5px solid var(--line); border-radius: 10px; padding: 13px; background: #f8f9fe; }
.member-access-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.member-access-head strong { display: block; font-size: 0.92rem; }
.member-access-head small { display: block; color: var(--ink-faint); font-size: 0.74rem; font-weight: 600; margin-top: 2px; }
.switch-check { flex: none; cursor: pointer; }
.switch-check input { position: absolute; opacity: 0; pointer-events: none; }
.switch-check span { display: block; width: 42px; height: 24px; border-radius: 12px; background: #c9cede; padding: 3px; transition: background .15s; }
.switch-check span::after { content: ""; display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(23,27,52,.25); transition: transform .15s; }
.switch-check input:checked + span { background: var(--ok); }
.switch-check input:checked + span::after { transform: translateX(18px); }
.switch-check input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.member-rights { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
.right-option { display: flex; align-items: flex-start; gap: 8px; border-radius: 8px; padding: 8px; background: #fff; cursor: pointer; }
.right-option.dependent { margin-left: 12px; }
.right-option input { width: 17px; height: 17px; flex: none; margin-top: 1px; accent-color: var(--brand); }
.right-option input:disabled + span { opacity: .45; }
.right-option b, .right-option small { display: block; }
.right-option b { font-size: 0.8rem; }
.right-option small { color: var(--ink-faint); font-size: 0.68rem; font-weight: 600; line-height: 1.35; margin-top: 1px; }
.member-access-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 5px; }
.child-request-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.child-request-row:first-of-type { border-top: none; }
.child-request-row:not(.pending) { opacity: .72; }
.request-member-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.request-main { flex: 1; min-width: 190px; }
.request-main b, .request-main span, .request-main small { display: block; }
.request-main b { font-size: .78rem; color: var(--ink-soft); }
.request-main span { font-size: .9rem; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.request-main small { color: var(--ink-faint); font-size: .68rem; font-weight: 600; margin-top: 3px; }
.request-status { padding: 4px 8px; border-radius: 7px; font-size: .7rem; font-weight: 800; text-transform: capitalize; }
.request-status.approved { color: #0f7a60; background: #e2f6f0; }
.request-status.declined { color: var(--danger); background: #fdeceb; }

.who-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.who-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 7px;
  border-radius: 999px; border: 2px solid var(--line); font-weight: 700; font-size: 0.85rem;
  cursor: pointer; user-select: none; transition: all 0.13s; background: #fff;
}
.who-chip.on { border-color: var(--wc, var(--brand)); background: color-mix(in srgb, var(--wc, var(--brand)) 12%, #fff); }

.day-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.day-dot {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line);
  font-weight: 800; font-size: 0.78rem; color: var(--ink-soft); background: #fff;
  transition: all 0.13s;
}
.day-dot.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; transition: transform 0.12s; }
.color-dot.on { border-color: var(--ink); transform: scale(1.1); }

.icon-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-choice {
  width: 42px; height: 42px; border-radius: 12px; border: 2px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft); background: #fff;
}
.icon-choice.on { border-color: var(--brand); color: var(--brand); background: #eef2ff; }

.avatar-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-choice { border: 2.5px solid var(--line); border-radius: 50%; padding: 2px; background: #fff; }
.avatar-choice.on { border-color: var(--brand); }

.modal-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.modal-actions .spacer { flex: 1; }

/* ============ Toast ============ */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-weight: 700; font-size: 0.92rem;
  padding: 12px 22px; border-radius: 999px; box-shadow: var(--shadow); z-index: 200;
  animation: toast-in 0.25s ease-out;
}
.toast.star { background: #b26a00; }
@keyframes toast-in { from { transform: translate(-50%, 16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ============ Screensaver ============ */
.screensaver { position: fixed; inset: 0; z-index: 300; cursor: pointer; overflow: hidden; background: #0e1230; }
.ss-sky { position: absolute; inset: 0; transition: background 2s; }
.ss-sky .ss-orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.55; animation: drift 26s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(80px, -60px) scale(1.15); } }
.ss-star { position: absolute; background: #fff; border-radius: 50%; animation: twinkle 3.5s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.9; } }
.ss-info { position: absolute; left: 6%; bottom: 10%; color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,0.35); }
.ss-time { font-size: 5.2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.ss-date { font-size: 1.3rem; margin-top: 8px; opacity: 0.85; }
.ss-next { margin-top: 18px; font-size: 1rem; opacity: 0.8; display: flex; align-items: center; gap: 8px; }
.ss-hint { position: absolute; right: 24px; bottom: 20px; color: rgba(255,255,255,0.45); font-size: 0.8rem; font-weight: 600; }

/* ============ Empty state ============ */
.empty {
  text-align: center; color: var(--ink-faint); padding: 34px 16px; font-weight: 600;
}
.empty img { width: 150px; margin-bottom: 10px; opacity: 0.9; }
/* Empty states inside card grids should span & center across the full row */
:is(.pets-wrap, .lists-wrap, .recipes-wrap, .chore-board, .reward-grid, .photo-grid, .emp-lists) > .empty {
  grid-column: 1 / -1; justify-self: center; width: 100%;
}

.hidden { display: none !important; }

/* ============ Weather ============ */
.side-weather {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  color: #aab2e0; font-size: 0.85rem; font-weight: 700;
}
.side-weather .i { width: 22px; height: 22px; color: #ffd67a; }
.side-weather .wloc { font-size: 0.68rem; font-weight: 600; color: #8f97c6; display: block; }
.wcol-head .wx {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  margin-top: 4px; font-size: 0.68rem; font-weight: 700; color: var(--ink-faint);
}
.wcol-head .wx .i { width: 14px; height: 14px; }
.wcol-head.today .wx { color: rgba(255, 255, 255, 0.85); }

/* ============ Quick add ============ */
.quick-add {
  display: flex; align-items: center; gap: 10px;
  margin: 0 24px 12px; padding: 6px 8px 6px 14px;
  background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.quick-add .i { color: #9b6bff; flex: none; }
.quick-add input { flex: 1; border: none; outline: none; background: transparent; font-size: 0.92rem; padding: 8px 0; }

/* ============ Recipes ============ */
.recipes-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; align-items: start; }
.recipe-card { padding: 16px; cursor: pointer; position: relative; transition: transform 0.12s, box-shadow 0.15s; }
.recipe-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.recipe-card .rem { font-size: 2.3rem; line-height: 1; }
.recipe-card .rt { font-weight: 800; font-size: 1rem; margin: 8px 0 4px; }
.recipe-card .rmeta { display: flex; gap: 10px; color: var(--ink-faint); font-size: 0.78rem; font-weight: 700; flex-wrap: wrap; }
.recipe-card .rfav { position: absolute; top: 10px; right: 12px; color: var(--accent); }
.recipe-card .rfav .i { fill: var(--accent); width: 17px; height: 17px; }
.recipe-conflict-chip { padding: 2px 6px; border-radius: 5px; color: var(--danger); background: #fde8e8; }
.recipe-detail .rd-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.recipe-detail .rd-head .rem { font-size: 2.6rem; }
.recipe-detail .rd-meta { color: var(--ink-faint); font-size: 0.85rem; font-weight: 700; }
.recipe-detail h4 { margin: 14px 0 6px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-soft); }
.recipe-detail .ing-list { list-style: none; margin: 0; padding: 0; }
.recipe-detail .ing-list li { padding: 5px 0 5px 22px; position: relative; font-size: 0.92rem; border-bottom: 1px dashed var(--line); }
.recipe-detail .ing-list li::before { content: ""; position: absolute; left: 4px; top: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.recipe-detail .steps { white-space: pre-line; line-height: 1.65; font-size: 0.92rem; color: var(--ink); }
.rd-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.recipe-warning { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 9px; margin: 8px 0; padding: 10px; border-left: 4px solid var(--accent); border-radius: 6px; color: #765000; background: #fff8e8; }
.recipe-warning.danger { border-left-color: var(--danger); color: #8f3036; background: #fff1f1; }
.recipe-warning > .i { margin-top: 1px; }
.recipe-warning b, .recipe-warning span { display: block; }
.recipe-warning b { font-size: .76rem; }
.recipe-warning span { margin-top: 2px; font-size: .68rem; font-weight: 650; overflow-wrap: anywhere; }
.nutrition-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin: 10px 0; }
.nutrition-grid > div { padding: 9px; border: 1px solid var(--line); border-radius: 7px; background: #f8f9fd; }
.nutrition-grid b, .nutrition-grid span { display: block; }
.nutrition-grid b { font-size: .82rem; }
.nutrition-grid span { margin-top: 2px; color: var(--ink-faint); font-size: .59rem; font-weight: 750; }
.nutrition-inputs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.nutrition-inputs input { min-width: 0; width: 100%; border: 1.5px solid var(--line); border-radius: 8px; padding: 8px; background: #fafbff; }
.nutrition-inputs input:focus { border-color: var(--brand); outline: 0; }
.serving-scale { display: flex; align-items: center; gap: 7px; margin: 11px 0 4px; padding: 8px 10px; border-radius: 8px; background: #eef2ff; }
.serving-scale > span { min-width: 0; flex: 1; color: var(--ink-soft); font-size: .7rem; font-weight: 750; }
.serving-scale .icon-btn { width: 30px; height: 30px; box-shadow: none; background: #fff; }
.serving-scale .i { width: 14px; height: 14px; }
.serving-scale input { width: 62px; border: 1px solid #cfd6ea; border-radius: 7px; padding: 6px; background: #fff; text-align: center; }
.serving-scale > b { font-size: .7rem; }
.recipe-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.recipe-tags span { padding: 3px 7px; border-radius: 6px; color: #087668; background: #e2f6f0; font-size: .62rem; font-weight: 800; }
.recipe-tags span.allergen { color: #98353b; background: #fde8e8; }

/* ============ Shopping ============ */
.shop-wrap { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); max-width: 1080px; }
.shop-card { padding: 18px; border-top: 5px solid var(--accent); }
.shop-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.shop-head h3 { flex: 1; font-size: 1.15rem; overflow-wrap: anywhere; }
.shop-head .count { color: var(--ink-faint); font-weight: 700; font-size: 0.85rem; }
.shop-item { padding: 8px 2px; }
.shop-item .lmain { flex: 1; min-width: 0; }
.shop-item .lt { display: block; }
.qty-chip {
  background: #fff4e0; color: #b26a00; font-size: 0.72rem; font-weight: 800;
  border-radius: 6px; padding: 1px 7px; margin-left: 4px; vertical-align: 1px; white-space: nowrap;
}
.src-tag {
  display: block; color: var(--ink-faint); font-size: 0.72rem; font-weight: 600;
  margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-item.done .src-tag { opacity: 0.6; }
.shop-add { display: flex; gap: 8px; margin-top: 12px; flex-wrap: nowrap; }
.shop-add input.qty { width: 64px; flex: none; }
.shop-add input { border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fafbff; outline: none; min-width: 0; }
.shop-add input:focus { border-color: var(--brand); }
.shop-add input.item { flex: 1 1 auto; }
.shop-add .btn { flex: none; }

/* ============ Supplies ============ */
.supplies-wrap { max-width: 1080px; margin: 0 auto; }
.supply-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.supply-toolbar span { color: var(--ink-faint); font-size: .7rem; font-weight: 650; }
.supply-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); max-width: none; }
.expiry-banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; margin-bottom: 16px;
  border-left: 5px solid #b26a00; background: #fffaf0;
}
.low-banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; margin-bottom: 12px;
  border-left: 5px solid var(--danger); background: #fff5f4;
}
.low-banner .eb-ic { width: 30px; height: 30px; display: grid; place-items: center; color: var(--danger); }
.low-banner b { font-size: .92rem; }
.low-chip { color: #a9343a; background: #fde8e8; }
.expiry-banner .eb-ic { font-size: 1.5rem; line-height: 1.2; }
.expiry-banner b { font-size: 0.92rem; }
.eb-items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.eb-chip {
  background: #fff4e0; color: #b26a00; border-radius: 999px; padding: 4px 11px;
  font-size: 0.78rem; font-weight: 700; cursor: pointer; transition: filter 0.12s;
}
.eb-chip:hover { filter: brightness(0.96); }
.eb-chip.expired, .eb-chip.today { background: #fdeceb; color: var(--danger); }
.eb-chip small { font-weight: 600; opacity: 0.75; }
.supply-card { padding: 18px; border-top: 5px solid var(--lc, var(--ok)); }
.supply-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.supply-head .loc-emoji { font-size: 1.35rem; line-height: 1; }
.supply-head h3 { flex: 1; font-size: 1.1rem; overflow-wrap: anywhere; }
.supply-head .count { font-size: 0.78rem; color: var(--ink-faint); font-weight: 700; white-space: nowrap; }
.supply-add { display: flex; gap: 6px; margin: 10px 0 6px; flex-wrap: wrap; }
.supply-add input {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px;
  background: #fafbff; outline: none; min-width: 0; font-size: 0.88rem;
}
.supply-add input:focus { border-color: var(--brand); }
.supply-add .item { flex: 1 1 130px; }
.supply-add .amount { width: 68px; flex: none; }
.supply-add .unit { width: 62px; flex: none; }
.supply-add .threshold { width: 76px; flex: none; }
.supply-add .exp { width: 140px; flex: none; }
.supply-add .btn { flex: none; }
.supply-item { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-radius: 8px; cursor: pointer; }
.supply-item:hover { background: #f7f8fd; }
.supply-item.low { margin: 2px -6px; padding-left: 8px; padding-right: 8px; border-left: 3px solid var(--danger); background: #fff7f6; }
.supply-item .sp-main { flex: 1; min-width: 0; }
.supply-item .sp-name { display: block; font-weight: 700; font-size: 0.92rem; overflow-wrap: anywhere; }
.supply-item .sp-meta { display: block; font-size: 0.72rem; color: var(--ink-faint); font-weight: 600; margin-top: 1px; }
.sp-meta .exp { font-weight: 800; }
.sp-meta .exp.expired, .sp-meta .exp.today { color: var(--danger); }
.sp-meta .exp.soon { color: #b26a00; }
.sp-meta .exp.week { color: var(--ink-soft); }
.sp-meta .low-label { color: var(--danger); font-weight: 800; }
.supply-item .lx { opacity: 0; color: var(--ink-faint); display: inline-flex; }
.supply-item:hover .lx { opacity: 1; }
.supply-item .lx:hover { color: var(--danger); }
.quantity-pair { display: grid; grid-template-columns: minmax(0, 1fr) 90px; gap: 7px; }
.quantity-pair input { min-width: 0; }
.barcode-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.barcode-pair input { min-width: 0; border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fafbff; outline: none; }
.barcode-pair input:focus { border-color: var(--brand); }
.barcode-flow { display: flex; flex-direction: column; gap: 10px; }
.barcode-flow video { width: 100%; max-height: 280px; aspect-ratio: 4 / 3; border-radius: 8px; background: #14182d; object-fit: cover; }
.barcode-entry { height: 54px; display: flex; align-items: center; gap: 10px; padding: 0 13px; border: 1.5px solid var(--line); border-radius: 8px; background: #fafbff; }
.barcode-entry:focus-within { border-color: var(--brand); }
.barcode-entry .i { width: 28px; color: var(--brand); }
.barcode-entry input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 1.05rem; font-weight: 750; }
.barcode-actions { display: flex; gap: 8px; }
.barcode-actions .btn { flex: 1; justify-content: center; }
.barcode-flow > p { margin: 0; color: var(--ink-faint); font-size: .68rem; font-weight: 650; text-align: center; }
.stock-history { display: flex; flex-direction: column; gap: 12px; }
.stock-balance { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; align-items: center; padding: 12px; border-radius: 8px; background: #eef2ff; }
.stock-balance span { color: var(--ink-soft); font-size: .68rem; font-weight: 800; }
.stock-balance b { grid-row: 1 / 3; grid-column: 2; color: #315cbe; font-size: 1.2rem; }
.stock-balance small { color: var(--ink-faint); font-size: .64rem; font-weight: 700; }
.movement-list { display: flex; flex-direction: column; }
.movement-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; align-items: center; min-height: 49px; border-top: 1px solid var(--line); }
.movement-row:first-child { border-top: 0; }
.movement-row > span { color: #087668; font-size: .78rem; font-weight: 900; }
.movement-row.out > span { color: var(--danger); }
.movement-row b, .movement-row small { display: block; overflow-wrap: anywhere; }
.movement-row b { font-size: .76rem; }
.movement-row small { margin-top: 2px; color: var(--ink-faint); font-size: .64rem; font-weight: 650; }

/* Recipe × supplies stock indicators */
.stock-chip { color: #0f7a60; }
.stock-chip.full { font-weight: 800; }
.ing-list li.have::before { background: var(--ok); }
.ing-list li.need::before { background: var(--accent); }
.have-tag { font-size: 0.68rem; color: #0f9d7a; font-weight: 800; margin-left: 6px; white-space: nowrap; }
.all-stock { color: #0f9d7a; font-weight: 700; font-size: 0.9rem; align-self: center; }

/* ============ Member Wishlists ============ */
.wishlists-wrap { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.member-wishlist { min-width: 0; }
.member-wishlist-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding-bottom: 9px; border-bottom: 2px solid color-mix(in srgb, var(--member-color) 55%, var(--line)); }
.member-wishlist-head > div { min-width: 0; flex: 1; }
.member-wishlist-head h2 { font-size: 1rem; }
.member-wishlist-head span { color: var(--ink-faint); font-size: .7rem; font-weight: 750; }
.wish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; align-items: stretch; }
.wish-card { min-width: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow-sm); }
.wish-card.received, .wish-card.no_longer_wanted { opacity: .76; }
.wish-image { height: 160px; display: grid; place-items: center; overflow: hidden; background: #edf0f7; }
.wish-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wish-image > span { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 8px; color: #a87100; background: #fff3d7; }
.wish-image .i { width: 25px; height: 25px; }
.wish-content { min-width: 0; flex: 1; padding: 12px 13px 8px; }
.wish-title-row { display: flex; align-items: flex-start; gap: 7px; }
.wish-title-row h3 { min-width: 0; flex: 1; font-size: .9rem; overflow-wrap: anywhere; }
.wish-status { flex: none; padding: 3px 6px; border-radius: 6px; color: #345bc2; background: #e8eeff; font-size: .6rem; font-weight: 850; }
.wish-card.received .wish-status { color: #087668; background: #e2f6f0; }
.wish-card.no_longer_wanted .wish-status { color: var(--ink-soft); background: #e9ebf2; }
.wish-content p { margin: 6px 0 0; color: var(--ink-soft); font-size: .74rem; line-height: 1.45; overflow-wrap: anywhere; }
.wish-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--brand); font-size: .7rem; font-weight: 800; text-decoration: none; overflow-wrap: anywhere; }
.wish-link:hover { text-decoration: underline; }
.wish-link .i { width: 13px; height: 13px; }
.wish-actions { display: flex; align-items: center; gap: 6px; padding: 8px 10px 10px; flex-wrap: wrap; }
.wish-actions .btn { padding: 5px 8px; font-size: .67rem; }
.wish-actions .btn .i { width: 13px; height: 13px; }
.wish-actions .icon-btn { width: 30px; height: 30px; box-shadow: none; background: #f3f5fa; }
.wish-actions .icon-btn .i { width: 14px; height: 14px; }
.wish-actions .wish-delete { color: var(--danger); }
.wish-empty { min-height: 100px; grid-column: 1 / -1; display: grid; place-items: center; padding: 18px; border: 1px dashed var(--line); border-radius: 8px; color: var(--ink-faint); font-size: .76rem; font-weight: 650; text-align: center; }
.past-wishes { margin-top: 11px; }
.past-wishes > summary { color: var(--ink-soft); font-size: .74rem; font-weight: 850; cursor: pointer; }
.past-wishes[open] > summary { margin-bottom: 9px; }
.wish-grid.archived .wish-image { height: 115px; }
.wish-current-image { display: flex; align-items: center; gap: 11px; margin-bottom: 8px; padding: 8px; border-radius: 8px; background: #f4f6fb; }
.wish-current-image img { width: 74px; height: 56px; object-fit: cover; border-radius: 6px; }
.f-field input[type="file"] { width: 100%; border: 1.5px dashed var(--line); border-radius: 8px; padding: 9px; color: var(--ink-soft); background: #fafbff; font-size: .78rem; }

/* ============ Photos ============ */
.photo-toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.photo-library { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.photo-folder { min-width: 0; }
.photo-folder-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.photo-folder-head > div { min-width: 0; flex: 1; }
.photo-folder-head h2 { display: inline; margin-right: 7px; font-size: 1rem; }
.photo-folder-head span { color: var(--ink-faint); font-size: .7rem; font-weight: 750; }
.photo-folder-head p { margin: 3px 0 0; color: var(--ink-soft); font-size: .76rem; line-height: 1.4; overflow-wrap: anywhere; }
.photo-folder-head .photo-count { min-width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; color: var(--ink-soft); background: #e9ecf5; }
.photo-folder-head .icon-btn { width: 32px; height: 32px; box-shadow: none; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.photo-tile { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-sm); background: var(--panel); }
.photo-image { position: relative; aspect-ratio: 4/3; overflow: hidden; background: #e8ecf9; }
.photo-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile .pdel {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 8px;
  background: rgba(20, 24, 48, 0.55); color: #fff; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s;
}
.photo-tile:hover .pdel { opacity: 1; }
.photo-tile .pdel .i { width: 14px; height: 14px; }
.photo-controls { display: flex; align-items: center; gap: 6px; padding: 7px; }
.photo-controls label { display: inline-flex; align-items: center; gap: 4px; flex: none; color: var(--ink-soft); font-size: .68rem; font-weight: 800; cursor: pointer; }
.photo-controls input { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); }
.photo-controls select { min-width: 0; flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 5px; color: var(--ink-soft); background: #f8f9fd; font-size: .66rem; font-weight: 700; }
.photo-folder-empty { grid-column: 1 / -1; padding: 20px; border: 1px dashed var(--line); border-radius: 8px; color: var(--ink-faint); font-size: .76rem; font-weight: 650; text-align: center; }

/* Screensaver photo slideshow */
.ss-photos { position: absolute; inset: 0; }
.ss-photos img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 2.2s ease; will-change: opacity;
}
.ss-photos img.show { opacity: 1; }
.screensaver .ss-info { z-index: 2; }
.screensaver .ss-hint { z-index: 2; }
.ss-photos::after { content: ""; position: absolute; inset: 0; background: linear-gradient(15deg, rgba(10,12,32,.55) 0%, transparent 55%); }

/* ============ Settings extras ============ */
.geo-results { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.geo-hit {
  text-align: left; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font-weight: 700; font-size: 0.88rem; background: #fafbff;
}
.geo-hit:hover { border-color: var(--brand); color: var(--brand); }
.geo-hit small { display: block; color: var(--ink-faint); font-weight: 600; }
.feed-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.feed-row:first-of-type { border-top: none; }
.feed-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.feed-info { flex: 1; min-width: 160px; }
.feed-info .fn { font-weight: 700; }
.feed-info .fu { font-size: 0.72rem; color: var(--ink-faint); word-break: break-all; }
.feed-info .fe { font-size: 0.74rem; color: var(--danger); font-weight: 700; }
.feed-info .fs { font-size: 0.72rem; color: var(--ink-faint); }
.pin-input {
  font-size: 1.6rem; letter-spacing: 12px; text-align: center; font-weight: 800;
  width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 12px; outline: none;
}
.pin-input:focus { border-color: var(--brand); }
.lock-badge { color: #ffd67a; }

/* ============ Drag & drop ============ */
.evt[draggable="true"] { cursor: grab; }
.evt.dragging { opacity: 0.45; }
.wcol-body.drag-over, .meal-cell.drag-over { outline: 2.5px dashed var(--brand); outline-offset: 2px; border-radius: var(--radius-sm); }
.meal-cell[draggable="true"] { cursor: grab; }
.evt.ics { background: #f4f6ff; }
.evt .feed-tag { font-size: 0.68rem; color: var(--ink-faint); font-weight: 700; margin-top: 3px; display: flex; align-items: center; gap: 4px; }
.evt .feed-tag .i { width: 11px; height: 11px; }

/* ============ Finance ============ */
.fin-wrap { display: flex; flex-direction: column; gap: 16px; }
.finance-accounts { display: flex; flex-direction: column; gap: 8px; }
.finance-accounts-head { display: flex; align-items: baseline; gap: 7px; padding: 0 2px; }
.finance-accounts-head span { color: var(--ink-faint); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0; }
.finance-accounts-head b { font-size: .86rem; }
.finance-account-list { display: flex; gap: 8px; overflow-x: auto; padding: 1px 1px 5px; scrollbar-width: thin; }
.finance-account {
  min-width: 165px; flex: 1 0 165px; display: flex; gap: 9px;
  align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; text-align: left;
  background: var(--panel); box-shadow: var(--shadow-sm);
}
.finance-account:hover { border-color: #aab8df; }
.finance-account.active { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 16%, transparent); }
.finance-account .avatar, .finance-account-icon { width: 36px; height: 36px; flex: none; }
.finance-account-icon { display: grid; place-items: center; border-radius: 50%; color: var(--brand); background: #eef2ff; }
.finance-account-icon .i { width: 17px; height: 17px; }
.finance-account-main { min-width: 0; flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.finance-account-main b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.finance-account-main strong { white-space: nowrap; font-size: .8rem; }
.finance-account-main strong.neg { color: var(--danger); }
.fin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.fin-card { padding: 16px; display: flex; align-items: center; gap: 12px; }
.fin-card .fic {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.fin-card .fic .i { width: 22px; height: 22px; }
.fin-card.inc .fic { background: #e2f6f0; color: #0f9d7a; }
.fin-card.exp .fic { background: #fdeceb; color: var(--danger); }
.fin-card.net .fic { background: #eef2ff; color: var(--brand); }
.fin-card.bill .fic { background: #fff4e0; color: #b26a00; }
.fin-card.forecast .fic { background: #e8eeff; color: #315cbe; }
.fin-card .fv { font-size: 1.25rem; font-weight: 800; line-height: 1.1; }
.fin-card .fl { font-size: 0.75rem; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.5px; }
.fin-card.net .fv.neg { color: var(--danger); }
.fin-card.forecast .fv.neg { color: var(--danger); }

.budget-section { display: flex; flex-direction: column; gap: 10px; }
.budget-section-head { display: flex; align-items: center; gap: 12px; }
.budget-section-head > div:first-child { min-width: 150px; }
.budget-section-head > div:first-child > span { display: block; color: var(--ink-faint); font-size: .66rem; font-weight: 850; text-transform: uppercase; }
.budget-section-head h2 { margin-top: 2px; font-size: 1.05rem; }
.cashflow-inline { min-width: 0; flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.cashflow-inline span { color: var(--ink-faint); font-size: .66rem; font-weight: 750; }
.cashflow-inline b { display: block; margin-top: 2px; color: var(--ink); font-size: .76rem; }
.budget-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.budget-card { min-width: 0; padding: 13px; border: 1px solid var(--line); border-top: 4px solid var(--ok); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow-sm); }
.budget-card.warning { border-top-color: var(--accent); }
.budget-card.over { border-top-color: var(--danger); }
.budget-card.inactive { opacity: .6; }
.budget-head { display: flex; align-items: center; gap: 8px; }
.budget-head > span { width: 32px; height: 32px; display: grid; place-items: center; flex: none; border-radius: 7px; background: #f2f4f9; }
.budget-head > div { min-width: 0; flex: 1; }
.budget-head h3 { font-size: .82rem; }
.budget-head small { display: block; margin-top: 1px; color: var(--ink-faint); font-size: .59rem; font-weight: 850; text-transform: uppercase; }
.budget-head .icon-btn { width: 30px; height: 30px; box-shadow: none; background: #f2f4f9; }
.budget-head .i { width: 13px; height: 13px; }
.budget-values { display: flex; align-items: baseline; gap: 5px; margin-top: 11px; }
.budget-values b { font-size: 1rem; }
.budget-values span { color: var(--ink-faint); font-size: .68rem; font-weight: 700; }
.budget-values strong { margin-left: auto; font-size: .72rem; }
.budget-card.over .budget-values strong { color: var(--danger); }
.budget-progress { height: 6px; margin-top: 6px; overflow: hidden; border-radius: 3px; background: #e8ebf2; }
.budget-progress span { display: block; height: 100%; border-radius: 3px; background: var(--ok); }
.budget-card.warning .budget-progress span { background: var(--accent); }
.budget-card.over .budget-progress span { background: var(--danger); }
.budget-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; color: var(--ink-faint); font-size: .62rem; font-weight: 700; }
.budget-card.over .budget-foot span:first-child { color: var(--danger); }
.budget-empty { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1px dashed var(--line); border-radius: 8px; color: var(--ink-faint); }
.budget-empty .i { width: 30px; height: 30px; color: var(--brand); }
.budget-empty b { color: var(--ink); }
.budget-empty span { font-size: .68rem; font-weight: 650; }

.fin-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.fin-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.tx-card { padding: 16px; }
.tx-card h3, .subs-card h3, .cat-card h3, .arrears-card h3 { font-size: 0.98rem; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.tx-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.tx-card-head h3 { min-width: 210px; flex: 1; margin-bottom: 0; }
.tx-filter {
  width: min(230px, 100%); min-height: 36px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #f8f9fd;
  font-size: .78rem; font-weight: 650;
}
.tx-filter:focus { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 16%, transparent); }
.tx-history {
  max-height: min(620px, 62vh); overflow-y: auto; overscroll-behavior: contain;
  padding-right: 4px; scrollbar-gutter: stable; scrollbar-width: thin;
}
.tx-history .tx-group:first-child .tx-day { margin-top: 6px; }
.tx-filter-empty { padding: 24px 8px; }
.tx-day { font-size: 0.74rem; font-weight: 800; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.5px; margin: 12px 0 4px; }
.tx-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-radius: 10px; transition: opacity .18s ease, transform .18s ease; }
.tx-row.removing { opacity: 0; transform: translateX(10px); pointer-events: none; }
.tx-row:hover { background: #f7f8fd; }
.tx-row .tic {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
  background: #f1f3fb;
}
.tx-row .tmain { flex: 1; min-width: 0; }
.tx-row .tt { font-weight: 700; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-row .tm { font-size: 0.74rem; color: var(--ink-faint); }
.tx-row .tamt { font-weight: 800; font-size: 0.92rem; white-space: nowrap; }
.tx-row .tamt.inc { color: #0f9d7a; }
.tx-row .tamt.exp { color: var(--ink); }
.tx-row .lx { opacity: 0; display: inline-flex; color: var(--ink-faint); }
.tx-row:hover .lx { opacity: 1; }
.tx-row .lx:hover { color: var(--danger); }
.sub-badge { font-size: 0.64rem; font-weight: 800; background: #fff4e0; color: #b26a00; border-radius: 5px; padding: 1px 6px; margin-left: 6px; vertical-align: 1px; }

.cat-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.cat-row .cn { width: 105px; flex: none; font-size: 0.8rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-row .cbar { flex: 1; height: 9px; border-radius: 5px; background: var(--line); overflow: hidden; }
.cat-row .cbar span { display: block; height: 100%; border-radius: 5px; background: var(--brand); }
.cat-row .cv { font-size: 0.78rem; font-weight: 800; color: var(--ink-soft); white-space: nowrap; }

.subs-card { padding: 16px; }
.sub-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.sub-row:first-of-type { border-top: none; }
.sub-row.inactive { opacity: 0.5; }
.sub-row .sic {
  width: 34px; height: 34px; border-radius: 10px; flex: none; background: #fff4e0; color: #b26a00;
  display: flex; align-items: center; justify-content: center;
}
.sub-row .sic .i { width: 17px; height: 17px; }
.sub-row .smain { flex: 1; min-width: 130px; }
.sub-row .sn { font-weight: 700; font-size: 0.9rem; }
.sub-row .sd { font-size: 0.74rem; color: var(--ink-faint); }
.sub-row .samt { font-weight: 800; font-size: 0.9rem; }
.sub-payment-status { font-weight: 850; text-transform: capitalize; }
.sub-payment-status.paid { color: var(--ok); }
.sub-payment-status.missed { color: var(--danger); }
.sub-payment-status.arranged { color: #976100; }
.sub-missed-btn { padding: 5px 8px; font-size: .7rem; }
.sub-missed-btn:disabled { opacity: .4; cursor: default; }
.arrears-card { padding: 16px; }
.arrears-card h3 { color: #a9343a; }
.arrears-card h3 > span { min-width: 24px; height: 24px; display: grid; place-items: center; margin-left: auto; border-radius: 7px; color: #a9343a; background: #fde8e8; font-size: .7rem; }
.arrear-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.arrear-row:first-of-type { border-top: 0; }
.arrear-flag { width: 32px; height: 32px; display: grid; place-items: center; flex: none; border-radius: 8px; color: var(--danger); background: #fde8e8; }
.arrear-flag .i { width: 16px; height: 16px; }
.arrear-row.arranged .arrear-flag { color: #976100; background: #fff2d5; }
.arrear-main { min-width: 130px; flex: 1; }
.arrear-main b, .arrear-main small { display: block; }
.arrear-main b { font-size: .82rem; }
.arrear-main small { margin-top: 2px; color: var(--ink-faint); font-size: .68rem; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.arrear-amount { font-size: .82rem; font-weight: 850; }
.arrear-row .btn { padding: 5px 8px; font-size: .68rem; }
.arrear-explain { margin: 0; padding: 10px 12px; border-left: 4px solid var(--danger); color: #833238; background: #fff5f4; font-size: .76rem; font-weight: 650; line-height: 1.45; }
.arrear-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border-radius: 8px; background: #f4f6fb; }
.arrear-summary span { color: var(--ink-soft); font-size: .78rem; font-weight: 700; }
.arrear-summary b { font-size: 1rem; }

/* Savings goals stay separate from transaction totals */
.savings-section { padding: 2px 0; }
.savings-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.savings-head > div { min-width: 0; flex: 1; }
.savings-head span { display: block; margin-bottom: 2px; color: var(--ink-faint); font-size: .68rem; font-weight: 850; text-transform: uppercase; }
.savings-head h2 { font-size: 1.05rem; }
.savings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.savings-goal { min-width: 0; padding: 15px; border: 1px solid var(--line); border-top: 4px solid var(--goal-color); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow-sm); }
.savings-goal.complete { background: #f5fbf9; }
.goal-head { display: flex; align-items: flex-start; gap: 10px; }
.goal-head > div { min-width: 0; flex: 1; }
.goal-head h3 { font-size: .94rem; overflow-wrap: anywhere; }
.goal-head p { margin: 3px 0 0; color: var(--ink-faint); font-size: .7rem; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.goal-icon { width: 36px; height: 36px; display: grid; place-items: center; flex: none; border-radius: 8px; color: var(--goal-color); background: color-mix(in srgb, var(--goal-color) 13%, #fff); }
.goal-icon .i { width: 19px; height: 19px; }
.goal-head .icon-btn { width: 30px; height: 30px; box-shadow: none; background: #f4f6fb; }
.goal-head .icon-btn .i { width: 14px; height: 14px; }
.goal-amounts { display: flex; align-items: baseline; gap: 6px; margin-top: 14px; }
.goal-amounts b { font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.goal-amounts span { min-width: 0; flex: 1; color: var(--ink-faint); font-size: .72rem; font-weight: 700; }
.goal-amounts strong { color: var(--goal-color); font-size: .78rem; }
.goal-progress { height: 10px; margin-top: 7px; overflow: hidden; border-radius: 5px; background: #e8ebf3; }
.goal-progress span { display: block; height: 100%; border-radius: inherit; background: var(--goal-color); transition: width .35s ease; }
.goal-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; color: var(--ink-faint); font-size: .67rem; font-weight: 700; }
.goal-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.goal-history { min-width: 145px; flex: 1; }
.goal-history summary { color: var(--ink-soft); font-size: .7rem; font-weight: 800; cursor: pointer; }
.goal-history-list { display: flex; flex-direction: column; gap: 4px; margin-top: 7px; }
.goal-contribution { display: flex; align-items: center; gap: 6px; padding: 6px 7px; border-radius: 7px; background: #f5f7fb; }
.goal-contribution > span { min-width: 0; flex: 1; }
.goal-contribution b, .goal-contribution small { display: block; }
.goal-contribution b { color: #087668; font-size: .74rem; }
.goal-contribution small { margin-top: 1px; color: var(--ink-faint); font-size: .62rem; font-weight: 650; overflow-wrap: anywhere; }
.goal-contribution button { width: 26px; height: 26px; display: grid; place-items: center; flex: none; color: var(--ink-faint); }
.goal-contribution button:hover { color: var(--danger); }
.goal-contribution .i { width: 12px; height: 12px; }
.goal-no-history { color: var(--ink-faint); font-size: .68rem; font-weight: 650; }
.savings-empty { min-height: 150px; grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 18px; border: 1px dashed #cdd3e2; border-radius: 8px; color: var(--ink-faint); background: #f9fafe; text-align: center; }
.savings-empty:hover { border-color: var(--brand); color: var(--brand); }
.savings-empty .i { width: 28px; height: 28px; }
.savings-empty b { color: var(--ink); font-size: .88rem; }
.savings-empty span { max-width: 420px; font-size: .72rem; font-weight: 650; line-height: 1.4; }
.goal-form-note { margin: 0; padding: 9px 11px; border-left: 4px solid var(--ok); color: #27685f; background: #eff9f6; font-size: .72rem; font-weight: 650; line-height: 1.4; }
.goal-contribution-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px; border-radius: 8px; background: #f3f6fb; }
.goal-contribution-summary span { color: var(--ink-soft); font-size: .74rem; font-weight: 700; }
.goal-contribution-summary b { font-size: .86rem; text-align: right; }

/* ============ Assistant ============ */
.chat-wrap { display: grid; grid-template-columns: 280px 1fr; gap: 16px; height: 100%; min-height: 0; }
.chat-side {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 12px; overflow-y: auto; overflow-x: hidden;
}
.chat-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; text-align: left;
  background: #f7f8fd; border: 1.5px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color 0.15s, background 0.15s; width: 100%; min-width: 0;
}
.chat-item:hover { border-color: var(--line); background: #f1f3fb; }
.chat-item.sel { border-color: var(--brand); background: #eef2ff; }
.chat-item .cmain { flex: 1; min-width: 0; overflow: hidden; }
.chat-item .ctitle { display: block; font-weight: 700; font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .clast { display: block; font-size: 0.73rem; color: var(--ink-faint); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .cx { opacity: 0; color: var(--ink-faint); display: inline-flex; flex: none; }
.chat-item:hover .cx { opacity: 1; }
.chat-item .cx:hover { color: var(--danger); }

.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-head .ct { flex: 1; font-weight: 800; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .who { font-size: 0.75rem; color: var(--ink-faint); font-weight: 600; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bubble-row { display: flex; gap: 10px; align-items: flex-end; }
.bubble-row.me { flex-direction: row-reverse; }
.bubble {
  max-width: 74%; padding: 10px 14px; border-radius: 16px; font-size: 0.92rem; line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.bubble-row.me .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.bubble-row.bot .bubble { background: #f1f3fb; color: var(--ink); border-bottom-left-radius: 5px; }
.bot-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #4a7cff, #9b6bff); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.bot-avatar .i { width: 18px; height: 18px; }
.action-chips { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.action-chip {
  font-size: 0.78rem; font-weight: 700; border-radius: 9px; padding: 5px 10px;
  background: #e2f6f0; color: #0f7a60; cursor: pointer; text-align: left;
}
.action-chip.err { background: #fdeceb; color: var(--danger); cursor: default; }
.bubble-time { font-size: 0.66rem; color: var(--ink-faint); margin-top: 4px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.chat-input { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.chat-input input {
  flex: 1; border: 1.5px solid var(--line); border-radius: 999px; padding: 10px 18px;
  background: #fafbff; outline: none; font-size: 0.92rem;
}
.chat-input input:focus { border-color: var(--brand); }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink-faint); gap: 8px; padding: 24px; text-align: center; }
.chat-hints { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.chat-hint { background: #eef2ff; color: #3d5fc4; font-weight: 700; font-size: 0.8rem; padding: 7px 13px; border-radius: 999px; }
.chat-hint:hover { background: #dde5ff; }

/* ============ Mic / voice ============ */
.mic-btn { position: relative; }
.mic-btn.rec { color: #fff !important; background: var(--danger) !important; }
.mic-btn.rec::after {
  content: ""; position: absolute; inset: -4px; border-radius: inherit;
  border: 2px solid var(--danger); animation: micpulse 1.2s ease-out infinite;
}
@keyframes micpulse { from { opacity: 0.8; transform: scale(1); } to { opacity: 0; transform: scale(1.35); } }

/* ============ Wake-word overlay ============ */
.wake-overlay {
  position: fixed; right: 22px; bottom: 22px; z-index: 250; width: min(360px, calc(100vw - 32px));
}
.wake-card {
  background: var(--panel); border-radius: 18px; box-shadow: 0 14px 44px rgba(23, 27, 52, 0.28);
  padding: 14px 16px; animation: pop 0.2s ease-out;
}
.wake-head { display: flex; align-items: center; gap: 10px; }
.wake-titles { flex: 1; min-width: 0; }
.wake-name { font-weight: 800; font-size: 0.95rem; }
.wake-state { font-size: 0.76rem; color: var(--ink-faint); font-weight: 700; }
.wake-state.listening { color: var(--danger); }
.wake-state.speaking { color: var(--brand); }
.wake-pulse { position: relative; }
.wake-pulse.on::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2.5px solid var(--brand); animation: micpulse 1.3s ease-out infinite;
}
.wake-lines { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; max-height: 40vh; overflow-y: auto; }
.wake-lines:empty { display: none; }
.wake-line { font-size: 0.86rem; line-height: 1.4; padding: 7px 11px; border-radius: 11px; overflow-wrap: anywhere; }
.wake-line.you { background: var(--brand); color: #fff; align-self: flex-end; max-width: 88%; border-bottom-right-radius: 4px; }
.wake-line.bot { background: #f1f3fb; align-self: flex-start; max-width: 92%; border-bottom-left-radius: 4px; }
.wake-line.act { background: #e2f6f0; color: #0f7a60; font-weight: 700; font-size: 0.78rem; align-self: flex-start; }

/* Sidebar wake indicator */
.wake-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 700; color: #8f97c6; }
.wake-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #566; }
.wake-dot.on { color: #7fe0c8; }
.wake-dot.on::before { background: #2bd4a8; box-shadow: 0 0 8px #2bd4a8; animation: blink 2.2s infinite; }

/* ============ Kiosk mode ============ */
body.kiosk { font-size: 17.5px; }
body.kiosk .nav-btn { padding: 13px 12px; }
body.kiosk .ss-hint { display: none; }
body.kiosk #topbar { padding-top: 20px; }

@media (max-width: 1080px) {
  .receipt-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .receipt-total { grid-column: span 2; }
  .receipt-row { grid-template-columns: 42px minmax(0, 1fr) minmax(0, 1fr) 34px; align-items: end; }
  .receipt-stock-wrap { grid-column: 1; }
  .receipt-item-field { grid-column: 2 / 4; }
  .receipt-remove { grid-column: 4; }
  .receipt-row > .f-field:not(.receipt-item-field) { grid-column: span 2; }
  .fin-grid { grid-template-columns: 1fr; }
  .chat-wrap { grid-template-columns: 1fr; grid-template-rows: auto minmax(280px, 1fr); }
  .chat-side { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 10px; }
  .chat-side .btn { flex: none; }
  .chat-item { min-width: 210px; width: auto; flex: none; }
  .bubble { max-width: 86%; }
  .day-wrap, .rewards-wrap { grid-template-columns: 1fr; }
  .day-wrap { height: auto; }
  .day-col, .day-side { overflow: visible; }
  .meals-grid { grid-template-columns: 64px repeat(7, minmax(104px, 1fr)); overflow-x: auto; padding-bottom: 6px; font-size: 0.9rem; }
}

/* ============ Desktop: collapsible sidebar rail ============ */
@media (min-width: 861px) {
  body.side-collapsed #sidebar { width: 76px; padding-left: 10px; padding-right: 10px; }
  body.side-collapsed :is(.brand-name, .nav-btn > span, .nav-list-head > span, .nav-order-label) { max-width: 0; opacity: 0; }
  body.side-collapsed .nav-list-head { justify-content: center; padding: 0; }
  body.side-collapsed .brand { justify-content: center; padding: 0; }
  body.side-collapsed .nav-btn { justify-content: center; gap: 0; padding-left: 0; padding-right: 0; }
  body.side-collapsed .nav-btn > :is(.nav-lock, .lock-badge) { display: none !important; }
  body.side-collapsed .side-toggle .i { transform: rotate(180deg); }
  /* Rail keeps a compact clock, date and weather visible */
  body.side-collapsed .clock { text-align: center; padding: 0; }
  body.side-collapsed .clock-time { font-size: 1.05rem; }
  body.side-collapsed .clock-date { font-size: 0.6rem; margin-top: 2px; letter-spacing: 0.2px; }
  body.side-collapsed .side-weather {
    flex-direction: column; align-items: center; text-align: center;
    gap: 2px; margin-top: 8px; font-size: 0.78rem;
  }
  body.side-collapsed .side-weather .i { width: 18px; height: 18px; }
  body.side-collapsed .side-weather > span { min-width: 0; max-width: 100%; }
  body.side-collapsed .side-weather .wloc {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  /* Wake-word status survives as a bare glowing dot */
  body.side-collapsed .side-wake { font-size: 0; gap: 0; justify-content: center; }
  body.side-collapsed .sidebar-tools { grid-template-columns: 1fr; }
  body.side-collapsed .sidebar-tool { justify-content: center; padding: 0; }
  body.side-collapsed .sidebar-tool > span:not(.tool-badge) { display: none; }
  .family-name, .member-strip, .lock-badge { transition: opacity 0.18s ease; }
  body.side-collapsed :is(.family-name, .member-strip, .lock-badge) {
    opacity: 0; visibility: hidden;
  }
}

/* ============ Mobile: burger + slide-in drawer ============ */
@media (max-width: 860px) {
  #sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 210;
    width: min(300px, 85vw);
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  body.side-open #sidebar { transform: translateX(0); box-shadow: 20px 0 60px rgba(10, 14, 40, 0.45); }
  .side-toggle { display: none; }
  .icon-btn.burger { display: inline-flex; }

  /* Layout & type */
  #topbar { padding: 12px 14px 8px; gap: 10px; justify-content: center; }
  #viewTitle { font-size: 1.2rem; text-align: center; }
  .topbar-left { width: 100%; min-height: 40px; justify-content: center; gap: 10px; padding: 0 46px; position: relative; }
  .topbar-left .burger { position: absolute; left: 0; top: 0; }
  .period-nav { flex: 1 1 100%; justify-content: center; }
  .topbar-right { width: 100%; justify-content: center; gap: 8px; }
  #calModes { flex: 1 1 100%; justify-content: center; }
  .member-filter { justify-content: center; }
  #viewRoot { padding: 4px 14px 20px; }
  .quick-add { margin: 0 14px 10px; }
  .quick-add input { min-width: 0; }
  .period-label { white-space: normal; font-size: 0.85rem; }

  /* Bigger, zoom-proof inputs & touch targets */
  input, select, textarea { font-size: 16px; }
  .seg button { padding: 7px 11px; }
  .btn { min-height: 40px; justify-content: center; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .photo-toolbar { justify-content: center; }
  .settings-wrap { width: 100%; }
  .settings-wrap .form-row > :is(input, select) { min-width: 0; flex: 1 1 180px; }

  /* Week view -> agenda list (day header left, events right) */
  .week-wrap { display: flex; flex-direction: column; gap: 10px; height: auto; max-width: 640px; }
  .wcol { flex-direction: row; gap: 10px; }
  .wcol-head { width: 62px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 4px; }
  .wcol-body { flex: 1; min-width: 0; overflow: visible; }

  /* Chores strip */
  .chore-week-strip { gap: 5px; }
  .cws-day { padding: 8px 2px; }

  /* Finance */
  .finance-account { min-width: 165px; flex-basis: 165px; }
  .fin-cards { grid-template-columns: repeat(2, 1fr); }
  .fin-card { padding: 12px; }
  .fin-card .fv { font-size: 1.05rem; }
  .budget-section-head { align-items: flex-start; flex-wrap: wrap; }
  .cashflow-inline { order: 3; flex: 1 1 100%; justify-content: flex-start; }

  /* Meals */
  .meals-grid { grid-template-columns: 56px repeat(7, minmax(96px, 1fr)); }

  /* Modal -> bottom sheet */
  .modal-wrap { padding: 10px; align-items: flex-end; }
  .modal { max-height: 94vh; max-height: 94dvh; border-radius: 16px; width: 100%; }

  /* Chat / assistant */
  .chat-input { padding: 10px; gap: 6px; }
  .chat-scroll { padding: 12px; }
  .wake-overlay { right: 10px; bottom: 10px; }

  /* Settings & forms */
  .settings-wrap .form-row label { min-width: 90px; font-size: 0.82rem; }
  .who-picker, .day-picker { gap: 6px; }
  .emp-head .btn { flex: 1 1 auto; justify-content: center; }
  .document-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============ Small phones ============ */
@media (max-width: 700px) {
  .receipt-source { grid-template-columns: 1fr; }
  .receipt-source button { min-height: 98px; display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 10px; text-align: left; }
  .receipt-source button > span { grid-row: 1 / 3; margin: 0; }
  .receipt-source button small { max-width: none; }
  .receipt-meta { grid-template-columns: 1fr 1fr; }
  .receipt-total { grid-column: 1 / -1; }
  .receipt-preview-actions .spacer { display: none; }
  .receipt-preview-actions .btn { flex: 1 1 calc(50% - 4px); }
  /* Month view: events become colored dots */
  .month-wrap { height: auto; }
  .month-grid { grid-auto-rows: minmax(52px, auto); }
  .mcell { min-height: 52px; padding: 4px; gap: 2px; }
  .mcell .dnum { width: 20px; height: 20px; font-size: 0.72rem; }
  .mcell .pills { flex-direction: row; flex-wrap: wrap; gap: 3px; align-content: flex-start; }
  .pill { width: 8px; height: 8px; padding: 0; border-radius: 50%; font-size: 0; flex: none; }
  .pill.more { width: auto; height: auto; min-height: 8px; padding: 0 4px; border-radius: 6px; font-size: 0.58rem; line-height: 1.4; }

  .day-evt { padding: 12px; gap: 10px; }
  .day-evt .time-block { width: 64px; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

@media (max-width: 560px) {
  .meal-usage-head { align-items: flex-start; }
  .meal-usage-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px; }
  .meal-usage-row .f-field:first-child { grid-column: 1 / -1; }
  .receipt-meta { grid-template-columns: 1fr; }
  .receipt-total { grid-column: auto; }
  .receipt-row { grid-template-columns: 36px minmax(0, 1fr) 34px; padding: 8px; }
  .receipt-stock-wrap { grid-column: 1; }
  .receipt-item-field { grid-column: 2; }
  .receipt-remove { grid-column: 3; }
  .receipt-row > .f-field:not(.receipt-item-field) { grid-column: 1 / -1; }
  .receipt-save-note { width: 100%; }
  .dashboard-brief { align-items: flex-start; flex-wrap: wrap; }
  .dashboard-brief > .btn { width: 100%; }
  .dash-stat { min-height: 82px; padding: 12px; gap: 9px; }
  .dash-stat-icon { width: 36px; height: 36px; }
  .dash-stat b { font-size: 1.12rem; }
  .dash-stat small { font-size: .66rem; }
  .f-2col, .f-3col { grid-template-columns: 1fr; }
  .fin-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .budget-grid { grid-template-columns: 1fr; }
  .budget-section-head > .btn { margin-left: auto; }
  .cashflow-inline { flex-wrap: wrap; gap: 8px 14px; }
  .lists-wrap, .pets-wrap, .recipes-wrap, .chore-board, .emp-lists { grid-template-columns: 1fr; }
  .reward-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .spacer { display: none; }
  .modal-actions > .btn { flex: 1 1 calc(50% - 6px); min-height: 42px; }
  .period-nav { flex-wrap: wrap; }
  .period-nav .period-label { flex: 1 1 100%; margin-left: 0; text-align: center; }
  .topbar-right > .seg { max-width: 100%; }
  .savings-head, .member-wishlist-head { flex-wrap: wrap; }
  .savings-head .btn, .member-wishlist-head .btn { flex: 1 1 100%; }
  .savings-grid, .wish-grid { grid-template-columns: 1fr; }
  .goal-meta { flex-direction: column; gap: 2px; }
  .goal-contribution-summary { align-items: flex-start; flex-direction: column; }
  .wish-image { height: min(52vw, 210px); }
  .wish-actions .btn { flex: 1 1 auto; min-height: 38px; }
  .wish-current-image { align-items: flex-start; flex-direction: column; }
  .shop-add { flex-wrap: wrap; }
  .shop-add input.item { flex-basis: calc(100% - 82px); }
  .rd-actions .btn { flex: 1 1 auto; justify-content: center; }
  .nutrition-inputs, .nutrition-grid { grid-template-columns: 1fr 1fr; }
  .serving-scale { flex-wrap: wrap; }
  .serving-scale > span { flex-basis: 100%; }
  .supply-toolbar { align-items: stretch; flex-direction: column; }
  .supply-toolbar .btn { width: 100%; }
  .barcode-actions { flex-direction: column; }
  .movement-row { grid-template-columns: 76px minmax(0, 1fr); }
  .member-rights { grid-template-columns: 1fr; }
  .asset-summary { grid-template-columns: 1fr 1fr; }
  .asset-summary > div:first-child { grid-column: 1 / -1; }
  .asset-grid { grid-template-columns: 1fr; }
  .asset-detail-head { grid-template-columns: 42px minmax(0, 1fr); }
  .asset-detail-head > .btn { grid-column: 1 / -1; }
  .asset-facts { grid-template-columns: 1fr 1fr; }
  .pet-health-hero { grid-template-columns: 42px minmax(0, 1fr); }
  .pet-health-hero > .btn { grid-column: 1 / -1; }
  .pet-health-stats, .pet-health-grid { grid-template-columns: 1fr 1fr; }
  .member-profile-box, .member-permissions { grid-template-columns: 1fr; }
  .roommate-settings-head { align-items: stretch; flex-direction: column; }
  .roommate-settings-head .btn { width: 100%; }
  .pwa-install-card { grid-template-columns: 48px minmax(0, 1fr); }
  .pwa-install-card .btn { grid-column: 1 / -1; width: 100%; min-height: 44px; }
  .document-summary { grid-template-columns: 1fr 1fr; }
  .document-summary > label { grid-column: 1 / -1; }
  .document-card { grid-template-columns: 40px minmax(0, 1fr); align-items: start; }
  .document-icon { width: 38px; height: 38px; }
  .document-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .document-actions .icon-btn { width: 40px; height: 40px; }
  .oversight-card { grid-template-columns: minmax(0, 1fr) auto; }
  .oversight-card > .btn { grid-column: 1 / -1; }
  .weekly-settings-card > label { grid-column: 1 / -1; }
  .weekly-stats, .weekly-columns { grid-template-columns: 1fr 1fr; }
  .weekly-money { grid-template-columns: 1fr; }
  .history-row { grid-template-columns: 36px minmax(0, 1fr); }
  .history-row > :is(button, em) { grid-column: 1 / -1; justify-self: end; }
}

/* ============ Touch devices: keep hover-revealed actions visible ============ */
@media (hover: none) {
  .list-item .lx, .tx-row .lx, .photo-tile .pdel, .reward-card .rx, .chat-item .cx { opacity: 1; }
  .list-item { padding: 9px 2px; }
}
