
/* ═══════════════════════════════════════════════════════════════
   1. DESIGN TOKENS
═══════════════════════════════════════════════════════════════ */
:root {
  /* Backgrounds */
  --bg:        #0B0B0B;
  --surface:   #111111;
  --surface-2: #181818;
  --surface-3: #202020;
  --surface-4: #282828;

  /* Borders */
  --border:   #1E1E1E;
  --border-2: #2C2C2C;
  --border-3: #3A3A3A;

  /* Primary — Orange */
  --primary:      #F5A800;
  --primary-h:    #E09700;
  --primary-dim:  rgba(245,168,0,0.09);
  --primary-dim2: rgba(245,168,0,0.16);
  --primary-dim3: rgba(245,168,0,0.05);

  /* Text */
  --t1: #F0F0F0;
  --t2: #9A9A9A;
  --t3: #555555;

  /* Status colors */
  --green:       #22C55E;  --green-bg:  rgba(34,197,94,0.10);
  --red:         #EF4444;  --red-bg:    rgba(239,68,68,0.10);
  --amber:       #F59E0B;  --amber-bg:  rgba(245,158,11,0.10);
  --blue:        #60A5FA;  --blue-bg:   rgba(96,165,250,0.10);
  --purple:      #A78BFA;  --purple-bg: rgba(167,139,250,0.10);
  --cyan:        #22D3EE;  --cyan-bg:   rgba(34,211,238,0.10);

  /* Layout */
  --sidebar-w: 228px;
  --topbar-h:  56px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Elevation */
  --shadow:    0 2px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.7);
  --ring:      0 0 0 1px rgba(245,168,0,0.35);
  --glow:      0 0 0 1px rgba(245,168,0,0.25), 0 0 16px rgba(245,168,0,0.08);
}

/* ═══════════════════════════════════════════════════════════════
   2. RESET & BASE
═══════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--t1);
  font-size: 14px;
  line-height: 1.5;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--t3); }

/* ═══════════════════════════════════════════════════════════════
   3. APP LAYOUT
═══════════════════════════════════════════════════════════════ */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.22s ease, min-width 0.22s ease;
  overflow: hidden;
  z-index: 200;
}
.sidebar.collapsed {
  width: 60px;
  min-width: 60px;
}

/* Logo */
.sidebar-logo {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}
.logo-mark {
  width: 30px; height: 30px;
  flex-shrink: 0;
  background: #0B0B0B;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(245,168,0,0.25);
}
.logo-mark svg { width: 26px; height: 26px; }
.logo-text {
  font-size: 17px; font-weight: 800; font-style: italic;
  color: #FFFFFF; letter-spacing: -0.4px;
  opacity: 1; transition: opacity 0.15s;
}
.logo-text em { color: var(--primary); font-style: normal; }
.sidebar.collapsed .logo-text { opacity: 0; pointer-events: none; }

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0;
}
.nav-group-label {
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--t3);
  padding: 12px 18px 5px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s;
}
.sidebar.collapsed .nav-group-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  margin: 1px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.12s, color 0.12s;
  position: relative;
  color: var(--t2);
  font-size: 13.5px;
  font-weight: 500;
  user-select: none;
}
.nav-item:hover {
  background: var(--surface-3);
  color: var(--t1);
}
.nav-item.active {
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.nav-icon {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-item:hover .nav-icon { opacity: 1; }
.nav-icon svg { width: 16px; height: 16px; display: block; }
.nav-label {
  font-size: 13.5px;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-group-label { opacity: 0; }

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px;
  flex-shrink: 0;
  overflow: hidden;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s;
}
.user-card:hover { background: var(--surface-3); }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary-dim2);
  color: var(--primary);
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--primary-dim2);
}
.user-info { overflow: hidden; transition: opacity 0.15s; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--t2); white-space: nowrap; }
.sidebar.collapsed .user-info { opacity: 0; }

/* ── Main area ─────────────────────────────────────────────── */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 100;
}
.topbar-toggle {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--t2);
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.topbar-toggle:hover { background: var(--surface-3); color: var(--t1); }
.topbar-toggle svg { width: 18px; height: 18px; }

.topbar-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--t2);
  flex-shrink: 0;
}
.topbar-breadcrumb .sep { color: var(--t3); }
.topbar-page-title {
  font-size: 15px; font-weight: 700;
  color: var(--t1);
}
.topbar-divider {
  width: 1px; height: 20px;
  background: var(--border-2);
  margin: 0 4px;
}

.topbar-search {
  flex: 1; max-width: 340px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--t1);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 12px 7px 34px;
  outline: none;
  transition: border-color 0.15s;
}
.topbar-search input::placeholder { color: var(--t3); }
.topbar-search input:focus { border-color: var(--primary); }
.gs-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 10px; z-index: 9999; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.gs-group-label {
  font-size: 10px; font-weight: 700; color: var(--t3);
  text-transform: uppercase; letter-spacing: .08em;
  padding: 8px 12px 4px;
}
.gs-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer; transition: background .1s;
}
.gs-item:hover { background: var(--surface-3); }
.gs-item-icon { font-size: 13px; flex-shrink: 0; }
.gs-item-main { min-width: 0; }
.gs-item-title { font-size: 13px; font-weight: 600; color: var(--t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item-sub   { font-size: 11px; color: var(--t3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-empty { padding: 16px 12px; text-align: center; font-size: 13px; color: var(--t3); }
.topbar-search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--t3); width: 15px; height: 15px;
  pointer-events: none;
}

.topbar-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
}
.topbar-icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius);
  background: none; border: 1px solid var(--border-2);
  cursor: pointer; color: var(--t2);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s; position: relative;
  font-size: 15px;
}
.topbar-icon-btn:hover { background: var(--surface-3); color: var(--t1); border-color: var(--border-3); }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
}
#topbar-actions {
  display: flex; align-items: center; gap: 8px;
}

/* ── Content area ──────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  background: var(--bg);
}
.page { display: none; }
.page.active { display: block; }
#page-dashboard.active { display: flex; flex-direction: column; overflow: hidden; }
/* Full-bleed pages that manage their own layout */
.page--flush.active { display: flex; flex-direction: column; margin: -28px; }
@media (max-width: 768px) { .page--flush.active { margin: -16px; } }

/* ═══════════════════════════════════════════════════════════════
   4. COMPONENT LIBRARY
═══════════════════════════════════════════════════════════════ */

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--t2);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title-lg {
  font-size: 15px; font-weight: 700;
  color: var(--t1);
}
.card-sub { font-size: 12px; color: var(--t2); margin-top: 2px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all 0.15s; font-family: inherit;
  white-space: nowrap; user-select: none;
}
.btn-primary {
  background: var(--primary); color: #111;
}
.btn-primary:hover { background: var(--primary-h); }
.btn-primary:focus-visible { box-shadow: var(--glow); outline: none; }
.btn-secondary {
  background: var(--surface-2); color: var(--t1);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-3); }
.btn-ghost {
  background: none; color: var(--t2);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--surface-3); color: var(--t1); border-color: var(--border-2); }
.btn-danger {
  background: var(--red-bg); color: var(--red);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.18); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--t2);
  border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: var(--surface-3); color: var(--t1); border-color: var(--border-3); cursor: pointer; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ── Badges & Status chips ─────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
}
.badge-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }

