/* ==========================================================================
   TripPlanner — design system
   Theme tokens are set on :root by js/theme.js (preset + user overrides).
   ========================================================================== */
:root {
  --accent: #7c5cff; --accent-2: #00d4ff; --accent-rgb: 124, 92, 255;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', var(--font);
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --fs: 15px; --radius: 16px; --radius-sm: 10px; --blur: 18px;
  --gap: 18px; --pad: 20px; --speed: 1;
  --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444; --info: #38bdf8;
  --sidebar-w: 248px;
}
html[data-mode="dark"] {
  --bg: #07070f; --bg-2: #0e0e1c;
  --surface: rgba(255, 255, 255, .055); --surface-2: rgba(255, 255, 255, .09); --surface-solid: #14142a;
  --border: rgba(255, 255, 255, .10); --border-strong: rgba(255, 255, 255, .2);
  --text: #eef0ff; --muted: #9aa0c3; --faint: #5f6488;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45); --input: rgba(255, 255, 255, .06);
  color-scheme: dark;
}
html[data-mode="light"] {
  --bg: #f4f5fb; --bg-2: #e9ebf7;
  --surface: rgba(255, 255, 255, .72); --surface-2: rgba(255, 255, 255, .92); --surface-solid: #ffffff;
  --border: rgba(20, 20, 60, .10); --border-strong: rgba(20, 20, 60, .22);
  --text: #14142b; --muted: #5d6185; --faint: #9a9dbb;
  --shadow: 0 10px 34px rgba(30, 30, 90, .12); --input: rgba(255, 255, 255, .9);
  color-scheme: light;
}
html[data-density="compact"] { --fs: 14px; --gap: 12px; --pad: 14px; }
html[data-anim="none"] *, html[data-anim="none"] *::before, html[data-anim="none"] *::after { animation: none !important; transition: none !important; }
html[data-anim="reduced"] { --speed: .5; }
@media (prefers-reduced-motion: reduce) { html:not([data-anim="full"]) *, html:not([data-anim="full"]) *::before { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: var(--fs); line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0 0 .4em; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
::selection { background: rgba(var(--accent-rgb), .35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: .85em; } .tiny { font-size: .75em; }
.mono { font-family: var(--font-mono); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; } .row.end { justify-content: flex-end; } .row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; } .stack > * + * { margin-top: 10px; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- animated background ---------- */
#bg-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: radial-gradient(1200px 800px at 80% -10%, var(--bg-2), var(--bg)); }
#bg-fx .blob { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(90px); opacity: .32; animation: drift calc(28s / var(--speed)) ease-in-out infinite alternate; }
html[data-mode="light"] #bg-fx .blob { opacity: .22; }
#bg-fx .b1 { background: var(--accent); top: -15vmax; left: -10vmax; }
#bg-fx .b2 { background: var(--accent-2); bottom: -18vmax; right: -12vmax; animation-delay: -9s; }
#bg-fx .b3 { background: #ff5ea8; top: 30%; left: 45%; width: 30vmax; height: 30vmax; opacity: .14; animation-delay: -16s; }
#bg-fx canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
html[data-bg="none"] #bg-fx .blob, html[data-bg="grid"] #bg-fx .blob, html[data-bg="particles"] #bg-fx .blob { display: none; }
html[data-bg="grid"] #bg-fx { background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 44px 44px; background-color: var(--bg); }
html[data-bg="mesh"] #bg-fx .blob { filter: blur(140px); opacity: .45; }
@keyframes drift { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(8vw, 6vh) scale(1.15); } 100% { transform: translate(-6vw, 10vh) scale(.95); } }

/* ---------- boot ---------- */
.boot { height: 100vh; display: grid; place-items: center; }
.boot-plane { font-size: 52px; animation: fly 1.6s ease-in-out infinite; }
@keyframes fly { 0%, 100% { transform: translate(-20px, 6px) rotate(-6deg); } 50% { transform: translate(20px, -8px) rotate(4deg); } }

/* ---------- glass surfaces ---------- */
.glass, .card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(var(--blur)) saturate(1.4); -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  box-shadow: var(--shadow);
}
html[data-surface="solid"] .glass, html[data-surface="solid"] .card { background: var(--surface-solid); backdrop-filter: none; }
.card { padding: var(--pad); position: relative; }
.card.hover { transition: transform calc(.25s / var(--speed)), border-color .25s, box-shadow .25s; }
.card.hover:hover { transform: translateY(-3px); border-color: rgba(var(--accent-rgb), .45); box-shadow: var(--shadow), 0 0 0 1px rgba(var(--accent-rgb), .2), 0 12px 40px rgba(var(--accent-rgb), .18); }
html[data-glow="off"] .card.hover:hover { box-shadow: var(--shadow); }
.card-title { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 12px; }
.card-title h3 { margin: 0; display: flex; gap: 8px; align-items: center; }
.grid { display: grid; gap: var(--gap); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
@media (max-width: 1100px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- buttons & inputs ---------- */
.btn {
  --b: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--b); color: var(--text);
  font: 600 .92em var(--font); cursor: pointer; position: relative; overflow: hidden; white-space: nowrap;
  transition: transform .15s, background .2s, border-color .2s, box-shadow .2s; user-select: none;
}
.btn:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; box-shadow: 0 6px 22px rgba(var(--accent-rgb), .4); }
.btn.primary:hover { box-shadow: 0 8px 30px rgba(var(--accent-rgb), .6); }
.btn.danger { color: var(--bad); } .btn.danger:hover { background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .4); }
.btn.ghost { background: transparent; border-color: transparent; } .btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 6px 10px; font-size: .82em; border-radius: 9px; }
.btn.icon { padding: 8px; width: 36px; height: 36px; } .btn.icon.sm { width: 30px; height: 30px; padding: 5px; }
.btn .ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255, 255, 255, .35); animation: ripple .6s linear; pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.sm svg.i { width: 15px; height: 15px; }

