/* ===========================================================================
   Ollie, the app (app.ollie.chat)

   Built phone first, to feel like an app: a top bar whose title tucks away
   as you scroll, tabs at the bottom of a phone (at the top of a tablet),
   sheets that slide up, cards to swipe. It keeps working without
   JavaScript: sheets open as the page's :target, forms post as usual.

   The Content-Security-Policy blocks inline styles, so every one-off tweak
   lives here too.
=========================================================================== */

/* ---------------------------------------------------------------------------
   Tokens: the same palette as the marketing site (ollie.chat)
--------------------------------------------------------------------------- */
:root {
    --bg: #f7f5f2;
    --surface: #ffffff;
    --surface-2: #f1eeea;
    --surface-3: #e8e3dd;
    --ink: #1d1d1f;
    --ink-2: #3a3a3c;
    --muted: #6e6e73;
    --faint: #a3a0a6;
    --line: #e5e1dc;
    --line-strong: #d4cec6;
    --accent: #c8401a;
    --accent-ink: #ffffff;
    --accent-hover: #a9340f;
    --accent-soft: #ffe9df;
    --accent-softer: #fff4ee;
    --good: #1f7a55;
    --good-ink: #ffffff;
    --good-soft: #e2f4ea;
    --warn: #9a5800;
    --warn-soft: #fbefd9;
    --bad: #c42b1c;
    --bad-ink: #ffffff;
    --bad-soft: #fde8e6;
    --ios-blue: #007aff;
    --bar: rgba(247, 245, 242, 0.8);
    --scrim: rgba(24, 18, 14, 0.38);
    --toast: #1d1d1f;
    --toast-ink: #f7f5f2;
    --toast-accent: #ff9670;
    --shadow-sm: 0 1px 2px rgba(29, 29, 31, 0.05), 0 4px 12px -6px rgba(29, 29, 31, 0.1);
    --shadow: 0 1px 2px rgba(29, 29, 31, 0.05), 0 10px 24px -12px rgba(29, 29, 31, 0.18);
    --shadow-lg: 0 24px 60px -18px rgba(29, 29, 31, 0.35), 0 4px 12px rgba(29, 29, 31, 0.08);
    --radius: 20px;
    --radius-sm: 14px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, "Helvetica Neue", Helvetica, Arial,
        sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --appbar-h: 52px;
    --tabbar-h: 56px;
    --kb: 0px; /* the on-screen keyboard's height, from app.js */
    --gutter: 16px;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --ease-in: cubic-bezier(0.45, 0, 0.8, 0.4);
    --spring: cubic-bezier(0.3, 1.35, 0.5, 1);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b0b0c;
        --surface: #1c1c1e;
        --surface-2: #2c2c2e;
        --surface-3: #3a3a3c;
        --ink: #f5f5f7;
        --ink-2: #d1d1d6;
        --muted: #a1a1a6;
        --faint: #6e6e73;
        --line: #333336;
        --line-strong: #48484a;
        --accent: #ff7a4d;
        --accent-ink: #1d1d1f;
        --accent-hover: #ff9670;
        --accent-soft: #3a2118;
        --accent-softer: #261610;
        --good: #6fd3a3;
        --good-ink: #0b0b0c;
        --good-soft: #17301f;
        --warn: #f0b35c;
        --warn-soft: #3a2b14;
        --bad: #ff6b5e;
        --bad-ink: #0b0b0c;
        --bad-soft: #3d1f1c;
        --ios-blue: #0a84ff;
        --bar: rgba(18, 18, 20, 0.78);
        --scrim: rgba(0, 0, 0, 0.6);
        --toast: #f5f5f7;
        --toast-ink: #1d1d1f;
        --toast-accent: #c8401a;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 24px -12px rgba(0, 0, 0, 0.6);
        --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, 0.8);
        color-scheme: dark;
    }
}

/* ---------------------------------------------------------------------------
   Base
--------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-padding-top: calc(var(--safe-top) + var(--appbar-h) + 12px);
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h1 { font-size: 2.05rem; line-height: 1.12; letter-spacing: -0.03em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: 2px; }
img { max-width: 100%; }
small, .muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
/* Headings given focus so screen readers follow along aren't something to press. */
[tabindex="-1"]:focus { outline: none; }
::selection { background: var(--accent-soft); }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: fixed; top: calc(var(--safe-top) + 8px); left: 8px; z-index: 200; padding: 10px 14px;
    background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.icon { width: 22px; height: 22px; flex: none; }
.icon-inline { width: 16px; height: 16px; vertical-align: -3px; color: var(--muted); }

/* ---------------------------------------------------------------------------
   Page frame
--------------------------------------------------------------------------- */
.wrap {
    width: 100%; max-width: 1080px; margin: 0 auto;
    padding-left: max(var(--gutter), var(--safe-left));
    padding-right: max(var(--gutter), var(--safe-right));
}
.main { flex: 1; padding-top: 4px; padding-bottom: calc(40px + var(--safe-bottom)); }
.has-tabs .main { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 36px); }
.has-fab .main { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 100px); }
.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.medium { max-width: 640px; margin-left: auto; margin-right: auto; }

/* ---------------------------------------------------------------------------
   Top bar: back button or logo, a title that appears once the page's big
   title has scrolled under it, and the page's buttons.
--------------------------------------------------------------------------- */
.appbar {
    position: sticky; top: 0; z-index: 50;
    padding-top: var(--safe-top);
    background: var(--bg);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    view-transition-name: appbar;
}
.appbar.is-scrolled { box-shadow: 0 0.5px 0 var(--line); }
.appbar.is-condensed {
    background: var(--bar);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 0.5px 0 var(--line);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .appbar.is-condensed { background: var(--bg); }
}

.appbar-inner {
    display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 4px;
    height: var(--appbar-h); max-width: 1080px; margin: 0 auto;
    padding-left: max(6px, var(--safe-left)); padding-right: max(6px, var(--safe-right));
}
.appbar-lead { grid-column: 1; display: flex; align-items: center; min-width: 0; justify-self: start; }
.appbar-trail { grid-column: 3; display: flex; align-items: center; gap: 2px; justify-self: end; min-width: 0; }
.appbar-title {
    grid-column: 2; grid-row: 1; max-width: 56vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em;
    opacity: 0; transform: translateY(6px); transition: opacity 0.2s ease, transform 0.2s ease;
}
.appbar.is-condensed .appbar-title { opacity: 1; transform: none; }
.appbar:not(.has-back) .appbar-title { display: none; }
.is-focus .appbar:not(.has-back) .appbar-title { display: block; }

.brand {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 8px;
    color: var(--ink); text-decoration: none; font-size: 1.28rem; font-weight: 700; letter-spacing: -0.03em;
}
.brand img { width: 30px; height: 30px; }

.appbar-back {
    display: inline-flex; align-items: center; min-width: 0; min-height: 44px; padding: 0 10px 0 0;
    color: var(--accent); text-decoration: none; font-size: 1.0625rem; letter-spacing: -0.01em;
}
.appbar-back .icon { width: 30px; height: 30px; stroke-width: 2.4; margin-right: -2px; }
.appbar-back span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.appbar-back:active { opacity: 0.5; }

.icon-btn {
    display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; margin: 0;
    border: 0; border-radius: 50%; background: transparent; color: var(--accent); cursor: pointer;
    text-decoration: none; font: inherit; touch-action: manipulation;
    transition: background-color 0.15s ease, transform 0.15s ease;
}
.icon-btn .icon { width: 24px; height: 24px; }
.icon-btn:active { background: var(--surface-2); transform: scale(0.94); }
.icon-btn-filled { background: var(--accent-soft); }

