.admin-login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(47, 158, 68, 0.18), transparent),
    var(--bg);
}

.admin-login__card {
  width: 100%;
  max-width: 360px;
  padding: 28px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.admin-login__brand,
.admin-header__eyebrow,
.admin-view__eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.admin-login__card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
}

.admin-login__sub {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--text-dim);
}

.admin-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  min-height: 100dvh;
  padding: 18px 16px 40px;
}

.admin-header {
  margin-bottom: 20px;
}

.admin-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.admin-header__logout,
.admin-back,
.admin-menu-card,
.btn-edit,
.btn-delete,
.btn-cancel {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.admin-header__logout {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
}

.admin-header__logout:hover {
  color: var(--text);
  background: var(--bg-card-hover);
}

.admin-header h1 {
  margin: 0;
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 700;
}

.admin-header__sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}

.admin-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.admin-menu-card {
  min-height: 168px;
  padding: 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 14px;
  text-align: left;
  color: var(--text);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 60%),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.admin-menu-card:hover,
.admin-menu-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: var(--bg-card-hover);
  outline: none;
}

.admin-menu-card__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--gold-light);
  background: var(--gold-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.admin-menu-card__content {
  min-width: 0;
  align-self: center;
}

.admin-menu-card__content strong {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
  line-height: 1.15;
}

.admin-menu-card__content small {
  display: block;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.45;
}

.admin-menu-card__arrow {
  align-self: center;
  color: var(--gold);
  font-size: 28px;
  line-height: 1;
}

.admin-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-view[hidden],
.admin-home[hidden] {
  display: none;
}

.admin-view__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 2px;
}

.admin-view__bar h2 {
  margin: 0;
  font-size: 21px;
}

.admin-back {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  color: var(--gold);
  background: var(--gold-muted);
  font-size: 13px;
  font-weight: 600;
}

.admin-back:hover,
.admin-back:focus-visible {
  background: rgba(212, 175, 55, 0.2);
  outline: none;
}

.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.admin-card h3 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
}

.admin-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-card__head h3 {
  margin: 0;
}

.admin-card__hint {
  margin: -4px 0 14px;
  color: var(--text-dim);
  font-size: 13px;
}

.admin-count {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--gold-muted);
  color: var(--gold-light);
  font-size: 12px;
}

.dispatch-logo-current {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -4px 0 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.dispatch-logo-current[hidden] {
  display: none;
}

.dispatch-logo-current img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.driver-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: grid;
  gap: 10px;
}

.form-row--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-row--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.form-field span {
  font-size: 12px;
  color: var(--text-muted);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
}

.form-field textarea {
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-muted);
}

.form-field input:read-only {
  opacity: 0.7;
  cursor: not-allowed;
}

