/* ===== App shell ===== */
body { background: var(--soft); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); }
.sb-nav a { display: flex; align-items: center; gap: .75rem; height: 42px; padding: 0 .8rem; border-radius: 11px; font-size: .9rem; font-weight: 600; color: var(--ink-2); transition: background .15s, color .15s; position: relative; }
.sb-nav a svg { width: 19px; height: 19px; color: var(--faint); transition: color .15s; }
.sb-nav a:hover { background: var(--soft); color: var(--text); }
.sb-nav a:hover svg { color: var(--ink-2); }
.sb-nav a[aria-current="page"] { background: var(--brand-50); color: var(--text); font-weight: 700; }
.sb-nav a[aria-current="page"] svg { color: var(--brand-ink); }
.sb-nav a[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.sb-nav a.is-ai svg { color: var(--insight); }
.sb-nav a.is-ai[aria-current="page"] { background: var(--insight-50); }
.sb-nav a.is-ai[aria-current="page"]::before { background: var(--insight); }
.sb-section { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 1rem .8rem .4rem; }

.topbar { position: sticky; top: 0; z-index: 30; background: rgb(var(--c-soft) / .86); backdrop-filter: saturate(1.5) blur(14px); -webkit-backdrop-filter: saturate(1.5) blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s, background .2s; padding-top: env(safe-area-inset-top, 0px); }
.topbar.is-scrolled { border-bottom-color: var(--line); background: rgb(var(--c-surface) / .9); }

.app-main { width: 100%; max-width: 1360px; margin: 0 auto; padding: 1rem 1rem calc(var(--bottom-nav-h) + 2rem + var(--safe-b)); flex: 1; outline: none; }
@media (min-width: 640px) { .app-main { padding-left: 1.5rem; padding-right: 1.5rem; } }
@media (min-width: 1024px) { .app-main { padding: 1.75rem 2rem 3rem; } }
@media (min-width: 1440px) { .app-main { padding-left: 2.5rem; padding-right: 2.5rem; } }

.bottom-nav { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; height: calc(var(--bottom-nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgb(var(--c-surface) / .96); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); }
.bn-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .68rem; font-weight: 600; color: var(--muted); min-height: 48px; }
.bn-item svg { width: 22px; height: 22px; stroke-width: 1.9; }
.bn-item[aria-current="page"] { color: var(--text); }
.bn-item[aria-current="page"] svg { color: var(--brand-ink); stroke-width: 2.3; }
.bn-add { display: grid; place-items: center; }
.bn-add span { width: 54px; height: 54px; margin-top: -22px; border-radius: 18px; background: var(--brand); color: var(--navy); display: grid; place-items: center; box-shadow: 0 10px 22px -8px rgba(255, 138, 0, .85), 0 0 0 5px var(--surface); transition: transform .15s; }
.bn-add span svg { width: 26px; height: 26px; stroke-width: 2.5; }
.bn-add:active span { transform: scale(.94); }

.demo-banner { display: flex; align-items: center; gap: .6rem; padding: .55rem 1rem; background: var(--deep); color: #E2E8F0; font-size: .8rem; }
.demo-banner b { color: #fff; }
.demo-banner button { margin-left: auto; color: var(--brand); font-weight: 700; white-space: nowrap; }

/* Page header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
@media (min-width: 1024px) { .page-title { font-size: 1.85rem; } .page-head { margin-bottom: 1.75rem; } }
.page-sub { color: var(--muted); margin-top: .3rem; font-size: .925rem; }

/* KPI */
.kpi { padding: 1.1rem; }
@media (min-width: 640px) { .kpi { padding: 1.25rem 1.35rem; } }
.kpi-label { display: flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.kpi-label .kpi-ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-ink); }
.kpi-label .kpi-ic svg { width: 15px; height: 15px; }
.kpi-value { margin-top: .7rem; font-size: clamp(1.15rem, 6.2vw, 1.45rem); overflow-wrap: anywhere; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
@media (min-width: 640px) { .kpi-value { font-size: 1.7rem; } }
.kpi-trend { margin-top: .45rem; display: flex; align-items: center; gap: .3rem; font-size: .76rem; color: var(--muted); font-weight: 500; flex-wrap: wrap; }
.trend { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; }
.trend svg { width: 13px; height: 13px; }
.trend.up { color: var(--warn-ink); }
.trend.down { color: var(--success-ink); }

/* Records */
.rec { display: flex; align-items: center; gap: .9rem; padding: .85rem; border-radius: 16px; transition: background .15s; text-decoration: none; color: inherit; }
.rec:hover { background: var(--soft); }
.rec .thumb, .rec .img-fallback { width: 56px; height: 56px; border-radius: 14px; flex: none; object-fit: cover; }
@media (min-width: 640px) { .rec .thumb, .rec .img-fallback { width: 64px; height: 64px; } }
.rec-title { font-weight: 700; font-size: .95rem; color: var(--text); letter-spacing: -.01em; }
.rec-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .7rem; margin-top: .25rem; font-size: .78rem; color: var(--muted); }
.rec-meta span { display: inline-flex; align-items: center; gap: .3rem; }
.rec-meta svg { width: 13px; height: 13px; }
.rec-total { font-weight: 800; font-size: 1rem; letter-spacing: -.02em; text-align: right; }

/* Empty states */
.empty { text-align: center; padding: 3rem 1.25rem; }
.empty-art { width: 92px; height: 92px; margin: 0 auto 1.25rem; border-radius: 28px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-ink); position: relative; }
.empty-art svg { width: 40px; height: 40px; }
.empty h3 { font-size: 1.2rem; font-weight: 800; letter-spacing: -.02em; }
.empty p { margin: .5rem auto 0; color: var(--muted); max-width: 26rem; font-size: .925rem; line-height: 1.6; }

/* Editor items */
.item-card { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: .85rem; transition: border-color .15s, box-shadow .15s; }
.item-card:focus-within { border-color: #FFD199; box-shadow: 0 0 0 4px rgba(255, 138, 0, .08); }
.item-grid { display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; }
.item-grid .ig-name { grid-column: 1 / -1; }
@media (min-width: 768px) { .item-grid { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.2fr) auto minmax(0, 1fr); align-items: end; } .item-grid .ig-name { grid-column: auto; } }
.mini-label { font-size: .7rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; display: block; }

.sticky-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--bottom-nav-h) + var(--safe-b)); z-index: 35; background: rgb(var(--c-surface) / .97); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: .7rem 1rem; display: flex; align-items: center; gap: .75rem; box-shadow: 0 -8px 24px -12px rgba(15, 23, 42, .15); }
@media (min-width: 1024px) { .sticky-bar { display: none; } }

