/* ============================================================
   Private Travel Office — visual identity
   Palette lifted directly from the dossier's own per-city colors
   (master_v2.js COLOR table), so the app reads as a continuation
   of the same document rather than a separate generic dashboard.
   ============================================================ */

:root {
  --navy: #1b2a4a;
  --navy-dark: #0f1b30;
  --gold: #9c7a3c;
  --gold-bright: #d9b876;
  --cream: #f5f1e8;
  --ink: #000000;
  --grey: #2b2f34;
  --line: #c9c0a8;
  --danger: #a33341;
  --ok: #2f5233;

  /* Per-city colors, taken from the dossier's COLOR table and
     brightened/saturated slightly from the raw dossier hexes so they
     stay legible as body text (the dossier used them on dark
     backgrounds; here several sit on cream and need more contrast). */
  --c-vegas: #a33341;
  --c-slc: #1f4e5f;
  --c-transit: #3b3b3b;
  --c-munich: #2f5233;
  --c-baden: #7c2e40;
  --c-leipzig: #453a75;
  --c-berlin: #1a1a1a;
  --c-zurich: #2d6b58;
  --c-london: #2b3a55;
  --c-cannes: #147a84;
  --c-open: #9c7a3c;

  --font-display: Georgia, "Times New Roman", serif;
  --font-body: Garamond, "Cormorant Garamond", Georgia, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ---------- Dark mode ----------
   Every rule in this file reads colors through variables, so dark
   mode is a second value set under this attribute selector rather
   than a duplicated stylesheet. Cream becomes deep navy, ink becomes
   a bright warm white, and the per-city accent colors are lifted
   back toward their brighter dossier-original hues (which were
   designed for dark backgrounds in the first place, then had to be
   darkened for the light cream page — dark mode reverses that). */
[data-theme="dark"] {
  --cream: #12203a;
  --ink: #f7f3ea;
  --grey: #cdd3dc;
  --line: #33445e;
  --gold: #d9b876;
  --gold-bright: #eecf98;
  --danger: #e78b95;
  --ok: #7fbf94;

  --c-vegas: #e2707d;
  --c-slc: #6fb3cf;
  --c-transit: #b7bec7;
  --c-munich: #7fbf94;
  --c-baden: #d98da3;
  --c-leipzig: #ada0e8;
  --c-berlin: #dfe3e8;
  --c-zurich: #7fd4b6;
  --c-london: #9fb3d9;
  --c-cannes: #63d6e0;
  --c-open: #d9b876;
}
[data-theme="dark"] body { background: var(--cream); }
[data-theme="dark"] .auth-card { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .modal { background: #182a4a; }
[data-theme="dark"] .modal input, [data-theme="dark"] .modal select, [data-theme="dark"] .modal textarea {
  background: #0f1b30; color: var(--ink); border-color: var(--line);
}
[data-theme="dark"] .trip-card:hover, [data-theme="dark"] .btn-outline:hover { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .btn-link { color: var(--gold-bright); }
[data-theme="dark"] .leg-actions button, [data-theme="dark"] .budget-line-row .bl-actions button { color: var(--gold-bright); }
[data-theme="dark"] .leg-actions button:hover, [data-theme="dark"] .budget-line-row .bl-actions button:hover { color: var(--gold); }

/* ---------- Theme toggle button ---------- */
.theme-toggle {
  background: none;
  border: 1.5px solid rgba(255,255,255,0.3);
  color: #fff;
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 14px;
  font-family: var(--font-ui);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.theme-toggle:hover { background: rgba(255,255,255,0.08); }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ---------- Screens ---------- */

.screen { min-height: 100vh; }

#screen-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
  min-height: 100vh;
}

/* ---------- Brand ---------- */

.brand-mark { text-align: center; margin-bottom: 28px; }
.brand-kicker {
  display: block;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 14px;
  color: var(--gold-bright);
  margin-bottom: 6px;
}
.brand-title {
  font-family: var(--font-display);
  font-size: 32px;
  color: #fff;
  margin: 0;
  font-weight: 700;
}
.brand-mark.small .brand-title { display: none; }
.brand-mark.small .brand-kicker { color: var(--gold); margin: 0; font-style: normal; font-size: 13px; }

/* ---------- Auth card ---------- */

.auth-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(201,165,101,0.25);
  border-radius: 2px;
  padding: 40px 36px;
  width: 380px;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid rgba(201,165,101,0.25);
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-family: var(--font-body);
  font-style: italic;
  font-size: 15px;
  padding: 10px 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.auth-tab.active {
  color: var(--gold-bright);
  border-bottom-color: var(--gold-bright);
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: rgba(255,255,255,0.6);
}
.auth-form input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 2px;
  padding: 10px 12px;
  color: #fff;
  font-size: 14px;
  font-family: var(--font-ui);
}
.auth-form input:focus {
  outline: none;
  border-color: var(--gold-bright);
}
.auth-error {
  color: #e08a8a;
  font-size: 12.5px;
  min-height: 16px;
  margin: 0;
}

/* ---------- Buttons ---------- */

.btn-gold {
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: 2px;
  padding: 11px 20px;
  font-size: 14px;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-gold:hover { background: var(--gold-bright); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gold);
  color: var(--gold);
  border-radius: 2px;
  padding: 9px 18px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.btn-outline:hover { background: rgba(156,122,60,0.08); }

.btn-link {
  background: none;
  border: none;
  color: var(--navy);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  background: var(--navy);
  color: #fff;
}
.topbar-left { display: flex; align-items: center; gap: 20px; }
.topbar h2 { font-family: var(--font-display); font-size: 21px; margin: 0; font-weight: 600; letter-spacing: 0.01em; }
.topbar-user { display: flex; align-items: center; gap: 20px; font-size: 15px; }
.topbar .btn-link { color: var(--gold-bright); font-size: 15px; }

/* ---------- Page layout ---------- */

.page { max-width: 800px; margin: 0 auto; padding: 48px 32px 80px; }
.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 32px;
}
.page-header h2 { font-family: var(--font-display); margin: 0; font-size: 26px; font-weight: 600; }

/* ---------- Trip list ---------- */

.trip-list { display: flex; flex-direction: column; }
.trip-card {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
  cursor: pointer;
  transition: padding-left 0.15s;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.trip-card:hover { padding-left: 8px; }
.trip-card-name { font-family: var(--font-display); font-size: 21px; margin: 0 0 4px; }
.trip-card-dates { font-size: 15px; color: var(--grey); font-style: italic; font-family: var(--font-body); }
.trip-card-badge {
  font-size: 14px;
  color: var(--gold);
  font-family: var(--font-body);
  font-style: italic;
  white-space: nowrap;
}

/* ---------- Agent chips (top bar) ---------- */
/* Reworked from a plain underline-tab bar into distinct labeled chips,
   each carrying a two-letter badge and its own accent color — closer
   to a persistent "which agent am I talking to" bar than a quiet tab
   strip, and higher-contrast/larger per the readability pass. */

.agent-tabs {
  display: flex;
  gap: 10px;
  background: var(--navy-dark);
  padding: 14px 40px;
  flex-wrap: wrap;
}
.agent-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: 20px;
  padding: 8px 16px 8px 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.agent-chip:hover { background: rgba(255,255,255,0.09); }
.agent-chip.active {
  background: rgba(255,255,255,0.1);
  border-color: var(--chip-color, var(--gold-bright));
}
.chip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--chip-color, var(--gold));
  color: #fff;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.chip-label {
  color: rgba(255,255,255,0.65);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
}
.agent-chip.active .chip-label { color: #fff; }

/* The Boss chip is visually first and slightly larger — the "front
   door" of the trip, not just one more agent among equals. */
.boss-chip {
  padding: 10px 20px 10px 10px;
  border-width: 2px;
}
.boss-chip .chip-badge { width: 30px; height: 30px; font-size: 12px; }
.boss-chip .chip-label { font-weight: 700; font-size: 16px; }
.boss-chip.active .chip-label, .boss-chip .chip-label { color: #fff; }

.agent-panel { }
.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
}
.panel-header h3 { font-family: var(--font-display); margin: 0; font-size: 23px; font-weight: 600; }

/* ---------- Continuity banner ---------- */

.banner {
  border-left: 3px solid var(--gold);
  padding: 10px 0 10px 16px;
  font-size: 16px;
  font-family: var(--font-body);
  font-style: italic;
  margin-bottom: 32px;
  color: #5c4014;
}
.banner.danger { border-left-color: var(--danger); color: var(--danger); }
.banner.ok { border-left-color: var(--ok); color: var(--ok); }

/* ---------- Itinerary: the route line ---------- */
/* The itinerary reads as a journey rather than a data table: a single
   gold line runs down the page, each leg is a stop on it. Stay legs
   get their own dossier-matched color as a small marker + left rule;
   drive/flight legs sit smaller and quieter between them, since they
   are connective tissue, not destinations. */

.leg-list {
  position: relative;
  padding-left: 28px;
}
.leg-list::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(180deg, var(--gold-bright), var(--line) 90%);
}

.leg-row {
  position: relative;
  padding: 18px 0 18px 24px;
  border-bottom: 1px solid var(--line);
}
.leg-row::before {
  /* the stop marker on the route line */
  content: "";
  position: absolute;
  left: -28px;
  top: 24px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--stop-color, var(--gold));
  border: 2px solid var(--cream);
  box-shadow: 0 0 0 1px var(--stop-color, var(--gold));
}
.leg-row.type-drive::before, .leg-row.type-flight::before {
  width: 6px;
  height: 6px;
  left: -25.5px;
  top: 26px;
  background: var(--grey);
  box-shadow: none;
  border: none;
}

.leg-row.type-drive, .leg-row.type-flight {
  padding-top: 10px;
  padding-bottom: 10px;
  opacity: 0.88;
}

.leg-top-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.leg-dates { color: var(--grey); font-family: var(--font-body); font-style: italic; font-size: 16px; white-space: nowrap; }
.leg-city { font-family: var(--font-display); font-size: 21px; font-weight: 600; }
.leg-city-clickable { cursor: pointer; }
.leg-city-clickable:hover { color: var(--stop-color, var(--gold)); text-decoration: underline; text-underline-offset: 4px; }
.leg-row.type-drive .leg-city, .leg-row.type-flight .leg-city { font-family: var(--font-ui); font-size: 16px; font-weight: 500; color: var(--ink); }
.leg-label { color: var(--stop-color, var(--gold)); font-size: 14px; font-family: var(--font-body); font-style: italic; margin-bottom: 2px; font-weight: 600; }
.leg-notes { font-size: 16px; color: var(--grey); margin-top: 4px; }

.leg-status-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.leg-status {
  font-size: 15px;
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 600;
  color: var(--stop-color, var(--grey));
}
.leg-actions { display: flex; gap: 14px; }
.leg-actions button {
  background: none; border: none; cursor: pointer; font-size: 15px; color: var(--navy); font-family: var(--font-ui); font-weight: 500;
}
.leg-actions button:hover { color: var(--gold); }

/* ---------- Budget ---------- */

.ceiling-watch {
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  padding: 28px 0;
  margin-bottom: 40px;
}
.ceiling-watch .cw-total { font-family: var(--font-display); font-size: 36px; margin: 0 0 6px; font-weight: 600; }
.ceiling-watch .cw-sub { font-size: 15px; color: var(--grey); font-family: var(--font-body); font-style: italic; }
.ceiling-watch .cw-bar {
  height: 3px;
  background: var(--line);
  margin: 18px 0 10px;
  overflow: hidden;
}
.ceiling-watch .cw-bar-fill { height: 100%; background: var(--gold); }
.ceiling-watch .cw-warning { color: var(--danger); font-size: 15px; margin-top: 10px; font-family: var(--font-body); font-style: italic; font-weight: 600; }

.budget-line-list { display: flex; flex-direction: column; }
.budget-line-row {
  display: grid;
  grid-template-columns: 1fr 90px 170px auto;
  align-items: baseline;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  font-size: 16px;
}
.budget-line-row .bl-category {
  font-size: 13px;
  font-family: var(--font-body);
  font-style: italic;
  color: var(--gold);
  display: block;
  margin-bottom: 2px;
  font-weight: 600;
}
.budget-line-row .bl-amount { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-display); font-size: 17px; }
.budget-line-row .bl-actions { display: flex; gap: 12px; justify-self: end; }
.budget-line-row .bl-actions button { background: none; border: none; cursor: pointer; color: var(--navy); font-size: 15px; font-weight: 500; }
.budget-line-row .bl-actions button:hover { color: var(--gold); }

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,27,48,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--cream);
  border-radius: 2px;
  padding: 32px 34px;
  width: 420px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
}
/* The Boss chat modal is a real conversation, not a short form — give
   it much more room so scrolling isn't the constant experience. */