.form-fieldset {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.form-fieldset legend {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.form-check--boxed {
  align-self: end;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  box-sizing: border-box;
}

.form-check input,
.dispatch-visible-toggle input {
  accent-color: var(--gold);
}

.form-message {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.form-message--ok {
  background: rgba(61, 220, 132, 0.12);
  color: var(--green);
}

.form-message--err {
  background: rgba(255, 80, 80, 0.12);
  color: #ff6b6b;
}

.drivers-table-wrap {
  overflow-x: auto;
}

.drivers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.drivers-table th,
.drivers-table td {
  padding: 9px 7px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.drivers-table th {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.drivers-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.018);
}

.avail-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--text-dim);
  vertical-align: middle;
}

.avail-dot--on {
  background: var(--green);
  box-shadow: 0 0 6px var(--green-glow);
}

.drivers-table__actions {
  white-space: nowrap;
  text-align: right;
}

.badge-select {
  max-width: 150px;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 12px;
}

.badge-select:focus {
  outline: none;
  border-color: var(--gold);
}

.btn-edit,
.btn-delete,
.btn-cancel {
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 12px;
}

.btn-edit {
  color: var(--gold);
}

.btn-edit:hover {
  background: var(--gold-muted);
}

.btn-delete {
  color: #ff6b6b;
}

.btn-delete:hover {
  background: rgba(255, 80, 80, 0.12);
}

.btn-cancel {
  color: var(--text-muted);
}

.btn-cancel:hover {
  color: var(--text);
  background: var(--bg-card-hover);
}

.drivers-loading,
.drivers-error {
  margin: 0;
  padding: 26px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

.drivers-error {
  color: #ff6b6b;
}

.dispatch-visible-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 12px;
}

.dispatch-table td:nth-child(2) {
  min-width: 190px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .admin-home {
    grid-template-columns: 1fr;
  }

  .admin-menu-card {
    min-height: 108px;
  }
}

@media (max-width: 520px) {
  .admin-shell {
    padding-inline: 12px;
  }

  .admin-header__top {
    align-items: flex-start;
  }

  .admin-view__bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-row--2,
  .form-row--3 {
    grid-template-columns: 1fr;
  }

  .form-check--boxed {
    align-self: stretch;
  }

  .admin-card {
    padding: 14px;
  }
}


/* Five-card admin home + System Health / Legal merge */
.admin-home { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 900px) { .admin-home { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .admin-home { grid-template-columns: 1fr; } }

/* System Health + Legal (2026-08-02) */
.admin-shell {
  max-width: 1180px;
}

.admin-card__hint--inline {
  margin: 4px 0 0;
}

.admin-subheading {
  margin: 18px 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.health-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.health-summary > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.health-checked,
.health-label,
.health-tile small,
.legal-form__meta {
  font-size: 12px;
  color: var(--text-dim);
}

.health-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
}

.health-pill--ok { color: var(--green); background: rgba(61, 220, 132, 0.10); }
.health-pill--warning { color: #ffd166; background: rgba(255, 209, 102, 0.10); }
.health-pill--critical { color: #ff6b6b; background: rgba(255, 80, 80, 0.10); }
.health-pill--unknown { color: var(--text-dim); background: var(--bg-elevated); }

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

.health-grid--services {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.health-tile {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.health-tile__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.health-tile strong {
  display: block;
  font-size: 18px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.health-tile small {
  display: block;
  margin-top: 6px;
  line-height: 1.35;
}

.health-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--text-dim);
}

.health-dot--ok { background: var(--green); box-shadow: 0 0 8px var(--green-glow); }
.health-dot--warning { background: #ffd166; }
.health-dot--critical { background: #ff6b6b; box-shadow: 0 0 8px rgba(255, 80, 80, 0.35); }
.health-dot--unknown { background: var(--text-dim); }

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

.legal-form {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.legal-form__head,
.legal-form__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.legal-form__head {
  margin-bottom: 12px;
}

.legal-form__head h3 {
  margin: 0;
  font-size: 15px;
}

.legal-editor {
  min-height: 280px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.45;
}

.legal-form__meta {
  margin: 10px 0;
}

.legal-form__actions {
  margin-top: 12px;
}

.legal-form__actions .btn-cancel {
  text-decoration: none;
}

@media (max-width: 900px) {
  .health-grid,
  .health-grid--services {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .legal-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .admin-shell {
    max-width: 100%;
  }
  .health-grid,
  .health-grid--services {
    grid-template-columns: 1fr;
  }
  .health-summary,
  .legal-form__actions {
    align-items: flex-start;
    flex-direction: column;
  }
}

.health-alerts {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid var(--border);
}
.health-alerts--warning { color: #ffd166; background: rgba(255, 209, 102, 0.08); border-color: rgba(255, 209, 102, 0.30); }
.health-alerts--critical { color: #ff6b6b; background: rgba(255, 80, 80, 0.08); border-color: rgba(255, 80, 80, 0.30); }



/* Notifications / Recent Events (2026-08-02) */
.notification-count {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin-left: 6px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #c9a44c;
  color: #0a0a0a;
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}
.notification-count[hidden] { display: none; }
.notifications-status {
  margin: 8px 0 14px;
  color: var(--muted, #8f8f8f);
  font-size: 13px;
}
.notifications-list {
  display: grid;
  gap: 10px;
}
.notification-event {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(201, 164, 76, 0.28);
  border-radius: 14px;
  background: rgba(255,255,255,0.025);
}
.notification-event__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c9a44c;
  box-shadow: 0 0 0 4px rgba(201, 164, 76, 0.12);
}
.notification-event__title { font-weight: 700; }
.notification-event__meta { margin-top: 3px; color: var(--muted, #8f8f8f); font-size: 13px; }
.notification-event__time { color: var(--muted, #8f8f8f); font-size: 12px; white-space: nowrap; }
.admin-notification-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  max-width: min(380px, calc(100vw - 36px));
  padding: 14px 16px;
  border: 1px solid rgba(201, 164, 76, 0.6);
  border-radius: 14px;
  background: #111;
  color: #fff;
  box-shadow: 0 18px 50px rgba(0,0,0,.4);
  font-weight: 700;
}
@media (max-width: 1100px) { .admin-home { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .admin-home { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .admin-home { grid-template-columns: 1fr; }
  .notification-event { grid-template-columns: auto 1fr; }
  .notification-event__time { grid-column: 2; }
}