.breakdown-row { display: flex; justify-content: space-between; gap: 1rem; font-size: .875rem; padding: .3rem 0; }
.breakdown-row span:first-child { color: var(--ink-2); }
.breakdown-row span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.breakdown-row.is-sub span { color: var(--muted) !important; font-weight: 500 !important; font-size: .8rem; }
.breakdown-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: .75rem; margin-top: .5rem; border-top: 1.5px dashed var(--line); }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { text-align: center; font-size: .7rem; font-weight: 700; color: var(--faint); padding: .3rem 0; text-transform: uppercase; letter-spacing: .05em; }
.cal-d { min-height: 64px; border-radius: 12px; padding: .4rem; background: var(--surface); border: 1px solid var(--line-2); text-align: left; display: flex; flex-direction: column; transition: border-color .15s, background .15s; font-size: .8rem; }
@media (min-width: 768px) { .cal-d { min-height: 92px; padding: .55rem; } }
.cal-d:hover { border-color: var(--line-strong); }
.cal-d.is-out { background: transparent; border-color: transparent; color: var(--line-strong); pointer-events: none; }
.cal-d.is-today .cal-n { background: var(--inv-bg); color: var(--inv-fg); }
.cal-d.is-sel { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255,138,0,.15); }
.cal-d.has { background: var(--brand-50); border-color: var(--brand-100); }
.cal-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .75rem; }
.cal-amt { margin-top: auto; font-size: .68rem; font-weight: 800; color: var(--text); }
@media (min-width: 768px) { .cal-amt { font-size: .78rem; } }

