/**
 * TuMicha Driver portal — matches driver-app theme (soft white + charcoal + teal accents).
 * Loaded after shared styles so these tokens win for the driver surface.
 */

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Syne:wght@600;700;800&display=swap");

:root {
  --bg: #f3f3f4;
  --panel: #ffffff;
  --surface: #ffffff;
  --mist: #fafafa;
  --cream-soft: #ececee;
  --text: #121212;
  --ink: #121212;
  --muted: #6a6a6e;
  --border: rgba(18, 18, 18, 0.08);
  --soft-press: rgba(18, 18, 18, 0.06);
  --accent: #2f7a73;
  --accent-dark: #24635d;
  --accent-soft: rgba(47, 122, 115, 0.12);
  --auth-bg: #f3f3f4;
  --tab-bar: #ffffff;
  --logo-bg: #ffffff;
  --danger: #b44a3f;
  --danger-bg: #fee4e2;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --info: #1d4ed8;
  --info-bg: #dbeafe;
  --shadow: 0 1px 3px rgba(18, 18, 18, 0.08);
  --shadow-auth: 0 4px 12px rgba(18, 18, 18, 0.08);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-display: "Syne", "DM Sans", sans-serif;
  --rail-width: 248px;
  --tab-height: 58px;

  /* Compatibility aliases used by shared CSS.
     Map former “gold” primary tokens to charcoal ink so shared brand.css
     buttons match the driver-app (teal is accents only, not CTAs). */
  --primary: var(--ink);
  --primary-dark: var(--ink);
  --tumicha-gold: var(--ink);
  --tumicha-gold-light: #2a2a2a;
  --tumicha-gold-dark: #0d0d0d;
  --tumicha-cream: var(--panel);
  --tumicha-cream-muted: var(--muted);
  --tumicha-brown: var(--ink);
  --tumicha-brown-deep: var(--bg);
  --tumicha-brown-mid: var(--mist);
  --tumicha-brown-warm: var(--cream-soft);
  --tumicha-surface-auth: var(--panel);
  --tumicha-surface-dark: var(--bg);
  --tumicha-border-warm: var(--border);
  --tumicha-text-light: var(--text);
  --tumicha-text-muted-light: var(--muted);
  --tumicha-ink: var(--ink);
  --tumicha-muted: var(--muted);
  --tumicha-border: var(--border);
  --tumicha-shadow: var(--shadow);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg) !important;
  -webkit-font-smoothing: antialiased;
}

body.driver-portal-shell {
  background: var(--bg) !important;
  color: var(--text) !important;
}

.hidden {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* ── Auth (matches AuthScreen) ── */

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-lg);
  background: var(--auth-bg) !important;
}

.auth-screen::before {
  display: none !important;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-xl) !important;
  padding: var(--space-xl) !important;
  box-shadow: var(--shadow-auth) !important;
  color: var(--text) !important;
}

.auth-card::before {
  display: none !important;
}

/* Exact landing .site-header banner colors */
.brand-banner {
  --landing-paper: #f5f5f6;
  --landing-banner-bg: rgba(12, 12, 14, 0.88);
  --landing-banner-line: rgba(245, 245, 246, 0.16);
  background: var(--landing-banner-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--landing-banner-line);
  color: var(--landing-paper);
}

.auth-brand-block.brand-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  margin: calc(-1 * var(--space-xl)) calc(-1 * var(--space-xl)) var(--space-lg);
  padding: 18px 24px 16px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.auth-brand-block .logo {
  justify-content: center;
  color: var(--landing-paper);
}

.auth-brand-block .brand-wordmark {
  color: var(--landing-paper);
}

.auth-brand-block p {
  margin: 0;
  font-size: 15px;
  line-height: 22px;
  color: rgba(245, 245, 246, 0.62) !important;
  max-width: 280px;
}

/* Exact landing header .logo treatment */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: #f5f5f6;
  flex-shrink: 0;
}

.logo img,
.brand-logo,
.brand-logo-lg {
  width: 40px;
  height: 40px;
  border-radius: 10px !important;
  object-fit: contain;
  background: rgba(245, 245, 246, 0.08) !important;
  padding: 4px !important;
  border: 0 !important;
  box-shadow: none !important;
  flex-shrink: 0;
}

