/* =========================================================
   Rotam – design system
   ========================================================= */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e8ecf1;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --border: #e4e8ee;
  --border-strong: #d0d7e1;
  --accent: #0f766e;
  --accent-2: #0e7490;
  --accent-hover: #115e59;
  --accent-soft: #e7f5f3;
  --accent-text: #0f766e;
  --on-accent: #ffffff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #b45309;
  --warn-soft: #fff7ed;
  --ok: #047857;
  --ok-soft: #ecfdf5;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px -6px rgba(15, 23, 42, .08);
  --shadow-lg: 0 30px 70px -15px rgba(15, 23, 42, .35);
  --map-halo: #ffffff;
  --radius: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1016;
  --surface: #121922;
  --surface-2: #18212c;
  --surface-3: #222d3a;
  --text: #e8edf3;
  --text-2: #c3ccd8;
  --muted: #8b97a8;
  --border: #212b37;
  --border-strong: #2f3b4a;
  --accent: #2dd4bf;
  --accent-2: #22d3ee;
  --accent-hover: #5eead4;
  --accent-soft: rgba(45, 212, 191, .12);
  --accent-text: #5eead4;
  --on-accent: #042f2e;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .12);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 30px 70px -15px rgba(0, 0, 0, .7);
  --map-halo: #121922;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 15.5px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
}
body.modal-open { overflow: hidden; }
main { flex: 1; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: clamp(1.65rem, 3.6vw, 2.25rem); font-weight: 800; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent-text); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { flex: none; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
@media (min-width: 700px) { .container { padding-left: 28px; padding-right: 28px; } }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 1100;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: .75rem; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent);
  box-shadow: 0 4px 12px -2px color-mix(in srgb, var(--accent) 45%, transparent);
}
.brand-text { display: grid; line-height: 1.1; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em; }
.brand-tag { font-size: .72rem; color: var(--muted); font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: .5rem; }