.modal.modal-chat {
  width: 720px;
  max-width: 92vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.modal.modal-chat .agent-chat-log {
  flex: 1;
  max-height: none !important;
  min-height: 320px;
}
.modal h3 { font-family: var(--font-display); margin-top: 0; font-size: 22px; }
.modal form { display: flex; flex-direction: column; gap: 14px; }
.modal label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--grey); font-weight: 500; }
.modal input, .modal select, .modal textarea {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 10px 11px;
  font-size: 16px;
  font-family: var(--font-ui);
  background: #fff;
}
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 6px; }
.modal .field-row { display: flex; gap: 10px; }
.modal .field-row > label { flex: 1; }

@media (max-width: 640px) {
  .budget-line-row { grid-template-columns: 1fr; }
  .budget-line-row .bl-actions { justify-self: start; }
  .page { padding: 32px 20px 60px; }
}

/* ---------- AI Agent chat + proactive check banner ---------- */

.agent-check-banner {
  border-left: 3px solid var(--gold);
  padding: 14px 18px;
  margin-bottom: 28px;
  font-size: 16px;
  line-height: 1.6;
  background: rgba(156,122,60,0.06);
}
.agent-check-banner:empty { display: none; }
.agent-check-banner .acb-meta {
  display: block;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 13px;
  color: var(--grey);
  margin-top: 8px;
}

