:root {
  --navy-950: #071426;
  --navy-900: #0b1f3a;
  --navy-800: #12325a;
  --gold-500: #f5b83b;
  --gold-100: #fff3cf;
  --ink-900: #172033;
  --ink-700: #3e4a61;
  --ink-500: #718096;
  --ink-400: #94a0b3;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eef1f6;
  --line: #e2e7ef;
  --green-700: #17633b;
  --green-100: #e4f7ec;
  --red-700: #a13333;
  --red-100: #fdeaea;
  --blue-700: #2559a7;
  --blue-100: #e8f0ff;
  --amber-700: #9b5b08;
  --amber-100: #fff2d8;
  --shadow-sm: 0 1px 2px rgba(7, 20, 38, .05);
  --shadow-md: 0 14px 40px rgba(7, 20, 38, .12);
  --radius-sm: 9px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --sidebar: 252px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink-900);
  background: var(--surface-2);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
svg { display: block; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 30;
  display: flex; flex-direction: column;
  padding: 22px 16px 16px;
  color: #d9e3f2;
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--gold-500); color: var(--navy-950);
  font-weight: 900; font-size: 18px;
  box-shadow: 0 6px 20px rgba(245, 184, 59, .24);
}
.brand-copy strong { display: block; color: #fff; font-size: 16px; line-height: 1.1; }
.brand-copy span { color: #8ea4c2; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.nav-label { padding: 13px 12px 7px; color: #6f86a6; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.nav { display: grid; gap: 4px; }
.nav-link {
  min-height: 44px; display: flex; align-items: center; gap: 12px;
  padding: 0 12px; border-radius: 11px;
  color: #aebed4; font-weight: 650;
  transition: .16s ease;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-link.active { color: #fff; background: rgba(245,184,59,.15); box-shadow: inset 3px 0 var(--gold-500); }
.nav-link .icon { width: 19px; height: 19px; flex: 0 0 auto; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 99px; background: rgba(255,255,255,.1); color: #fff; font-size: 11px; }
.sidebar-footer { margin-top: auto; padding-top: 18px; }
.scan-health { padding: 14px; border: 1px solid rgba(255,255,255,.09); border-radius: 14px; background: rgba(255,255,255,.045); }
.scan-health-head { display: flex; justify-content: space-between; gap: 10px; color: #fff; font-size: 12px; font-weight: 700; }
.scan-health p { margin: 5px 0 10px; color: #8ea4c2; font-size: 11px; }
.progress { height: 7px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.1); }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--gold-500); }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  min-height: 68px; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; border-bottom: 1px solid rgba(226,231,239,.9);
  background: rgba(255,255,255,.88); backdrop-filter: blur(14px);
}
.mobile-menu { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-700); }
.topbar-context { min-width: 0; }
.topbar-context small { display: block; color: var(--ink-500); font-size: 11px; }
.topbar-context strong { display: block; overflow: hidden; color: var(--ink-900); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  position: relative; width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink-700);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .icon { width: 18px; height: 18px; }
.notification-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border: 2px solid #fff; border-radius: 50%; background: #e25757; }
.user-menu { display: flex; align-items: center; gap: 10px; padding: 5px 7px 5px 5px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--navy-900); color: #fff; font-size: 12px; font-weight: 800; }
.user-copy { text-align: left; }
.user-copy strong { display: block; color: var(--ink-900); font-size: 12px; line-height: 1.2; }
.user-copy span { display: block; color: var(--ink-500); font-size: 10px; }

.content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 28px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.page-title h1 { margin: 0; font-size: clamp(24px, 2.5vw, 32px); line-height: 1.15; letter-spacing: -.025em; }
.page-title p { margin: 7px 0 0; max-width: 720px; color: var(--ink-500); font-size: 14px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 9px; }

.btn {
  min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 15px; border: 1px solid transparent; border-radius: 10px;
  background: var(--gold-500); color: var(--navy-950); font-weight: 800;
  box-shadow: var(--shadow-sm); transition: .16s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.02); }
.btn:active { transform: translateY(0); }
.btn .icon { width: 17px; height: 17px; }
.btn.secondary { border-color: var(--line); background: #fff; color: var(--ink-700); font-weight: 700; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-700); }
.btn.danger { background: var(--red-100); color: var(--red-700); }
.btn.small { min-height: 34px; padding: 0 11px; font-size: 12px; }
.btn.full { width: 100%; }

.card { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; }
.card-head h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.card-head p { margin: 4px 0 0; color: var(--ink-500); font-size: 12px; }
.card-body { padding: 0 20px 20px; }
.card-link { color: var(--blue-700); font-size: 12px; font-weight: 750; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { min-height: 126px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metric-label { color: var(--ink-500); font-size: 12px; font-weight: 700; }
.metric-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: var(--surface-3); color: var(--navy-800); }
.metric-icon .icon { width: 18px; height: 18px; }
.metric-value { margin-top: 12px; font-size: 28px; font-weight: 850; letter-spacing: -.025em; }
.metric-note { color: var(--ink-500); font-size: 11px; }
.metric-note.good { color: var(--green-700); font-weight: 700; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 18px; margin-bottom: 18px; }
.grid-equal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }

.tour-card { padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(145deg, #fff 0%, #fffaf0 100%); }
.tour-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.tour-card h3 { margin: 0; font-size: 16px; }
.tour-card .route { margin-top: 5px; color: var(--ink-500); font-size: 12px; }
.big-fare { color: var(--green-700); font-size: 22px; font-weight: 850; white-space: nowrap; }
.big-fare small { display: block; color: var(--ink-500); font-size: 10px; font-weight: 600; text-align: right; }
.journey { margin-top: 16px; display: grid; gap: 10px; }
.journey-row { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 10px; align-items: center; }
.journey-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--blue-100); color: var(--blue-700); }
.journey-icon.land { background: var(--surface-3); color: var(--ink-500); }
.journey-icon .icon { width: 17px; height: 17px; }
.journey-main strong { display: block; font-size: 13px; }
.journey-main span { color: var(--ink-500); font-size: 11px; }
.journey-price { font-size: 12px; font-weight: 750; white-space: nowrap; }

.alert-summary { display: flex; flex-direction: column; min-height: 100%; }
.empty-mini { flex: 1; min-height: 184px; display: grid; place-items: center; text-align: center; padding: 18px; }
.empty-mini-icon { width: 48px; height: 48px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 15px; background: var(--green-100); color: var(--green-700); }
.empty-mini-icon .icon { width: 22px; height: 22px; }
.empty-mini h3 { margin: 0 0 5px; font-size: 14px; }
.empty-mini p { max-width: 280px; margin: 0; color: var(--ink-500); font-size: 12px; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.search-box { position: relative; flex: 1 1 260px; min-width: 220px; }
.search-box .icon { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; color: var(--ink-400); transform: translateY(-50%); }
.search-box input { padding-left: 38px; }
.input, select, textarea {
  width: 100%; min-height: 40px; padding: 9px 11px;
  border: 1px solid #d7dde7; border-radius: 10px;
  outline: 0; background: #fff; color: var(--ink-900);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, textarea::placeholder { color: #a8b1bf; }
.input:focus, select:focus, textarea:focus { border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(245,184,59,.18); }
select.compact, .input.compact { width: auto; min-width: 150px; }
textarea { min-height: 88px; resize: vertical; }
label { display: block; margin-bottom: 6px; color: var(--ink-700); font-size: 12px; font-weight: 750; }
.field-hint { margin-top: 5px; color: var(--ink-500); font-size: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.field.full { grid-column: 1 / -1; }

.data-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 11px 16px; border-bottom: 1px solid var(--line); background: #fbfcfe; color: var(--ink-500); font-size: 10px; font-weight: 800; letter-spacing: .07em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fcfdff; }
.data-table .right { text-align: right; }
.data-table .center { text-align: center; }
.route-main { display: flex; align-items: center; gap: 11px; min-width: 185px; }
.route-code { width: 56px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; background: var(--navy-900); color: #fff; font-size: 9px; white-space: nowrap; font-weight: 850; letter-spacing: .03em; }
.route-name strong { display: block; font-size: 13px; }
.route-name span { display: block; margin-top: 1px; color: var(--ink-500); font-size: 11px; }
.primary-cell { font-weight: 750; }
.secondary-cell { color: var(--ink-500); font-size: 12px; }
.price { color: var(--green-700); font-weight: 850; white-space: nowrap; }
.kebab { width: 34px; height: 34px; display: grid; place-items: center; margin-left: auto; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink-500); }
.kebab:hover { border-color: var(--line); background: var(--surface-2); }
.kebab .icon { width: 18px; height: 18px; }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 9px; border-radius: 99px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active { background: var(--green-100); color: var(--green-700); }
.badge.pending { background: var(--amber-100); color: var(--amber-700); }
.badge.paused { background: var(--surface-3); color: var(--ink-500); }
.badge.high { background: var(--amber-100); color: var(--amber-700); }
.badge.normal { background: var(--blue-100); color: var(--blue-700); }
.badge.low { background: var(--surface-3); color: var(--ink-500); }
.badge.high::before, .badge.normal::before, .badge.low::before { display: none; }

.section-tabs { display: flex; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.section-tab { min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-500); font-size: 12px; font-weight: 750; }
.section-tab.active { background: #fff; color: var(--ink-900); box-shadow: var(--shadow-sm); }

.route-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.summary-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink-700); font-size: 11px; font-weight: 700; }
.summary-chip strong { color: var(--ink-900); }

.trip-list { display: grid; gap: 12px; }
.trip-item { display: grid; grid-template-columns: minmax(250px,1.4fr) minmax(220px,1fr) 100px 120px 110px 42px; gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.trip-item:hover { border-color: #ccd5e2; box-shadow: var(--shadow-sm); }
.trip-title strong { display: block; }
.trip-title span { display: block; margin-top: 3px; color: var(--ink-500); font-size: 11px; }
.trip-route { display: flex; align-items: center; gap: 7px; color: var(--ink-700); font-size: 12px; font-weight: 700; }
.trip-route .icon { width: 15px; height: 15px; color: var(--blue-700); }

.calendar-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
.calendar-card { overflow: hidden; }
.calendar-toolbar { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.calendar-toolbar h2 { margin: 0 auto; font-size: 16px; }
.calendar-nav { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink-700); }
.calendar-nav .icon { width: 16px; height: 16px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); padding: 10px 14px 16px; }
.weekday { padding: 9px 6px; color: var(--ink-500); font-size: 10px; font-weight: 800; text-align: center; text-transform: uppercase; }
.day { position: relative; min-height: 92px; padding: 9px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); background: #fff; }
.day:nth-child(7n+1) { border-left: 1px solid var(--line); }
.day:nth-last-child(-n+7) { border-bottom: 1px solid var(--line); }
.day.muted-day { background: #fafbfc; color: #b1b9c6; }
.day .date { font-size: 11px; font-weight: 750; }
.day .fare { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 5px 6px; border-radius: 7px; background: var(--green-100); color: var(--green-700); font-size: 11px; font-weight: 850; text-align: center; }
.day.best { background: #fffbef; box-shadow: inset 0 0 0 2px var(--gold-500); }
.day.unscanned::after { content: "Not scanned"; position: absolute; left: 8px; bottom: 9px; color: #b4bdca; font-size: 9px; }
.calendar-side { display: grid; align-content: start; gap: 14px; }
.kpi-stack { display: grid; gap: 10px; }
.kpi-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.kpi-row span { color: var(--ink-500); font-size: 11px; }
.kpi-row strong { font-size: 15px; }
.legend-list { display: grid; gap: 9px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 9px; color: var(--ink-500); font-size: 11px; }
.legend-swatch { width: 20px; height: 14px; border-radius: 4px; background: var(--green-100); }
.legend-swatch.best { background: #fffbef; box-shadow: inset 0 0 0 2px var(--gold-500); }
.legend-swatch.off { background: #fafbfc; border: 1px solid var(--line); }

.empty-state { min-height: 360px; display: grid; place-items: center; padding: 36px; text-align: center; }
.empty-state-icon { width: 70px; height: 70px; display: grid; place-items: center; margin: 0 auto 15px; border-radius: 22px; background: var(--surface-3); color: var(--navy-800); }
.empty-state-icon .icon { width: 30px; height: 30px; }
.empty-state h2 { margin: 0 0 7px; font-size: 18px; }
.empty-state p { max-width: 460px; margin: 0 auto 18px; color: var(--ink-500); }
.empty-state-actions { display: flex; justify-content: center; gap: 9px; flex-wrap: wrap; }

.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.settings-nav { position: sticky; top: 92px; padding: 8px; }
.settings-nav a { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 0 11px; border-radius: 9px; color: var(--ink-500); font-size: 12px; font-weight: 700; }
.settings-nav a.active { background: var(--surface-3); color: var(--ink-900); }
.settings-nav .icon { width: 16px; height: 16px; }
.settings-sections { display: grid; gap: 16px; }
.setting-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.2fr); gap: 22px; padding: 18px 0; border-top: 1px solid var(--line); }
.setting-row:first-child { border-top: 0; padding-top: 0; }
.setting-copy strong { display: block; font-size: 13px; }
.setting-copy p { margin: 4px 0 0; color: var(--ink-500); font-size: 11px; }
.integration-row { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.integration-logo { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-3); color: var(--navy-800); font-weight: 900; }
.integration-copy { flex: 1; min-width: 0; }
.integration-copy strong { display: block; font-size: 13px; }
.integration-copy span { display: block; color: var(--ink-500); font-size: 11px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: none; background: rgba(7,20,38,.48); backdrop-filter: blur(3px); }
.modal-backdrop.open { display: block; }
.drawer { position: absolute; top: 0; right: 0; width: min(610px, 100%); height: 100%; display: flex; flex-direction: column; background: #fff; box-shadow: var(--shadow-md); animation: slideIn .2s ease; }
@keyframes slideIn { from { transform: translateX(20px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 20px; }
.drawer-head p { margin: 5px 0 0; color: var(--ink-500); font-size: 12px; }
.close-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-500); }
.close-btn .icon { width: 18px; height: 18px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 30px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 24px; border-top: 1px solid var(--line); background: #fff; }
.form-section { padding: 0 0 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section-head { margin-bottom: 13px; }
.form-section-head h3 { margin: 0; font-size: 14px; }
.form-section-head p { margin: 4px 0 0; color: var(--ink-500); font-size: 11px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; border-radius: 99px; background: #cfd6e1; transition: .18s; }
.slider::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .18s; }
.switch input:checked + .slider { background: var(--green-700); }
.switch input:checked + .slider::before { transform: translateX(18px); }
details.advanced { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
details.advanced summary { padding: 13px 14px; cursor: pointer; color: var(--ink-700); font-size: 12px; font-weight: 800; }
details.advanced .advanced-body { padding: 2px 14px 15px; }

.segmented { display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.segmented button { min-height: 32px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-500); font-size: 11px; font-weight: 750; }
.segmented button.active { background: #fff; color: var(--ink-900); box-shadow: var(--shadow-sm); }
.trip-builder { display: grid; gap: 10px; }
.leg-row { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 12px; }
.leg-rail { position: relative; display: flex; justify-content: center; }
.leg-rail::after { content: ""; position: absolute; top: 40px; bottom: -12px; width: 2px; background: var(--line); }
.leg-row:last-child .leg-rail::after { display: none; }
.leg-node { position: relative; z-index: 1; width: 36px; height: 36px; display: grid; place-items: center; border: 2px solid var(--gold-500); border-radius: 11px; background: #fff; color: var(--navy-900); }
.leg-node .icon { width: 17px; height: 17px; }
.leg-box { margin-bottom: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.leg-fields { display: grid; grid-template-columns: 1fr 30px 1fr; gap: 8px; align-items: end; }
.leg-arrow { display: grid; place-items: center; height: 40px; color: var(--ink-400); }
.leg-controls { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.inline-field { display: flex; align-items: center; gap: 6px; color: var(--ink-500); font-size: 11px; }
.inline-field input { width: 58px; min-height: 32px; padding: 4px 7px; text-align: center; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: none; align-items: center; gap: 10px; max-width: 360px; padding: 13px 15px; border-radius: 12px; background: var(--navy-900); color: #fff; box-shadow: var(--shadow-md); }
.toast.show { display: flex; animation: toastIn .2s ease; }
.toast .icon { width: 18px; height: 18px; color: var(--gold-500); }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(420px, .95fr); background: #fff; }
.login-visual { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 46px; color: #fff; background: linear-gradient(145deg, var(--navy-900), #0e2b4d 60%, #153c63); }
.login-visual::before, .login-visual::after { content: ""; position: absolute; border-radius: 50%; background: rgba(245,184,59,.12); }
.login-visual::before { width: 380px; height: 380px; right: -100px; top: -90px; }
.login-visual::after { width: 500px; height: 500px; left: -230px; bottom: -240px; }
.login-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; }
.login-brand strong { font-size: 18px; }
.login-message { position: relative; z-index: 1; max-width: 560px; }
.login-message h1 { margin: 0; max-width: 520px; font-size: clamp(34px, 4vw, 56px); line-height: 1.06; letter-spacing: -.035em; }
.login-message h1 span { color: var(--gold-500); }
.login-message p { max-width: 490px; margin: 18px 0 0; color: #b9c7da; font-size: 15px; }
.login-points { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 14px 24px; color: #d5dfec; font-size: 12px; }
.login-points span { display: flex; align-items: center; gap: 8px; }
.login-points .icon { width: 16px; height: 16px; color: var(--gold-500); }
.login-form-wrap { display: grid; place-items: center; padding: 40px; background: #fff; }
.login-card { width: 100%; max-width: 420px; }
.login-card h2 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.login-card > p { margin: 8px 0 26px; color: var(--ink-500); }
.login-card .field { margin-bottom: 15px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px; }
.password-toggle { position: absolute; right: 6px; top: 50%; width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: transparent; color: var(--ink-500); transform: translateY(-50%); }
.password-toggle .icon { width: 17px; height: 17px; }
.login-options { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 4px 0 18px; font-size: 12px; }
.checkline { display: flex; align-items: center; gap: 7px; color: var(--ink-700); }
.checkline input { accent-color: var(--navy-900); }
.help-link { color: var(--blue-700); font-weight: 700; }
.security-note { margin-top: 20px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--ink-500); font-size: 11px; text-align: center; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2, .calendar-layout { grid-template-columns: 1fr; }
  .calendar-side { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .trip-item { grid-template-columns: minmax(230px,1.4fr) minmax(200px,1fr) 90px 110px 42px; }
  .trip-item .trip-travellers { display: none; }
}

@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(290px, 84vw); transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow-md); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 25; background: rgba(7,20,38,.48); }
  .mobile-menu { display: grid; place-items: center; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .settings-nav a { white-space: nowrap; }
  .login-page { grid-template-columns: 1fr; }
  .login-visual { min-height: 360px; padding: 34px; }
  .login-points { display: none; }
}

@media (max-width: 720px) {
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 30px; }
  .user-copy { display: none; }
  .page-head { align-items: stretch; flex-direction: column; }
  .page-actions .btn { flex: 1; }
  .metric-grid, .grid-equal, .calendar-side { grid-template-columns: 1fr; }
  .metric-card { min-height: 110px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .setting-row { grid-template-columns: 1fr; gap: 10px; }
  .trip-item { grid-template-columns: 1fr 42px; }
  .trip-item > :not(.trip-title):not(.kebab) { display: none; }
  .calendar-grid { padding: 8px; }
  .day { min-height: 68px; padding: 6px; }
  .day .fare { left: 4px; right: 4px; bottom: 5px; padding: 3px 2px; font-size: 9px; }
  .day.unscanned::after { display: none; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .leg-fields { grid-template-columns: 1fr; }
  .leg-arrow { display: none; }
  .login-form-wrap { padding: 30px 20px; }
  .login-visual { min-height: 310px; padding: 26px 22px; }
  .login-message h1 { font-size: 36px; }
}

@media (max-width: 720px) {
  .settings-layout, .settings-sections, .settings-nav { min-width: 0; max-width: 100%; }
  .settings-nav { width: 100%; overflow-x: auto; }
  .integration-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; }
  .integration-row .badge { grid-column: 2; justify-self: start; }
  .integration-row .btn { grid-column: 3; grid-row: 1 / span 2; }
}
.icon svg { width: 100%; height: 100%; }
.mobile-menu .icon, .user-menu > .icon { width: 18px; height: 18px; }

/* ============================================================
   Server-rendered additions (flash banners, row/user menus,
   leg-mode differentiation) — Tripate Fares live app.
   ============================================================ */
.flash { margin: 0 0 18px; padding: 12px 15px; border-radius: 11px; font-size: 13px; font-weight: 650; border: 1px solid transparent; }
.flash.ok { background: var(--green-100); color: var(--green-700); border-color: #c9ecd6; }
.flash.err { background: var(--red-100); color: var(--red-700); border-color: #f4d0d0; }

/* Fixed-position dropdown used by row kebabs and the user menu. */
.popover {
  position: fixed; z-index: 120; min-width: 170px; padding: 6px;
  display: none; flex-direction: column; gap: 2px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-md);
}
.popover.open { display: flex; }
.popover a, .popover button {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 38px; padding: 0 11px;
  border: 0; border-radius: 9px; background: transparent; color: var(--ink-700);
  font-size: 12px; font-weight: 700; text-align: left; cursor: pointer;
}
.popover a:hover, .popover button:hover { background: var(--surface-2); }
.popover button.danger { color: var(--red-700); }
.popover button.danger:hover { background: var(--red-100); }
.popover .icon { width: 16px; height: 16px; flex: 0 0 auto; }
.popover form { margin: 0; }
.popover .sep { height: 1px; margin: 4px 2px; background: var(--line); }
.popover .pop-head { padding: 8px 11px 6px; }
.popover .pop-head strong { display: block; font-size: 12px; color: var(--ink-900); }
.popover .pop-head span { display: block; font-size: 11px; color: var(--ink-500); }
.user-menu { cursor: pointer; }

/* Land legs read differently from flight legs in the trip builder. */
.leg-row.land .leg-node { border-color: #cbd3e0; color: var(--ink-500); }
.leg-mode { cursor: default; }

/* Recommended tag inside dashboard price rows. */
.tag { display: inline-flex; align-items: center; min-height: 20px; padding: 0 8px; margin-left: 6px; border-radius: 99px; background: var(--green-100); color: var(--green-700); font-size: 10px; font-weight: 800; }

/* Stacked price rows used on the dashboard (verified prices / flagged windows). */
.stack-list { display: grid; gap: 2px; }
.stack-row { padding: 12px 0; border-top: 1px solid var(--line); }
.stack-row:first-child { border-top: 0; }
.stack-row .stack-title { font-weight: 750; font-size: 13px; }
.stack-row .stack-sub { color: var(--ink-500); font-weight: 500; }
.stack-line { margin-top: 4px; font-size: 13px; color: var(--ink-700); }
.stack-line .price { font-size: 13px; }
.leg-line { margin-top: 4px; font-size: 13px; color: var(--ink-700); display: flex; align-items: baseline; gap: 8px; }
.leg-line .icon { width: 14px; height: 14px; color: var(--blue-700); position: relative; top: 2px; }
.leg-line.land { color: var(--ink-500); }

/* ============================================================
   Searchable comboboxes (airport / airline) + multi-airport
   picker + Tour-months panel.
   ============================================================ */
.combo { position: relative; }
.combo-menu { position: absolute; z-index: 80; left: 0; right: 0; top: calc(100% + 4px); max-height: 244px; overflow-y: auto; padding: 5px; background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-md); }
.combo-menu[hidden] { display: none; }
.combo-opt { display: flex; gap: 8px; align-items: baseline; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; font: inherit; cursor: pointer; }
.combo-opt:hover { background: var(--surface-2); }
.combo-opt strong { color: var(--ink-900); font-size: 13px; }
.combo-opt span { color: var(--ink-500); font-size: 12px; }
.combo-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.combo-chips:not(:empty) { margin-bottom: 7px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 5px 3px 9px; border-radius: 8px; background: var(--surface-3); color: var(--ink-900); font-size: 12px; font-weight: 750; }
.chip button { border: 0; background: transparent; color: var(--ink-500); font-size: 15px; line-height: 1; cursor: pointer; padding: 0 2px; }
.chip button:hover { color: var(--red-700); }
.combo-airports { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.combo-airports[hidden] { display: none; }
.apick-label { margin-bottom: 7px; color: var(--ink-500); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.apick { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--ink-700); font-size: 12px; }
.apick input { accent-color: var(--gold-500); }
.apick strong { color: var(--ink-900); }
.leg-airline { margin-top: 12px; }
.leg-row.land .leg-airline { display: none; }

/* Tour-months (booked-month) panel on Settings */
.month-list { display: grid; gap: 8px; }
.month-row { display: grid; grid-template-columns: 158px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; }
.month-row.blocked { background: #fffaf0; border-color: var(--gold-500); }
.month-row .m-name { font-weight: 750; font-size: 13px; }
.month-row .m-name span { display: block; margin-top: 1px; color: var(--ink-500); font-size: 11px; font-weight: 500; }
.month-row form { margin: 0; display: flex; gap: 8px; align-items: center; }
@media (max-width: 720px) { .month-row { grid-template-columns: 1fr; gap: 9px; } }
.month-badge { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 9px; border-radius: 99px; background: var(--amber-100); color: var(--amber-700); font-size: 10px; font-weight: 800; }
.cal-blocked-banner { display: flex; align-items: center; gap: 9px; margin: 0 0 16px; padding: 12px 15px; border: 1px solid var(--gold-500); border-radius: 11px; background: #fffaf0; color: var(--amber-700); font-size: 13px; font-weight: 650; }
.cal-blocked-banner .icon { width: 17px; height: 17px; }

/* Per-leg stops + layover controls (trip builder) */
.leg-extra { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 11px; align-items: center; }
.leg-row.land .leg-extra { display: none; }
.leg-inline { display: flex; align-items: center; gap: 6px; color: var(--ink-500); font-size: 11px; font-weight: 700; }
.leg-inline select { width: auto; min-height: 34px; min-width: 92px; }

/* Pick-a-specific-flight widget (G) */
.flightpick { position: relative; }
.leg-flightpick { margin-top: 12px; }
.leg-row.land .leg-flightpick { display: none; }
.flightpick-current { margin-bottom: 7px; }
.flightpick-current:empty { display: none; }
.fp-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 5px 5px 11px; border-radius: 9px; background: var(--blue-100); color: var(--blue-700); font-size: 12px; font-weight: 750; }
.fp-chip strong { color: var(--navy-900); }
.fp-chip button { border: 0; background: transparent; color: var(--blue-700); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 3px; }
.flightpick-menu { margin-top: 8px; max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: var(--shadow-sm); }
.flightpick-menu[hidden] { display: none; }
.fp-msg { padding: 12px 14px; color: var(--ink-500); font-size: 12px; }
.fp-opt { display: block; width: 100%; padding: 10px 13px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; font: inherit; }
.fp-opt:last-child { border-bottom: 0; }
.fp-opt:hover { background: var(--surface-2); }
.fp-num { font-weight: 800; font-size: 12px; color: var(--navy-900); margin-right: 10px; }
.fp-times { font-size: 13px; font-weight: 700; color: var(--ink-900); }
.fp-meta { display: block; margin-top: 3px; color: var(--ink-500); font-size: 11px; }