label.f { display: block; font-size: .82em; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
label.f > span { display: block; margin-bottom: 5px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: .95em; color: var(--text); background: var(--input);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .22); }
textarea { resize: vertical; min-height: 70px; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
input[type="color"] { padding: 2px; height: 38px; width: 56px; cursor: pointer; }
input[type="range"] { padding: 0; accent-color: var(--accent); }
select option { background: var(--surface-solid); color: var(--text); }
.inline-input { background: transparent; border-color: transparent; padding: 4px 8px; }
.inline-input:hover { border-color: var(--border); }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 30px; cursor: pointer; transition: .25s; }
.switch span::before { content: ""; position: absolute; height: 18px; width: 18px; left: 2px; top: 2px; background: var(--muted); border-radius: 50%; transition: .25s cubic-bezier(.3, 1.6, .5, 1); }
.switch input:checked + span { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.switch input:checked + span::before { transform: translateX(18px); background: #fff; }
.seg-ctl { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); gap: 2px; flex-wrap: wrap; }
.seg-ctl button { border: 0; background: transparent; color: var(--muted); font: 600 .85em var(--font); padding: 6px 12px; border-radius: 9px; cursor: pointer; transition: .2s; }
.seg-ctl button.on { background: var(--surface-2); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }

/* ---------- chips, badges, avatars ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 30px; font-size: .78em; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.chip.accent { background: rgba(var(--accent-rgb), .16); border-color: rgba(var(--accent-rgb), .35); color: var(--text); }
.chip.ok { background: rgba(34, 197, 94, .14); border-color: rgba(34, 197, 94, .35); }
.chip.warn { background: rgba(245, 158, 11, .14); border-color: rgba(245, 158, 11, .35); }
.chip.bad { background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .35); }
.chip.info { background: rgba(56, 189, 248, .14); border-color: rgba(56, 189, 248, .35); }
.chip.click { cursor: pointer; transition: .2s; } .chip.click:hover { border-color: var(--accent); }
.chip.off { opacity: .45; text-decoration: line-through; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font: 700 .72em var(--font); color: #fff; flex: none; border: 2px solid var(--bg); box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.avatar.lg { width: 52px; height: 52px; font-size: 1.05em; }
.avatars { display: flex; } .avatars .avatar + .avatar { margin-left: -8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--border); background: var(--surface); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font: 700 1.2rem var(--font-display); }
.brand .logo { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 20px rgba(var(--accent-rgb), .5); font-size: 18px; animation: pulse-glow 4s ease-in-out infinite; }
@keyframes pulse-glow { 50% { box-shadow: 0 6px 30px rgba(var(--accent-rgb), .8); } }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--muted); font-weight: 600; transition: .2s; position: relative; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.on { color: var(--text); background: linear-gradient(90deg, rgba(var(--accent-rgb), .22), transparent); }
.nav a.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 4px; background: linear-gradient(var(--accent), var(--accent-2)); }
.nav .sep { height: 1px; background: var(--border); margin: 10px 6px; }
.nav .label { font-size: .7em; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); padding: 6px 12px; font-weight: 700; }
.sidebar .me { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.main { min-width: 0; padding: 26px clamp(16px, 3vw, 38px) 90px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.topbar h1 { margin: 0; }
.crumbs { color: var(--muted); font-size: .85em; display: flex; gap: 6px; align-items: center; }
.mobile-nav { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 16px 16px 96px; }
  .mobile-nav { display: flex; position: fixed; bottom: 10px; left: 10px; right: 10px; z-index: 40; justify-content: space-around; padding: 6px; border-radius: 20px; }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; color: var(--muted); font-size: .68em; font-weight: 600; border-radius: 14px; }
  .mobile-nav a.on { color: var(--text); background: rgba(var(--accent-rgb), .2); }
  h1 { font-size: 1.5rem; }
}

/* ---------- page transitions ---------- */
.page { animation: page-in calc(.45s / var(--speed)) cubic-bezier(.2, .8, .2, 1); }
@keyframes page-in { from { opacity: 0; transform: translateY(12px) scale(.995); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.stagger > * { animation: rise calc(.5s / var(--speed)) cubic-bezier(.2, .8, .2, 1) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; } .stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .1s; } .stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; } .stagger > *:nth-child(6) { animation-delay: .22s; }
.stagger > *:nth-child(n+7) { animation-delay: .26s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.gradient-text { background: linear-gradient(120deg, var(--text) 10%, var(--accent) 50%, var(--accent-2) 90%); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 8s linear infinite; }
@keyframes shine { to { background-position: 200% center; } }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: var(--radius); min-height: 120px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { padding: 8vh 6vw; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-hero h1 { font-size: clamp(2.2rem, 4.4vw, 4rem); line-height: 1.05; }
.auth-hero p { font-size: 1.1em; color: var(--muted); max-width: 520px; }
.auth-hero .orbit { position: absolute; right: -120px; top: 50%; width: 520px; height: 520px; margin-top: -260px; border-radius: 50%; border: 1px dashed var(--border-strong); animation: spin calc(40s / var(--speed)) linear infinite; }
.auth-hero .orbit span { position: absolute; top: -18px; left: 50%; font-size: 30px; transform: rotate(90deg); }
.auth-hero .orbit.o2 { width: 360px; height: 360px; margin-top: -180px; right: -40px; animation-duration: calc(26s / var(--speed)); animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-card { margin: auto; width: min(420px, 92vw); padding: 34px; }
.feature-list { display: grid; gap: 10px; margin-top: 26px; }
.feature-list div { display: flex; gap: 10px; align-items: center; color: var(--muted); }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-hero { padding: 40px 22px 10px; } .auth-hero .orbit { display: none; } .feature-list { display: none; } }

/* ---------- dashboard ---------- */
.hero { padding: 28px; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--accent-rgb), .35), transparent 70%); }
.stat { display: flex; gap: 14px; align-items: center; }
.stat .ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: rgba(var(--accent-rgb), .15); color: var(--accent); flex: none; }
.stat b { font: 700 1.5rem var(--font-display); display: block; line-height: 1.1; }
.trip-card { padding: 0; overflow: hidden; cursor: pointer; transform-style: preserve-3d; }
.trip-card .cover { height: 120px; position: relative; display: grid; place-items: center; font-size: 46px; overflow: hidden; }
.trip-card .cover::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, var(--c1), var(--c2)); opacity: .85; }
.trip-card .cover::after { content: ""; position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent, rgba(255, 255, 255, .25), transparent 30%); animation: spin calc(12s / var(--speed)) linear infinite; opacity: 0; transition: opacity .4s; }
.trip-card:hover .cover::after { opacity: 1; }
.trip-card .cover .em { position: relative; z-index: 1; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .3)); transition: transform .4s cubic-bezier(.3, 1.6, .5, 1); }
.trip-card:hover .cover .em { transform: scale(1.18) rotate(-6deg); }
.trip-card .cover .chip { position: absolute; top: 10px; right: 10px; z-index: 1; background: rgba(0, 0, 0, .35); color: #fff; border: 0; backdrop-filter: blur(6px); }
.trip-card .body { padding: 16px 18px 18px; }
.progress { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.new-card { display: grid; place-items: center; min-height: 230px; border: 2px dashed var(--border-strong); background: transparent; cursor: pointer; color: var(--muted); box-shadow: none; }
.new-card:hover { color: var(--text); border-color: var(--accent); }
.new-card .plus { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(var(--accent-rgb), .15); color: var(--accent); margin: 0 auto 10px; transition: transform .4s cubic-bezier(.3, 1.6, .5, 1); }
.new-card:hover .plus { transform: rotate(90deg) scale(1.1); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 46px; margin-bottom: 8px; animation: fly 3s ease-in-out infinite; display: inline-block; }

/* ---------- trip header & tabs ---------- */
.trip-head { padding: 24px 26px; overflow: hidden; margin-bottom: 16px; }
.trip-head::before { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, color-mix(in srgb, var(--tc, var(--accent)) 30%, transparent), transparent 60%); pointer-events: none; }
.trip-head .em { font-size: 44px; line-height: 1; }
.trip-head h1 { margin: 0; }
.countdown { font: 700 1.6rem var(--font-display); }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; margin-bottom: 18px; border-radius: 16px; scrollbar-width: none; position: sticky; top: 8px; z-index: 15; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: flex; gap: 8px; align-items: center; padding: 9px 14px; border-radius: 12px; color: var(--muted); font-weight: 600; font-size: .9em; white-space: nowrap; transition: .2s; }
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a.on { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 16px rgba(var(--accent-rgb), .45); }