.credits-pill {
    display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; margin: 0 6px;
    border-radius: 999px; background: var(--surface-2); color: var(--ink);
    font-size: 0.8125rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.credits-pill .icon { width: 16px; height: 16px; color: var(--accent); }
.appbar.has-back .credits-pill { display: none; }

.appbar-link { color: var(--accent); text-decoration: none; font-weight: 600; padding: 10px 10px; white-space: nowrap; }
.appbar-skip { margin: 0; }
.appbar-skip button {
    background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; padding: 10px 12px; cursor: pointer;
}

/* The welcome steps' progress, where the title would be. */
.steps-bar { display: flex; gap: 5px; width: min(170px, 42vw); }
.steps-bar span { flex: 1; height: 5px; border-radius: 3px; background: var(--surface-3); }
.steps-bar span.is-done { background: var(--accent); }
.steps-bar span.is-current { background: linear-gradient(to right, var(--accent) 50%, var(--surface-3) 50%); }
.is-focus .appbar-title { opacity: 1; transform: none; max-width: none; }

/* Something's loading after a tap: a thin bar under the top bar. */
.loading-bar {
    position: fixed; top: calc(var(--safe-top) + var(--appbar-h)); left: 0; z-index: 60; height: 2px; width: 100%;
    transform-origin: left; transform: scaleX(0); background: var(--accent); opacity: 0; pointer-events: none;
}
.is-loading .loading-bar { opacity: 1; animation: loading 8s cubic-bezier(0.1, 0.6, 0.2, 1) forwards; }
@keyframes loading { from { transform: scaleX(0.05); } to { transform: scaleX(0.92); } }

/* ---------------------------------------------------------------------------
   Tabs: a bar at the bottom of a phone
--------------------------------------------------------------------------- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: flex; justify-content: space-around;
    padding: 6px max(8px, var(--safe-right)) calc(var(--safe-bottom) + 4px) max(8px, var(--safe-left));
    background: var(--bar);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 -0.5px 0 var(--line);
    transition: transform 0.25s var(--ease);
    view-transition-name: tabbar;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .tabbar { background: var(--surface); }
}
.tab {
    flex: 1; max-width: 160px; min-height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); text-decoration: none; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.01em;
    -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.tab .icon { width: 26px; height: 26px; stroke-width: 1.9; transition: transform 0.15s ease; }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"] .icon { stroke-width: 2.2; }
.tab:active .icon { transform: scale(0.88); }

/* Typing: the keyboard needs the room. */
.has-keyboard .tabbar,
body:has(:is(input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"]), textarea, select):focus) .tabbar {
    transform: translateY(calc(100% + 10px));
}

/* ---------------------------------------------------------------------------
   Page titles and sections
--------------------------------------------------------------------------- */
.page-title { padding: 2px 0 18px; }
.page-title h1 { margin: 0; overflow-wrap: anywhere; }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 0.98rem; }
.page-sub strong { color: var(--ink); font-weight: 600; }
.page-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-title-row > :first-child { min-width: 0; }

.section { margin-top: 30px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 12px; }
.section-head h2 { margin: 0; font-size: 1.3rem; }
.section-head .btn-small, .section-head .link { flex: none; }
.section-note { margin: -6px 2px 14px; color: var(--muted); font-size: 0.9rem; }
.count {
    display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; margin-left: 6px;
    border-radius: 999px; background: var(--surface-3); color: var(--muted);
    font-size: 0.78rem; font-weight: 700; letter-spacing: 0; vertical-align: 3px;
}
.count-accent { background: var(--accent-soft); color: var(--accent); }
.count-good { background: var(--good-soft); color: var(--good); }
.link { color: var(--accent); font-weight: 600; text-decoration: none; }

/* ---------------------------------------------------------------------------
   Buttons
--------------------------------------------------------------------------- */
.btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 11px 22px; border: 1px solid transparent; border-radius: 999px;
    background: var(--accent); color: var(--accent-ink);
    font: inherit; font-size: 1rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.005em;
    text-decoration: none; text-align: center; cursor: pointer;
    -webkit-user-select: none; user-select: none; touch-action: manipulation;
    transition: transform 0.15s var(--ease), background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.btn .icon { width: 20px; height: 20px; }
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-tinted { background: var(--accent-soft); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-plain { background: var(--surface-2); color: var(--ink); }
.btn-good { background: var(--good); color: var(--good-ink); }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-destructive { background: var(--bad); color: var(--bad-ink); }
.btn-small { min-height: 36px; padding: 7px 14px; font-size: 0.9rem; }
.btn-small .icon { width: 17px; height: 17px; }
.btn-large { min-height: 54px; font-size: 1.0625rem; }
.btn-block { width: 100%; }

@media (hover: hover) {
    .btn:hover { background: var(--accent-hover); }
    .btn-secondary:hover { background: var(--surface-2); }
    .btn-tinted:hover { background: color-mix(in srgb, var(--accent-soft) 70%, var(--accent) 12%); }
    .btn-ghost:hover { background: var(--accent-softer); }
    .btn-plain:hover { background: var(--surface-3); }
    .btn-good:hover { background: var(--good); filter: brightness(1.06); }
    .btn-danger:hover { background: var(--bad-soft); filter: brightness(0.97); }
    .btn-destructive:hover { background: var(--bad); filter: brightness(1.06); }
    .icon-btn:hover { background: var(--surface-2); }
    a:hover { color: var(--accent-hover); }
}

/* A form on its way: a spinner in the button that sent it. */
.btn.is-busy { color: transparent !important; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after {
    content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%;
    border: 2.5px solid currentColor; border-color: var(--accent-ink) var(--accent-ink) transparent transparent;
    opacity: 0.9; animation: spin 0.7s linear infinite;
}
.btn-secondary.is-busy::after, .btn-plain.is-busy::after, .btn-ghost.is-busy::after, .btn-tinted.is-busy::after {
    border-color: var(--accent) var(--accent) transparent transparent;
}

.link-button {
    background: none; border: 0; padding: 0; font: inherit; color: var(--accent); font-weight: 600; cursor: pointer;
}
.inline-form { display: inline; }

/* Pills: small, round, tappable. */
.pill {
    display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px;
    border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink);
    font: inherit; font-size: 0.875rem; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer;
    -webkit-user-select: none; user-select: none; touch-action: manipulation;
    transition: transform 0.15s var(--ease), background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pill .icon { width: 15px; height: 15px; color: var(--muted); }
.pill:active { transform: scale(0.96); }
.pill[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pill[aria-pressed="true"] .icon { color: var(--accent); }
@media (hover: hover) { .pill:hover { border-color: var(--accent); color: var(--ink); } }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }

/* A row that scrolls sideways on a phone, running to the screen's edges. */
.scroller {
    display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
    margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 6px; scroll-padding: 0 var(--gutter);
    scrollbar-width: none;
}
.scroller::-webkit-scrollbar { display: none; }
.scroller > * { flex: none; scroll-snap-align: start; }

.chip {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
    background: var(--surface-2); color: var(--muted); font-size: 0.8rem; font-weight: 600; white-space: nowrap;
}
.chip .icon { width: 14px; height: 14px; }
.chip-good { background: var(--good-soft); color: var(--good); }
.chip-accent { background: var(--accent-soft); color: var(--accent); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------------------------------------------------------------------
   Forms
--------------------------------------------------------------------------- */
.field { margin-bottom: 18px; }
.field label, .label { display: block; margin-bottom: 7px; font-weight: 600; font-size: 0.95rem; }
.field .hint, .hint { margin: 7px 0 0; color: var(--muted); font-size: 0.875rem; }
.field .error, .error { margin: 7px 0 0; color: var(--bad); font-size: 0.875rem; font-weight: 500; }
.optional { color: var(--muted); font-weight: 400; }

input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"],
input[type="search"], input[type="tel"], input[type="url"], select, textarea {
    display: block; width: 100%; min-height: 50px; margin: 0; padding: 12px 14px;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
    font: inherit; font-size: 1rem; line-height: 1.4;
    -webkit-appearance: none; appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
textarea { min-height: 124px; resize: vertical; }
select {
    padding-right: 40px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
input[type="date"] { min-height: 50px; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; min-height: 1.4em; }
input[type="search"]::-webkit-search-cancel-button { display: none; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--bad); }

.input-prefix { display: flex; align-items: stretch; }
.input-prefix > span {
    display: flex; align-items: center; padding: 0 14px; border: 1px solid var(--line-strong); border-right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--surface-2); color: var(--muted); font-weight: 600;
}
.input-prefix input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .form-row { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.form-note { margin: 14px 0 0; }

/* A password with a button to show what's been typed. */
.password { position: relative; }
.password input { padding-right: 52px; }
.password-toggle {
    position: absolute; top: 3px; right: 3px; width: 44px; height: 44px; display: none; place-items: center;
    border: 0; border-radius: 12px; background: none; color: var(--muted); cursor: pointer;
}
.js .password-toggle { display: grid; }
.password-toggle .icon { width: 22px; height: 22px; }
.password-toggle .icon-hide, .password-toggle[aria-pressed="true"] .icon-show { display: none; }
.password-toggle[aria-pressed="true"] .icon-hide { display: block; }

/* Checkboxes as rows with a face and a tick. */
.picks-list { list-style: none; margin: 0; padding: 0; border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.pick-row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 14px; cursor: pointer; }
.picks-list li + li .pick-row::before { content: ""; position: absolute; top: 0; left: 62px; right: 0; border-top: 0.5px solid var(--line-strong); }
.pick-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pick-row .name { flex: 1; font-weight: 600; }
.pick-tick {
    width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center;
    color: transparent; transition: background-color 0.15s ease, border-color 0.15s ease;
}
.pick-tick .icon { width: 16px; height: 16px; stroke-width: 3; }
.pick-row input:checked ~ .pick-tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pick-row input:focus-visible ~ .pick-tick { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

/* Tap-to-choose answers: radio buttons dressed as pills. */
.choices { border: 0; margin: 0 0 24px; padding: 0; min-width: 0; }
.choices legend { padding: 0; margin-bottom: 12px; font-weight: 600; font-size: 1.02rem; }
.choices .hint { margin: 10px 0 0; }
.choices .error { margin: 10px 0 0; }
.choice-list { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; display: inline-flex; cursor: pointer; }
.choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice > span {
    display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 9px 16px;
    border: 1.5px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-weight: 500;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s var(--ease);
    -webkit-user-select: none; user-select: none;
}
.choice:active > span { transform: scale(0.97); }
.choice input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.choice input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.has-error .choice > span { border-color: var(--bad); }

/* Bigger answers, one to a row, with a tick. */
.options { display: grid; gap: 10px; }
.option { position: relative; display: block; cursor: pointer; }
.option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.option > span {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; padding: 14px 18px;
    border: 1.5px solid var(--line); border-radius: 18px; background: var(--surface);
    font-size: 1.05rem; font-weight: 600; box-shadow: var(--shadow-sm);
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s var(--ease);
    -webkit-user-select: none; user-select: none;
}
.option > span::after {
    content: ""; flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong);
    background: center / 14px no-repeat;
}
.option:active > span { transform: scale(0.98); }
.option input:checked + span { border-color: var(--accent); background: var(--accent-softer); color: var(--accent); }
.option input:checked + span::after {
    border-color: var(--accent);
    background-color: var(--accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
}
.option input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

/* Big tiles to choose an occasion. */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile-choice { position: relative; display: block; cursor: pointer; }
.tile-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.tile-choice > span {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 100px;
    padding: 12px 8px; border: 1.5px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm);
    font-weight: 600; text-align: center; line-height: 1.25;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s var(--ease), box-shadow 0.15s ease;
    -webkit-user-select: none; user-select: none;
}
.tile-choice .emoji { font-size: 2rem; line-height: 1; }
.tile-choice:active > span { transform: scale(0.97); }
.tile-choice input:checked + span {
    border-color: var(--accent); background: var(--accent-softer); color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}
.tile-choice input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

/* How much there is in a description, as it's typed. */
.meter { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.meter li {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px 4px 7px; border-radius: 999px;
    background: var(--surface-2); color: var(--muted); font-size: 0.8125rem; font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.meter li .icon { width: 14px; height: 14px; stroke-width: 3; opacity: 0.35; }
.meter li.is-met { background: var(--good-soft); color: var(--good); }
.meter li.is-met .icon { opacity: 1; }
.meter-hint { margin: 8px 0 0; font-size: 0.875rem; color: var(--muted); }
.tips { margin: 6px 0 0; padding-left: 20px; font-size: 0.875rem; color: var(--muted); }
.js .meter-fallback { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.meter { display: none; }
.js .meter { display: flex; }

/* Looking for someone in a long list. */
.search-field { position: relative; margin-bottom: 14px; }
.search-field .icon { position: absolute; left: 13px; top: 50%; width: 19px; height: 19px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { min-height: 44px; padding-left: 42px; border-color: transparent; border-radius: 12px; background: var(--surface-3); }
.search-field input:focus { background: var(--surface); }

/* A person's page opens like a contact card. */
.profile { text-align: center; }
.profile .avatar { margin: 0 auto 12px; }

/* A switch between two views of one sheet. */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; margin: 0 0 18px; border-radius: 12px; background: var(--surface-2); }
.segmented button {
    min-height: 36px; border: 0; border-radius: 10px; background: none; color: var(--ink);
    font: inherit; font-size: 0.92rem; font-weight: 600; cursor: pointer;
}
.segmented button[aria-selected="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.segmented { display: none; }
.js .segmented { display: grid; }

/* ---------------------------------------------------------------------------
   Cards and grouped lists
--------------------------------------------------------------------------- */
.card {
    background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px;
}
.card + .card, .stack > * + * { margin-top: 16px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.divider-text {
    display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--muted);
    font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.divider-text::before, .divider-text::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* Lists in rounded groups, like a phone's Settings. */
.group {
    list-style: none; margin: 0; padding: 0; overflow: hidden;
    background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.group-title {
    margin: 26px 16px 8px; color: var(--muted);
    font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.group-note { margin: 8px 16px 0; color: var(--muted); font-size: 0.8125rem; }
.group + .group, .group + .group-note + .group { margin-top: 20px; }

.row {
    position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px 14px 10px 16px;
    border: 0; background: var(--surface); color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
    -webkit-user-select: none; user-select: none; touch-action: pan-y;
    transition: background-color 0.15s ease;
}
.row:active { background: var(--surface-2); }
@media (hover: hover) { .row:hover { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); color: var(--ink); } }
.group > li + li > .row::before, .group > li + li > .swipe-row > .row::before, .group > li + li > form > .row::before, .group > .row + .row::before {
    content: ""; position: absolute; top: 0; left: var(--inset, 16px); right: 0; border-top: 0.5px solid var(--line);
}
.group.has-faces { --inset: 68px; }
.group.has-icons { --inset: 58px; }
.group.has-emoji { --inset: 62px; }
.row .occasion-emoji { width: 36px; height: 36px; border-radius: 11px; font-size: 1.2rem; }
.row-lists { color: var(--ink-2); }
.row-body { flex: 1; min-width: 0; }
.row-title { display: block; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row-sub { display: block; margin-top: 1px; color: var(--muted); font-size: 0.875rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row-value { flex: none; color: var(--muted); font-size: 0.95rem; }
.row-end { flex: none; display: flex; align-items: center; gap: 8px; }
.row-chevron { flex: none; width: 18px; height: 18px; color: var(--faint); stroke-width: 2.4; }
.row-icon {
    flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
    background: var(--accent); color: #fff;
}
.row-icon .icon { width: 18px; height: 18px; stroke-width: 2.1; }
.row-icon.is-blue { background: #0a84ff; }
.row-icon.is-green { background: #30b566; }
.row-icon.is-grey { background: #8e8e93; }
.row-icon.is-purple { background: #8e5cf0; }
.row-icon.is-red { background: #ff453a; }
.row-icon.is-orange { background: #ff9f0a; }
.row.is-danger { color: var(--bad); justify-content: center; font-weight: 600; }
.row.is-accent { color: var(--accent); font-weight: 600; }
.row .chips { flex-wrap: nowrap; overflow: hidden; }
.row-sub.is-good { color: var(--good); }
.row-sub.is-accent, .row-sub.is-busy { color: var(--accent); }
.row-sub.is-warn { color: var(--warn); }
.row-sub .spinner { display: inline-block; width: 11px; height: 11px; border-width: 2px; margin-right: 2px; vertical-align: -1px; }
.swipe-note { display: none; }
@media (pointer: coarse) and (scripting: enabled) { .swipe-note { display: block; } }
.js .no-js-only { display: none; }
form > .row { width: 100%; }

.avatar {
    flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
    font-weight: 700; font-size: 1rem; letter-spacing: 0;
    background: var(--tone-bg, var(--accent-soft)); color: var(--tone-ink, var(--accent));
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.35rem; }
.avatar-xl { width: 84px; height: 84px; font-size: 2rem; }
.avatar-sm { width: 28px; height: 28px; font-size: 0.75rem; }
.tone-1 { --tone-bg: #ffe4d6; --tone-ink: #b8471f; }
.tone-2 { --tone-bg: #dcebff; --tone-ink: #2d62b0; }
.tone-3 { --tone-bg: #daf3e6; --tone-ink: #1d7a52; }
.tone-4 { --tone-bg: #ece3ff; --tone-ink: #6a45c2; }
.tone-5 { --tone-bg: #fff0c7; --tone-ink: #946400; }
.tone-6 { --tone-bg: #ffe0ea; --tone-ink: #b3325f; }
@media (prefers-color-scheme: dark) {
    .tone-1 { --tone-bg: #43271c; --tone-ink: #ffb08f; }
    .tone-2 { --tone-bg: #1d2c44; --tone-ink: #9cc3ff; }
    .tone-3 { --tone-bg: #173327; --tone-ink: #7fdcb0; }
    .tone-4 { --tone-bg: #2b2142; --tone-ink: #c7b1ff; }
    .tone-5 { --tone-bg: #3a2f12; --tone-ink: #f4cf6a; }
    .tone-6 { --tone-bg: #3f1c29; --tone-ink: #ff9fbf; }
}
.faces { display: flex; padding-left: 6px; }
.faces .avatar { width: 28px; height: 28px; margin-left: -7px; font-size: 0.72rem; box-shadow: 0 0 0 2px var(--surface); }
.faces .more { background: var(--surface-2); color: var(--muted); }

/* A row that slides aside to show what else it can do (swipe left). */
.swipe-row { position: relative; overflow: hidden; }
.swipe-row > .row { z-index: 1; transition: transform 0.3s var(--ease); }
.swipe-actions { position: absolute; top: 0; right: 0; bottom: 0; display: flex; }
.swipe-actions form { display: flex; margin: 0; }
.row-action {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 86px; padding: 0 14px;
    border: 0; background: var(--bad); color: #fff; font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer;
}
.row-action .icon { width: 22px; height: 22px; }
.swipe-row.is-dragging > .row { transition: none; transform: translateX(var(--dx, 0)); }
.swipe-row.is-open > .row, .swipe-row:has(.swipe-actions :focus-visible) > .row { transform: translateX(calc(-1 * var(--reveal, 86px))); }
/* A mouse can't swipe: the button sits at the end of the row instead. */
@media (hover: hover) and (pointer: fine) {
    .swipe-row { display: flex; align-items: stretch; background: var(--surface); }
    .swipe-row > .row { flex: 1; min-width: 0; }
    .swipe-actions { position: static; align-items: center; padding-right: 10px; }
    .row-action { min-width: 0; min-height: 36px; padding: 0 12px; border-radius: 999px; background: transparent; color: var(--bad); flex-direction: row; }
    .row-action:hover { background: var(--bad-soft); }
    .row-action .icon { width: 17px; height: 17px; }
}
@media (scripting: none) {
    .swipe-row { display: flex; align-items: stretch; background: var(--surface); }
    .swipe-row > .row { flex: 1; min-width: 0; }
    .swipe-actions { position: static; align-items: center; padding-right: 10px; }
    .row-action { min-width: 0; min-height: 36px; border-radius: 999px; background: transparent; color: var(--bad); }
}

/* ---------------------------------------------------------------------------
   Sheets (<dialog>): up from the bottom of a phone, in the middle of a
   bigger screen. Drag the handle down, tap outside or press Escape to close.
--------------------------------------------------------------------------- */
.sheet {
    position: fixed; inset: auto 0 0 0; z-index: 100;
    width: 100%; max-width: none; height: auto; max-height: 100%; margin: 0; padding: 0;
    border: 0; background: transparent; color: var(--ink); overflow: visible;
}
.sheet[open] { display: flex; flex-direction: column; justify-content: flex-end; }
.sheet::backdrop { background: var(--scrim); animation: fade-in 0.3s ease; }
.sheet.is-closing::backdrop { animation: fade-out 0.25s ease forwards; }

.sheet-panel {
    position: relative; display: flex; flex-direction: column; width: 100%;
    max-height: calc(100vh - var(--safe-top) - 10px - var(--kb));
    max-height: calc(100dvh - var(--safe-top) - 10px - var(--kb));
    margin-bottom: var(--kb);
    padding-bottom: var(--safe-bottom);
    background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.16);
    animation: sheet-up 0.42s var(--ease);
}
.sheet.is-closing .sheet-panel { animation: sheet-down 0.26s var(--ease-in) forwards; }
.sheet-panel.is-dragging { transition: none; }
.sheet-panel.is-settling { transition: transform 0.3s var(--ease); }

.sheet-grab { flex: none; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: var(--line-strong); }
.sheet-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 20px 12px; touch-action: none; cursor: grab; }
.sheet-head h2 { margin: 2px 0 0; font-size: 1.3rem; }
.sheet-lead { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }
.sheet-close {
    flex: none; display: grid; place-items: center; width: 32px; height: 32px; margin: 2px -4px 0 0;
    border-radius: 50%; background: var(--surface-2); color: var(--muted); text-decoration: none;
}
.sheet-close .icon { width: 17px; height: 17px; stroke-width: 2.6; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 22px; }
.sheet-body > :last-child { margin-bottom: 0; }
.sheet-actions { display: grid; gap: 10px; margin-top: 20px; }
.sheet-actions-row { display: flex; gap: 10px; margin-top: 20px; }
.sheet-actions-row > * { flex: 1; }

/* A menu of actions. */
.menu { list-style: none; margin: 0 -8px; padding: 0; }
.menu li + li { border-top: 0.5px solid var(--line); }
.menu form { margin: 0; }
.menu-item {
    display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 10px 8px;
    border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit; font-size: 1.0625rem;
    text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item .icon { color: var(--accent); }
.menu-item:active { background: var(--surface-2); }
.menu-item.is-danger, .menu-item.is-danger .icon { color: var(--bad); }
.menu-item small { display: block; color: var(--muted); font-size: 0.85rem; }

/* A question to answer before going on (made by app.js). */
.sheet-alert .sheet-panel { padding: 22px 20px calc(var(--safe-bottom) + 18px); text-align: center; }
.alert-title { margin: 4px 8px 6px; font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; }
.alert-text { margin: 0 8px 20px; color: var(--muted); }
.alert-actions { display: grid; gap: 10px; }

@media (min-width: 768px) {
    .sheet { inset: 0; width: min(540px, calc(100% - 48px)); max-height: calc(100% - 64px); margin: auto; }
    .sheet[open] { justify-content: center; }
    .sheet-panel {
        max-height: calc(100vh - 64px - var(--kb)); max-height: calc(100dvh - 64px - var(--kb));
        border-radius: 24px; padding-bottom: 0; box-shadow: var(--shadow-lg); animation: sheet-pop 0.32s var(--spring);
    }
    .sheet.is-closing .sheet-panel { animation: sheet-unpop 0.2s ease forwards; }
    .sheet-grab { display: none; }
    .sheet-head { padding-top: 18px; cursor: default; }
    .sheet-alert { width: min(400px, calc(100% - 48px)); }
    .sheet-alert .sheet-panel { padding-bottom: 20px; }
}

/* Without JavaScript a sheet is the page's :target, over a dimmed page. */
@media (scripting: none) {
    .sheet:target {
        display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
        inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; background: var(--scrim);
    }
    .sheet-grab { display: none; }
}
@media (scripting: none) and (min-width: 768px) {
    .sheet:target { justify-content: center; }
    .sheet:target .sheet-panel { width: min(540px, calc(100% - 48px)); }
}

/* ---------------------------------------------------------------------------
   Toasts: little messages at the bottom, some with an action (Undo)
--------------------------------------------------------------------------- */
.toasts {
    position: fixed; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 16px); z-index: 150;
    display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 12px; pointer-events: none;
}
.has-tabs .toasts { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px); }
.has-fab .toasts { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 80px); }
.toast {
    pointer-events: auto; display: flex; align-items: center; gap: 4px; width: fit-content; max-width: min(520px, 100%); min-height: 48px;
    padding: 8px 8px 8px 18px; border-radius: 16px; background: var(--toast); color: var(--toast-ink);
    box-shadow: var(--shadow-lg); font-weight: 500; font-size: 0.95rem; line-height: 1.35;
    animation: toast-in 0.42s var(--spring); touch-action: pan-y;
}
.toast-text { padding: 6px 8px 6px 0; }
.toast.is-leaving { animation: toast-out 0.22s ease forwards; }
.toast-action {
    flex: none; min-height: 36px; padding: 6px 12px; border: 0; border-radius: 10px; background: none;
    color: var(--toast-accent); font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.toast-action:active { background: color-mix(in srgb, var(--toast-ink) 12%, transparent); }
.toast-error { background: var(--bad); color: #fff; }
.toast-error .toast-action { color: #fff; }

/* Messages from the server, before app.js turns them into toasts. */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 500; }
.flash-success { background: var(--good-soft); color: var(--good); }
.flash-error { background: var(--bad-soft); color: var(--bad); }
.flash-info { background: var(--surface-2); color: var(--ink); }

.offline-bar {
    position: fixed; left: 50%; top: calc(var(--safe-top) + var(--appbar-h) + 8px); z-index: 70;
    display: flex; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px); padding: 8px 14px; border-radius: 20px;
    background: var(--toast); color: var(--toast-ink); font-size: 0.875rem; font-weight: 600; box-shadow: var(--shadow);
    transform: translate(-50%, -12px); opacity: 0; pointer-events: none; transition: transform 0.3s var(--ease), opacity 0.3s ease;
}
.offline-bar .icon { width: 18px; height: 18px; flex: none; }
.offline-retry {
    flex: none; min-height: 32px; margin: -6px -8px -6px 0; padding: 4px 10px; border: 0; border-radius: 999px; background: none;
    color: var(--toast-accent); font: inherit; font-weight: 700; cursor: pointer; pointer-events: auto;
}
.is-offline .offline-bar { transform: translate(-50%, 0); opacity: 1; }

/* ---------------------------------------------------------------------------
   Banners, offers and empty pages
--------------------------------------------------------------------------- */
.banner {
    display: grid; gap: 14px; margin-bottom: 22px; padding: 18px;
    border-radius: var(--radius); background: var(--accent-soft);
}
.banner p { margin: 0; }
.banner strong { color: var(--ink); }
.banner-warn { background: var(--warn-soft); }
.banner .pitch { margin: 8px 0 0; font-size: 0.92rem; color: var(--ink-2); }
.banner-actions { display: grid; gap: 8px; }
.banner-actions .btn { width: 100%; }
.banner-actions .small { margin: 0; text-align: center; }
.banner-compact { gap: 12px; padding: 14px 16px; }
.banner-compact .pitch + .pitch, .banner-compact .banner-actions .small, .banner-compact .banner-more { display: none; }
.card .banner:last-child { margin-bottom: 0; }

.offer {
    display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; padding: 14px 16px;
    border-radius: var(--radius-sm); background: var(--accent-soft);
}
.offer p { margin: 0; }
.offer-icon { font-size: 1.5rem; line-height: 1.2; }

.empty { padding: 34px 22px; border-radius: 24px; background: var(--surface); text-align: center; box-shadow: var(--shadow-sm); }
.empty h2 { margin: 0 0 6px; }
.empty p { color: var(--muted); max-width: 34ch; margin-left: auto; margin-right: auto; }
.empty .ollie { display: block; width: 84px; height: 84px; margin: 0 auto 12px; }
.empty .btn { margin-top: 4px; }
.empty .pills { justify-content: center; margin-top: 18px; }

.ollie-bob { animation: bob 2.4s ease-in-out infinite; }
.ollie-pop { animation: pop-in 0.6s var(--spring) both; }

/* Put Ollie on the Home Screen. */
.install-card {
    display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 14px; align-items: center; margin-top: 20px; padding: 14px;
    border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm);
    border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    animation: rise-in 0.5s var(--ease) both;
}
.install-card > img { grid-row: span 2; width: 54px; height: 54px; border-radius: 13px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); }
.install-card p { margin: 0; }
.install-card-title { font-weight: 700; }
.install-card-text { color: var(--muted); font-size: 0.875rem; line-height: 1.4; }
.install-card-actions { grid-column: 2; display: flex; gap: 8px; align-items: center; margin-top: 10px; }

.install-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; padding: 14px; border-radius: 18px; background: var(--surface-2); }
.install-hero img { width: 62px; height: 62px; border-radius: 15px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14); }
.install-hero p { margin: 0; }
.install-hero strong { display: block; font-size: 1.05rem; }
.install-hero span { color: var(--muted); font-size: 0.9rem; line-height: 1.4; display: block; }
.install-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.install-steps li { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: center; }
.install-steps p { margin: 0; }
.install-steps .muted { display: block; font-size: 0.875rem; margin-top: 2px; }
.step-icon {
    display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); color: var(--ios-blue);
}
.step-icon .icon { width: 24px; height: 24px; }
.step-icon img { width: 30px; height: 30px; }
.install-note { margin: 20px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--accent-softer); font-size: 0.9rem; }
.install-kbd { display: inline-flex; vertical-align: -5px; color: var(--ios-blue); }
.install-kbd .icon { width: 20px; height: 20px; }

/* ---------------------------------------------------------------------------
   Occasions
--------------------------------------------------------------------------- */
.occasion-list { display: grid; gap: 12px; list-style: none; margin: 0; padding: 0; }
.occasion-card {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px;
    border-radius: 22px; background: var(--surface); color: var(--ink); text-decoration: none;
    border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); box-shadow: var(--shadow-sm);
    transition: transform 0.15s var(--ease), box-shadow 0.2s ease;
    -webkit-user-select: none; user-select: none;
}
.occasion-card:active { transform: scale(0.98); }
@media (hover: hover) { .occasion-card:hover { color: var(--ink); box-shadow: var(--shadow); } }
.occasion-emoji {
    display: grid; place-items: center; width: 54px; height: 54px; border-radius: 17px;
    background: var(--accent-softer); font-size: 1.8rem; line-height: 1;
}
.occasion-card h2, .occasion-card h3 { margin: 0; font-size: 1.1rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.occasion-when { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.occasion-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
.occasion-foot .meter-track { flex: 1; }
.occasion-foot .done-text { color: var(--muted); font-size: 0.85rem; font-weight: 500; white-space: nowrap; }
.countdown { color: var(--accent); font-weight: 600; }
.countdown.is-soon { display: inline-block; padding: 0 8px; border-radius: 999px; background: var(--accent-soft); }
.occasion-card .row-chevron { align-self: center; }

.meter-track { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 3px; background: var(--good); transform-origin: left; transition: transform 0.5s var(--ease); }
/* The fill's width comes from a class: inline styles aren't allowed. */
.meter-fill { width: 100%; transform: scaleX(0); }
.fill-1 { transform: scaleX(0.1); } .fill-2 { transform: scaleX(0.2); } .fill-3 { transform: scaleX(0.3); }
.fill-4 { transform: scaleX(0.4); } .fill-5 { transform: scaleX(0.5); } .fill-6 { transform: scaleX(0.6); }
.fill-7 { transform: scaleX(0.7); } .fill-8 { transform: scaleX(0.8); } .fill-9 { transform: scaleX(0.9); }
.fill-10 { transform: scaleX(1); }

/* The ring on an occasion's page: how many people are sorted. */
.summary {
    display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center; padding: 16px;
    border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm);
    border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.summary > .btn, .summary > form, .summary > .status-box { grid-column: 1 / -1; }
.summary > form .btn { width: 100%; }
.summary p { margin: 0; }
.summary-title { font-weight: 700; font-size: 1.05rem; }
.summary-text { color: var(--muted); font-size: 0.9rem; }
.ring { position: relative; width: 58px; height: 58px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring .ring-track { stroke: var(--surface-2); }
.ring .ring-fill { stroke: var(--good); stroke-linecap: round; transition: stroke-dashoffset 0.6s var(--ease); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 0.9rem; }

.status-box {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm);
    background: var(--surface-2); font-weight: 500;
}
.status-box.failed { background: var(--bad-soft); color: var(--bad); }
.spinner {
    flex: none; width: 20px; height: 20px; border-radius: 50%;
    border: 2.5px solid var(--line-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite;
}
.chip .spinner { width: 12px; height: 12px; border-width: 2px; }

/* ---------------------------------------------------------------------------
   One person's gifts
--------------------------------------------------------------------------- */
.person-card {
    display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 14px; padding: 16px;
    border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm);
    border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.person-about { margin: 0; color: var(--ink-2); font-size: 0.97rem; }
.person-about-wrap { min-width: 0; align-self: center; }
.more-toggle { margin-top: 2px; font-size: 0.92rem; }
.person-card .pills { grid-column: 1 / -1; }
@media (scripting: enabled) {
    .clamp:not(.is-open) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
}

/* Finding ideas: the button, and what Ollie's doing while he looks. */
.search-panel { margin-top: 18px; scroll-margin-top: calc(var(--safe-top) + var(--appbar-h) + 16px); }
.search-cta {
    display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 16px; border-radius: var(--radius);
    background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.search-cta p { margin: 0; flex: 1; min-width: 0; font-size: 0.92rem; color: var(--muted); }
.search-cta strong { display: block; color: var(--ink); font-size: 1rem; }
.search-cta .btn { flex: none; }
.search-first { padding: 26px 20px 22px; border-radius: 24px; background: var(--surface); text-align: center; box-shadow: var(--shadow-sm); }
.search-first .ollie { width: 76px; height: 76px; margin: 0 auto 10px; display: block; }
.search-first h2 { margin: 0 0 6px; }
.search-first p { color: var(--muted); margin: 0 auto 16px; max-width: 36ch; }
.search-first form .btn { width: 100%; max-width: 360px; }
.search-meta { margin: 10px 2px 0; color: var(--muted); font-size: 0.85rem; }
.search-meta:empty { display: none; }

.working {
    padding: 22px 18px 18px; border-radius: 24px; background: var(--surface); text-align: center; box-shadow: var(--shadow-sm);
    border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.working .ollie { display: block; width: 76px; height: 76px; margin: 0 auto 8px; }
.working-text { margin: 0 auto 16px; max-width: 34ch; font-weight: 600; font-size: 1.02rem; min-height: 3em; }
.working-note { margin: 12px 0 0; color: var(--muted); font-size: 0.85rem; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; padding: 0; list-style: none; text-align: center; }
.steps li { font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.steps li::before {
    content: ""; display: block; height: 6px; margin-bottom: 7px; border-radius: 3px; background: var(--surface-2);
}
.steps li.is-done { color: var(--good); }
.steps li.is-done::before { background: var(--good); }
.steps li.is-current { color: var(--accent); }
.steps li.is-current::before {
    background: linear-gradient(90deg, var(--accent-soft) 0%, var(--accent) 50%, var(--accent-soft) 100%) 0 0 / 200% 100%;
    animation: shimmer 1.4s linear infinite;
}

/* While the first search runs: what to do with the ideas when they come. */
.coach { margin-top: 18px; }
.coach .label { margin: 0 2px 10px; }
.tip {
    width: min(78vw, 290px); padding: 14px 16px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm);
    border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); font-size: 0.92rem;
}
.tip-icon { display: block; font-size: 1.5rem; margin-bottom: 6px; }
.tip p { margin: 0; }
.tip .btn { margin-top: 10px; }

/* Ollie's ideas, which also filter what's shown. */
.ideas-block { margin: 26px 0 0; }
.idea {
    display: flex; flex-direction: column; gap: 3px; width: min(70vw, 250px); padding: 12px 14px;
    border: 1.5px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink);
    font: inherit; text-align: left; cursor: pointer; box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s var(--ease);
    -webkit-user-select: none; user-select: none;
}
.idea:active { transform: scale(0.98); }
.idea strong { font-size: 0.95rem; line-height: 1.3; }
.idea span { color: var(--muted); font-size: 0.84rem; line-height: 1.4; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.idea .idea-count { color: var(--accent); font-weight: 700; font-size: 0.78rem; display: block; margin-top: 2px; }
.idea[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-softer); }
.idea-all { width: auto; min-width: 104px; justify-content: center; align-items: center; text-align: center; }
.idea-all strong { font-size: 0.95rem; }
.ideas-static .idea { cursor: default; }
@media (scripting: none) { .idea-all { display: none; } .idea { cursor: default; } }
/* Quick answers fill in a field for you; without JavaScript, the field is all there is. */
@media (scripting: none) { [data-fill] { display: none; } }

.all-sorted {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius);
    background: var(--good-soft); color: var(--good); font-weight: 600;
}
.all-sorted p { margin: 0; }
.all-sorted span { font-size: 1.4rem; }
.filter-empty { padding: 16px; color: var(--muted); text-align: center; }

/* Products: big cards (Ollie's picks) by default; tiles and rows by where they sit. */
.products { display: grid; gap: 14px; list-style: none; margin: 0; padding: 0; }
.product {
    position: relative; display: flex; flex-direction: column; min-width: 0;
    background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-sm);
    border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    scroll-margin-top: calc(var(--safe-top) + var(--appbar-h) + 16px);
    transition: opacity 0.2s ease;
}
.product-image {
    position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden;
    border-radius: 21px 21px 0 0; background: var(--surface-2);
}
.product-image img { display: block; width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }
.product-image .placeholder { display: grid; place-items: center; height: 100%; font-size: 2.4rem; }
.product-body { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; min-width: 0; }
.product-title { margin: 0; font-size: 1.05rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.product-title a { color: inherit; text-decoration: none; }
.product-meta { display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; margin: 0; color: var(--muted); font-size: 0.9rem; }
.product-price { color: var(--ink); font-weight: 700; font-size: 1rem; }
.product-shop { color: var(--muted); text-decoration: none; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.product-shop .icon { width: 13px; height: 13px; vertical-align: -1px; margin-left: 2px; }
a.product-shop:active { color: var(--accent); }
.product-reason {
    position: relative; margin: 4px 0 0; padding: 10px 12px 10px 42px; border-radius: 14px;
    background: var(--accent-softer); color: var(--ink-2); font-size: 0.93rem; line-height: 1.45;
}
.product-reason::before {
    content: ""; position: absolute; left: 10px; top: 9px; width: 24px; height: 24px;
    background: url("ollie.svg") center / contain no-repeat;
}
.product-idea { margin: 0; color: var(--muted); font-size: 0.8rem; }
.product-idea .icon { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }
.product-feedback { margin: 0; color: var(--muted); font-size: 0.86rem; font-style: italic; }
.product-bought { margin: 0; color: var(--good); font-size: 0.86rem; font-weight: 600; }
.product-bought .icon { width: 15px; height: 15px; vertical-align: -3px; stroke-width: 3; }
.product-idea-why { margin: 0; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); font-size: 0.9rem; color: var(--ink-2); }
.product-idea-why strong { display: block; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }

.product-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 10px; align-items: center; }
.product-actions > form { margin: 0; display: flex; }
.product-actions .btn { min-height: 44px; }
.act-grow { flex: 1 1 0; min-width: 0; }
.act-grow > .btn, .act-grow > summary { width: 100%; }
/* On a pick, the shop is a small square button after Pass and Keep. */
.product-actions > .act-link { flex: none; width: 48px; padding: 0; }
.product-actions > .act-link .act-label { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.product.is-bought { border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.product.is-rejected .product-image img { filter: grayscale(0.6); opacity: 0.75; }

/* Pass: a sheet with quick reasons (app.js), or this form in place. */
.pass { position: relative; }
.pass > summary { list-style: none; }
.pass > summary::-webkit-details-marker { display: none; }
.pass[open] > summary { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pass[open] { flex: 1 0 100%; order: 5; }
.pass-form { display: grid; gap: 10px; margin-top: 10px; padding: 14px; border-radius: 16px; background: var(--surface-2); }
.pass-form label { font-weight: 600; font-size: 0.9rem; }
.pass-form .pills .pill { background: var(--surface); }
.pass-row { display: flex; gap: 8px; }
.pass-row input { flex: 1; min-width: 0; }
.pass-row .btn { flex: none; }
.pass-item { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 10px; border-radius: 16px; background: var(--surface-2); }
.pass-item img, .pass-item .placeholder { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex: none; background: var(--surface-3); display: grid; place-items: center; }
.pass-item p { margin: 0; font-weight: 600; line-height: 1.3; }
.sheet .pass-form { margin: 0; padding: 0; background: none; }
.sheet .pass-form .pills .pill { min-height: 42px; padding: 8px 15px; font-size: 0.95rem; background: var(--surface); }

/* Swiping a card: stamps say which way it's going. */
.product[data-swipe] { touch-action: pan-y; -webkit-touch-callout: none; }
.stamp {
    position: absolute; top: 16px; z-index: 3; padding: 5px 12px; border: 3px solid currentColor; border-radius: 12px;
    background: color-mix(in srgb, var(--surface) 88%, transparent); font-size: 1.05rem; font-weight: 800; letter-spacing: 0.06em;
    text-transform: uppercase; opacity: 0; pointer-events: none; transition: opacity 0.12s ease, transform 0.15s var(--spring);
}
.stamp-right { left: 16px; color: var(--good); transform: rotate(-10deg) scale(0.9); }
.stamp-left { right: 16px; color: var(--bad); transform: rotate(10deg) scale(0.9); }
.product.is-dragging { transition: none; transform: translateX(var(--dx, 0)) rotate(calc(var(--swipe, 0) * 5deg)); z-index: 5; box-shadow: var(--shadow-lg); }
.product:is(.is-dragging, .is-flying) .stamp-right { opacity: clamp(0, calc(var(--swipe, 0) * 2.2), 1); }
.product:is(.is-dragging, .is-flying) .stamp-left { opacity: clamp(0, calc(var(--swipe, 0) * -2.2), 1); }
.product.is-armed .stamp-right, .product.is-armed .stamp-left { transform: rotate(0deg) scale(1.08); }
.product.is-settling { transition: transform 0.4s var(--spring); }
.product.is-flying { transform: translateX(var(--dx, 0)) rotate(calc(var(--swipe, 0) * 5deg)); z-index: 5; }
.product.is-paged, .product.is-filtered, [data-part].is-filtered-out { display: none; }

.swipe-hint {
    display: flex; align-items: center; justify-content: center; gap: 10px; margin: -2px 0 12px; color: var(--muted); font-size: 0.85rem; font-weight: 500;
}
.swipe-hint b { color: var(--good); } .swipe-hint i { color: var(--bad); font-style: normal; font-weight: 700; }
.swipe-hint { display: none; }
@media (pointer: coarse) and (scripting: enabled) { .swipe-hint { display: flex; } }
.product.is-nudging { animation: nudge 1.6s var(--ease) 0.6s 1 both; }

/* Tiles: two across on a phone, the rest to browse. */
.products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.products-grid .product { border-radius: 18px; }
.products-grid .product-image { aspect-ratio: 1; border-radius: 17px 17px 0 0; }
.products-grid .product-body { gap: 2px; padding: 10px 11px 11px; }
.products-grid .product-title { font-size: 0.9rem; font-weight: 600; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.products-grid .product-meta { gap: 0 6px; font-size: 0.8rem; flex-wrap: nowrap; min-width: 0; }
.products-grid .product-price { font-size: 0.88rem; }
.products-grid .product-reason, .products-grid .product-idea, .products-grid .stamp { display: none; }
.products-grid .product-feedback, .products-grid .product-bought { font-size: 0.8rem; }
.products-grid .product-actions { gap: 6px; padding-top: 8px; flex-wrap: nowrap; }
.products-grid .product-actions .btn, .products-grid .pass > summary { min-height: 38px; padding: 6px 8px; font-size: 0.85rem; }
.products-grid .act-label { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.products-grid .act-link { display: none; }
.products-grid .pass[open] { position: static; }
.products-grid .pass[open] .pass-form { position: relative; z-index: 2; }
.products-grid .product:has(.pass[open]) { grid-column: 1 / -1; }

/* Rows: the shortlist and what's been bought. */
.products-rows { gap: 0; overflow: hidden; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.products-rows .product {
    display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 12px;
    border: 0; border-radius: 0; box-shadow: none; background: var(--surface);
}
.products-rows .product + .product::before { content: ""; position: absolute; top: 0; left: 88px; right: 0; border-top: 0.5px solid var(--line); }
.products-rows .product-image { width: 64px; height: 64px; aspect-ratio: auto; border-radius: 14px; }
.products-rows .product-image .placeholder { font-size: 1.6rem; }
.products-rows .product-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; padding: 0; }
.products-rows .product-title { grid-column: 1; font-size: 0.95rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.products-rows .product-meta { grid-column: 1; font-size: 0.82rem; flex-wrap: nowrap; }
.products-rows .product-price { font-size: 0.9rem; }
.products-rows .product-bought { grid-column: 1; font-size: 0.82rem; }
.products-rows .product-actions { grid-column: 2; grid-row: 1 / span 3; margin: 0; padding: 0; gap: 6px; flex-wrap: nowrap; }
.products-rows .product-actions .btn { min-height: 38px; padding: 6px 13px; font-size: 0.88rem; }
.products-rows .product-reason, .products-rows .product-idea, .products-rows .product-feedback, .products-rows .act-extra { display: none; }
.products-rows .act-icon .act-label { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.products-rows .act-icon .btn { width: 38px; padding: 0; }
.products-rows .stamp { top: 50%; margin-top: -18px; font-size: 0.85rem; }
.products-rows .product.is-dragging { transform: translateX(var(--dx, 0)); box-shadow: var(--shadow); }
.products-rows .product.is-flying { transform: translateX(var(--dx, 0)); }

/* A product opened in a sheet: everything about it, with every action. */
.product.is-detail { border: 0; box-shadow: none; background: none; }
.product.is-detail .product-image { border-radius: 18px; aspect-ratio: 4 / 3; }
.product.is-detail .product-body { padding: 14px 0 0; gap: 8px; }
.product.is-detail .product-title { font-size: 1.25rem; font-weight: 700; }
.product.is-detail .stamp { display: none; }
.product.is-detail .act-label, .product.is-detail .product-actions > .act-link .act-label { position: static !important; width: auto; height: auto; clip: auto; overflow: visible; }
.product.is-detail .product-actions > .act-link { width: auto; padding: 11px 22px; }
.product.is-detail .act-link, .product.is-detail .act-extra { display: flex; }
.product.is-detail .product-actions { padding-top: 14px; }
.product.is-detail .product-actions > * { flex: 1 1 calc(50% - 4px); }
.product.is-detail .product-actions > .act-wide { flex-basis: 100%; }
.product.is-detail .product-actions .btn, .product.is-detail .pass > summary { width: 100%; min-height: 50px; }

/* Folded away until wanted: earlier ideas, passes, past years. */
.fold { margin-top: 14px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.fold > summary {
    display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 16px; list-style: none; cursor: pointer;
    font-weight: 600; -webkit-user-select: none; user-select: none;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary .icon { margin-left: auto; color: var(--faint); transition: transform 0.25s var(--ease); }
.fold[open] > summary .icon { transform: rotate(180deg); }
.fold > summary small { color: var(--muted); font-weight: 500; }
.fold-body { padding: 2px 12px 14px; }
.fold-body > .products { margin-top: 0; }
.fold-first { margin-top: 30px; }

/* The big button that floats above the tabs. */
.fab {
    position: fixed; right: max(16px, var(--safe-right)); bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px); z-index: 45;
    display: inline-flex; align-items: center; gap: 8px; min-height: 54px; padding: 0 22px 0 18px;
    border-radius: 999px; background: var(--accent); color: var(--accent-ink);
    font-weight: 700; font-size: 1rem; text-decoration: none;
    box-shadow: 0 12px 28px -8px color-mix(in srgb, var(--accent) 70%, transparent), 0 3px 8px rgba(0, 0, 0, 0.14);
    transition: transform 0.3s var(--ease), opacity 0.2s ease;
    -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.fab .icon { width: 22px; height: 22px; }
.fab:active { transform: scale(0.95); }
.fab.is-hidden { transform: translateY(calc(100% + 30px)); opacity: 0; pointer-events: none; }
@media (hover: hover) { .fab:hover { color: var(--accent-ink); background: var(--accent-hover); } }
.has-keyboard .fab { display: none; }

/* A celebration when something's bought. */
.confetti { position: fixed; z-index: 160; width: 9px; height: 13px; border-radius: 2px; pointer-events: none; }

/* ---------------------------------------------------------------------------
   Plan and credits
--------------------------------------------------------------------------- */
.balance {
    position: relative; overflow: hidden; padding: 22px 20px 20px; border-radius: 26px; color: #fff;
    background: linear-gradient(135deg, #b9360f 0%, #e0552a 55%, #f07a45 100%);
    box-shadow: 0 18px 40px -18px rgba(200, 64, 26, 0.7);
}
.balance::after {
    content: ""; position: absolute; right: -30px; bottom: -40px; width: 170px; height: 170px; opacity: 0.18;
    background: url("ollie.svg") center / contain no-repeat;
}
.balance p { margin: 0; position: relative; z-index: 1; }
.balance-label { font-size: 0.85rem; font-weight: 600; opacity: 0.9; text-transform: uppercase; letter-spacing: 0.06em; }
.balance-number { margin: 4px 0 2px; font-size: 3.1rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.balance-sub { opacity: 0.92; font-size: 0.95rem; }
.balance .chip { background: rgba(255, 255, 255, 0.22); color: #fff; }
.balance-actions { position: relative; z-index: 1; margin-top: 18px; display: grid; gap: 8px; }
.balance-actions .btn { background: #fff; color: #b9360f; border-color: transparent; }
.balance-actions .btn-plain { background: rgba(255, 255, 255, 0.2); color: #fff; }
.balance .meter-track { margin-top: 14px; background: rgba(255, 255, 255, 0.25); position: relative; z-index: 1; }
.balance .meter-fill { background: #fff; }
.balance-note { margin-top: 8px !important; font-size: 0.85rem; opacity: 0.9; }

.stat { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pack { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 8px 12px; border-radius: 18px; background: var(--surface); text-align: center; box-shadow: var(--shadow-sm); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.pack .stat { font-size: 1.45rem; }
.pack p { margin: 0 0 10px; color: var(--muted); font-size: 0.8rem; }
.pack form { width: 100%; }
.pack .btn { width: 100%; min-height: 40px; padding: 8px 6px; font-size: 0.9rem; }
.ledger-amount { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.pack-note { margin: -2px 16px 12px; }
.fold-body > .group { box-shadow: none; border: 0; background: none; }
.fold-body > .group .row { background: none; padding-left: 4px; padding-right: 4px; }
.plus { color: var(--good); }
.prose { color: var(--ink-2); font-size: 0.95rem; }
.prose p { margin: 0 0 0.8em; }

/* ---------------------------------------------------------------------------
   The welcome steps and signing in: full screen, one thing at a time
--------------------------------------------------------------------------- */
.onboard { max-width: 560px; margin: 0 auto; }
.onboard-head { text-align: center; padding: 6px 0 22px; }
.onboard-head .ollie { display: block; width: 92px; height: 92px; margin: 0 auto 10px; }
.onboard-head h1 { font-size: 1.9rem; }
.onboard-head .lead { margin: 8px auto 0; max-width: 34ch; color: var(--muted); font-size: 1.05rem; }

.journey { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 14px; }
.journey li { display: flex; align-items: center; gap: 12px; }
.journey-mark {
    flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
    background: var(--surface-2); color: var(--muted); font-size: 0.9rem; font-weight: 700;
}
.journey .is-done { color: var(--muted); }
.journey .is-done .journey-mark { background: var(--good-soft); color: var(--good); }

.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.field-pills { margin-top: 10px; }
.pager-count { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em; }
.onboard form > .field:first-of-type { margin-top: 22px; }

/* The main button at the bottom of the screen, where a thumb reaches. */
.cta-bar {
    position: sticky; bottom: 0; z-index: 5; display: grid; gap: 6px;
    margin: 22px calc(-1 * var(--gutter)) 0; padding: 14px var(--gutter) calc(14px + var(--safe-bottom));
    background: linear-gradient(to top, var(--bg) 72%, color-mix(in srgb, var(--bg) 0%, transparent));
}
.cta-bar .btn { width: 100%; }
.cta-bar .cta-row { display: flex; gap: 10px; }
.cta-bar .cta-row .btn { flex: 1; }
.cta-bar .cta-row .btn-ghost { flex: 0 0 auto; width: auto; }
.card .cta-bar { margin-left: -18px; margin-right: -18px; margin-bottom: -18px; padding-left: 18px; padding-right: 18px; border-radius: 0 0 var(--radius) var(--radius); background: linear-gradient(to top, var(--surface) 72%, transparent); }

/* The three questions, one at a time (app.js). */
.pager .page { border: 0; margin: 0; padding: 0; min-width: 0; }
.pager .page + .page { margin-top: 30px; }
.pager .page legend { width: 100%; padding: 0; margin: 0 0 16px; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
.pager.is-ready .page { display: none; }
.pager.is-ready .page.is-current { display: block; margin-top: 0; animation: page-in 0.35s var(--ease); }
.pager.is-ready .page.is-current.is-back { animation-name: page-back; }
.pager-count { margin: 0 0 8px; color: var(--accent); font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }

.auth { max-width: 420px; margin: 0 auto; padding-top: 4px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head .ollie { display: block; width: 84px; height: 84px; margin: 0 auto 12px; }
.auth-head h1 { font-size: 1.9rem; margin-bottom: 6px; }
.auth-head p { margin: 0 auto; max-width: 32ch; color: var(--muted); }
.auth-offer {
    display: flex; align-items: center; gap: 10px; max-width: 360px; margin: 14px auto 0 !important; padding: 10px 14px; border-radius: 16px;
    background: var(--accent-soft); color: var(--ink) !important; font-weight: 600; font-size: 0.92rem; line-height: 1.35; text-align: left;
}
.auth-offer span { font-size: 1.4rem; }
.auth-alt { margin: 20px 0 0; text-align: center; color: var(--muted); }
.auth-alt a { font-weight: 600; text-decoration: none; }
.after-card { text-align: center; margin-top: 16px; }

.error-page { max-width: 420px; margin: 8vh auto 0; text-align: center; }
.error-page .ollie { display: block; width: 96px; height: 96px; margin: 0 auto 14px; }
.error-page p { color: var(--muted); }

/* ---------------------------------------------------------------------------
   Footer: on bigger screens, and before signing in. On a phone the Account
   tab has the same links.
--------------------------------------------------------------------------- */
.site-footer { padding: 20px 0 calc(20px + var(--safe-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; }
.site-footer p { margin: 0; }
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.has-tabs .site-footer, .is-focus .site-footer { display: none; }
@media (display-mode: standalone) { .site-footer { display: none; } }

/* ---------------------------------------------------------------------------
   Tablets and bigger
--------------------------------------------------------------------------- */
@media (min-width: 768px) {
    :root { --appbar-h: 64px; --gutter: 28px; }
    h1 { font-size: 2.4rem; }
    .main { padding-top: 12px; }
    .has-tabs .main, .has-fab .main { padding-bottom: 72px; }
    .appbar-title { display: none; }
    .appbar.has-back .credits-pill { display: inline-flex; }
    .is-focus .appbar-title { display: block; }

    /* The tabs float at the top, like iPadOS. */
    .tabbar {
        top: calc(var(--safe-top) + (var(--appbar-h) - 44px) / 2); bottom: auto; left: 50%; right: auto; z-index: 60;
        gap: 2px; height: 44px; padding: 4px; border-radius: 999px; transform: translateX(-50%);
        background: color-mix(in srgb, var(--surface) 88%, transparent);
        box-shadow: 0 0 0 0.5px var(--line), 0 6px 20px -8px rgba(0, 0, 0, 0.2);
    }
    .tab { flex-direction: row; gap: 7px; min-height: 36px; padding: 0 16px; border-radius: 999px; font-size: 0.92rem; color: var(--ink); }
    .tab .icon { width: 20px; height: 20px; }
    .tab[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
    .has-keyboard .tabbar,
    body:has(:is(input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"]), textarea, select):focus) .tabbar { transform: translateX(-50%); }

    .toasts, .has-tabs .toasts { bottom: calc(var(--safe-bottom) + 24px); }
    .has-fab .toasts { bottom: calc(var(--safe-bottom) + 96px); }
    .fab { bottom: calc(var(--safe-bottom) + 24px); right: max(28px, var(--safe-right)); }

    .page-title { padding-bottom: 22px; }
    .occasion-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .banner { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 20px 22px; }
    .banner > :first-child { flex: 1 1 auto; min-width: 0; }
    .banner-actions { flex: 0 0 min(280px, 42%); }
    .banner-compact .pitch + .pitch, .banner-compact .banner-actions .small { display: block; }
    .banner-compact .banner-more { display: inline; }
    .products { gap: 18px; }
    .products-rows { gap: 0; }
    .products-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
    .products-rows .product-actions .act-extra { display: flex; }
    .products-rows .product-actions .act-extra .act-label { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .products-rows .product-actions .act-extra .btn { width: 38px; padding: 0; }
    .person-card { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; padding: 18px 20px; }
    .person-card .pills { grid-column: auto; justify-content: flex-end; }
    .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .onboard-head h1, .auth-head h1 { font-size: 2.2rem; }
    .idea { width: 240px; }
    .tip { width: 280px; }
    .scroller { margin: 0; padding-left: 0; padding-right: 0; flex-wrap: wrap; overflow: visible; }
    .card { padding: 22px; }
    .card .cta-bar { margin-left: -22px; margin-right: -22px; margin-bottom: -22px; padding-left: 22px; padding-right: 22px; }
}

@media (min-width: 1100px) {
    .occasion-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .products-picks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .products-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------------------
   Moving between pages, and other motion
--------------------------------------------------------------------------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 0.16s ease both vt-out; }
::view-transition-new(root) { animation: 0.28s var(--ease) both vt-in; }
::view-transition-group(appbar), ::view-transition-group(tabbar) { animation-duration: 0.2s; }

@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes sheet-pop { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
@keyframes sheet-unpop { to { opacity: 0; transform: scale(0.97); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(24px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px) scale(0.98); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes pop-in { 0% { opacity: 0; transform: scale(0.6) rotate(-8deg); } 100% { opacity: 1; transform: none; } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes page-in { from { opacity: 0; transform: translateX(28px); } }
@keyframes page-back { from { opacity: 0; transform: translateX(-28px); } }
@keyframes nudge {
    0%, 100% { transform: none; }
    20% { transform: translateX(-26px) rotate(-1.5deg); }
    45% { transform: translateX(26px) rotate(1.5deg); }
    65% { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
    *, *::before, *::after, ::backdrop {
        animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important; scroll-behavior: auto !important;
    }
    .spinner, .btn.is-busy::after { animation-duration: 1.5s !important; animation-iteration-count: infinite !important; }
}
