:root {
  --bg: #eef3f8;
  --paper: #fff;
  --panel: #f6f9fd;
  --line: #cfd7e2;
  --line-dark: #aeb8c6;
  --text: #18212f;
  --muted: #5f6b7a;
  --accent: #1f63d1;
  --accent-soft: #eaf2ff;
  --success: #177245;
  --success-soft: #eaf8f0;
  --danger: #a91e16;
  --danger-soft: #fff0ee;
  --warning: #9a5b00;
  --warning-soft: #fff6df;
  --shadow: 0 2px 12px rgba(23, 34, 50, .08);
  --card-shadow: 0 1px 7px rgba(29, 45, 68, .06);
  --request-column-gap: 22px;
  --request-date-width: 190px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

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

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

button,
.btn {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 13px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  background: #f4f7fa;
  color: #263445;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

input,
select,
textarea {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  padding: 8px 11px;
  background: #fff;
  color: var(--text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0;
}

input::placeholder,
textarea::placeholder {
  color: #7d8998;
  font-weight: 400;
  opacity: 1;
}

select { font-weight: 400; }
textarea { min-height: 86px; resize: vertical; }

button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus,
tr[tabindex]:focus,
.day-cell:focus {
  outline: 3px solid rgba(31, 99, 209, .22);
  outline-offset: 2px;
}

p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.hidden { display: none !important; }

.app-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-family: Arial, Helvetica, sans-serif;
}

.app-nav-inner {
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: 9px 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
}

.brand {
  font-size: 22px;
  font-weight: 900;
  white-space: nowrap;
}

.section-tabs {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow: hidden;
}

.section-tab {
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #304057;
  font-weight: 700;
  white-space: nowrap;
}

.section-tab:hover,
.section-tab.active {
  background: var(--accent-soft);
  border-color: #a8c7fb;
  color: #114da5;
}

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

.logout-form { margin: 0; }

.logout-button {
  min-height: 38px;
  padding: 7px 10px;
  background: #f8fafc;
  font-size: 15px;
}

.user-pill {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: #304057;
  font-weight: 700;
  white-space: nowrap;
}

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

.btn-success,
button.btn-success {
  background: var(--success-soft);
  border-color: #bce7cf;
  color: var(--success);
}

.btn-danger,
button.btn-danger {
  background: var(--danger-soft);
  border-color: #f2b8b3;
  color: var(--danger);
}

.btn-small,
button.btn-small {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 14px;
}

.page {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 10px 12px 24px;
}

.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.message {
  border-radius: 7px;
  padding: 10px 12px;
  font-weight: 700;
}

.message.success {
  background: var(--success-soft);
  color: var(--success);
}

.message.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.message.error,
.message.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.errorlist {
  margin: 6px 0 0;
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
  list-style: none;
}

.status {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.status.active { background: var(--accent-soft); color: #114da5; }
.status.done { background: var(--success-soft); color: var(--success); }
.status.cancelled { background: var(--danger-soft); color: var(--danger); }
.status.warning { background: var(--warning-soft); color: var(--warning); }

.topbar {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  margin-bottom: 10px;
  font-family: Arial, Helvetica, sans-serif;
}

.topbar-inner {
  padding: 9px 12px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.screen-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  white-space: nowrap;
}

.mode-bar,
.date-tools,
.date-mode-tools,
.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.mode-bar {
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.date-tools { justify-self: start; }

.mode-btn,
.seg-btn,
.filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: #263445;
  white-space: nowrap;
}

.mode-btn {
  min-height: 42px;
  padding: 9px 12px;
  font-size: 16px;
  font-weight: 700;
}

.mode-btn.active,
.seg-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.date-input { width: 200px; }

.topbar input {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: normal;
  padding: 8px 10px;
}

.period-toggle.active {
  background: var(--accent-soft);
  border-color: #a8c7fb;
  color: #114da5;
}

.period-edit-tools {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 6px;
}

.period-edit-tools label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.period-edit-tools input { width: 158px; }

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(400px, 540px);
  gap: 18px;
  align-items: end;
  margin-bottom: 10px;
}

.filter-group {
  display: grid;
  gap: 6px;
}

.filter-buttons {
  overflow: visible;
  padding-bottom: 0;
}

.filter-btn {
  min-height: 36px;
  padding: 7px 9px;
  background: #f8fafc;
  font-size: 14px;
  font-weight: 700;
}

.filter-btn.active {
  background: var(--accent-soft);
  border-color: #a8c7fb;
  color: #114da5;
}

.search-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  align-self: end;
}

.search-wrap label {
  color: #172337;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.board {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: calc(100vh - 232px);
  box-shadow: var(--shadow);
  scrollbar-gutter: stable;
}

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

thead {
  background: #e9eef5;
  color: #354255;
}

th {
  padding: 10px 11px;
  text-align: left;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-dark);
}

.board th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #e9eef5;
}

.board .journal-center {
  text-align: center;
}