.badge-green   { background: var(--green-bg);  color: var(--green);  }
.badge-red     { background: var(--red-bg);    color: var(--red);    }
.badge-amber   { background: var(--amber-bg);  color: var(--amber);  }
.badge-blue    { background: var(--blue-bg);   color: var(--blue);   }
.badge-purple  { background: var(--purple-bg); color: var(--purple); }
.badge-cyan    { background: var(--cyan-bg);   color: var(--cyan);   }
.badge-gray    { background: var(--surface-3); color: var(--t2);     }
.badge-primary { background: var(--primary-dim2); color: var(--primary); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 12px; font-weight: 600;
  color: var(--t2);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.form-label .req { color: var(--primary); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--t1);
  font-family: inherit;
  font-size: 13.5px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--t3); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-dim);
}
.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23555' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.form-select option { background: var(--surface-2); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--t3); }
.form-error { font-size: 11px; color: var(--red); }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.table-search {
  position: relative; flex: 1; min-width: 200px; max-width: 320px;
}
.table-search input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--t1);
  font-family: inherit; font-size: 13px;
  padding: 7px 12px 7px 32px;
  outline: none;
  transition: border-color 0.15s;
}
.table-search input::placeholder { color: var(--t3); }
.table-search input:focus { border-color: var(--primary); }
.table-search-icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--t3); width: 14px; height: 14px;
}
/* ── Sortable column headers ── */
.sortable-th {
  cursor: pointer; user-select: none;
  white-space: nowrap;
}
.sortable-th:hover { color: var(--primary); }
.sortable-th::after { content: ' ⇅'; font-size: 10px; color: var(--t3); }
.sortable-th.sort-asc::after  { content: ' ↑'; color: var(--primary); }
.sortable-th.sort-desc::after { content: ' ↓'; color: var(--primary); }

/* ── Inline column filter inputs ── */
.col-filter-input, .col-filter-select {
  width: 100%; box-sizing: border-box;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 5px;
  color: var(--t1);
  font-family: inherit; font-size: 11.5px;
  padding: 3px 7px; outline: none;
  transition: border-color .15s;
}
.col-filter-input:focus, .col-filter-select:focus { border-color: var(--primary); }
.col-filter-input::placeholder { color: var(--t3); }
.col-filter-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='8' height='5' viewBox='0 0 8 5' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L4 4L7 1' stroke='%23555' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
  padding-right: 20px; cursor: pointer;
}
input[type="date"].col-filter-input { appearance: auto; color-scheme: dark; padding-right: 4px; }
#ord-col-filters th { padding: 4px 6px; }
.table-filter-select {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--t1);
  font-family: inherit; font-size: 13px;
  padding: 7px 28px 7px 10px;
  outline: none; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23555' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input[type="date"].table-filter-select {
  padding-right: 10px;
  background-image: none;
  appearance: auto;
  color-scheme: dark;
}
.table-filter-select option { background: var(--surface-2); }
.table-actions { margin-left: auto; display: flex; gap: 8px; }

table.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}
table.data-table thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--t2);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
table.data-table thead th:first-child { border-radius: 0; }
table.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
table.data-table tbody tr:last-child { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--surface-2); }
table.data-table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  color: var(--t1);
}
table.data-table tbody td.muted { color: var(--t2); font-size: 12.5px; }
.table-empty {
  text-align: center; padding: 60px 20px;
  color: var(--t3); font-size: 13px;
}
.table-count {
  font-size: 12px; color: var(--t2);
  padding: 10px 18px;
  border-top: 1px solid var(--border);
}

/* ── KPI Cards ─────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}
.kpi-card:hover { border-color: var(--border-3); transform: translateY(-1px); }
.kpi-card::after {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
}
.kpi-card.kpi-orange::after { background: var(--primary); }
.kpi-card.kpi-green::after  { background: var(--green); }
.kpi-card.kpi-blue::after   { background: var(--blue); }
.kpi-card.kpi-purple::after { background: var(--purple); }

.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.kpi-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.kpi-icon svg { width: 18px; height: 18px; display: block; }
.kpi-icon.orange { background: var(--primary-dim);  color: var(--primary); }
.kpi-icon.green  { background: var(--green-bg);     color: var(--green); }
.kpi-icon.blue   { background: var(--blue-bg);      color: var(--blue); }
.kpi-icon.purple { background: var(--purple-bg);    color: var(--purple); }

.kpi-change {
  font-size: 11.5px; font-weight: 600;
  display: flex; align-items: center; gap: 3px;
}
.kpi-change.up   { color: var(--green); }
.kpi-change.down { color: var(--red); }
.kpi-change.neu  { color: var(--t2); }

.kpi-val {
  font-size: 30px; font-weight: 800;
  color: var(--t1); line-height: 1;
  margin-bottom: 4px;
}
.kpi-label { font-size: 12px; color: var(--t2); font-weight: 500; }

/* ── Dividers ──────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.page-gap { height: 16px; }
.page-gap-sm { height: 10px; }

/* ── Section title ─────────────────────────────────────────── */
.section-title {
  font-size: 13px; font-weight: 700;
  color: var(--t1); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 80px 20px; text-align: center;
  gap: 12px;
}
.empty-icon { font-size: 48px; line-height: 1; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--t1); }
.empty-sub { font-size: 13px; color: var(--t2); max-width: 320px; }

/* ── Coming soon placeholder ───────────────────────────────── */
.coming-soon {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  min-height: calc(100vh - var(--topbar-h) - 56px);
  text-align: center;
}
.cs-icon-wrap {
  width: 72px; height: 72px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  box-shadow: 0 0 0 6px var(--primary-dim3);
}
.cs-title { font-size: 20px; font-weight: 800; color: var(--t1); }
.cs-sub { font-size: 13px; color: var(--t2); max-width: 340px; }
.cs-feature-list {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  width: 100%; max-width: 420px;
  text-align: left;
}
.cs-feature {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--t2);
}
.cs-feature-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary); flex-shrink: 0;
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════
   5. MODAL SYSTEM
═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
.modal-overlay.open { display: flex; }

@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes slideUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column;
  animation: slideUp 0.2s ease;
}
.modal-box.modal-lg { max-width: 760px; }
.modal-box.modal-sm { max-width: 420px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--t1); }
.modal-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: none; border: none; cursor: pointer;
  color: var(--t2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; transition: all 0.12s;
}
.modal-close:hover { background: var(--surface-3); color: var(--t1); }
.modal-body {
  padding: 22px;
  overflow-y: auto; flex: 1;
}
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Confirm dialog ────────────────────────────────────────── */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1100;
  display: none;
  align-items: center; justify-content: center;
  animation: fadeIn 0.12s ease;
}
.confirm-overlay.open { display: flex; }
.confirm-box {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  max-width: 380px; width: 100%;
  text-align: center;
  animation: slideUp 0.18s ease;
}
.confirm-icon { font-size: 36px; margin-bottom: 12px; }
.confirm-title { font-size: 16px; font-weight: 700; color: var(--t1); margin-bottom: 8px; }
.confirm-msg { font-size: 13px; color: var(--t2); margin-bottom: 22px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ═══════════════════════════════════════════════════════════════
   6. TOAST SYSTEM
═══════════════════════════════════════════════════════════════ */
.toast-wrap {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
  align-items: flex-end; pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  font-size: 13.5px; font-weight: 500;
  min-width: 240px; max-width: 380px;
  animation: toastIn 0.22s ease;
}
@keyframes toastIn {
  from { opacity:0; transform:translateY(8px) scale(0.97); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity:1; transform:translateY(0); }
  to   { opacity:0; transform:translateY(8px); }
}
.toast.out { animation: toastOut 0.18s ease forwards; }
.toast-icon { font-size: 17px; flex-shrink: 0; }
.toast-text { color: var(--t1); flex:1; }
.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--t2); font-size: 16px; padding: 0 2px;
  transition: color 0.12s;
}
.toast-close:hover { color: var(--t1); }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--amber); }
.toast.info    { border-left: 3px solid var(--blue); }

