/* ============================================================
   YTS Buss — global styles
   ============================================================ */

:root {
  /* Light, default palette: warm signature red */
  --bg:        #f7f2ed;
  --bg-soft:   #efe8e1;
  --surface:   #ffffff;
  --surface-2: #fbf8f5;
  --ink:       #1a1614;
  --ink-soft:  #5a524d;
  --ink-mute:  #8a807a;
  --line:      #e7dfd7;
  --line-soft: #f1ebe4;

  --brand:        #d63b30;   /* signature red */
  --brand-deep:   #9a221a;
  --brand-soft:   #f6e3df;
  --brand-tint:   #fdf3f1;
  --brand-ink:    #ffffff;

  --ok:        #2f6a3f;
  --warn:      #b8740c;
  --info:      #2a5a8a;

  --radius:    14px;
  --radius-lg: 22px;
  --radius-sm: 9px;

  --shadow-sm: 0 1px 0 rgba(20,12,10,.04), 0 1px 2px rgba(20,12,10,.04);
  --shadow:    0 1px 0 rgba(20,12,10,.04), 0 8px 24px -8px rgba(20,12,10,.12);
  --shadow-lg: 0 24px 60px -20px rgba(20,12,10,.25), 0 4px 12px -4px rgba(20,12,10,.08);

  --display: "Instrument Serif", "Times New Roman", serif;
  --sans:    "Manrope", -apple-system, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, monospace;
}

[data-theme="dark"] {
  --bg:        #161210;
  --bg-soft:   #1d1815;
  --surface:   #211b18;
  --surface-2: #1a1513;
  --ink:       #f3ede6;
  --ink-soft:  #a89e96;
  --ink-mute:  #6f6660;
  --line:      #2e2620;
  --line-soft: #251e1a;

  --brand:        #ff5247;
  --brand-deep:   #c43229;
  --brand-soft:   #3a1a17;
  --brand-tint:   #261311;
  --brand-ink:    #ffffff;

  --shadow-sm: 0 1px 0 rgba(0,0,0,.4);
  --shadow:    0 1px 0 rgba(0,0,0,.4), 0 10px 30px -10px rgba(0,0,0,.5);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* ---------- type ---------- */
.display { font-family: var(--display); font-weight: 400; letter-spacing: -0.01em; }
.mono    { font-family: var(--mono); font-feature-settings: "tnum"; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); }
.tnum    { font-variant-numeric: tabular-nums; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.015em; color: var(--ink); }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p  { margin: 0; }

/* ---------- layout primitives ---------- */
.app-shell {
  display: grid;
  grid-template-rows: 56px 1fr;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  gap: 24px;
  position: relative;
  z-index: 30;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: -0.015em;
  color: var(--ink);
  user-select: none;
}
.wordmark .mark-red {
  font-family: var(--display);
  color: var(--brand);
  font-style: italic;
  font-size: 26px;
}
.wordmark .mark-sub {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--ink-mute);
  text-transform: uppercase;
  margin-left: 8px;
  align-self: center;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.role-switch {
  display: flex;
  gap: 0;
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 4px;
  border: 1px solid var(--line);
}
.role-switch button {
  border: 0;
  background: transparent;
  padding: 7px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  letter-spacing: -0.005em;
  transition: all .18s;
}
.role-switch button[data-active="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.role-switch button:hover:not([data-active="true"]) { color: var(--ink); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.user-chip .avatar {
  width: 26px; height: 26px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--brand-ink);
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink-soft);
}
.icon-btn:hover { color: var(--ink); background: var(--bg-soft); }

/* ---------- app body ---------- */
.app-body { display: grid; grid-template-columns: 232px 1fr; overflow: hidden; }
.app-body.no-sidebar { grid-template-columns: 1fr; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.sidebar .sb-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 700;
  padding: 14px 12px 6px;
}
.sidebar a, .sidebar button {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  text-align: left;
  width: 100%;
}
.sidebar button:hover { background: var(--bg-soft); color: var(--ink); }
.sidebar button[data-active="true"] {
  background: var(--brand-tint);
  color: var(--brand-deep);
}
.sidebar svg { flex-shrink: 0; }

.main {
  overflow-y: auto;
  background: var(--bg);
}

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 14px;
  transition: border .15s, box-shadow .15s;
  outline: 0;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.textarea { resize: vertical; min-height: 96px; font-family: var(--sans); }
.input[readonly] { background: var(--bg-soft); color: var(--ink-soft); }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%235a524d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.checkbox-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 13px;
  cursor: pointer;
}
.checkbox-row input { accent-color: var(--brand); width: 16px; height: 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.005em;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-soft); }
.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
}
.btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--ink); }
.btn-dark {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}
.btn-dark:hover { background: #000; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 14px 22px; font-size: 15px; border-radius: 12px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
  gap: 14px;
}
.card-header h2 { font-size: 16px; }
.card-body { padding: 22px; }
.card-tight .card-body { padding: 16px; }