.lang {
  position: relative; display: flex; align-items: center;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted);
}
.lang .ico { position: absolute; left: 10px; pointer-events: none; }
.lang select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: .875rem; font-weight: 600; height: 36px; padding: 0 12px 0 32px; min-height: 0; width: auto; cursor: pointer;
}
.lang select:focus { box-shadow: none; }
.lang:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button {
  display: grid; place-items: center; width: 32px; height: 28px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  height: 40px; padding: 0 1rem; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: .9rem; font-weight: 600; white-space: nowrap; cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent); border-color: transparent; color: var(--on-accent);
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 4px 14px -4px color-mix(in srgb, var(--accent) 60%, transparent);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); background: transparent; border-color: transparent; box-shadow: none; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { height: 34px; padding: 0 .75rem; font-size: .85rem; }
.btn-lg { height: 46px; padding: 0 1.25rem; font-size: .95rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color .15s, color .15s;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.bordered { border: 1px solid var(--border); background: var(--surface); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Inputs ---------- */
input, select, textarea {
  width: 100%; min-height: 42px; padding: .55rem .8rem;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0;
  border: 1.5px solid var(--border-strong); border-radius: 6px; background: var(--surface); cursor: pointer;
  display: grid; place-items: center;
}
input[type="checkbox"]::after {
  content: ""; width: 10px; height: 6px; border: 2px solid var(--on-accent); border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px); opacity: 0;
}
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after { opacity: 1; }

/* ---------- Generic ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; height: 28px; padding: 0 .65rem;
  border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.chip .ico { color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; gap: .3rem; height: 24px; padding: 0 .55rem;
  border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .01em;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }

/* ---------- Page ---------- */
.page { padding-top: 2rem; padding-bottom: 4rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.page-head .lead { color: var(--muted); margin-top: .4rem; font-size: 1rem; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .875rem; margin-bottom: .9rem; }
.crumb:hover { color: var(--text); }
.meta-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }

/* ---------- Home ---------- */
.home-hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--surface); }
.home-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 220px at 85% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(500px 200px at 10% 120%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 70%);
}
.home-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to left, #000, transparent 70%);
  -webkit-mask-image: linear-gradient(to left, #000, transparent 70%);
}
.home-hero .container { position: relative; z-index: 1; padding-top: 2.5rem; padding-bottom: 2.25rem; display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.home-hero h1 { margin-top: .35rem; }
.home-hero .lead { color: var(--muted); margin-top: .5rem; max-width: 46ch; }
.trip-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.trip-card {
  display: flex; flex-direction: column; overflow: hidden; color: var(--text); text-decoration: none;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.trip-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(15,23,42,.05), 0 18px 40px -12px rgba(15,23,42,.2); border-color: var(--border-strong); }
.trip-cover { position: relative; height: 150px; background: linear-gradient(135deg, var(--c1), var(--c2)); color: #fff; }
.trip-cover::after {
  content: ""; position: absolute; inset: 0; opacity: .18;
  background-image: radial-gradient(#fff 1px, transparent 1px); background-size: 16px 16px;
}
.trip-cover svg.sketch { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.trip-cover .badge { position: absolute; top: 12px; left: 12px; z-index: 2; background: rgba(255,255,255,.92); color: #0f172a; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.trip-body { display: flex; flex-direction: column; gap: .45rem; padding: 1rem 1.1rem 1.1rem; flex: 1; }
.trip-body h3 { font-size: 1.1rem; }
.trip-meta { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .85rem; }
.trip-route { color: var(--text-2); font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-foot { margin-top: auto; padding-top: .85rem; display: grid; gap: .45rem; }
.trip-foot-row { display: flex; justify-content: space-between; gap: .5rem; font-size: .82rem; color: var(--muted); }
.trip-foot-row strong { color: var(--text); font-weight: 600; }
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.meter.over span { background: var(--danger); }
.new-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .6rem;
  min-height: 300px; padding: 1.5rem; border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  background: transparent; color: var(--muted); font: inherit; cursor: pointer; transition: border-color .2s, background-color .2s, color .2s;
}
.new-card:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.new-card .plus { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--accent-text); box-shadow: var(--shadow-sm); }
.new-card strong { color: var(--text); font-size: 1rem; }
.empty { text-align: center; padding: 3rem 1.5rem; }
.empty-art { width: 180px; max-width: 70%; margin: 0 auto 1.25rem; display: block; }
.empty h2 { font-size: 1.35rem; margin-bottom: .4rem; }
.empty p { max-width: 42ch; margin: 0 auto; }
.empty .actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }

/* ---------- Route map ---------- */
.map-card { overflow: hidden; margin-bottom: 1.25rem; position: relative; }
.map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .6rem 1rem; flex-wrap: wrap; padding: .85rem 1rem .85rem 1.1rem; border-bottom: 1px solid var(--border); }
.map-title { display: flex; align-items: center; gap: .6rem; }
.map-title .ico-tile { width: 32px; height: 32px; }
.map-title small { display: block; color: var(--muted); font-size: .78rem; font-weight: 500; font-family: var(--font); letter-spacing: 0; }
.map-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.legend { display: flex; flex-wrap: wrap; gap: .35rem; }
.legend-item { display: inline-flex; align-items: center; gap: .4rem; height: 28px; padding: 0 .6rem; border-radius: 999px; background: var(--surface-2); font-size: .78rem; font-weight: 600; color: var(--text-2); }
.legend-item .ico { color: var(--c); }
.legend-line { display: inline-block; width: 18px; border-top: 2.5px solid var(--c); }
.legend-line.dashed { border-top-style: dashed; }
.route-map { height: clamp(300px, 52vh, 500px); background: var(--surface-2); }
.map-empty {
  position: absolute; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 500;
  display: flex; align-items: center; gap: .5rem; max-width: calc(100% - 2rem);
  padding: .55rem 1rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: .875rem; font-weight: 500;
}
.pick-map { height: 240px; border-radius: var(--radius-md); border: 1px solid var(--border); overflow: hidden; }

/* Leaflet theming */
.leaflet-container { font: inherit; background: var(--surface-2); }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.85) saturate(.6); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip, .leaflet-tooltip { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow); }
.leaflet-popup-content-wrapper { border-radius: 12px; }
.leaflet-popup-content { margin: 12px 14px; font-size: .875rem; line-height: 1.45; }
.leaflet-popup-content strong { font-family: var(--font-display); font-size: .95rem; }
.leaflet-tooltip { border-radius: 8px; font-size: .8rem; font-weight: 600; }
.leaflet-bar { border: 1px solid var(--border) !important; border-radius: 10px !important; overflow: hidden; box-shadow: var(--shadow) !important; }
.leaflet-bar a { background: var(--surface); color: var(--text); border-color: var(--border) !important; width: 32px !important; height: 32px !important; line-height: 32px !important; }
.leaflet-bar a:hover { background: var(--surface-2); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 85%, transparent) !important; color: var(--muted); border-radius: 6px 0 0 0; }
.leaflet-control-attribution a { color: var(--accent-text); }
.route-halo { stroke: var(--map-halo); }
.num-pin span {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent);
  font-weight: 800; font-size: .85rem; font-family: var(--font-display);
  border: 2.5px solid var(--map-halo); box-shadow: 0 3px 10px rgba(0,0,0,.3);
}
.mode-pin span {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--map-halo); color: var(--c); border: 2px solid var(--c); box-shadow: 0 2px 6px rgba(0,0,0,.22);
}
.pick-pin span {
  display: block; width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 3px solid var(--map-halo); box-shadow: 0 3px 8px rgba(0,0,0,.35);
}