/* ═══════════════════════════════════════════════════════════════
   7. UTILITY
═══════════════════════════════════════════════════════════════ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-20  { margin-top: 20px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-12  { font-size: 12px; }
.fs-13  { font-size: 13px; }
.c-t2   { color: var(--t2); }
.c-primary { color: var(--primary); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Highlight primary text ────────────────────────────────── */
.hl { color: var(--primary); font-weight: 600; }

/* ── Skeleton loader ───────────────────────────────────────── */
@keyframes shimmer {
  from { background-position: -500px 0; }
  to   { background-position: 500px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 1000px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius);
}

/* ═══════════════════════════════════════════════════════════════
   8. DASHBOARD
═══════════════════════════════════════════════════════════════ */
.dash-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}
.dash-col { display: flex; flex-direction: column; gap: 16px; }

/* Recent orders table inside dashboard */
.dash-order-row td:first-child { font-weight: 600; color: var(--primary); font-size: 12.5px; }

/* Status donut */
.donut-wrap {
  display: flex; align-items: center; gap: 20px;
  padding: 4px 0;
}
.donut-svg { flex-shrink: 0; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.donut-legend-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px;
}
.donut-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.donut-legend-label { flex: 1; color: var(--t2); }
.donut-legend-val   { font-weight: 700; color: var(--t1); font-size: 13px; }
.donut-legend-pct   { font-size: 11px; color: var(--t3); margin-left: 2px; }

/* Alert items */
.alert-list { display: flex; flex-direction: column; gap: 0; }
.alert-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.alert-item:last-child { border-bottom: none; padding-bottom: 0; }
.alert-item:first-child { padding-top: 0; }
.alert-dot-wrap {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.alert-dot-wrap svg { width: 14px; height: 14px; }
.alert-dot-wrap.warn  { background: var(--amber-bg);  color: var(--amber); }
.alert-dot-wrap.error { background: var(--red-bg);    color: var(--red); }
.alert-dot-wrap.info  { background: var(--blue-bg);   color: var(--blue); }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-size: 13px; font-weight: 600; color: var(--t1); }
.alert-sub   { font-size: 11.5px; color: var(--t2); margin-top: 2px; }
.alert-time  { font-size: 11px; color: var(--t3); white-space: nowrap; }

/* Quick actions */
.quick-actions {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.qa-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; transition: all 0.15s;
  text-align: center;
}
.qa-btn:hover {
  border-color: var(--primary);
  background: var(--primary-dim3);
}
.qa-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  color: var(--t1);
}
.qa-icon svg { width: 17px; height: 17px; }
.qa-btn:hover .qa-icon { background: var(--primary-dim); color: var(--primary); }
.qa-label { font-size: 12px; font-weight: 600; color: var(--t2); line-height: 1.3; }
.qa-btn:hover .qa-label { color: var(--primary); }

/* Activity feed */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.activity-item:last-child { border-bottom: none; }
.activity-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--t2);
  flex-shrink: 0;
}
.activity-avatar.primary { background: var(--primary-dim); color: var(--primary); }
.activity-text { flex: 1; font-size: 12.5px; color: var(--t2); line-height: 1.4; }
.activity-text strong { color: var(--t1); font-weight: 600; }
.activity-time { font-size: 11px; color: var(--t3); white-space: nowrap; flex-shrink: 0; }

/* Reports range button */
.rpt-range, .rpt-timing-view, .rpt-timing-mode { background: var(--surface-3); color: var(--t2); border: 1px solid var(--border-2); border-radius: 6px; padding: 5px 12px; font-size: 12px; cursor: pointer; transition: all .15s; }
.rpt-range:hover, .rpt-timing-view:hover, .rpt-timing-mode:hover { color: var(--t1); border-color: var(--border-3); }
.rpt-range.active, .rpt-timing-view.active, .rpt-timing-mode.active { background: var(--primary-dim); color: var(--primary); border-color: var(--primary-dim2); font-weight: 700; }
/* Bảng thời gian vận hành theo loại xe (reports_renderTiming) */
.rpt-tm-tbl td.num, .rpt-tm-tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rpt-tm-tbl td.num { font-weight: 600; }
.rpt-tm-tbl .rpt-tm-all { background: var(--surface-2); color: var(--primary); font-weight: 800; }
.rpt-tm-leg { font-weight: 600; font-size: 13px; color: var(--t1); }
.rpt-tm-def { font-size: 11px; color: var(--t3); margin-top: 1px; }
/* Mẫu A (11/2026): tab + bảng gọn, hàng thấp, nhãn phụ cùng dòng */
.rpt-tm-tabs { display: inline-flex; margin: 12px 16px 10px; border: 1px solid var(--border-2); border-radius: 7px; overflow: hidden; }
.rpt-tm-tab { background: transparent; color: var(--t2); border: 0; border-right: 1px solid var(--border-2); padding: 6px 16px; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.rpt-tm-tab:last-child { border-right: 0; }
.rpt-tm-tab:hover { color: var(--t1); background: var(--surface-2); }
.rpt-tm-tab.active { background: var(--primary-dim); color: var(--primary); font-weight: 700; }
.rpt-tm-wrap { overflow-x: auto; padding: 0 16px 4px; }
.rpt-tm-wrap .rpt-tm-tbl { border: 1px solid var(--border); border-radius: 8px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.rpt-tm-wrap .rpt-tm-tbl thead th { padding: 8px 14px; letter-spacing: .04em; }
.rpt-tm-wrap .rpt-tm-tbl tbody td { padding: 8px 14px; border-top: 1px solid var(--border); }
.rpt-tm-wrap .rpt-tm-tbl tbody tr:first-child td { border-top: 0; }
.rpt-tm-wrap .rpt-tm-tbl td:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rpt-tm-wrap .rpt-tm-leg { display: inline; }
.rpt-tm-wrap .rpt-tm-def { display: inline; margin: 0 0 0 8px; color: var(--t2); opacity: .75; }
.rpt-tm-wrap .rpt-tm-tbl td.num { font-size: 14px; }
.rpt-tm-wrap .rpt-tm-gap td { padding-top: 8px; border-top: 2px solid var(--border-2); }
.rpt-tm-wrap .rpt-tm-overall td { background: var(--surface-2); }
.rpt-tm-wrap .rpt-tm-overall td.num { color: var(--primary); font-weight: 800; }
.rpt-tm-note { padding: 10px 16px 12px; font-size: 11.5px; color: var(--t3); line-height: 1.6; }
.rpt-tm-count td { color: var(--t2); font-size: 12px; }
.rpt-tm-count td.num { font-weight: 700; }
.rpt-tm-gap td { padding-top: 16px; }
.rpt-tm-overall td { border-top: 2px solid var(--border-2); }
.rpt-tm-overall .rpt-tm-leg { color: var(--primary); }
.rpt-tm-block + .rpt-tm-block { border-top: 6px solid var(--surface-2); }
.rpt-tm-tbl { table-layout: fixed; width: 100%; }
.rpt-tm-tbl th, .rpt-tm-def { overflow: hidden; text-overflow: ellipsis; }
.rpt-tm-est { color: var(--amber); margin-right: 2px; font-weight: 700; cursor: help; }
/* Chuyến bất thường (reports_openAnomalies) */
.rpt-an-btn.is-alert { color: var(--red); border-color: rgba(239,68,68,.45); }
.rpt-an-sec { font-size: 10.5px; font-weight: 700; color: var(--t3); text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 6px; }
.rpt-an-tbl { font-size: 12.5px; }
.rpt-an-tbl td.num, .rpt-an-tbl th.num { text-align: right; white-space: nowrap; }
.rpt-an-tbl td { vertical-align: top; }
.rpt-an-list { margin: 0; padding-left: 16px; line-height: 1.5; }
.rpt-an-list li.is-drop { color: var(--t1); }
.rpt-an-list li.is-drop::marker { color: var(--red); }
.rpt-an-list li.is-warn { color: var(--t2); }
.rpt-an-list li.is-warn::marker { color: var(--amber); }
.rpt-an-badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; border: 1px solid transparent; }
.rpt-an-badge.is-drop { color: var(--red); background: var(--red-bg); border-color: rgba(239,68,68,.3); }
.rpt-an-badge.is-warn { color: var(--amber); background: var(--amber-bg); border-color: rgba(245,158,11,.3); }
.rpt-an-badge.is-keep { color: var(--green); background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.3); }

