/* App-level pieces the UI kit doesn't cover. Every color, radius and space is a token from design/tokens.css. */

html, body { min-height: 100%; }
body { overflow-x: hidden; }
.bt [hidden] { display: none !important; }
.bt a { color: var(--accent); }
.bt h1, .bt h2, .bt h3, .bt p { margin: 0; }

.screen { display: grid; gap: var(--space-4); padding-top: var(--space-4); }
.screen__title { font: 800 28px/32px var(--font-display); letter-spacing: -.3px; }
.screen__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.helper { color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.muted { color: var(--ink-muted); }
.label { font: 700 12px/16px var(--font-sans); letter-spacing: .6px; text-transform: uppercase; color: var(--ink-muted); }
.stack { display: grid; gap: var(--space-3); }
.row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- Admin bar ---------- */
.admin-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); background: var(--ink); color: var(--bg); font: 700 11px/16px var(--font-sans); letter-spacing: .6px; text-transform: uppercase; }
.admin-bar a { color: var(--bg); text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; }
.admin-bar__status { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; opacity: .85; }
.admin-bar__status button { margin-left: var(--space-2); background: none; border: 1px solid currentColor; color: inherit; border-radius: var(--radius-sm); padding: 2px 8px; font: inherit; cursor: pointer; }

/* ---------- Banner (errors, notices) ---------- */
.banner { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--vote-down); color: var(--ink); }
.banner p { flex: 1; }

/* ---------- Plan hero ---------- */
.hero { position: relative; margin: 0 calc(var(--space-4) * -1); min-height: 196px; display: flex; flex-direction: column; justify-content: flex-end; gap: var(--space-3); padding: var(--space-4); background: var(--surface-sunken); overflow: hidden; }
.hero.bt-scene { background: var(--surface-sunken); }
.hero__top { position: absolute; top: var(--space-4); left: var(--space-4); right: var(--space-4); display: flex; justify-content: space-between; gap: var(--space-2); }
.hero__chip { display: inline-flex; align-items: center; min-height: 28px; padding: 0 var(--space-3); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); border: 1px solid var(--line); font: 600 12px/1 var(--font-sans); text-decoration: none; cursor: pointer; }
.hero__card { position: relative; background: var(--surface); border-radius: var(--radius-md); padding: var(--space-3); display: grid; gap: 2px; }
.hero__card .bt-hero__title { font-size: 28px; line-height: 32px; }
.hero__card .row { margin-top: var(--space-2); }
@media (min-width: 640px) { .hero { margin: 0; border-radius: var(--radius-lg); min-height: 240px; } }
@media (min-width: 1024px) { .hero { margin-top: var(--space-6); min-height: 280px; } .hero__card .bt-hero__title { font-size: 44px; line-height: 48px; } }

/* ---------- Plan layout ---------- */
.plan-grid { display: grid; gap: var(--space-4); }
.plan-grid > * { min-width: 0; }
.plan-grid .bt-card + .bt-card { margin-top: 0; }
@media (min-width: 1024px) { .plan-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; } }
.day-head { display: grid; gap: 2px; }
.day-head__date { font-size: 13px; color: var(--ink-muted); }
.day-head__title { font: 800 24px/30px var(--font-display); }
.day-head__plan { color: var(--ink); white-space: pre-line; margin-top: var(--space-1); }

/* Schedule rows as buttons in admin */
.sched-edit { display: block; width: 100%; background: none; border: 0; padding: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; border-radius: var(--radius-sm); }
.sched-edit:hover { background: var(--surface-sunken); }
.who-all { font: 600 12px/26px var(--font-sans); color: var(--ink-muted); white-space: nowrap; }

/* Notes, links & places */
.things { display: grid; gap: var(--space-2); }
.thing { display: flex; align-items: center; gap: var(--space-3); min-height: 56px; padding: var(--space-2) var(--space-3); background: var(--surface-sunken); border-radius: var(--radius-md); color: var(--ink); text-decoration: none; border: 0; width: 100%; text-align: left; font: inherit; }
.bt a.thing { color: var(--ink); }
a.thing:hover, button.thing:hover { filter: brightness(.97); }
button.thing { cursor: pointer; }
.thing__icon { width: 36px; height: 36px; flex: 0 0 auto; border-radius: var(--radius-sm); background: var(--surface); display: grid; place-items: center; color: var(--ink-muted); }
.thing__icon svg { width: 20px; height: 20px; }
.thing__body { flex: 1; min-width: 0; }
.thing__label { font-weight: 650; overflow-wrap: anywhere; }
.thing__sub { font-size: 13px; color: var(--ink-muted); overflow-wrap: anywhere; white-space: pre-line; }
.thing__go { color: var(--ink-muted); flex: 0 0 auto; }

