/* Wishlist – stylesheet. Light & dark theme, mobile first adjustments at the bottom. */

:root {
  --bg: #faf6f1;
  --surface: #ffffff;
  --surface-2: #f5eee7;
  --text: #2a1f1d;
  --muted: #7a6a64;
  --border: #eadfd6;
  --primary: #b3263e;
  --primary-hover: #9a1e33;
  --primary-ink: #ffffff;
  --primary-soft: #fbe8eb;
  --mine: #1f6f5c;
  --mine-soft: #e2f3ee;
  --taken: #a39791;
  --warn-bg: #fff6dc;
  --warn-border: #efc75e;
  --info-bg: #e9f1fb;
  --info-border: #8fb3e3;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --danger-border: #e8a39b;
  --success-bg: #e6f5ec;
  --success-border: #8fcfa8;
  --shadow: 0 1px 2px rgba(60, 30, 20, .06), 0 4px 14px rgba(60, 30, 20, .06);
  --shadow-lg: 0 10px 40px rgba(40, 20, 10, .22);
  --radius: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-brand: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17120f;
    --surface: #221b18;
    --surface-2: #2b2320;
    --text: #f3ebe6;
    --muted: #b3a39b;
    --border: #3b302b;
    --primary: #e05a70;
    --primary-hover: #ea7488;
    --primary-ink: #1b0c10;
    --primary-soft: #3a1f25;
    --mine: #56b99e;
    --mine-soft: #1d3530;
    --taken: #7d716c;
    --warn-bg: #3a3014;
    --warn-border: #8a7027;
    --info-bg: #182a40;
    --info-border: #36577f;
    --danger: #f08072;
    --danger-bg: #3d1d1a;
    --danger-border: #7d3a33;
    --success-bg: #17332a;
    --success-border: #2f6b52;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.7rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
code { font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
  padding: .65em 1.05em; min-height: 42px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .wish:focus-visible, .bell-btn:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); background: var(--danger); }
.btn-mine { background: var(--mine); border-color: var(--mine); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger-text { color: var(--danger); }
.btn-sm { font-size: .85rem; padding: .45em .7em; min-height: 36px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: progress; }

/* ---------- Top bar & navigation ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: .55rem 1rem;
  display: flex; align-items: center; gap: 1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-brand); font-weight: 700; font-size: 1.3rem;
  color: var(--text); text-decoration: none;
}
.brand-icon { color: var(--primary); width: 1.35em; height: 1.35em; }
.mainnav { display: flex; gap: .25rem; margin-left: 1rem; flex: 1; }
.mainnav a {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem .8rem; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.mainnav a:hover { color: var(--text); background: var(--surface-2); }
.mainnav a.active { color: var(--primary); background: var(--primary-soft); }
.topbar-user { display: flex; align-items: center; gap: .4rem; margin-left: auto; }
.topbar-user .who { color: var(--muted); font-size: .9rem; font-weight: 600; }

/* ---------- Notification bars ---------- */
.notices { max-width: 1120px; margin: .75rem auto 0; padding: 0 1rem; display: grid; gap: .5rem; }
.bar {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .7rem .9rem; border-radius: var(--radius-sm); border: 1px solid;
  box-shadow: var(--shadow);
}
.bar-icon { width: 1.3em; height: 1.3em; }
.bar-text { flex: 1 1 260px; }
.bar-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.bar-warn { background: var(--warn-bg); border-color: var(--warn-border); }
.bar-info { background: var(--info-bg); border-color: var(--info-border); }
.bar-danger { background: var(--danger-bg); border-color: var(--danger-border); }
.bar-close {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
}
.bar-close:hover { background: rgba(0, 0, 0, .07); }

/* ---------- Layout ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-head p { max-width: 62ch; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 1.2rem 1.25rem; margin-bottom: 1.25rem; }
.panel h2 { display: flex; align-items: center; gap: .5rem; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.empty { text-align: center; padding: 2.5rem 1.25rem; }
.empty-icon { width: 48px; height: 48px; color: var(--primary); margin-bottom: .5rem; }
.count {
  display: inline-block; min-width: 1.6em; padding: 0 .45em; margin-left: .25em;
  font-size: .78rem; font-weight: 700; text-align: center; line-height: 1.6;
  border-radius: 999px; background: var(--surface-2); color: var(--muted);
}

/* ---------- Flash messages ---------- */
.flashes { display: grid; gap: .5rem; margin-bottom: 1rem; }
.flash { padding: .75rem .9rem; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: .75rem; }
.flashes .flash { margin-bottom: 0; }
.flash-success { background: var(--success-bg); border-color: var(--success-border); }
.flash-error { background: var(--danger-bg); border-color: var(--danger-border); }
.flash-warning { background: var(--warn-bg); border-color: var(--warn-border); }
.flash-info { background: var(--info-bg); border-color: var(--info-border); }
.copy-row { display: flex; gap: .4rem; margin-top: .5rem; }
.copy-input { flex: 1; min-width: 0; font-size: .85rem !important; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.1rem; }
.tabs a {
  padding: .6rem .9rem; color: var(--muted); text-decoration: none; font-weight: 600;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .3em;
  font-size: .8rem; font-weight: 600; padding: .2em .6em; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); text-decoration: none; white-space: nowrap;
}
.chip-link { color: var(--primary); }
.chip-link:hover { background: var(--primary-soft); }
.chip-warn { background: var(--warn-bg); color: inherit; }
.chip-admin { background: var(--primary-soft); color: var(--primary); }
.chip .icon { width: 1em; height: 1em; }