/* Auth screen */
.auth-bg {
  position: fixed; inset: 0; z-index: 9999;
  background: #0B0B0B;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
#auth-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.auth-glow-orb {
  position: absolute; border-radius: 50%; pointer-events: none;
  filter: blur(80px); opacity: .18;
  animation: auth-orb-drift 12s ease-in-out infinite alternate;
}
.auth-glow-orb.orb1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, #F5A800 0%, transparent 70%);
  top: -120px; left: -100px;
  animation-duration: 14s;
}
.auth-glow-orb.orb2 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, #ff6b00 0%, transparent 70%);
  bottom: -80px; right: -60px;
  animation-duration: 10s; animation-delay: -5s;
}
.auth-glow-orb.orb3 {
  width: 260px; height: 260px;
  background: radial-gradient(circle, #F5A800 0%, transparent 70%);
  top: 50%; left: 50%; transform: translate(-50%,-50%);
  opacity: .07;
  animation-duration: 8s; animation-delay: -3s;
}
@keyframes auth-orb-drift {
  0%   { transform: translate(0,0) scale(1); }
  50%  { transform: translate(30px,-20px) scale(1.08); }
  100% { transform: translate(-20px,30px) scale(.94); }
}
.auth-card {
  position: relative; z-index: 2;
  background: rgba(17,17,17,.82);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(245,168,0,.18);
  border-radius: 20px;
  padding: 40px 44px;
  width: 440px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 32px 80px rgba(0,0,0,.7), 0 0 60px rgba(245,168,0,.07);
  animation: auth-card-in .45s cubic-bezier(.22,1,.36,1) both;
}
@keyframes auth-card-in {
  from { opacity: 0; transform: translateY(22px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-logo-ring {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--primary-dim);
  border: 1.5px solid rgba(245,168,0,.3);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
  box-shadow: 0 0 24px rgba(245,168,0,.15);
}
.auth-tab {
  flex: 1; padding: 7px 0; border: none; border-radius: 6px;
  background: transparent; color: var(--t2); font-size: 13px;
  font-family: inherit; cursor: pointer; font-weight: 500;
  transition: all .15s;
}
.auth-tab.active { background: var(--surface-4); color: var(--t1); font-weight: 600; }

/* Dispatch */
.dsp-ftab {
  padding: 4px 10px; border: none; border-radius: 5px; background: transparent;
  color: var(--t2); font-size: 11.5px; font-family: inherit; cursor: pointer;
  font-weight: 500; transition: all .12s;
}
.dsp-ftab:hover { background: var(--surface-3); color: var(--t1); }
.dsp-ftab.active { background: var(--primary-dim); color: var(--primary); font-weight: 700; }

.dsp-order-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.dsp-order-row:last-child { border-bottom: none; }
.dsp-order-row:hover { background: var(--surface-2); }

.dsp-res-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.dsp-res-row:last-child { border-bottom: none; }
.dsp-res-row:hover { background: var(--surface-2); }

/* Route Optimization */
.ropt-layout { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - var(--topbar-h)); overflow: hidden; }
.ropt-config { border-right: 1px solid var(--border); overflow-y: auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 14px; }
.ropt-results { overflow-y: auto; padding: 20px; } /* kept for compat */
.ropt-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }
.ropt-section-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--t2); margin-bottom: 12px; }
.ropt-run-btn {
  width: 100%; padding: 12px; border: none; border-radius: var(--radius); cursor: pointer;
  background: var(--primary); color: #000; font-size: 13.5px; font-weight: 800;
  font-family: inherit; transition: all .15s; letter-spacing: .02em;
}
.ropt-run-btn:hover:not(:disabled) { background: var(--primary-h); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(245,168,0,.3); }
.ropt-run-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.ropt-progress-wrap { display: none; }
.ropt-progress-bar { height: 5px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-bottom: 6px; }
.ropt-progress-fill { height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s ease; width: 0%; }
.ropt-progress-label { font-size: 11px; color: var(--t2); }
.ropt-log { font-size: 10.5px; color: var(--t3); max-height: 72px; overflow-y: auto; font-family: monospace; line-height: 1.6; }
.ropt-source-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.ropt-stab { flex: 1; padding: 7px 8px; border: 1px solid var(--border); border-radius: 6px; background: transparent;
  color: var(--t2); font-size: 12px; font-family: inherit; cursor: pointer; font-weight: 500; text-align: center; transition: all .12s; }
.ropt-stab.active { border-color: var(--primary); background: var(--primary-dim); color: var(--primary); font-weight: 700; }
.ropt-upload-zone { border: 1.5px dashed var(--border-2); border-radius: var(--radius); padding: 20px 12px; text-align: center; cursor: pointer;
  transition: all .15s; color: var(--t3); font-size: 12px; }
.ropt-upload-zone:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-dim3); }
.ropt-order-preview { font-size: 11.5px; color: var(--t2); padding: 8px 0; }
/* Result cards */
.ropt-summary { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.ropt-sum-item { flex: 1; min-width: 80px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; text-align: center; }
.ropt-sum-val { font-size: 22px; font-weight: 800; color: var(--primary); }
.ropt-sum-lbl { font-size: 10px; color: var(--t3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.ropt-result-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(340px,1fr)); gap: 14px; }
.ropt-truck-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: border-color .15s; }
.ropt-truck-card:hover { border-color: var(--border-2); }
.ropt-truck-hdr { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.ropt-truck-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--primary); color: #000;
  font-size: 14px; font-weight: 900; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ropt-truck-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.ropt-route-line { display: flex; flex-direction: column; gap: 0; }
