﻿:root {
  --navy: #0f172a;
  --navy-light: #172038;
  --amber: #f59e0b;
  --amber-dark: #b45309;
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #1e2433;
  --muted: #6b7280;
  --border: #e5e7eb;
  --green: #16a34a;
  --red: #dc2626;
  --blue: #2563eb;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 230px;
  background: var(--navy);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-mark {
  background: var(--amber);
  color: var(--navy);
  font-weight: 800;
  font-size: 13px;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}

.brand-mark-logo {
  height: 24px;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand-logo-chip {
  background: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.25;
  color: #fff;
  letter-spacing: 0.2px;
}

.nav {
  flex: 1;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #a9b4c9;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.nav-ico {
  font-size: 13px;
  width: 16px;
  text-align: center;
  color: var(--amber);
}

.nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.nav-link.active {
  background: var(--amber);
  color: var(--navy);
  font-weight: 600;
}

.nav-link.active .nav-ico { color: var(--navy); }

.nav-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 14px 12px 4px;
  font-weight: 700;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #a9b4c9;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.nav-dropdown-toggle:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-dropdown-toggle .nav-caret { font-size: 10px; transition: transform 0.15s; }
.nav-dropdown.open > .nav-dropdown-toggle .nav-caret { transform: rotate(90deg); }

.nav-dropdown-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 10px;
  max-height: 0;
  overflow: hidden;
}
.nav-dropdown.open > .nav-dropdown-body {
  max-height: 500px;
}

.filter-select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: #fff;
  color: var(--ink);
}

.sidebar-foot {
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #dbe3f0;
  margin-bottom: 8px;
}

.user-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.logout-link {
  font-size: 12px;
  color: #8fa0bd;
  text-decoration: none;
}
.logout-link:hover { color: #fff; }

/* Main content */
.content {
  margin-left: 230px;
  flex: 1;
  padding: 28px 34px;
}

.topbar h1 {
  font-size: 21px;
  margin: 0 0 10px 0;
}

.route-line {
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--amber) 0 10px, transparent 10px 18px);
  margin-bottom: 22px;
}

/* Messages */
.messages { margin-bottom: 16px; }
.msg {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 8px;
}
.msg-success { background: #dcfce7; color: #166534; }
.msg-error { background: #fee2e2; color: #991b1b; }

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

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--amber);
}

.stat-label {
  font-size: 12.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--navy);
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.panel-head h2 {
  font-size: 16px;
  margin: 0;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 2px solid var(--border);
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

tr:last-child td { border-bottom: none; }

.mono { font-family: 'Consolas', monospace; color: var(--navy); }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-available, .badge-delivered, .badge-paid { background: #dcfce7; color: #166534; }
.badge-dispatched, .badge-in_transit, .badge-on_trip { background: #fef3c7; color: #92400e; }
.badge-maintenance, .badge-cancelled, .badge-pending { background: #fee2e2; color: #991b1b; }
.badge-scheduled, .badge-off_duty, .badge-partial { background: #e0e7ff; color: #3730a3; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.btn-primary { background: var(--amber); color: var(--navy); }
.btn-primary:hover { background: var(--amber-dark); color: #fff; }

.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f1f5f9; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger-text { color: var(--red); text-decoration: none; font-size: 12.5px; }
.btn-edit-text { color: var(--blue); text-decoration: none; font-size: 12.5px; margin-right: 10px; }

.actions-col { white-space: nowrap; }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.form-field { margin-bottom: 4px; }
.form-field.full { grid-column: 1 / -1; }

.form-field label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13.5px;
  font-family: inherit;
  background: #fbfbfd;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--amber);
  background: #fff;
}

.form-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

/* Filter pills */
.filter-row { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-pill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
  background: #fff;
}
.filter-pill.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  background: var(--navy);
}

.login-panel-left {
  flex: 1.1;
  position: relative;
  display: flex;
  align-items: center;
  padding: 60px 64px;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 15%, rgba(245,158,11,0.18) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(245,158,11,0.12) 0%, transparent 50%),
    linear-gradient(160deg, #0f172a 0%, #0b1224 60%, #070b16 100%);
}

.login-panel-glow {
  position: absolute;
  top: -120px; right: -120px;
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(245,158,11,0.25) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.login-panel-content {
  position: relative;
  z-index: 1;
  max-width: 480px;
}

.login-panel-content .login-brand { margin-bottom: 44px; }
.login-panel-content .brand-mark { width: 38px; height: 38px; }

.login-hero-title {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  margin: 0 0 16px;
  letter-spacing: -0.3px;
}

.login-hero-sub {
  font-size: 14.5px;
  line-height: 1.6;
  color: #9aa5bc;
  margin: 0 0 36px;
  max-width: 400px;
}

.login-hero-stats {
  display: flex;
  gap: 32px;
  margin-bottom: 40px;
}

.login-hero-stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--amber);
}

.login-hero-stat-label {
  font-size: 11.5px;
  color: #8891a8;
  margin-top: 3px;
  max-width: 90px;
  line-height: 1.35;
}

.login-route-svg { width: 100%; max-width: 380px; opacity: 0.9; }

.login-panel-right {
  flex: 1;
  min-width: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 40px;
}

.login-brand-mobile { display: none; }

.login-card {
  background: var(--card);
  width: 380px;
  padding: 40px 38px;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15,23,42,0.12);
  border: 1px solid var(--border);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.login-brand .brand-mark {
  width: 36px; height: 36px;
}

.login-title { font-size: 22px; font-weight: 700; margin: 20px 0 4px; color: var(--ink); }
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 26px; }

.login-card .form-field { margin-bottom: 18px; }
.login-input-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.login-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  background: #fafbfc;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-input-wrap:focus-within {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
  background: #fff;
}
.login-input-ico { font-size: 14px; opacity: 0.55; }
.login-input-wrap input {
  border: none;
  background: transparent;
  padding: 11px 0;
  font-size: 14px;
  width: 100%;
  outline: none;
  color: var(--ink);
}

.login-submit-btn {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 14.5px;
  font-weight: 700;
  margin-top: 6px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(245,158,11,0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}
.login-submit-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(245,158,11,0.45); }

.login-footnote {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 22px;
}

@media (max-width: 900px) {
  .login-panel-left { display: none; }
  .login-panel-right { flex: 1; min-width: 0; }
  .login-brand-mobile { display: flex; }
}

/* Invoice detail */
.invoice-sheet {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px 38px;
  max-width: 720px;
}
.invoice-sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 2px dashed var(--border);
  margin-bottom: 20px;
}
.invoice-total-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
}
.invoice-total-row.grand {
  border-top: 2px solid var(--navy);
  margin-top: 8px;
  padding-top: 12px;
  font-weight: 700;
  font-size: 16px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 13.5px;
}

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   DASHBOARD VISUAL CHARTS
   ========================================================= */