/* ---------- ribbon (draggable date ranges) ---------- */
.ribbon { position: relative; overflow-x: auto; padding-bottom: 6px; }
.ribbon-inner { position: relative; min-width: 100%; }
.ribbon-days { display: grid; gap: 0; }
.ribbon-day { text-align: center; padding: 6px 2px; border-left: 1px solid var(--border); font-size: .72em; color: var(--muted); user-select: none; }
.ribbon-day b { display: block; color: var(--text); font-size: 1.25em; font-family: var(--font-display); }
.ribbon-day.today { background: rgba(var(--accent-rgb), .14); border-radius: 8px; }
.ribbon-day.weekend { background: var(--surface); }
.ribbon-lanes { position: relative; margin-top: 6px; }
.rbar { position: absolute; height: 34px; border-radius: 10px; display: flex; align-items: center; padding: 0 12px; font-weight: 600; font-size: .84em; color: #fff; cursor: grab; user-select: none; touch-action: none; background: linear-gradient(135deg, var(--bc), color-mix(in srgb, var(--bc) 65%, #000)); box-shadow: 0 4px 14px color-mix(in srgb, var(--bc) 45%, transparent); transition: box-shadow .2s, transform .15s; overflow: hidden; white-space: nowrap; }
.rbar:hover { transform: translateY(-1px); box-shadow: 0 8px 22px color-mix(in srgb, var(--bc) 60%, transparent); }
.rbar.dragging { cursor: grabbing; opacity: .9; z-index: 5; transition: none; transform: scale(1.02); }
.rbar .h { position: absolute; top: 0; bottom: 0; width: 10px; cursor: ew-resize; }
.rbar .h::after { content: ""; position: absolute; top: 9px; bottom: 9px; left: 4px; width: 2px; border-radius: 2px; background: rgba(255, 255, 255, .7); }
.rbar .h.l { left: 0; } .rbar .h.r { right: 0; }
.ribbon-act { position: absolute; height: 6px; border-radius: 3px; background: var(--muted); opacity: .6; }

/* ---------- itinerary board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.day-col { padding: 12px; min-height: 200px; }
.day-col header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; gap: 8px; }
.day-col header b { font: 700 1.05rem var(--font-display); }
.day-col .seg-tag { font-size: .72em; padding: 2px 8px; border-radius: 6px; color: #fff; }
.drop-list { min-height: 60px; display: flex; flex-direction: column; gap: 8px; border-radius: 12px; }
.drop-list.empty-drop { border: 2px dashed var(--border); }
.act { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--ac, var(--accent)); cursor: grab; transition: transform .15s, box-shadow .2s, border-color .2s; position: relative; }
.act:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, .18); border-color: var(--border-strong); border-left-color: var(--ac, var(--accent)); }
.act .t { font-weight: 650; display: flex; gap: 6px; align-items: center; }
.act .meta { font-size: .78em; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.act .acts { display: flex; gap: 4px; margin-top: 8px; opacity: .0; transition: opacity .2s; }
.act:hover .acts, .act:focus-within .acts { opacity: 1; }
@media (hover: none) { .act .acts { opacity: 1; } }
.act.st-done { opacity: .75; } .act.st-done .t span.title { text-decoration: line-through; text-decoration-color: var(--ok); }
.act.st-skipped, .act.st-cancelled { opacity: .5; }
.act.st-in_progress { box-shadow: 0 0 0 2px var(--warn); animation: pulse-ring 2s infinite; }
@keyframes pulse-ring { 50% { box-shadow: 0 0 0 5px rgba(245, 158, 11, .25); } }
.sortable-ghost { opacity: .35; } .sortable-chosen { transform: rotate(1.5deg) scale(1.02); box-shadow: 0 14px 34px rgba(0, 0, 0, .35) !important; }
.drive-pill { padding: 8px 12px; border-radius: 12px; border: 1px dashed var(--border-strong); font-size: .82em; display: flex; gap: 8px; align-items: center; color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .9em; }
table.t th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8em; text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr:hover td { background: var(--surface); }
.matrix td.cell { text-align: center; }
.tog { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--border); display: inline-grid; place-items: center; cursor: pointer; transition: .2s cubic-bezier(.3, 1.6, .5, 1); background: var(--surface); color: var(--faint); }
.tog.on { background: rgba(34, 197, 94, .18); border-color: rgba(34, 197, 94, .5); color: var(--ok); }
.tog:hover { transform: scale(1.12); }

/* ---------- checklist ---------- */
.check { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; transition: background .2s; }
.check:hover { background: var(--surface); }
.check .box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--border-strong); display: grid; place-items: center; cursor: pointer; flex: none; transition: .25s cubic-bezier(.3, 1.6, .5, 1); }
.check .box svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; opacity: 0; transform: scale(.4); transition: .25s; }
.check.done .box { background: linear-gradient(135deg, var(--ok), #4ade80); border-color: transparent; }
.check.done .box svg { opacity: 1; transform: none; }
.check.done .txt { text-decoration: line-through; color: var(--muted); }
.ring { --p: 0; width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); position: relative; transition: --p 1s; }
.ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface-solid); }
.ring b { position: relative; font: 700 1.1rem var(--font-display); }
@property --p { syntax: '<number>'; inherits: false; initial-value: 0; }

