/* YOLO Travel Club — colour tokens only below :root. scripts/css-tokens.mjs
   fails the build on a raw colour anywhere outside a token block. */

:root {
  --bg: #f7f3ec;
  --bg-2: #efe8dc;
  --card: #fffdf9;
  --ink: #1d1a16;
  --ink-2: #5b544a;
  --ink-3: #8c8478;
  --line: #e4dccd;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: #fbe7da;
  --ok: #15803d;
  --ok-soft: #dcf2e3;
  --warn: #b45309;
  --warn-soft: #fdf0d8;
  --bad: #b91c1c;
  --bad-soft: #fde2e2;
  --mine: #0e7490;
  --mine-soft: #d9f0f4;
  --shadow: 0 1px 2px rgba(29, 26, 22, .06), 0 8px 24px rgba(29, 26, 22, .07);
  --scrim: rgba(20, 17, 14, .45);
  --hero-fade: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, .72) 100%);
  --on-hero: #ffffff;
  --cat-transfer: #6d28d9;
  --cat-meal: #c2410c;
  --cat-activity: #0369a1;
  --cat-free: #15803d;
  --cat-spa: #be185d;
  --radius: 16px;
  --radius-s: 10px;
  --font-display: 'Fraunces', Georgia, serif;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --tabbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14120f;
    --bg-2: #1c1915;
    --card: #211d19;
    --ink: #f3ede4;
    --ink-2: #c4bbad;
    --ink-3: #8f877b;
    --line: #36302a;
    --accent: #f97316;
    --accent-ink: #1a0f06;
    --accent-soft: #3a2415;
    --ok: #4ade80;
    --ok-soft: #173222;
    --warn: #fbbf24;
    --warn-soft: #3a2d12;
    --bad: #f87171;
    --bad-soft: #3b1a1a;
    --mine: #22d3ee;
    --mine-soft: #0f2d33;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --scrim: rgba(0, 0, 0, .6);
    --cat-transfer: #a78bfa;
    --cat-meal: #fb923c;
    --cat-activity: #38bdf8;
    --cat-free: #4ade80;
    --cat-spa: #f472b6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14120f; --bg-2: #1c1915; --card: #211d19; --ink: #f3ede4; --ink-2: #c4bbad; --ink-3: #8f877b; --line: #36302a;
  --accent: #f97316; --accent-ink: #1a0f06; --accent-soft: #3a2415; --ok: #4ade80; --ok-soft: #173222; --warn: #fbbf24; --warn-soft: #3a2d12;
  --bad: #f87171; --bad-soft: #3b1a1a; --mine: #22d3ee; --mine-soft: #0f2d33; --scrim: rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --cat-transfer: #a78bfa; --cat-meal: #fb923c; --cat-activity: #38bdf8; --cat-free: #4ade80; --cat-spa: #f472b6;
  color-scheme: dark;
}

