/* ============================================================
   theme.css — Admin design system (Bootstrap-style)
   Design tokens are isolated here so the whole look can be
   re-skinned by changing :root variables only.
   (Original code — clean-room reconstruction, refined from recon.)
   ============================================================ */

:root {
  /* ---- BRAND TOKENS (re-skin point) — matches trucker.ancient.mx green ---- */
  --primary:      #598039;   /* olive/forest green */
  --primary-d:    #405d29;
  --primary-soft: rgba(89, 128, 57, 0.10);
  --secondary:    #598039;
  --success:      #4caf50;
  --info:         #218ade;
  --warning:      #e98c03;
  --danger:       #df3f33;

  /* ---- CHROME ---- */
  --sidebar-bg:   #ffffff;
  --sidebar-fg:   #5a5d6e;
  --sidebar-active-bg: var(--primary-soft);
  --sidebar-active-fg: var(--primary);
  --topbar-bg:    #ffffff;
  --body-bg:      #f8f9fa;
  --card-bg:      #ffffff;
  --border:       #e6e8ee;

  --text:         #3e3e3e;
  --muted:        #8a8da3;

  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 1px 3px rgba(0,0,0,.04), 0 6px 18px rgba(20,20,43,.05);
  --shadow-sm:    0 1px 2px rgba(0,0,0,.06);

  --font: "Nunito", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --sidebar-w: 250px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--body-bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: var(--primary); }

/* ============================================================
   LAYOUT
   ============================================================ */
.admin { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #e4e4ee; border-radius: 3px; }

.brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 20px; flex: none;
  border-bottom: 1px solid var(--border);
}
.brand .logo {
  width: 36px; height: 36px; border-radius: 9px; flex: none;
  background: var(--primary); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 16px;
}
.brand .name { font-weight: 800; font-size: 18px; letter-spacing: -0.3px; }

.nav { padding: 14px 12px; flex: 1; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); font-weight: 700; padding: 16px 12px 8px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--sidebar-fg); font-weight: 600; margin-bottom: 2px;
}
.nav-link i, .nav-link .ic { width: 20px; text-align: center; font-size: 16px; opacity: .9; }
.nav-link:hover { background: #f6f6fb; color: var(--text); }
.nav-link.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-fg); }
.nav-link .badge { margin-left: auto; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: none;
  background: var(--topbar-bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px;
  background: var(--body-bg); border-radius: 999px; padding: 9px 16px; color: var(--muted);
}
.topbar .search input { border: 0; background: none; outline: none; flex: 1; color: var(--text); font: inherit; }
.topbar .iconbtn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--body-bg);
  color: var(--text); display: grid; place-items: center; font-size: 16px; cursor: pointer; position: relative;
}
.topbar .iconbtn .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--topbar-bg); }
.topbar .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 800; }

.content { padding: 24px; flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 800; margin: 0; letter-spacing: -0.4px; }
.page-head .crumb { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ============================================================
   COMPONENTS
   ============================================================ */
.card2 {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card2 .card-head { display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card2 .card-head h3 { font-size: 16px; font-weight: 800; margin: 0; }
.card2 .card-body { padding: 20px; }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.kpi {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px 20px;
}
.kpi .top { display: flex; align-items: center; justify-content: space-between; }
.kpi .ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-size: 18px; }
.kpi .val { font-size: 26px; font-weight: 800; margin-top: 14px; letter-spacing: -0.5px; }
.kpi .lbl { color: var(--muted); font-weight: 600; margin-top: 2px; }
.kpi .delta { font-size: 12px; font-weight: 700; margin-top: 8px; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); font-weight: 700; padding: 13px 20px; border-bottom: 1px solid var(--border); }
.tbl tbody td { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.tbl tbody tr:hover { background: #fafafe; }
.tbl tbody tr:last-child td { border-bottom: 0; }

/* Badges / pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; }
.pill.dot::before { content:""; width:7px; height:7px; border-radius:50%; background: currentColor; }
.pill-success { background: rgba(33,181,115,.12); color: var(--success); }
.pill-warning { background: rgba(247,181,0,.14); color: #c98f00; }
.pill-danger  { background: rgba(240,50,60,.12); color: var(--danger); }
.pill-info    { background: rgba(31,155,207,.12); color: var(--info); }
.pill-muted   { background: #eef0f5; color: var(--muted); }

/* Buttons */
.btn2 { border: 0; border-radius: var(--radius-sm); font-weight: 700; font-family: var(--font);
  padding: 9px 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.btn-primary2 { background: var(--primary); color: #fff; }
.btn-primary2:hover { background: var(--primary-d); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-ghost { background: var(--body-bg); color: var(--text); }
.btn-sm2 { padding: 6px 12px; font-size: 13px; }

/* Forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.input2 { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 14px; font: inherit; color: var(--text); background: #fff; outline: none; }
.input2:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* helpers */
.row2 { display: grid; gap: 18px; }
.g2 { grid-template-columns: 2fr 1fr; }
.g2e { grid-template-columns: 1fr 1fr; }
.muted { color: var(--muted); }
.mt0{margin-top:0}.mb0{margin-bottom:0}
.toastr { position: fixed; right: 24px; bottom: 24px; background: #2b2b3c; color: #fff; font-weight: 600;
  padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 999; opacity: 0;
  transform: translateY(10px); transition: .2s; pointer-events: none; }
.toastr.show { opacity: 1; transform: none; }
.table-wrap { overflow-x: auto; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search { flex: 1; max-width: 320px; display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; color: var(--muted); }
.toolbar .search input { border: 0; outline: none; background: none; flex: 1; font: inherit; color: var(--text); }
.chip { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 700;
  font-size: 13px; color: var(--text); cursor: pointer; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty i { font-size: 40px; opacity: .5; display: block; margin-bottom: 10px; }
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: inline-grid; place-items: center; font-weight: 800; font-size: 13px; }

@media (max-width: 992px) {
  .sidebar { position: fixed; left: -260px; z-index: 60; transition: left .2s; box-shadow: var(--shadow); }
  .sidebar.open { left: 0; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .row2.g2, .row2.g2e { grid-template-columns: 1fr; }
}