/* ---------- Stats ---------- */
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 2rem; }
.stat { padding: 1rem 1.1rem; display: grid; gap: .65rem; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 600; }
.ico-tile { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: color-mix(in srgb, var(--tint, var(--accent)) 13%, transparent); color: var(--tint, var(--accent)); flex: none; }
.stat-val { font-family: var(--font-display); font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-sub { font-size: .8rem; color: var(--muted); }
.stat.over .stat-val, .stat.over .stat-sub { color: var(--danger); }

/* ---------- Trip layout ---------- */
.two-col { display: grid; gap: 1.75rem; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.side { position: sticky; top: 84px; display: grid; gap: 1.25rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.section-head h2 { font-size: 1.25rem; }

/* Timeline */
.timeline { display: grid; }
.tl-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 14px; }
.tl-rail { position: relative; display: flex; justify-content: center; }
.tl-rail::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--border-strong); }
.timeline > .tl-row:first-child .tl-rail::before { top: 20px; }
.timeline > .tl-row:last-child .tl-rail::before { bottom: auto; height: 34px; }
.tl-node {
  position: relative; z-index: 1; display: grid; place-items: center; width: 36px; height: 36px; margin-top: 16px;
  border: 3px solid var(--bg); border-radius: 50%; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent);
  font: 800 .85rem var(--font-display); box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--accent) 60%, transparent);
}
.tl-day .tl-rail span { position: relative; z-index: 1; width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; background: var(--bg); border: 2px solid var(--border-strong); }
.tl-day .tl-content { padding: 0 0 .65rem; font-size: .8rem; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
.tl-day:not(:first-child) .tl-content { padding-top: .25rem; }
.tl-leg .tl-rail::before { width: 3px; margin-left: -1.5px; background: repeating-linear-gradient(to bottom, var(--c) 0 6px, transparent 6px 11px); }
.tl-leg .tl-rail .leg-ico {
  position: relative; z-index: 1; align-self: center; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface); color: var(--c); border: 2px solid var(--c); box-shadow: var(--shadow-sm);
}
.tl-leg .tl-content { display: flex; align-items: center; padding: 1rem 0; }
.leg-pill {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: .25rem .8rem;
  padding: .45rem .8rem; border-radius: 10px; background: color-mix(in srgb, var(--c) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 22%, transparent);
  font-size: .84rem; color: var(--text-2);
}
.leg-pill strong { color: var(--c); font-weight: 700; }
:root[data-theme="dark"] .leg-pill strong { color: color-mix(in srgb, var(--c) 55%, #fff); }
.leg-pill .sep { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); }
.tl-stop .tl-content { padding-bottom: .25rem; }

.stop { padding: 1rem 1.1rem 1.1rem; }
.stop-head { display: flex; align-items: flex-start; gap: .75rem; }
.stop-title { flex: 1; min-width: 0; }
.stop-title h3 { font-size: 1.12rem; overflow-wrap: anywhere; }
.stop-sub { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.stop-tools { display: flex; gap: 2px; margin: -4px -6px 0 0; }
.stop-sec { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.sec-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .55rem; font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.sec-title span:first-child { display: inline-flex; align-items: center; gap: .4rem; }
.exp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.exp-list li { display: flex; align-items: center; gap: .65rem; padding: .35rem 0; font-size: .9rem; }
.exp-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: color-mix(in srgb, var(--c) 13%, transparent); color: var(--c); flex: none; }
.exp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.exp-total { justify-content: space-between; margin-top: .3rem; padding-top: .6rem !important; border-top: 1px dashed var(--border-strong); font-weight: 700; }
.todos { display: grid; gap: .1rem; }
.todo { display: flex; align-items: center; gap: .65rem; padding: .35rem 0; font-size: .92rem; cursor: pointer; }
.todo.done span { text-decoration: line-through; color: var(--muted); }
.notes { display: flex; gap: .6rem; padding: .7rem .85rem; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: .88rem; white-space: pre-wrap; }
.notes .ico { color: var(--muted); margin-top: 2px; }

/* Budget */
.budget { padding: 1.15rem 1.2rem 1.25rem; }
.budget-head { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.1rem; }
.donut-wrap { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1.1rem; }
.donut { position: relative; width: 128px; height: 128px; flex: none; border-radius: 50%; }
.donut::after { content: ""; position: absolute; inset: 16px; border-radius: 50%; background: var(--surface); }
.donut-center { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; text-align: center; }
.donut-center small { color: var(--muted); font-size: .7rem; font-weight: 600; }
.donut-center strong { font-family: var(--font-display); font-size: .98rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.budget-progress { flex: 1; min-width: 0; display: grid; gap: .45rem; }
.budget-progress .meter { height: 8px; }
.budget-progress p { font-size: .82rem; color: var(--muted); }
.over-text { color: var(--danger) !important; font-weight: 600; display: flex; align-items: center; gap: .35rem; }
.cat-list, .by-stop { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.cat-list li { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: .6rem; font-size: .88rem; }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.cat-list .pct { color: var(--muted); font-size: .78rem; width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }
.cat-list strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.small-h { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 1.35rem 0 .65rem; font-family: var(--font); font-weight: 700; }
.by-stop { gap: .4rem; }
.by-stop li { display: flex; align-items: center; gap: .55rem; font-size: .88rem; }
.by-stop .n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); font-size: .72rem; font-weight: 700; color: var(--text-2); flex: none; }
.by-stop .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.by-stop .amt { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 20px;
  background: rgba(8, 12, 18, .55); backdrop-filter: blur(3px); animation: fade .18s ease-out;
}
.modal {
  width: 100%; max-width: 540px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg);
  animation: pop .2s cubic-bezier(.2, .8, .3, 1);
}
.modal-wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 1.15rem; }
.modal-body { padding: 1.25rem; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .9rem 1.25rem calc(.9rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface-2); }
.modal-foot .spacer { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }

