/* =========================================================
   Falcon ERP — Shared Design System
   Brand palette sourced from Falcon Beverages (U) Ltd brand kit:
   gradient (orange -> red-orange), #1A0E0E, #E65100, #FAF6F3, #FFFFFF
   ========================================================= */

:root {
  /* Brand (orange, anchored on #E65100) */
  --brand-50:  #fff4ea;
  --brand-100: #ffe3cc;
  --brand-200: #ffc89a;
  --brand-300: #ffa666;
  --brand-400: #fa8a3d;
  --brand-500: #f2720f;
  --brand-600: #e65100;
  --brand-700: #c24300;
  --brand-800: #9c3600;
  --brand-900: #7a2b00;
  --brand-950: #4a1a00;

  /* Accent (red-orange, the gradient's far end) */
  --accent-400: #ff7a4d;
  --accent-500: #e0431c;
  --accent-600: #c62828;

  /* Brand gradient, used for marks, avatars, hero panels */
  --brand-gradient: linear-gradient(135deg, var(--brand-400) 0%, var(--brand-600) 55%, var(--accent-600) 100%);

  /* Neutrals (warm, tuned toward #1A0E0E) */
  --gray-25:  #fdfbfa;
  --gray-50:  #faf6f3;
  --gray-100: #f2ebe6;
  --gray-200: #e4d9d2;
  --gray-300: #cbbab0;
  --gray-400: #a59086;
  --gray-500: #7d6a62;
  --gray-600: #594946;
  --gray-700: #3c2f2d;
  --gray-800: #291d1c;
  --gray-900: #1a0e0e;
  --gray-950: #100808;

  /* Status */
  --success-50: #eafbf3;
  --success-500: #1cb877;
  --success-600: #159c65;
  --warning-50: #fff8ea;
  --warning-500: #e8a723;
  --warning-600: #c8890f;
  --danger-50: #fdedee;
  --danger-500: #e6484f;
  --danger-600: #c93038;
  --info-50: #eef4ff;
  --info-500: #4c7cf0;
  --info-600: #3760d0;
  --violet-50: #f3eeff;
  --violet-500: #8b5cf6;
  --violet-600: #7141e0;

  /* Surfaces */
  --surface: #ffffff;
  --surface-muted: #faf6f3;
  --surface-sunken: var(--gray-100);
  --border: var(--gray-200);
  --border-strong: var(--gray-300);
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-500);
  --text-tertiary: var(--gray-400);
  --text-inverse: #ffffff;

  /* Sidebar (dark, #1A0E0E) */
  --sidebar-bg: #1a0e0e;
  --sidebar-bg-alt: #241413;
  --sidebar-border: #3a2422;
  --sidebar-text: #cbb6b0;
  --sidebar-text-active: #ffffff;
  --sidebar-accent: var(--brand-500);

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(26, 14, 14, .06);
  --shadow-sm: 0 1px 3px rgba(26, 14, 14, .08), 0 1px 2px rgba(26,14,14,.06);
  --shadow-md: 0 6px 16px rgba(26, 14, 14, .10), 0 2px 4px rgba(26,14,14,.05);
  --shadow-lg: 0 16px 40px rgba(26, 14, 14, .16);
  --shadow-focus: 0 0 0 3px rgba(230, 81, 0, .25);

  /* Layout */
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 68px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Falcon Display', 'Inter', sans-serif;
}

@font-face {
  font-family: 'Falcon Display';
  src: url('../fonts/Roboto-BoldItalic.ttf') format('truetype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

[data-theme="dark"] {
  --surface: #241413;
  --surface-muted: #1a0e0e;
  --surface-sunken: #180d0d;
  --border: #3a2422;
  --border-strong: #4a2f2c;
  --text-primary: #f8f0ed;
  --text-secondary: #c0a89f;
  --text-tertiary: #8a716a;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--surface-muted);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  font-size: 14.5px;
  line-height: 1.5;
  transition: background .2s ease, color .2s ease;
}
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--brand-200); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* =========================================================
   App Shell
   ========================================================= */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .2s ease;
}
.app-shell.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-alt) 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--sidebar-border);
  z-index: 20;
}
.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-logo-wrap { height: 32px; width: 188px; max-width: 100%; overflow: hidden; flex-shrink: 0; transition: width .2s ease; }
.sidebar-logo-wrap img { height: 32px; width: auto; display: block; object-fit: cover; object-position: left center; }
.is-collapsed .sidebar-logo-wrap { width: 32px; }
.sidebar-product-tag { font-size: 11px; color: var(--sidebar-text); font-weight: 600; letter-spacing: .02em; }
.is-collapsed .sidebar-product-tag { display: none; }

