/* Tokens and components; one definition per selector within each breakpoint. */
:root {
  --ink: #203539;
  --muted: #5C6F71;
  --paper: #EDF2F1;
  --surface: #FFFFFF;
  --navy: #176B67;
  --navy-2: #105550;
  --line: #D9E3E1;
  --line-strong: #B5C9C5;
  --amber: #E8B34B;
  --amber-soft: #FBF2D8;
  --red: #A63F46;
  --red-soft: #FBEDEF;
  --green: #247451;
  --green-soft: #E9F4ED;
  --blue-soft: #E6F2F0;
  --shadow: 0 14px 45px #20353918;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  font-size: 15px;
  line-height: 1.45;
}
button, input, select, textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 14px 16px;
  background: var(--surface);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 24px;
  justify-content: flex-start;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--navy);
  color: white;
  font-weight: 800;
  letter-spacing: -.03em;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-bottom: 4px solid var(--amber);
}
.brand strong, .brand div > span {
  display: block;
}
.brand strong {
  max-width: 150px;
  line-height: 1.15;
  font-family: Bahnschrift, "Segoe UI", sans-serif;
  font-weight: 600;
  font-size: 1rem;
}
.brand div > span {
  margin-top: 3px;
  color: #9fb2c0;
  font-size: .82rem;
}
nav {
  display: grid;
  gap: 6px;
}
.nav-item {
  border: 0;
  width: 100%;
  min-height: 44px;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  background: transparent;
  text-align: left;
}
.nav-item:hover {
  background: #F0F6F4;
  color: var(--navy);
}
.nav-item.active {
  background: var(--blue-soft);
  color: var(--navy);
  box-shadow: inset 3px 0 var(--navy);
  font-weight: 650;
}
.nav-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 99px;
  text-align: center;
  font-size: .75rem;
  font-family: inherit;
  color: #172b38;
  background: var(--amber);
  font-weight: 700;
}
.payment-nav-count {
  color: #7b2c28;
  background: #f5c7c3;
}
.sidebar-note {
  margin-top: auto;
  padding: 16px 8px 2px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.status-dot {
  flex: 0 0 auto;
  margin-top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #64c49b;
  box-shadow: 0 0 0 4px rgba(100,196,155,.13);
}
.sidebar-note strong, .sidebar-note small {
  display: block;
}
.sidebar-note strong {
  font-size: .84rem;
}
.sidebar-note small {
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.35;
}
.sidebar-note > div {
  min-width: 0;
}
#serverStatusText > span {
  display: block;
}
.sync-date {
  font-variant-numeric: tabular-nums;
}
.sync-reviews-link {
  display: block;
  padding: 0;
  margin-top: 6px;
  border: 0;
  background: none;
  color: var(--navy);
  font: inherit;
  font-size: .8rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  white-space: normal;
  text-align: left;
}
.sync-reviews-link[hidden] {
  display: none;
}
.sync-review-item {
  padding: 0 0 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.sync-review-item h3 {
  margin-top: 0;
}
.sync-review-item dt {
  color: var(--muted);
  font-size: .85rem;
}
.sync-review-item dd {
  margin: 3px 0 12px;
  white-space: pre-wrap;
}
main {
  min-width: 0;
  padding: 0 28px 36px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 100px;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
h1, h2, h3, p {
  margin-top: 0;
}
h1 {
  margin-bottom: 0;
  font-size: 1.8rem;
  letter-spacing: -.025em;
  font-family: Bahnschrift, "Segoe UI", sans-serif;
  font-weight: 600;
}
h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
  letter-spacing: -.02em;
  font-family: Bahnschrift, "Segoe UI", sans-serif;
  font-weight: 600;
}
h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}
.eyebrow {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}
.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}
.month-picker {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: .85rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
}
.month-picker select {
  min-height: 40px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
}
.month-picker option.empty-month-option {
  color: #7b858d;
  background: #edf0f2;
}
.button {
  border: 1px solid transparent;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: .9rem;
}
.button.primary {
  color: white;
  background: var(--navy);
}
.button.primary:hover {
  background: var(--navy-2);
}
.button.secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}
.button:disabled {
  opacity: .55;
  cursor: wait;
}
.view {
  display: none;
}
.view.active {
  display: block;
}
.month-empty .view {
  display: none !important;
}
.month-empty .sidebar nav {
  opacity: .35;
  pointer-events: none;
}
.empty-month-state {
  min-height: calc(100vh - 150px);
  display: grid;
  place-items: center;
}
.empty-month-card {
  width: min(680px, 100%);
  padding: 58px 42px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.empty-month-card h2 {
  margin-bottom: 10px;
  font-size: 1.65rem;
}
.empty-month-card > p:not(.eyebrow) {
  margin: 0 auto 28px;
  max-width: 500px;
  color: var(--muted);
  line-height: 1.55;
}
.upload-main-button {
  min-height: 58px;
  padding: 0 30px;
  font-size: 1.05rem;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.metric {
  width: 100%;
  min-height: 116px;
  padding: 18px 20px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  position: relative;
  overflow: hidden;
  text-align: left;
  border-right: 1px solid var(--line);
}
.clickable-metric:hover {
  border-color: var(--amber);
  transform: none;
  box-shadow: none;
  background: var(--amber-soft);
}
.metric::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 5px;
  background: var(--line);
  display: none;
}
.metric.attention::after {
  background: var(--amber);
}
.metric.money::after {
  background: var(--green);
}
.metric strong {
  display: block;
  margin: 14px 0 5px;
  font-size: clamp(1.25rem, 1.8vw, 1.75rem);
  letter-spacing: -.03em;
  font-family: Bahnschrift, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.metric span {
  color: var(--muted);
  font-size: .86rem;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: none;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr);
  gap: 20px;
  margin-bottom: 18px;
}
.panel-heading {
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.text-button {
  border: 0;
  padding: 4px 0;
  background: none;
  color: var(--navy-2);
  font-size: .86rem;
  font-weight: 700;
}
.issue-stack {
  padding: 4px 20px 14px;
}
.issue-line {
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.issue-line:hover {
  color: var(--navy-2);
}
.issue-line:last-child {
  border-bottom: 0;
}
.issue-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--amber-soft);
  color: #9b6112;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.issue-line strong, .issue-line small {
  display: block;
}
.issue-line small {
  margin-top: 3px;
  color: var(--muted);
}
.issue-line b {
  font-size: 1.2rem;
}
.composition {
  padding: 24px 22px;
}
.composition-bar {
  display: flex;
  height: 14px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--line);
  margin-bottom: 24px;
}
.composition-bar span:nth-child(1) {
  background: var(--navy-2);
}
.composition-bar span:nth-child(2) {
  background: var(--amber);
}
.composition-bar span:nth-child(3) {
  background: #8e9ba5;
}
.composition-legend {
  display: grid;
  gap: 14px;
}
.legend-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 9px;
  align-items: center;
}
.legend-row i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.legend-row:nth-child(1) i {
  background: var(--navy-2);
}
.legend-row:nth-child(2) i {
  background: var(--amber);
}
.legend-row:nth-child(3) i {
  background: #8e9ba5;
}
.legend-row span {
  color: var(--muted);
}
.recent-panel {
  margin-bottom: 18px;
}
.table-wrap {
  overflow: auto;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-color: #A6C1BA transparent;
}
.table-wrap.tall {
  max-height: calc(100vh - 230px);
}
table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 14px;
  color: #61717e;
  background: #F0F5F3;
  border-bottom: 1px solid var(--line-strong);
  text-align: left;
  font-size: .79rem;
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
  overflow-wrap: anywhere;
  font-weight: 600;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: .88rem;
}
.cell-note {
  display: block;
  max-width: 330px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-weight: 400;
  text-overflow: ellipsis;
}
tbody tr:hover {
  background: #f7fafb;
}
tbody tr.clickable {
  cursor: pointer;
}
.status {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 99px;
  padding: 2px 9px;
  font-size: .76rem;
  font-weight: 700;
}
.status.calculated {
  color: var(--green);
  background: var(--green-soft);
}
.status.review {
  color: #8d5a0e;
  background: var(--amber-soft);
}
.status.not_payable, .status.missing_driver {
  color: #6e7780;
  background: #ebeff2;
}
.money {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
}
.toolbar {
  min-height: 58px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.segmented {
  display: inline-flex;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
}
.segmented button {
  border: 0;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: .86rem;
  font-weight: 700;
}
.segmented button.active {
  color: white;
  background: var(--navy);
}
.segmented span {
  margin-left: 5px;
  opacity: .75;
}
.search {
  min-height: 43px;
  min-width: min(320px, 100%);
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 8px;
}
.search span {
  color: var(--muted);
  font-size: 1.2rem;
}
.search input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
}
.search.wide {
  flex: 1;
  max-width: 580px;
}
select {
  min-height: 43px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface);
}
.driver-toolbar {
  justify-content: flex-start;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin: 6px 0 8px;
  gap: 12px;
}
.payment-toolbar {
  justify-content: flex-start;
}
.payment-summary {
  margin-left: auto;
  display: grid;
  grid-template-columns: auto auto auto auto;
  gap: 6px 10px;
  align-items: baseline;
  color: var(--muted);
  font-size: .82rem;
}
.payment-summary strong {
  color: var(--ink);
  font-size: 1rem;
}
.payment-panel table {
  table-layout: fixed;
}
.payment-panel th:nth-child(1) {
  width: 42%;
}
.payment-panel th:nth-child(2) {
  width: 18%;
}
.payment-panel th:nth-child(3) {
  width: 20%;
}
.payment-panel th:nth-child(4) {
  width: 20%;
}
.payment-toggle {
  min-width: 128px;
  min-height: 36px;
  border: 1px solid;
  border-radius: 8px;
  font-weight: 700;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.payment-toggle.unpaid {
  color: #963d38;
  border-color: #dfa09c;
  background: var(--red-soft);
}
.payment-toggle.unpaid:hover {
  background: #f5d4d1;
}
.payment-toggle.paid {
  color: #216249;
  border-color: #8fc7ae;
  background: var(--green-soft);
}
.payment-toggle.paid:hover {
  background: #d4ecdf;
}
.sort-button {
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
  cursor: pointer;
}
.sort-button::after {
  content: "↕";
  opacity: .35;
  font-size: .78rem;
}
.sort-button.active[data-direction="asc"]::after {
  content: "↑";
  opacity: 1;
}
.sort-button.active[data-direction="desc"]::after {
  content: "↓";
  opacity: 1;
}
.sort-button:hover {
  color: var(--navy);
}
.driver-panel table {
  table-layout: fixed;
  white-space: normal;
}
.driver-panel th, .driver-panel td {
  padding: 10px 7px;
  overflow-wrap: anywhere;
  font-size: .78rem;
}
.driver-panel th {
  font-size: .68rem;
}
.driver-panel th[data-column="driver"] {
  width: 18%;
}
.driver-panel td[data-column="driver"] {
  font-size: .83rem;
}
.column-hidden {
  display: none;
}
.column-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 18px;
}
.column-options .check-field {
  min-height: 38px;
  margin-top: 0;
  color: var(--ink);
}
.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.queue-panel {
  min-height: 520px;
}
.review-queue {
  display: grid;
}
.review-card {
  width: 100%;
  padding: 17px 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: grid;
  grid-template-columns: 100px minmax(180px, .8fr) minmax(220px, 1.2fr) 140px 34px;
  gap: 14px;
  align-items: center;
  text-align: left;
}
.review-card:hover {
  background: #f7fafb;
}
.review-card .date {
  color: var(--muted);
  font-size: .82rem;
}
.review-card strong, .review-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.review-card small {
  margin-top: 4px;
  color: var(--muted);
}
.review-card .review-source {
  color: #8d5a0e;
  white-space: normal;
}
.review-card .source-note {
  max-height: 2.8em;
  color: #536b7a;
  white-space: normal;
}
.review-card.data-issue-card {
  border-left: 4px solid var(--red);
  background: #fff8f7;
}
.invalid-phone {
  color: var(--red) !important;
  font-weight: 800;
}
.review-card .next {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--amber-soft);
  color: #905b0f;
}
.help-panel {
  position: sticky;
  top: 18px;
  padding: 22px;
  border-radius: 12px;
  color: white;
  background: #173d5b;
  box-shadow: var(--shadow);
}
.help-panel .eyebrow {
  color: #9fb7c8;
}
.help-panel > p:not(.eyebrow) {
  margin-top: 14px;
  color: #c3d2dc;
  line-height: 1.55;
}
.help-rule {
  height: 1px;
  margin: 22px 0;
  background: rgba(255,255,255,.14);
}
.help-panel dl {
  margin: 0;
}
.help-panel dl div {
  padding: 10px 0;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.help-panel dt {
  font-weight: 700;
}
.help-panel dd {
  margin: 0;
  color: #aebfca;
  text-align: right;
}
.quality-intro {
  margin-bottom: 18px;
  padding: 22px 24px;
  border-left: 5px solid var(--navy);
  background: var(--blue-soft);
  display: grid;
  grid-template-columns: .5fr 1fr;
  gap: 40px;
  align-items: center;
}
.quality-intro p:last-child {
  margin: 0;
  color: #3d5362;
  line-height: 1.6;
}
.quality-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.quality-card {
  min-height: 145px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}
.quality-card .check-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.quality-card.pass .check-icon {
  color: var(--green);
  background: var(--green-soft);
}
.quality-card.warn .check-icon {
  color: #8d5a0e;
  background: var(--amber-soft);
}
.quality-card.fail .check-icon {
  color: var(--red);
  background: var(--red-soft);
}
.quality-card strong {
  display: block;
  margin: 20px 0 6px;
}
.quality-card small {
  color: var(--muted);
  line-height: 1.4;
}
.quality-explanation {
  padding: 24px;
}
.explanation-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 24px;
}
.explanation-grid article {
  padding-top: 15px;
  border-top: 2px solid var(--line);
}
.explanation-grid article > span {
  color: var(--amber);
  font-size: .8rem;
  font-weight: 800;
}
.explanation-grid h3 {
  margin-top: 12px;
}
.explanation-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}
.empty {
  padding: 50px 24px;
  color: var(--muted);
  text-align: center;
}
dialog {
  border: 0;
  padding: 0;
  background: transparent;
}
dialog::backdrop {
  background: rgba(12, 29, 41, .58);
  backdrop-filter: blur(2px);
}
.detail-dialog {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.wide-dialog {
  width: min(1080px, calc(100vw - 30px));
}
.compact-dialog {
  width: min(460px, calc(100vw - 30px));
}
.dialog-shell {
  max-height: calc(100vh - 30px);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0,0,0,.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dialog-shell > header, .dialog-shell > footer {
  flex: 0 0 auto;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.dialog-shell > footer {
  border-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
}
.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.35rem;
}
.dialog-body {
  overflow: auto;
  padding: 22px;
}
.trip-facts, .driver-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.fact {
  min-height: 74px;
  padding: 12px;
  border-radius: 8px;
  background: #f1f4f6;
}
.fact span, .route-block > span, .field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
}
.fact strong {
  font-size: .9rem;
}
.driver-rate-fact.overridden {
  background: #fff1cc;
  box-shadow: inset 0 0 0 1px #d8aa43;
}
.inline-edit-button, .inline-reset-button {
  display: block;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--navy-2);
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.driver-rate-editor {
  margin-top: 8px;
}
.driver-rate-editor input, .driver-rate-editor select {
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid #c6b38e;
  border-radius: 7px;
  background: white;
}
.driver-rate-editor select {
  margin-top: 8px;
}
.driver-rate-editor small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}
.rate-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.rate-edit-grid > [hidden] {
  display: none;
}
.rate-edit-wide {
  grid-column: 1 / -1;
}
.edit-column {
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  padding-left: 8px;
  padding-right: 8px;
  text-align: center;
}
.route-edit-icon {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--navy);
  background: var(--surface);
  font-size: 1rem;
  line-height: 1;
}
.route-edit-icon:hover {
  border-color: var(--navy-2);
  background: var(--blue-soft);
}
.route-block {
  margin-bottom: 18px;
  padding: 14px;
  border-left: 3px solid var(--line-strong);
  background: #fafbfc;
}
.route-block p {
  margin: 0;
  max-height: 120px;
  overflow: auto;
  line-height: 1.55;
  font-size: .88rem;
  white-space: pre-wrap;
}
.decision-card {
  padding: 20px;
  border: 1px solid #e9c88f;
  border-radius: 10px;
  background: var(--amber-soft);
}
.decision-card > div:first-child > p:last-child {
  margin-bottom: 18px;
  color: #6d5732;
}
.decision-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.field {
  display: block;
}
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid #c6b38e;
  border-radius: 7px;
  outline: none;
  background: white;
}
.field textarea {
  resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--navy-2);
  box-shadow: 0 0 0 3px rgba(34,91,127,.13);
}
.field-row {
  display: flex;
  gap: 12px;
  align-items: end;
}
.field-row .grow {
  flex: 1;
}
.contact-card {
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f9fa;
}
.driver-contact-details {
  padding: 0;
}
.driver-contact-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
}
.driver-contact-details > summary::-webkit-details-marker {
  display: none;
}
.driver-contact-details > summary .eyebrow {
  margin-bottom: 3px;
}
.driver-contact-details .details-action {
  color: var(--navy-2);
  font-size: .8rem;
  font-weight: 700;
}
.driver-contact-details[open] .details-action {
  font-size: 0;
}
.driver-contact-details[open] .details-action::after {
  content: "Свернуть";
  font-size: .8rem;
}
.driver-contact-fields {
  padding: 0 18px 16px;
  border-top: 1px solid var(--line);
}
.contact-card .field-row {
  margin: 14px 0 12px;
}
.contact-card .name-fields {
  align-items: stretch;
}
.contact-card .name-fields .field {
  flex: 1 1 0;
  min-width: 0;
}
#contractDecision .field-row {
  margin-bottom: 18px;
}
.check-field {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #59492f;
  font-size: .9rem;
}
.driver-trips {
  max-height: 380px;
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.driver-trips .route-cell {
  min-width: 240px;
  max-width: 440px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.hidden {
  display: none !important;
}
.toast {
  position: fixed;
  inset: auto 24px 24px auto;
  z-index: 100;
  max-width: 460px;
  margin: 0;
  padding: 13px 16px;
  border: 0;
  border-radius: 9px;
  color: white;
  background: #19384f;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .18s ease;
}
.toast::backdrop {
  background: transparent;
  backdrop-filter: none;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast.error {
  background: var(--red);
}
.signed-out .app-shell {
  display: none;
}
#loginScreen {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--paper);
  align-items: center;
  justify-content: center;
  z-index: 3000;
}
.signed-out #loginScreen {
  display: flex;
}
#loginForm {
  background: white;
  border-radius: 10px;
  padding: 32px;
  width: min(420px, calc(100vw - 32px));
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  border-top: 5px solid var(--navy);
}
#loginForm label, #accountDialog label {
  display: grid;
  gap: 6px;
  margin: 14px 0;
}
#loginForm input, #accountDialog input {
  padding: 10px;
  border: 1px solid #b8c2d2;
  border-radius: 6px;
}
#loginError, #accountError {
  color: #b42318;
}
#loginError:empty, #loginStatus:empty {
  display: none;
}
#loginError:not(:empty) {
  padding: 12px;
  border: 1px solid #efb4ae;
  border-radius: 7px;
  background: #fff0ef;
  line-height: 1.45;
}
#loginStatus {
  color: #526573;
  font-size: .9rem;
}
#loginForm button:disabled {
  opacity: .65;
  cursor: wait;
}
#accountDialog {
  padding: 24px;
  width: min(440px, 95vw);
}
.account-menu {
  position: relative;
  margin: -8px 0 18px;
  z-index: 1200;
}
.account-menu > button {
  background: none;
  color: inherit;
  border: 0;
  padding: 8px;
  font: inherit;
  cursor: pointer;
}
.account-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  padding: 8px;
  border-radius: 8px;
  background: white;
  box-shadow: 0 8px 24px #14243c33;
  color: #17243b;
}
.account-menu:hover .account-dropdown, .account-menu:focus-within .account-dropdown {
  display: grid;
}
.account-dropdown button {
  background: white;
  text-align: left;
  border: 0;
  padding: 12px;
  cursor: pointer;
}
.account-dropdown button:hover {
  background: #eef2f7;
}
.driver-pdf {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 6px;
  border: 1px solid #cbd8e2;
  border-radius: 4px;
  color: #19445b;
  background: #f5f9fc;
  text-decoration: none;
  white-space: nowrap;
  font-size: 12px;
}
.driver-pdf:hover {
  background: #e3eff7;
}
.data-error-row td {
  background: #faeeee;
}
.data-error-row:hover td {
  background: #f5e2e1;
}
.data-problem-note {
  background: #faeeee;
  color: #7b3935;
  padding: 12px;
  border-radius: 7px;
  margin: 12px 0;
}
.data-problem-note.no-data-issues {
  background: #f1f4f6;
  color: #526573;
}
.data-fix-link {
  display: block;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  padding: 8px 0;
  cursor: pointer;
}
.request-edit-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
}
.request-edit-fields textarea, .request-edit-fields input, .request-edit-fields select {
  width: 100%;
  min-height: 40px;
  padding: 8px;
  border: 1px solid #cad5dd;
  border-radius: 6px;
  background: white;
  font: inherit;
}
.request-edit-fields textarea {
  resize: vertical;
}
.request-edit-fields .request-field-problem textarea, .request-edit-fields .request-field-problem input, .request-edit-fields .request-field-problem select {
  border-color: #d58a84;
  background: #fff0ef;
  box-shadow: 0 0 0 2px #c94c4430;
}
.request-edit-fields .request-field-problem > span {
  color: #963d38;
}
.grid-pagination {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-top: 14px;
}
#requestsGrid td, #vehiclesGrid td, #routesGrid td, #contractsGrid td {
  white-space: normal;
  overflow-wrap: anywhere;
}
#requestsGrid td {
  vertical-align: top;
}
#requestsGrid .registry-cell {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  line-height: 1.4;
  max-height: 4.2em;
}
.driver-toolbar .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-height: 43px;
}
.column-resizer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 9px;
  cursor: col-resize;
  touch-action: none;
  z-index: 4;
  border-right: 2px solid transparent;
}
.column-resizer:hover {
  border-color: #849eb0;
  background: #93b1c533;
}
.resizing-columns {
  cursor: col-resize;
  user-select: none;
}
.nav-payments {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.muted {
  color: #647786;
  line-height: 1.5;
}
#requestEditError {
  color: #a32222;
}
.editor-sections > * {
  margin: 0;
}
.editor-sections > * + * {
  margin-top: 18px;
}
#vehicleEditIssue:empty {
  display: none;
}
#vehicleEditIssue {
  color: #a32222;
  line-height: 1.45;
}
.vehicle-affected {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.vehicle-affected p {
  margin: 0 0 10px;
}
#vehicleRequestLinks .data-fix-link {
  width: 100%;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.4;
}
#vehicleRequestLinks .data-fix-link:hover {
  color: var(--navy-2);
  text-decoration: underline;
}
#vehicleRequestLinks small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}
#requestEditNotice p {
  margin: 0;
  line-height: 1.5;
}
#requestEditNotice .button {
  margin-top: 12px;
}
.table-tools {
  display: flex;
  justify-content: flex-end;
  margin: 4px 0 8px;
}
.table-tools .button {
  min-height: 32px;
  padding: 5px 12px;
}
.toolbar-columns {
  margin-left: auto;
}
.request-days {
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 8px;
  display: block;
  overflow-x: auto;
  padding: 3px;
}
.request-day {
  min-width: 48px;
  background: #eef2f4;
  color: #172b3a;
  border: 1px solid #172b3a25;
  border-radius: 7px;
  padding: 6px 9px;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  flex: 0 0 auto;
}
.request-day strong {
  font-size: .9rem;
}
.request-day small {
  color: inherit;
  font-size: .65rem;
  opacity: .72;
}
.request-day.weekend {
  background: #eadfdf;
  color: #703f3c;
}
.request-day.holiday {
  background: #c96b65;
  color: white;
}
.request-day.active {
  outline: 2px solid #102b40;
  box-shadow: inset 0 -3px #fff8;
  font-weight: 700;
  outline-width: 1px;
  outline-offset: 1px;
}
.request-day:focus-visible {
  outline: 3px solid #e7a72b;
  outline-offset: 2px;
}
.request-day-note {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: .8rem;
}
.fit-hidden {
  display: none !important;
}
.fitted-table th {
  width: auto !important;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  padding: 9px 10px;
  letter-spacing: 0;
}
.fitted-table .sort-button {
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}
.fitted-table td {
  height: 54px;
  padding: 7px 10px;
  vertical-align: middle !important;
  overflow: hidden;
}
.fitted-table .compact-cell {
  max-height: 40px;
  line-height: 20px;
  overflow: hidden;
  overflow-wrap: normal;
  word-break: normal;
  font-variant-numeric: tabular-nums;
}
.fitted-table .registry-cell, #requestsGrid .registry-cell {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  max-height: 40px;
  line-height: 20px;
  overflow: hidden;
  overflow-wrap: normal;
  word-break: normal;
}
.fitted-table td .cell-note {
  display: none;
}
.fitted-table .payment-toggle {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
}
.fitted-table .route-cell {
  min-width: 0;
  max-width: none;
}
#tableDetailBody {
  margin: 0;
}
#tableDetailBody > div {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
#tableDetailBody dt {
  color: var(--muted);
  font-size: .8rem;
  margin-bottom: 5px;
}
#tableDetailBody dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.dialog-shell h2 {
  overflow-wrap: anywhere;
}
.tariff-toolbar {
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}
.tariff-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.compact-help-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 1rem;
}
.tariff-columns-button {
  min-height: 36px;
  padding: 0 12px;
}
.tariff-context {
  margin: 0 0 12px;
  font-size: .85rem;
}
.tariff-pane[hidden] {
  display: none;
}
.tariff-pane .table-wrap.tall {
  max-height: calc(100vh - 245px);
}
#routesGrid .edit-column .compact-cell {
  display: flex;
  justify-content: center;
}
.table-tools + .table-wrap.tall {
  max-height: calc(100vh - 220px);
}
.route-bundles {
  margin-top: 22px;
}
.route-bundles p {
  font-size: .88rem;
  line-height: 1.6;
}
.view-loading {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 0;
  color: var(--muted);
  font-size: .88rem;
}
.mini-spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid #b9c9d5;
  border-top-color: #22506f;
  border-radius: 50%;
  animation: loading-spin .8s linear infinite;
}
.view[aria-busy="true"] .table-wrap {
  opacity: .45;
  pointer-events: none;
}
.server-error .status-dot {
  background: #ec8989;
  box-shadow: 0 0 0 4px #ec898922;
}
.server-error strong {
  color: var(--red);
}
.server-syncing .status-dot {
  background: transparent;
  border: 2px solid #8296a5;
  border-top-color: var(--navy);
  width: 12px;
  height: 12px;
  animation: loading-spin .8s linear infinite;
  box-shadow: none;
}
.sync-running main .view, .sync-running .month-picker {
  opacity: .65;
  pointer-events: none;
}
.request-day-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-bottom: 8px;
  width: max-content;
}
.request-day.day-has-errors {
  border-color: #c66a6a;
}
.request-day.day-no-errors {
  border-color: #65a984;
}
.metric.money {
  background: var(--blue-soft);
}
.dialog-shell > header {
  padding: 18px 22px;
}
#loginForm h1 {
  font-size: 1.6rem;
}
:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 3px;
}
button:disabled {
  cursor: not-allowed;
}
.skip-link {
  position: fixed;
  left: 12px;
  top: -80px;
  z-index: 4000;
  padding: 12px 16px;
  background: var(--surface);
  color: var(--navy);
  border: 2px solid var(--navy);
  border-radius: 6px;
}
.skip-link:focus {
  top: 12px;
}
@keyframes loading-spin { to { transform: rotate(360deg); } }

