/* Libreta de viaje en tonos pastel: cada ciudad tiene su tinte (SF niebla, SD agua, LA atardecer). */
:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --ink: #1f2a3a;
  --muted: #677385;
  --line: #e4e8ef;
  --accent: #e5735f;
  --accent-ink: #b24a38;
  --accent-soft: #fdebe6;
  --sf: #7f9fd9; --sf-soft: #e9effb; --sf-ink: #3b5a92;
  --sd: #4fb3a0; --sd-soft: #e2f4ef; --sd-ink: #23705f;
  --la: #eba25a; --la-soft: #fcefdf; --la-ink: #93591a;
  --fly: #a08fd8; --fly-soft: #eeeafa; --fly-ink: #574794;
  --ok: #2f9e6e; --ok-soft: #e3f5ec;
  --display: "Bricolage Grotesque", ui-rounded, system-ui, sans-serif;
  --body: Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-lg: 20px; --r-md: 14px; --r-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 42, 58, .04), 0 4px 16px rgba(31, 42, 58, .05);
  --hdr: 64px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 760px) { body { padding-bottom: 32px; } }
h1, h2, h3 { text-wrap: balance; }
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 16px; }
.wrap { max-width: 880px; margin: 0 auto; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
[hidden] { display: none !important; }

/* ---------- Encabezado ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(246, 247, 251, .9); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top-in { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-name { font: 800 17px/1.1 var(--display); letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--muted); }
.me { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.me a { font-size: 12px; color: var(--muted); }
@media (max-width: 420px) { .who-btn > span:not(.av) { display: none; } .brand-name { font-size: 16px; } }
.seg { display: none; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; }
@media (min-width: 760px) { .seg { display: flex; } }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; display: flex; gap: 6px; align-items: center; }
.seg button[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }

/* ---------- Navegación inferior (teléfono) ---------- */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px var(--gutter-r) calc(6px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); }
@media (min-width: 760px) { .bottom { display: none; } }
.bottom button { border: 0; background: none; display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer; position: relative; }
.bottom svg { width: 22px; height: 22px; }
.bottom button[aria-current="page"] { color: var(--accent-ink); }
.bottom .badge { position: absolute; top: 0; left: calc(50% + 6px); }