.ropt-route-node { display: flex; align-items: flex-start; gap: 8px; }
.ropt-dot-wrap { display: flex; flex-direction: column; align-items: center; width: 14px; flex-shrink: 0; padding-top: 2px; }
.ropt-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ropt-dot-depot { background: var(--t1); border: 2px solid var(--primary); }
.ropt-dot-stop  { background: var(--primary); border: 2px solid rgba(245,168,0,.3); }
.ropt-connector { width: 2px; flex: 1; min-height: 12px; background: var(--border-2); margin: 2px 0; }
.ropt-node-label { font-size: 11.5px; color: var(--t2); padding-bottom: 8px; line-height: 1.3; }
.ropt-node-label.depot { color: var(--t1); font-weight: 600; }
.ropt-order-list { display: flex; flex-direction: column; gap: 4px; }
.ropt-order-row { display: flex; align-items: flex-start; gap: 8px; padding: 7px 10px;
  background: var(--surface-2); border-radius: 6px; }
.ropt-order-num { width: 18px; height: 18px; background: var(--surface-3); border-radius: 4px;
  font-size: 10px; font-weight: 700; color: var(--t3); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.ropt-lf-wrap { display: flex; flex-direction: column; gap: 5px; }
.ropt-lf-row { display: flex; align-items: center; gap: 8px; }
.ropt-lf-label { font-size: 10px; font-weight: 700; color: var(--t3); width: 28px; flex-shrink: 0; }
.ropt-lf-bar { flex: 1; height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.ropt-lf-fill { height: 100%; border-radius: 99px; transition: width .5s ease; }
.ropt-lf-val { font-size: 10.5px; font-weight: 700; width: 40px; text-align: right; flex-shrink: 0; }
.ropt-km-badge { display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  background: var(--primary-dim3); border: 1px solid rgba(245,168,0,.12); border-radius: 6px;
  font-size: 11.5px; color: var(--t2); flex-wrap: wrap; }
.ropt-map-btn { margin-left: auto; padding: 3px 10px; border: 1px solid var(--border-2); border-radius: 4px;
  background: transparent; color: var(--t2); font-size: 11px; font-family: inherit; cursor: pointer; transition: all .12s; }
.ropt-map-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-dim3); }
.ropt-truck-map { width: 100%; height: 240px; border-radius: 6px; overflow: hidden; margin-top: 4px; display: none; cursor: pointer; }
/* Map phóng to toàn màn hình — để screenshot gửi khách */
#ropt-bigmap-overlay { position: fixed; inset: 0; z-index: 4000; background: var(--bg, #0b0f14);
  display: flex; flex-direction: column; }
.ropt-bigmap-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--surface, #111827); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ropt-bigmap-title { font-size: 14px; font-weight: 800; color: var(--t1); flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ropt-bigmap-close { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-2);
  background: transparent; color: var(--t2); font-size: 16px; cursor: pointer; flex-shrink: 0; line-height: 1; }
.ropt-bigmap-close:hover { border-color: var(--red, #ef4444); color: var(--red, #ef4444); }
#ropt-bigmap-canvas { flex: 1 1 0; min-height: 0; width: 100%; background: #e5e7eb; }
/* Badge số km nổi bật trên map to — để screenshot gửi đối tác luôn thấy rõ km */
.ropt-bigmap-badge { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 1200;
  background: rgba(255,255,255,.97); border: 2px solid #D6006E; border-radius: 14px; padding: 7px 22px;
  text-align: center; box-shadow: 0 5px 20px rgba(0,0,0,.32); pointer-events: none; }
.ropt-bigmap-badge .rbb-sub { font-size: 12.5px; font-weight: 700; color: #475569; letter-spacing: .2px; }
.ropt-bigmap-badge .rbb-km { font-size: 28px; font-weight: 900; color: #D6006E; line-height: 1.12; letter-spacing: .3px; }
/* Nhãn địa chỉ cố định tại mỗi điểm trên map to (ropt_drawTruckOnMap showLabels) */
.leaflet-tooltip.ropt-ptlabel { background: #fff; border: 1px solid rgba(0,0,0,.2); border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.32); padding: 6px 9px; color: #1E293B; font-size: 12px; line-height: 1.4;
  width: 210px; max-width: 210px; white-space: normal; word-break: break-word; overflow-wrap: anywhere;
  display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.leaflet-tooltip.ropt-ptlabel::before { display: none; }   /* bỏ mũi nhọn tooltip */
.ropt-ptlabel-num { flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px;
  background: #F5A800; color: #1E293B; font-weight: 800; font-size: 11.5px; display: inline-flex;
  align-items: center; justify-content: center; margin-top: 1px; }
.ropt-ptlabel-txt { flex: 1 1 auto; min-width: 0; }
.ropt-ptlabel-txt b { display: block; font-weight: 800; font-size: 12.5px; color: #0F172A; margin-bottom: 2px; }
.ropt-ptlabel-addr { display: block; color: #475569; font-size: 11px; line-height: 1.35; }
.ropt-deferred { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }
.ropt-deferred-title { font-size: 12px; font-weight: 700; color: var(--amber); margin-bottom: 10px; }
.ropt-deferred-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.ropt-deferred-row:last-child { border-bottom: none; }
.ropt-stat-pill { display: inline-flex; padding: 2px 8px; border-radius: 99px; font-size: 10px; font-weight: 700; }
.ropt-stat-pill.good { background: var(--green-bg); color: var(--green); }
.ropt-stat-pill.warn { background: var(--amber-bg); color: var(--amber); }
.ropt-stat-pill.low  { background: var(--red-bg);   color: var(--red); }
.ropt-stat-pill.km   { background: var(--surface-3); color: var(--t2); }
/* Route Optimizer — UI polish */
.ropt-section-title { display: flex; align-items: center; gap: 7px; }
.ropt-section-title > svg { width: 13px; height: 13px; color: var(--primary); flex-shrink: 0; }
.ropt-fleet-tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11.5px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ropt-fleet-tbl thead th { text-align: left; padding: 7px 8px; font-weight: 700; font-size: 9.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--t3); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.ropt-fleet-tbl tbody td { padding: 8px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; color: var(--t1); }
.ropt-fleet-tbl tbody tr:last-child td { border-bottom: none; }
.ropt-fleet-tbl tbody tr:hover td { background: var(--primary-dim3); }
.ropt-fleet-tbl .num { text-align: right; color: var(--t2); }
.ropt-fleet-tbl .ctr { text-align: center; color: var(--t2); }
.ropt-icon-btn { border: none; background: transparent; cursor: pointer; padding: 4px; border-radius: 5px; color: var(--t3); line-height: 0; transition: background .12s, color .12s; }
.ropt-icon-btn:hover { background: var(--surface-3); color: var(--t1); }
.ropt-icon-btn.danger:hover { color: var(--red); background: var(--red-bg); }
.ropt-empty-fleet { font-size: 11.5px; color: var(--t3); padding: 16px 8px; text-align: center; border: 1px dashed var(--border-2); border-radius: 8px; line-height: 1.6; }
.ropt-add-btn { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; margin-top: 8px; border: 1px dashed var(--border-2); border-radius: 8px; background: transparent; color: var(--t2); font-size: 12px; font-weight: 600; cursor: pointer; transition: border-color .12s, color .12s, background .12s; }
.ropt-add-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-dim3); }
.ropt-add-btn > svg { width: 13px; height: 13px; }
.ropt-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 10px; font-weight: 600; }
.ropt-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; min-height: 300px; color: var(--t3); gap: 10px; }
/* Tab bar */
.ropt-right { display: flex; flex-direction: column; overflow: hidden; }
.ropt-tabbar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 10px 20px;
  background: var(--surface); flex-shrink: 0; }
.ropt-tab { padding: 8px 14px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--t2);
  font-size: 12.5px; font-weight: 600; font-family: inherit; cursor: pointer; transition: all .15s;
  display: inline-flex; align-items: center; gap: 7px; }
.ropt-tab > svg { width: 15px; height: 15px; }
.ropt-tab:hover { color: var(--t1); background: var(--surface-2); }
.ropt-tab.active { color: var(--primary); background: var(--primary-dim); border-color: var(--primary-dim2); }
.ropt-tab-badge { display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--t2); border-radius: 99px;
  font-size: 10px; font-weight: 700; padding: 1px 7px; min-width: 22px; }