/* Receipt preview */
.receipt-paper { background: var(--surface); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; color: #334155; padding: 22px 20px 26px; box-shadow: var(--shadow); max-width: 320px; margin: 0 auto; position: relative; overflow: hidden;
  -webkit-mask: linear-gradient(#000 0 0) top/100% calc(100% - 8px) no-repeat, radial-gradient(circle 5px at 50% 100%, transparent 98%, #000) bottom/10px 8px repeat-x;
  mask: linear-gradient(#000 0 0) top/100% calc(100% - 8px) no-repeat, radial-gradient(circle 5px at 50% 100%, transparent 98%, #000) bottom/10px 8px repeat-x; }
.receipt-paper .rl { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.receipt-paper .rr { border-top: 1px dashed var(--line-strong); margin: 10px 0; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: 24px; background: var(--surface); transition: border-color .2s, background .2s; }
.dropzone.is-over { border-color: var(--brand); background: var(--brand-50); }
.scan-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: inherit; }
.scan-overlay::after { content: ""; position: absolute; left: 0; right: 0; height: 80px; background: linear-gradient(180deg, transparent, rgba(255,138,0,.15) 70%, rgba(255,138,0,.85) 98%, transparent); animation: scanY 2.2s cubic-bezier(.5,0,.5,1) infinite; }
@keyframes scanY { from { transform: translateY(-80px); } to { transform: translateY(700px); } }
.flag { display: inline-flex; align-items: center; gap: .25rem; font-size: .7rem; font-weight: 700; color: var(--warn-ink); }
.flag svg { width: 12px; height: 12px; }

/* Chat */
.chat-wrap { display: flex; flex-direction: column; height: calc(100dvh - 64px - var(--bottom-nav-h) - var(--safe-b) - 2rem); min-height: 420px; }
@media (min-width: 1024px) { .chat-wrap { height: calc(100dvh - 72px - 4.75rem); } }
.has-demo-banner .chat-wrap { height: calc(100dvh - 64px - var(--bottom-nav-h) - var(--safe-b) - 2rem - 37px); }
@media (min-width: 1024px) { .has-demo-banner .chat-wrap { height: calc(100dvh - 72px - 4.75rem - 37px); } }
.msg-user { align-self: flex-end; max-width: 85%; background: var(--inv-bg); color: var(--inv-fg); padding: .75rem 1rem; border-radius: 18px 18px 4px 18px; font-size: .925rem; line-height: 1.5; }
.msg-bot { align-self: flex-start; max-width: min(640px, 94%); background: var(--surface); border: 1px solid var(--line); padding: 1rem 1.1rem; border-radius: 18px 18px 18px 4px; font-size: .925rem; line-height: 1.6; color: var(--ink-2); box-shadow: var(--shadow-xs); }
.msg-bot b, .msg-bot strong { color: var(--text); }
.ref-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 700; padding: .35rem .6rem; border-radius: 9px; background: var(--insight-50); color: var(--insight); border: 1px solid var(--insight-line); transition: background .15s; }
.ref-chip:hover { background: #EDE9FE; }
.ref-chip svg { width: 13px; height: 13px; }
.prompt-card { text-align: left; padding: 1rem; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s; font-size: .875rem; font-weight: 600; color: var(--text); display: flex; gap: .75rem; align-items: flex-start; }
.prompt-card:hover { border-color: #D8CCFB; box-shadow: var(--shadow); transform: translateY(-1px); }
.prompt-card svg { width: 18px; height: 18px; color: var(--insight); flex: none; margin-top: 1px; }
.typing span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #A78BFA; margin-right: 4px; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Split */
.person-card { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); padding: 1rem; }
.diner-toggle { display: inline-flex; align-items: center; gap: .35rem; height: 32px; padding: 0 .65rem 0 .3rem; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: .8rem; font-weight: 600; color: var(--ink-2); transition: all .15s; }
.diner-toggle .avatar { width: 24px; height: 24px; font-size: .6rem; opacity: .5; }
.diner-toggle[aria-pressed="true"] { border-color: var(--inv-bg); background: var(--inv-bg); color: var(--inv-fg); }
.diner-toggle[aria-pressed="true"] .avatar { opacity: 1; box-shadow: 0 0 0 2px var(--surface); }

/* Stars */
.stars { display: inline-flex; gap: 2px; }
.stars button, .stars span { color: #E2E8F0; }
.stars svg { width: 16px; height: 16px; }
.stars .on { color: var(--brand); }
.stars .on svg { fill: currentColor; }

/* Restaurant cards */
.r-card { position: relative; overflow: hidden; display: flex; flex-direction: column; }
.r-cover { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--brand-50); }
.r-cover img, .r-cover .img-fallback { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.r-card:hover .r-cover img { transform: scale(1.03); }
.fav-btn { position: absolute; top: .65rem; right: .65rem; width: 36px; height: 36px; border-radius: 50%; background: rgb(var(--c-surface) / .95); display: grid; place-items: center; color: var(--muted); box-shadow: var(--shadow-sm); transition: transform .15s, color .15s; }
.fav-btn:hover { transform: scale(1.06); }
.fav-btn svg { width: 17px; height: 17px; }
.fav-btn[aria-pressed="true"] { color: #E11D48; }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
.heart-toggle[aria-pressed="true"] { color: #E11D48; }
.heart-toggle[aria-pressed="true"] svg { fill: currentColor; }

/* Tabs */
.tabs { display: flex; gap: 1.25rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { position: relative; padding: .7rem 0; font-weight: 600; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); font-weight: 700; }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2.5px; border-radius: 3px 3px 0 0; background: var(--brand); }

/* Settings */
.set-nav a { display: flex; align-items: center; gap: .65rem; padding: .6rem .8rem; border-radius: 10px; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.set-nav a svg { width: 18px; height: 18px; color: var(--faint); }
.set-nav a:hover { background: var(--surface); }
.set-nav a.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; }
.set-row + .set-row { border-top: 1px solid var(--line-2); }

/* Alerts */
.alert { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem; border-radius: 14px; font-size: .875rem; line-height: 1.5; }
.alert > svg { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.alert-warn { background: var(--warn-50); color: #92400E; border: 1px solid #FDE68A; }
.alert-danger { background: var(--danger-50); color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: var(--success-50); color: #166534; border: 1px solid #BBF7D0; }
.alert-info { background: var(--raised); color: var(--ink-2); border: 1px solid var(--line); }
.alert-insight { background: var(--insight-50); color: #4C1D95; border: 1px solid var(--insight-line); }

.profile-menu { position: absolute; bottom: calc(100% + 8px); left: 12px; right: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: .4rem; animation: fadeUp .18s var(--ease); }
.profile-menu a, .profile-menu button { display: flex; width: 100%; align-items: center; gap: .6rem; padding: .6rem .7rem; border-radius: 9px; font-size: .875rem; font-weight: 600; color: var(--ink-2); }
.profile-menu a:hover, .profile-menu button:hover { background: var(--soft); color: var(--text); }
.profile-menu svg { width: 17px; height: 17px; }

.more-grid a, .more-grid button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; padding: 1rem .5rem; border-radius: 16px; border: 1px solid var(--line); font-size: .78rem; font-weight: 600; text-align: center; color: var(--ink-2); min-height: 92px; }
.more-grid a:active { background: var(--soft); }
.more-grid svg { width: 22px; height: 22px; color: var(--brand-ink); }
.more-grid .is-ai svg { color: var(--insight); }

/* Grid/flex children may shrink below their content width (prevents horizontal overflow on narrow phones).
   An explicit min-w-* on the element still wins, so controls like selects keep a readable width. */
.app-main .grid > *:not([class*="min-w-"]), .app-main .flex-1:not([class*="min-w-"]) { min-width: 0; }
.app-main .btn { max-width: 100%; }
.app-main .btn > span, .app-main .btn { overflow: hidden; text-overflow: ellipsis; }

/* ===== Nearby / maps ===== */
.nb-map { height: 62vh; min-height: 360px; }
@media (min-width: 768px) { .nb-map { height: calc(100dvh - 250px); min-height: 460px; position: sticky; top: 92px; } }
.leaflet-container { font-family: inherit; background: var(--track); isolation: isolate; z-index: 0; }
.leaflet-control-attribution { font-size: 10px; }
.leaflet-tooltip { font-family: inherit; font-weight: 700; font-size: 12px; color: var(--text); border-radius: 8px; border: 0; box-shadow: var(--shadow); }
.o-pin-wrap { background: none; border: 0; }
.o-pin { width: 34px; height: 34px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg); background: var(--surface); border: 2.5px solid var(--brand); display: grid; place-items: center; box-shadow: 0 6px 14px -4px rgba(15,23,42,.45); transition: transform .15s; }
.o-pin > * { transform: rotate(45deg); }
.o-pin svg { width: 16px; height: 16px; }
.o-pin.is-saved { border-color: #E11D48; color: #E11D48; }
.o-pin.is-saved svg { fill: currentColor; }
.o-pin.is-active { background: var(--inv-bg); border-color: var(--brand); transform: rotate(-45deg) scale(1.18); }
.me-dot { display: block; width: 18px; height: 18px; border-radius: 50%; background: #3B82F6; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(59,130,246,.22), 0 2px 6px rgba(0,0,0,.3); }
.place-card { display: flex; gap: .8rem; padding: .85rem; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.place-card:hover { border-color: var(--line-strong); }
.place-card.is-active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255,138,0,.15); }
.pc-ic { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-ink); }
.pc-ic svg { width: 18px; height: 18px; }

/* alerts in dark mode: tinted surfaces with readable text */
html.dark .alert-warn { color: #FDE68A; border-color: rgb(251 191 36 / .28); }
html.dark .alert-danger { color: #FECACA; border-color: rgb(248 113 113 / .3); }
html.dark .alert-success { color: #BBF7D0; border-color: rgb(74 222 128 / .26); }
html.dark .alert-insight { color: #DDD6FE; border-color: var(--insight-line); }
html.dark .alert-info { background: var(--raised); }
html.dark .\!bg-white { background-color: var(--surface) !important; }
html.dark .item-card:focus-within { border-color: rgb(255 138 0 / .45); }
html.dark .cal-d.is-out { background: transparent; }
html.dark .place-card.is-active, html.dark .cal-d.is-sel { box-shadow: 0 0 0 3px rgb(255 138 0 / .25); }
html.dark .demo-banner { border-bottom: 1px solid var(--line); }

/* ===== Command palette ===== */
.pal-trigger { align-items: center; gap: .6rem; height: 44px; padding: 0 .5rem 0 .9rem; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--faint); font-size: .92rem; transition: border-color .15s, box-shadow .15s; }
.pal-trigger:hover { border-color: var(--line-strong); }
.pal-trigger svg { width: 18px; height: 18px; }
.pk { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 .4rem; margin: 0 1px; border-radius: 6px; border: 1px solid var(--line); background: var(--soft); font: 600 11px/1 inherit; font-family: inherit; color: var(--muted); }
.pal-item { width: 100%; display: flex; align-items: center; gap: .75rem; padding: .6rem .6rem; border-radius: 12px; text-align: left; color: var(--text); }
.pal-item.is-active { background: var(--raised); }
.pal-ic { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--soft); color: var(--ink-2); border: 1px solid var(--line); }
.pal-ic svg { width: 17px; height: 17px; }
.pal-item.is-ai .pal-ic { background: var(--insight-50); color: var(--insight); border-color: var(--insight-line); }
.pal-item.is-active .pal-ic { border-color: var(--line-strong); }

/* ===== Hide amounts (privacy mode) ===== */
html.hide-amounts .num, html.hide-amounts .kpi-value, html.hide-amounts .rec-total, html.hide-amounts .money { filter: blur(7px); user-select: none; transition: filter .2s; }
html.hide-amounts input.num { filter: none; }
html.hide-amounts .viz-tip, html.hide-amounts #ovTrend text, html.hide-amounts #iTrend text { filter: blur(5px); }

/* ===== Notifications bell ===== */
.bell-dot { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--brand); color: #0F172A; font-size: 10px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--soft); }
/* ===== Insight cards ===== */
.ins-row { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .ins-row { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }
.ins-card { display: flex; gap: .8rem; align-items: flex-start; padding: 1rem 1.05rem; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); text-align: left; color: var(--ink-2); box-shadow: var(--shadow-xs); transition: border-color .15s, transform .15s; }
a.ins-card:hover, button.ins-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.ins-card b { color: var(--text); }
.ins-ic { width: 34px; height: 34px; flex: none; border-radius: 11px; display: grid; place-items: center; }
.ins-ic svg { width: 17px; height: 17px; }
.ins-card.is-good .ins-ic { background: var(--success-50); color: var(--success-ink); }
.ins-card.is-warn .ins-ic { background: var(--warn-50); color: var(--warn-ink); }
.ins-card.is-info .ins-ic { background: var(--brand-50); color: var(--brand-ink); }
.ins-card.is-danger .ins-ic { background: var(--danger-50); color: var(--danger); }

/* ===== Report & print ===== */
.rep-table { border-collapse: collapse; }
.rep-table thead th { border-bottom: 1px solid var(--line); }
.rep-table tbody tr + tr td { border-top: 1px solid var(--line-2); }
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; }
  #sidebar, #topbar, #bottomNav, #demoBanner, .no-print, .toast-wrap, .viz-tip, .modal-root { display: none !important; }
  .lg\:pl-\[var\(--sidebar-w\)\] { padding-left: 0 !important; }
  .app-main { padding: 0 !important; max-width: none !important; }
  .report { border: 0 !important; box-shadow: none !important; padding: 0 !important; }
  .report .bg-soft { background: #F8FAFC !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rep-break { break-before: auto; }
  .rep-table tr { break-inside: avoid; }
  html.hide-amounts .num, html.hide-amounts .kpi-value { filter: none !important; }
}

/* scanner suggestions */
.suggest { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; color: var(--insight); }
.suggest svg { width: 13px; height: 13px; }
.suggest b { color: var(--text); }

/* ===== Guided tour ===== */
.tour-root { position: fixed; inset: 0; z-index: 95; }
.tour-hole { position: fixed; border-radius: 16px; box-shadow: 0 0 0 9999px rgb(2 6 15 / .6); transition: all .3s var(--ease); pointer-events: none; outline: 2px solid var(--brand); outline-offset: 2px; }
.tour-card { position: fixed; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 20px; padding: 1.15rem 1.2rem 1rem; box-shadow: var(--shadow-lg); transition: top .3s var(--ease), left .3s var(--ease); }
@media (prefers-reduced-motion: reduce) { .tour-hole, .tour-card { transition: none; } }

/* ===== Diner Pass ===== */

/* pin picker */
.pin-map { height: 52vh; min-height: 300px; max-height: 520px; }
.pin-map .leaflet-container, .pin-map > .leaflet-container { cursor: crosshair; }
.pin-locate { position: absolute; z-index: 2; right: .6rem; bottom: .6rem; box-shadow: var(--shadow); }

/* ---------- small phones ---------- */
.rec-amt { display: none; font-weight: 800; font-size: .9rem; letter-spacing: -.02em; margin-top: .1rem; }
@media (max-width: 419px) {
  .rec { gap: .75rem; padding: .75rem .6rem; }
  .rec .thumb, .rec .img-fallback { width: 48px; height: 48px; border-radius: 12px; }
  .rec-total { display: none; }
  .rec-amt { display: block; }
}
.seg > button { flex-shrink: 0; }
/* Segmented control that fits the screen instead of scrolling: 2×2 on small phones */
.seg-fit { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; overflow: visible; }
.seg-fit > button { justify-content: center; padding: 0 .5rem; }
@media (min-width: 400px) { .seg-fit { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 640px) { .seg-fit { display: inline-flex; width: auto; } .seg-fit > button { padding: 0 .85rem; } }
.split-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .3rem .6rem; padding: .75rem; border-radius: 12px; background: var(--soft); }
.split-name { font-weight: 600; font-size: .875rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-amt { font-weight: 800; }
.split-tag { grid-column: 2 / -1; justify-self: start; }
.split-tag:empty { display: none; }
@media (max-width: 399px) {
  .theme-seg button { padding: 0 .5rem; gap: .3rem; }
}
.rep-scroll { overflow-x: auto; margin: 0 -.5rem; padding: 0 .5rem; scrollbar-width: thin; }
.rep-scroll .rep-table { min-width: 100%; }
@media print { .rep-scroll { overflow: visible; margin: 0; padding: 0; } }

/* installable app */
.install-card { display: flex; align-items: center; gap: .75rem; padding: .75rem .9rem; margin-bottom: 1rem; border-radius: 18px; border: 1px solid rgb(255 138 0 / .35); background: linear-gradient(135deg, rgb(255 138 0 / .10), rgb(255 138 0 / .03)); }
.ios-step { width: 1.6rem; height: 1.6rem; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 800; background: var(--brand); color: #0F172A; }
@media (display-mode: standalone) { .hide-standalone { display: none !important; } }

/* Small phones: the page title in the top bar gets a little more room */
@media (max-width: 379px) { #mTitle { font-size: .95rem !important; letter-spacing: -.02em; } #topbar > div { gap: .5rem; } #topbar .ml-auto { gap: .25rem; } }

/* ===== Account menu (top-right avatar) =====
   Solid in the Classic design; glass.css turns it into glass in v2. */
.avatar-top { width: 36px; height: 36px; font-size: .78rem; }
@media (min-width: 1024px) { .avatar-top { width: 40px; height: 40px; font-size: .82rem; } }
.avatar-acct { width: 52px; height: 52px; font-size: 1.05rem; border-radius: 16px; }
.avatar-btn { display: block; border-radius: 50%; transition: transform .25s cubic-bezier(.3,1.5,.5,1), box-shadow .25s; }
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { transform: scale(1.06); box-shadow: 0 0 0 3px rgb(255 138 0 / .35); }
.acct-menu { position: fixed; z-index: 85; display: flex; flex-direction: column; width: min(calc(100vw - 1.5rem), 22rem); border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); transform-origin: top right; animation: acctIn .3s cubic-bezier(.2,1.2,.4,1) both; }
.acct-menu.is-up { transform-origin: bottom left; }
.acct-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: .5rem; border-radius: inherit; }
.acct-menu.is-closing { animation: acctOut .16s ease both; }
@keyframes acctIn { from { opacity: 0; transform: translateY(-6px) scale(.96); } }
@keyframes acctOut { to { opacity: 0; transform: scale(.98); } }
.acct-head { display: flex; align-items: center; gap: .8rem; padding: .6rem .6rem .7rem; }
.acct-name { font-weight: 800; font-size: 1.02rem; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.acct-email { font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; line-height: 1.35; }
/* Diner Pass card strip: the card design you wear, as a slim bar */
.acct-card { display: block; margin: 0 .25rem .45rem; border-radius: 18px; color: #fff; transition: transform .25s var(--ease); }
.acct-card:hover { transform: translateY(-1px); }
.acct-card .pc-face { position: relative; inset: auto; flex-direction: row; align-items: center; gap: .75rem; min-height: 58px; padding: .7rem .95rem; border-radius: 18px; box-shadow: 0 14px 30px -18px rgb(2 6 15 / .6), inset 0 1px 1px rgb(255 255 255 / .28), inset 0 0 0 1px rgb(255 255 255 / .12); container-type: normal; }
.acct-card-text { position: relative; z-index: 2; display: flex; flex-direction: column; min-width: 0; flex: 1; }
.acct-card-label { font-size: .64rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; opacity: .85; overflow-wrap: anywhere; }
.acct-card-num { margin-top: .15rem; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-weight: 700; font-size: .92rem; letter-spacing: .08em; white-space: nowrap; text-shadow: 0 1px 0 rgb(0 0 0 / .3); }
@media (max-width: 359px) { .acct-card-num { font-size: .8rem; letter-spacing: .04em; } }
.acct-card-go { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: .3rem; flex: none; font-size: .74rem; font-weight: 800; }
.acct-card-go svg { width: 15px; height: 15px; }
.acct-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; margin: 0 .25rem; }
.acct-stats a { min-width: 0; padding: .55rem .6rem; border-radius: 14px; background: var(--soft); transition: background .15s; }
.acct-stats a:hover { background: var(--raised); }
.acct-stats span { display: block; font-size: .68rem; font-weight: 600; color: var(--muted); line-height: 1.25; }
.acct-stats b { display: block; margin-top: .1rem; font-size: .9rem; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.acct-stats small { font-size: .66rem; font-weight: 600; color: var(--muted); }
.acct-seen { display: flex; gap: .4rem; align-items: flex-start; margin: .6rem .55rem .2rem; font-size: .72rem; font-weight: 600; color: var(--muted); line-height: 1.4; }
.acct-seen svg { width: 14px; height: 14px; flex: none; margin-top: 1px; color: var(--success-ink); }
.acct-sep { height: 1px; margin: .45rem .3rem; background: var(--line); }
.acct-row { display: flex; width: 100%; align-items: center; gap: .75rem; min-height: 44px; padding: .55rem .7rem; border-radius: 14px; font-size: .9rem; font-weight: 600; color: var(--ink-2); text-align: left; transition: background .15s, color .15s; }
.acct-row:hover, .acct-row:focus-visible { background: var(--soft); color: var(--text); }
.acct-row > svg:first-child { width: 18px; height: 18px; flex: none; color: var(--muted); }
.acct-chev { width: 16px; height: 16px; flex: none; color: var(--faint); }
.acct-row-brand { color: var(--brand-ink); font-weight: 700; }
.acct-row-brand > svg:first-child { color: var(--brand-ink); }
.acct-row-danger, .acct-row-danger > svg:first-child { color: var(--danger) !important; }
.acct-row-danger:hover { background: var(--danger-50); }
.acct-prefs { padding: .2rem .25rem 0; }

/* Appearance rows: theme · design · glass */
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .35rem .45rem; }
.pref-label { font-size: .75rem; font-weight: 700; color: var(--muted); }
.seg3 { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 3px; border-radius: 13px; background: var(--raised); width: min(100%, 12.5rem); }
.seg3 > button { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-width: 0; height: 32px; padding: 0 .5rem; border-radius: 10px; font-size: .78rem; font-weight: 700; color: var(--muted); transition: background .2s, color .2s, box-shadow .2s; white-space: nowrap; }
.seg3 > button svg { width: 15px; height: 15px; flex: none; }
.seg3 > button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(var(--c-shadow) / .1), 0 4px 10px -4px rgb(var(--c-shadow) / .25); }
.seg3 > button[aria-checked="true"] svg { color: var(--brand-ink); }
html.dark .seg3 > button[aria-checked="true"] { background: rgb(var(--c-line-strong)); }
.more-prefs { margin-top: 1rem; padding: .35rem; border-radius: 18px; background: var(--soft); }
.more-prefs .seg3 { width: min(100%, 15rem); }
@media (max-width: 359px) { .more-prefs .seg3:not(.seg-2) > button span { display: none; } }

/* Diner Pass tier: badge on avatars + pill */
.tier-badge { position: absolute; right: -5px; bottom: -5px; display: grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 99px; box-shadow: 0 0 0 2.5px var(--surface), 0 4px 10px -2px rgb(2 6 23 / .4); pointer-events: none; background: var(--t); color: var(--tf); }
.tier-badge svg { width: .78rem; height: .78rem; stroke-width: 2.4; }
.tier-slot-sm { position: absolute; right: 0; bottom: 0; width: 0; height: 0; pointer-events: none; }
.tier-slot-sm .tier-badge { right: -4px; bottom: -4px; width: 1.05rem; height: 1.05rem; box-shadow: 0 0 0 2px var(--soft); }
.sidebar .tier-slot-sm .tier-badge { box-shadow: 0 0 0 2px var(--surface); }
.tier-slot-sm .tier-badge svg { width: .58rem; height: .58rem; }
[data-tier="regular"] { --t: linear-gradient(135deg, #CBD5E1, #64748B 55%, #1E293B); --tf: #fff; }
[data-tier="foodie"] { --t: linear-gradient(135deg, #FFD199, #FF8A00 50%, #C2410C); --tf: #1A1206; }
[data-tier="gourmand"] { --t: linear-gradient(135deg, #C4B5FD, #7C3AED 50%, #3B2A8C); --tf: #fff; }
[data-tier="connoisseur"] { --t: linear-gradient(135deg, #FDE68A, #CA8A04 55%, #1C1917); --tf: #1C1917; }
[data-tier="legend"] { --t: conic-gradient(from 200deg, #ff7ad9, #ffd36e, #7affc8, #6ec3ff, #b07aff, #ff7ad9); --tf: #1B1035; }
.tier-pill { display: inline-flex; align-items: center; gap: .3rem; margin-top: .35rem; padding: .18rem .55rem .18rem .4rem; border-radius: 99px; font-size: .7rem; font-weight: 800; background: var(--t); color: var(--tf); box-shadow: inset 0 1px 0 rgb(255 255 255 / .3), 0 4px 10px -6px rgb(2 6 23 / .5); white-space: nowrap; }
.tier-pill svg { width: 12px; height: 12px; stroke-width: 2.4; }
.tier-pill-sm { margin: 0; font-size: .66rem; padding: .12rem .45rem .12rem .35rem; }
.pref-box { padding: .3rem; border-radius: 16px; background: var(--soft); }
.pref-box .seg3 { width: min(100%, 16rem); }
@media (max-width: 359px) { .pref-box .seg3:not(.seg-2) > button span { display: none; } }

/* ===== Settings: activity log ===== */
.act-seal { display: flex; gap: .9rem; align-items: flex-start; padding: 1rem 1.1rem; border-radius: 20px; color: #fff; background: radial-gradient(120% 140% at 100% 0%, rgb(34 197 94 / .3), transparent 55%), linear-gradient(140deg, #0F172A, #10291F); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .06); }
.act-seal.is-bad { background: radial-gradient(120% 140% at 100% 0%, rgb(239 68 68 / .35), transparent 55%), linear-gradient(140deg, #1A0B0F, #2A0E14); }
.act-seal-ic { display: grid; place-items: center; flex: none; width: 2.6rem; height: 2.6rem; border-radius: 14px; background: rgb(74 222 128 / .16); color: #4ADE80; }
.act-seal.is-bad .act-seal-ic { background: rgb(248 113 113 / .16); color: #F87171; }
.act-hash { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .7rem; opacity: .7; overflow-wrap: anywhere; }
.act-stat { display: flex; flex-direction: column; gap: .15rem; padding: .7rem .8rem; border-radius: 16px; background: var(--soft); border: 1px solid var(--line-2); min-width: 0; }
.act-stat svg { width: 16px; height: 16px; color: var(--brand-ink); }
.act-stat b { font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; }
.act-stat span { font-size: .72rem; color: var(--muted); font-weight: 600; line-height: 1.3; }
.act-chips .chip { height: 34px; font-size: .8rem; }
.act-day { position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); z-index: 2; margin: 1rem 0 .35rem; padding: .3rem 0; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); background: linear-gradient(var(--surface) 70%, transparent); }
@media (min-width: 1024px) { .act-day { top: 72px; } }
html[data-design="v2"] .act-day { background: none; position: static; }
.act-ul { display: flex; flex-direction: column; gap: .15rem; }
.act-item details > summary { display: flex; align-items: flex-start; gap: .75rem; padding: .65rem .55rem; border-radius: 14px; cursor: pointer; list-style: none; transition: background .15s; }
.act-item details > summary::-webkit-details-marker { display: none; }
.act-item details > summary:hover, .act-item details[open] > summary { background: var(--soft); }
.act-ic { display: grid; place-items: center; flex: none; width: 2.2rem; height: 2.2rem; border-radius: 12px; background: var(--raised); color: var(--ink-2); }
.act-ic svg { width: 16px; height: 16px; }
.act-ic[data-tone="blue"] { background: rgb(59 130 246 / .12); color: #2563EB; }
.act-ic[data-tone="violet"] { background: var(--insight-50); color: var(--insight); }
.act-ic[data-tone="orange"] { background: var(--brand-50); color: var(--brand-ink); }
.act-ic[data-tone="sky"] { background: rgb(14 165 233 / .12); color: #0284C7; }
.act-ic[data-tone="amber"] { background: var(--warn-50); color: var(--warn-ink); }
.act-ic[data-tone="red"] { background: var(--danger-50); color: var(--danger); }
html.dark .act-ic[data-tone="blue"] { color: #60A5FA; }
html.dark .act-ic[data-tone="sky"] { color: #38BDF8; }
.act-sum { display: block; font-size: .9rem; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.act-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .5rem; margin-top: .2rem; font-size: .74rem; color: var(--muted); }
.act-meta > span:not(.badge) + span:not(.badge)::before { content: "·"; margin-right: .5rem; color: var(--faint); }
.act-meta .badge { height: 20px; font-size: .66rem; }
.act-chev { width: 16px; height: 16px; flex: none; margin-top: .55rem; color: var(--faint); transition: transform .25s var(--ease); }
details[open] .act-chev { transform: rotate(180deg); }
.act-detail { padding: .2rem .55rem .9rem 3.5rem; }
@media (max-width: 399px) { .act-detail { padding-left: .55rem; } }
.act-changes { display: grid; gap: .35rem; margin-bottom: .6rem; }
.act-changes > div { display: grid; grid-template-columns: minmax(5.5rem, auto) 1fr; gap: .6rem; align-items: baseline; font-size: .82rem; }
.act-changes dt { color: var(--muted); font-weight: 600; }
.act-changes dd { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; min-width: 0; overflow-wrap: anywhere; }
.act-changes s { color: var(--faint); }
.act-changes dd svg { width: 13px; height: 13px; color: var(--faint); }
.act-facts { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .72rem; color: var(--muted); }

/* ===== Settings: danger zone ===== */
/* phones/tablets: the tab row runs edge to edge and fades out, so it reads as scrollable */
@media (max-width: 1023px) {
  .set-nav { margin-inline: -1rem; padding-inline: 1rem; scroll-padding-inline: 1rem; -webkit-mask-image: linear-gradient(90deg, transparent, #000 1rem, #000 calc(100% - 2rem), transparent); mask-image: linear-gradient(90deg, transparent, #000 1rem, #000 calc(100% - 2rem), transparent); }
  .set-nav::after { content: ""; flex: none; width: 1rem; }
}
@media (min-width: 640px) and (max-width: 1023px) { .set-nav { margin-inline: -1.5rem; padding-inline: 1.5rem; } }
.set-nav a.is-danger svg { color: var(--danger); }
.set-nav a.is-danger.is-active { color: var(--danger); }
.danger-card { border-color: rgb(var(--c-danger) / .3) !important; }
.dz-row { display: flex; flex-direction: column; gap: .75rem; padding: 1rem 0; }
.dz-row:first-child { padding-top: 0; }
@media (min-width: 640px) { .dz-row { flex-direction: row; align-items: center; } }
.dz-ic { display: grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; border-radius: 13px; background: var(--raised); color: var(--ink-2); }
.dz-ic svg { width: 18px; height: 18px; }
.dz-ic[data-tone="amber"] { background: var(--warn-50); color: var(--warn-ink); }
.dz-ic[data-tone="red"] { background: var(--danger-50); color: var(--danger); }
.dz-ic-lg { width: 2.9rem; height: 2.9rem; border-radius: 16px; }
.dz-point { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding: .8rem .9rem; border-radius: 16px; border: 1px solid var(--line); }