/* Trip skins — a trip's accent follows you through its screens. */
[data-trip="portugal"] { --accent: #1d4ed8; --accent-soft: #dde7fb; --accent-ink: #ffffff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) [data-trip="portugal"] { --accent: #60a5fa; --accent-soft: #172a4a; --accent-ink: #0b1526; } }
[data-trip="iceland"] { --accent: #0f766e; --accent-soft: #d5f0ec; --accent-ink: #ffffff; }
[data-trip="tropics"] { --accent: #0e7490; --accent-soft: #d6eff4; --accent-ink: #ffffff; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100vh; min-height: 100dvh;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; margin: 0; line-height: 1.15; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
p { margin: 0 0 .75em; }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); font-size: 13px; }
.small { font-size: 14px; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
#main { max-width: 760px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
.boot { padding: 40vh 0; text-align: center; color: var(--ink-3); }
.topbar { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; }
.topbar .grow { flex: 1; min-width: 0; }
.topbar h1 { font-size: 26px; }
.back { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; flex: none; }
.section { margin: 26px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section h2 { font-size: 20px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center; gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1; max-width: 120px; background: none; border: 0; padding: 6px 4px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--ink-3); position: relative;
}
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button.on { color: var(--accent); }
.tabbar .dot { position: absolute; top: 4px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--card); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.tight { padding: 12px 14px; }
.card.flat { box-shadow: none; }
.card.accent { background: var(--accent-soft); border-color: transparent; }
.card.warn { background: var(--warn-soft); border-color: transparent; }

.tripcard { position: relative; border-radius: 20px; overflow: hidden; min-height: 210px; display: flex; align-items: flex-end; background: var(--bg-2); box-shadow: var(--shadow); border: 0; width: 100%; padding: 0; text-align: left; }
.tripcard img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tripcard .fade { position: absolute; inset: 0; background: var(--hero-fade); }
.tripcard .txt { position: relative; padding: 18px; color: var(--on-hero); width: 100%; }
.tripcard h2 { font-size: 26px; }
.tripcard .meta { font-size: 14px; opacity: .92; margin-top: 4px; }
.tripcard.noimg .txt { color: var(--ink); }
.tripcard.noimg .fade { display: none; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; letter-spacing: .02em; background: var(--accent); color: var(--accent-ink); }
.pill.soft { background: var(--accent-soft); color: var(--accent); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }
.countdown { font-family: var(--font-display); font-size: 40px; line-height: 1; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px;
}
.btn.block { width: 100%; }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; flex: none; }
.iconbtn svg { width: 20px; height: 20px; }

label.f { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
input, textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }
.codebox { font-size: 28px; letter-spacing: 10px; text-align: center; font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 380px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- join ---------- */
.join-hero { margin: -16px -16px 0; padding: calc(56px + env(safe-area-inset-top)) 24px 36px; background: var(--ink); color: var(--bg); border-radius: 0 0 28px 28px; }
.join-hero .brand { font-family: var(--font-display); font-size: 54px; line-height: .95; letter-spacing: -.02em; }
.join-hero .brand span { color: var(--accent); }
.join-hero p { opacity: .8; margin-top: 12px; max-width: 32ch; }
.join-body { padding: 24px 0; }

/* ---------- trip hub ---------- */
.hero { position: relative; margin: -16px -16px 0; min-height: 260px; display: flex; align-items: flex-end; background: var(--bg-2); overflow: hidden; }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero .fade { position: absolute; inset: 0; background: var(--hero-fade); }
.hero .txt { position: relative; padding: 20px 18px 18px; color: var(--on-hero); width: 100%; }
.hero.noimg .txt { color: var(--ink); } .hero.noimg .fade { display: none; }
.hero .back { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 14px; background: var(--card); color: var(--ink); z-index: 2; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 14px 0 6px; scrollbar-width: none; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 99px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.tabs button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.days { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 12px; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.days button { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 8px 12px; text-align: center; min-width: 58px; }
.days button b { display: block; font-size: 18px; font-family: var(--font-display); }
.days button small { font-size: 11px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; }
.days button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.days button.on small { color: var(--accent-ink); opacity: .8; }
.days button.today:not(.on) { border-color: var(--accent); }

.dayhead { margin: 6px 0 14px; }
.dayhead .hotel { font-size: 14px; color: var(--ink-2); margin-top: 6px; }
.timeline { position: relative; }
.item { display: flex; gap: 12px; width: 100%; text-align: left; background: none; border: 0; padding: 0; margin-bottom: 12px; }
.item .time { width: 58px; flex: none; text-align: right; font-size: 13px; font-weight: 700; color: var(--ink-2); padding-top: 14px; }
.item .body { flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--cat, var(--accent)); border-radius: 14px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.item .body .t { font-weight: 700; }
.item .body .l { font-size: 13px; color: var(--ink-3); }
.item .thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; background: var(--bg-2); }
.item.mine .body { background: var(--mine-soft); border-color: transparent; border-left-color: var(--mine); }
.item.past { opacity: .55; }
.item.now .body { box-shadow: 0 0 0 2px var(--accent); }
.cat-transfer { --cat: var(--cat-transfer); } .cat-meal { --cat: var(--cat-meal); } .cat-activity { --cat: var(--cat-activity); } .cat-free { --cat: var(--cat-free); } .cat-spa { --cat: var(--cat-spa); }
.catlabel { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--cat); }

/* ---------- sheet (detail cards, forms) ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  background: var(--card); border-radius: 22px 22px 0 0; padding: 10px 18px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .25s ease; max-width: 760px; margin: 0 auto; overscroll-behavior: contain;
}
.sheet.on { transform: translateY(0); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet .close { position: sticky; top: 0; float: right; }
.gallery { display: flex; gap: 8px; overflow-x: auto; margin: 12px -18px; padding: 0 18px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gallery img { height: 220px; width: auto; max-width: 85vw; border-radius: 14px; object-fit: cover; scroll-snap-align: start; flex: none; background: var(--bg-2); }
.md h1, .md h2, .md h3 { margin: 14px 0 6px; font-size: 18px; }
.md ul, .md ol { padding-left: 20px; margin: 6px 0 12px; }
.md li { margin: 3px 0; }
.md p:last-child { margin-bottom: 0; }

/* ---------- board, chat ---------- */
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 46px; max-height: 160px; padding: 11px 14px; border-radius: 22px; }
.composer .send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); flex: none; display: grid; place-items: center; }
.composer .send svg, .composer .iconbtn svg { width: 20px; height: 20px; }
.composer .iconbtn { width: 46px; height: 46px; border-radius: 50%; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
.post { padding: 14px; }
.post.pinned { border-color: var(--accent); }
.who { display: flex; gap: 10px; align-items: center; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.post .text { margin: 10px 0 0; white-space: pre-wrap; word-wrap: break-word; }
.post .pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin-top: 10px; }
.post .pics img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.comments { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.comment { display: flex; gap: 8px; margin: 8px 0; font-size: 14px; }
.comment .bubble { background: var(--bg-2); border-radius: 12px; padding: 7px 11px; }
.role { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-left: 4px; }

.chat { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.msg { max-width: 80%; display: flex; gap: 8px; align-items: flex-end; }
.msg .b { background: var(--card); border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; padding: 8px 12px; white-space: pre-wrap; word-wrap: break-word; }
.msg .n { font-size: 11px; font-weight: 700; color: var(--ink-3); margin: 6px 0 2px 46px; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.me .b { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); border-radius: 18px 18px 6px 18px; }
.msg img { border-radius: 12px; max-height: 240px; margin-top: 4px; }
.stamp { text-align: center; font-size: 12px; color: var(--ink-3); margin: 10px 0 4px; }
.dock { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 20; background: var(--bg); padding: 8px 16px; border-top: 1px solid var(--line); }
.dock > div { max-width: 728px; margin: 0 auto; }
.typing { font-size: 12px; color: var(--ink-3); height: 16px; }

.list > button, .list > a, .list > div.li { display: flex; align-items: center; gap: 12px; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; text-align: left; margin-bottom: 8px; color: var(--ink); }
.list .unread { font-weight: 800; }
.online { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); display: inline-block; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0; transition: all .2s; z-index: 60; max-width: 90vw; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.empty { text-align: center; color: var(--ink-3); padding: 30px 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; font-weight: 600; }
.bubbles { display: flex; flex-direction: column; gap: 10px; }
.bubbles .q { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-radius: 16px 16px 4px 16px; padding: 9px 13px; max-width: 85%; }
.bubbles .a { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 10px 14px; max-width: 92%; white-space: pre-wrap; }

/* ---------- admin ---------- */
.stat { text-align: center; }
.stat b { display: block; font-family: var(--font-display); font-size: 30px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wired { display: flex; flex-wrap: wrap; gap: 6px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t td, table.t th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.adminitem { display: flex; gap: 8px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.adminitem:last-child { border-bottom: 0; }
.envbar { position: fixed; top: 0; left: 0; right: 0; z-index: 70; text-align: center; font-size: 11px; font-weight: 800; letter-spacing: .08em; background: var(--warn); color: var(--card); padding: 2px 0 2px; padding-top: max(2px, env(safe-area-inset-top)); }

.notimes .item .time { display: none; }
.thumbs:empty { display: none; }
.typing:empty { height: 6px; }
body.staging #main { padding-top: calc(max(16px, env(safe-area-inset-top)) + 26px); }
body.staging .hero { margin-top: -42px; }
