:root {
  color-scheme: light;
  --color-charcoal: #252A2E;
  --color-primary: #2F6B4F;
  --color-active: #16806A;
  --color-info: #2563EB;
  --color-success: #2E7D32;
  --color-warning: #E89B0C;
  --color-danger: #C83E3E;
  --color-bg: #F4F3EF;
  --color-card: #FFFFFF;
  --color-text: #202326;
  --color-muted: #6B706F;
  --color-border: #D9DCD8;
  --shadow-soft: 0 16px 40px rgba(32, 35, 38, 0.10);
  --shadow-small: 0 8px 20px rgba(32, 35, 38, 0.08);
  --radius: 8px;
  --header-height: 64px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 500;
  line-height: 1.45;
}

body.nav-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

img,
svg {
  max-width: 100%;
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--header-height);
  padding: 10px 16px;
  background: var(--color-charcoal);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.app-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.app-brand-link {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  color: inherit;
  border-radius: var(--radius);
  transition: opacity 120ms ease;
}

.app-brand-link:hover,
.app-brand-link:focus-visible {
  opacity: 0.85;
  outline: 2px solid rgba(255, 255, 255, 0.24);
  outline-offset: 2px;
}

.app-brand-mark {
  display: grid;
  flex: 0 0 76px;
  width: 76px;
  height: 52px;
  place-items: center;
  border-radius: var(--radius);
  background: #fff;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.65);
  overflow: hidden;
}

.app-brand-mark img {
  display: block;
  width: 66px;
  height: 42px;
  object-fit: contain;
}

.app-brand-title {
  display: grid;
  gap: 1px;
  overflow: hidden;
  max-width: 64vw;
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.08;
}

.app-brand-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-brand-title strong {
  color: #D8E7DD;
  font-weight: 900;
}

.app-brand-subtitle {
  display: none;
}

.icon-button {
  display: inline-grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  outline: 2px solid rgba(255, 255, 255, 0.24);
  outline-offset: 2px;
}

.app-sidebar {
  position: fixed;
  inset: 0 0 0 0;
  z-index: 60;
  display: flex;
  width: 100%;
  transform: translateX(-105%);
  flex-direction: column;
  background: #fff;
  transition: transform 180ms ease;
}

.app-sidebar.is-open {
  transform: translateX(0);
}

.app-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  background: rgba(0, 0, 0, 0.38);
}

.app-overlay.is-open {
  display: block;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-user {
  min-width: 0;
}

.sidebar-user strong {
  display: block;
  overflow: hidden;
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user span {
  display: block;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--color-text);
  font-weight: 600;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(47, 107, 79, 0.10);
  outline: none;
}

.nav-badge {
  margin-left: auto;
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(232, 155, 12, 0.16);
  color: #6b4200;
  font-size: 0.78rem;
  text-align: center;
}

.sidebar-actions {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--color-border);
}

.app-main {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 14px 92px;
}

.page-header {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.page-eyebrow {
  display: none;
}

.page-title {
  display: inline-block;
  margin: 0;
  padding: 8px 16px;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: #fff;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 700;
  line-height: 1.2;
}

.page-subtitle {
  display: none;
}

.page-actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-panel .action-row {
  align-items: end;
}

.center-actions {
  justify-content: center;
}

.section-padded {
  padding: 16px;
}

.mt-14 {
  margin-top: 14px;
}

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

.stat-card {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-small);
}

.stat-card span {
  display: block;
  color: var(--color-muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

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

.stat-grid-3 .stat-card {
  min-height: 60px;
  padding: 10px 8px;
}

.stat-grid-3 .stat-card span {
  font-size: 0.62rem;
}

.stat-grid-3 .stat-card strong {
  margin-top: 4px;
  font-size: 1.25rem;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  color: var(--color-text);
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.control-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
}

.control-card h2,
.section-head h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 0;
}

.email-config-card {
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid rgba(47, 107, 79, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(47, 107, 79, 0.06), rgba(37, 99, 235, 0.03)),
    var(--color-card);
  box-shadow: var(--shadow-small);
}

.email-config-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.email-config-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.email-config-head h2 {
  margin: 0;
  color: var(--color-text);
  font-size: 1.05rem;
  font-weight: 800;
}

.email-config-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
}

