:root {
  --bg: #eef1f7;
  --panel: #ffffff;
  --panel-soft: #f7f8fc;
  --border: #ccd5e6;
  --border-strong: #1f2b88;
  --text: #0d1220;
  --muted: #5d6680;
  --accent: #23247f;
  --accent-2: #3344b7;
  --accent-soft: #e8ebff;
  --ok: #1c2b7a;
  --warn: #4d5eb0;
  --danger: #7d2638;
  --shadow: 0 20px 48px rgba(27, 39, 102, 0.12);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(35, 36, 127, 0.12), transparent 24%),
    radial-gradient(circle at top right, rgba(51, 68, 183, 0.1), transparent 20%),
    linear-gradient(180deg, #f8faff 0%, #edf1f8 100%);
  min-height: 100vh;
}

.app-shell {
  width: min(1500px, calc(100% - 28px));
  margin: 0 auto;
  padding: 20px 0 36px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 24px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.06), transparent 40%),
    linear-gradient(135deg, #13174d, #23247f 55%, #1a2368 100%);
  box-shadow: var(--shadow);
  color: #fbfbfa;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-logo {
  width: clamp(180px, 20vw, 260px);
  max-width: 100%;
  height: auto;
  display: block;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 36px rgba(3, 10, 42, 0.24);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  color: #d7dcff;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.17em;
  margin-bottom: 6px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.3vw, 2.2rem);
  line-height: 1.05;
}

.topbar p {
  margin: 8px 0 0;
  color: #c8d1f2;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition: transform 0.14s ease, opacity 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  opacity: 0.94;
}

.primary,
.secondary {
  border-radius: 12px;
  padding: 0.78rem 0.92rem;
  font-weight: 700;
}

.primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 24px rgba(35, 36, 127, 0.18);
}

.secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(31, 43, 136, 0.18);
}

.hidden {
  display: none !important;
}

.login-card,
.panel,
.hero-card,
.upload-card,
.mini-card {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.login-card {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  padding: 26px;
  background:
    radial-gradient(circle at top left, rgba(35, 36, 127, 0.08), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(243, 246, 255, 0.98));
}

.login-copy h2 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 3vw, 2.6rem);
  line-height: 1.02;
}

.login-logo {
  display: block;
  width: min(280px, 100%);
  height: auto;
  margin-bottom: 14px;
}

.login-eyebrow {
  color: var(--accent);
  margin-bottom: 10px;
}

.login-copy p {
  margin: 0 0 16px;
  color: var(--muted);
  max-width: 42ch;
  font-size: 1rem;
  line-height: 1.55;
}

.login-feature-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.login-feature {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(236, 241, 255, 0.98));
}

.login-feature strong {
  color: var(--accent);
}

.login-feature span {
  color: var(--muted);
  line-height: 1.45;
}

.login-form {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 22px;
  border-radius: 20px;
  border: 1px solid rgba(31, 43, 136, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(247, 249, 255, 0.99));
  box-shadow: 0 18px 38px rgba(27, 39, 102, 0.08);
}

.login-form-copy {
  margin-bottom: 6px;
}

.login-form-copy h3 {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.login-form-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.login-form label,
.upload-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"],
input[type="file"],
select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 0.74rem 0.84rem;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(35, 36, 127, 0.55);
  box-shadow: 0 0 0 4px rgba(35, 36, 127, 0.12);
}

.feedback {
  min-height: 1.15rem;
  color: var(--muted);
}

.feedback.error {
  color: var(--danger);
}

.feedback.success {
  color: var(--ok);
}

.dashboard {
  display: grid;
  gap: 14px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
}

.hero-card {
  padding: 18px;
  background:
    radial-gradient(circle at top right, rgba(51, 68, 183, 0.12), transparent 34%),
    linear-gradient(135deg, #ffffff, #f1f4ff);
}

.card-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
}

.hero-card h2 {
  margin: 8px 0 4px;
  font-size: 1.75rem;
}

.hero-card p {
  margin: 0;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfcff, #f2f5ff);
  border: 1px solid var(--border);
}