.sidebar-role {
  margin: 16px 16px 4px;
  padding: 10px 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--r-md);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-role .avatar { width: 30px; height: 30px; font-size: 12px; }
.sidebar-role .who { overflow: hidden; }
.sidebar-role .who strong { display: block; font-size: 12.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-role .who span { font-size: 11px; color: var(--sidebar-text); }
.is-collapsed .sidebar-role { display: none; }

.sidebar-nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-section-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: #5b6689; font-weight: 700; margin: 14px 12px 6px;
}
.is-collapsed .nav-section-title { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-md);
  color: var(--sidebar-text); font-size: 13.5px; font-weight: 600;
  white-space: nowrap; position: relative;
  transition: background .15s ease, color .15s ease;
}
.nav-item .icon { width: 18px; height: 18px; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(230,81,0,.28), rgba(230,81,0,.06)); color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 20px; border-radius: 0 4px 4px 0; background: var(--brand-500);
}
.nav-item .badge-count {
  margin-left: auto; font-size: 10.5px; font-weight: 800; background: var(--brand-600);
  color: #fff; padding: 2px 7px; border-radius: 99px;
}
.is-collapsed .nav-item span.label, .is-collapsed .badge-count { display: none; }
.is-collapsed .nav-item { justify-content: center; }

.sidebar-footer { padding: 14px; border-top: 1px solid var(--sidebar-border); display: flex; flex-direction: column; gap: 8px; }
.collapse-btn, .logout-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px; border-radius: var(--r-md); border: 1px solid var(--sidebar-border);
  background: rgba(255,255,255,.03); color: var(--sidebar-text); font-size: 12.5px; font-weight: 600;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.collapse-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.collapse-btn .icon { transition: transform .2s ease; }
.is-collapsed .collapse-btn .icon { transform: rotate(180deg); }
.is-collapsed .collapse-btn span.label, .is-collapsed .logout-btn span.label { display: none; }
.logout-btn:hover { background: rgba(230,72,79,.12); color: #ff9298; border-color: rgba(230,72,79,.4); }

/* ---------- Main ---------- */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { display: flex; flex-direction: column; margin-right: auto; }
.topbar-title h1 { font-size: 18px; }
.topbar-title p { font-size: 12.5px; color: var(--text-secondary); margin-top: 1px; }
.mobile-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px; color: var(--text-secondary); }

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-sunken); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 8px 12px; width: 260px;
  color: var(--text-tertiary);
}
.search-box input { border: none; background: none; outline: none; color: var(--text-primary); font-size: 13px; width: 100%; }
.search-box .icon { width: 16px; height: 16px; }

.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--surface-sunken); color: var(--text-primary); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger-500); border: 2px solid var(--surface);
}

.topbar-user { display: flex; align-items: center; gap: 10px; padding-left: 12px; border-left: 1px solid var(--border); cursor: pointer; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
}
.topbar-user .who { line-height: 1.25; }
.topbar-user .who strong { display: block; font-size: 13px; }
.topbar-user .who span { font-size: 11.5px; color: var(--text-secondary); }