/* ---------- budget ---------- */
.bar-row { display: grid; grid-template-columns: 120px 1fr 90px; gap: 10px; align-items: center; margin-bottom: 10px; font-size: .88em; }
.bars { display: grid; gap: 3px; }
.bars i { display: block; height: 8px; border-radius: 6px; transition: width 1s cubic-bezier(.2, .8, .2, 1); min-width: 2px; }
.bars i.p { background: rgba(var(--accent-rgb), .55); } .bars i.a { background: linear-gradient(90deg, var(--accent-2), var(--accent)); }

/* ---------- journal & log ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--accent), var(--accent-2), transparent); }
.tl-item { position: relative; margin-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 16px; width: 12px; height: 12px; border-radius: 50%; background: var(--kc, var(--accent)); box-shadow: 0 0 0 4px var(--bg), 0 0 14px var(--kc, var(--accent)); }
.log-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.log-item:hover { background: var(--surface); }
.log-item .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.log-item .ico.create { background: rgba(34, 197, 94, .15); color: var(--ok); }
.log-item .ico.update { background: rgba(56, 189, 248, .15); color: var(--info); }
.log-item .ico.delete { background: rgba(239, 68, 68, .15); color: var(--bad); }
.log-item .ico.revert { background: rgba(245, 158, 11, .15); color: var(--warn); }
.log-item.reverted { opacity: .55; }
.diff { margin-top: 8px; font-size: .82em; display: grid; grid-template-columns: max-content 1fr 1fr; gap: 3px 12px; }
.diff .k { color: var(--muted); font-weight: 600; } .diff .b { color: var(--bad); text-decoration: line-through; word-break: break-word; } .diff .a { color: var(--ok); word-break: break-word; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(5, 5, 15, .55); backdrop-filter: blur(6px); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 24px; animation: pop calc(.35s / var(--speed)) cubic-bezier(.3, 1.4, .5, 1); background: var(--surface-solid); }
.modal.wide { width: min(900px, 100%); }
.modal header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.modal footer .left { margin-right: auto; }
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
.closing { animation: fade .18s reverse forwards !important; }
@media (max-width: 600px) { .modal-back { place-items: end center; padding: 0; } .modal { border-radius: 22px 22px 0 0; max-height: 92vh; } }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 240px; max-width: 380px; padding: 12px 16px; border-radius: 14px; display: flex; gap: 10px; align-items: center; animation: toast-in .45s cubic-bezier(.3, 1.4, .5, 1); background: var(--surface-solid); border: 1px solid var(--border); box-shadow: var(--shadow); border-left: 4px solid var(--tc, var(--accent)); }
.toast.out { animation: toast-out .3s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(60px) scale(.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(60px); } }
@media (max-width: 600px) { #toasts { left: 16px; right: 16px; } .toast { max-width: none; } }

/* ---------- AI chat ---------- */
.ai-fab { position: fixed; right: 24px; bottom: 24px; z-index: 50; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 30px rgba(var(--accent-rgb), .55); display: grid; place-items: center; transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.ai-fab::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(var(--accent-rgb), .5); animation: orb 2.4s ease-out infinite; }
@keyframes orb { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.ai-fab:hover { transform: scale(1.1) rotate(8deg); }
.ai-fab svg.i { width: 26px; height: 26px; }
@media (max-width: 900px) { .ai-fab { bottom: 88px; right: 16px; width: 54px; height: 54px; } }
.ai-panel { position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(440px, calc(100vw - 24px)); z-index: 90; display: flex; flex-direction: column; background: var(--surface-solid); transform: translateX(110%); transition: transform calc(.45s / var(--speed)) cubic-bezier(.2, .9, .2, 1); }
.ai-panel.open { transform: none; }
.ai-panel header { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.ai-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; animation: rise .35s cubic-bezier(.2, .8, .2, 1); word-wrap: break-word; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg p { margin: .3em 0; } .msg ul, .msg ol { margin: .3em 0; padding-left: 1.3em; }
.msg table { border-collapse: collapse; font-size: .85em; } .msg td, .msg th { border: 1px solid var(--border); padding: 3px 6px; }
.msg .changes { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border-strong); font-size: .8em; color: var(--muted); }
.typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-6px); opacity: 1; } }
.ai-input { padding: 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: flex-end; }
.ai-input textarea { min-height: 44px; max-height: 160px; resize: none; }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 10px; }

