:root {
  color-scheme: light;
  --ink: #101a2b;
  --muted: #657287;
  --line: #d9e1ec;
  --panel: #ffffff;
  --surface: #f4f7fb;
  --surface-strong: #e9eef6;
  --navy: #102039;
  --navy-dark: #0d1d33;
  --navy-soft: #edf3fb;
  --accent: #e31f2b;
  --accent-dark: #b91622;
  --accent-soft: #fff1f2;
  --warning: #9a5b13;
  --danger: #b91622;
  --shadow: 0 18px 45px rgba(16, 31, 54, 0.11);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fafd 0%, var(--surface) 240px);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.auth-locked {
  overflow: hidden;
}

body.auth-locked .app-shell {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(13, 29, 51, 0.94), rgba(16, 32, 57, 0.88)),
    radial-gradient(circle at 80% 20%, rgba(227, 31, 43, 0.18), transparent 32%),
    var(--navy-dark);
}

.auth-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
}

.auth-logo {
  display: block;
  width: 116px;
  height: 116px;
  object-fit: contain;
  margin-bottom: 18px;
}

.auth-card h1 {
  margin: 4px 0 8px;
  font-size: 2.3rem;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 850;
}

.auth-form input {
  min-height: 48px;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--navy-dark);
  color: #f8fbff;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 4px;
}

.brand-mark {
  width: 72px;
  height: 72px;
  object-fit: contain;
  background: transparent;
  border-radius: 999px;
  border: 0;
  flex: 0 0 72px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: #d7e0ee;
  font-size: 0.86rem;
}

.account-switcher {
  color: #e8eef7;
}

.account-switcher select {
  margin-top: 8px;
  border-color: rgba(255, 255, 255, 0.18);
  background: #132945;
  color: #ffffff;
}

.api-login-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.api-status {
  color: #d7e0ee;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.api-status.connected {
  color: #ffffff;
}

.api-status.error {
  color: #ffb5bb;
}

.api-login-panel form,
.api-actions {
  display: grid;
  gap: 8px;
}

.api-login-panel input {
  min-height: 38px;
  border-color: rgba(255, 255, 255, 0.18);
  background: #132945;
  color: #ffffff;
}

.api-login-panel input::placeholder {
  color: rgba(255, 255, 255, 0.58);
}