/* ---------- Content ---------- */
.content { padding: 26px 28px 60px; flex: 1; }
.content-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.content-header h2 { font-size: 20px; }
.content-header .sub { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--r-md); font-size: 13px; font-weight: 700;
  border: 1px solid transparent; transition: all .15s ease; white-space: nowrap;
}
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--brand-600), var(--brand-700)); color: #fff; box-shadow: 0 4px 12px rgba(37,112,232,.28); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-sunken); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--text-primary); }
.btn-danger { background: var(--danger-500); color: #fff; }
.btn-danger:hover { background: var(--danger-600); }
.btn-success { background: var(--success-500); color: #fff; }
.btn-success:hover { background: var(--success-600); }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* =========================================================
   Cards / KPI
   ========================================================= */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.card-pad { padding: 20px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px 20px; position: relative; overflow: hidden; box-shadow: var(--shadow-xs);
  transition: transform .15s ease, box-shadow .15s ease;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kpi-icon { width: 40px; height: 40px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; }
.kpi-icon .icon { width: 20px; height: 20px; }
.kpi-icon.blue { background: var(--brand-50); color: var(--brand-600); }
.kpi-icon.teal { background: #e6fbf8; color: var(--accent-600); }
.kpi-icon.amber { background: var(--warning-50); color: var(--warning-600); }
.kpi-icon.green { background: var(--success-50); color: var(--success-600); }
.kpi-icon.violet { background: var(--violet-50); color: var(--violet-600); }
.kpi-icon.red { background: var(--danger-50); color: var(--danger-600); }
.kpi-trend { font-size: 11.5px; font-weight: 800; padding: 3px 8px; border-radius: 99px; display: inline-flex; align-items: center; gap: 3px; }
.kpi-trend.up { background: var(--success-50); color: var(--success-600); }
.kpi-trend.down { background: var(--danger-50); color: var(--danger-600); }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.kpi-label { color: var(--text-secondary); font-size: 12.5px; margin-top: 4px; font-weight: 600; }

/* =========================================================
   Grid / Panels
   ========================================================= */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.panel-header h3 { font-size: 14.5px; }
.panel-header .sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.panel-body { padding: 18px 20px; }
.panel-link { font-size: 12.5px; font-weight: 700; color: var(--brand-600); display: inline-flex; align-items: center; gap: 4px; }
.panel-link:hover { text-decoration: underline; }

/* =========================================================
   Table
   ========================================================= */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-tertiary); font-weight: 800; padding: 10px 20px; border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--surface-muted);
}
.data-table tbody td { padding: 14px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .12s ease; }
.data-table tbody tr:hover { background: var(--surface-muted); }
.cell-strong { font-weight: 700; color: var(--text-primary); }
.cell-muted { color: var(--text-secondary); font-size: 12.5px; }
.cell-flex { display: flex; align-items: center; gap: 10px; }
.mini-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 11px; flex-shrink: 0;
}

/* =========================================================
   Badges / Status Pills
   ========================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px;
  font-size: 11.5px; font-weight: 800; white-space: nowrap; letter-spacing: .01em;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-50); color: var(--success-600); }
.badge-warning { background: var(--warning-50); color: var(--warning-600); }
.badge-danger { background: var(--danger-50); color: var(--danger-600); }
.badge-info { background: var(--info-50); color: var(--info-600); }
.badge-violet { background: var(--violet-50); color: var(--violet-600); }
.badge-neutral { background: var(--surface-sunken); color: var(--text-secondary); }

/* =========================================================
   Progress / Stepper (order tracking)
   ========================================================= */
.stepper { display: flex; align-items: flex-start; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; }
.step .dot {
  width: 30px; height: 30px; border-radius: 50%; background: var(--surface-sunken); border: 2px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center; color: var(--text-tertiary); font-size: 12px; font-weight: 800;
  z-index: 1; transition: all .2s ease;
}
.step .line { position: absolute; top: 15px; left: 50%; width: 100%; height: 2px; background: var(--border-strong); z-index: 0; }
.step:last-child .line { display: none; }
.step .lbl { font-size: 10.5px; font-weight: 700; color: var(--text-tertiary); margin-top: 8px; max-width: 78px; line-height: 1.3; }
.step.done .dot { background: var(--success-500); border-color: var(--success-500); color: #fff; }
.step.done .line { background: var(--success-500); }
.step.done .lbl { color: var(--text-primary); }
.step.current .dot { background: var(--brand-600); border-color: var(--brand-600); color: #fff; box-shadow: 0 0 0 5px var(--brand-100); }
.step.current .lbl { color: var(--brand-700); }

.progress-bar { height: 8px; border-radius: 99px; background: var(--surface-sunken); overflow: hidden; }
.progress-bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-500), var(--accent-500)); }