.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 26px;
    margin-bottom: 26px;
}


/* Chart Card */

.chart-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;

    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.06);

    min-width: 0;
}


/* First three charts */

.chart-card:nth-child(1),
.chart-card:nth-child(2),
.chart-card:nth-child(3) {
    grid-column: span 2;
}


/* Bottom two charts */

.chart-wide {
    grid-column: span 3;
}


/* Chart heading */

.chart-card h3 {
    margin: 0 0 14px 0;

    font-size: 18px;
    font-weight: 600;

    color: #111827;
}


/* Chart area */

.chart-container {
    position: relative;

    height: 310px;
    width: 100%;
}


/* Bottom charts */

.monthly-chart {
    height: 330px;
}


/* Responsive */

@media (max-width: 1200px) {

    .dashboard-charts {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-card:nth-child(1),
    .chart-card:nth-child(2),
    .chart-card:nth-child(3),
    .chart-wide {
        grid-column: span 1;
    }
}


@media (max-width: 700px) {

    .dashboard-charts {
        grid-template-columns: 1fr;
    }

    .chart-card:nth-child(1),
    .chart-card:nth-child(2),
    .chart-card:nth-child(3),
    .chart-wide {
        grid-column: span 1;
    }

    .chart-container {
        height: 280px;
    }
}

/* Add Point button */
.add-point-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  padding: 10px 18px;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #172554;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.22);
  transition: all 0.2s ease;
}

.add-point-btn:hover {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(245, 158, 11, 0.32);
}

.add-point-btn:active {
  transform: translateY(0);
  box-shadow: 0 3px 8px rgba(245, 158, 11, 0.22);
}

.add-point-btn:focus-visible {
  outline: 3px solid rgba(245, 158, 11, 0.3);
  outline-offset: 2px;
}

/* POD status filter */
.pod-status-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  margin-right: 14px;
}

.pod-status-filter label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.pod-status-filter select {
  width: auto;
  min-width: 125px;
  padding: 7px 10px;
}

/* POD status checkboxes */
.pod-status-options {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 38px;
}

.pod-status-option {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  margin: 0 !important;
  color: #374151 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer;
}

.pod-status-option input[type="checkbox"] {
  width: 16px !important;
  height: 16px;
  margin: 0;
  accent-color: var(--amber);
  cursor: pointer;
}


/* Fix: wide tables scroll inside content instead of breaking page */
.content { min-width: 0; overflow-x: auto; }


/* Trips table: scrolls inside its own panel, Actions column always visible */
.trips-table-wrap { width: 100%; overflow-x: auto; }
.trips-table { min-width: 1250px; }
.trips-table th, .trips-table td { padding: 10px 8px; }
/* Invoice Number column (12th) */
.trips-table td:nth-child(12) { width: 150px; max-width: 150px; white-space: normal; word-break: break-all; }
/* Actions column sticks to right edge */
.trips-table th:last-child, .trips-table td:last-child {
  position: sticky; right: 0; background: #fff;
  box-shadow: -6px 0 8px -6px rgba(15, 23, 42, 0.18);
}