/* Optima Platform - Dark theme */
:root {
  --bg: #0f0f0f;
  --bg1: #161616;
  --bg2: #1e1e1e;
  --bg3: #262626;
  --border: #2a2a2a;
  --border2: #333;
  --t1: #f5f5f5;
  --t2: #d4d4d4;
  --t3: #a3a3a3;
  --t4: #737373;
  --accent: #FF9933;
  --accent2: #e68a2e;
  --green: #34D186;
  --red: #ef4444;
  --yellow: #FBBF24;
  --blue: #60A5FA;
  --font: 'Inter', -apple-system, sans-serif;
  --radius: 8px;
  --radius-sm: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--t1);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

#app { display: flex; height: 100vh; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--t4); }

/* Sidebar */
.sidebar {
  width: 220px;
  background: var(--bg1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.sidebar-logo span { color: var(--t3); font-weight: 400; font-size: 11px; margin-left: 6px; }

.sidebar-nav { flex: 1; padding: 0 8px; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--t3);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}

.nav-item:hover { background: var(--bg3); color: var(--t2); }
.nav-item.active { background: var(--bg3); color: var(--accent); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }

.nav-sep { height: 1px; background: var(--border); margin: 8px 12px; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--t4);
}

/* Main content */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg1);
  flex-shrink: 0;
}

.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-sub { font-size: 12px; color: var(--t4); margin-left: 12px; font-weight: 400; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--t2);
  font-family: var(--font);
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover { background: var(--bg3); border-color: var(--border2); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); }

.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,0.1); }

.btn-sm { padding: 5px 10px; font-size: 11px; }

.btn-icon {
  padding: 6px;
  border: none;
  background: none;
  color: var(--t3);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.btn-icon:hover { background: var(--bg3); color: var(--t1); }

/* Cards */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title span { color: var(--t4); font-weight: 400; font-size: 11px; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }

.stat {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.stat-label { font-size: 11px; color: var(--t4); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-value.accent { color: var(--accent); }
.stat-delta { font-size: 11px; margin-top: 2px; }
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red); }

/* Tables */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.tbl th {
  text-align: left;
  padding: 8px 10px;
  font-weight: 600;
  font-size: 11px;
  color: var(--t4);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
  background: var(--bg1);
  position: sticky;
  top: 0;
  z-index: 1;
}

.tbl td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.tbl tr:hover td { background: rgba(255,255,255,0.02); }

.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-family: 'SF Mono', 'Consolas', monospace; }
.tbl .mono { font-family: 'SF Mono', 'Consolas', monospace; font-size: 11px; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-green { background: rgba(52,209,134,0.15); color: var(--green); }
.badge-red { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-yellow { background: rgba(251,191,36,0.15); color: var(--yellow); }
.badge-blue { background: rgba(96,165,250,0.15); color: var(--blue); }
.badge-gray { background: rgba(115,115,115,0.15); color: var(--t4); }

/* Forms */
.form-group { margin-bottom: 12px; }
.form-label { display: block; font-size: 11px; color: var(--t4); margin-bottom: 4px; font-weight: 500; }

.form-input,
.form-select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg1);
  color: var(--t1);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus { border-color: var(--accent); }

.form-input::placeholder { color: var(--t4); }

select.form-select { cursor: pointer; appearance: none; }

textarea.form-input { resize: vertical; min-height: 60px; }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* Status dots */
.sdot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.sdot.ok { background: var(--green); }
.sdot.warn { background: var(--yellow); }
.sdot.bad { background: var(--red); }
.sdot.idle { background: var(--t4); }

/* Rent table (weekly grid) */
.rent-grid {
  display: grid;
  grid-template-columns: 200px repeat(7, 1fr) 80px;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.rent-cell {
  background: var(--bg2);
  padding: 6px 8px;
  font-size: 11px;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.rent-cell.header {
  background: var(--bg1);
  font-weight: 600;
  color: var(--t4);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.3px;
  justify-content: center;
}

.rent-cell.vehicle {
  font-weight: 600;
  font-size: 12px;
  gap: 6px;
}

.rent-cell.total {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  justify-content: flex-end;
  font-family: 'SF Mono', 'Consolas', monospace;
}

.rent-cell select {
  width: 100%;
  padding: 2px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg1);
  color: var(--t2);
  font-size: 11px;
  font-family: var(--font);
}

.rent-cell.idle { background: rgba(115,115,115,0.08); }
.rent-cell.repair { background: rgba(251,191,36,0.08); }

/* Modal / Drawer */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
}

.drawer {
  width: 480px;
  max-width: 90vw;
  background: var(--bg1);
  border-left: 1px solid var(--border);
  height: 100vh;
  overflow-y: auto;
  padding: 24px;
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tab {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--t4);
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}

.tab:hover { color: var(--t2); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--t4);
  font-size: 13px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 10px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  animation: fadeIn 0.2s ease;
  max-width: 320px;
}

.toast.success { background: rgba(52,209,134,0.9); color: #000; }
.toast.error { background: rgba(239,68,68,0.9); color: #fff; }
.toast.info { background: rgba(96,165,250,0.9); color: #000; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Search */
.search-box {
  position: relative;
}

.search-box input {
  padding-left: 32px;
}

.search-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--t4);
}

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--t4);
}

.empty-icon { font-size: 32px; margin-bottom: 8px; opacity: 0.3; }
.empty-text { font-size: 13px; }

/* Responsive */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 800px) {
  .sidebar { width: 60px; }
  .sidebar-logo span, .nav-item span { display: none; }
  .sidebar-logo { padding: 16px 12px; font-size: 14px; }
  .nav-item { justify-content: center; padding: 10px; }
  .stat-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4, .grid-2-1 { grid-template-columns: 1fr; }
  .rent-grid { font-size: 10px; }
}

/* Print */
@media print {
  .sidebar, .topbar { display: none; }
  .content { padding: 0; overflow: visible; }
  body { background: #fff; color: #000; }
  .card { border-color: #ddd; }
}

/* Login */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg0);
}

.login-box {
  width: 340px;
  padding: 32px;
  background: var(--bg2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.login-logo {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  text-align: center;
  margin-bottom: 24px;
}

.login-logo span { color: var(--t2); font-weight: 400; }

.login-error {
  background: rgba(239,68,68,0.15);
  color: var(--red);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 12px;
}

/* Sidebar user */
.sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 0;
  justify-content: center;
}

.pagination .btn-sm {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--t2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pagination .btn-sm:hover:not([disabled]) { background: var(--bg3); border-color: var(--accent); }
.pagination .btn-sm[disabled] { opacity: 0.3; cursor: default; }
.pagination .btn-active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 700; }
.pagination .page-dots { color: var(--t4); padding: 0 4px; font-size: 12px; }

/* Utility */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.muted { color: var(--t4); }
.accent-fg { color: var(--accent); }
.green-fg { color: var(--green); }
.red-fg { color: var(--red); }
.mono { font-family: 'SF Mono', 'Consolas', monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