/* ---------- My wishes: item cards ---------- */
.item-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.item-card { display: flex; flex-direction: column; overflow: hidden; }
.item-card.is-archived .thumb { filter: grayscale(.6); opacity: .85; }
.thumb {
  aspect-ratio: 4 / 3; background: var(--surface-2);
  display: grid; place-items: center; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder { width: 46px; height: 46px; color: color-mix(in srgb, var(--primary) 45%, var(--muted)); opacity: .55; }
.item-body { padding: .85rem 1rem .4rem; flex: 1; }
.item-title { margin-bottom: .25rem; overflow-wrap: anywhere; }
.item-desc {
  color: var(--muted); font-size: .92rem; margin-bottom: .5rem; white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.item-meta { display: flex; flex-wrap: wrap; gap: .35rem; }
.item-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: .1rem; padding: .35rem .35rem .45rem; border-top: 1px solid var(--border); }
.is-archived .item-actions { grid-template-columns: repeat(2, 1fr); }
.item-actions .btn { padding-left: .3em; padding-right: .3em; }

/* ---------- Others' lists ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: .85rem; margin-bottom: .9rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-free { background: var(--primary); }
.dot-mine { background: var(--mine); }
.dot-taken { background: var(--taken); }
.people-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.person { padding: .9rem 1rem 1rem; scroll-margin-top: 80px; }
.person-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.person-name { display: flex; align-items: center; gap: .55rem; flex: 1; min-width: 0; flex-wrap: wrap; }
.person-name h2 { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700;
  background: var(--primary-soft); color: var(--primary);
}
.spent {
  font-size: .82rem; font-weight: 700; color: var(--mine);
  background: var(--mine-soft); padding: .15em .6em; border-radius: 999px; white-space: nowrap;
}
.bell-btn {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  display: grid; place-items: center; cursor: pointer;
}
.bell-btn:hover { background: var(--surface-2); }
.bell-btn.is-on { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.person-empty { margin: .25rem 0 0; font-size: .92rem; }
.wish-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.wish {
  width: 100%; display: flex; align-items: center; gap: .6rem; text-align: left;
  font: inherit; color: var(--text); cursor: pointer;
  padding: .6rem .75rem; min-height: 44px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  border-left: 4px solid var(--primary);
  transition: background .15s, border-color .15s;
}
.wish:hover { background: var(--surface-2); }
.wish-title { flex: 1; overflow-wrap: anywhere; }
.wish-tag { font-size: .75rem; font-weight: 700; padding: .1em .55em; border-radius: 999px; white-space: nowrap; }
.wish-mine { border-left-color: var(--mine); background: var(--mine-soft); }
.wish-mine .wish-tag { background: var(--mine); color: #fff; }
.wish-taken { border-left-color: var(--taken); color: var(--muted); background: var(--surface-2); }
.wish-taken .wish-title { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.wish-taken .wish-tag { background: var(--border); color: var(--muted); }

/* ---------- Modal dialogs ---------- */
.modal {
  width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(25, 12, 8, .5); backdrop-filter: blur(2px); }
.modal[open] { animation: modal-in .18s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal > form, .modal-inner { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.15rem .6rem;
}
.modal-head h2 { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.modal-kicker { margin: 0 0 .15rem; font-size: .8rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .04em; }
.modal-close {
  border: 0; background: var(--surface-2); color: var(--text); cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
}
.modal-body { padding: .3rem 1.15rem 1rem; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: .5rem;
  padding: .8rem 1.15rem; border-top: 1px solid var(--border); background: var(--surface);
  padding-bottom: calc(.8rem + var(--safe-bottom));
}
.modal-confirm { width: min(420px, calc(100% - 24px)); }
.modal-confirm .modal-body { padding-top: 1.2rem; }
.confirm-text { margin: 0; white-space: pre-line; }
.wish-image { border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); margin-bottom: .9rem; }
.wish-image img { width: 100%; max-height: 320px; object-fit: contain; }
.wish-desc { white-space: pre-line; overflow-wrap: anywhere; }
.wish-meta { margin-bottom: 1rem; }
.wish-action { border-top: 1px solid var(--border); padding-top: 1rem; }
.wish-action .state { display: flex; align-items: center; gap: .5rem; font-weight: 600; margin-bottom: .75rem; }
.wish-action .state-mine { color: var(--mine); }
.wish-action .state-taken { color: var(--muted); }
.wish-action .actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.inline-field { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.form .inline-field label { flex: 1 1 160px; margin: 0; }

/* ---------- Forms ---------- */
.form label, .form .field { display: block; margin-bottom: .9rem; font-weight: 600; font-size: .92rem; }
.form .field-label { display: block; margin-bottom: .35rem; }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=url],
.form textarea, .form select, input.copy-input, textarea.code {
  display: block; width: 100%; margin-top: .35rem;
  font: inherit; font-weight: 400; font-size: 1rem; color: var(--text);
  padding: .65rem .75rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg);
}
input.copy-input { margin-top: 0; }
.form textarea { resize: vertical; min-height: 80px; }
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.form small { display: block; font-weight: 400; color: var(--muted); margin-top: .3rem; font-size: .82rem; }
.form fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
.form legend { font-weight: 700; font-size: 1rem; margin-bottom: .6rem; padding: 0; }
.form .check { display: flex; align-items: center; gap: .6rem; font-weight: 500; cursor: pointer; }
.form .check input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; margin: 0; }
.req { color: var(--primary); }
.opt { color: var(--muted); font-weight: 400; font-size: .82rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9rem; }
.form-error { color: var(--danger); font-weight: 600; margin: .25rem 0 0; }
.image-field { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: .35rem; }
.image-preview { width: 84px; height: 84px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-btn { cursor: pointer; margin: 0 !important; font-weight: 600 !important; }
.form .remove-image { margin: 0; }
form.inline { display: inline; }
.test-mail { border-top: 1px solid var(--border); padding-top: 1rem; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 1rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.account-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.account-grid .panel { margin: 0; }

/* ---------- Admin ---------- */
.user-list { display: grid; }
.user-row {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
  padding: .8rem 0; border-top: 1px solid var(--border);
}
.user-row:first-child { border-top: 0; }
.user-main { display: flex; gap: .75rem; align-items: center; min-width: 0; flex: 1 1 280px; }
.user-name { font-weight: 700; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.user-sub { color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.user-actions { display: flex; flex-wrap: wrap; gap: .15rem; }
.status { font-weight: 700; }
.status-ok { color: var(--mine); }
.status-pending { color: #b07a00; }

/* ---------- Floating action button (mobile) ---------- */
.fab { display: none; }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 1.25rem; z-index: 100;
  display: grid; gap: .5rem; width: min(440px, calc(100% - 24px)); pointer-events: none;
}
.toast {
  background: #2a1f1d; color: #fff; padding: .75rem 1rem; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-weight: 500; animation: toast-in .2s ease-out;
}
.toast.toast-error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Auth & installer pages ---------- */
.layout-auth { min-height: 100dvh; background:
  radial-gradient(circle at 15% 10%, var(--primary-soft), transparent 45%),
  radial-gradient(circle at 85% 90%, var(--mine-soft), transparent 40%), var(--bg); }
.auth-wrap { max-width: 440px; margin: 0 auto; padding: 3rem 1rem 2rem; }
.auth-wrap .flashes { margin-top: 0; }
.auth-brand {
  display: flex; align-items: center; justify-content: center; gap: .55rem; margin-bottom: 1.25rem;
  font-family: var(--font-brand); font-weight: 700; font-size: 1.8rem;
}
.auth-brand .brand-icon { width: 1.4em; height: 1.4em; }
.auth-card { padding: 1.5rem 1.4rem; }
.auth-card h1 { font-size: 1.45rem; }
.auth-links { text-align: center; margin: 1rem 0 0; font-size: .92rem; }
.install-card { max-width: 560px; }
.layout-auth:has(.install-card) .auth-wrap { max-width: 600px; }
.checks { list-style: none; padding: 0; margin: 0 0 1.2rem; display: grid; gap: .2rem; font-size: .92rem; }
.checks .ok { color: var(--mine); }
.checks .nok { color: var(--danger); font-weight: 600; }
.credentials { display: grid; gap: .5rem; background: var(--surface-2); padding: .9rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.credentials div { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.credentials span { color: var(--muted); }
.credentials code { font-size: 1.05rem; font-weight: 700; background: var(--surface); }
.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: .35rem; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; margin-bottom: 1rem; }

/* ---------- Desktop only / mobile only ---------- */
@media (max-width: 760px) {
  body.layout-app { padding-bottom: calc(var(--nav-h) + var(--safe-bottom)); }
  /* No backdrop-filter here: it would trap the fixed bottom navigation inside the header. */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
  .topbar-inner { padding: .5rem .9rem; }
  .topbar-user .who, .install-btn span { display: none; }
  .mainnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0;
    height: calc(var(--nav-h) + var(--safe-bottom)); padding: 0 .25rem var(--safe-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, .06);
  }
  .mainnav a {
    flex: 1; flex-direction: column; justify-content: center; gap: .15rem;
    border-radius: 0; font-size: .72rem; padding: .3rem .2rem;
  }
  .mainnav a .icon { width: 1.45em; height: 1.45em; }
  .mainnav a.active { background: transparent; }
  .mainnav a:hover { background: transparent; }
  .container { padding: 1rem .85rem 5.5rem; }
  .notices { padding: 0 .85rem; }
  h1 { font-size: 1.45rem; }
  .page-head p { font-size: .92rem; }
  .hide-mobile { display: none !important; }
  .fab {
    display: grid; place-items: center; position: fixed; z-index: 35;
    right: 1rem; bottom: calc(var(--nav-h) + var(--safe-bottom) + 1rem);
    width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow-lg);
  }
  .fab .icon { width: 28px; height: 28px; }
  .item-grid { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .item-body { padding: .65rem .7rem .3rem; }
  .item-desc { -webkit-line-clamp: 2; font-size: .85rem; }
  .item-actions { padding: .25rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
  .item-actions .btn { flex-direction: column; font-size: .72rem; padding: .35em .2em; gap: .15em; min-height: 48px; }
  .item-actions .btn .icon { width: 1.35em; height: 1.35em; }
  .people-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .toast-wrap { bottom: calc(var(--nav-h) + var(--safe-bottom) + .75rem); }

  /* Dialogs become bottom sheets on phones */
  .modal {
    width: 100%; max-width: 100%; margin: auto 0 0; max-height: 92dvh;
    border-radius: 18px 18px 0 0;
  }
  .modal > form, .modal-inner { max-height: 92dvh; }
  .modal[open] { animation: sheet-in .22s ease-out; }
  .modal-confirm { margin: auto; border-radius: var(--radius); width: calc(100% - 32px); }
  @keyframes sheet-in { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
}

@media (max-width: 380px) {
  .item-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Standalone (installed PWA) tweaks */
@media (display-mode: standalone) {
  .install-btn, [data-install] { display: none !important; }
}