/* ---------- calendar (FullCalendar theming) ---------- */
.fc { --fc-border-color: var(--border); --fc-page-bg-color: transparent; --fc-neutral-bg-color: var(--surface); --fc-today-bg-color: rgba(var(--accent-rgb), .1); --fc-event-border-color: transparent; --fc-button-bg-color: var(--surface-2); --fc-button-border-color: var(--border); --fc-button-text-color: var(--text); --fc-button-hover-bg-color: var(--surface); --fc-button-active-bg-color: var(--accent); --fc-list-event-hover-bg-color: var(--surface-2); font-size: .88em; }
.fc .fc-button { border-radius: 10px !important; font-weight: 600; text-transform: capitalize; box-shadow: none !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 0; }
.fc .fc-toolbar-title { font-family: var(--font-display); font-size: 1.25em; }
.fc-event { border-radius: 8px !important; padding: 1px 3px; box-shadow: 0 3px 10px rgba(0, 0, 0, .2); cursor: pointer; transition: filter .2s; }
.fc-event:hover { filter: brightness(1.12); }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { color: var(--text); }
.fc .fc-timegrid-slot-label, .fc .fc-list-day-cushion { color: var(--muted); }
.fc-theme-standard .fc-list-day-cushion { background: var(--surface); }
.fc .fc-highlight { background: rgba(var(--accent-rgb), .25); }
.fc-event.ev-segment { font-weight: 700; }
.fc-event.st-done { opacity: .6; } .fc-event.st-skipped, .fc-event.st-cancelled { opacity: .35; text-decoration: line-through; }
.cal-layout { display: grid; grid-template-columns: 1fr 260px; gap: var(--gap); }
@media (max-width: 1000px) { .cal-layout { grid-template-columns: 1fr; } }
.idea { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--ac, var(--accent)); cursor: grab; font-size: .88em; margin-bottom: 6px; }