.ropt-tab-badge--ready { background: var(--green-bg); color: var(--green); }
@keyframes spin { to { transform: rotate(360deg); } }
.ropt-tab-body { flex: 1; overflow-y: auto; padding: 20px; }
/* Preview table */
.ropt-preview-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ropt-preview-table thead th { background: var(--surface-2); color: var(--t2); font-size: 10.5px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; position: sticky; top: 0; }
.ropt-preview-table tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
.ropt-preview-table tbody tr:hover { background: var(--surface-2); }
.ropt-preview-table tbody tr.ropt-row-selected { background: var(--primary-dim) !important; }
.ropt-preview-table tbody tr.ropt-row-selected td { color: var(--t1); }
.ropt-sel-toolbar { display:flex; align-items:center; gap:10px; padding:8px 12px; background:var(--primary-dim); border:1px solid rgba(245,168,0,.25); border-radius:8px; margin-bottom:12px; font-size:12.5px; }
.ropt-sel-toolbar.hidden { display:none; }
.ropt-preview-table tbody td { padding: 9px 10px; vertical-align: middle; color: var(--t1); }
.ropt-preview-table tbody tr:last-child { border-bottom: none; }
.ropt-preview-stats { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.ropt-badge-split { background: var(--blue-bg); color: var(--blue); padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; }
.ropt-badge-ghep  { background: var(--amber-bg); color: var(--amber); padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; }

/* Driver Tracking */
.trk-layout { display: flex; height: calc(100vh - var(--topbar-h)); overflow: hidden; }
.trk-sidebar { width: 260px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--surface); }
.trk-sidebar-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.trk-sidebar-footer { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.trk-dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px rgba(34,197,94,.3); animation: trk-pulse 2s ease-in-out infinite; }
@keyframes trk-pulse { 0%,100% { box-shadow: 0 0 0 2px rgba(34,197,94,.3); } 50% { box-shadow: 0 0 0 5px rgba(34,197,94,.1); } }
.trk-driver-row { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; display: flex; align-items: center; gap: 10px; }
.trk-driver-row:hover { background: var(--surface-2); }
.trk-driver-row.active { background: var(--primary-dim); }
.trk-driver-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-3); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0; color: var(--t1); }
.trk-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.trk-status-dot.on_trip  { background: var(--primary); }
.trk-status-dot.active   { background: var(--green); }
.trk-status-dot.off      { background: var(--t3); }

/* Settings nav */
.stg-nav {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 10px;
  background: transparent; border: none; border-radius: var(--radius);
  color: var(--t2); font-size: 13px; font-family: inherit;
  cursor: pointer; text-align: left; transition: all .15s;
}
.stg-nav:hover { background: var(--surface-2); color: var(--t1); }
.stg-nav.active { background: var(--primary-dim); color: var(--primary); font-weight: 600; }
.stg-nav svg { flex-shrink: 0; }

/* Empty dash state */
.dash-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 40px 20px; text-align: center;
}
.dash-empty-icon {
  width: 44px; height: 44px; border-radius: var(--radius-lg);
  background: var(--surface-2); border: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--t3);
}
.dash-empty-icon svg { width: 22px; height: 22px; }
.dash-empty-text { font-size: 13px; color: var(--t2); }
.dash-empty-sub  { font-size: 12px; color: var(--t3); }

