:root {
  --bg-0: #0a0e12;
  --bg-1: #101820;
  --bg-2: #16202a;
  --bg-3: #1c2a38;
  --panel: rgba(18, 28, 38, 0.92);
  --border: rgba(0, 173, 239, 0.22);
  --border-soft: rgba(255, 255, 255, 0.06);
  --text: #e8eef4;
  --text-muted: #8fa3b5;
  --primary: #00ADEF;
  --secondary: #8CC63F;
  --accent: #EC008C;
  --teal: #1a6f8f;
  --teal-deep: #0E4B66;
  --danger: #ff4d6d;
  --warning: #ffb020;
  --success: #8CC63F;
  --info: #00ADEF;
  --radius: 12px;
  --sidebar-w: 268px;
  --sidebar-w-collapsed: 72px;
  --header-h: 64px;
  --shadow-neon: 0 0 0 1px rgba(0, 173, 239, 0.25), 0 0 18px rgba(0, 173, 239, 0.12);
  --font: "Segoe UI", "Candara", "Tahoma", "Geneva", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(0, 173, 239, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(236, 0, 140, 0.10), transparent 50%),
    radial-gradient(ellipse 50% 40% at 80% 100%, rgba(140, 198, 63, 0.08), transparent 50%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 45%, #0c141c);
  line-height: 1.45;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: #4cc8f5; }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #0b1219 0%, #0f1822 100%);
  border-right: 1px solid var(--border-soft);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  transition: width .25s ease, transform .25s ease;
  box-shadow: 4px 0 24px rgba(0,0,0,.35);
}
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar-brand {
  display: flex; align-items: center; justify-content: center;
  padding: 12px 14px; border-bottom: 1px solid var(--border-soft);
  min-height: var(--header-h);
}
.sidebar-brand img {
  width: auto; max-width: 100%; height: 44px; object-fit: contain;
}
.sidebar.collapsed .sidebar-brand img { height: 36px; }

.sidebar-nav { overflow-y: auto; padding: 12px 8px 24px; flex: 1; }
.nav-item { margin-bottom: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text-muted); border: 1px solid transparent;
  transition: .18s ease;
}
.nav-link:hover {
  color: var(--text);
  background: rgba(0, 173, 239, 0.08);
  border-color: rgba(0, 173, 239, 0.18);
}
.nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(0,173,239,.18), rgba(140,198,63,.08));
  border-color: rgba(0,173,239,.35);
  box-shadow: var(--shadow-neon);
}
.nav-link .nav-icon {
  width: 20px; height: 20px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: filter .18s ease, color .18s ease;
}
.nav-link .nav-icon svg {
  stroke: currentColor;
  filter: drop-shadow(0 0 4px currentColor);
}
.nav-icon--home { color: #00ADEF; }
.nav-icon--book { color: #8CC63F; }
.nav-icon--truck { color: #EC008C; }
.nav-icon--invoice { color: #4cc8f5; }
.nav-icon--calendar { color: #ffb020; }
.nav-icon--chart { color: #b6e56a; }
.nav-icon--upload { color: #ff6ec7; }
.nav-icon--users { color: #00d4aa; }
.nav-icon--settings { color: #7ad7f5; }
.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
  filter: drop-shadow(0 0 8px currentColor);
}
.sidebar.collapsed .nav-label, .sidebar.collapsed .nav-caret { display: none; }
.nav-caret { margin-left: auto; font-size: 11px; opacity: .7; transition: transform .2s; }
.nav-item.open > .nav-link .nav-caret { transform: rotate(90deg); }
.nav-children {
  display: none; padding: 4px 0 6px 18px;
}
.nav-item.open > .nav-children { display: block; }
.nav-children a {
  display: block; padding: 7px 10px; border-radius: 8px;
  color: var(--text-muted); font-size: 13px;
}
.nav-children a:hover, .nav-children a.active {
  color: var(--primary); background: rgba(0,173,239,.08);
}
.sidebar.collapsed .nav-children { display: none !important; }

.main-wrap {
  flex: 1; margin-left: var(--sidebar-w);
  min-width: 0; transition: margin-left .25s ease;
  display: flex; flex-direction: column; min-height: 100vh;
}
.sidebar.collapsed ~ .main-wrap { margin-left: var(--sidebar-w-collapsed); }

.topbar {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 20px;
  background: rgba(10, 16, 22, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; z-index: 30;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border-soft); background: var(--bg-2);
  color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: .15s ease;
}
.icon-btn:hover { border-color: var(--primary); box-shadow: var(--shadow-neon); }
.icon-btn .nav-icon {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn .nav-icon svg,
.nav-link .nav-icon svg {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--border-soft); background: var(--bg-2);
}
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.user-meta { line-height: 1.2; }
.user-meta strong { display: block; font-size: 13px; }
.user-meta span { font-size: 11px; color: var(--text-muted); }

.content { padding: 20px; flex: 1; }
.page-title {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.page-title h1 { margin: 0; font-size: 1.45rem; letter-spacing: .02em; }
.page-title p { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  position: relative; overflow: hidden;
  transition: .2s ease; cursor: pointer; color: inherit;
  display: block;
}
.stat-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
}
.stat-card:nth-child(3n)::before { background: linear-gradient(180deg, var(--secondary), var(--primary)); }
.stat-card:nth-child(4n)::before { background: linear-gradient(180deg, var(--accent), var(--primary)); }
.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0,173,239,.4);
  box-shadow: var(--shadow-neon);
}
.stat-card .label { color: var(--text-muted); font-size: 12px; margin-bottom: 8px; }
.stat-card .value { font-size: 1.35rem; font-weight: 700; letter-spacing: .01em; }
.stat-card .hint { margin-top: 6px; font-size: 11px; color: var(--text-muted); }

.panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border-soft);
}
.panel-header h2, .panel-header h3 { margin: 0; font-size: 1rem; }
.panel-body { padding: 16px; }

.charts-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px;
}
.chart-box { min-height: 280px; position: relative; }
.chart-box canvas { max-height: 260px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; font-weight: 600; font-size: 13px; transition: .15s ease;
  background: var(--bg-3); color: var(--text);
}
.btn:hover { filter: brightness(1.08); }
.btn-primary {
  background: linear-gradient(135deg, #0090c7, var(--primary));
  border-color: rgba(0,173,239,.5);
  box-shadow: 0 0 16px rgba(0,173,239,.25);
  color: #041018;
}
.btn-secondary {
  background: linear-gradient(135deg, #6fa028, var(--secondary));
  color: #0b1404; border-color: rgba(140,198,63,.45);
}
.btn-danger { background: rgba(255,77,109,.15); border-color: rgba(255,77,109,.45); color: #ff8aa0; }
.btn-ghost { background: transparent; border-color: var(--border-soft); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; }

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; min-width: 720px;
}
table.data th, table.data td {
  padding: 10px 12px; border-bottom: 1px solid var(--border-soft);
  text-align: left; font-size: 13px; vertical-align: middle;
}
table.data th {
  color: var(--text-muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em;
  background: rgba(0,0,0,.18); position: sticky; top: 0;
}
table.data tr:hover td { background: rgba(0,173,239,.04); }
table.data .actions { white-space: nowrap; display: flex; gap: 6px; }

.form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px;
}
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.form-control, .form-select, .form-textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border-soft); background: var(--bg-1);
  outline: none; transition: .15s ease;
}
.form-control:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,173,239,.15);
}
.form-textarea { min-height: 90px; resize: vertical; }
.form-hint { font-size: 11px; color: var(--text-muted); }
.form-error { color: var(--danger); font-size: 12px; }

.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px;
}
.filters .form-group { min-width: 160px; }