.form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .4rem; min-width: 0; }
.label { font-weight: 600; font-size: .85rem; color: var(--text-2); }
.hint { font-size: .8rem; color: var(--muted); }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.form-sec { display: grid; gap: .8rem; padding-top: 1.1rem; border-top: 1px solid var(--border); min-width: 0; }
.form > .form-sec:first-child { padding-top: 0; border-top: 0; }
.form-sec-title { display: flex; align-items: center; gap: .5rem; font-family: var(--font-display); font-weight: 700; font-size: .95rem; }
.form-sec-title .ico-tile { width: 28px; height: 28px; border-radius: 8px; }
.input-icon { position: relative; flex: 1; }
.input-icon .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 38px; }
.search-row { display: flex; gap: .5rem; }
.results { list-style: none; margin: 0; padding: .3rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow); max-height: 220px; overflow-y: auto; }
.results li.muted, .results li.error { padding: .6rem .7rem; font-size: .88rem; }
.results li.error { color: var(--danger); }
.results button { display: flex; gap: .55rem; align-items: flex-start; width: 100%; text-align: left; padding: .55rem .65rem; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: .88rem; cursor: pointer; }
.results button .ico { color: var(--muted); margin-top: 2px; }
.results button:hover, .results button:focus-visible { background: var(--surface-2); }