/* ---------- map ---------- */
.map { height: 460px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); z-index: 0; }
.leaflet-container { background: var(--bg-2); font-family: var(--font); }
html[data-mode="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface-solid); color: var(--text); }
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center; background: var(--pc, var(--accent)); box-shadow: 0 4px 12px rgba(0, 0, 0, .35); border: 2px solid #fff; }
.pin span { transform: rotate(45deg); font-size: 13px; }
.drive-card { cursor: pointer; }
.drive-card.sel { border-color: var(--accent); box-shadow: var(--shadow), 0 0 0 2px rgba(var(--accent-rgb), .35); }
.route-line { display: flex; align-items: center; gap: 8px; }
.route-line .ln { flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--accent) 0 8px, transparent 8px 14px); background-size: 28px 2px; animation: dash 1s linear infinite; }
@keyframes dash { to { background-position: 28px 0; } }
.suggest-box { position: relative; }
.suggest-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; max-height: 240px; overflow: auto; background: var(--surface-solid); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); margin-top: 4px; }
.suggest-list div { padding: 8px 12px; cursor: pointer; font-size: .85em; } .suggest-list div:hover { background: var(--surface-2); }

/* ---------- settings ---------- */
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 74px; border-radius: 14px; padding: 6px; border: 2px solid var(--border); cursor: pointer; text-align: center; font-size: .72em; font-weight: 600; transition: .2s; background: var(--surface); }
.swatch i { display: block; height: 34px; border-radius: 9px; margin-bottom: 4px; }
.swatch.on { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(var(--accent-rgb), .35); }
.setting { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: 0; }
.setting .d { color: var(--muted); font-size: .82em; }
.setting > :last-child { flex: none; max-width: 55%; }
.advanced-toggle { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; color: var(--accent); font-weight: 600; font-size: .9em; margin-top: 10px; }
.reveal { animation: rise .4s cubic-bezier(.2, .8, .2, 1); }