.brand-wordmark {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #f5f5f6;
}

.brand-wordmark .brand-name,
.brand-wordmark .brand-go {
  font-weight: 700;
  color: inherit;
}

.brand-wordmark .brand-go {
  margin-left: 0.28em;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: var(--space-md);
}

.tab-btn {
  min-height: 40px;
  background: var(--surface) !important;
  color: var(--muted) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

.tab-btn.active {
  background: var(--mist) !important;
  border-color: var(--ink) !important;
  color: var(--ink) !important;
}

.auth-form label,
.auth-card label {
  display: grid;
  gap: 8px;
  margin-bottom: var(--space-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--text) !important;
}

.auth-form input,
.auth-card input,
.auth-card textarea {
  min-height: 48px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text);
  color-scheme: light;
}

.auth-form input::placeholder,
.auth-card input::placeholder {
  color: var(--muted) !important;
  -webkit-text-fill-color: var(--muted);
}

.auth-form .primary-btn {
  width: 100%;
  margin-top: 4px;
}

.auth-helper {
  margin: 0 0 12px;
  color: var(--muted) !important;
  font-size: 14px;
  line-height: 20px;
  text-align: left;
}

/* Matches driver-app login link (ink, left-aligned — not teal/centered) */
.auth-link {
  background: none;
  border: 0;
  color: var(--ink) !important;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  text-align: left;
}

.auth-link:hover {
  color: var(--ink) !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.driver-portal-shell .auth-link,
body.driver-portal-shell .auth-link:hover {
  color: var(--ink) !important;
}

.auth-helper:has(> .auth-link:only-child) {
  margin: 0;
}

.error-text,
.auth-card .error-text {
  color: var(--danger) !important;
  margin-top: 12px;
  font-size: 14px;
}

.success-text,
.auth-card .success-text {
  color: var(--success) !important;
}

/* ── Buttons (matches Button.tsx) ── */

.primary-btn,
.secondary-btn,
.danger-btn,
.action-btn,
.logout-btn {
  min-height: 50px;
  border-radius: var(--radius-sm) !important;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.2px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary-btn {
  background: var(--ink) !important;
  color: #ffffff !important;
  border-color: var(--ink) !important;
  box-shadow: none !important;
}

.primary-btn:hover:not(:disabled),
.primary-btn:active:not(:disabled) {
  background: var(--ink) !important;
  border-color: var(--ink) !important;
  color: #ffffff !important;
  opacity: 0.88;
  transform: none;
  box-shadow: none !important;
}

.primary-btn:disabled,
.secondary-btn:disabled,
.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-btn,
.refresh-btn {
  background: var(--mist) !important;
  color: var(--ink) !important;
  border-color: var(--border) !important;
}

.secondary-btn:hover:not(:disabled) {
  background: var(--soft-press) !important;
}

.danger-btn,
.action-btn.danger {
  background: var(--danger-bg) !important;
  color: var(--danger) !important;
  border-color: var(--danger-bg) !important;
}

.action-btn {
  min-height: 42px;
  font-size: 14px;
  background: var(--mist) !important;
  color: var(--ink) !important;
  border-color: var(--border) !important;
}

/* ── App shell ── */

.app {
  --header-h: 72px;
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  grid-template-rows: var(--header-h) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  background: var(--bg);
  overflow-x: clip;
}

.driver-portal-banner {
  --header-h: 72px;
  --landing-paper: #f5f5f6;
  --landing-banner-bg: rgba(12, 12, 14, 0.88);
  --landing-banner-line: rgba(245, 245, 246, 0.16);
  grid-column: 1 / -1;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 70;
  height: var(--header-h);
  width: 100%;
  margin: 0;
  color: var(--landing-paper);
  background: var(--landing-banner-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--landing-banner-line);
  box-sizing: border-box;
}

.driver-portal-banner.hidden {
  display: none !important;
}

.driver-portal-banner-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0.85rem 1.1rem;
  padding: 0 1rem 0 0.85rem;
  box-sizing: border-box;
  flex-wrap: nowrap;
  min-width: 0;
}

.driver-portal-banner .logo {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--landing-paper);
  flex: 1 1 auto;
  min-width: 0;
}