td {
  padding: 11px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover:not(.return-highlight):not(.selected) {
  background: #f0f6ff;
}

.attention-row { background: var(--warning-soft); }
tbody tr.return-highlight,
tbody tr.selected {
  background: #dbeafe;
  box-shadow: inset 7px 0 0 var(--accent), inset 0 0 0 2px rgba(31, 99, 209, .62);
}

tbody tr.return-highlight:hover,
tbody tr.return-highlight:hover td,
tbody tr.selected:hover,
tbody tr.selected:hover td {
  background: #dbeafe;
}

tbody tr.return-highlight td,
tbody tr.selected td {
  background: #dbeafe;
  border-top: 1px solid rgba(31, 99, 209, .45);
  border-bottom: 1px solid rgba(31, 99, 209, .45);
}

tbody tr.return-highlight .time,
tbody tr.return-highlight .strong,
tbody tr.selected .time,
tbody tr.selected .strong {
  color: #073b8e;
  font-weight: 900;
}

tbody tr[data-request-id],
tbody tr[data-directory-row] {
  cursor: pointer;
}
.time { font-size: 16px; font-weight: 800; white-space: nowrap; }
.strong { font-weight: 800; }
.subtext { color: var(--muted); font-size: 14px; margin-top: 3px; font-weight: 700; }

.driver-missing-text {
  display: inline-block;
  border: 1px solid #f1d08a;
  border-radius: 7px;
  padding: 6px 8px;
  background: var(--warning-soft);
  color: var(--warning);
  font-weight: 800;
}

.warning-text { color: var(--warning); }
.money { font-weight: 800; white-space: nowrap; }

.board td.journal-center .money {
  margin-bottom: 6px;
}

.payment {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.payment.unpaid {
  background: var(--warning-soft);
  border: 1px solid #f1d08a;
  color: var(--warning);
}

.payment.paid {
  background: var(--success-soft);
  border: 1px solid #bce7cf;
  color: var(--success);
}

.payment.neutral {
  background: #edf1f5;
  border: 1px solid var(--line);
  color: #354255;
}

.empty,
.empty-state {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.mobile-cards { display: none; }
.card-list { display: grid; gap: 10px; }

.request-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 5px solid #b8c2d0;
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.request-card.attention,
.request-card.attention-row { border-left-color: #d18b00; }

.request-card.return-highlight {
  background: #f4f8ff;
  border-color: #7db0fb;
  border-left-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 99, 209, .18), var(--shadow);
}

.request-card.selected {
  background: #f4f8ff;
  border-color: #7db0fb;
  border-left-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 99, 209, .18), var(--shadow);
}

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

.card-row { margin: 7px 0; font-weight: 700; }
.card-label, .card-row span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; margin-bottom: 2px; }

.request-paper {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.paper-header {
  position: sticky;
  top: 57px;
  z-index: 30;
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr);
  grid-template-areas: "back title meta actions";
  gap: 16px;
  align-items: center;
  padding: 13px 16px;
  border: 1px solid #d5dde8;
  border-radius: 8px 8px 0 0;
  background: #fff;
  box-shadow: 0 2px 10px rgba(23, 34, 50, .08);
  overflow: visible;
}

.back-list-btn { grid-area: back; }

.request-title-line {
  grid-area: title;
  min-height: 44px;
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  align-items: center;
  white-space: nowrap;
}

.request-title { font-size: 20px; font-weight: 800; }

.created-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  margin-left: 12px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-weight: 700;
}