.mode-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.mode-opt { position: relative; }
.mode-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mode-opt .tile {
  display: grid; justify-items: center; gap: .3rem; padding: .7rem .25rem .6rem;
  border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; text-align: center; color: var(--muted);
  transition: border-color .15s, background-color .15s, color .15s;
}
.mode-opt .tile:hover { border-color: var(--c); color: var(--c); }
.mode-opt small { font-size: .78rem; font-weight: 600; color: var(--text-2); }
.mode-opt input:checked + .tile { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.mode-opt input:focus-visible + .tile { outline: 2px solid var(--accent); outline-offset: 2px; }

.exp-row { display: grid; grid-template-columns: 1.5fr 1.25fr .95fr auto auto; gap: .45rem; align-items: center; }
.exp-paid { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 600; color: var(--text-2); white-space: nowrap; cursor: pointer; padding: 0 .25rem; }
.todo-row { display: flex; align-items: center; gap: .6rem; }
.todo-row .todo-text { flex: 1; }
.rows { display: grid; gap: .5rem; }
.rows:empty { display: none; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .8rem; }
.site-footer .container { display: flex; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; padding-top: 1.25rem; padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); }
.site-footer a { color: inherit; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .two-col { grid-template-columns: 1fr; }
  .side { position: static; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  body { font-size: 15px; }
  .topbar-inner { height: 58px; }
  .brand-tag, .hide-xs { display: none; }
  .page { padding-top: 1.25rem; }
  .page-head { align-items: flex-start; margin-bottom: 1.25rem; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .home-hero .container { padding-top: 1.75rem; padding-bottom: 1.5rem; }
  .home-hero .btn { width: 100%; }
  .stats { gap: .65rem; }
  .stat { padding: .85rem .9rem; }
  .stat-val { font-size: 1.15rem; }
  .route-map { height: 44vh; }
  .map-toolbar { padding: .75rem .85rem; }
  .tl-row { grid-template-columns: 34px minmax(0, 1fr); column-gap: 10px; }
  .tl-node { width: 32px; height: 32px; }
  .stop { padding: .9rem .9rem 1rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .donut { width: 112px; height: 112px; }
  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal, .modal-wide { max-width: none; max-height: 94dvh; border-radius: 20px 20px 0 0; border-bottom: 0; animation: sheet .25s cubic-bezier(.2, .8, .3, 1); }
  .mode-grid { grid-template-columns: repeat(4, 1fr); gap: .4rem; }
  .exp-row { grid-template-columns: 1fr 1fr auto; padding-bottom: .65rem; border-bottom: 1px solid var(--border); }
  .exp-row .exp-label { grid-column: 1 / -1; }
  .exp-row .exp-amt-in { grid-column: 2 / 4; }
  .exp-row .exp-paid { grid-column: 1 / 3; }
  .exp-row .icon-btn { grid-column: 3; grid-row: 3; justify-self: end; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 3000; display: grid; gap: .5rem; width: min(440px, calc(100% - 32px)); }
.toast {
  display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem; border-radius: 12px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: .9rem; font-weight: 500;
  animation: pop .2s ease-out;
}
.toast-error .ico { color: #f87171; }
.toast-ok .ico { color: #34d399; }

/* =========================================================
   Suggestions, weather, budget alerts
   ========================================================= */
.btn-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); box-shadow: none; }
.btn-soft:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.spinner { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Map suggestion filter bar */
.poi-bar { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .75rem; padding: .65rem 1rem .65rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.poi-label { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 700; color: var(--text-2); }
.poi-label .ico { color: var(--accent-text); }
.poi-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.poi-chip { position: relative; cursor: pointer; }
.poi-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.poi-chip span {
  display: inline-flex; align-items: center; gap: .35rem; height: 30px; padding: 0 .7rem; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font-size: .8rem; font-weight: 600;
  transition: background-color .15s, border-color .15s, color .15s;
}
.poi-chip span::before { content: ""; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--border-strong); flex: none; background: var(--surface); }
.poi-chip input:checked + span { border-color: var(--c); color: var(--text); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.poi-chip input:checked + span::before {
  border-color: var(--c);
  background: var(--c) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 10px no-repeat;
}
.poi-chip span .ico { color: var(--c); }
.poi-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.poi-status { margin-left: auto; display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--muted); font-weight: 500; }
.poi-err { color: var(--danger); }
.poi-pin span {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--c); color: #fff; border: 2px solid var(--map-halo); box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.poi-pop { display: grid; gap: .3rem; min-width: 180px; }
.poi-pop-cat { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 700; color: var(--c); text-transform: uppercase; letter-spacing: .04em; }
.poi-pop strong { font-size: .98rem; line-height: 1.3; }
.poi-pop-links { display: flex; flex-wrap: wrap; gap: .3rem .8rem; margin-top: .2rem; }
.poi-pop-links a { display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; font-size: .8rem; text-decoration: none; }
.poi-pop-links a:hover { text-decoration: underline; }

/* Weather */
.wx-kind { text-transform: none; letter-spacing: 0; font-weight: 600; }
.wx-days { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.wx-day {
  flex: 0 0 auto; min-width: 76px; display: grid; justify-items: center; gap: .2rem; padding: .55rem .5rem;
  border-radius: 12px; background: var(--surface-2); text-align: center;
}
.wx-date { font-size: .72rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.wx-temp { font-size: .85rem; font-variant-numeric: tabular-nums; }
.wx-temp span { color: var(--muted); }
.wx-precip { display: inline-flex; align-items: center; gap: .15rem; font-size: .7rem; font-weight: 600; color: #0284c7; }
:root[data-theme="dark"] .wx-precip { color: #38bdf8; }
.wx-typical { display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border-radius: 12px; background: var(--surface-2); font-size: .9rem; }
.wx-loading { font-size: .85rem; color: var(--muted); }
.wx-clear .ico, .wx-partly .ico { color: #f59e0b; }
.wx-cloudy .ico, .wx-fog .ico { color: #64748b; }
.wx-drizzle .ico, .wx-rain .ico { color: #0284c7; }
.wx-snow .ico { color: #38bdf8; }
.wx-storm .ico { color: #7c3aed; }
.wx-precip .ico { color: inherit; }

/* Nearby suggestions in stop card */
.nearby-toggle .chev { transition: transform .2s; }
.nearby-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.nearby-body { margin-top: .8rem; }
.nearby-cols { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.nearby-group h4 { margin: 0 0 .4rem; font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.place-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
.place-list li { display: flex; align-items: center; gap: .6rem; padding: .3rem 0; }
.place-main { flex: 1; min-width: 0; display: grid; }
.place-main a { color: var(--text); font-weight: 600; font-size: .9rem; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-main a:hover { color: var(--accent-text); text-decoration: underline; }
.place-main small { color: var(--muted); font-size: .78rem; }
.nearby-src { margin-top: .6rem; font-size: .72rem; color: var(--muted); }
.nearby-msg { padding: .25rem 0; }

/* Budget: remaining + over alert */
.budget-head .badge { margin-left: auto; }
.remaining { display: grid; gap: .1rem; }
.remaining span { font-size: .78rem; font-weight: 600; color: var(--muted); }
.remaining strong { font-family: var(--font-display); font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ok); }
.remaining.over strong { color: var(--danger); }
.donut-alert {
  position: absolute; top: 2px; right: 2px; z-index: 2; display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%; background: var(--danger); color: #fff;
  font: 800 1.05rem/1 var(--font-display); border: 3px solid var(--surface);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 50%, transparent); animation: pulse 2s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Info popup */
.modal-small { max-width: 420px; }
.info-dialog { display: flex; gap: .9rem; align-items: flex-start; }
.info-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; flex: none; }
.info-warn .info-ico { background: var(--warn-soft); color: var(--warn); }
.info-text { display: grid; gap: .5rem; padding-top: .15rem; }
@media (max-width: 600px) {
  .poi-bar { padding: .6rem .85rem; }
  .poi-chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
  .poi-chip span { white-space: nowrap; }
  .poi-status { margin-left: 0; }
  .modal-small { max-width: none; }
}

/* =========================================================
   Accounts, team, invitations, album
   ========================================================= */
.chip-sm { height: 24px; padding: 0 .5rem; font-size: .72rem; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: .6rem .8rem; border-radius: 10px; font-size: .88rem; font-weight: 500; }
.form-ok { color: var(--ok); background: var(--ok-soft); padding: .6rem .8rem; border-radius: 10px; font-size: .88rem; font-weight: 500; }
.btn:disabled { opacity: .6; cursor: progress; }

/* Avatars */
.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent);
  font: 700 .8rem var(--font-display); letter-spacing: .02em;
}
.avatar-sm { width: 26px; height: 26px; font-size: .66rem; border: 2px solid var(--surface); }
.avatar-more { background: var(--surface-3); color: var(--text-2); }
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -8px; }

/* Account menu */
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; border-radius: 50%; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.user-menu .menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 1200; min-width: 230px; padding: .4rem; box-shadow: var(--shadow-lg); }
.menu-head { display: grid; gap: .1rem; padding: .55rem .65rem .65rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; overflow-wrap: anywhere; }
.menu-item { display: flex; align-items: center; gap: .55rem; width: 100%; padding: .6rem .65rem; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--surface-2); }

/* Sign-in screen */
.auth-wrap { max-width: 1040px; margin: 0 auto; padding: 3rem 16px 4rem; display: grid; gap: 2.5rem; grid-template-columns: 1.1fr 1fr; align-items: center; }
.auth-side h1 { margin: .4rem 0 1.25rem; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.auth-points li { display: flex; align-items: center; gap: .75rem; color: var(--text-2); font-weight: 500; }
.auth-points .ico { color: var(--accent-text); padding: 7px; box-sizing: content-box; border-radius: 10px; background: var(--accent-soft); }
.auth-card { padding: 1.5rem; display: grid; gap: 1rem; }
.auth-card h2 { font-size: 1.35rem; }
.seg-wide { display: flex; width: 100%; }
.seg-wide button { flex: 1; width: auto; height: 36px; padding: 0 .75rem; gap: .4rem; display: inline-flex; align-items: center; justify-content: center; font: inherit; font-size: .88rem; font-weight: 600; }
.seg-wide .count { font-size: .72rem; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 0 .4rem; min-width: 1.4rem; }
.auth-submit { width: 100%; }
.auth-links { display: flex; justify-content: center; }
.auth-links .link-btn { display: inline-flex; align-items: center; gap: .3rem; }

/* Home toolbar, notices, invitations */
.home-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.home-toolbar .seg-wide { width: auto; min-width: min(100%, 380px); }
.filter-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.fchip {
  display: inline-flex; align-items: center; gap: .35rem; height: 32px; padding: 0 .8rem; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.fchip:hover { border-color: var(--accent); }
.fchip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.notice, .invite-card { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; padding: .9rem 1rem; margin-bottom: 1rem; }
.notice-text, .invite-text { flex: 1; min-width: 200px; display: grid; gap: .1rem; }
.notice-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.invites { margin-bottom: 1.5rem; }
.invites .small-h { display: flex; align-items: center; gap: .4rem; margin-top: 0; }
.invite-card { border-color: color-mix(in srgb, #7c3aed 35%, var(--border)); background: color-mix(in srgb, #7c3aed 5%, var(--surface)); margin-bottom: .6rem; }
.trip-title-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }

/* Team panel */
.team { padding: 1.15rem 1.2rem 1.25rem; }
.team .budget-head .chip { margin-left: auto; }
.member-list, .pending-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.member-list li { display: flex; align-items: center; gap: .65rem; }
.member-main { flex: 1; min-width: 0; display: grid; }
.member-main strong { font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-main small { font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-form { display: flex; gap: .45rem; }
.invite-form .input-icon input { min-height: 36px; font-size: .88rem; }
.invite-form .btn { flex: none; }
.team .hint { margin-top: .45rem; }
.invite-ok { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; padding: .6rem .7rem; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-size: .85rem; font-weight: 600; }
.invite-ok span { flex: 1; min-width: 140px; }
.pending-list { margin: 0; gap: .25rem; }
.pending-list li { display: flex; align-items: center; gap: .5rem; font-size: .86rem; color: var(--text-2); }
.pending-list .ico { color: var(--muted); }
.pending-email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-leave { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--border); }

/* Album */
.album { margin-top: 2rem; padding: 1.1rem 1.2rem 1.25rem; }
.album-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.album-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.album-actions select { max-width: 220px; }
.album-upload { cursor: pointer; }
.album-filter { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.album-filter:empty { display: none; }
.album-status { margin-bottom: .75rem; font-size: .86rem; color: var(--muted); }
.album-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.ph { padding: 0; border: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 1; background: var(--surface-2); cursor: zoom-in; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.ph:hover img { transform: scale(1.04); }
.album-empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: .5rem; padding: 2rem 1rem; text-align: center; color: var(--muted); border: 1.5px dashed var(--border-strong); border-radius: 14px; }
.album-empty p { max-width: 46ch; }
.modal-viewer { max-width: 980px; }
.modal-viewer .modal-body { padding: 0; }
.viewer-img { position: relative; background: #0b0f14; display: grid; place-items: center; min-height: 240px; }
.viewer-img img { max-width: 100%; max-height: 70vh; max-height: 70dvh; display: block; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); color: #0f172a; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.viewer-nav.prev { left: 12px; }
.viewer-nav.next { right: 12px; }
.viewer-meta { padding: .9rem 1.25rem; display: grid; gap: .4rem; }
.viewer-meta p { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.viewer-foot { display: flex; align-items: center; gap: .5rem; width: 100%; }

@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; gap: 1.75rem; padding-top: 1.75rem; }
  .auth-points { display: none; }
  .auth-side h1 { margin-bottom: 0; }
}
@media (max-width: 600px) {
  .home-toolbar .seg-wide { width: 100%; min-width: 0; }
  .album-grid { grid-template-columns: repeat(3, 1fr); gap: .3rem; }
  .ph { border-radius: 8px; }
  .album-actions { width: 100%; }
  .album-actions select { flex: 1; max-width: none; }
  .modal-viewer .viewer-img img { max-height: 60dvh; }
}

/* =========================================================
   Plans, Premium page, ad spaces
   ========================================================= */
.badge-premium { background: color-mix(in srgb, #d97706 16%, transparent); color: #b45309; }
:root[data-theme="dark"] .badge-premium { color: #fbbf24; }
.chip-link { text-decoration: none; }
.chip-link:hover { background: var(--surface-3); }
.menu-plan { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
a.menu-item { text-decoration: none; }

/* Premium page */
.premium-hero { text-align: center; max-width: 640px; margin: 0 auto 2rem; }
.premium-hero .eyebrow { display: inline-flex; align-items: center; gap: .35rem; color: #d97706; }
.premium-hero h1 { margin: .4rem 0 .6rem; }
.premium-hero .lead { color: var(--muted); }
.plan-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 880px; margin: 0 auto; }
.plan-card { padding: 1.4rem; display: flex; flex-direction: column; gap: 1.1rem; }
.plan-premium { border-color: color-mix(in srgb, #d97706 45%, var(--border)); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 18px 40px -16px color-mix(in srgb, #d97706 45%, transparent); }
.plan-top { display: flex; align-items: center; gap: .75rem; }
.plan-top > div { flex: 1; }
.plan-top h2 { font-size: 1.25rem; }
.plan-price { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; }
.plan-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.plan-rows li { display: flex; align-items: center; gap: .6rem; font-size: .92rem; padding-bottom: .65rem; border-bottom: 1px dashed var(--border); }
.plan-rows li:last-child { border-bottom: 0; padding-bottom: 0; }
.plan-rows li span { flex: 1; color: var(--text-2); }
.plan-rows .ico { color: var(--muted); }
.plan-cta { width: 100%; margin-top: auto; }
.plan-premium .btn-primary:not(:disabled) { background: #d97706; }
.plan-premium .btn-primary:not(:disabled):hover { background: #b45309; }
.plan-soon { text-align: center; margin-top: -.5rem; }
.plan-active { display: flex; align-items: center; gap: .4rem; color: var(--ok); font-weight: 600; margin-top: auto; }
.premium-note { display: flex; align-items: center; justify-content: center; gap: .4rem; text-align: center; max-width: 640px; margin: 1.5rem auto 0; }
.info-premium .info-ico { background: color-mix(in srgb, #d97706 14%, transparent); color: #d97706; }
.album-full .album-upload { opacity: .6; }

/* Ad spaces – never on top of content */
.ad-label { display: block; font-size: .66rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: .3rem; text-align: center; }
.ad-rail {
  position: fixed; top: 96px; z-index: 5; width: 160px;
  /* centred in the empty margin beside the 1200px content column */
  left: calc((100vw - 1200px) / 4 - 80px);
}
.ad-right { left: auto; right: calc((100vw - 1200px) / 4 - 80px); }
.ad-strip { border-top: 1px solid var(--border); padding: .9rem 0 1rem; }
.ad-strip .container { max-width: 760px; }
.ad-placeholder {
  display: grid; place-content: center; gap: .2rem; text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: 10px; color: var(--muted); font-size: .8rem; font-weight: 600;
  background: repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--border) 45%, transparent) 10px 20px);
}
.ad-placeholder small { font-weight: 500; font-size: .7rem; }
.ad-rail-size { width: 160px; height: 600px; }
.ad-strip-size { width: 100%; height: 90px; }
@media (max-width: 760px) {
  .plan-grid { grid-template-columns: 1fr; }
  .ad-strip-size { height: 60px; }
}