.email-config-grid {
  display: grid;
  gap: 10px;
}

.email-config-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(107, 112, 111, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
}

.email-config-item span {
  display: block;
  margin-bottom: 5px;
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.email-config-item strong {
  display: block;
  color: var(--color-text);
  font-size: 0.94rem;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

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

.text-danger {
  color: var(--color-danger) !important;
}

.control-search-form {
  grid-template-columns: 1fr;
}

.field-error {
  color: var(--color-danger);
  font-size: 0.82rem;
  font-weight: 700;
}

.checkbox-row input[type="checkbox"] {
  width: 20px !important;
  height: 20px !important;
  min-height: 20px !important;
}

.app-card,
.form-panel,
.filter-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card);
  box-shadow: var(--shadow-small);
}

.trip-list {
  display: grid;
  gap: 12px;
}

.trip-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-small);
  transition: box-shadow 120ms ease, transform 120ms ease;
}

.trip-card:hover {
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.trip-card.status-submitted {
  border-left-color: var(--color-warning);
}

.trip-card.status-assigned {
  border-left-color: #1D4ED8;
}

.trip-card.status-inprogress {
  border-left-color: #EAB308;
}

.trip-card.status-completed {
  border-left-color: var(--color-success);
}

.trip-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.trip-number {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.trip-title {
  margin: 4px 0 0;
  color: var(--color-text);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.22;
}

.trip-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.meta-item {
  display: grid;
  gap: 2px;
}

.meta-label {
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.meta-value {
  color: var(--color-text);
  font-size: 0.94rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.requester-name {
  padding: 0.06em 0.25em;
  border-radius: 4px;
  background: rgba(47, 107, 79, 0.13);
  color: #20563E;
  font-weight: 800;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(47, 107, 79, 0.12);
  color: var(--color-primary);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.status-assigned {
  background: rgba(37, 99, 235, 0.10);
  color: #1D4ED8;
}

.status-pill.status-submitted {
  background: rgba(232, 155, 12, 0.16);
  color: #6b4200;
}

.status-pill.status-inprogress {
  background: #FEF3C7;
  color: #92400E;
}

.status-pill.status-completed {
  background: rgba(46, 125, 50, 0.14);
  color: var(--color-success);
}

.status-pill.status-danger {
  background: rgba(200, 62, 62, 0.14);
  color: var(--color-danger);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: rgba(47, 107, 79, 0.12);
  color: var(--color-primary);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
}

.btn svg,
.icon-button svg,
.nav-link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.btn:hover,
.btn:focus-visible {
  filter: brightness(0.98);
  outline: 2px solid rgba(47, 107, 79, 0.18);
  outline-offset: 2px;
}

.btn-primary,
.btn-success {
  border-color: rgba(47, 107, 79, 0.22);
  background: rgba(47, 107, 79, 0.12);
  color: var(--color-primary);
}

.btn-primary:hover,
.btn-success:hover {
  background: rgba(47, 107, 79, 0.18);
}

.btn-info,
.btn-secondary {
  border-color: var(--color-border);
  background: #F8FAFC;
  color: var(--color-text);
}

.btn.btn-view,
a.btn.btn-view,
button.btn.btn-view {
  border-color: rgba(5, 150, 105, 0.24);
  background: rgba(5, 150, 105, 0.14);
  color: #047857;
}

.btn.btn-view:hover,
a.btn.btn-view:hover,
button.btn.btn-view:hover {
  background: rgba(5, 150, 105, 0.22);
}

.btn.btn-update,
a.btn.btn-update,
button.btn.btn-update {
  border-color: rgba(8, 145, 178, 0.24);
  background: rgba(8, 145, 178, 0.14);
  color: #0E7490;
}

.btn.btn-update:hover,
a.btn.btn-update:hover,
button.btn.btn-update:hover {
  background: rgba(8, 145, 178, 0.22);
}

.btn.btn-assign,
a.btn.btn-assign,
button.btn.btn-assign {
  border-color: rgba(109, 40, 217, 0.22);
  background: rgba(109, 40, 217, 0.12);
  color: #6D28D9;
}

.btn.btn-assign:hover,
a.btn.btn-assign:hover,
button.btn.btn-assign:hover {
  background: rgba(109, 40, 217, 0.18);
}

.btn.btn-delete,
a.btn.btn-delete,
button.btn.btn-delete,
.btn.btn-cancel,
a.btn.btn-cancel,
button.btn.btn-cancel,
.btn.btn-danger,
a.btn.btn-danger,
button.btn.btn-danger {
  border-color: rgba(180, 35, 24, 0.22);
  background: rgba(180, 35, 24, 0.12);
  color: #B42318;
}

.btn.btn-delete:hover,
a.btn.btn-delete:hover,
button.btn.btn-delete:hover,
.btn.btn-cancel:hover,
a.btn.btn-cancel:hover,
button.btn.btn-cancel:hover,
.btn.btn-danger:hover,
a.btn.btn-danger:hover,
button.btn.btn-danger:hover {
  background: rgba(180, 35, 24, 0.18);
}

.btn-warning {
  border-color: rgba(232, 155, 12, 0.24);
  background: rgba(232, 155, 12, 0.16);
  color: #6b4200;
}

.btn-warning:hover {
  background: rgba(232, 155, 12, 0.24);
}

.btn-icon-action {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  gap: 0;
}

.btn-icon-action svg {
  width: 17px;
  height: 17px;
}

.btn-icon-action .btn-label {
  display: none;
}

.btn-block {
  width: 100%;
}

.btn.disabled,
.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 35;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -8px 24px rgba(32, 35, 38, 0.10);
}

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

.bottom-nav a {
  display: grid;
  width: 100%;
  min-height: 48px;
  place-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.push-enable-button {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.push-enable-button[hidden] {
  display: none;
}

.bottom-nav a:hover,
.bottom-nav a:focus-visible {
  background: rgba(47, 107, 79, 0.10);
  color: var(--color-primary);
  outline: none;
}

.form-panel {
  width: min(100%, 980px);
  padding: 18px;
}

.form-grid {
  display: grid;
  gap: 14px 16px;
}

.form-group,
.form-row {
  position: relative;
  display: grid;
  gap: 7px;
  margin: 0;
  align-content: start;
}

.form-group:focus-within,
.form-row:focus-within,
.form-group.selectize-open,
.form-row.selectize-open {
  z-index: 2000;
}

.form-group label,
.form-row label,
.form-label,
label.col-form-label,
.l1 {
  color: var(--color-text);
  font-size: 0.82rem;
  font-weight: 700;
}

.form-control,
.form-control-plaintext,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-text);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 20px;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(47, 107, 79, 0.55);
  box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.12);
  outline: none;
}

textarea.form-control,
textarea {
  height: auto;
  min-height: 104px;
  resize: vertical;
}

.form-control-plaintext,
input[readonly],
textarea[readonly],
input:disabled,
textarea:disabled,
select:disabled {
  background: #f7f7f4;
  color: var(--color-muted);
  cursor: not-allowed;
  opacity: 1;
}

.selectize-control,
.form-panel .selectize-control,
.filter-panel .selectize-control {
  position: relative;
  width: 100%;
}

.selectize-control.dropdown-active {
  z-index: 2000;
}

.selectize-control.form-control,
.form-panel .selectize-control.form-control,
.filter-panel .selectize-control.form-control,
.form-panel .selectize-control.single,
.filter-panel .selectize-control.single {
  min-height: 0;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.selectize-control.single .selectize-input,
.selectize-input {
  display: flex !important;
  align-items: center;
  height: 40px;
  min-height: 40px;
  padding: 9px 34px 9px 11px !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius) !important;
  background: #fff !important;
  box-shadow: none !important;
  color: var(--color-text);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 20px !important;
}

.selectize-input > input {
  height: 20px !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--color-text) !important;
  font-size: 0.92rem !important;
  line-height: 20px !important;
}

.form-panel .selectize-control.single .selectize-input,
.filter-panel .selectize-control.single .selectize-input,
.form-panel .selectize-input,
.filter-panel .selectize-input {
  border: 1px solid var(--color-border) !important;
  box-shadow: none !important;
}

.selectize-control.single .selectize-input.focus,
.selectize-input.focus {
  border-color: rgba(47, 107, 79, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.12) !important;
}

.selectize-control.disabled .selectize-input,
.selectize-input.disabled {
  background: #f7f7f4 !important;
  color: var(--color-muted) !important;
  cursor: not-allowed !important;
}

.selectize-dropdown {
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  border-color: var(--color-border) !important;
  border-radius: var(--radius) !important;
  background: #fff !important;
  box-shadow: var(--shadow-small);
  overflow: hidden !important;
  z-index: 3000 !important;
}

.selectize-dropdown.form-control {
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
}

.selectize-dropdown-content {
  max-height: 232px !important;
  padding: 4px !important;
}

.selectize-dropdown .option {
  display: block;
  min-height: 36px;
  padding: 8px 10px !important;
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.25;
  white-space: normal;
}

.selectize-dropdown .option.active,
.selectize-dropdown .option:hover {
  background: rgba(47, 107, 79, 0.12) !important;
}

.filter-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px 14px;
  align-items: start;
}

.filter-actions-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding-top: 2px;
}