.badge {
  display: inline-flex; align-items: center; padding: 3px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  border: 1px solid transparent;
}
.badge-success { background: rgba(140,198,63,.15); color: #b6e56a; border-color: rgba(140,198,63,.35); }
.badge-danger { background: rgba(255,77,109,.15); color: #ff8aa0; border-color: rgba(255,77,109,.35); }
.badge-warning { background: rgba(255,176,32,.15); color: #ffc85a; border-color: rgba(255,176,32,.35); }
.badge-info { background: rgba(0,173,239,.15); color: #7ad7f5; border-color: rgba(0,173,239,.35); }
.badge-muted { background: rgba(255,255,255,.06); color: var(--text-muted); }

.alert {
  padding: 12px 14px; border-radius: 10px; margin-bottom: 12px;
  border: 1px solid transparent; font-size: 13px;
}
.alert-success { background: rgba(140,198,63,.12); border-color: rgba(140,198,63,.35); color: #c6ef88; }
.alert-error { background: rgba(255,77,109,.12); border-color: rgba(255,77,109,.35); color: #ffb0bf; }
.alert-warning { background: rgba(255,176,32,.12); border-color: rgba(255,176,32,.35); color: #ffd48a; }
.alert-info { background: rgba(0,173,239,.12); border-color: rgba(0,173,239,.35); color: #9fe0f7; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--border-soft); }
.tab {
  padding: 10px 14px; color: var(--text-muted); border-bottom: 2px solid transparent;
  margin-bottom: -1px; font-weight: 600; font-size: 13px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.pagination {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; align-items: center;
}
.pagination a, .pagination span {
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-soft);
  color: var(--text-muted); font-size: 12px;
}
.pagination a:hover, .pagination .current {
  border-color: var(--primary); color: var(--primary); background: rgba(0,173,239,.08);
}

.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(0,173,239,.18), transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(236,0,140,.14), transparent 35%),
    radial-gradient(circle at 50% 100%, rgba(140,198,63,.10), transparent 40%),
    #05080c;
}
.login-card {
  width: min(420px, 100%);
  background: rgba(12, 18, 26, 0.92);
  border: 1px solid rgba(0,173,239,.28);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: 0 0 0 1px rgba(140,198,63,.08), 0 0 40px rgba(0,173,239,.15);
}
.login-logo { text-align: center; margin-bottom: 22px; }
.login-logo img { width: 120px; height: auto; filter: drop-shadow(0 0 12px rgba(0,173,239,.35)); }
.login-logo h1 { margin: 12px 0 4px; font-size: 1.2rem; }
.login-logo p { margin: 0; color: var(--text-muted); font-size: 12px; }
.password-wrap { position: relative; }
.password-wrap .toggle-pass {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; color: var(--text-muted); cursor: pointer;
}

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: none; align-items: center; justify-content: center; z-index: 80; padding: 16px;
}
.modal-backdrop.show { display: flex; }
.modal {
  width: min(480px, 100%); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 14px; padding: 18px;
  box-shadow: var(--shadow-neon);
}
.modal h3 { margin: 0 0 8px; }
.modal p { color: var(--text-muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.empty-state {
  text-align: center; padding: 36px 16px; color: var(--text-muted);
}

.footer-bar {
  padding: 12px 20px; color: var(--text-muted); font-size: 12px;
  border-top: 1px solid var(--border-soft); text-align: center;
}

@media (max-width: 1100px) {
  .charts-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-105%);
    width: min(86vw, var(--sidebar-w));
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed { width: min(86vw, var(--sidebar-w)); }
  .main-wrap, .sidebar.collapsed ~ .main-wrap { margin-left: 0; }
  .user-meta { display: none; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .cards-grid { grid-template-columns: 1fr; }
  .content { padding: 14px; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-wrap { margin: 0 !important; }
  body { background: #fff; color: #000; }
  .panel { box-shadow: none; border: 1px solid #ccc; }
}