.open-votes a { display: flex; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; }
.open-votes a:first-of-type { border-top: 0; }

/* ---------- Crew ---------- */
.bt-profile__photo span.initials { display: grid; justify-items: center; gap: var(--space-1); }
.no-photo { font: 600 11px/14px var(--font-sans); color: var(--ink-muted); }
.add-guy { min-height: 100%; border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); background: transparent; color: var(--ink-muted); font: 650 15px/22px var(--font-sans); display: grid; place-items: center; gap: var(--space-2); padding: var(--space-6) var(--space-3); cursor: pointer; }
.add-guy svg { width: 28px; height: 28px; }

/* ---------- Profile ---------- */
.profile-top { position: relative; margin: 0 calc(var(--space-4) * -1); aspect-ratio: 1 / 1; max-height: 420px; width: calc(100% + var(--space-4) * 2); background: var(--surface-sunken); display: grid; place-items: center; overflow: hidden; color: var(--ink-muted); font: 800 72px/1 var(--font-display); }
.profile-top img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.profile-top__bar { position: absolute; top: var(--space-4); left: var(--space-4); right: var(--space-4); display: flex; justify-content: space-between; }
@media (min-width: 640px) { .profile-top { margin: var(--space-4) 0 0; width: 100%; border-radius: var(--radius-lg); max-width: 420px; } }
.profile-name { font: 800 28px/32px var(--font-display); }
.buying a { display: flex; justify-content: space-between; padding: var(--space-2) 0; border-top: 1px solid var(--line); text-decoration: none; font-weight: 600; }
.buying a:first-of-type { border-top: 0; }
.contact { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.contact .bt-btn { text-decoration: none; }

/* ---------- Groceries ---------- */
.progress-line { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: var(--space-2); }
.pills { display: flex; gap: var(--space-2); flex-wrap: wrap; margin: var(--space-4) 0; }
.pill { min-height: 36px; padding: 0 var(--space-4); border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 600 14px/1 var(--font-sans); cursor: pointer; }
.pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.mark { width: 24px; height: 24px; flex: 0 0 auto; border-radius: var(--radius-sm); display: grid; place-items: center; }
.mark--done { background: var(--accent); color: var(--on-accent); }
.mark--done::after { content: ""; width: 6px; height: 11px; border: solid var(--on-accent); border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.mark--open { border: 2px dashed var(--line-strong); }
.grocery-edit { background: none; border: 0; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; flex: 1; min-width: 0; }

/* ---------- Votes ---------- */
.vote-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-2); }
.status-chip--final { background: var(--accent-soft); color: var(--accent-ink); }
.result { padding: var(--space-3) 0; border-top: 1px solid var(--line); display: grid; gap: var(--space-2); }
.result:first-of-type { border-top: 0; }
.result__top { display: flex; align-items: center; gap: var(--space-2); }
.result__title { font: 650 17px/24px var(--font-sans); flex: 1; min-width: 0; overflow-wrap: anywhere; }
.result__title a { color: inherit; }
.result__score { font: 800 18px/22px var(--font-display); font-variant-numeric: tabular-nums; }
.result__score--pos { color: var(--vote-up); }
.result__score--neg { color: var(--vote-down); }
.winner { display: inline-block; padding: 3px 8px; border-radius: var(--radius-pill); background: var(--highlight); color: var(--on-highlight); font: 700 11px/1 var(--font-sans); letter-spacing: .4px; }
.result__bar { display: flex; align-items: center; gap: var(--space-2); font: 600 13px/18px var(--font-sans); font-variant-numeric: tabular-nums; }
.result__bar .up { color: var(--vote-up); }
.result__bar .down { color: var(--vote-down); }
.result__bar .bt-progress { flex: 1; }
.result__bar .bt-progress > span { background: var(--vote-up); }
.steppers { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; background: var(--surface-sunken); border-radius: var(--radius-pill); padding: 2px; }
.stepper button { width: 36px; height: 36px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--ink); font: 700 18px/1 var(--font-sans); cursor: pointer; }
.stepper button:hover { background: var(--surface); }
.stepper output { min-width: 56px; text-align: center; font: 700 14px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.stepper--up output { color: var(--vote-up); }
.stepper--down output { color: var(--vote-down); }

/* ---------- Media ---------- */
.intro-preview { width: 100%; aspect-ratio: 9 / 16; max-height: 420px; background: var(--surface-sunken); border-radius: var(--radius-md); object-fit: contain; border: 0; }
.bg-tile-wrap { position: relative; }
.bg-tile-del { position: absolute; top: var(--space-1); right: var(--space-1); width: 32px; height: 32px; border-radius: var(--radius-pill); border: 0; background: var(--surface); color: var(--ink); cursor: pointer; font: 700 16px/1 var(--font-sans); box-shadow: var(--shadow-card); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 44px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; margin: 0; border-radius: var(--radius-pill); background: var(--line-strong); position: relative; cursor: pointer; flex: 0 0 auto; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: var(--radius-pill); background: var(--surface); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }

/* ---------- Forms and sheets ---------- */
.field { display: grid; gap: var(--space-1); }
.field > span { font: 600 13px/18px var(--font-sans); color: var(--ink-muted); }
.field .bt-input { width: 100%; }
textarea.bt-input { min-height: 88px; padding: var(--space-2) var(--space-3); resize: vertical; }
select.bt-input { appearance: auto; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.seg { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.who-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-1) var(--space-3); max-height: 220px; overflow: auto; padding: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.who-picker label { display: flex; align-items: center; gap: var(--space-2); min-height: 36px; }
.danger { color: var(--vote-down); }
.bt-btn.danger { border-color: var(--vote-down); }
.option-row { display: flex; gap: var(--space-2); }

.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-float); }
.sheet::backdrop { background: var(--scrim); }
.sheet form { display: grid; gap: var(--space-4); padding: var(--space-4) var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom, 0px)); }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.sheet__title { font: 800 22px/28px var(--font-display); }
.sheet__actions { display: flex; gap: var(--space-2); justify-content: flex-end; flex-wrap: wrap; }
.sheet__actions .bt-btn--primary { flex: 1; }
@media (min-width: 640px) { .sheet { margin: auto; border-radius: var(--radius-lg); } }

