/* ═══ F&I Copilot — Design System ═══ */
/* Color Palette: White · Silver · Grey · Black · Neon Blue */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* ── Backgrounds (Light) ── */
  --bg-primary: #f5f6f8;
  --bg-secondary: #ffffff;
  --bg-tertiary: #ebedf2;
  --bg-card: #ffffff;

  /* ── Accent: Neon Blue ── */
  --accent: #00b4e6;
  --accent-dim: rgba(0, 180, 230, 0.10);
  --accent-glow: rgba(0, 180, 230, 0.25);
  --accent-solid: #0099cc;

  /* ── Semantic ── */
  --green: #059669;
  --green-dim: rgba(5, 150, 105, 0.10);
  --yellow: #d97706;
  --yellow-dim: rgba(217, 119, 6, 0.10);
  --red: #dc2626;
  --red-dim: rgba(220, 38, 38, 0.10);

  /* ── Text ── */
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;
  --silver: #71717a;

  /* ── Borders ── */
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.16);
  --border-accent: rgba(0, 180, 230, 0.30);

  /* ── Shared ── */
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-accent: 0 4px 20px rgba(0, 180, 230, 0.12);
  --transition: 0.2s ease;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ═══ Screen System ═══ */
.screen {
  display: none;
  height: 100vh;
  width: 100vw;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══ Typography ═══ */
h1,
h2,
h3 {
  font-family: 'Sora', sans-serif;
  letter-spacing: -0.5px;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* ═══ Buttons ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 44px;
  min-width: 44px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-solid));
  color: #fff;
}

.btn-primary:hover {
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
}

.btn-success {
  background: var(--green-dim);
  color: var(--green);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
  border-radius: var(--radius);
}

.btn-icon {
  width: 44px;
  padding: 0;
}

/* ═══ Cards ═══ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-hover:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-accent);
}

/* ═══ Forms ═══ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  transition: border-color var(--transition);
  min-height: 44px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-textarea {
  resize: vertical;
  min-height: 60px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2371717a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-row {
  display: grid;
  gap: 12px;
}

.form-row-2 {
  grid-template-columns: 1fr 1fr;
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-row-4 {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

/* ═══ Header ═══ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-solid));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 8px var(--accent-dim);
  color: #fff;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ═══ Badge ═══ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-gold {
  background: var(--accent-dim);
  color: var(--accent-solid);
}

.badge-green {
  background: var(--green-dim);
  color: var(--green);
}

.badge-yellow {
  background: var(--yellow-dim);
  color: var(--yellow);
}

.badge-red {
  background: var(--red-dim);
  color: var(--red);
}

.badge-blue {
  background: var(--accent-dim);
  color: var(--accent-solid);
}

/* ═══ Stat Cards ═══ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-card {
  text-align: center;
  padding: 16px;
}

.stat-value {
  font-family: 'Sora', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.stat-trend {
  font-size: 11px;
  margin-top: 2px;
}

.stat-up {
  color: var(--green);
}

.stat-down {
  color: var(--red);
}

/* ═══ Deals List ═══ */
.deals-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.deal-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--transition);
}

.deal-row:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}

.deal-vehicle {
  font-weight: 600;
  color: var(--text-primary);
}

.deal-amount {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-solid);
  font-weight: 600;
}

.deal-status {
  text-transform: capitalize;
  color: var(--text-secondary);
}

/* ═══ Menu Columns ═══ */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.menu-col {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.menu-col-header {
  text-align: center;
  padding: 12px;
  border-radius: var(--radius) var(--radius) 0 0;
  position: sticky;
  top: 0;
  z-index: 1;
}

.menu-col.platinum .menu-col-header {
  background: linear-gradient(135deg, rgba(0, 180, 230, 0.10), rgba(0, 180, 230, 0.04));
  border-bottom: 2px solid var(--accent);
}

.menu-col.gold .menu-col-header {
  background: linear-gradient(135deg, rgba(113, 113, 122, 0.08), rgba(113, 113, 122, 0.03));
  border-bottom: 2px solid var(--silver);
}

.menu-col.silver .menu-col-header {
  background: linear-gradient(135deg, rgba(161, 161, 170, 0.08), rgba(161, 161, 170, 0.03));
  border-bottom: 2px solid var(--text-muted);
}

.recommended-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-solid);
  margin-bottom: 4px;
}

.menu-tier-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.menu-product {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.menu-product-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--text-primary);
}

.menu-product-price {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.menu-total {
  padding: 14px;
  text-align: center;
  border-top: 2px solid var(--border);
  margin-top: auto;
}

.menu-total-price {
  font-family: 'Sora', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

.menu-delta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ═══ Coaching Panel ═══ */
.coaching-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.coaching-section {
  padding: 14px;
}

.coaching-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.coaching-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

.coaching-opening {
  font-size: 16px;
  font-style: italic;
  color: var(--accent-solid);
  line-height: 1.5;
}

.objection-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.objection-btn {
  font-size: 12px;
  padding: 8px 14px;
}

.coaching-response {
  padding: 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-dim);
}

/* ═══ Outcome Grid ═══ */
.outcome-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.product-outcome {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition);
}

.product-outcome.sold {
  border-color: var(--green);
  background: var(--green-dim);
}

.product-outcome .toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  position: relative;
  transition: all var(--transition);
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.product-outcome .toggle::after {
  content: '';
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  position: absolute;
  top: 1px;
  left: 2px;
  transition: all var(--transition);
}

.product-outcome.sold .toggle {
  background: var(--green);
  border-color: var(--green);
}

.product-outcome.sold .toggle::after {
  background: #fff;
  left: 22px;
}

/* ═══ Star Rating ═══ */
.star-rating {
  display: flex;
  gap: 8px;
}

.star {
  font-size: 28px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition);
}

.star.active {
  color: var(--accent);
}

/* ═══ Loading ═══ */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(245, 246, 248, 0.90);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.loading-text {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ═══ Split Layout ═══ */
.split {
  display: grid;
  gap: 20px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.split-60-40 {
  grid-template-columns: 3fr 2fr;
}

.split-70-30 {
  grid-template-columns: 7fr 3fr;
}

.split-panel {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ═══ Camera ═══ */
.camera-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.camera-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-shutter {
  position: absolute;
  bottom: 20px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--accent);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}

.camera-shutter:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* ═══ Dashboard Charts ═══ */
.chart-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding: 8px 0;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(to top, var(--accent-solid), var(--accent));
  transition: height var(--transition);
  min-height: 4px;
}

.bar-label {
  font-size: 10px;
  color: var(--text-muted);
}

.bar-value {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}

/* ═══ Toast ═══ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  padding: 12px 24px;
  font-size: 14px;
  z-index: 200;
  animation: slideUp 0.3s ease;
  box-shadow: var(--shadow-accent);
  color: var(--text-primary);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ═══ Price color coding ═══ */
.gross-high {
  color: var(--green);
}

.gross-mid {
  color: var(--yellow);
}

.gross-low {
  color: var(--red);
}

/* ═══ Scrollbar ═══ */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}