.filter-actions-bar .action-row {
  gap: 8px;
}

.filter-submit-group {
  align-self: end;
}

.filter-row .btn,
.filter-panel > .action-row .btn,
.filter-actions-bar .btn {
  min-width: 0;
  min-height: 38px;
  padding: 8px 11px;
  font-size: 0.86rem;
}

.alert {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-text);
  font-weight: 600;
}

.alert-success {
  border-color: rgba(46, 125, 50, 0.28);
  background: rgba(46, 125, 50, 0.10);
  color: var(--color-success);
}

.alert-danger {
  border-color: rgba(200, 62, 62, 0.28);
  background: rgba(200, 62, 62, 0.10);
  color: var(--color-danger);
}

.alert-warning {
  border-color: rgba(232, 155, 12, 0.32);
  background: rgba(232, 155, 12, 0.12);
  color: #92400E;
}

.empty-state {
  padding: 28px 16px;
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.empty-state p,
.muted {
  color: var(--color-muted);
}

.help-text {
  font-size: 0.85rem;
}

.help-text ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.help-text li {
  margin-bottom: 4px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.page-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  padding: 8px 12px;
  color: var(--color-text);
  font-weight: 600;
}

.page-item.disabled .page-link {
  color: var(--color-muted);
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: none;
  padding: 18px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.48);
}