.driver-portal-banner .logo img {
  width: 40px;
  height: 40px;
  border-radius: 10px !important;
  object-fit: contain;
  background: rgba(245, 245, 246, 0.08) !important;
  padding: 4px !important;
  border: 0 !important;
  box-shadow: none !important;
  flex-shrink: 0;
}

.driver-portal-banner-wordmark {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.08rem;
  min-width: 0;
  font-family: var(--font-display, inherit);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
  overflow: hidden;
}

.driver-portal-banner-brand {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.driver-portal-banner .logo-go {
  font-style: normal;
  font-weight: 600;
  opacity: 0.72;
  letter-spacing: -0.02em;
}

.driver-portal-banner-portal {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.15;
  opacity: 0.78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sidebar {
  --sidebar-pad-x: var(--space-md);
  background: var(--panel) !important;
  color: var(--text) !important;
  padding: var(--space-lg) var(--space-md) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  border-right: 1px solid var(--border);
  /* Pin rail so brand + Sign out stay visible while content scrolls */
  position: fixed;
  top: var(--header-h, 72px);
  left: 0;
  width: var(--rail-width);
  height: calc(100vh - var(--header-h, 72px));
  height: calc(100dvh - var(--header-h, 72px));
  max-height: calc(100dvh - var(--header-h, 72px));
  overflow: hidden;
  box-sizing: border-box;
  z-index: 20;
  grid-row: 2;
}

.sidebar::before {
  display: none !important;
}

.sidebar-brand.brand-banner {
  display: block;
  margin: calc(-1 * var(--space-lg)) calc(-1 * var(--sidebar-pad-x)) var(--space-sm);
  padding: 0;
  flex-shrink: 0;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 72px;
  margin: 0;
  padding: 0 16px;
  border-bottom: none;
  box-sizing: border-box;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-copy .brand-wordmark {
  color: #f5f5f6 !important;
  font-size: 1.15rem;
  font-weight: 700;
}

.brand-copy .brand-tagline,
.brand-copy small {
  color: rgba(245, 245, 246, 0.62) !important;
  margin-top: 4px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  opacity: 1;
}

.nav,
.nav-primary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav::-webkit-scrollbar,
.nav-primary::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  background: transparent !important;
  color: var(--muted) !important;
  border: 0 !important;
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
  color: inherit;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-btn:hover {
  background: var(--soft-press) !important;
  color: var(--ink) !important;
}

.nav-btn.active {
  background: var(--mist) !important;
  color: var(--ink) !important;
}

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  margin-top: 0;
  width: 100%;
  flex-shrink: 0;
  background: var(--mist) !important;
  color: var(--ink) !important;
  border: 1px solid var(--border) !important;
}

.driver-sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(18, 18, 18, 0.06);
}

.sidebar .account-strip,
#driver-account-strip.account-strip {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  color: var(--text) !important;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(248, 248, 249, 0.88)) !important;
  border: 1px solid rgba(18, 18, 18, 0.08) !important;
  border-radius: 16px !important;
  flex-shrink: 0;
  margin: 4px 2px 2px !important;
  padding: 12px !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 8px 20px rgba(18, 18, 18, 0.05);
  backdrop-filter: blur(10px);
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.sidebar .account-strip-logo-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(145deg, #1c1c1e 0%, #3a3a3c 100%);
  box-shadow: 0 4px 12px rgba(18, 18, 18, 0.14);
}

.sidebar .account-strip-logo,
.sidebar .account-strip-logo-fallback {
  display: block;
  width: 100%;
  height: 100%;
}

.sidebar .account-strip-logo {
  object-fit: contain;
  background: rgba(245, 245, 246, 0.08);
  padding: 6px;
  box-sizing: border-box;
}

.sidebar .account-strip-logo-fallback {
  display: none;
  place-items: center;
  color: #f5f5f6;
  font-size: 1.05rem;
  font-weight: 700;
}

.sidebar .account-strip-logo-wrap:not(:has(.account-strip-logo)) .account-strip-logo-fallback,
.sidebar .account-strip-logo.hidden + .account-strip-logo-fallback {
  display: grid;
}

.sidebar .account-strip-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  gap: 0.12rem;
  min-width: 0;
  min-height: 48px;
}