/* ---------- chips / pills ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--bg-soft);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.chip-brand { background: var(--brand-tint); color: var(--brand-deep); border-color: var(--brand-soft); }
.chip-ok    { background: #e6f0e8; color: #2f6a3f; border-color: #cde0d2; }
.chip-warn  { background: #fbf0d6; color: #b8740c; border-color: #f0dcae; }
.chip-info  { background: #e5edf7; color: #2a5a8a; border-color: #c9d8ec; }
[data-theme="dark"] .chip-ok   { background: #1b2a1f; color: #8fc89c; border-color: #2a3d2f; }
[data-theme="dark"] .chip-warn { background: #2c2316; color: #d9b56b; border-color: #3d321d; }
[data-theme="dark"] .chip-info { background: #1a2230; color: #8eb2d6; border-color: #2a3548; }

.dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.tab {
  position: relative;
  padding: 14px 18px;
  background: transparent;
  border: 0;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  letter-spacing: -0.005em;
}
.tab[data-active="true"] { color: var(--ink); }
.tab[data-active="true"]::after {
  content: "";
  position: absolute;
  left: 18px; right: 18px; bottom: -1px;
  height: 2px;
  background: var(--brand);
  border-radius: 2px 2px 0 0;
}

/* ---------- tables ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.tbl td {
  padding: 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.tbl tr:hover td { background: var(--surface-2); }
.tbl tr:last-child td { border-bottom: 0; }

/* ---------- specific app bits ---------- */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  gap: 16px;
}
.section-title h2 { font-size: 22px; letter-spacing: -0.02em; }
.section-title .display {
  font-family: var(--display);
  font-size: 32px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat .stat-label { font-size: 12px; color: var(--ink-mute); font-weight: 600; }
.stat .stat-value {
  font-family: var(--display);
  font-size: 38px;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.stat .stat-sub { font-size: 11px; color: var(--ink-soft); font-weight: 600; }

.stat-accent {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.stat-accent .stat-label { color: rgba(255,255,255,0.6); }
.stat-accent .stat-value { color: var(--bg); }
.stat-accent .stat-sub { color: rgba(255,255,255,0.7); }

.stat-brand {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
}
.stat-brand .stat-label, .stat-brand .stat-sub { color: rgba(255,255,255,0.78); }
.stat-brand .stat-value { color: #fff; }

/* trip line — visual itinerary */
.trip {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink-soft); font-weight: 600;
}
.trip .pt {
  display: inline-flex; align-items: center; gap: 7px;
}
.trip .pt-dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--brand); flex-shrink: 0;
}
.trip .pt-dot.end { background: var(--ink); }
.trip .line {
  flex: 1; max-width: 32px;
  height: 1.5px;
  background: linear-gradient(90deg, var(--brand), var(--ink));
  border-radius: 2px;
}

/* timeline list */
.day-strip {
  display: flex; gap: 6px; padding: 8px 0;
}
.day-strip .day {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  min-width: 0;
}
.day-strip .day[data-active="true"] {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}
.day-strip .day .dnum {
  font-family: var(--display); font-size: 22px; line-height: 1;
}
.day-strip .day .dname {
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; margin-top: 4px; opacity: 0.7;
}

/* live price (customer) */
.live-price {
  background: var(--ink); color: var(--bg);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex; flex-direction: column; gap: 8px;
  position: sticky; top: 16px;
}
.live-price .lp-label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.6); font-weight: 700; }
.live-price .lp-value { font-family: var(--display); font-size: 56px; line-height: 1; letter-spacing: -0.02em; }
.live-price .lp-sub { font-size: 12px; color: rgba(255,255,255,0.7); }
.live-price .lp-row {
  display: flex; justify-content: space-between;
  padding: 8px 0; border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12px; color: rgba(255,255,255,0.8);
}
.live-price .lp-row b { color: #fff; font-weight: 700; }

/* phone frame (driver) */
.phone-stage {
  display: grid; place-items: center; padding: 30px 20px;
  min-height: 100%; background: var(--bg-soft);
}
.phone {
  width: 380px;
  height: 780px;
  background: var(--surface);
  border-radius: 38px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  position: relative;
}
.phone-notch {
  height: 28px;
  background: var(--surface);
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 24px;
  font-size: 11px; font-weight: 700;
}
.phone-notch::after {
  content: ""; position: absolute; left: 50%; top: 8px;
  transform: translateX(-50%);
  width: 90px; height: 22px;
  background: var(--ink); border-radius: 999px;
}
.phone-body { flex: 1; overflow-y: auto; }

/* offer PDF — variants live in pdf-preview.jsx */
.pdf-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* utility */
.row { display: flex; gap: 12px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.text-soft { color: var(--ink-soft); }
.text-mute { color: var(--ink-mute); }
.text-brand { color: var(--brand); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.font-bold { font-weight: 700; } .font-semi { font-weight: 600; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-mute); }

@media print {
  body { background: #fff; }
  .topbar, .sidebar, .tabs, .no-print { display: none !important; }
  .app-body { display: block; }
  .main { overflow: visible; }
}
