/* Home: sizes and storage */
:root {
  --bg: #ECEEF2;
  --surface: #FFFFFF;
  --ink: #14181F;
  --ink-2: #3B4452;
  --ink-3: #4C5563;
  --ink-4: #6B7482;
  --line: #D9DDE4;
  --line-2: #C9CFDA;
  --dot: rgba(20, 24, 31, 0.08);
  --sizes: #0F766E;
  --storage: #2F6E93;
  --danger: #B4443A;
  --accent: var(--sizes);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink);
  font-family: 'Figtree', system-ui, -apple-system, sans-serif; font-size: 16px; line-height: 1.45;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.4px);
  background-size: 20px 20px;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code { background: #E1E4EA; padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

.screen { max-width: 560px; margin: 0 auto; min-height: 100dvh; }
.screen.center { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 16px; padding: 40px 28px; }
.mark { width: 64px; height: 64px; border-radius: 18px; background: var(--ink); display: grid; place-items: center; }
.big { margin: 8px 0 0; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 52px; line-height: 0.95; letter-spacing: -0.035em; }
.lead { margin: 0; color: var(--ink-2); font-size: 17px; }
.muted { margin: 0; color: var(--ink-3); }

/* login */
.login { display: flex; flex-direction: column; gap: 18px; padding: max(72px, env(safe-area-inset-top)) 28px calc(32px + env(safe-area-inset-bottom)); }
.login-actions { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.btn { min-height: 54px; border-radius: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 20px; }
.btn-light { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.btn-dark { border: 0; background: var(--ink); color: #FFFFFF; }
.btn-danger { border: 1px solid #E3B7B2; background: #FFFFFF; color: var(--danger); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.email-form { display: flex; flex-direction: column; gap: 10px; }
.note { margin: 6px 0 0; display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 14px; }
.err { margin: 0; min-height: 1em; color: var(--danger); font-size: 14px; }

/* app */
.app { position: relative; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; padding: max(18px, env(safe-area-inset-top)) 20px 10px; display: flex; flex-direction: column; gap: 12px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.kicker { margin: 0; font-weight: 600; color: var(--accent); font-size: 14px; }
.title { margin: 0; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 38px; line-height: 1; letter-spacing: -0.03em; }
.avatars { display: flex; align-items: center; border: 0; background: transparent; padding: 4px; min-height: 44px; }
.av { width: 34px; height: 34px; border-radius: 50%; color: #FFFFFF; display: grid; place-items: center; font-weight: 700; font-size: 14px; border: 2px solid var(--bg); position: relative; }
.av-e { background: #0F766E; }
.av-d { background: #B8336A; margin-left: -8px; }
.av-heart { position: absolute; right: -5px; bottom: -4px; }
.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; min-height: 48px; }
.search input { flex: 1; border: 0; outline: none; background: transparent; min-width: 0; font-size: 16px; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
input::placeholder { color: #8A93A1; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.pill { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }
.pill.on { background: var(--accent); color: #FFFFFF; border-color: var(--accent); }
.pill.on-dark { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.pill.add { background: transparent; border-style: dashed; border-color: #9AA2B1; }
.pill .n { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--ink-3); }
.pill.on-dark .n { background: rgba(255, 255, 255, 0.2); color: #FFFFFF; }
.heart { flex: none; }

.list-wrap { flex: 1; padding: 4px 20px calc(130px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.count { margin: 0 0 2px; font-size: 14px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.count button { border: 0; background: transparent; color: var(--accent); font-weight: 600; font-size: 14px; padding: 6px 2px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.card { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px; display: flex; gap: 14px; align-items: center; }
.card:active { background: #F6F7F9; }
.tile { flex: none; min-width: 64px; height: 64px; padding: 0 8px; border-radius: 14px; display: grid; place-items: center; text-align: center;
  font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; letter-spacing: -0.01em; font-size: 24px; line-height: 1.05; }
.tile.long { font-size: 15px; }
.card-main { flex: 1; min-width: 0; }
.card-title { margin: 0; font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.card-sub { margin: 0; color: var(--ink-3); font-size: 14px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.card-note { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; background: #F3F4F7; border-radius: 8px; padding: 4px 8px; display: inline-block; }
.card.item { flex-direction: column; align-items: stretch; gap: 6px; padding: 14px 16px; }
.item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.room { flex: none; background: #E4EEF5; color: #24587A; font-weight: 600; font-size: 13px; border-radius: 999px; padding: 3px 10px; }
.spot { margin: 0; display: flex; gap: 8px; align-items: flex-start; color: var(--ink-2); font-size: 15px; }
.spot svg { flex: none; margin-top: 3px; }
.when { margin: 0; color: var(--ink-4); font-size: 13px; }
.empty { margin: 24px 0; text-align: center; color: var(--ink-3); }
.offline { margin: 8px 0 0; font-size: 13px; color: var(--ink-3); text-align: center; }

.fab { position: fixed; right: max(20px, calc(50vw - 260px)); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 6; min-height: 52px; padding: 0 22px; border-radius: 16px; border: 0;
  background: var(--ink); color: #FFFFFF; font-weight: 700; display: flex; align-items: center; gap: 8px; box-shadow: 0 8px 20px rgba(20, 24, 31, 0.25); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: env(safe-area-inset-bottom); }
.tab { min-height: 64px; border: 0; background: transparent; font-size: 13px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink-4); }
.tab.on { color: var(--ink); }

/* bottom sheet */
.sheet-root { position: fixed; inset: 0; z-index: 20; background: rgba(20, 24, 31, 0.45); display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-backdrop { flex: 1; border: 0; background: transparent; }
.sheet { background: var(--surface); border-radius: 24px 24px 0 0; padding: 18px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px;
  max-height: 88dvh; overflow-y: auto; width: 100%; max-width: 560px; margin: 0 auto; animation: up 0.2s ease-out; }
@keyframes up { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { margin: 0; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 24px; }
.x { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--bg); font-size: 20px; line-height: 1; }
.label { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.wrap { display: flex; gap: 8px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input { min-height: 46px; border-radius: 12px; border: 1px solid var(--line-2); background: #FFFFFF; padding: 0 12px; font-size: 16px; font-weight: 400; color: var(--ink); width: 100%; }
.field input:focus { border-color: var(--accent); outline: none; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .btn { flex: 1; min-height: 52px; }
.btn-save { background: var(--accent); color: #FFFFFF; border: 0; }
.acct { margin: 0; color: var(--ink-2); }

.toast { position: fixed; left: 50%; bottom: calc(160px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); z-index: 15; background: var(--ink); color: #FFFFFF;
  padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; opacity: 0; transition: all 0.2s; pointer-events: none; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.card-title { display: block; }
.card-main > .card-sub { margin-top: 1px; }
.item .card-title { flex: 1; min-width: 0; }
.when { display: block; }
