/* Shell, header, tab bar, floating list bar, sheets, snackbar, push banner, buttons, rows, chips. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 22px; -webkit-font-smoothing: antialiased; }
#app { min-height: 100%; display: flex; justify-content: center; background: #e9ebe6; }
#phone { position: relative; width: 100%; max-width: 430px; height: 100dvh; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
@media (min-width: 480px) { #phone { box-shadow: 0 0 0 1px rgba(0,0,0,0.05), 0 30px 80px rgba(0,0,0,0.16); } }
.screen { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: var(--s6); position: relative; }
.screen.dark { background: #0d1210; color: #fff; }
body.has-listbar .screen { padding-bottom: 88px; }
.content { padding: var(--s1) var(--s4) var(--s6); }
a { color: var(--primary); text-decoration: none; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 700; }
h1 { font-size: 22px; line-height: 28px; letter-spacing: -0.01em; }
h2 { font-size: 17px; line-height: 22px; }
h3 { font-size: 15px; line-height: 20px; margin-top: var(--s3); }
p { margin: var(--s2) 0; }
ul { padding-left: 20px; margin: 6px 0; }
code { font-size: 12px; background: #eef1ec; padding: 2px 6px; border-radius: 6px; }
small { display: block; font-size: 13px; line-height: 18px; color: var(--ink-3); }
.fine { font-size: 12px; line-height: 16px; color: var(--ink-3); margin-top: var(--s5); }
.hint { font-size: 13px; line-height: 18px; color: var(--ink-3); margin: var(--s1) 0 var(--s3); }
.hint.center { text-align: center; }
.lead { font-size: 16px; color: var(--ink-2); margin: var(--s2) 0 var(--s4); }
.section { font-size: 13px; line-height: 18px; text-transform: uppercase; letter-spacing: var(--track-caps); color: var(--ink-3); margin: var(--s6) 0 var(--s2); font-weight: 700; }
.section .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.ic { width: 24px; height: 24px; flex: none; display: inline-block; vertical-align: middle; }
.ic.sm { width: 18px; height: 18px; } .ic.xs { width: 14px; height: 14px; } .ic.lg { width: 28px; height: 28px; }

/* Header */
.hdr { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s2) var(--s2); background: rgba(244,245,241,0.86); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); }
.hdr-title { flex: 1; font-size: 17px; line-height: 22px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-spacer { width: var(--tap); flex: none; }
.hdr.overlay { position: absolute; left: 0; right: 0; background: transparent; backdrop-filter: none; }
.icon-btn { width: var(--tap); height: var(--tap); border: 0; background: none; font: inherit; color: var(--ink); border-radius: 50%; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; position: relative; flex: none; }
.icon-btn.on { color: var(--primary); }
.icon-btn.round { background: var(--card); box-shadow: var(--shadow-rest); }
.bell .dot, .unread-dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid var(--bg); }
.text-btn { border: 0; background: none; font: inherit; font-weight: 600; color: var(--primary); min-height: var(--tap); padding: 0 var(--s3); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 10px var(--s4); border-radius: var(--r1); border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-align: center; width: 100%; margin: 6px 0; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); box-shadow: 0 6px 16px rgba(22,122,69,0.25); }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--primary); box-shadow: none; }
.btn.big { min-height: 54px; font-size: 17px; border-radius: 16px; }
.btn.on { border-color: var(--primary); color: var(--primary); }
.btn.sm { min-height: 40px; padding: 6px 12px; font-size: 14px; width: auto; margin: 0; }
.action-row { display: flex; gap: var(--s2); margin: var(--s3) 0; }
.action-row .btn { flex: 1; margin: 0; padding: 10px 6px; font-size: 14px; }
.sticky-cta { position: sticky; bottom: 0; padding: var(--s2) 0 var(--s2); background: linear-gradient(transparent, var(--bg) 35%); z-index: 3; }
.stickybar { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; gap: var(--s3); margin: var(--s4) calc(var(--s4) * -1) 0; padding: var(--s3) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom)); background: rgba(255,255,255,0.94); backdrop-filter: blur(12px); border-top: var(--hairline); }
.stickybar .btn { margin: 0; flex: 1; }
.stickybar .price-big { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }

/* Tab bar */
#nav { display: flex; border-top: var(--hairline); background: rgba(255,255,255,0.96); backdrop-filter: blur(12px); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); position: relative; z-index: 6; }
#nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px; font-size: 11px; line-height: 14px; font-weight: 600; color: var(--ink-3); border-radius: 12px; }
#nav a .ic { width: 26px; height: 26px; }
#nav a.active { color: var(--primary); }
#nav a.scan-nav .ic { background: var(--primary); color: #fff; width: 48px; height: 48px; padding: 11px; border-radius: 50%; margin-top: -20px; box-shadow: 0 8px 18px rgba(22,122,69,0.38); border: 3px solid var(--card); box-sizing: content-box; }

/* Floating list bar */
#listbar { position: absolute; left: 14px; right: 14px; bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 7; display: flex; align-items: center; gap: var(--s3); min-height: 54px; padding: 8px 14px 8px 10px; border-radius: var(--r-pill); background: var(--ink); color: #fff; box-shadow: var(--shadow-raised); transform: translateY(120px); opacity: 0; transition: transform var(--t-sheet) var(--ease-spring), opacity var(--t-fast); pointer-events: none; }
#listbar.show { transform: none; opacity: 1; pointer-events: auto; }
#listbar b { font-size: 16px; } #listbar .listbar-sub { flex: 1; font-size: 13px; color: rgba(255,255,255,0.75); }
#listbar .listbar-count { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; }