.agent-chat {
  margin-top: 36px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.agent-chat-header {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 14px;
}
.agent-chat-log {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 420px;
  overflow-y: auto;
  margin-bottom: 16px;
}
.chat-msg {
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1.55;
  max-width: 85%;
  white-space: pre-wrap;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--navy);
  color: #fff;
}
.chat-msg.assistant {
  align-self: flex-start;
  background: rgba(156,122,60,0.08);
  border: 1px solid var(--line);
}
.chat-msg.pending { opacity: 0.6; font-style: italic; }
.chat-msg ul { margin: 6px 0; padding-left: 22px; }
.chat-msg li { margin-bottom: 4px; }
.chat-msg div { margin-bottom: 2px; }
.chat-msg strong { font-weight: 700; }
.chat-msg h4, .chat-msg h5, .chat-msg h6 {
  font-family: var(--font-display);
  margin: 10px 0 4px;
  font-weight: 700;
}
.chat-msg h4 { font-size: 18px; }
.chat-msg h5 { font-size: 16px; }
.chat-msg h6 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.03em; }

.agent-chat-form { display: flex; gap: 10px; }
.agent-chat-form input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 11px 14px;
  font-size: 16px;
  font-family: var(--font-ui);
  background: #fff;
  color: var(--ink);
}
[data-theme="dark"] .agent-chat-form input { background: #0f1b30; }
.agent-chat-form input:focus { outline: none; border-color: var(--gold); }

[data-theme="dark"] .agent-check-banner { background: rgba(217,184,118,0.08); }
[data-theme="dark"] .chat-msg.assistant { background: rgba(217,184,118,0.08); }