/* ═══════════════════════════════════════════════════════════════
   9. DASHBOARD SUB-TABS
═══════════════════════════════════════════════════════════════ */
.dash-subtab {
  padding: 10px 18px; font-size: 12.5px; font-weight: 700;
  border: none; background: none; cursor: pointer;
  color: var(--t3); border-bottom: 2px solid transparent;
  transition: color 0.15s;
}
.dash-subtab-active { color: var(--primary); border-bottom: 2px solid var(--primary); }
.fin-period-btn {
  padding: 5px 13px; font-size: 12px; font-weight: 600; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--t2);
  cursor: pointer; transition: all 0.15s;
}
.fin-period-btn:hover { border-color: var(--primary); color: var(--primary); }
.fin-period-active { background: var(--primary) !important; color: #000 !important; border-color: var(--primary) !important; }

/* ═══════════════════════════════════════════════════════════════
   10. RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 960px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .sidebar { position: fixed; z-index: 300; transform: translateX(-100%); transition: transform 0.22s; }
  .sidebar.mobile-open { transform: translateX(0); }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

.map-type-btn {
  background: var(--surface-3); border: 1px solid var(--border-2);
  color: var(--t2); font-size: 11px; font-weight: 600;
  padding: 4px 9px; border-radius: 6px; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.map-type-btn:hover { border-color: var(--primary); color: var(--primary); }
.map-type-active { background: var(--primary-dim) !important; border-color: var(--primary) !important; color: var(--primary) !important; }

/* ── Chuyến hàng: cột Hành động gọn (link + menu ⋯) ── */
.shp-act { display: inline-flex; align-items: center; gap: 4px; }
.shp-act .btn-icon { color: var(--t2); }
.shp-act .btn-icon:hover, .shp-act-more.is-open { color: var(--t1); border-color: var(--border-2); background: var(--surface-3); }
.shp-menu {
  position: fixed; z-index: 99999; min-width: 196px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.shp-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 7px; background: transparent;
  color: var(--t2); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer;
}
.shp-menu-item svg { flex-shrink: 0; opacity: .85; }
.shp-menu-item:hover, .shp-menu-item:focus-visible { background: var(--surface-3); color: var(--t1); outline: none; }
.shp-menu-item.is-danger { color: var(--red); }
.shp-menu-item.is-danger:hover, .shp-menu-item.is-danger:focus-visible { background: var(--red-bg); color: var(--red); }
.shp-menu-sep { height: 1px; margin: 4px 6px; background: var(--border); }
/* Đơn tách nhiều xe trong popup chi tiết chuyến */
.shp-split-badge {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 99px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums;
  color: var(--amber); background: var(--amber-bg); border: 1px solid rgba(245,158,11,.35);
}
.shp-split-line { font-size: 11px; color: var(--amber); margin-top: 4px; line-height: 1.45; }
.shp-split-line a { color: var(--amber); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

/* ── Carrier Statement: thẻ theo chuyến (cstmt_render) ── */
.cst-empty { padding: 44px; text-align: center; color: var(--t3); font-size: 13px; border: 1px solid var(--border); border-radius: 12px; }
.cst-dim { color: var(--t3); }
.cst-lbl { font-size: 11px; color: var(--t2); text-transform: uppercase; letter-spacing: .05em; }
.cst-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cst-kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.cst-kval { font-size: 22px; font-weight: 800; line-height: 1.15; margin-top: 6px; font-variant-numeric: tabular-nums; }
.cst-kval small { font-size: 12px; font-weight: 600; color: var(--t3); }
.cst-list { display: flex; flex-direction: column; gap: 12px; }
.cst-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.cst-head { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cst-date { font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.cst-who { flex: 1; min-width: 0; color: var(--t2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cst-vtype { display: inline-block; margin-left: 10px; padding: 1px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; color: var(--blue, #60A5FA); background: rgba(96,165,250,.12); border: 1px solid rgba(96,165,250,.3); vertical-align: 1px; }
.cst-note { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; padding: 1px 9px 1px 3px; border-radius: 99px; font-size: 11px; font-weight: 700; color: var(--amber); background: var(--amber-bg); border: 1px solid rgba(245,158,11,.35); vertical-align: 1px; font-variant-numeric: tabular-nums; }
.cst-note-k { padding: 0 6px; border-radius: 99px; background: rgba(245,158,11,.22); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.cst-total { text-align: right; }
.cst-total + .cst-total { padding-left: 16px; border-left: 1px solid var(--border); }
.cst-amt { font-size: 15px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cst-edit { color: var(--t3); }
.cst-edit:hover { color: var(--primary); }
.cst-tbl { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12.5px; }
.cst-tbl th { padding: 7px 14px 5px; font-size: 10.5px; font-weight: 600; color: var(--t2); text-transform: uppercase; letter-spacing: .04em; text-align: left; }
.cst-tbl td { padding: 7px 14px; border-top: 1px solid var(--border); vertical-align: top; }
.cst-tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cst-npp { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cst-npp .shp-split-badge { margin-left: 6px; vertical-align: 1px; }
.cst-of { font-size: 10.5px; color: var(--t3); line-height: 1.2; }
.cst-addr { color: var(--t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cst-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--t2); font-variant-numeric: tabular-nums; }
.cst-foot b, .cst-grand b { color: var(--t1); font-weight: 700; }
.cst-sum { margin-left: auto; }
.cst-grand { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin-top: 14px; padding: 12px 16px; border: 1px solid var(--primary-dim2, rgba(245,168,0,.2)); background: var(--primary-dim); border-radius: 12px; font-size: 12.5px; color: var(--t2); font-variant-numeric: tabular-nums; }
.cst-grand-t { font-weight: 700; color: var(--t1); }
.cst-grand-amt { margin-left: auto; font-size: 17px; font-weight: 800; color: var(--primary); }
.cst-ltl-wrap { border: 1px solid var(--border); border-radius: 12px; overflow: auto; }
/* Bảng kê khách hàng (Billing, xuka_renderTable) — dùng lại .cst-* + vài class riêng */
.xk-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -4px 0 12px; }
.xk-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--t2); cursor: pointer; user-select: none; }
.xk-ht { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.xk-ht.is-ltl { color: var(--amber); background: var(--amber-bg); border-color: rgba(245,158,11,.3); }
.xk-ht.is-ftl { color: #818CF8; background: rgba(129,140,248,.12); border-color: rgba(129,140,248,.3); }
.xk-region { color: var(--t2); }
.xk-note { margin-top: 4px; font-size: 12px; color: var(--t1); line-height: 1.35; word-break: break-word; }
.ord-lock { margin-left: 5px; font-size: 11px; cursor: help; }
.ord-lock-btn { color: var(--amber); }
.xk-lock { margin-left: 6px; font-size: 11px; cursor: help; }
.xk-tbl tbody tr.xk-row { cursor: default; }
.xk-tbl tbody tr.xk-row:hover td { background: var(--surface-2); }
.xk-info { display: flex; flex-direction: column; gap: 8px; }
.xk-info-sec { font-size: 10.5px; font-weight: 700; color: var(--t3); text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }
.xk-info-sec:first-child { margin-top: 0; }
.xk-kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; font-size: 13px; align-items: start; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }
.xk-kv > span { word-break: break-word; }
.xk-k { color: var(--t3); }
@media (max-width: 560px) { .xk-kv { grid-template-columns: 1fr; gap: 2px; } .xk-k { margin-top: 6px; } }
.xk-ov { color: var(--amber); font-size: 9px; margin-left: 4px; vertical-align: 2px; }
.xk-foot { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-top: 14px; }
.xk-foot-sum { font-size: 12.5px; color: var(--t2); padding-top: 4px; font-variant-numeric: tabular-nums; }
.xk-foot-sum b { color: var(--t1); }
.xk-inv { min-width: 300px; margin-left: auto; border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.xk-inv-row { display: flex; justify-content: space-between; gap: 24px; padding: 3px 0; font-size: 12.5px; color: var(--t2); }
.xk-inv-row span:last-child { color: var(--t1); font-weight: 600; }
.xk-inv-row.is-sub { margin-top: 4px; padding-top: 7px; border-top: 1px solid var(--border); }
.xk-inv-row.is-total { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 14px; font-weight: 700; color: var(--t1); }
.xk-inv-row.is-total span:last-child { color: var(--green); font-size: 17px; font-weight: 800; }
.xk-tbl td { vertical-align: top; }
/* Bảng kê LTL dạng thẻ theo ngày (cstmt_renderLtl) */
.cst-depot { font-size: 12px; color: var(--t2); margin: -4px 0 12px; }
.cst-depot b { color: var(--t1); font-weight: 600; }
.cst-sub { font-size: 11.5px; color: var(--t2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cst-plate { display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: 5px; font-size: 10.5px; font-weight: 700; color: var(--t1); background: var(--surface-3); border: 1px solid var(--border-2); vertical-align: 1px; }
.cst-rate { color: var(--t2); }
/* Cột quan trọng của bảng kê LTL (Khối, Đơn giá): chỉ đổi màu chữ (vàng đậm), không tô nền */
.cst-tbl td.cst-hl { color: var(--primary); font-weight: 800; font-size: 13px; }
.cst-tbl th.cst-hl { color: var(--primary); }
.cst-money { font-weight: 700; }
.cst-tbl td .cst-rowedit { width: 26px; height: 26px; padding: 0; }
.cst-kv { display: inline-block; max-width: 100%; padding: 1px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid transparent; }
.cst-kv-0 { color: #60A5FA; background: rgba(96,165,250,.12);  border-color: rgba(96,165,250,.3); }
.cst-kv-1 { color: #34D399; background: rgba(52,211,153,.12);  border-color: rgba(52,211,153,.3); }
.cst-kv-2 { color: #F472B6; background: rgba(244,114,182,.12); border-color: rgba(244,114,182,.3); }
.cst-kv-3 { color: #A78BFA; background: rgba(167,139,250,.12); border-color: rgba(167,139,250,.3); }
.cst-kv-4 { color: #FB923C; background: rgba(251,146,60,.12);  border-color: rgba(251,146,60,.3); }
.cst-kv-5 { color: #2DD4BF; background: rgba(45,212,191,.12);  border-color: rgba(45,212,191,.3); }
/* Form sửa chuyến */
.cse-total { margin-top: 16px; max-width: 320px; }
.cse-hint { font-size: 11px; color: var(--t3); margin-top: 5px; }
.cse-sec { margin: 18px 0 8px; font-size: 11px; font-weight: 700; color: var(--t3); text-transform: uppercase; letter-spacing: .06em; }
.cse-otbl { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 640px; }
.cse-otbl th { text-align: left; font-size: 10.5px; font-weight: 600; color: var(--t3); padding: 0 4px 6px; }
.cse-otbl td { padding: 3px 4px; }
.cse-otbl .form-input { padding: 6px 8px; font-size: 12px; }
.cse-otbl td:nth-child(n+3) .form-input { width: 84px; text-align: right; }
@media (max-width: 720px) {
  .cst-head { flex-wrap: wrap; }
  .cst-who { flex-basis: 100%; order: 3; white-space: normal; }
  .cst-card { overflow-x: auto; }
  .cst-tbl { min-width: 560px; }
}

/* ── Phân quyền: role viewer chỉ xem — ẩn mọi nút thêm/sửa/xóa/xác nhận.
   Selector khớp theo tên hàm trong onclick → tự áp dụng cho mọi lần re-render.
   Nút export/in/xem KHÔNG bị ẩn (không khớp pattern nào bên dưới). ── */
body[data-role="viewer"] [onclick*="openModal"],
body[data-role="viewer"] [onclick*="_modalOnSave"],
body[data-role="viewer"] [onclick*="_delete"],
body[data-role="viewer"] [onclick*="_del("],
body[data-role="viewer"] [onclick*="_remove"],
body[data-role="viewer"] [onclick*="_save"],
body[data-role="viewer"] [onclick*="_add"],
body[data-role="viewer"] [onclick*="_create"],
body[data-role="viewer"] [onclick*="_confirm"],
body[data-role="viewer"] [onclick*="_cancel"],
body[data-role="viewer"] [onclick*="_assign"],
body[data-role="viewer"] [onclick*="_apply"],
body[data-role="viewer"] [onclick*="ropt_run"],
body[data-role="viewer"] [onclick*="clearData"],
body[data-role="viewer"] [onclick*="importJSON"],
body[data-role="viewer"] [onclick*="_openCreate"],
body[data-role="viewer"] [onclick*="_openAdd"],
body[data-role="viewer"] [onclick*="_openEdit"],
body[data-role="viewer"] [onclick*="_openAssign"],
body[data-role="viewer"] [onclick*="_editStatus"],
body[data-role="viewer"] [onclick*="_editCell"],
body[data-role="viewer"] [onclick*="ropt_edit"],
body[data-role="viewer"] [onclick*="pricing_edit"],
body[data-role="viewer"] [onclick*="drivers_export"],
body[data-role="viewer"] #stg-users-section { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   SEASONAL EVENT THEMES  — đè token màu + nền login theo body[data-season]
   Bật/tắt bằng theme.js (theme_apply / auto theo ngày).
   Asset: src/assets/themes/<slug>/login-bg.jpg (+ logo.png, decoration.png tùy chọn)
═══════════════════════════════════════════════════════════════ */

/* ── Rằm tháng 7 (tông TÍM) ──────────────────────────────────── */
body[data-season="ram-thang-7"] {
  --primary:      #8E44AD;
  --primary-h:    #6C3483;
  --primary-dim:  rgba(142,68,173,0.12);
  --primary-dim2: rgba(142,68,173,0.20);
  --primary-dim3: rgba(142,68,173,0.07);
  --ring:  0 0 0 1px rgba(142,68,173,0.40);
  --glow:  0 0 0 1px rgba(142,68,173,0.30), 0 0 16px rgba(142,68,173,0.14);
}
/* Logo → biểu tượng sự kiện (swap ảnh bằng content:url — giữ đúng width/height) */
body[data-season="ram-thang-7"] .brand-logo { content: url("../assets/themes/ram-thang-7/logo.png"); }
body[data-season="ram-thang-7"] .logo-mark  { border-color: transparent; background: transparent; }
/* Chữ "TMS" đổi theo màu event */
body[data-season="ram-thang-7"] .brand-tms { color: var(--primary) !important; }

/* Màn hình đăng nhập: nền ảnh sự kiện + lớp decoration khung (đều là asset) */
body[data-season="ram-thang-7"] .auth-bg {
  background:
    url("../assets/themes/ram-thang-7/decoration.png") center/cover no-repeat,
    #0B0910 url("../assets/themes/ram-thang-7/login-bg.jpg") center/cover no-repeat;
}
body[data-season="ram-thang-7"] #auth-canvas   { opacity: 0.22; }
body[data-season="ram-thang-7"] .auth-glow-orb { display: none; }

/* Nền content: quầng tím rất mờ ở góc (tinh tế, không hại đọc) */
body[data-season="ram-thang-7"] .content {
  background:
    radial-gradient(120% 70% at 100% 0%, rgba(142,68,173,0.08), transparent 55%),
    radial-gradient(90% 60% at 0% 100%, rgba(255,138,0,0.04), transparent 55%),
    var(--bg);
}

/* ── Giáng sinh (tông VÀNG KIM + điểm đỏ đô / xanh thông) ─────────
   KHÔNG đổi --red/--green: đó là màu trạng thái (hủy / đã giao). */
body[data-season="christmas"] {
  --primary:      #EDB443;
  --primary-h:    #D49A2A;
  --primary-dim:  rgba(237,180,67,0.10);
  --primary-dim2: rgba(237,180,67,0.18);
  --primary-dim3: rgba(237,180,67,0.06);
  --ring:  0 0 0 1px rgba(237,180,67,0.40);
  --glow:  0 0 0 1px rgba(237,180,67,0.30), 0 0 16px rgba(237,180,67,0.14);
}
body[data-season="christmas"] .brand-logo { content: url("../assets/themes/christmas/logo.png"); }
body[data-season="christmas"] .logo-mark  { border-color: transparent; background: transparent; }
body[data-season="christmas"] .brand-tms  { color: var(--primary) !important; }

/* Màn hình đăng nhập: nền làng tuyết + khung kim tuyến; tuyết rơi = canvas #season-snow (theme.js) */
body[data-season="christmas"] .auth-bg {
  background:
    url("../assets/themes/christmas/decoration.png") center/cover no-repeat,
    #080605 url("../assets/themes/christmas/login-bg.jpg") center/cover no-repeat;
}
body[data-season="christmas"] #auth-canvas   { display: none; }
body[data-season="christmas"] .auth-glow-orb { display: none; }
body[data-season="christmas"] .auth-card {
  border-color: rgba(237,180,67,.28);
  box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 32px 80px rgba(0,0,0,.75), 0 0 70px rgba(128,32,44,.22);
}
#season-snow {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 1;
}

/* Trong app: dây kim tuyến ở mép trên vùng nội dung (là background, cuộn theo nội dung,
   KHÔNG che nút) + quầng đỏ đô / xanh thông rất mờ ở 2 góc. */
body[data-season="christmas"] .content {
  background:
    url("../assets/themes/christmas/garland.png") top left / auto 26px repeat-x local,
    radial-gradient(120% 70% at 100% 0%, rgba(128,32,44,0.10), transparent 55%) scroll,
    radial-gradient(90% 60% at 0% 100%, rgba(30,90,60,0.08), transparent 55%) scroll,
    var(--bg);
}
/* Trang full-bleed (bản đồ, Route Optimizer…) phủ sát mép → bỏ dây kim tuyến */
body[data-season="christmas"] .content:has(.page--flush.active) {
  background:
    radial-gradient(120% 70% at 100% 0%, rgba(128,32,44,0.10), transparent 55%),
    var(--bg);
}
