:root {
  color-scheme: light;
  --surface: #faf9fe;
  --surface-low: #f4f3f8;
  --surface-mid: #eeedf3;
  --surface-high: #ffffff;
  --ink: #1a1b1f;
  --muted: #444748;
  --soft: #747878;
  --line: #d7d7dd;
  --primary: #000000;
  --gold: #e9c349;
  --gold-soft: #fed65b;
  --gold-ink: #241a00;
  --danger: #a82020;
  --success: #22653f;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.08);
  --focus: 0 0 0 3px rgba(233, 195, 73, 0.45);
  font-family: Manrope, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--surface);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(254, 214, 91, 0.14), rgba(250, 249, 254, 0) 280px),
    var(--surface);
}

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

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 44px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  margin-bottom: 28px;
  padding: 12px 14px 12px 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(215, 215, 221, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  text-decoration: none;
}

.brand img {
  width: auto;
  height: 46px;
  flex: 0 0 auto;
}

.brand-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-kicker,
.eyebrow,
.field-label,
.meta-label {
  margin: 0;
  color: var(--soft);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-transform: uppercase;
}

.brand-title {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.button {
  padding: 0 14px;
  color: #ffffff;
  background: var(--primary);
}

.button:hover {
  background: #2a2a2a;
}

.button:active,
.ghost-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.ghost-button {
  padding: 0 13px;
  color: var(--ink);
  background: var(--surface-low);
  border: 1px solid var(--line);
}

.ghost-button:hover {
  background: var(--surface-mid);
}

.icon-button {
  width: 40px;
  color: var(--ink);
  background: var(--surface-low);
  border: 1px solid var(--line);
}

.icon-button:hover {
  background: var(--surface-mid);
}

:is(a, button, input, select, textarea):focus-visible {
  outline: 0;
  box-shadow: var(--focus);
}

.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.page-head h1 {
  max-width: 720px;
  margin: 6px 0 10px;
  color: var(--ink);
  font-size: 2.25rem;
  font-weight: 850;
  letter-spacing: -0.02em;
  line-height: 1.08;
  text-wrap: balance;
}

.lede {
  max-width: 65ch;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
  text-wrap: pretty;
}

.status-strip {
  display: grid;
  gap: 6px;
  min-width: 180px;
  padding: 14px 16px;
  background: var(--primary);
  border-radius: var(--radius-md);
  color: #ffffff;
}

.status-strip strong {
  font-size: 1.65rem;
  line-height: 1;
}

.status-strip span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.82rem;
  font-weight: 700;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 260px) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--surface-high);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.field {
  display: grid;
  gap: 7px;
}

.field input,
.field select,
.file-input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.field input::placeholder {
  color: #5f6364;
  opacity: 1;
}

.updated {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 44px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.driver-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(282px, 1fr));
  gap: 14px;
}

.driver-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 16px;
  min-height: 148px;
  padding: 16px;
  background: var(--surface-high);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.driver-photo,
.photo-placeholder {
  width: 88px;
  height: 112px;
  border-radius: var(--radius-md);
}

.driver-photo {
  object-fit: cover;
  background: var(--surface-mid);
}

.photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-ink);
  background: linear-gradient(145deg, var(--gold-soft), var(--gold));
  font-size: 1.45rem;
  font-weight: 850;
}

.driver-body {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.driver-name {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 850;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.vehicle-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  color: var(--gold-ink);
  background: rgba(254, 214, 91, 0.6);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 850;
}

.driver-phone {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 750;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.driver-phone:hover {
  color: var(--ink);
  text-decoration: underline;
}

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

.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 850;
  text-decoration: none;
}

.small-button:hover {
  background: var(--surface-mid);
}

.empty-state,
.error-state,
.panel {
  padding: 22px;
  background: var(--surface-high);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.empty-state h2,
.error-state h2,
.panel h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1.25;
}

.empty-state p,
.error-state p,
.panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.error-state {
  border-color: rgba(168, 32, 32, 0.35);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.4fr);
  gap: 16px;
  align-items: start;
}

.panel {
  display: grid;
  gap: 16px;
}

.panel-header {
  display: grid;
  gap: 4px;
}

.form-stack {
  display: grid;
  gap: 12px;
}

.notice {
  display: none;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1.45;
}

.notice.is-visible {
  display: block;
}

.notice.success {
  color: #123c27;
  background: rgba(34, 101, 63, 0.13);
}

.notice.error {
  color: #5d1111;
  background: rgba(168, 32, 32, 0.12);
}

.notice.info {
  color: #332600;
  background: rgba(254, 214, 91, 0.32);
}

.schema-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.schema-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.schema-list code {
  color: var(--ink);
  font-weight: 850;
}

.schema-list span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.current-list {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  background: #ffffff;
}

.data-table th,
.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--soft);
  background: var(--surface-low);
  font-size: 0.73rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.table-driver {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.table-thumb,
.table-initials {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  flex: 0 0 auto;
}

.table-thumb {
  object-fit: cover;
  background: var(--surface-mid);
}

.table-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-ink);
  background: var(--gold-soft);
  font-weight: 850;
}

.hidden {
  display: none !important;
}

.skeleton {
  position: relative;
  overflow: hidden;
  min-height: 148px;
  background: var(--surface-high);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.skeleton::after {
  position: absolute;
  inset: 0;
  content: "";
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(233, 195, 73, 0.18), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 820px) {
  .topbar,
  .page-head,
  .toolbar,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
    align-items: stretch;
  }

  .nav-actions,
  .updated {
    justify-content: flex-start;
  }

  .page-head h1 {
    font-size: 1.85rem;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .brand-text {
    display: none;
  }

  .topbar {
    gap: 12px;
    padding: 10px;
  }

  .nav-actions {
    gap: 6px;
  }

  .button,
  .ghost-button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 0.86rem;
  }

  .page-head h1 {
    font-size: 1.58rem;
  }

  .driver-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .driver-photo,
  .photo-placeholder {
    width: 72px;
    height: 92px;
  }

  .toolbar,
  .panel,
  .empty-state,
  .error-state {
    padding: 12px;
  }
}