/* ---------- Generales ---------- */
main { padding-top: 20px; padding-bottom: 24px; outline: none; }
.loading, .empty { color: var(--muted); padding: 40px 0; text-align: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.kicker { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.h-sec { font: 800 26px/1.1 var(--display); letter-spacing: -.015em; margin: 4px 0 6px; }
.lede { color: var(--muted); margin: 0 0 18px; max-width: 60ch; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { border-color: #cdd4df; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #2c3a4f; }
.btn.primary[disabled] { opacity: .5; cursor: default; }
.btn.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.link { border: 0; background: none; padding: 4px 6px; color: var(--muted); font-weight: 500; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(88px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 40; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
@media (min-width: 760px) { .toast { bottom: 24px; } }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center; padding: 18px 20px; border-radius: var(--r-lg); background: linear-gradient(120deg, var(--accent-soft), var(--fly-soft) 55%, var(--sd-soft)); margin-bottom: 18px; }
@media (max-width: 560px) { .hero { grid-template-columns: 1fr; gap: 14px; } }
.count { display: flex; align-items: baseline; gap: 8px; }
.count b { font: 800 46px/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.count span { font-size: 14px; color: var(--ink); font-weight: 600; max-width: 12ch; line-height: 1.25; }
.route { display: flex; gap: 4px; min-width: 0; }
.route button { flex-shrink: 0; min-width: max-content; border: 0; border-radius: 10px; padding: 8px 10px; text-align: left; cursor: pointer; min-width: 0; display: grid; gap: 1px; }
.route button b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route button small { font-size: 11px; opacity: .8; white-space: nowrap; }
.route .sf { background: rgba(255,255,255,.75); color: var(--sf-ink); box-shadow: inset 0 -3px 0 var(--sf); }
.route .sd { background: rgba(255,255,255,.75); color: var(--sd-ink); box-shadow: inset 0 -3px 0 var(--sd); }
.route .la { background: rgba(255,255,255,.75); color: var(--la-ink); box-shadow: inset 0 -3px 0 var(--la); }
.route button:hover { background: #fff; }

/* ---------- Tira de días ---------- */
.days { position: sticky; top: calc(var(--hdr) + env(safe-area-inset-top, 0px)); z-index: 10; background: var(--bg); margin: 0 calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l)); padding: 8px var(--gutter-r) 10px var(--gutter-l); display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.days::-webkit-scrollbar { display: none; }
.day-pill { flex: none; width: 52px; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 6px 0 7px; display: grid; justify-items: center; gap: 1px; cursor: pointer; position: relative; }
.day-pill small { font-size: 10.5px; font-weight: 600; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.day-pill b { font: 700 18px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.day-pill i { width: 18px; height: 3px; border-radius: 2px; background: var(--c, var(--line)); }
.day-pill.today::after { content: "hoy"; position: absolute; top: -7px; font-size: 9.5px; font-weight: 700; background: var(--accent); color: #fff; padding: 0 5px; border-radius: 6px; text-transform: uppercase; }
.day-pill[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.day-pill[aria-current="true"] small { color: #c8d0dc; }
.c-sf { --c: var(--sf); --soft: var(--sf-soft); --cink: var(--sf-ink); }
.c-sd { --c: var(--sd); --soft: var(--sd-soft); --cink: var(--sd-ink); }
.c-la { --c: var(--la); --soft: var(--la-soft); --cink: var(--la-ink); }
.c-fly { --c: var(--fly); --soft: var(--fly-soft); --cink: var(--fly-ink); }

/* ---------- Encabezado del día ---------- */
.dayhead { margin-top: 18px; border-radius: var(--r-lg); background: var(--soft); padding: 18px 20px; }
.dayhead .kicker { color: var(--cink); }
.dayhead h2 { font: 800 28px/1.08 var(--display); letter-spacing: -.02em; margin: 4px 0 6px; }
.dayhead p { margin: 0; color: #4b5668; max-width: 62ch; }
.dayhead .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 13px; color: var(--cink); font-weight: 600; }
.dayhead .meta span { display: inline-flex; align-items: center; gap: 5px; }
.dayhead .meta svg { width: 15px; height: 15px; }

/* ---------- Línea de tiempo ---------- */
.timeline { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }
.act { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; position: relative; }
.act::before { content: ""; position: absolute; left: 31px; top: 34px; bottom: -14px; border-left: 2px dotted var(--line); }
.act:last-child::before { display: none; }
.act-time { text-align: right; padding-top: 14px; font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.act-time::after { content: ""; display: block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin: 6px 0 0 auto; box-shadow: 0 0 0 3px var(--bg); }
.act-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.act-card h3 { margin: 0 0 3px; font-size: 16.5px; line-height: 1.3; }
.act-card > p { margin: 0; color: var(--muted); font-size: 14.5px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 2px 9px; }
.tag.food { background: var(--accent-soft); color: var(--accent-ink); }
.tag.cult { background: var(--fly-soft); color: var(--fly-ink); }
.tag.must { background: var(--la-soft); color: var(--la-ink); }
.tag.book { background: #fff4cc; color: #7a5d00; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.daynav { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; }

/* ---------- Votación ---------- */
.poll { margin-top: 12px; border-radius: var(--r-sm); background: var(--surface-2); padding: 10px; display: grid; gap: 6px; }
.poll-q { font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 0 2px 2px; }
.opt { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; cursor: pointer; overflow: hidden; }
.opt .fill { position: absolute; inset: 0 auto 0 0; background: var(--sd-soft); width: 0; transition: width .3s ease; }
.opt > span { position: relative; font-size: 14px; font-weight: 600; min-width: 0; }
.opt .who { position: relative; display: flex; align-items: center; gap: 3px; }
.opt.mine { border-color: var(--sd); }
.opt.mine > span::before { content: "✓ "; color: var(--sd-ink); }

/* ---------- Comentarios ---------- */
.thread { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 10px; }
.cmt { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; }
.av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--av, #98a2b3); flex: none; }
.av.sm { width: 20px; height: 20px; font-size: 9.5px; box-shadow: 0 0 0 2px var(--surface); }
.cmt-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 13px; }
.cmt-head b { font-size: 13.5px; }
.cmt-head time { color: var(--muted); font-size: 12px; }
.cmt-body { margin: 2px 0 0; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.status { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 6px; }
.status.revisado { background: var(--ok-soft); color: var(--ok); }
.status.nuevo { background: var(--accent-soft); color: var(--accent-ink); }
.cmt-tools { display: flex; gap: 2px; margin-top: 2px; }
.compose { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.compose textarea { width: 100%; min-height: 42px; max-height: 180px; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: 15px/1.4 var(--body); background: var(--surface); color: var(--ink); }
.compose textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); }

/* ---------- Vista de comentarios ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; align-items: center; }
.feed { display: grid; gap: 10px; }
.feed .card { padding: 14px 16px; }
.ctx { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--cink, var(--muted)); text-decoration: none; margin-bottom: 8px; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; }
.ctx i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.admin-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: var(--r-md); background: var(--fly-soft); margin-bottom: 14px; font-size: 13.5px; }
.general { padding: 14px 16px; margin-bottom: 18px; display: grid; gap: 10px; }

/* ---------- Vuelos y estadías ---------- */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.pass { display: grid; grid-template-columns: minmax(0, 1fr); border-radius: var(--r-md); overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.pass-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; font-size: 12.5px; font-weight: 700; }
.pass.delta .pass-top { background: var(--sf-soft); color: var(--sf-ink); }
.pass.united .pass-top { background: var(--fly-soft); color: var(--fly-ink); }
.pass-mid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 14px 14px 10px; }
.pass-mid .ap b { display: block; font: 800 30px/1 var(--display); letter-spacing: -.01em; }
.pass-mid .ap span { font-size: 12px; color: var(--muted); }
.pass-mid .ap strong { display: block; font-size: 15px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.pass-mid .ap.r { text-align: right; }
.pass-mid svg { width: 26px; height: 26px; color: var(--muted); }
.pass-bot { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 10px 14px 12px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--muted); }
.pass-bot b { color: var(--ink); font-weight: 600; }
.pass-note { padding: 0 14px 12px; font-size: 12.5px; color: var(--accent-ink); }
.datehead { font-size: 13px; font-weight: 700; color: var(--muted); margin: 22px 0 8px; }
.stay { padding: 14px 16px; border-left: 4px solid var(--c); display: grid; gap: 2px; }
.stay b { font-size: 15px; }
.stay span { font-size: 13px; color: var(--muted); }
.list { margin: 0; padding: 14px 16px 14px 34px; display: grid; gap: 4px; font-size: 14.5px; }

/* ---------- Maleta ---------- */
.check { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 15px; }
.check:last-child { border-bottom: 0; }
.check input { width: 20px; height: 20px; accent-color: var(--sd); flex: none; }
.check.done span { color: var(--muted); text-decoration: line-through; }
.progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 0 0 14px; }
.progress i { display: block; height: 100%; background: var(--sd); border-radius: 4px; transition: width .3s; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Pantalla de entrada ---------- */
.login-page { padding-bottom: 0; min-height: 100vh; background: linear-gradient(160deg, var(--accent-soft), var(--fly-soft) 45%, var(--sd-soft)); }
.login { min-height: 100vh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top, 0px)) var(--gutter-r) max(24px, env(safe-area-inset-bottom, 0px)) var(--gutter-l); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 24px; padding: 28px 24px; box-shadow: 0 10px 40px rgba(31, 42, 58, .1); display: grid; gap: 16px; }
.login-mark { width: 44px; height: 44px; }
.login-card h1 { font: 800 32px/1.02 var(--display); letter-spacing: -.02em; margin: 0; }
.login-card h1 span { color: var(--accent); }
.login-sub { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.who-pick { border: 0; margin: 0; padding: 0; }
.who-pick legend { font-size: 13px; font-weight: 700; margin-bottom: 8px; padding: 0; }
.names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.names input { position: absolute; opacity: 0; pointer-events: none; }
.name-pill { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; font-weight: 600; cursor: pointer; }
.names input:checked + .name-pill { border-color: var(--ink); background: var(--surface-2); }
.names input:focus-visible + .name-pill { outline: 2px solid var(--accent); outline-offset: 2px; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; font: 16px var(--body); padding: 12px 84px 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); }
.pw-wrap input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.pw-wrap .btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.btn.big { justify-content: center; padding: 13px; font-size: 16px; border-radius: 12px; }
.login-err { margin: -6px 0 0; min-height: 1.2em; color: var(--accent-ink); font-size: 14px; font-weight: 600; }
.login-card .hint { margin: -8px 0 0; text-align: center; }

/* ---------- ¿Quién eres? (dentro de la app) ---------- */
.who-wrap { min-height: 60vh; display: grid; place-items: center; padding: 20px 0; }
.who-card { box-shadow: var(--shadow); border: 1px solid var(--line); }
.who-card .name-pill { background: var(--surface); text-align: left; position: relative; }
.who-card .name-pill:hover { border-color: var(--ink); }
.who-card .name-pill small { position: absolute; top: -8px; right: 8px; font-size: 10px; font-weight: 700; background: var(--sd-soft); color: var(--sd-ink); padding: 1px 6px; border-radius: 6px; }
.who-card > .btn.link { justify-self: center; }
body.picking .seg, body.picking .bottom { visibility: hidden; }
.who-btn { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 2px 6px 2px 2px; border-radius: 999px; cursor: pointer; font-size: 13px; color: var(--muted); }
.who-btn:hover { background: var(--surface-2); }

/* ---------- Llegadas y traslados ---------- */
.arrivals { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.arr-chip { display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--surface); color: var(--ink); border-radius: 12px; padding: 8px 12px; font-size: 14px; cursor: pointer; box-shadow: var(--shadow); }
.arr-chip svg { width: 18px; height: 18px; color: var(--cink); }
.arr-chip b { font-variant-numeric: tabular-nums; color: var(--cink); }
.arr-k { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cink); margin-bottom: 4px; }
.arr-k svg { width: 16px; height: 16px; }
.arr-k.tr { color: var(--muted); }
.act-card.arrive { background: var(--soft); border-color: transparent; box-shadow: inset 4px 0 0 var(--c); }
.act-card.arrive h3 { font: 800 19px/1.2 var(--display); }
.act-card.transit { background: var(--surface-2); box-shadow: none; }
.act.is-arrive .act-time { color: var(--cink); font-size: 14px; }
.act.is-arrive .act-time::after { width: 13px; height: 13px; }
.day-pill { overflow: visible; }
.travel-dot { position: absolute; top: -6px; right: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 1px var(--line); display: grid; place-items: center; color: var(--muted); }
.travel-dot svg { width: 12px; height: 12px; }
.day-pill.today .travel-dot { display: none; }