.sidebar .account-strip-name {
  display: block;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar .account-strip-detail {
  display: block;
  margin: 0;
  color: var(--muted) !important;
  font-size: 0.78rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar .account-strip-detail.hidden,
.sidebar .account-strip-detail[hidden] {
  display: none !important;
}

.sidebar .account-kind-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin-top: 0.15rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.06);
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-logout-btn {
  margin-top: 0;
}

.main {
  grid-column: 2;
  grid-row: 2;
  padding: var(--space-lg);
  min-width: 0;
  background: var(--bg) !important;
}

.main .status-card,
.main .card-list,
.main .trip-panel {
  width: 100%;
  max-width: 720px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  line-height: 1.2;
}

.topbar p {
  margin: 0;
  font-size: 15px;
  line-height: 22px;
  color: var(--muted);
}

/* ── Cards / lists (matches Card.tsx) ── */

.card-list {
  display: grid;
  gap: var(--space-md);
}

.status-card,
.job-card,
.trip-panel,
.empty-state,
.account-card,
.verification-form,
.table-wrap,
.verification-banner,
.verification-gaps,
.verification-ready {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.status-card,
.job-card,
.trip-panel,
.account-card,
.verification-form {
  padding: var(--space-md);
}

.trip-panel .driver-trip-chat {
  margin-top: 14px;
  min-height: 220px;
}

.trip-chat {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  overflow: hidden;
}

.trip-chat-header {
  padding: 10px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.trip-chat-messages {
  flex: 1;
  min-height: 100px;
  max-height: 220px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}

.trip-chat-bubble {
  max-width: 88%;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.35;
}

.trip-chat-bubble--customer {
  align-self: flex-start;
  background: var(--mist, #f5f5f6);
  color: var(--text, #121212);
}

.trip-chat-bubble--driver {
  align-self: flex-end;
  background: var(--ink, #121212);
  color: #fff;
}

.trip-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
}

.status-card .account-strip {
  margin: 0 0 14px;
  padding: 0;
  background: none;
  border: none;
}

.status-card .account-strip strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.status-card .account-strip small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

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

.status-row span {
  font-weight: 600;
  font-size: 15px;
}

.status-card .primary-btn,
.status-card .secondary-btn {
  width: 100%;
}

.muted-text {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--muted);
}

.job-card h3,
.trip-panel h3,
.account-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.required-profile-list {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.required-profile-item {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
}

.required-plate-form,
.required-doc-uploads {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.required-doc-row {
  display: grid;
  gap: 6px;
}

.required-profile-hint {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--muted);
}

.required-profile-hint.is-blocked {
  color: #8a1f1f;
}

.job-meta,
.trip-meta {
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  margin: 0 0 10px;
}

.job-meta.job-earn,
.trip-job-meta.trip-earn {
  color: var(--text);
  font-weight: 600;
}

.job-route {
  margin: 0 0 12px;
  line-height: 1.5;
  color: var(--text);
  font-size: 15px;
}

.job-actions,
.trip-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.empty-state {
  padding: 28px 20px;
  color: var(--muted);
  text-align: center;
  border-style: solid;
  font-size: 15px;
  line-height: 22px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--mist);
}

/* ── Badges (matches StatusBadge) ── */

.badge,
.status-badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-online,
.status-badge-online {
  background: var(--success-bg);
  color: var(--success);
}

.badge-offline,
.status-badge-offline {
  background: var(--cream-soft);
  color: var(--muted);
}

.badge-created { background: var(--cream-soft); color: #555555; }
.badge-assigned { background: var(--accent-soft); color: var(--accent-dark); }
.badge-picked_up { background: var(--info-bg); color: var(--info); }
.badge-in_transit { background: var(--accent-soft); color: var(--accent-dark); }
.badge-arrived { background: var(--info-bg); color: var(--info); }
.badge-delivered { background: var(--success-bg); color: var(--success); }
.badge-cancelled,
.badge-failed { background: var(--danger-bg); color: #b42318; }
.badge-ready {
  display: inline-flex;
  margin: 8px 0 4px;
  background: var(--success-bg);
  color: var(--success);
}

.trip-job-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.trip-job-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.trip-job-title {
  font-size: 1.02rem;
  color: var(--text);
}

.trip-job-meta,
.trip-quiet-hint,
.trip-chat-empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.collection-status {
  display: grid;
  gap: 0.2rem;
  margin: 0.35rem 0 0.15rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid transparent;
}

.collection-status strong {
  font-size: 0.92rem;
  line-height: 1.25;
}

.collection-status span {
  font-size: 0.84rem;
  line-height: 1.35;
}

.collection-status--wait {
  background: #fef3c7;
  border-color: rgba(180, 83, 9, 0.28);
  color: #92400e;
}

.collection-status--ready {
  background: #dcfce7;
  border-color: rgba(21, 128, 61, 0.28);
  color: #166534;
}

.job-card .collection-status {
  margin-top: 0.5rem;
}

.trip-destination-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 12px;
  background: var(--mist);
  border: 1px solid var(--border);
}

.trip-destination-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.trip-destination-address {
  font-size: 0.98rem;
  color: var(--text);
  line-height: 1.35;
}

.trip-section-label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.trip-actions {
  display: grid;
  gap: 10px;
}

.text-link-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  text-align: left;
}

.text-link-btn:hover {
  color: var(--text);
}

.trip-panel--live .driver-trip-chat {
  margin-top: 0;
  min-height: 180px;
}

.trip-empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.history-card {
  padding: var(--space-md);
  border-radius: var(--radius-lg, 16px);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.history-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.history-route {
  margin: 0 0 12px;
}

.history-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.history-date {
  font-size: 0.88rem;
  color: var(--muted);
}

body.driver-trip-active .main {
  padding-bottom: 12px;
}

/* ── Account / settings cards ── */

.account-layout {
  display: grid;
  gap: var(--space-md);
  max-width: 720px;
  margin-inline: auto;
}

.account-card .settings-intro,
.verification-form .settings-intro {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.account-card > p {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 22px;
  color: var(--text);
}

.account-card > p.settings-intro,
.account-card > p.muted-text {
  color: var(--muted);
}

.account-layout > .secondary-btn {
  width: 100%;
}

.account-card label,
.verification-form label {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.account-card input,
.account-card select,
.account-card textarea,
.verification-form input:not([type="checkbox"]):not([type="file"]),
.panel-form input:not([type="checkbox"]):not([type="file"]),
.panel-form textarea {
  min-height: 48px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.account-card textarea,
.panel-form textarea {
  min-height: 110px;
  resize: vertical;
}

.account-card .primary-btn,
.account-card .secondary-btn,
.verification-form .primary-btn {
  width: 100%;
  margin-top: 4px;
}

.form-status {
  margin: -4px 0 12px;
  font-size: 13px;
  line-height: 18px;
}

.form-status.success {
  color: var(--success);
}

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

.admin-access-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--mist);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.92rem;
}

/* ── Verification ── */

.verification-banner {
  margin: 0 auto 16px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border-color: rgba(47, 122, 115, 0.22);
  color: var(--text);
  line-height: 1.45;
  max-width: 720px;
  box-shadow: none;
}

.verification-checklist {
  margin: 0 auto 16px;
  max-width: 720px;
}

.verification-gaps,
.verification-ready {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  line-height: 1.45;
  box-shadow: none;
}

.verification-gaps {
  color: var(--warning);
  background: var(--warning-bg);
  border-color: rgba(180, 83, 9, 0.18);
}

.verification-ready {
  color: var(--success);
  background: var(--success-bg);
  border-color: rgba(21, 128, 61, 0.18);
}

.verification-form {
  max-width: 720px;
  margin-inline: auto;
  display: grid;
  gap: 12px;
}

.verification-form h3 {
  margin: 8px 0 0;
  font-size: 17px;
  font-weight: 700;
}

.verification-form .doc-status {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.9rem;
}

.verification-form .doc-status.uploaded {
  color: var(--success);
}

.consent-check {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500 !important;
  margin-top: 8px;
}

.consent-check input {
  margin-top: 3px;
}

.address-block {
  margin-bottom: 8px;
}

.address-map-host {
  min-height: 280px;
  border-radius: 14px;
  overflow: visible;
  border: 0;
  margin-bottom: 10px;
  background: transparent;
}

.address-map-host .address-map-picker {
  margin: 0;
}

.address-map-host .address-map-picker-canvas-wrap {
  border-color: var(--border);
  background: var(--mist);
}

.address-map-host .address-map-search {
  color: var(--text);
}

body.driver-portal-shell .address-map-selected input[readonly],
.verification-form .address-map-selected input[readonly] {
  background: var(--mist) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

/* Don't restyle the Google Maps search field as a portal form input */
.verification-form .address-map-search {
  min-height: auto !important;
  width: calc(100% - 24px) !important;
  margin: 0 !important;
  border: 0 !important;
  background: #fff !important;
  color: #121212 !important;
  box-shadow: 0 2px 8px rgba(18, 18, 18, 0.14) !important;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  z-index: 40;
  box-shadow: 0 8px 24px rgba(18, 18, 18, 0.18);
  max-width: min(360px, calc(100vw - 32px));
}

/* ── Brand / shared overrides for this portal only ── */

body.driver-portal-shell .auth-screen,
body.driver-portal-shell .auth-screen::before {
  background: var(--auth-bg) !important;
}

body.driver-portal-shell .sidebar {
  background: var(--panel) !important;
  color: var(--text) !important;
}

body.driver-portal-shell .sidebar .account-strip,
body.driver-portal-shell .sidebar .account-strip small,
body.driver-portal-shell .sidebar .account-strip .account-strip-detail {
  color: inherit;
}

body.driver-portal-shell .main,
body.driver-portal-shell .app {
  background: var(--bg) !important;
}

body.driver-portal-shell .primary-btn,
body.driver-portal-shell .primary-btn:hover:not(:disabled),
body.driver-portal-shell .primary-btn:active:not(:disabled) {
  background: var(--ink) !important;
  border-color: var(--ink) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

body.driver-portal-shell .tab-btn.active {
  background: var(--mist) !important;
  color: var(--ink) !important;
  border-color: var(--ink) !important;
}

body.driver-portal-shell .account-card,
body.driver-portal-shell .settings-card,
body.driver-portal-shell .job-card,
body.driver-portal-shell .trip-panel,
body.driver-portal-shell .table-wrap,
body.driver-portal-shell .status-card {
  background: var(--panel) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow) !important;
  color: var(--text);
}

body.driver-portal-shell .twofa-enabled-badge {
  background: var(--success-bg);
  color: var(--success);
}

/* ── Drawer nav (parity with admin / business portals) ── */

body.driver-portal-shell.driver-drawer-nav .app,
body.driver-portal-shell .app.driver-drawer-nav {
  --rail-width: 0px;
  --header-h: 72px;
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  grid-template-rows: none;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  /* Avoid overflow-x:clip creating a scrollport that can yank sticky ribbons off-screen. */
  overflow-x: visible;
  overflow-y: visible;
  padding-top: var(--header-h);
  padding-bottom: 0;
  box-sizing: border-box;
}

body.driver-portal-shell.driver-drawer-nav .driver-portal-banner,
body.driver-portal-shell .app.driver-drawer-nav .driver-portal-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  order: -1;
  flex: 0 0 auto;
  grid-column: auto;
  grid-row: auto;
  z-index: 70;
  width: 100%;
}

body.driver-portal-shell.driver-drawer-nav .main,
body.driver-portal-shell .app.driver-drawer-nav .main {
  width: 100%;
  max-width: 100%;
  grid-column: auto;
  grid-row: auto;
  flex: 1 1 auto;
  min-width: 0;
  order: 1;
  padding: 20px 16px 28px;
}

html.driver-nav-drawer-lock,
html.driver-nav-drawer-lock body {
  overflow: hidden;
}

body.driver-portal-shell.driver-drawer-nav .driver-nav-drawer-toggle,
body.driver-portal-shell .app.driver-drawer-nav .driver-nav-drawer-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(245, 245, 246, 0.2);
  border-radius: 12px;
  background: rgba(245, 245, 246, 0.08);
  color: #f5f5f6;
  box-shadow: none;
  cursor: pointer;
}

.driver-nav-drawer-toggle {
  display: none;
}

.driver-nav-drawer-toggle-icon {
  display: grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
}

.driver-nav-drawer-toggle-icon svg {
  width: 100%;
  height: 100%;
}

body.driver-portal-shell.driver-drawer-nav .driver-nav-drawer-backdrop,
body.driver-portal-shell .app.driver-drawer-nav .driver-nav-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  border: 0;
  background: rgba(42, 41, 39, 0.34);
  cursor: pointer;
  margin: 0;
  padding: 0;
}

body.driver-portal-shell.driver-drawer-nav.driver-nav-drawer-open .driver-nav-drawer-backdrop,
body.driver-portal-shell.driver-nav-drawer-open .driver-nav-drawer-backdrop,
body.driver-portal-shell .app.driver-nav-drawer-open .driver-nav-drawer-backdrop {
  display: block;
}

body.driver-portal-shell.driver-drawer-nav #driver-sidebar,
body.driver-portal-shell .app.driver-drawer-nav #driver-sidebar {
  --sidebar-pad-x: 14px;
  display: flex !important;
  flex-direction: column;
  position: fixed !important;
  top: var(--header-h, 72px);
  left: 0;
  bottom: 0;
  right: auto;
  z-index: 60;
  width: min(20rem, 86vw) !important;
  max-width: min(20rem, 86vw);
  height: calc(100vh - var(--header-h, 72px)) !important;
  height: calc(100dvh - var(--header-h, 72px)) !important;
  max-height: calc(100dvh - var(--header-h, 72px)) !important;
  align-self: auto;
  overflow-x: hidden;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  gap: 6px;
  padding: 16px var(--sidebar-pad-x) calc(16px + env(safe-area-inset-bottom, 0px));
  border-right: 1px solid rgba(18, 18, 18, 0.08) !important;
  border-top: none !important;
  border-bottom: none !important;
  border-top-right-radius: 20px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fafafa 48%, #f7f7f8 100%) !important;
  box-shadow: 8px 0 32px rgba(18, 18, 18, 0.14);
  transform: translateX(-105%);
  transition: transform 220ms ease;
  overscroll-behavior: contain;
  box-sizing: border-box;
}

body.driver-portal-shell.driver-drawer-nav.driver-nav-drawer-open #driver-sidebar,
body.driver-portal-shell.driver-nav-drawer-open.driver-drawer-nav #driver-sidebar,
body.driver-portal-shell .app.driver-drawer-nav.driver-nav-drawer-open #driver-sidebar,
body.driver-portal-shell .app.driver-nav-drawer-open.driver-drawer-nav #driver-sidebar {
  transform: translateX(0);
}

body.driver-portal-shell.driver-drawer-nav .sidebar-brand,
body.driver-portal-shell.driver-drawer-nav .sidebar-brand.brand-banner {
  display: block !important;
  margin: -16px calc(-1 * var(--sidebar-pad-x)) 8px;
}

body.driver-portal-shell.driver-drawer-nav .nav,
body.driver-portal-shell.driver-drawer-nav .nav-primary {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  margin: 0;
  padding: 4px 0 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.driver-portal-shell.driver-drawer-nav .nav-btn {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  text-align: left;
  padding: 9px 10px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  min-width: 0;
  width: 100%;
}

body.driver-portal-shell.driver-drawer-nav .logout-btn {
  display: flex !important;
  margin-top: 0;
  width: 100%;
}

body.driver-portal-shell.driver-drawer-nav #driver-sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(18, 18, 18, 0.06);
}

body.driver-portal-shell.driver-drawer-nav #driver-account-strip {
  display: grid !important;
}

body.driver-portal-shell.driver-drawer-nav .topbar {
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
}

body.driver-portal-shell.driver-drawer-nav .topbar > div:first-child {
  text-align: left;
}

@media (max-width: 900px) {
  body.driver-portal-shell.driver-drawer-nav .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  body.driver-portal-shell.driver-drawer-nav .topbar h1 {
    font-size: 1.55rem;
  }

  body.driver-portal-shell.driver-drawer-nav .topbar .secondary-btn {
    width: 100%;
  }

  body.driver-portal-shell.driver-drawer-nav .topbar #refresh-btn {
    display: none !important;
  }

  body.driver-portal-shell.driver-drawer-nav .toast {
    right: 14px;
    left: 14px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }
}

@media (hover: none) and (pointer: coarse) {
  .topbar #refresh-btn {
    display: none !important;
  }
}

.native-pull-refresh {
  position: fixed;
  top: max(10px, env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 80;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.88);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 4px 16px rgba(18, 18, 18, 0.18);
}

.native-pull-refresh.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