@media (max-width:1100px) {
  .metrics, .quality-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .review-layout { grid-template-columns: 1fr; }
  .help-panel { position: static; }
  .review-card { grid-template-columns: 90px minmax(160px, .8fr) minmax(200px, 1.2fr) 30px; }
  .review-card .review-amount { display: none; }
}

@media (max-width:700px) {
  .request-edit-fields { grid-template-columns: 1fr; }
  .topbar { padding: 10px 0; }
  .tariff-toolbar { align-items: stretch; flex-direction: column; }
  .tariff-tabs { min-width: 0; }
  .tariff-tabs button { flex: 1; padding: 0 10px; }
}

@media (max-width:760px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .rate-edit-grid { grid-template-columns: 1fr; }
  .rate-edit-wide { grid-column: auto; }
  .sidebar { position: static; width: 100%; height: auto; padding: 12px 14px 0; border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 0 12px; }
  .brand { justify-content: flex-start; padding: 0 0 12px; }
  nav { grid-template-columns: repeat(5, 1fr); grid-column: 1 / -1; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 10px; }
  .nav-item { justify-content: center; font-size: .8rem; flex: 0 0 auto; width: auto; min-height: 40px; padding: 8px 12px; white-space: nowrap; }
  .nav-count { display: inline-block; margin-left: 8px; }
  .sidebar-note { display: flex; grid-column: 1 / -1; padding: 10px 0; margin: 0; }
  main { padding: 0 14px 24px; }
  .topbar { min-height: 92px; padding-top: 18px; flex-direction: column; align-items: stretch; padding: 18px 0; gap: 14px; margin-bottom: 16px; }
  .top-actions { display: flex; flex-direction: row; justify-content: flex-start; }
  .month-picker { padding-left: 8px; flex: 1 0 100%; }
  .top-actions .button { padding: 0 10px; flex: 1; min-height: 42px; }
  .metrics, .quality-grid, .explanation-grid { grid-template-columns: 1fr; }
  .metric { min-height: 104px; padding: 14px; border-bottom: 1px solid var(--line); }
  .toolbar { align-items: stretch; flex-direction: column; }
  .segmented { overflow-x: auto; }
  .search { min-width: 0; width: 100%; }
  .driver-toolbar select { width: 100%; }
  .payment-summary { width: 100%; margin-left: 0; }
  .review-card { grid-template-columns: 80px 1fr 30px; }
  .review-card .customer-block, .review-card .review-amount { display: none; }
  .quality-intro { grid-template-columns: 1fr; gap: 12px; }
  .trip-facts, .driver-summary, .decision-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-row { align-items: stretch; flex-direction: column; }
  .column-options { grid-template-columns: 1fr; }
  .brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .brand strong { max-width: none; font-size: .9rem; }
  .account-menu { margin: 0; align-self: start; }
  .nav-payments { margin-top: 0; border-top: 0; padding-top: 8px; }
  .sidebar-note small { display: inline-block; margin-right: 6px; }
  #serverStatusText > span { display: inline; margin-right: 4px; }
  .sync-reviews-link { display: inline; margin-left: 10px; }
  .month-picker select { flex: 1; min-width: 0; }
  h1 { font-size: 1.55rem; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric strong { font-size: 1.25rem; }
  .metric span { font-size: .77rem; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .panel-heading { padding: 14px 16px; }
  .panel-heading .text-button { max-width: 112px; }
  .dialog-body { padding: 16px; }
  .detail-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .dialog-shell > footer { gap: 8px; padding: 12px 16px; }
  .dialog-shell > footer .button { flex: 1; padding: 0 10px; }
}

@media (prefers-reduced-motion:reduce) {
  .mini-spinner, .server-syncing .status-dot { animation: none; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