.stat-card .value {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.82rem;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.ops-secondary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.panel {
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 255, 0.96));
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-header h3,
.panel-header h4 {
  margin: 0;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-header-actions input[type="date"] {
  width: auto;
  min-width: 145px;
  padding: 0.56rem 0.64rem;
  border-radius: 10px;
}

.panel-header-actions .secondary {
  padding: 0.56rem 0.72rem;
  border-radius: 10px;
}

.panel-header span {
  color: var(--muted);
  font-size: 0.88rem;
}

.route-toolbar {
  display: grid;
  grid-template-columns: 1.7fr 180px 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.upload-card {
  padding: 16px;
}

.upload-card h4 {
  margin: 0 0 8px;
}

.upload-card p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.45;
}

.upload-card input {
  margin-bottom: 10px;
}

.table-wrap {
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
  background: #fff;
}

.table th,
.table td {
  padding: 12px 10px;
  border-bottom: 1px solid #e2e2de;
  vertical-align: top;
}

.table th {
  text-align: left;
  color: #1c2766;
  font-size: 0.79rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, #eef2ff, #e5ebff);
  position: sticky;
  top: 0;
}

.table td {
  color: var(--text);
}

.table tbody tr:nth-child(odd) {
  background: #fbfcff;
}

.table tbody tr:hover {
  background: #f2f5ff;
}

.muted {
  color: var(--muted);
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.34rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pending {
  background: #edf1fb;
  color: #52607f;
}

.status-suggested {
  background: #e5ebff;
  color: #243387;
}

.status-assigned {
  background: #dce4ff;
  color: #1e2e82;
}

.status-confirmed {
  background: #23247f;
  color: #ffffff;
}

.status-cancelled {
  background: #f4e4e8;
  color: #7d2638;
}

.stack {
  display: grid;
  gap: 9px;
}

.stack.compact {
  gap: 7px;
}

.stack-scroll {
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.mini-card {
  padding: 12px;
}

.mini-card-title {
  font-weight: 700;
  margin-bottom: 5px;
}

.alert-card {
  border-left: 4px solid var(--accent);
}

.fleet-row,
.driver-row,
.report-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfcff, #f2f5ff);
  border: 1px solid var(--border);
}

.fleet-row strong,
.driver-row strong,
.report-row strong {
  display: block;
}

.fleet-row small,
.driver-row small,
.report-row small {
  color: var(--muted);
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.report-grid > div {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfcff, #f2f5ff);
}

.report-grid h4 {
  margin: 0 0 10px;
}

.route-controls {
  display: grid;
  gap: 6px;
  min-width: 240px;
}

.route-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.route-controls select {
  padding: 0.54rem 0.6rem;
  background: #ffffff;
}

.route-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.route-actions button {
  width: auto;
  border-radius: 10px;
  padding: 0.52rem 0.72rem;
  font-weight: 700;
}

.route-reasons {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

@media (max-width: 1220px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ops-secondary-grid,
  .hero-grid,
  .import-grid,
  .report-grid,
  .login-card,
  .route-toolbar {
    grid-template-columns: 1fr;
  }
  .route-selects {
    grid-template-columns: 1fr;
  }
  .topbar-brand {
    flex-direction: column;
    align-items: flex-start;
  }
  .brand-logo {
    width: min(240px, 100%);
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 16px, 1500px);
  }
  .topbar {
    padding: 16px;
    border-radius: 16px;
  }
  .panel,
  .hero-card,
  .upload-card,
  .login-card {
    border-radius: 16px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .table {
    min-width: 920px;
  }
}

@media print {
  body {
    background: #fff !important;
    color: #111;
    min-height: auto;
  }
  .print-hidden,
  .route-toolbar,
  #exportStatus,
  #routeFilterSummary,
  .route-selects,
  .route-actions,
  .route-reasons {
    display: none !important;
  }
  .app-shell {
    width: 100%;
    margin: 0;
    padding: 0;
  }
  .panel {
    border: 0;
    box-shadow: none;
    background: #fff;
    padding: 0;
  }
  .table-wrap {
    border: 1px solid #ccc;
    border-radius: 0;
    overflow: visible;
  }
  .table {
    min-width: 0;
    width: 100%;
  }
  .table th,
  .table td {
    padding: 6px 8px;
    border: 1px solid #ddd;
    font-size: 10pt;
  }
  .table th {
    position: static;
    background: #f2f2f2;
    color: #111;
  }
}
