/* ============================================================
   Swift Pace Logistics Driver Portal — design tokens
   Palette: near-black chrome, vivid gold signature accent + an
   electric-teal secondary "pop" for graphic moments (decorative
   only — kept separate from the semantic tier colors below).
   Data surfaces (metric tiles, tables) stay light/high-contrast
   on purpose: this gets read outdoors on a phone.
   Headings in Bricolage Grotesque, body/data in Inter.
   ============================================================ */

:root {
  --navy-900: #08080c;
  --navy-800: #131318;
  --navy-700: #201f28;
  --slate-600: #33465c;

  --accent-500: #ffb020;
  --accent-600: #e89900;
  --accent-100: #fff2d6;

  --accent-pop: #14e0c0;
  --accent-pop-600: #0eb99f;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e3e8ef;

  --text-900: #101826;
  --text-600: #4b5768;
  --text-400: #5b6b80;
  --text-on-dark: #f5f3ee;
  --text-on-dark-muted: #b7b6c2;

  --tier-fantastic: #0e6b3a;
  --tier-fantastic-bg: #e5f5ec;
  --tier-great: #1c7a46;
  --tier-great-bg: #ecf7f0;
  --tier-fair: #7a4e08;
  --tier-fair-bg: #fbf1dd;
  --tier-poor: #a52a2a;
  --tier-poor-bg: #fbe9e9;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 38, 0.06);
  --shadow-md: 0 8px 24px rgba(16, 24, 38, 0.08);
  --shadow-lg: 0 20px 48px rgba(8, 8, 12, 0.22);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-900);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 var(--space-2);
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 var(--space-3);
  color: var(--text-600);
}

a {
  color: var(--navy-700);
}

img {
  max-width: 100%;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

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

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  background: var(--navy-900);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 200;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 8px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--accent-500);
  color: var(--navy-900);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--accent-600);
}
.btn-dark {
  background: var(--navy-900);
  color: #fff;
}
.btn-dark:hover {
  background: var(--navy-800);
}
.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-900);
}
.btn-outline:hover {
  border-color: var(--navy-700);
}
.btn-danger {
  background: transparent;
  border-color: var(--tier-poor);
  color: var(--tier-poor);
}
.btn-danger:hover {
  background: var(--tier-poor-bg);
}
.btn-sm {
  min-height: 36px;
  padding: 0 var(--space-4);
  font-size: 14px;
}
.btn-block {
  width: 100%;
}
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- Forms ---------- */

.field {
  margin-bottom: var(--space-4);
}
.field label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: var(--space-2);
  color: var(--text-900);
}
.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field input[type="date"],
.field input[type="file"],
.field input[type="tel"],
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-900);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--navy-700);
}
.field .hint {
  font-size: 13px;
  color: var(--text-400);
  margin-top: var(--space-1);
}
.field-error {
  border-color: var(--tier-poor) !important;
}
.error-text {
  color: var(--tier-poor);
  font-size: 13px;
  font-weight: 600;
  margin-top: var(--space-1);
}

.alert {
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
}
.alert-success {
  background: var(--tier-fantastic-bg);
  color: var(--tier-fantastic);
  border-color: #bfe4cd;
}
.alert-error {
  background: var(--tier-poor-bg);
  color: var(--tier-poor);
  border-color: #f3c6c6;
}
.alert-info {
  background: var(--accent-100);
  color: #8a5c10;
  border-color: #f0dcb2;
}

/* ---------- Top navigation ---------- */

.topbar {
  background: var(--navy-900);
  color: var(--text-on-dark);
}
.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: var(--space-4);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: #fff;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-on-dark-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14.5px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
}
.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.nav-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 14px;
  color: var(--text-on-dark-muted);
}
.nav-user strong {
  color: #fff;
}

.bottom-nav {
  display: none;
}

@media (max-width: 767px) {
  .nav-links {
    display: none;
  }
  .nav-user-name {
    display: none;
  }
  .topbar .container {
    min-height: 56px;
  }
  main.has-bottom-nav {
    display: block;
    padding-bottom: 76px;
  }
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    background: var(--navy-900);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 60px;
    color: var(--text-on-dark-muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
  }
  .bottom-nav a.active {
    color: var(--accent-500);
  }
}

/* ---------- Login split screen ---------- */

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.login-visual {
  position: relative;
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-8);
  color: #fff;
}
.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 8, 12, 0.35) 0%, rgba(8, 8, 12, 0.58) 55%, rgba(8, 8, 12, 0.94) 100%);
}
.login-visual::after {
  content: "";
  position: absolute;
  top: -18%;
  right: -14%;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--accent-pop);
  opacity: 0.22;
  filter: blur(2px);
}
.login-visual > * {
  position: relative;
}
.login-visual .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-500);
  margin-bottom: var(--space-3);
}
.login-visual h1 {
  font-size: clamp(28px, 3.2vw, 42px);
  max-width: 20ch;
  color: #fff;
}
.login-visual p {
  color: var(--text-on-dark-muted);
  max-width: 44ch;
  font-size: 16px;
}
.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--surface);
}
.login-card {
  width: 100%;
  max-width: 380px;
}
.login-card .brand {
  color: var(--navy-900);
  margin-bottom: var(--space-6);
}
.login-card .brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 14px;
}
.login-card h2 {
  font-size: 24px;
  margin-bottom: var(--space-1);
}
.login-card .subtitle {
  margin-bottom: var(--space-5);
}