/* =========================================================
   Forms / Modals
   ========================================================= */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 7px; color: var(--text-primary); }
.field .hint { font-size: 11.5px; color: var(--text-tertiary); margin-top: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-primary); font-size: 13px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-500); box-shadow: var(--shadow-focus); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-price {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px;
  background: var(--brand-50); border: 1px dashed var(--brand-300); border-radius: var(--r-md); margin-top: 6px;
}
.field-price strong { font-size: 20px; color: var(--brand-800); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(12,17,32,.55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface); border-radius: var(--r-xl); width: 100%; max-width: 520px;
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(.98); transition: transform .18s ease;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal.modal-lg { max-width: 720px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2;}
.modal-header h3 { font-size: 16px; }
.modal-close { width: 32px; height: 32px; border-radius: var(--r-md); border: none; background: var(--surface-sunken); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--border); }
.modal-body { padding: 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }

/* =========================================================
   Document Chips
   ========================================================= */
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-muted);
}
.doc-chip .doc-icon { width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--brand-50); color: var(--brand-600); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.doc-chip .doc-info { flex: 1; min-width: 0; }
.doc-chip .doc-info strong { display: block; font-size: 12.5px; }
.doc-chip .doc-info span { font-size: 11px; color: var(--text-tertiary); }
.doc-chip .doc-action { color: var(--text-secondary); }
.doc-chip .doc-action:hover { color: var(--brand-600); }