.created-meta label {
  color: #4f5d6e;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.created-meta input,
.paper-actions button,
.back-list-btn {
  height: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.paper-header button { padding-left: 10px; padding-right: 10px; }
.created-meta input { width: auto; }
.created-date-input { width: 100%; }
.created-time-input { width: 104px; }

.paper-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  margin-left: 12px;
}

.request-save-state {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 112px;
  width: 112px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f4f7fa;
  color: #4f5d6e;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.request-save-state.dirty {
  border-color: #f1d08a;
  background: var(--warning-soft);
  color: var(--warning);
}

.request-save-state.saved {
  border-color: #bce7cf;
  background: var(--success-soft);
  color: var(--success);
}

.status-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 318px;
  width: 318px;
  gap: 6px;
  margin-left: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.paper-grid {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 18px 14px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.paper-section {
  border: 1px solid #d5dee9;
  border-radius: 12px;
  padding: 20px 22px 22px;
  background: #fff;
  box-shadow: var(--card-shadow);
}

.paper-section.full { grid-column: 1 / -1; }
.dispatcher-comments-wrap { padding-top: 0; }
.dispatcher-comment-list { list-style: none; padding: 0; margin: 18px 0; }
.dispatcher-comment { padding: 14px 0; border-bottom: 1px solid var(--line); }
.dispatcher-comment-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.dispatcher-comment-meta time { color: var(--text-secondary); font-size: 15px; }
.dispatcher-comment-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; }
.dispatcher-comment-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; }
.dispatcher-comment-actions .dispatcher-comment-error { color: #a32121; }
.paper-section.primary-zone,
.paper-section.driver-zone {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.paper-section.quiet-zone { background: #fff; }

.section-title {
  margin: 0 0 20px;
  color: #0f1f34;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.primary-zone > .section-title,
.driver-zone > .section-title {
  margin-left: 22px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 16px 18px;
  align-items: start;
}

.client-grid {
  --client-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 158px) minmax(0, 150px) minmax(0, 228px) minmax(0, 242px);
  width: 100%;
  grid-template-columns: var(--client-columns);
}

.client-price-control input {
  text-align: right;
}

.field-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 700;
}

.form-control {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #253449;
  font-weight: 400;
}

.form-control span,
.field-label {
  display: block;
  min-height: 18px;
  line-height: 1.25;
  color: #172337;
  font-size: 16px;
  font-weight: 700;
}

.form-control input,
.form-control select,
.form-control textarea {
  font-weight: 400;
}

.form-control input:disabled,
.form-control select:disabled,
.form-control textarea:disabled {
  background: #f1f4f8;
  color: #657286;
  cursor: not-allowed;
}

.large-check,
.choice-pill,
.check-line,
.delete-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: #263445;
}

.large-check,
.choice-pill,
.payment-line .check-line {
  min-height: 46px;
  border: 1px solid var(--line-dark);
  border-radius: 7px;
  background: #fff;
  padding: 8px 12px;
  white-space: nowrap;
}

.large-check input,
.choice-pill input,
.check-line input,
.delete-check input {
  width: auto;
  min-height: auto;
  transform: scale(1.25);
  accent-color: var(--accent);
}

.trip-layout {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: var(--request-column-gap);
  align-items: start;
  min-width: 0;
}

.trip-layout > *,
.driver-finance-layout > * {
  min-width: 0;
}

.trip-subgrid {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.trip-main-panel {
  border: 1px solid #d5dee9;
  border-radius: 12px;
  background: #fff;
  padding: 20px 22px;
  box-shadow: var(--card-shadow);
  display: grid;
  grid-template-columns:
    var(--request-date-width)
    minmax(0, .95fr)
    minmax(0, .9fr)
    minmax(0, .95fr);
  gap: 16px;
  min-width: 0;
}

.trip-field-pair {
  display: grid;
  gap: 7px;
  align-items: start;
  min-width: 0;
}

.trip-field-pair label,
.trip-field-pair .field-label {
  color: #172337;
  font-size: 16px;
  font-weight: 700;
  white-space: normal;
  line-height: 1.25;
}

.trip-rate-row { grid-column: 1 / -1; }

.hourly-row {
  display: grid;
  grid-template-columns: auto 128px minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.hours-field {
  display: grid;
  grid-template-columns: 62px 58px;
  gap: 7px;
  align-items: center;
}

.hours-field label {
  color: #344256;
  font-weight: 700;
}

.hours-field.inactive {
  opacity: .55;
}

.hours-field.inactive input {
  background: #f1f4f8;
  color: var(--muted);
}

.subsection-title {
  margin: 0 0 14px;
  color: #172337;
  font-size: 17px;
  font-weight: 700;
  text-transform: none;
}

.route-panel,
.passenger-panel,
.flight-panel,
.note-panel,
.client-price-panel,
.driver-assign-panel,
.settlement-panel {
  border: 1px solid #d5dee9;
  border-radius: 12px;
  background: #fff;
  padding: 20px 22px;
  box-shadow: var(--card-shadow);
  min-width: 0;
}

.route-list { display: grid; gap: 14px; }

.route-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.route-label {
  color: #172337;
  font-size: 16px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.route-step {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: #114da5;
  font-weight: 900;
}

.meeting-controls {
  display: grid;
  gap: 8px;
}

.meeting-row {
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(260px, 1fr);
  align-items: center;
}

.meet-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.choice-pill {
  justify-content: center;
  cursor: pointer;
}

.choice-pill:has(input:checked) {
  background: var(--accent-soft);
  border-color: #8fb6f3;
  color: #114da5;
}

.meet-options.inactive {
  opacity: .55;
}

.meet-options.inactive .choice-pill {
  background: #f1f4f8;
  color: var(--muted);
  cursor: default;
}

.flight-grid {
  display: grid;
  grid-template-columns: 118px minmax(150px, .95fr) 118px minmax(252px, 1.55fr);
  gap: 14px;
  align-items: start;
}

.flight-panel.inactive {
  background: #f8fafc;
}

.flight-panel.inactive .flight-grid {
  opacity: .58;
}

.flight-panel.inactive input {
  background: #f1f4f8;
  color: var(--muted);
}

.flight-grid input {
  min-width: 0;
}

.flight-time-input {
  width: 100%;
}

.flight-hint {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.client-price-line {
  margin-top: 0;
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: end;
}

.driver-finance-layout {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: var(--request-column-gap);
  align-items: start;
  width: 100%;
  min-width: 0;
}

.driver-assign-panel .field-grid,
.settlement-panel .field-grid {
  grid-template-columns: 1fr;
}

.driver-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.driver-add-btn {
  min-height: 46px;
  padding-left: 14px;
  padding-right: 14px;
}

.finance-stack {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.settlement-panel {
  width: 100%;
  min-width: 0;
}

.driver-money-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}

.expense-list {
  display: contents;
}

.driver-money-row {
  display: grid;
  grid-column: 1;
  grid-template-columns: minmax(170px, 220px) minmax(0, 1fr) 132px 78px;
  gap: 10px 14px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.driver-money-label {
  color: #172337;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.driver-money-row > input,
.driver-money-amount {
  width: 100%;
  min-width: 0;
}

.driver-money-amount {
  grid-column: 3;
}

.driver-money-action {
  justify-self: end;
  width: auto;
  min-width: 0;
  padding-left: 10px;
  padding-right: 10px;
}

.driver-add-expense {
  grid-column: 1;
  justify-self: start;
}

.driver-money-divider {
  height: 1px;
  grid-column: 1;
  margin-top: 4px;
  background: #d8e1ec;
}

.driver-info {
  margin-top: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 10px 12px;
  color: #344256;
  font-weight: 700;
  line-height: 1.4;
}

.driver-info.missing {
  background: var(--warning-soft);
  border-color: #f1d08a;
  color: var(--warning);
}

.driver-whatsapp-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.whatsapp-btn {
  background: var(--success-soft);
  border-color: #bce7cf;
  color: var(--success);
}

.whatsapp-btn.disabled,
.whatsapp-btn[aria-disabled="true"] {
  background: #f1f4f8;
  border-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
  pointer-events: auto;
}

body.modal-open {
  overflow: hidden;
}

.quick-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.quick-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 33, 47, .42);
}

.quick-modal-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(23, 34, 50, .22);
  padding: 20px 22px;
}

.quick-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.quick-modal-head h2 {
  margin: 0 0 4px;
  font-size: 24px;
  line-height: 1.2;
}

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

.quick-modal-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.duplicate-panel {
  margin-bottom: 14px;
  border: 1px solid #f1d08a;
  border-radius: 8px;
  background: var(--warning-soft);
  color: var(--warning);
  padding: 12px;
}

.duplicate-panel > strong {
  display: block;
  margin-bottom: 4px;
  color: #744500;
}

.duplicate-list {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.duplicate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #ecc36c;
  border-radius: 7px;
  background: #fff;
  padding: 8px 10px;
}

.duplicate-row strong,
.duplicate-row span {
  display: block;
}

.duplicate-row span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.warning-panel,
.warning-box {
  margin-top: 10px;
  border: 1px solid #f1d08a;
  border-radius: 7px;
  background: var(--warning-soft);
  color: var(--warning);
  padding: 8px 10px;
  font-weight: 700;
}

.warning-panel {
  margin: 12px 14px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.driver-total-row {
  margin-top: 2px;
  border: 1px solid #b7c8df;
  border-radius: 7px;
  background: #f4f8ff;
  padding: 10px 0;
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(0, 1fr) 132px 78px;
  grid-template-areas: "label paid total spacer";
  gap: 10px 14px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.driver-total-label {
  grid-area: label;
  padding-left: 12px;
  color: #172337;
  font-size: 18px;
  font-weight: 800;
}

.driver-total-amount {
  grid-area: total;
  justify-self: stretch;
  color: #172337;
  box-sizing: border-box;
  padding-left: 12px;
  text-align: left;
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.payment-line {
  grid-area: paid;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.payment-line .check-line:has(input:checked) {
  border-color: #bce7cf;
  background: var(--success-soft);
  color: var(--success);
}

.payment-line .check-line:has(input:checked) input {
  accent-color: var(--success);
}

.form-delete-field {
  display: none;
}

.directory-shell,
.page-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  padding: 20px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.table-scroll .directory-table {
  min-width: 760px;
}

.report-table {
  min-width: 860px;
}

.report-filter {
  display: grid;
  grid-template-columns: minmax(140px, 170px) minmax(140px, 170px) minmax(140px, 170px) auto minmax(220px, 1fr) minmax(240px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}

.report-quick-days,
.report-filter-actions {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.report-quick-days {
  align-self: end;
}

.btn-compact,
button.btn-compact {
  min-height: 40px;
  padding: 8px 11px;
  font-size: 15px;
}

.directory-form-title {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.directory-form-title .btn {
  flex: 0 0 auto;
}

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

.backup-info {
  grid-template-columns: 180px 220px minmax(0, 1fr);
}

.backup-info .wide strong {
  font-size: 16px;
  line-height: 1.35;
  word-break: break-word;
}

.audit-table details {
  max-width: 520px;
}

.audit-table summary {
  cursor: pointer;
  font-weight: 800;
  color: #114da5;
}

.change-details {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  color: #344256;
}

.change-details div {
  display: grid;
  gap: 2px;
}

.security-summary,
.security-pagination,
.security-filter-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.security-summary {
  margin: 0 0 16px;
  color: var(--text-secondary);
}

.security-summary strong,
.security-summary b {
  color: var(--text-primary);
}

.security-filters {
  display: grid;
  grid-template-columns: minmax(125px, 160px) minmax(170px, 210px) minmax(180px, 1fr) minmax(160px, 210px) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.security-filter-actions {
  gap: 8px;
}

.security-table {
  min-width: 850px;
}

.security-nowrap {
  white-space: nowrap;
}

.security-pagination {
  justify-content: center;
  margin-top: 18px;
}

@media (max-width: 1150px) {
  .security-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .security-filters {
    grid-template-columns: minmax(0, 1fr);
  }
}

.directory-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.directory-tab {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: #263445;
  font-weight: 700;
}

.directory-tab.active {
  background: var(--accent-soft);
  border-color: #a8c7fb;
  color: #114da5;
}

.directory-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
}

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

.directory-table th {
  background: #e9eef5;
  color: #354255;
  font-weight: 900;
}

.report-table th,
.report-table td {
  text-align: center;
  padding-left: 16px;
  padding-right: 16px;
}

.directory-table td.money {
  text-align: right;
}

.report-table td.money {
  text-align: center;
}

.directory-form {
  display: grid;
  gap: 18px;
}

.contacts-panel {
  border: 1px solid #d5dee9;
  border-radius: 12px;
  background: #fff;
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
}

.settings-section {
  border: 1px solid #d5dee9;
  border-radius: 12px;
  background: #fff;
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
}

.settings-table {
  min-width: 980px;
}

.settings-user-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.settings-password-grid {
  grid-template-columns: repeat(2, minmax(220px, 360px));
}

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

.form-hint {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.contact-head,
.contact-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.15fr) minmax(140px, .9fr) minmax(160px, 1fr) minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.contact-head {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.contact-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.contact-field {
  display: contents;
}

.contact-field > span {
  display: none;
}

.contact-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

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

.login-shell {
  min-height: calc(100vh - 28px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 15px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 5px;
  margin-bottom: 6px;
  text-align: center;
}

.login-brand img {
  width: min(230px, 72%);
  height: auto;
  display: block;
  object-fit: contain;
  margin-bottom: 6px;
}

.login-brand h1 {
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.login-brand p {
  color: #4d5969;
  font-size: 19px;
  font-weight: 700;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: #172337;
  font-size: 16px;
  font-weight: 700;
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 50px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 36px;
  min-height: 34px;
  height: 34px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #526174;
}

.password-toggle:hover {
  background: var(--accent-soft);
  color: #114da5;
}

.password-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
  margin: 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.calendar-toolbar {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  padding: 11px 12px;
  margin-bottom: 10px;
}

.calendar-toolbar-inner {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.calendar-date-mode {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-date-mode > span {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.calendar-toolbar h1 {
  margin: 0 18px 0 0;
  font-size: 30px;
  line-height: 1.15;
  white-space: nowrap;
}

.segmented,
.month-tools,
.quick-tools,
.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.seg-btn,
.filter-row .filter-btn {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 15px;
  font-weight: 700;
}

.month-nav,
.month-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}

.month-nav strong {
  min-width: 160px;
  text-align: center;
  font-size: 18px;
}

.icon-btn {
  width: 44px;
  padding-left: 0;
  padding-right: 0;
  font-size: 20px;
}

.quick-tools { justify-self: end; }

.open-item {
  background: var(--warning-soft);
  border-color: #f1d08a;
  color: var(--warning);
}

.open-item.active {
  background: #fff1cc;
  border-color: #e2ad3a;
  box-shadow: 0 0 0 3px rgba(226, 173, 58, .18);
}

.filters-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  padding: 10px 12px;
  margin-bottom: 10px;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 12px;
  align-items: start;
}

.calendar-main { min-width: 0; }

.month-card,
.week-card,
.day-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
}

.month-card { padding: 10px; }
.week-card, .day-panel { padding: 14px; }

.weekday-row,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.weekday {
  padding: 9px 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #354255;
  font-weight: 900;
  text-align: center;
}

.day-cell {
  min-height: 116px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 5px rgba(29, 45, 68, .05);
}

.day-cell:hover {
  background: #f7fbff;
  border-color: #b8c7db;
}

.day-cell.muted {
  background: #fbfcfe;
  color: #7a8492;
}

.day-cell.today {
  box-shadow: inset 0 0 0 2px #a8c7fb;
}

.day-cell.selected {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 3px var(--accent);
}

.date-number {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 21px;
  font-weight: 900;
}

.today-mark {
  color: #114da5;
  font-size: 12px;
  font-weight: 900;
}

.day-count,
.mark {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  border-radius: 999px;
  font-weight: 900;
}

.day-count {
  min-height: 28px;
  padding: 4px 8px;
  background: var(--accent-soft);
  color: #114da5;
}

.day-marks {
  display: grid;
  gap: 5px;
  margin-top: auto;
}

.mark {
  min-height: 24px;
  padding: 3px 7px;
  font-size: 13px;
}

.mark.driver {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid #f1d08a;
}

.mark.pay {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #f2b8b3;
}

.mark.done {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid #bce7cf;
}

.week-head,
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.week-head h2,
.panel-head h2 {
  margin: 0 0 5px;
  font-size: 22px;
}

.week-list,
.request-list {
  display: grid;
  gap: 9px;
}

.week-day,
.request-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px;
  box-shadow: 0 1px 5px rgba(29, 45, 68, .05);
}

.day-panel .request-row {
  cursor: pointer;
}

.week-day {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
}

.week-day.selected {
  background: var(--accent-soft);
  border-color: #a8c7fb;
}

.week-date {
  font-size: 18px;
  font-weight: 900;
}

.week-meta {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.week-events {
  display: grid;
  gap: 7px;
}

.week-event {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  font-weight: 700;
}

.week-event.attention,
.request-row.attention {
  background: var(--warning-soft);
  border-color: #f1d08a;
}

.week-time,
.request-time {
  font-weight: 900;
}

.week-route {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-empty {
  min-height: 38px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
}

.day-panel {
  position: sticky;
  top: 76px;
  background: var(--paper);
}

.day-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.summary-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--panel);
}

.summary-tile strong {
  display: block;
  font-size: 22px;
}

.summary-tile span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.report-summary-grid .summary-tile {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
  white-space: nowrap;
}

.report-summary-grid .summary-tile strong {
  display: inline;
  flex: 0 0 auto;
}

.report-summary-grid .summary-tile span {
  flex: 0 1 auto;
}

.request-main {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.request-time-actions {
  display: grid;
  gap: 8px;
  justify-self: start;
  justify-items: center;
}

.request-route,
.request-driver {
  margin-top: 4px;
  color: #344256;
  font-weight: 700;
}

.request-driver.missing { color: var(--warning); }

.panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* V5 typography system: calm, readable hierarchy for the PostgreSQL MVP. */
:root {
  --font-family-ui: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-size-xs: 13px;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-md: 17px;
  --font-size-lg: 18px;
  --font-size-xl: 24px;
  --font-size-2xl: 26px;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.2;
  --line-height-normal: 1.4;
  --line-height-relaxed: 1.5;
  --text-primary: #1f2937;
  --text-secondary: #667085;
  --text-muted: #98a2b3;
  --text-heading: #172033;
  --text-link: #2459c4;
  --text-success: #16794b;
  --text-warning: #9a6700;
  --text-danger: #b42318;
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --success: var(--text-success);
  --warning: var(--text-warning);
  --danger: var(--text-danger);
}

body,
button,
.btn,
input,
select,
textarea {
  font-family: var(--font-family-ui);
}

body {
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
}

p {
  color: var(--text-secondary);
  font-weight: var(--font-weight-regular);
}

h1,
.screen-title,
.calendar-toolbar h1,
.page-head h1 {
  color: var(--text-heading);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
}

button,
.btn {
  color: #344054;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
}

.btn-primary,
button.btn-primary {
  color: #fff;
}

input,
select,
textarea {
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  font-weight: var(--font-weight-regular);
}

select {
  font-weight: var(--font-weight-regular);
}

.app-nav,
.topbar,
.topbar input {
  font-family: var(--font-family-ui);
}

.brand {
  color: var(--text-heading);
  font-size: 22px;
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
}

.section-tab,
.user-pill,
.logout-button {
  font-weight: var(--font-weight-semibold);
}

.section-tab {
  color: #344054;
  font-size: var(--font-size-base);
  line-height: 1.3;
}

.section-tab:hover,
.section-tab.active {
  color: var(--text-link);
}

.user-pill {
  color: #344054;
  font-size: 15px;
  line-height: 1.3;
}

.message,
.errorlist {
  font-weight: var(--font-weight-semibold);
}

.mode-bar,
.period-edit-tools label,
.search-wrap label,
.form-hint,
.contact-head,
.expense-head,
.flight-hint {
  color: #344054;
  font-size: 15px;
  font-weight: var(--font-weight-medium);
  line-height: 1.35;
}

.mode-btn,
.seg-btn,
.filter-row .filter-btn {
  color: #344054;
  font-size: 15px;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
}

.filter-btn,
.directory-tab,
.btn-compact,
button.btn-compact {
  color: #344054;
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-tight);
}

.filter-btn {
  font-size: var(--font-size-sm);
}

.filter-btn.active,
.directory-tab.active,
.mode-btn.active,
.seg-btn.active {
  color: var(--text-link);
  font-weight: var(--font-weight-semibold);
}

.mode-btn.active,
.seg-btn.active {
  color: #fff;
}

th,
.directory-table th,
.report-table th {
  color: #475467;
  font-size: 15px;
  font-weight: var(--font-weight-semibold);
  line-height: 1.3;
}

td,
.directory-table td,
.report-table td {
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
}

.board td {
  padding-top: 16px;
  padding-bottom: 16px;
}

tbody tr.return-highlight .time,
tbody tr.return-highlight .strong,
tbody tr.selected .time,
tbody tr.selected .strong {
  color: #073b8e;
  font-weight: var(--font-weight-semibold);
}

.time,
.week-time,
.request-time {
  color: var(--text-heading);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
}

.strong,
.week-route,
.request-title,
.request-row strong,
.duplicate-row strong {
  color: var(--text-heading);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: 1.35;
}

.subtext,
.duplicate-row span,
.driver-info,
.change-details,
.week-empty,
.request-route,
.request-driver {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  line-height: 1.45;
}

.money,
.directory-table td.money,
.report-table td.money {
  color: var(--text-heading);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: 1.3;
}

.payment,
.status,
.driver-missing-text,
.btn-small,
button.btn-small,
.request-save-state,
.card-label,
.card-row span,
.mark,
.today-mark {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
}

.status {
  font-weight: var(--font-weight-semibold);
}

.status.active {
  color: var(--text-link);
}

.status.done,
.payment.paid,
.mark.done {
  color: var(--text-success);
}

.status.cancelled,
.mark.pay {
  color: var(--text-danger);
}

.status.warning,
.payment.unpaid,
.driver-missing-text,
.mark.driver,
.open-item,
.request-driver.missing {
  color: var(--text-warning);
}

.payment.neutral {
  color: var(--text-secondary);
}

.card-row {
  font-weight: var(--font-weight-regular);
}

.card-label,
.card-row span {
  color: var(--text-secondary);
}

.paper-header,
.paper-section,
.route-panel,
.passenger-panel,
.flight-panel,
.note-panel,
.client-price-panel,
.driver-assign-panel,
.settlement-panel,
.contacts-panel,
.settings-section,
.directory-shell,
.page-card {
  color: var(--text-primary);
}

.request-title {
  font-size: 20px;
  font-weight: var(--font-weight-bold);
}

.created-meta,
.created-meta label,
.form-control span,
.field-grid .field-label,
.trip-field-pair label,
.trip-field-pair .field-label,
.route-label,
.hours-field label,
.checks label,
.check-line,
.large-check,
.choice-pill {
  color: #344054;
  font-weight: var(--font-weight-semibold);
}

.form-control span,
.field-grid .field-label,
.trip-field-pair label,
.trip-field-pair .field-label,
.route-label {
  font-size: var(--font-size-base);
  line-height: 1.3;
}

.form-control input,
.form-control select,
.form-control textarea {
  font-weight: var(--font-weight-regular);
}

.section-title {
  color: var(--text-heading);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
}

.subsection-title {
  color: var(--text-heading);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  line-height: 1.3;
}

.route-step,
.warning-panel,
.warning-box,
.total-line,
.save-note,
.audit-table summary {
  font-weight: var(--font-weight-semibold);
}

.total-line,
.driver-total-row .total-line {
  font-size: var(--font-size-lg);
}

.login-brand h1 {
  color: var(--text-heading);
  font-size: 30px;
  font-weight: var(--font-weight-bold);
}

.login-brand p {
  color: #4d5969;
  font-size: 19px;
  font-weight: var(--font-weight-semibold);
}

.login-card label {
  color: #344054;
  font-weight: var(--font-weight-semibold);
}

.calendar-toolbar h1 {
  font-size: var(--font-size-2xl);
}

.month-nav strong,
.weekday,
.date-number,
.day-count,
.week-date,
.summary-tile strong,
.report-summary-grid .summary-tile strong {
  color: var(--text-heading);
  font-weight: var(--font-weight-semibold);
}

.month-nav strong,
.week-date {
  font-size: var(--font-size-lg);
}

.date-number,
.summary-tile strong {
  font-size: 21px;
}

.weekday {
  color: #475467;
}

.day-count {
  color: var(--text-link);
}

.summary-tile span,
.report-summary-grid .summary-tile span {
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.date-picker-field,
.month-picker-field,
.time-picker-field {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.date-picker-field.date-input-wrap {
  width: 210px;
  flex: 0 0 210px;
}

.date-picker-field.created-date-wrap {
  width: var(--request-date-width);
  flex: 0 0 var(--request-date-width);
}

.date-picker-field.period-date-wrap {
  width: 172px;
  flex: 0 0 172px;
}

.time-picker-field.compact {
  width: 104px;
  flex: 0 0 104px;
}

.date-picker-input,
.month-picker-input,
.time-picker-input,
.date-picker-field > input,
.month-picker-field > input,
.time-picker-field > input {
  width: 100%;
  min-width: 0;
  padding-right: 42px;
}

.date-picker-input,
.month-picker-input {
  appearance: none;
}

.date-picker-input::-webkit-calendar-picker-indicator,
.month-picker-input::-webkit-calendar-picker-indicator {
  display: none;
  -webkit-appearance: none;
}

.date-picker-input::-webkit-inner-spin-button,
.date-picker-input::-webkit-clear-button,
.month-picker-input::-webkit-inner-spin-button,
.month-picker-input::-webkit-clear-button {
  display: none;
}

.date-picker-trigger,
.month-picker-trigger,
.time-picker-trigger {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  transform: translateY(-50%);
  background: transparent;
  color: #344054;
}

.paper-header .date-picker-trigger,
.paper-header .time-picker-trigger,
.form-control .date-picker-trigger,
.form-control .month-picker-trigger,
.form-control .time-picker-trigger,
.period-edit-tools .date-picker-trigger,
.topbar .date-picker-trigger {
  padding: 0;
}

.date-picker-trigger:hover,
.date-picker-trigger:focus,
.month-picker-trigger:hover,
.month-picker-trigger:focus,
.time-picker-trigger:hover,
.time-picker-trigger:focus {
  background: var(--accent-soft);
  color: var(--text-link);
}

.date-picker-trigger svg,
.month-picker-trigger svg,
.time-picker-trigger svg {
  display: block;
  width: 21px;
  height: 21px;
  margin: 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.time-picker-field:has(input:disabled) .time-picker-trigger {
  pointer-events: none;
  opacity: .45;
}

.date-popover,
.time-popover {
  position: absolute;
  display: none;
  border: 1px solid #d6dee8;
  background: #fff;
  box-shadow: 0 12px 34px rgba(23, 34, 50, .18);
}

.date-popover {
  z-index: 90;
  width: min(360px, calc(100vw - 16px));
  border-radius: 10px;
}

.time-popover {
  z-index: 80;
  width: 248px;
  border-radius: 8px;
}

.date-popover.open,
.time-popover.open {
  display: block;
}

.date-popover-head {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
  align-items: center;
  padding: 12px 14px 8px;
}

.date-month-title,
.time-popover-title {
  color: #0f2b59;
  font-weight: var(--font-weight-semibold);
}

.date-month-title {
  font-size: 17px;
  text-align: center;
}

.time-popover-title {
  padding: 15px 18px 8px;
  font-size: 15px;
}

.date-nav-btn {
  width: 44px;
  min-height: 40px;
  padding: 0;
  border: 1px solid #d6dee8;
  background: #f6f9fd;
  color: #172337;
  font-size: 24px;
  line-height: 1;
}

.date-weekdays,
.date-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 0 10px;
}

.date-weekdays {
  margin: 3px 0 6px;
  color: #5f6b7a;
  font-size: 13px;
  font-weight: var(--font-weight-semibold);
  text-align: center;
}

.date-day-empty {
  min-height: 44px;
}

.date-day-btn {
  min-height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #f5f6f8;
  color: #172337;
  font-size: 16px;
  font-weight: var(--font-weight-regular);
}

.date-day-btn:hover,
.date-day-btn:focus {
  border-color: #8fb6f3;
  background: var(--accent-soft);
  color: #114da5;
}

.date-day-btn.today {
  border-color: #f1d08a;
  background: var(--warning-soft);
  color: var(--warning);
  font-weight: var(--font-weight-semibold);
}

.date-day-btn.selected {
  border-color: #1483ff;
  background: #eaf4ff;
  color: #1473df;
  box-shadow: inset 0 0 0 1px #1483ff;
  font-weight: var(--font-weight-semibold);
}

.month-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 14px 14px;
}

.month-choice-btn {
  min-height: 50px;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #f5f6f8;
  color: #172337;
  font-size: 15px;
  font-weight: var(--font-weight-regular);
}

.month-choice-btn:hover,
.month-choice-btn:focus {
  border-color: #8fb6f3;
  background: var(--accent-soft);
  color: #114da5;
}

.month-choice-btn.today {
  border-color: #f1d08a;
  background: var(--warning-soft);
  color: var(--warning);
  font-weight: var(--font-weight-semibold);
}

.month-choice-btn.selected {
  border-color: #1483ff;
  background: #eaf4ff;
  color: #1473df;
  box-shadow: inset 0 0 0 1px #1483ff;
  font-weight: var(--font-weight-semibold);
}

.date-popover-actions,
.time-popover-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid #eef1f5;
  padding: 10px 14px;
}

.date-popover-actions button,
.time-popover-actions button {
  flex: 1 1 auto;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--text-link);
  font-size: 14px;
  font-weight: var(--font-weight-semibold);
}

.date-popover-actions button:hover,
.date-popover-actions button:focus,
.time-popover-actions button:hover,
.time-popover-actions button:focus {
  background: var(--accent-soft);
}

.time-popover-body {
  display: grid;
  grid-template-columns: 80px auto 80px;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 4px 18px 16px;
}

.time-part {
  display: grid;
  justify-items: center;
  gap: 5px;
}

.time-step {
  width: 44px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #172033;
  font-size: 14px;
  line-height: 1;
}

.time-step:hover,
.time-step:focus {
  background: var(--accent-soft);
  color: var(--text-link);
}

.time-value {
  width: 80px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #f5f6f8;
  color: #2f3136;
  font-size: 48px;
  font-weight: var(--font-weight-regular);
  line-height: 1;
}

.time-value.active {
  border-color: #1483ff;
  background: #eaf4ff;
  color: #1473df;
  box-shadow: inset 0 0 0 1px #1483ff;
}

.time-separator {
  color: #1f2937;
  font-size: 42px;
  font-weight: var(--font-weight-semibold);
  line-height: 1;
}

.whatsapp-btn,
.btn.whatsapp-btn {
  background: var(--success-soft);
  border-color: #bce7cf;
  color: var(--text-success);
}

.whatsapp-btn:hover,
.whatsapp-btn:focus {
  background: #dff5e9;
  border-color: #9fd8b9;
  color: #10603a;
}

.whatsapp-btn.disabled,
.whatsapp-btn[aria-disabled="true"],
.btn.whatsapp-btn.disabled,
.btn.whatsapp-btn[aria-disabled="true"] {
  background: #f1f4f8;
  border-color: var(--line);
  color: var(--muted);
}

@media (max-width: 1280px) {
  .topbar-inner,
  .filters,
  .calendar-toolbar,
  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .quick-tools {
    justify-self: start;
  }

  .day-panel {
    position: static;
  }

  .board {
    max-height: calc(100vh - 300px);
  }

  .report-filter {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }
}

@media (max-width: 1420px) {
  .paper-header {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "back title"
      "meta actions";
  }

  .created-meta {
    margin-left: 0;
  }

  .paper-actions {
    min-width: 0;
    margin-left: 0;
    flex-wrap: wrap;
  }

  .status-actions {
    flex: 0 1 auto;
    width: auto;
    flex-wrap: wrap;
  }

}

@media (min-width: 1181px) and (max-width: 1420px) {
  .trip-main-panel {
    grid-template-columns: var(--request-date-width) minmax(0, 1fr);
  }

  .flight-grid {
    grid-template-columns: 118px minmax(0, 1fr);
  }

  .driver-total-row {
    grid-template-columns: 146px minmax(0, 1fr) 132px 78px;
  }

  .driver-total-label {
    font-size: 16px;
    white-space: nowrap;
  }

  .payment-line .check-line {
    gap: 8px;
    padding-left: 2px;
    padding-right: 2px;
    font-size: 15px;
  }
}

@media (max-width: 1180px) {
  .app-nav-inner {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .section-tabs {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .app-user-actions {
    justify-content: flex-start;
  }

  .user-pill {
    display: none;
  }

  .paper-header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "back"
      "title"
      "meta"
      "actions";
    overflow-x: visible;
  }

  .paper-actions {
    justify-content: flex-start;
  }

  .status-actions {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .created-meta {
    flex-wrap: wrap;
    padding-left: 0;
    border-left: 0;
  }

  .trip-layout,
  .driver-finance-layout {
    grid-template-columns: 1fr;
  }

  .client-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .flight-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .hourly-row,
  .meeting-row {
    grid-template-columns: 1fr;
  }

  .hours-field {
    grid-template-columns: 62px 58px;
  }

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

  .backup-info .wide {
    grid-column: 1 / -1;
  }

  th, td {
    padding: 9px 8px;
  }
}

@media (max-width: 900px) {
  .board {
    display: none;
  }

  .mobile-cards {
    display: block;
  }

  .paper-header {
    position: static;
    grid-template-columns: 1fr;
    grid-template-areas:
      "back"
      "title"
      "meta"
      "actions";
    overflow-x: visible;
  }

  .paper-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    min-width: 0;
  }

  .status-actions {
    flex: 1 1 auto;
    width: auto;
    flex-wrap: wrap;
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .created-meta {
    flex-wrap: wrap;
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .paper-grid,
  .driver-finance-layout,
  .driver-select-row,
  .trip-layout,
  .trip-main-panel,
  .client-grid,
  .field-grid,
  .route-row,
  .driver-money-row,
  .driver-expense-row,
  .quick-driver-grid,
  .duplicate-row,
  .created-meta,
  .hourly-row,
  .meet-options,
  .flight-grid,
  .client-price-line,
  .driver-total-row,
  .settings-user-grid,
  .settings-password-grid,
  .permissions-grid,
  .search-wrap {
    grid-template-columns: 1fr;
  }

  .driver-money-amount,
  .driver-total-amount,
  .payment-line {
    grid-column: auto;
    grid-area: auto;
  }

  .driver-total-row {
    grid-template-areas: "label" "paid" "total";
  }

  .driver-total-amount {
    text-align: left;
  }

  .contact-head {
    display: none;
  }

  .contact-row {
    grid-template-columns: 1fr;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
  }

  .contact-field {
    display: grid;
    gap: 5px;
  }

  .contact-field > span {
    display: block;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
  }

  .contact-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .expense-head {
    display: none;
  }

  .hours-field {
    grid-template-columns: 1fr;
  }

  .paper-section.full {
    grid-column: auto;
  }

  .primary-zone > .section-title,
  .driver-zone > .section-title {
    margin-left: 0;
  }

  .weekday {
    padding: 8px 4px;
    font-size: 13px;
  }

  .day-cell {
    min-height: 92px;
    padding: 6px;
  }

  .date-number {
    font-size: 17px;
  }

  .week-day,
  .week-event,
  .request-main,
  .day-summary {
    grid-template-columns: 1fr;
  }

  .week-route {
    white-space: normal;
  }

  .page-head {
    display: grid;
  }

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

  .report-filter,
  .summary-grid,
  .backup-info {
    grid-template-columns: 1fr;
  }

  .table-scroll .directory-table,
  .report-table {
    min-width: 680px;
  }

  .mark {
    max-width: 100%;
    padding: 3px 5px;
    font-size: 11px;
    line-height: 1.2;
    white-space: normal;
  }

  .time-popover {
    width: 244px;
  }
}

@media (max-width: 600px) {
  .month-grid .day-marks,
  .day-count-label {
    display: none;
  }

  .day-cell {
    min-height: 76px;
    padding: 7px 4px;
  }

  .day-count {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