/* Sheets */
#sheet-root { position: absolute; inset: 0; z-index: 20; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(13,18,16,0.42); opacity: 0; transition: opacity var(--t-sheet); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--card); border-radius: var(--r3) var(--r3) 0 0; padding: var(--s2) var(--s5) calc(var(--s6) + env(safe-area-inset-bottom)); max-height: 88%; overflow-y: auto; transform: translateY(100%); transition: transform var(--t-sheet) var(--ease-spring); box-shadow: 0 -12px 40px rgba(0,0,0,0.18); }
#sheet-root.open .sheet-backdrop { opacity: 1; } #sheet-root.open .sheet { transform: none; }
.sheet-grip { width: 36px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 4px auto 14px; }
.sheet h2 { font-size: 20px; line-height: 26px; margin-bottom: 6px; }

/* Snackbar */
#toast { position: absolute; left: 14px; right: 14px; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateY(20px); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: all var(--t-fast); z-index: 30; display: flex; align-items: center; gap: var(--s3); box-shadow: var(--shadow-raised); }
#toast.show { opacity: 1; transform: none; pointer-events: auto; }
#phone:has(.stickybar) #toast, body.has-listbar #toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
#toast span { flex: 1; }
.snack-btn { border: 0; background: none; color: var(--citrus); font: inherit; font-weight: 800; min-height: 32px; padding: 0 6px; cursor: pointer; letter-spacing: 0.02em; }

/* Push banner */
#push { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 25; display: flex; gap: var(--s3); align-items: center; background: var(--card); border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow-raised); transform: translateY(-130%); transition: transform var(--t-sheet) var(--ease-spring); cursor: pointer; }
#push.show { transform: none; }
.push-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--green-100); color: var(--green-900); display: flex; align-items: center; justify-content: center; flex: none; }
.push-text { min-width: 0; } .push-text b { display: block; font-size: 12px; letter-spacing: 0.04em; } .push-text span { display: block; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Notes, groups, rows, switches, chips */
.note { background: var(--card); border: var(--hairline); border-radius: 14px; padding: 12px 14px; margin: 10px 0; font-size: 14px; line-height: 20px; }
.note.warn { background: var(--warn-bg); border-color: #ffd9a8; color: var(--warn-ink); }
.note.ok { background: var(--ok-bg); border-color: #cfe9d8; color: var(--ok-ink); }
.draft-note { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--warn-ink); background: var(--warn-bg); border: 1px solid #ffd9a8; border-radius: 10px; padding: 8px 12px; margin: 12px 0; }
.group { background: var(--card); border-radius: var(--r2); overflow: hidden; box-shadow: var(--shadow-rest); margin: 6px 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 8px 16px; border-bottom: var(--hairline); cursor: pointer; }
.switch-row:last-child { border-bottom: 0; }
.switch-label { font-weight: 600; } .switch-hint { display: block; font-size: 12px; line-height: 16px; color: var(--ink-3); }
.switch-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch { flex: none; width: 50px; height: 30px; border-radius: 15px; background: #d6dad4; position: relative; transition: background var(--t-fast); }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.2); transition: transform var(--t-fast); }
.switch-row input:checked + .switch { background: var(--primary); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--primary); outline-offset: 2px; }
.row-btn, .row-static { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 16px; border: 0; border-bottom: var(--hairline); background: var(--card); font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.row-btn:last-child, .row-static:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; } .row-main b { display: block; font-size: 15px; line-height: 20px; } .row-main small { white-space: normal; }
.row-right { color: var(--ink-3); font-weight: 600; flex: none; display: inline-flex; align-items: center; }
.row-lead { width: 36px; height: 36px; border-radius: 10px; background: var(--card-2); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.plus-tag { font-size: 10px; line-height: 14px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; background: var(--citrus-100); color: var(--citrus-ink); padding: 3px 7px; border-radius: 999px; vertical-align: middle; }
.chips { display: flex; gap: var(--s2); overflow-x: auto; padding: var(--s1) 0 var(--s2); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex: none; min-height: 44px; padding: 8px 14px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--card); font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips.small .chip { font-size: 12px; min-height: 44px; padding: 6px 12px; }
.trust a, .fine a, .hint a { display: inline-block; padding: 8px 2px; margin: -8px 0; }
.chips.inset { padding: 0 16px 12px; margin-top: -4px; align-items: center; border-bottom: var(--hairline); }
.chip-label { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-right: 4px; white-space: nowrap; }
.chipbar { position: sticky; top: 56px; z-index: 4; background: var(--bg); margin: 0 calc(var(--s4) * -1); padding: 0 var(--s4); }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-3); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 60px auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.tabs { display: flex; margin: 0 16px 8px; background: #e6e9e3; border-radius: 12px; padding: 3px; }
.tabs a { flex: 1; text-align: center; min-height: 40px; line-height: 40px; border-radius: 10px; font-weight: 700; color: var(--ink-3); }
.tabs a.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-rest); }
.was { text-decoration: line-through; color: var(--ink-3); font-size: 13px; margin-left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