@media (max-width: 860px) {
  .login-shell {
    grid-template-columns: 1fr;
  }
  .login-visual {
    min-height: 240px;
    padding: var(--space-5);
  }
  .login-visual h1 {
    font-size: 24px;
  }
  .login-visual p {
    display: none;
  }
}

/* ---------- Page shell ---------- */

.page {
  padding: var(--space-6) 0 var(--space-8);
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
.page-header h1 {
  font-size: 26px;
  margin-bottom: var(--space-1);
}
.page-header .subtitle {
  margin: 0;
}

.welcome-banner {
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  background-size: cover;
  background-position: center 30%;
  min-height: 180px;
  display: flex;
  align-items: center;
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-md);
}
.welcome-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8, 8, 12, 0.94) 0%, rgba(8, 8, 12, 0.78) 45%, rgba(8, 8, 12, 0.28) 100%);
}
.welcome-banner::after {
  content: "";
  position: absolute;
  top: -40%;
  right: 6%;
  width: 220px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--accent-pop);
  opacity: 0.18;
  filter: blur(2px);
}
.welcome-banner-content {
  position: relative;
  color: #fff;
  padding: var(--space-6) var(--space-7);
}
.welcome-banner-content .eyebrow {
  color: var(--accent-500);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-1);
}
.welcome-banner-content h1 {
  color: #fff;
  font-size: clamp(22px, 2.6vw, 32px);
  margin-bottom: var(--space-2);
}
.welcome-banner-content p {
  color: var(--text-on-dark-muted);
  margin: 0;
  max-width: 52ch;
}

/* ---------- Cards & tiles ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.metric-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--tile-color, var(--border));
}
.metric-tile .metric-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}
.metric-tile .metric-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-900);
  margin-bottom: var(--space-2);
}
.metric-tile .metric-tier {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}
.tier-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.tier-fantastic { color: var(--tier-fantastic); background: var(--tier-fantastic-bg); }
.tier-great     { color: var(--tier-great); background: var(--tier-great-bg); }
.tier-fair      { color: var(--tier-fair); background: var(--tier-fair-bg); }
.tier-poor      { color: var(--tier-poor); background: var(--tier-poor-bg); }

/* ---------- Tips list ---------- */

.tips-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.tip-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  align-items: flex-start;
}
.tip-item.tip-good { background: var(--tier-fantastic-bg); border-color: #cdead9; }
.tip-item.tip-bad { background: var(--tier-poor-bg); border-color: #f3caca; }
.tip-icon {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
}
.tip-good .tip-icon { background: var(--tier-fantastic); }
.tip-bad .tip-icon { background: var(--tier-poor); }
.tip-text strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
  color: var(--text-900);
}
.tip-text span {
  font-size: 14px;
  color: var(--text-600);
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
th, td {
  text-align: left;
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  background: #f8f9fb;
  font-weight: 700;
  color: var(--text-600);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
tr:last-child td {
  border-bottom: none;
}

/* ---------- Admin layout ---------- */

.admin-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 68px);
}
.admin-sidebar {
  background: var(--navy-900);
  padding: var(--space-5) var(--space-3);
}
.admin-sidebar a {
  display: block;
  color: var(--text-on-dark-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14.5px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
}
.admin-sidebar a:hover,
.admin-sidebar a.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.admin-main {
  padding: var(--space-6) var(--space-6) var(--space-8);
}

@media (max-width: 860px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    display: flex;
    overflow-x: auto;
    gap: var(--space-1);
  }
  .admin-sidebar a {
    white-space: nowrap;
  }
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
}
.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-600);
  font-weight: 600;
}

.upload-hero {
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  background-size: cover;
  background-position: center;
  min-height: 140px;
  margin-bottom: var(--space-6);
}
.upload-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8, 8, 12, 0.92), rgba(8, 8, 12, 0.52));
}
.upload-hero::after {
  content: "";
  position: absolute;
  bottom: -50%;
  right: -4%;
  width: 180px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--accent-500);
  opacity: 0.16;
  filter: blur(2px);
}
.upload-hero-content {
  position: relative;
  color: #fff;
  padding: var(--space-5) var(--space-6);
}
.upload-hero-content h2 {
  color: #fff;
  font-size: 20px;
}
.upload-hero-content p {
  color: var(--text-on-dark-muted);
  margin: 0;
}

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-500);
  color: var(--navy-900);
  font-size: 12px;
  font-weight: 800;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
@media (max-width: 640px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

footer.site-footer {
  text-align: center;
  padding: var(--space-6) 0;
  color: var(--text-400);
  font-size: 13px;
}