/* ---------- Skeletons and empty states ---------- */
.skel { background: var(--surface-sunken); border-radius: var(--radius-lg); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

/* ---------- Intro video ---------- */
.intro { position: fixed; inset: 0; z-index: 50; background: var(--ink); display: flex; flex-direction: column; }
.intro video, .intro iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.intro__top { position: absolute; z-index: 1; top: calc(var(--space-4) + env(safe-area-inset-top, 0px)); left: var(--space-4); right: var(--space-4); display: flex; justify-content: space-between; }
.intro__top button { min-height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-pill); border: 0; background: var(--scrim); color: var(--on-scrim); font: 600 14px/1 var(--font-sans); cursor: pointer; }
.intro__sheet { position: relative; z-index: 1; margin-top: auto; padding: var(--space-6) var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, var(--scrim) 30%); color: var(--on-scrim); display: grid; gap: var(--space-3); }
.intro__title { font: 800 32px/36px var(--font-display); }
.intro__sheet .label { color: var(--on-scrim); }
.intro__sheet .bt-progress { background: var(--scrim); }
.intro__sheet .bt-btn { width: 100%; min-height: 52px; font-size: 17px; }

/* The trip title sits on its own card, so keep it ink-colored even over a photo. */
.bt-scene--has-img .hero__card .bt-hero__title { color: var(--ink); }
.bt-scene--has-img .hero__card .bt-hero__sub { color: var(--ink-muted); }
/* Admin schedule rows are buttons that keep the kit's row grid. */
.sched-edit.bt-sched-row { display: grid; }
.bt-schedule li:first-child > .sched-edit { border-top: 0; padding-top: 0; }