.checklist-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.checklist-item:last-child { border-bottom: none; }
.checklist-item .chk { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.checklist-item.done .chk { background: var(--success-500); color: #fff; }
.checklist-item.pending .chk { background: var(--warning-50); color: var(--warning-600); border: 1px dashed var(--warning-500); }
.checklist-item .chk .icon { width: 12px; height: 12px; }

/* =========================================================
   Document Preview (view / print / download)
   ========================================================= */
.doc-preview { background: #fff; color: #1a1a1a; border: 1px solid var(--border); border-radius: var(--r-md); padding: 32px; font-size: 13px; }
.dp-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid #1a1a1a; padding-bottom: 16px; margin-bottom: 20px; }
.dp-brand { display: flex; align-items: center; gap: 10px; }
.dp-brand strong { font-size: 15px; color: #111; }
.dp-brand div div { font-size: 11px; color: #777; }
.dp-title { font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: 22px; letter-spacing: -0.01em; margin-bottom: 4px; color: var(--brand-600); }
.dp-meta { color: #555; font-size: 12px; margin-bottom: 20px; }
.dp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.dp-field span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: #888; margin-bottom: 3px; }
.dp-field strong { font-size: 13px; color: #111; }
.dp-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.dp-table th, .dp-table td { border: 1px solid #ddd; padding: 8px 10px; text-align: left; font-size: 12.5px; color: #222; }
.dp-table th { background: #f5f5f5; }
.dp-note { color: #555; font-size: 12px; margin-bottom: 6px; }
.dp-company-footer { margin-top: 24px; padding-top: 14px; border-top: 1px solid #e4d9d2; font-size: 10.5px; color: #7d6a62; line-height: 1.7; }
.dp-company-footer strong { display: block; font-size: 11.5px; color: #1a0e0e; margin-bottom: 2px; }
.dp-company-footer span { display: block; }
.dp-footer { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 14px; padding-top: 12px; border-top: 1px dashed #e4d9d2; font-size: 10.5px; color: #a59086; }
.dp-stamp { border: 2px solid #159c65; color: #159c65; font-weight: 800; padding: 6px 14px; border-radius: 6px; transform: rotate(-6deg); font-size: 12px; white-space: nowrap; }

.print-area { display: none; }
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { display: block !important; position: absolute; top: 0; left: 0; width: 100%; padding: 30px; }
}

/* =========================================================
   Contact rows (client / driver contact cards)
   ========================================================= */
.contact-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.contact-row:last-child { border-bottom: none; }
.contact-row .contact-icon { width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--brand-50); color: var(--brand-600); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.contact-row .contact-body { min-width: 0; }
.contact-row .contact-body a { font-weight: 700; color: var(--brand-600); word-break: break-all; }
.contact-row .contact-body a:hover { text-decoration: underline; }

/* =========================================================
   Avatar photo + edit badge (profile picture upload)
   ========================================================= */
.avatar-upload { position: relative; display: inline-flex; flex-shrink: 0; }
.avatar-upload .avatar.has-photo { background-size: cover; background-position: center; color: transparent; }
.avatar-edit-badge {
  position: absolute; bottom: -3px; right: -3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand-600); border: 2px solid var(--sidebar-bg); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.avatar-edit-badge .icon { width: 11px; height: 11px; stroke-width: 2.6; }
.avatar-edit-badge:hover { background: var(--brand-700); }

/* =========================================================
   Timeline (activity feed)
   ========================================================= */
.timeline { position: relative; padding-left: 6px; }
.timeline-item { display: flex; gap: 14px; padding-bottom: 20px; position: relative; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; left: 14px; top: 30px; bottom: 0; width: 2px; background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  z-index: 1;
}
.timeline-content { padding-top: 4px; }
.timeline-content strong { font-size: 13px; display: block; }
.timeline-content p { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.timeline-content time { font-size: 11px; color: var(--text-tertiary); }

/* =========================================================
   Login Page
   ========================================================= */
.auth-page {
  min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface-muted);
}
.auth-visual {
  background: radial-gradient(circle at 20% 20%, var(--brand-700), var(--sidebar-bg) 65%);
  display: flex; flex-direction: column; justify-content: space-between; padding: 48px; color: #fff; position: relative; overflow: hidden;
}
.auth-visual::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 90%, rgba(255,138,61,.35), transparent 55%);
}
.auth-visual > * { position: relative; z-index: 1; }
.auth-headline { max-width: 420px; }
.auth-headline h1 { font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: 32px; line-height: 1.25; margin-bottom: 14px; letter-spacing: -0.01em; }
.auth-headline p { color: rgba(255,255,255,.75); font-size: 14.5px; line-height: 1.6; }
.auth-stats { display: flex; gap: 30px; }
.auth-stats div strong { font-size: 22px; display: block; }
.auth-stats div span { font-size: 11.5px; color: rgba(255,255,255,.6); }

.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-form { width: 100%; max-width: 400px; }
.auth-form h2 { font-size: 22px; margin-bottom: 6px; }
.auth-form .sub { color: var(--text-secondary); font-size: 13px; margin-bottom: 26px; }
.role-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 24px; }
.role-tab {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px;
  border: 1.5px solid var(--border); border-radius: var(--r-md); font-size: 11px; font-weight: 700; color: var(--text-secondary);
  background: var(--surface); transition: all .15s ease;
}
.role-tab .icon { width: 18px; height: 18px; }
.role-tab:hover { border-color: var(--brand-300); }
.role-tab.active { border-color: var(--brand-600); background: var(--brand-50); color: var(--brand-700); box-shadow: var(--shadow-focus); }
.auth-footer-note { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-tertiary); }
.demo-note { background: var(--warning-50); border: 1px solid #f3d98b; color: var(--warning-600); font-size: 12px; padding: 10px 12px; border-radius: var(--r-md); margin-bottom: 20px; }

/* =========================================================
   Misc utility
   ========================================================= */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.text-secondary { color: var(--text-secondary); }
.w-full { width: 100%; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-secondary); }
.empty-state .icon { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--text-tertiary); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .search-box { display: none; }
}
@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: var(--sidebar-w); height: 100vh;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .mobile-toggle { display: flex; }
  .kpi-grid, .grid-3 { grid-template-columns: 1fr 1fr; }
  .content { padding: 18px; }
  .topbar { height: auto; min-height: var(--topbar-h); padding: 12px 16px; }
  .topbar-title p { display: none; }
  .topbar-user .who { display: none; }
}
@media (max-width: 560px) {
  .kpi-grid, .grid-3 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}

.sidebar-scrim {
  display: none; position: fixed; inset: 0; background: rgba(12,17,32,.5); z-index: 15;
}
@media (max-width: 860px) {
  .app-shell.nav-open .sidebar-scrim { display: block; }
}