.app-modal.is-open,
.modal.is-open {
  display: grid;
  place-items: start center;
  animation: modal-backdrop-in 160ms ease-out both;
}

.modal-panel,
.modal-content {
  width: min(100%, 860px);
  margin: 24px auto;
  padding: 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.app-modal.is-open .modal-panel,
.modal.is-open .modal-content {
  animation: modal-panel-in 180ms ease-out both;
}

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

.modal-title {
  margin: 0;
  color: var(--color-primary);
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-title-danger {
  color: var(--color-danger);
}

.modal-title-warning {
  color: #92400E;
}

.error-list {
  margin: 0 0 14px;
  padding-left: 20px;
  color: var(--color-danger);
  font-weight: 600;
}

.error-list li {
  margin-bottom: 6px;
}

.modal-foot {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.btn-solid-primary {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

.btn-solid-primary:hover {
  filter: brightness(0.95);
}

.modal-head .icon-button,
.sidebar-head .icon-button {
  border: 1px solid var(--color-border);
  background: #F8FAFC;
  color: var(--color-text);
}

.modal-head .icon-button:hover,
.modal-head .icon-button:focus-visible,
.sidebar-head .icon-button:hover,
.sidebar-head .icon-button:focus-visible {
  background: #EEF2F7;
  outline: 2px solid rgba(47, 107, 79, 0.18);
}

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

.detail-row {
  display: grid;
  gap: 3px;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border);
}

.detail-row dt {
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-row dd {
  margin: 0;
  color: var(--color-text);
  font-size: 0.98rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.detail-row-status {
  border-bottom-color: rgba(37, 99, 235, 0.22);
}

.detail-row-status dt {
  color: #1D4ED8;
}

.detail-row-status.status-submitted {
  border-bottom-color: rgba(232, 155, 12, 0.35);
}

.detail-row-status.status-submitted dt {
  color: #8A5200;
}

.detail-row-status.status-assigned {
  border-bottom-color: rgba(37, 99, 235, 0.22);
}

.detail-row-status.status-assigned dt {
  color: #1D4ED8;
}

.detail-row-status.status-inprogress {
  border-bottom-color: rgba(217, 158, 11, 0.35);
}

.detail-row-status.status-inprogress dt {
  color: #92400E;
}

.detail-row-status.status-completed {
  border-bottom-color: rgba(46, 125, 50, 0.35);
}

.detail-row-status.status-completed dt {
  color: var(--color-success);
}

.status-text {
  color: #1D4ED8;
  font-weight: 800;
}

.status-text.status-assigned {
  color: #1D4ED8;
}

.status-text.status-submitted {
  color: #8A5200;
}

.status-text.status-inprogress {
  color: #92400E;
}

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

@keyframes modal-backdrop-in {
  from {
    background: rgba(0, 0, 0, 0);
  }
  to {
    background: rgba(0, 0, 0, 0.48);
  }
}

@keyframes modal-panel-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.desktop-table {
  display: none;
}

/* Excel exports are for desktop only; on phones the admin screens are view
   only. .desktop-only is hidden below the desktop breakpoint, and a
   .mobile-only note says where to export instead. */
@media (max-width: 959px) {
  .desktop-only {
    display: none !important;
  }
}

@media (min-width: 960px) {
  .mobile-only {
    display: none !important;
  }
}

.desktop-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--color-muted);
  font-size: 0.84rem;
}

.desktop-hint svg {
  flex: none;
  width: 16px;
  height: 16px;
}

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

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

.table th {
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.table tbody tr {
  transition: background-color 120ms ease;
}

.table tbody tr:hover {
  background-color: rgba(47, 107, 79, 0.06);
}

.table .action-row {
  flex-wrap: nowrap;
  gap: 6px;
}

.table .btn {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.table .btn-icon-action {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
}

.table .btn svg {
  width: 16px;
  height: 16px;
}

.table-responsive {
  overflow-x: auto;
}

/* The login page is exactly as tall as the visible screen, measured as 100% of
   the page rather than with vh/dvh units. In the installed Android app (PWA)
   100dvh can come out taller than the screen, so the page scrolled a little
   even though the card fit. 100% is always the real visible height, in the
   browser (toolbars shown) and in the installed app. */
html:has(> body.login-page) {
  height: 100%;
}

.login-page {
  /* Grid, so the shell stretches to the full height. */
  display: grid;
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(47, 107, 79, 0.10) 0 25%, transparent 25% 100%),
    linear-gradient(315deg, rgba(37, 42, 46, 0.08) 0 22%, transparent 22% 100%),
    #F4F3EF;
}

.login-shell {
  position: relative;
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
}

.login-shell::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(47, 107, 79, 0.10);
  border-radius: 22px;
  pointer-events: none;
}

.login-card {
  position: relative;
  width: min(100%, 400px);
  border: 1px solid rgba(47, 107, 79, 0.18);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 30px 82px rgba(32, 35, 38, 0.26),
    0 12px 32px rgba(47, 107, 79, 0.16);
}

.login-illustration {
  display: block;
}

/* Shorter on short screens so the whole card fits without scrolling. */
.login-illustration img {
  display: block;
  width: 100%;
  height: clamp(140px, 28vh, 260px);
  height: clamp(140px, 28dvh, 260px);
  object-fit: cover;
}

.login-panel {
  position: relative;
  padding: 22px 20px 20px;
  border: 0;
  border-radius: 0 0 18px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.98)),
    #fff;
  text-align: center;
}

.login-panel::before {
  content: "";
  position: absolute;
  top: 0;
  right: 22px;
  left: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(47, 107, 79, 0.35), transparent);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 clamp(16px, 3vh, 28px);
  padding: 10px 12px;
  border: 1px solid rgba(47, 107, 79, 0.16);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(47, 107, 79, 0.08), rgba(22, 128, 106, 0.03)),
    #fff;
  box-shadow:
    0 14px 30px rgba(47, 107, 79, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.login-brand-logo {
  flex: 0 0 84px;
  width: 84px;
  height: 60px;
  object-fit: contain;
}

.login-title {
  margin: 0;
  color: var(--color-primary);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.12;
  text-align: left;
}

.login-title span {
  display: block;
}

.login-title strong {
  color: #111827;
  font-weight: 900;
}

.login-form {
  display: grid;
  gap: 14px;
  text-align: left;
}

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

.login-field {
  position: relative;
}

.login-field svg {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 19px;
  height: 19px;
  color: #6B706F;
  transform: translateY(-50%);
  pointer-events: none;
}

.login-form .login-field input {
  width: 100%;
  height: 46px;
  padding: 11px 18px 11px 48px;
  border: 1px solid rgba(107, 112, 111, 0.26);
  border-radius: 14px;
  background: #F8FAFC;
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 650;
  box-shadow:
    inset 0 1px 2px rgba(32, 35, 38, 0.05),
    0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.login-form input::placeholder {
  color: var(--color-muted);
}

.login-form .login-field:focus-within svg {
  color: var(--color-primary);
}

.login-form .login-field input:focus {
  border-color: var(--color-primary);
  background: #fff;
  box-shadow:
    0 0 0 4px rgba(47, 107, 79, 0.13),
    0 10px 22px rgba(47, 107, 79, 0.10);
  outline: none;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--color-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.remember-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

/* The installed app always remembers the session (app.js ticks the box), so
   the choice is hidden there; the media query avoids a flash before JS runs. */
.remember-row[hidden] {
  display: none;
}

@media (display-mode: standalone) {
  .remember-row {
    display: none;
  }
}

.login-form .btn-solid-primary {
  margin-top: 4px;
  border: 1px solid var(--color-primary);
  border-radius: 14px;
  background:
    linear-gradient(135deg, #2F6B4F, #16806A),
    var(--color-primary);
  box-shadow:
    0 15px 30px rgba(47, 107, 79, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.login-form .btn-solid-primary:hover,
.login-form .btn-solid-primary:focus-visible {
  transform: translateY(-1px);
  box-shadow:
    0 18px 34px rgba(47, 107, 79, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.login-form .btn-solid-primary:active {
  transform: translateY(0);
}

.login-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(107, 112, 111, 0.18);
  color: #98A2B3;
  font-size: 0.82rem;
  font-weight: 400;
  text-align: center;
}

@media (max-width: 420px) {
  .login-brand {
    gap: 10px;
    padding: 10px;
  }

  .login-brand-logo {
    flex-basis: 82px;
    width: 82px;
    height: 60px;
  }

  .login-title {
    font-size: 1.05rem;
  }
}

@media (min-width: 1100px) {
  .login-page {
    background:
      linear-gradient(135deg, rgba(47, 107, 79, 0.08) 0 28%, transparent 28% 100%),
      linear-gradient(315deg, rgba(37, 42, 46, 0.07) 0 24%, transparent 24% 100%),
      #F7F7F4;
  }

  .login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(440px, 1fr);
    place-items: stretch;
    padding: 0;
  }

  .login-shell::before {
    inset: 18px;
  }

  .login-card {
    display: contents;
  }

  /* Out of the flow: the picture fills its column at whatever height the page
     is, instead of setting that height from its own proportions. */
  .login-illustration {
    position: relative;
    min-height: 0;
    overflow: hidden;
  }

  .login-illustration img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .login-panel {
    display: grid;
    align-content: center;
    align-self: center;
    justify-self: center;
    width: calc(100% - 64px);
    max-width: 420px;
    margin: 24px 32px;
    padding: clamp(22px, 4.5vh, 40px) 34px;
    border: 1px solid rgba(47, 107, 79, 0.18);
    border-radius: 18px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.98)),
      #fff;
    box-shadow:
      0 32px 88px rgba(32, 35, 38, 0.27),
      0 14px 36px rgba(47, 107, 79, 0.17);
    text-align: left;
  }

  .login-brand {
    margin-bottom: clamp(16px, 3.4vh, 30px);
  }

  .login-title {
    font-size: 1.3rem;
  }

  .login-form {
    gap: clamp(12px, 2vh, 18px);
  }

  .login-form .login-field input {
    height: clamp(42px, 6vh, 48px);
  }

  .login-footer {
    margin-top: clamp(16px, 3vh, 28px);
    padding-top: clamp(12px, 2vh, 18px);
  }

  .login-form .form-group label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }
}

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

/* Compatibility for templates still being converted. */
.container,
.w3-container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -8px;
}

[class*="col-"] {
  width: 100%;
  padding: 0 8px;
}

.w3-btn,
.w3-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.w3-green {
  background: var(--color-primary);
  color: #fff;
}

.w3-white {
  background: #fff;
}

.w3-round-large {
  border-radius: var(--radius);
}

.w3-border,
.w3-border-blue {
  border-color: var(--color-border) !important;
}

@media (max-width: 959px) {
  .mobile-only-list .btn-icon-action {
    width: auto;
    min-width: 0;
    height: 42px;
    min-height: 42px;
    padding: 9px 12px;
    gap: 7px;
  }

  .mobile-only-list .btn-icon-action .btn-label {
    display: inline;
  }

  .mobile-only-list .btn-icon-action svg {
    width: 17px;
    height: 17px;
  }
}

@media (min-width: 640px) {
  .app-main {
    padding: 24px 22px 96px;
  }

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

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

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

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

  .control-search-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

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

  .form-grid > .alert,
  .form-grid > .action-row,
  .form-grid > .form-group:has(textarea) {
    grid-column: 1 / -1;
  }

  .form-grid.form-grid-single {
    grid-template-columns: 1fr;
  }

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

  .col-sm-6 {
    width: 50%;
  }

  .col-sm-8 {
    width: 66.6667%;
  }

  .col-sm-4 {
    width: 33.3333%;
  }
}

@media (min-width: 960px) {
  .app-shell {
    display: grid;
    /* minmax(0, ...) lets the content column shrink to the window, so a wide
       table scrolls inside its card instead of widening the whole page. */
    grid-template-columns: 284px minmax(0, 1fr);
  }

  .app-header {
    grid-column: 1 / -1;
    padding-right: 24px;
    padding-left: 24px;
  }

  .app-brand-title {
    display: block;
    font-size: 0.96rem;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-brand-title span {
    display: inline;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .app-sidebar {
    position: sticky;
    top: var(--header-height);
    z-index: 20;
    width: 284px;
    height: calc(100vh - var(--header-height));
    transform: none;
    box-shadow: none;
  }

  .app-main {
    max-width: none;
    padding: 28px 28px 40px;
  }

  .app-overlay,
  .app-sidebar .icon-button,
  .bottom-nav,
  [data-nav-open] {
    display: none;
  }

  .page-header {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .page-header-main {
    min-width: 0;
  }

  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .email-config-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .trip-card {
    padding: 16px;
  }

  .trip-meta {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .desktop-table {
    display: block;
  }

  .mobile-only-list {
    display: none;
  }

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

/* Trip Editor (restricted correction console) */
.trip-editor-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  border-left: 4px solid var(--color-primary);
}

.trip-editor-card-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1 1 320px;
}

.trip-editor-card h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.trip-editor-card p {
  margin: 0;
}

.trip-editor-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: rgba(47, 107, 79, 0.12);
  color: var(--color-primary);
}

.trip-editor-icon svg {
  width: 20px;
  height: 20px;
}

.status-pill svg {
  width: 13px;
  height: 13px;
  margin-right: 4px;
}

.pill-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.trip-editor-notice {
  width: min(100%, 980px);
}

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

.trip-editor-history {
  width: min(100%, 980px);
  margin-top: 18px;
}

.trip-list + nav + .trip-editor-history,
.desktop-table + .trip-editor-history {
  width: auto;
}

.edit-log-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 14px;
  list-style: none;
}

.edit-log-entry {
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.edit-log-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
}

.edit-log-reason {
  margin: 6px 0 8px;
  white-space: pre-line;
}

.edit-log-changes {
  margin: 0;
}

.edit-log-empty {
  margin: 0;
  padding: 14px;
}

@media (min-width: 640px) {
  .form-grid > .trip-editor-reason {
    grid-column: 1 / -1;
  }
}

@media (min-width: 960px) {
  .trip-editor-search {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
  }
}
