:root {
  --primary: #E10613;
  --primary-dark: #B3040F;
  --secondary: #0E1C2F;
  --background: #F4F6FA;
  --white: #FFFFFF;
  --success: #00B894;
  --warning: #FDCB6E;
  --danger: #FF3B30;
  --text: #1f2937;
  --muted: #667085;
  --radius: 8px;
  --shadow: 0 6px 18px rgba(14, 28, 47, 0.08);
}

body.dark {
  --background: #121417;
  --white: #1C1F26;
  --text: #f4f6fa;
  --muted: #b6bfca;
  --secondary: #0b1525;
  --shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--background);
}

a { color: var(--secondary); text-decoration: none; }
a:hover { color: var(--primary); }

.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  width: 260px;
  background: var(--secondary);
  color: #fff;
  padding: 18px 14px;
  display: none;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.logo-wrap { display: flex; align-items: center; gap: 10px; }
.logo-wrap img { width: 100%; max-width: 210px; }
.logo-bus {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--primary);
  display: grid; place-items: center;
  box-shadow: 0 6px 12px rgba(225, 6, 19, 0.35);
}

.sidebar-nav { display: grid; gap: 8px; }
.sidebar-nav a {
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: all .2s ease;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--primary);
  transform: translateX(2px);
}

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--white);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.burger-btn {
  border: none; background: var(--secondary); color: #fff;
  width: 42px; height: 42px; border-radius: var(--radius); cursor: pointer;
}
.topbar-brand img { height: 34px; width: auto; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  border: none; background: var(--background);
  width: 40px; height: 40px; border-radius: var(--radius);
  color: var(--secondary); cursor: pointer; position: relative;
}
.notif-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 18px; height: 18px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 11px;
  display: grid; place-items: center;
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--secondary); color: #fff;
  font-weight: 700; display: grid; place-items: center;
}
.demo-badge {
  background: var(--warning);
  color: #3f2f00;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

main {
  padding: 14px 12px 90px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

h1, h2, h3 { margin-top: 0; color: var(--secondary); }
body.dark h1, body.dark h2, body.dark h3 { color: #fff; }

.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  overflow-x: auto;
  border-top: 4px solid rgba(225, 6, 19, 0.12);
}
.driver-card { position: relative; }
.driver-card .card-icon { font-size: 34px; }
.driver-card .btn { margin-top: 8px; }

label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
input, textarea, select, button {
  width: 100%; margin-top: 6px; min-height: 46px;
  border-radius: var(--radius); border: 1px solid #d2d7e2;
  padding: 12px 11px; font-size: 16px; background: #fff;
}
body.dark input, body.dark textarea, body.dark select {
  background: #131820; border-color: #2f3744; color: #fff;
}
textarea { min-height: 98px; }

button, .btn {
  background: var(--primary); color: #fff; border: none;
  font-weight: 700; cursor: pointer;
  transition: all .2s ease;
}
button:hover, .btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-outline {
  background: transparent !important;
  border: 2px solid var(--secondary) !important;
  color: var(--secondary) !important;
}

.error { color: var(--danger); font-weight: 600; }
.alert { border-left: 4px solid var(--primary); padding: 10px 12px; border-radius: var(--radius); background: #fff; }
.badge { display: inline-flex; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.success { background: rgba(0,184,148,.18); color: #056a56; }
.badge.warning { background: rgba(253,203,110,.22); color: #664104; }
.badge.danger { background: rgba(255,59,48,.15); color: #a91009; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid #e4e8f0; font-size: 14px; }
thead th { background: var(--secondary); color: #fff; position: sticky; top: 0; }
tbody tr:nth-child(even) { background: rgba(244, 246, 250, 0.7); }
body.dark tbody tr:nth-child(even) { background: rgba(255,255,255,0.03); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 3px; bottom: 3px; width: 2px; background: #d9dee8; }
.timeline-item { position: relative; margin-bottom: 12px; }
.timeline-item::before {
  content: ''; position: absolute; left: -18px; top: 8px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--primary);
}

.product-card { overflow: hidden; }
.product-media {
  border-radius: var(--radius); height: 150px;
  background: linear-gradient(120deg, #0E1C2F, #E10613);
  margin-bottom: 10px; transition: transform .2s ease;
}
.product-card:hover .product-media { transform: scale(1.02); }

.app-footer { margin: 12px; }
.app-footer .card { padding: 10px 12px; border-top: 0; }

.mobile-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--primary); color: #fff;
  display: flex; justify-content: space-around; gap: 4px;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
}
.mobile-nav a {
  color: #fff; font-size: 12px; display: grid;
  gap: 2px; place-items: center; font-weight: 700;
}
.mobile-nav .icon { font-size: 17px; }

.demo-banner {
  background: var(--warning);
  color: #473400;
  padding: 8px 10px;
  margin: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

body.dark .card,
body.dark .topbar,
body.dark .app-footer .card { color: #f4f6fa; }

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

@media (min-width: 980px) {
  .app-sidebar { display: flex; }
  .mobile-nav { display: none; }
  .burger-btn { display: none; }
  main { padding: 20px 20px 34px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

@media (max-width: 979px) {
  .app-shell.sidebar-open .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 250px;
    display: flex;
    z-index: 60;
  }
  .app-shell.sidebar-open::after {
    content: ''; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 50;
  }
  table { min-width: 560px; }
}