/* confetti */
.confetti { position: fixed; top: -10px; width: 10px; height: 14px; z-index: 300; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

/* ---------- refinements ---------- */
.form-grid { gap: 0 14px; }
.act .acts { display: none; opacity: 1; }
.act:hover .acts, .act:focus-within .acts { display: flex; }
@media (hover: none) { .act .acts { display: flex; } }
@media (max-width: 760px) {
  .trip-head { padding: 18px; }
  .trip-head > .row { flex-direction: column; align-items: stretch; }
  .trip-head .em { font-size: 34px; }
  .trip-head h1 { white-space: normal; font-size: 1.4rem; }
  .hide-sm { display: none; }
  .board { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: 1fr; }
  .setting { flex-direction: column; align-items: stretch; } .setting > :last-child { max-width: none; }
  .log-item { grid-template-columns: auto 1fr; } .log-item > :last-child { grid-column: 2; text-align: left !important; }
  .bar-row { grid-template-columns: 90px 1fr 70px; }
}
.trip-card .cover .chip { font-size: 12px; }
.mini-map { height: 150px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); margin-top: 8px; z-index: 0; }
.place-hint:empty { display: none; }
.route-stop { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.route-stop .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 700 .78em var(--font); color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.route-stop.base .num { background: #0d9488; }
.route-stop.off { opacity: .45; }
.route-leg { font-size: .76em; color: var(--muted); padding: 2px 0 2px 44px; display: flex; gap: 8px; align-items: center; }
.route-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; }
.route-layout .map { height: 420px; }
@media (max-width: 800px) { .route-layout { grid-template-columns: 1fr; } .route-layout .map { height: 300px; } }
.npin { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 700 12px var(--font); border: 2px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,.35); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.npin.base { background: #0d9488; }
.saving-badge { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 12px; background: rgba(34,197,94,.14); border: 1px solid rgba(34,197,94,.35); font-weight: 600; font-size: .85em; }
.gmap { width: 100%; border: 0; border-radius: var(--radius-sm); display: block; background: var(--surface-2); }
.map-ph { display: flex; gap: 14px; align-items: center; padding: 22px; border: 2px dashed var(--border-strong); border-radius: var(--radius-sm); color: var(--muted); background: repeating-linear-gradient(45deg, transparent 0 12px, var(--surface) 12px 24px); }
.map-ph > svg.i { width: 34px; height: 34px; flex: none; color: var(--accent); }