.api-login-panel .secondary-button {
  min-height: 38px;
  padding: 0 10px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
  color: #f2f6fb;
  text-align: left;
  border-radius: 8px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-label {
  flex: 1;
}

.nav-badge {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1;
}

.nav-tab.active {
  background: #ffffff;
  color: var(--navy-dark);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.nav-tab.active .nav-badge {
  background: var(--navy-dark);
  color: #ffffff;
}

.icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  font-weight: 800;
}

.nav-tab.active .icon {
  background: var(--accent-soft);
}

.sidebar-panel {
  margin-top: auto;
  padding: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.panel-label,
.eyebrow {
  display: block;
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-panel .panel-label {
  color: #ffffff;
}

.sidebar-panel p {
  margin: 8px 0 0;
  color: #d7e0ee;
  line-height: 1.45;
}

main {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 3rem);
  max-width: 820px;
}

h2 {
  font-size: 1.35rem;
}

.view > .admin-header,
.view > .page-heading,
.view > .history-header {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.view > .admin-header .section-heading h2,
.view > .page-heading h2,
.view > .history-header .section-heading h2 {
  font-size: clamp(2.1rem, 4vw, 3.25rem);
  letter-spacing: 0;
}

.view > .admin-header .eyebrow,
.view > .page-heading .eyebrow,
.view > .history-header .eyebrow {
  margin-bottom: 8px;
}

.metric-strip {
  display: none;
  grid-template-columns: repeat(3, minmax(112px, 1fr));
  gap: 8px;
  min-width: 440px;
}

.metric-strip div,
.admin-kpi-grid article,
.panel,
.mission-form,
.quote-panel,
.table-wrap,
.empty-state {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-strip div {
  min-height: 72px;
  padding: 12px;
}

.metric-strip span,
.metric-strip small {
  display: block;
}

.metric-strip span {
  font-size: 1.45rem;
  font-weight: 900;
}

.metric-strip small {
  margin-top: 4px;
  color: var(--muted);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.ops-column {
  display: grid;
  gap: 18px;
  align-content: start;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.admin-kpi-grid article {
  min-height: 92px;
  padding: 18px;
  border-top: 4px solid var(--accent);
}

.admin-kpi-grid span,
.admin-kpi-grid small {
  display: block;
}

.admin-kpi-grid span {
  color: var(--navy-dark);
  font-size: 1.95rem;
  font-weight: 900;
}

.admin-kpi-grid small {
  margin-top: 6px;
  color: var(--muted);
}

.urgent-panel {
  border-color: #efc67f;
}

.panel {
  padding: 22px;
}

.priority-list,
.dealer-activity,
.account-details,
.status-grid {
  margin-top: 16px;
}

.priority-list {
  display: grid;
  gap: 10px;
}

.alert-list,
.schedule-list,
.assignment-list,
.dealer-cards {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.alert-card,
.schedule-line,
.assignment-card,
.dealer-mission-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.alert-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-color: #f0d29c;
  background: #fffaf0;
}

.alert-card,
.schedule-line,
.assignment-card,
.dealer-mission-card,
.directory-card,
.agenda-day {
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.alert-card:hover,
.assignment-card:hover,
.dealer-mission-card:hover,
.directory-card:hover,
.agenda-day:hover {
  border-color: #c5d2e2;
  box-shadow: 0 16px 34px rgba(16, 31, 54, 0.12);
}

.alert-danger {
  border-color: #e4b1b1;
  background: #fff5f5;
}

.alert-warning {
  border-color: #f0c27b;
  background: #fff8ec;
}

.alert-soon {
  border-color: #eadb8f;
  background: #fffdeb;
}

.alert-new {
  border-color: #c9d8ea;
  background: #f2f7fd;
}

.alert-card strong,
.alert-card span,
.alert-card small {
  display: block;
}

.alert-card span {
  margin-top: 4px;
  color: #36465c;
  line-height: 1.35;
}

.alert-card small {
  margin-top: 4px;
  color: var(--warning);
  font-weight: 800;
}

.mini-button {
  min-height: 36px;
  border: 1px solid #e2b96f;
  border-radius: 8px;
  background: #ffffff;
  color: var(--warning);
  padding: 0 12px;
  font-weight: 850;
}

.document-actions {
  display: grid;
  gap: 6px;
  min-width: 130px;
}

.document-toggle,
.document-view-button {
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
  font-weight: 850;
}

.document-toggle {
  text-align: left;
  color: var(--muted);
}

.document-toggle.available,
.document-view-button {
  border-color: #c9d8ea;
  background: #edf3fb;
  color: var(--navy);
}

.document-toggle.missing {
  border-color: #e2b96f;
  background: #fff8e8;
  color: var(--warning);
}

.document-view-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  background: #f3f6f4;
  color: var(--muted);
}

.document-preview {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #c9d8ea;
  border-radius: 8px;
  background: #f5f8fc;
  color: #2f4058;
  font-size: 0.88rem;
  text-align: left;
}

.document-access-actions {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 0 !important;
  padding-top: 0 !important;
  width: max-content;
  margin-left: auto;
}

.pickup-button,
.pickup-state,
.start-button {
  width: 100%;
  margin-top: 8px;
}

.start-button {
  margin-top: 0;
}

.pickup-state {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #c9d8ea;
  background: #edf3fb;
  color: var(--navy);
  font-size: 0.85rem;
  font-weight: 850;
}

.schedule-line {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.schedule-line time {
  color: var(--accent-dark);
  font-weight: 900;
}

.schedule-line strong,
.schedule-line span {
  display: block;
}

.schedule-line span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

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

.planning-day {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.planning-driver-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.planning-driver-header h3 {
  margin-bottom: 0;
}

.driver-zone {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.planning-driver-header > span {
  min-width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 950;
}

.planning-mission {
  display: grid;
  gap: 7px;
  padding: 12px;
  border-radius: 8px;
  background: #f7faff;
  border: 1px solid var(--line);
}

.planning-mission + .planning-mission {
  margin-top: 10px;
}

.planning-mission span,
.planning-mission small {
  color: var(--muted);
  line-height: 1.35;
}

.planning-mission .status-pill,
.planning-mission .mission-ref {
  margin-top: 0;
}

.assignment-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) minmax(220px, auto);
  gap: 14px;
  align-items: end;
  padding: 16px;
}

.admin-page-intro {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.admin-page-intro article {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.admin-page-intro span,
.admin-page-intro strong {
  display: block;
}

.admin-page-intro span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.admin-page-intro strong {
  margin-top: 4px;
  color: var(--navy);
  font-size: 1.02rem;
}

.admin-action-card {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  align-items: stretch;
  background: #ffffff;
}

.assignment-main {
  display: grid;
  gap: 12px;
}

.assignment-main h3 {
  font-size: 1.1rem;
}

.assignment-control {
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faff;
}

.assignment-control label {
  margin-bottom: 0;
}

.admin-route-preview {
  background: #ffffff;
}

.admin-finance-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.admin-finance-strip span {
  display: grid;
  gap: 4px;
  margin-top: 0;
  padding: 10px 12px;
  background: #f7faff;
}

.admin-finance-strip span + span {
  border-left: 1px solid var(--line);
}

.admin-finance-strip small {
  margin-top: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-finance-strip strong {
  font-size: 1.08rem;
}

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

.assignment-actions .assignment-validate {
  grid-column: 1 / -1;
}

.assignment-actions .primary-button,
.assignment-actions .secondary-button,
.assignment-actions .danger-button {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
}

.assignment-card strong,
.assignment-card span,
.assignment-card small {
  display: block;
}

.assignment-card span,
.assignment-card small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.dealer-cards {
  grid-template-columns: 1fr;
  margin-top: 0;
}

.dealer-mission-card {
  position: relative;
  padding: 18px;
  display: grid;
  gap: 16px;
}

.dealer-tracking-card,
.dealer-history-card {
  background: #ffffff;
}

.completed-document-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  max-width: 180px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
}

.completed-document-badge.complete {
  border-color: #c9d8ea;
  background: #edf3fb;
  color: var(--navy);
}

.completed-document-badge.incomplete {
  border-color: #e2b96f;
  background: #fff8e8;
  color: var(--warning);
}

.dealer-mission-card .dealer-card-main {
  padding-right: 190px;
}

.dealer-card-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.dealer-agenda-card {
  align-items: start;
  border-color: #cfd9e7;
  background: #ffffff;
}

.dealer-agenda-actions {
  display: grid;
  gap: 8px;
  min-width: 150px;
  align-self: center;
}

.dealer-agenda-actions .secondary-button,
.dealer-agenda-actions .danger-button {
  width: 100%;
  min-height: 36px;
  padding: 0 11px;
  font-size: 0.88rem;
}

.dealer-agenda-card .mission-detail {
  grid-column: 1 / -1;
}

.dealer-agenda-card.compact {
  grid-template-columns: minmax(0, 1fr);
}

.dealer-agenda-card.compact .agenda-mission-main {
  gap: 6px;
}

.dealer-agenda-card.compact .mission-card-topline {
  gap: 6px;
}

.dealer-agenda-card.compact .mission-ref {
  font-size: 0.74rem;
}

.dealer-agenda-card.compact .status-pill {
  padding: 5px 7px;
  font-size: 0.74rem;
}

.dealer-agenda-card.compact .agenda-mission-main > strong,
.dealer-agenda-card.compact .agenda-mission-main > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.dealer-agenda-card.compact .mission-chip-row small {
  padding: 4px 7px;
  font-size: 0.78rem;
}

.dealer-agenda-card.compact .dealer-agenda-actions {
  grid-column: 1 / -1;
  grid-template-columns: 1fr;
  min-width: 0;
}

.dealer-agenda-card.compact .dealer-agenda-actions button {
  width: 100%;
  min-width: 0;
  padding-inline: 8px;
  white-space: normal;
}

.dealer-agenda-card.compact .dealer-agenda-actions .detail-button {
  grid-column: 1 / -1;
}

.dealer-agenda-card.compact .compact-info-list > span:first-child strong,
.dealer-agenda-card.compact .compact-info-list .compact-schedule strong span,
.dealer-agenda-card.compact .compact-info-list > span:last-child strong {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.danger-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid #e4b1b1;
  background: #fff5f5;
  color: var(--danger);
  font-weight: 850;
}

.dealer-card-main {
  display: grid;
  gap: 8px;
}

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

.mission-card-topline .mission-ref {
  margin-bottom: 0;
}

.dealer-card-main p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.dealer-route-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faff;
}

.dealer-route-preview div {
  min-width: 0;
}

.dealer-route-preview small,
.dealer-route-grid small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dealer-route-preview strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.35;
  white-space: normal;
}

.dealer-route-preview > span {
  color: var(--accent-dark);
  font-weight: 950;
  text-align: center;
}

.mission-chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mission-chip-row small {
  width: max-content;
  padding: 5px 8px;
  border: 1px solid #cfd9e7;
  border-radius: 999px;
  background: #f7faff;
  color: var(--navy);
  font-weight: 850;
}

.mission-chip-row .start-code-chip {
  border-color: #f0b5b9;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.dealer-route-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.dealer-route-grid section {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 0;
  background: #f7faff;
}

.dealer-route-grid section + section {
  border-left: 1px solid var(--line);
}

.dealer-route-grid strong {
  line-height: 1.35;
}

.dealer-route-grid span {
  color: var(--muted);
  font-weight: 800;
}

.dealer-compact-dl {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dealer-compact-dl > div:nth-child(2) {
  border-top: 0;
}

.dealer-compact-dl > div:nth-child(even) {
  border-left: 1px solid var(--line);
}

.dealer-compact-dl dt {
  width: 46%;
}

.dealer-departure-document {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faff;
}

.dealer-departure-document strong {
  color: var(--navy);
}

.dealer-departure-document > span {
  color: var(--muted);
  font-weight: 850;
}

.dealer-departure-document .document-preview {
  grid-column: 1 / -1;
  margin-top: 0;
}

.dealer-document-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dealer-document-strip span {
  padding: 7px 10px;
  border: 1px solid #e2b96f;
  border-radius: 999px;
  background: #fff8e8;
  color: var(--warning);
  font-size: 0.84rem;
  font-weight: 900;
}

.dealer-document-strip span.ready {
  border-color: #c9d8ea;
  background: #edf3fb;
  color: var(--navy);
}

.dealer-mission-card dl {
  display: grid;
  gap: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.dealer-mission-card dl > div {
  display: flex;
  justify-content: space-between;
  gap: 0;
  border-top: 1px solid var(--line);
  padding-top: 0;
}

.dealer-mission-card dl > div:first-child {
  border-top: 0;
}

.dealer-mission-card dt {
  width: 42%;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
  background: #f7faff;
  color: var(--muted);
}

.dealer-mission-card dd {
  flex: 1;
  margin: 0;
  padding: 8px 10px;
  font-weight: 850;
  text-align: right;
}

.page-heading {
  margin-bottom: 16px;
}

.page-subtitle {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

#dealerUpcomingView .page-heading {
  max-width: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

#dealerUpcomingView .agenda-nav {
  flex-basis: auto;
}

.dealer-page-intro {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.dealer-page-intro article {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.dealer-page-intro span,
.dealer-page-intro strong {
  display: block;
}

.dealer-page-intro span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.dealer-page-intro strong {
  margin-top: 4px;
  color: var(--navy);
  font-size: 1.02rem;
}

.history-header {
  margin-bottom: 16px;
}

.history-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.admin-history-kpis {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.history-kpis div,
.mission-detail,
.contacts-grid .panel {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.history-kpis span {
  display: block;
  font-size: 1.45rem;
  font-weight: 900;
}

.history-kpis small {
  color: var(--muted);
}

.history-advanced-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

.history-reset-button {
  min-height: 54px;
}

.history-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.mission-detail {
  margin-top: -16px;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.mission-detail dl {
  gap: 0;
  padding-top: 0;
  border-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.dealer-mission-card dl:has(+ .mission-detail:not([hidden])) {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.mission-detail dl > div {
  border-top: 1px solid var(--line);
  padding: 0;
}

.mission-detail dl > div:first-child {
  border-top: 0;
}

.mission-detail-heading {
  padding: 0 !important;
  background: #f2f6fb;
}

.mission-detail-heading dt {
  width: 100%;
  padding: 8px 10px;
  border-right: 0;
  background: #e8eef7;
  color: var(--navy);
  font-weight: 900;
}

.mission-detail-heading dd {
  display: none;
}

.mission-detail dd:has(.document-access-actions) {
  display: grid;
  justify-items: end;
}

.detail-divider-after {
  border-bottom: 1px solid var(--line);
}

.document-warning-button {
  border-color: #e2b96f;
  background: #fff8e8;
  color: var(--warning);
}

.mission-ref {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
}

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

.contacts-grid span,
.contacts-grid strong {
  display: block;
}

.contacts-grid span {
  color: var(--muted);
  margin-bottom: 6px;
}

.empty-inline {
  padding: 18px;
  border: 1px dashed #b8c3d2;
  border-radius: 8px;
  background: #fbfcff;
  color: var(--muted);
}

.empty-inline strong {
  color: var(--ink);
}

.empty-inline p {
  margin: 6px 0 0;
  line-height: 1.4;
}

.priority-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.priority-card strong,
.priority-card span {
  display: block;
}

.priority-card span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

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

.status-card {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcff;
}

.status-card span {
  display: block;
  font-size: 1.6rem;
  font-weight: 900;
}

.status-card small {
  color: var(--muted);
}

.dealer-activity {
  display: grid;
  gap: 12px;
}

.dealer-line {
  display: grid;
  gap: 7px;
}

.dealer-line header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.directory-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.directory-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.directory-card header span {
  color: var(--accent-dark);
  font-weight: 850;
}

.directory-highlight {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faff;
}

.directory-highlight span {
  color: var(--navy);
  font-size: 1.35rem;
  font-weight: 950;
}

.directory-highlight small {
  color: var(--muted);
  font-weight: 850;
}

.directory-card dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.directory-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.directory-card dt {
  color: var(--muted);
}

.directory-card dd {
  margin: 0;
  font-weight: 850;
  text-align: right;
}

.dealer-list-heading {
  margin: 18px 0 10px;
}

.dealer-management-list {
  display: grid;
  gap: 10px;
}

.dealer-management-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.dealer-management-main {
  display: grid;
  gap: 12px;
}

.dealer-management-main header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.dealer-management-main header strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.dealer-management-main header span {
  color: var(--accent-dark);
  font-weight: 900;
}

.dealer-management-main dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin: 0;
}

.dealer-management-main dl div {
  min-width: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.dealer-management-main dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dealer-management-main dd {
  margin: 3px 0 0;
  color: var(--ink);
  font-weight: 850;
  overflow-wrap: anywhere;
}

.dealer-access-box {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
  border: 1px solid #d6e0ee;
  border-radius: 8px;
  background: #f8fbff;
}

.dealer-access-box span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dealer-access-box strong,
.dealer-access-box small {
  overflow-wrap: anywhere;
}

.dealer-access-box small {
  color: var(--muted);
  font-weight: 850;
}

.account-row-actions {
  display: grid;
  gap: 8px;
}

.account-row-actions .secondary-button,
.account-row-actions .danger-button {
  width: 100%;
}

.account-edit-form {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid #d6e0ee;
  border-radius: 8px;
  background: #f8fbff;
}

.account-edit-form[hidden] {
  display: none;
}

.account-edit-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.admin-completed-card {
  background: #ffffff;
}

.admin-completed-card .dealer-card-main {
  padding-right: 190px;
}

.bar {
  height: 9px;
  border-radius: 999px;
  background: var(--surface-strong);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.account-details {
  display: grid;
  gap: 12px;
}

.account-details div {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.account-details dt {
  color: var(--muted);
}

.account-details dd {
  margin: 4px 0 0;
  font-weight: 850;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.mission-form {
  padding: 22px;
  display: grid;
  gap: 22px;
}

#dealerRequestView .mission-form > .section-heading {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

#dealerRequestView .mission-form > .section-heading h2 {
  font-size: clamp(1.9rem, 3vw, 2.75rem);
}

.section-heading {
  display: grid;
  gap: 2px;
}

fieldset {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

legend {
  padding: 0 8px;
  font-weight: 850;
}

.field-grid {
  display: grid;
  gap: 14px;
}

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

.field-grid.one {
  grid-template-columns: minmax(0, 1fr);
}

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

label {
  display: block;
  color: #25364d;
  font-size: 0.9rem;
  font-weight: 750;
}

label > input,
label > select,
label > textarea {
  margin-top: 7px;
}

.address-field {
  min-width: 0;
}

.address-suggestions {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.address-suggestion {
  width: 100%;
  min-height: 48px;
  display: grid;
  gap: 3px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  padding: 10px 12px;
}

.address-suggestion strong,
.address-suggestion span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.address-suggestion strong {
  font-size: 0.95rem;
}

.address-suggestion span {
  color: var(--muted);
  font-size: 0.82rem;
}

.address-suggestion:hover {
  background: var(--accent-soft);
}

.address-suggestion:last-child {
  border-bottom: 0;
}

.required-mark {
  color: var(--danger);
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c8d2df;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

input[readonly] {
  background: #eef3f9;
  color: #536176;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.field-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(162, 59, 59, 0.12);
}

.check-row:has(.field-error) {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(162, 59, 59, 0.12);
}

.form-errors,
.form-message {
  border-radius: 8px;
  padding: 14px;
  line-height: 1.45;
}

.form-errors {
  background: #fff5f5;
  border: 1px solid #e4b1b1;
  color: var(--danger);
}

.form-errors strong,
.form-message strong {
  display: block;
  margin-bottom: 6px;
}

.form-errors ul {
  margin: 0;
  padding-left: 20px;
}

.form-message {
  margin-top: 14px;
  background: #fff8ed;
  border: 1px solid #f2d9b4;
  color: var(--warning);
}

.form-message.success {
  background: #eefaf0;
  border-color: #b8dfc1;
  color: #166534;
}

.form-message.error {
  background: #fff5f5;
  border-color: #e4b1b1;
  color: var(--danger);
}

.account-create-form {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.account-create-form h3 {
  font-size: 1.35rem;
}

.password-change-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.password-change-panel > div {
  display: grid;
  gap: 4px;
}

.password-change-panel span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.password-change-panel strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.password-change-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.password-change-form[hidden] {
  display: none;
}

.password-change-form .form-actions {
  grid-column: 1 / -1;
}

.self-account-form input:disabled {
  color: var(--ink);
  background: #eef3f8;
  cursor: not-allowed;
}

.self-account-form.is-editing input {
  background: #ffffff;
  cursor: text;
}

.helper {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

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

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

.check-row {
  min-height: 92px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: center;
  column-gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faff;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.check-row span {
  grid-column: 2;
  color: var(--muted);
  font-weight: 650;
}

.upload-card {
  min-height: 96px;
  align-content: center;
  padding: 14px;
  border: 1px dashed #b8c3d2;
  border-radius: 8px;
  background: #f7faff;
}

.upload-card input {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.form-actions,
.admin-header,
.table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.table-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.period-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.period-filter span {
  color: var(--muted);
  font-weight: 850;
  line-height: 1;
}

.period-filter input {
  min-width: 138px;
}

#completedView .completed-table-actions .period-filter {
  flex: 1 1 420px;
  justify-content: flex-start;
}

#exportCompletedExcel {
  margin-left: auto;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  font-weight: 850;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--line);
}

.quote-panel {
  position: sticky;
  top: 24px;
  padding: 20px;
  display: grid;
  gap: 18px;
}

.price-box {
  min-height: 128px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.price-box span,
.price-box small {
  display: block;
  text-align: center;
}

.price-box span {
  font-size: 2.4rem;
  font-weight: 900;
}

.quote-details {
  display: grid;
  gap: 8px;
  margin: 0;
}

.quote-details div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
}

.quote-details dt {
  color: var(--muted);
}

.quote-details dd {
  margin: 0;
  font-weight: 850;
}

.tariff-note {
  padding: 14px;
  background: #fff8ed;
  color: var(--warning);
  border: 1px solid #f2d9b4;
  border-radius: 8px;
}

.tariff-note p {
  margin: 6px 0 0;
  line-height: 1.45;
}

.admin-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.admin-header .section-heading,
.history-header .section-heading,
.page-heading {
  max-width: 760px;
}

.admin-header .table-actions {
  align-self: flex-end;
  max-width: 760px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

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

th {
  background: var(--surface-strong);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #34455d;
}

td {
  background: #fff;
}

td.middle-cell {
  vertical-align: middle;
}

.route-cell strong,
.dealer-cell strong,
.vehicle-cell strong {
  display: block;
  margin-bottom: 4px;
}

.cell-muted {
  display: block;
  color: var(--muted);
  line-height: 1.4;
}

.route-flow {
  display: inline-grid;
  justify-items: center;
}

.route-flow strong,
.route-flow .cell-muted {
  justify-self: start;
}

.down-arrow {
  display: block;
  color: var(--accent-dark);
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
  margin: 6px auto;
  text-align: center;
}

.down-arrow.horizontal {
  display: inline-block;
  margin: 4px 8px 4px 0;
  vertical-align: middle;
}

.status-select,
.driver-input,
.assignment-driver,
.table-actions select,
.table-actions input {
  min-width: 150px;
}

.planning-filter.active,
.admin-upcoming-filter.active,
.agenda-mode.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.agenda-switch,
.agenda-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.agenda-nav {
  flex-basis: 100%;
  justify-content: flex-end;
}

.agenda-nav .agenda-switch {
  margin-right: 4px;
}

.agenda-nav strong {
  min-width: 170px;
  color: var(--ink);
  text-align: center;
}

.icon-button {
  width: 44px;
  padding: 0;
  font-size: 1.25rem;
}

.agenda-board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.agenda-board.week-mode {
  grid-template-columns: repeat(7, minmax(240px, 1fr));
  overflow-x: auto;
  padding-bottom: 4px;
}

.agenda-day {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.agenda-day header {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f2f6fb;
}

.agenda-day header span {
  color: var(--navy);
  font-weight: 900;
  text-transform: capitalize;
}

.agenda-day header strong {
  color: var(--muted);
}

.agenda-day-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.agenda-mission-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, auto);
  gap: 18px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.admin-agenda-card {
  align-items: start;
  background: #ffffff;
}

.admin-agenda-card .dealer-route-preview {
  margin-top: 4px;
}

.admin-agenda-card.compact .mission-card-topline {
  gap: 6px;
}

.admin-agenda-card.compact .mission-ref {
  font-size: 0.74rem;
}

.admin-agenda-card.compact .status-pill {
  padding: 5px 7px;
  font-size: 0.74rem;
}

.admin-agenda-card.compact .agenda-mission-main > strong,
.admin-agenda-card.compact .agenda-mission-main > span {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.25;
}

.compact-info-list {
  display: grid;
  gap: 7px;
  margin-top: 2px;
}

.compact-info-list > span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #dce4ef;
  border-radius: 7px;
  background: #f8fbff;
}

.compact-info-list small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compact-info-list strong {
  min-width: 0;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-info-list .compact-schedule strong {
  display: grid;
  gap: 3px;
  white-space: normal;
}

.compact-info-list .compact-schedule strong span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.driver-contact-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 4px;
}

.driver-contact-list em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
}

.agenda-actions {
  display: grid;
  gap: 8px;
  min-width: 126px;
  align-self: center;
}

.agenda-actions .detail-button,
.agenda-actions .start-button {
  width: 100%;
  margin-top: 0;
}

.agenda-time {
  display: grid;
  gap: 4px;
  text-align: center;
  min-width: 132px;
  justify-items: center;
  align-self: start;
  position: relative;
  z-index: 1;
}

.agenda-time strong {
  color: var(--accent-dark);
  font-size: 1.05rem;
}

.agenda-time .time-arrow {
  display: inline-flex;
  justify-content: center;
  color: var(--navy);
  font-weight: 900;
}

.agenda-time span,
.agenda-mission-main span,
.agenda-mission-main small {
  color: var(--muted);
}

.agenda-time strong,
.agenda-time span {
  max-width: 100%;
  white-space: nowrap;
}

.agenda-mission-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.agenda-mission-main strong,
.agenda-mission-main span,
.agenda-mission-main small {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
}

.agenda-mission-main strong,
.agenda-mission-main span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-mission-main small {
  line-height: 1.35;
}

.agenda-mission-card.compact {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  overflow: hidden;
}

.agenda-mission-card.compact .agenda-time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--navy-soft);
  text-align: left;
  overflow: hidden;
}

.agenda-mission-card.compact .agenda-actions {
  grid-column: 1 / -1;
  grid-template-columns: 1fr 42px;
  min-width: 0;
}

.agenda-mission-card.dealer-agenda-card.compact .dealer-agenda-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.agenda-mission-card.dealer-agenda-card.compact .dealer-agenda-actions .detail-button {
  grid-column: 1 / -1;
}

.agenda-mission-card.dealer-agenda-card.compact .dealer-agenda-actions button {
  width: 100%;
  padding-inline: 8px;
  white-space: nowrap;
}

.agenda-mission-card.compact .start-button,
.agenda-mission-card.compact .detail-button {
  min-height: 36px;
  padding: 0;
  font-size: 0.9rem;
}

.agenda-mission-card.compact .agenda-time strong {
  font-size: 0.82rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-mission-card.compact .agenda-time span {
  font-size: 0.82rem;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-mission-card.compact .agenda-time .time-arrow {
  flex: 0 0 auto;
  overflow: visible;
  line-height: 1;
}

.driver-agenda-board.week-mode .driver-mission-card.compact .mission-chip-row {
  display: none;
}

.driver-agenda-board.week-mode .driver-mission-card.compact .agenda-mission-main > strong,
.driver-agenda-board.week-mode .driver-mission-card.compact .agenda-mission-main > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-empty {
  padding: 18px;
  border: 1px dashed #b8c3d2;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.dealer-mode .status-select,
.dealer-mode .admin-only,
.dealer-mode .admin-only-cell {
  display: none;
}

.dealer-mode .admin-view,
.dealer-mode .driver-view,
.admin-mode .dealer-view,
.admin-mode .driver-view,
.driver-mode .admin-view,
.driver-mode .dealer-view,
.admin-mode #dealerNav,
.admin-mode #driverNav,
.dealer-mode #adminNav,
.dealer-mode #driverNav,
.driver-mode #adminNav,
.driver-mode #dealerNav {
  display: none !important;
}

.start-code {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(230, 43, 43, 0.1);
  color: var(--accent-dark);
  font-weight: 900;
  font-size: 0.78rem;
  letter-spacing: 0;
}

.driver-cards {
  gap: 18px;
}

.driver-section {
  display: grid;
  gap: 12px;
}

.driver-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--navy-soft);
  color: var(--navy);
}

.driver-section-heading strong {
  font-size: 1rem;
}

.driver-section-heading span {
  color: var(--muted);
  font-weight: 800;
}

.driver-mission-card .document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.driver-document-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.driver-document-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.driver-document-panel header div {
  display: grid;
  gap: 2px;
}

.driver-document-panel header strong {
  color: var(--ink);
  font-size: 1rem;
}

.driver-document-panel header span {
  color: var(--muted);
  font-weight: 800;
}

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

.driver-document-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d6e0ee;
  border-radius: 8px;
  background: #ffffff;
}

.driver-document-item > div:first-child {
  display: grid;
  gap: 3px;
}

.driver-document-item strong {
  color: var(--ink);
}

.driver-document-item span {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--navy-soft);
  font-size: 0.78rem;
  font-weight: 900;
}

.driver-document-item.ready span {
  color: #166534;
  background: #dcfce7;
}

.driver-document-item.missing span {
  color: #9a3412;
  background: #ffedd5;
}

.driver-document-item .document-access-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.driver-document-item .document-toggle,
.driver-document-item .document-view-button {
  width: 100%;
}

.driver-mission-card .document-toggle,
.driver-mission-card .document-view-button {
  min-height: 38px;
}

.in-progress-card-list {
  display: grid;
  gap: 14px;
}

.in-progress-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.in-progress-main {
  display: grid;
  gap: 10px;
}

.progress-heading {
  display: grid;
  gap: 6px;
}

.progress-heading .mission-card-topline {
  margin-bottom: 0;
}

.in-progress-main h3,
.progress-heading h3 {
  font-size: 1.18rem;
  line-height: 1.15;
}

.progress-vehicle-line {
  margin: 2px 0 0;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.2;
}

.progress-chip-row {
  align-items: center;
}

.progress-chip-row small {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  width: auto;
  max-width: 100%;
  padding: 6px 10px;
  line-height: 1.15;
}

.progress-route-grid {
  background: #f8fbff;
}

.in-progress-side {
  display: grid;
  gap: 12px;
  align-content: start;
}

.progress-documents {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faff;
}

.progress-documents > strong {
  color: var(--navy);
  font-size: 0.95rem;
}

.progress-document-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid #dce4ef;
  border-radius: 7px;
  background: #ffffff;
}

.progress-document-item > span {
  color: var(--ink);
  font-weight: 850;
}

.progress-document-item.ready {
  border-color: #bedbd3;
  background: #f2fbf8;
}

.progress-document-item.missing {
  border-color: #f2ca8f;
  background: #fff8eb;
}

.progress-actions {
  display: grid;
  gap: 8px;
}

.progress-actions .primary-button,
.progress-actions .secondary-button {
  width: 100%;
  min-height: 44px;
}

.status-pill {
  display: inline-block;
  width: max-content;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 850;
}

.priority-card .status-pill {
  display: inline-block;
}

.empty-state {
  margin-top: 16px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  color: var(--ink);
}

body.modal-open {
  overflow: hidden;
}

.mission-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.mission-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 23, 40, 0.74);
}

.mission-modal-panel {
  position: relative;
  width: min(1040px, 100%);
  max-height: min(86vh, 920px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 30px 90px rgba(11, 23, 40, 0.34);
}

.mission-modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px;
  background: var(--navy-dark);
  color: #ffffff;
}

.mission-modal-header .eyebrow {
  color: var(--accent);
}

.mission-modal-title {
  font-size: clamp(1.45rem, 3vw, 2.25rem);
}

.mission-modal-close {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 900;
}

.mission-modal-body {
  padding: 22px;
}

.mission-modal-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #f7faff;
}

.mission-modal-summary strong {
  font-size: 1.15rem;
}

.mission-modal-summary small {
  margin-left: auto;
  color: var(--muted);
  font-weight: 850;
}

.mission-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
  margin-top: 14px;
}

.mission-modal-section {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.mission-modal-section.wide {
  grid-column: 1 / -1;
}

.mission-modal-paired-sections {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.mission-modal-section h3 {
  padding: 12px 14px;
  background: #edf3fb;
  color: var(--navy);
  font-size: 1rem;
}

.mission-modal-section dl {
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.mission-modal-section dl > div {
  display: grid;
  grid-template-columns: minmax(150px, 0.42fr) minmax(0, 1fr);
  border-top: 1px solid var(--line);
}

.mission-modal-section dl > div:first-child {
  border-top: 1px solid var(--line);
}

.mission-modal-section dl > div:last-child {
  border-bottom: 0;
}

.mission-modal-section dt,
.mission-modal-section dd {
  margin: 0;
  padding: 10px 12px;
  line-height: 1.35;
}

.mission-modal-section dt {
  border-right: 1px solid var(--line);
  background: #f7faff;
  color: var(--muted);
  font-weight: 850;
}

.mission-modal-section dd {
  font-weight: 750;
}

.mission-modal-section .document-access-actions {
  width: auto;
}

@media (max-width: 1120px) {
  .app-shell,
  .workspace-grid,
  .dashboard-grid,
  .ops-grid {
    grid-template-columns: 1fr;
  }

  .quote-panel {
    position: static;
  }

  .topbar {
    flex-direction: column;
  }

	  .metric-strip {
	    min-width: 0;
	    width: 100%;
	  }

	  .sidebar {
	    position: static;
	    height: auto;
	    overflow: visible;
	  }
	}

@media (max-width: 720px) {
  main,
  .sidebar {
    padding: 18px;
  }

  .field-grid.two,
  .field-grid.three,
  .upload-grid,
  .checkbox-grid,
  .metric-strip,
  .admin-kpi-grid,
  .status-grid,
  .directory-grid,
  .history-kpis,
  .history-advanced-filters,
  .contacts-grid {
    grid-template-columns: 1fr;
  }

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

  .admin-kpi-grid article {
    min-height: 70px;
    padding: 10px 8px;
  }

  .admin-kpi-grid span {
    font-size: 1.25rem;
    line-height: 1;
  }

  .admin-kpi-grid small {
    margin-top: 5px;
    font-size: 0.68rem;
    line-height: 1.1;
  }

	  .form-actions,
	  .admin-header,
	  .table-actions,
	  .history-header,
	  #dealerUpcomingView .page-heading,
	  .admin-page-intro,
	  .dealer-page-intro,
	  .dealer-route-grid,
	  .dealer-compact-dl,
	  .driver-contact-list,
	  .driver-document-grid,
	  .dealer-management-row,
	  .dealer-management-main dl,
	  .account-edit-form,
	  .password-change-form,
	  .dealer-card-actions,
	  .in-progress-card,
	  .admin-action-card,
	  .admin-finance-strip,
	  .assignment-card,
	  .schedule-line {
    grid-template-columns: 1fr;
    align-items: stretch;
    flex-direction: column;
  }

  .dealer-compact-dl > div:nth-child(2) {
    border-top: 1px solid var(--line);
  }

  .dealer-compact-dl > div:nth-child(even),
  .dealer-route-grid section + section,
  .admin-finance-strip span + span {
    border-left: 0;
  }

  .dealer-route-grid section + section {
    border-top: 1px solid var(--line);
  }

  .admin-finance-strip span + span {
    border-top: 1px solid var(--line);
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .period-filter {
    width: 100%;
    justify-content: space-between;
  }

  .period-filter input {
    min-width: 0;
    width: 100%;
  }

	  .agenda-switch,
	  .agenda-nav {
	    width: 100%;
	  }

	  .agenda-nav {
	    display: grid;
	    grid-template-columns: 44px minmax(140px, 1fr) 44px;
	    justify-content: stretch;
	  }

	  .agenda-nav strong {
	    min-width: 0;
	    white-space: nowrap;
	  }

	  .agenda-nav .agenda-switch {
	    grid-column: 1 / -1;
	    display: grid;
	    grid-template-columns: repeat(2, minmax(0, 1fr));
	    margin-right: 0;
	  }

	  .agenda-nav .secondary-button {
	    width: auto;
	  }

	  .agenda-nav .agenda-switch .secondary-button {
	    width: 100%;
	  }

	  .agenda-nav .icon-button {
	    width: 44px;
	  }

	  .agenda-board.week-mode {
	    grid-template-columns: 1fr;
	    overflow-x: visible;
	  }

	  .mission-modal {
	    padding: 12px;
	  }

	  .mission-modal-header {
	    padding: 18px;
	  }

	  .mission-modal-body {
	    padding: 14px;
	  }

	  .mission-modal-grid {
	    grid-template-columns: 1fr;
	  }

	  .mission-modal-paired-sections {
	    grid-template-columns: 1fr;
	  }

	  .mission-modal-summary {
	    align-items: flex-start;
	    flex-direction: column;
	  }

	  .mission-modal-summary small {
	    margin-left: 0;
	  }

	  .mission-modal-section dl > div {
	    grid-template-columns: 1fr;
	  }

	  .mission-modal-section dt {
	    border-right: 0;
	    border-bottom: 1px solid var(--line);
	  }

  .agenda-mission-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .agenda-time {
    text-align: left;
  }

  .completed-document-badge {
    position: static;
    justify-self: start;
    max-width: none;
  }

  .dealer-mission-card .dealer-card-main {
    padding-right: 0;
  }
}
