:root {
  --teal: #0A5C5C;
  --teal-dark: #064848;
  --mint: #E4F4F4;
  --copper: #9A6B4A;
  --text: #1f2a2a;
  --muted: #6b7a7a;
  --line: #d7e0e0;
  --bg: #f4f7f7;
  --danger: #b42318;
  --ok: #1b6b3a;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--teal); text-decoration: none; }
.app { display: flex; min-height: 100vh; }
.side {
  width: 76px;
  background: var(--teal-dark);
  color: #fff;
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width .2s ease;
  z-index: 20;
}
.side:hover, .side:focus-within { width: 240px; }
.brand {
  font-weight: 800;
  letter-spacing: .04em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  color: #fff;
  white-space: nowrap;
}
.brand i, .side-link i { font-size: 1.25rem; width: 24px; text-align: center; flex: 0 0 24px; }
.side-link {
  color: #d7eeee;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  text-decoration: none;
}
.side-link.active, .side-link:hover { background: rgba(255,255,255,.12); color: #fff; }
.side-label { opacity: 0; transform: translateX(-6px); transition: opacity .15s ease, transform .15s ease; }
.side:hover .side-label, .side:focus-within .side-label { opacity: 1; transform: none; }
.side .logout { margin-top: auto; color: #ffd7d0; }
.main { flex: 1; min-width: 0; padding: 24px 28px 48px; }
.top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.top h1 { margin: 0 0 18px; font-size: 26px; color: var(--teal); }
.who { color: var(--muted); font-size: 14px; }
.card { background: #fff; border: 0; border-radius: 16px; padding: 20px; box-shadow: 0 8px 28px rgba(0,0,0,.06); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.btn, button, .btn-secondary {
  display: inline-block; background: var(--teal); color: #fff; border: 0; border-radius: 999px;
  padding: 10px 16px; font-weight: 700; cursor: pointer; font-size: 14px;
}
.btn-secondary { background: #fff; color: var(--teal); border: 1px solid var(--line); }
.btn-danger { background: var(--danger); color: #fff; }
.main .row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 18px; }
label { display: block; font-weight: 700; margin: 12px 0 6px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.date-row { display: flex; gap: 8px; align-items: center; }
.date-row input[type="text"] { flex: 1; }
.date-row input[type="date"] { width: auto; min-width: 140px; flex: 0 0 auto; }
.date-row .btn-secondary { width: auto; white-space: nowrap; }
.flash { padding: 12px 14px; border-radius: 10px; margin: 0 0 16px; }
.flash.ok { background: #e8f6ee; color: var(--ok); }
.flash.error { background: #fdecea; color: var(--danger); }
.switch { display: flex; align-items: center; gap: 8px; }
.switch input { width: auto; }
.preview { max-width: 320px; border-radius: 12px; border: 1px solid var(--line); }
.muted { color: var(--muted); font-size: 13px; }
.auth-body { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #064848, #0A5C5C 45%, #123); }
.auth-card { width: min(420px, 92vw); background: #fff; padding: 28px; border-radius: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-card h1 { margin: 0 0 16px; color: var(--teal); }
.auth-card button { width: 100%; margin-top: 16px; padding: 12px; }
.cf-turnstile { margin: 14px 0 2px; }
.eyebrow { letter-spacing: .14em; font-size: 11px; color: var(--copper); font-weight: 800; margin: 0 0 8px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.tabs a.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.creds { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.creds img { width: 100%; border-radius: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { display: inline; margin: 0; }
.actions .btn, .actions .btn-secondary, .actions .btn-danger, .actions button {
  padding: 8px 12px; font-size: 13px;
}
.cred-view { max-width: 520px; }
.cred-view img { width: 100%; border-radius: 16px; }
.table-card { overflow: auto; }
.drivers-table th { text-transform: uppercase; }
.drivers-table td { vertical-align: middle; }
.driver-cell { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.avatar-sm, .avatar-lg {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden; background: var(--mint); color: var(--teal);
  font-weight: 800; flex: 0 0 auto;
}
.avatar-sm { width: 42px; height: 42px; font-size: 13px; }
.avatar-lg { width: 128px; height: 128px; font-size: 36px; border: 4px solid rgba(255,255,255,.35); box-shadow: 0 10px 28px rgba(0,0,0,.18); }
.avatar-sm img, .avatar-lg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chip {
  display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px;
  background: #e8f0f0; color: var(--teal); font-size: 12px; font-weight: 700;
}
.chip-ok { background: #e8f6ee; color: var(--ok); }
.chip-off { background: #fdecea; color: var(--danger); }
.detail-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
.detail-hero {
  background: linear-gradient(165deg, #0A5C5C, #064848 70%);
  color: #fff; border-radius: 24px; padding: 28px 22px 32px; text-align: center;
  box-shadow: 0 16px 40px rgba(6,72,72,.28);
}
.detail-hero h2 { margin: 16px 0 6px; font-size: 22px; line-height: 1.25; color: #fff; }
.detail-hero p { margin: 0; color: #cfe8e8; font-size: 14px; word-break: break-all; }
.detail-hero .pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.detail-hero .chip { background: rgba(255,255,255,.14); color: #fff; }
.detail-hero .chip-ok { background: #d8f3e3; color: var(--ok); }
.detail-hero .chip-off { background: #ffd7d0; color: var(--danger); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-card { border-radius: 20px; padding: 22px; min-height: 180px; }
.detail-card h3 { margin: 0 0 12px; font-size: 16px; color: var(--teal); }
.kv {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.kv:last-of-type { border-bottom: 0; }
.kv span { color: var(--muted); font-weight: 600; }
.kv strong { text-align: right; font-weight: 700; }
.kv-wide { flex-direction: column; align-items: flex-start; }
.kv-wide strong { text-align: left; word-break: break-all; font-size: 13px; }
.detail-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.detail-actions .btn, .detail-actions .btn-secondary { text-align: center; }
.creds-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.creds-head .muted { margin: 4px 0 0; }
.creds .card { border-radius: 20px; }
.pass-card { max-width: 480px; margin-top: 20px; border-radius: 20px; }
.pass-card h3 { margin: 0 0 8px; color: var(--teal); }
.form-section { border-radius: 20px; margin-bottom: 16px; }
.form-section h3 { margin: 0 0 8px; color: var(--teal); font-size: 16px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0 24px; }
.file-preview { margin: 10px 0 0; }
.file-preview img { max-width: 140px; max-height: 140px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.detail-actions { margin-top: 0; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; align-items: end; margin-bottom: 16px; }
.filter-actions { display: flex; gap: 8px; align-items: center; padding-bottom: 2px; }
.bulk-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.bulk-bar select { width: auto; min-width: 220px; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 8px; }
.pager .chip.active { background: var(--teal); color: #fff; }
.stat-num { margin: 8px 0 0; font-size: 36px; font-weight: 800; color: var(--teal); }
.section-title { margin: 28px 0 12px; font-size: 20px; color: var(--teal); }
.dash-hero {
  background: linear-gradient(165deg, #0A5C5C, #064848 70%);
  color: #fff; border-radius: 24px; padding: 32px 28px;
  margin-bottom: 22px; box-shadow: 0 16px 40px rgba(6,72,72,.28);
}
.dash-hero h2 { color: #fff; margin: 0 0 8px; font-size: 28px; }
.dash-hero > p { color: #cfe8e8; margin: 0 0 18px; max-width: 46rem; }
.dash-hero .eyebrow { color: #e8c9a8; }
.dash-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-hero .btn { background: #fff; color: var(--teal); }
.dash-hero .btn-secondary { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.28); }
.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.dash-stat { display: flex; flex-direction: row; align-items: center; gap: 16px; color: inherit; transition: transform .15s ease; }
.dash-stat:hover { transform: translateY(-2px); color: inherit; }
.dash-stat i {
  font-size: 26px; color: var(--teal); background: var(--mint);
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center; flex: 0 0 56px;
}
.dash-stat .stat-num { margin: 0; line-height: 1; }
.dash-stat .muted { margin: 4px 0 0; }
.dash-cols { display: grid; grid-template-columns: 1.45fr 1fr; gap: 20px; align-items: start; }
.photo-field { display: flex; gap: 16px; align-items: center; margin-top: 8px; }
.photo-preview {
  width: 128px; height: 128px; border-radius: 50%; overflow: hidden;
  background: var(--mint); color: var(--teal); display: grid; place-items: center;
  font-weight: 800; font-size: 28px; flex: 0 0 128px; cursor: pointer;
  border: 4px solid #fff; box-shadow: 0 10px 28px rgba(0,0,0,.12);
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.field-msg { font-size: 12px; font-weight: 700; margin: 6px 0 0; }
.field-msg.err { color: var(--danger); }
.field-msg.ok { color: var(--ok); }
input.is-invalid { border-color: var(--danger); background: #fff6f5; }
.js-unique-banner { margin: 0 0 12px; }
@media (max-width: 800px) {
  .app { flex-direction: column; }
  .side { width: 100%; height: auto; position: relative; flex-direction: row; flex-wrap: wrap; }
  .side:hover, .side:focus-within { width: 100%; }
  .side-label { opacity: 1; transform: none; }
  .side .logout { margin-top: 0; }
  .grid2, .detail-layout, .detail-grid, .filters, .dash-stats, .dash-cols { grid-template-columns: 1fr; }
}
