.drivers-head-panel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.drivers-title-block p,
.driver-modal-heading p {
  margin: 7px 0 0;
  color: var(--muted, #77736e);
}

.drivers-head-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.drivers-head-actions label {
  min-width: 240px;
  margin: 0;
}

.drivers-inactive-toggle {
  min-width: 0 !important;
  min-height: 44px;
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.drivers-inactive-toggle input {
  width: 18px;
  height: 18px;
}

.drivers-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0;
}

.drivers-summary article,
.driver-profile-grid article,
.driver-report-summary article,
.driver-style-metrics article,
.driver-assignment-card > div,
.driver-note,
.driver-score-info {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e1dc);
  border-radius: 14px;
  padding: 16px;
}

.drivers-summary span,
.driver-profile-grid span,
.driver-report-summary span,
.driver-style-metrics span,
.driver-assignment-card > div > span,
.driver-note > span {
  display: block;
  color: var(--muted, #77736e);
  font-size: .82rem;
  margin-bottom: 6px;
}

.drivers-summary strong {
  font-size: 1.65rem;
}

.drivers-list-panel .panel-head {
  align-items: center;
}

.drivers-table td:first-child small,
.drivers-table td:nth-child(2) small,
#driver-tab-content table td small {
  display: block;
  color: var(--muted, #77736e);
  margin-top: 4px;
}

.driver-name-link {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text, #2b2a28);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.driver-name-link:hover {
  color: #c66c10;
}

.driver-inactive-row {
  opacity: .72;
}

#modal.drivers-dialog {
  width: min(960px, calc(100vw - 32px));
  max-width: 960px;
  max-height: calc(100vh - 32px);
  padding: 0;
}

#modal.drivers-detail-dialog {
  width: min(1120px, calc(100vw - 32px));
  max-width: 1120px;
}

#modal.drivers-dialog #modal-body {
  padding: 28px;
}

.driver-modal-heading {
  padding-right: 34px;
  margin-bottom: 22px;
}

.driver-modal-heading h2,
.driver-detail-head h2 {
  margin: 0;
}

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

.driver-form label,
.driver-assignment-card label,
.driver-report-filters label {
  display: grid;
  gap: 6px;
}

.driver-schedule {
  border: 1px solid var(--border, #e5e1dc);
  border-radius: 14px;
  padding: 16px;
  margin: 18px 0;
}

.driver-schedule-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.driver-schedule-head small {
  color: var(--muted, #77736e);
}

.driver-schedule-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 120px 24px 120px;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border, #eeeae6);
}

.driver-schedule-row label {
  display: flex;
  grid-auto-flow: column;
  justify-content: flex-start;
  align-items: center;
}

.driver-schedule-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.driver-detail-head {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 14px;
  padding-right: 36px;
}

.driver-detail-head p {
  margin: 4px 0 0;
  color: var(--muted, #77736e);
}

.driver-avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #bd640b;
  background: #fff0e2;
  font-weight: 800;
  font-size: 1.15rem;
}

.driver-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border, #e5e1dc);
  margin: 22px -28px 0;
  padding: 0 28px;
}

.driver-tabs button {
  flex: 0 0 auto;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted, #6e6a66);
  padding: 14px 12px 12px;
  font-weight: 650;
}

.driver-tabs button.active {
  color: #bd640b;
  border-bottom-color: #f28c28;
}

#driver-tab-content {
  padding-top: 20px;
  min-height: 240px;
}

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

.driver-profile-grid strong,
.driver-report-summary strong,
.driver-style-metrics strong {
  font-size: 1.08rem;
}

.driver-note {
  margin-top: 12px;
}

.driver-note p {
  margin: 0;
  white-space: pre-wrap;
}

.driver-assignment-card {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
}

.driver-assignment-card > div strong,
.driver-assignment-card > div small {
  display: block;
}

.driver-assignment-card > div strong {
  font-size: 1.15rem;
}

.driver-assignment-card > div small {
  color: var(--muted, #77736e);
  margin-top: 6px;
}

.driver-assignment-card form {
  border: 1px solid var(--border, #e5e1dc);
  border-radius: 14px;
  padding: 16px;
}

.driver-assignment-actions,
.driver-report-filters {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.driver-report-filters {
  justify-content: flex-start;
  margin: 0 0 16px;
}

.driver-report-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.driver-score-row {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
}

.driver-score {
  color: #fff;
  border-radius: 16px;
  padding: 20px;
  background: #4a4845;
}

.driver-score.good {
  background: #267a5d;
}

.driver-score.warning {
  background: #9a6817;
}

.driver-score.bad {
  background: #9a413c;
}

.driver-score span,
.driver-score p {
  display: block;
  color: rgba(255,255,255,.85);
}

.driver-score strong {
  display: block;
  font-size: 3rem;
  margin: 14px 0 8px;
}

.driver-score strong small {
  font-size: 1rem;
}

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

.driver-score-info {
  margin: 14px 0;
  background: var(--surface-soft, #faf8f5);
}

.driver-score-info p {
  margin: 8px 0;
}

.driver-score-info small {
  color: var(--muted, #77736e);
}

html[data-theme="dark"] .driver-avatar {
  background: #493425;
  color: #ffad5c;
}

html[data-theme="dark"] .driver-score-info {
  background: #302e2b;
}

@media (max-width: 900px) {
  .drivers-head-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .drivers-head-actions label {
    min-width: min(100%, 280px);
  }

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

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

  .driver-score-row,
  .driver-assignment-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .drivers-summary {
    gap: 8px;
  }

  .drivers-summary article {
    padding: 13px;
  }

  .drivers-summary strong {
    font-size: 1.35rem;
  }

  #modal.drivers-dialog,
  #modal.drivers-detail-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  #modal.drivers-dialog #modal-body {
    padding: 20px 16px;
  }

  .driver-form-grid,
  .driver-profile-grid,
  .driver-report-summary,
  .driver-style-metrics {
    grid-template-columns: 1fr;
  }

  .driver-schedule-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .driver-schedule-row {
    grid-template-columns: 1fr 1fr;
  }

  .driver-schedule-row > span {
    display: none;
  }

  .driver-schedule-row label {
    grid-column: 1 / -1;
  }

  .driver-tabs {
    margin-left: -16px;
    margin-right: -16px;
    padding: 0 16px;
  }

  .driver-report-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .driver-report-filters label,
  .driver-report-filters button {
    width: 100%;
  }
}

.driver-list-head,
.drivers-list-title,
.driver-list-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.driver-list-head {
  justify-content: space-between;
  flex-wrap: wrap;
}

.drivers-list-title h3 {
  margin: 0;
}

.driver-list-toolbar {
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.driver-list-toolbar .table-action-select {
  width: auto;
  min-width: 170px;
}

.driver-preview-cell {
  width: 72px;
  text-align: center;
}

.driver-preview-button {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border, #e5e1dc);
  border-radius: 10px;
  background: var(--surface-soft, #faf8f5);
  color: var(--text, #2b2a28);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.driver-preview-button:hover,
.driver-preview-button:focus-visible {
  border-color: #f28c28;
  background: #fff4e8;
  color: #c66c10;
  outline: none;
}

.driver-preview-button .ui-icon {
  width: 20px;
  height: 20px;
}

#modal.drivers-preview-dialog {
  width: min(780px, calc(100vw - 32px));
  max-width: 780px;
}

#modal.drivers-dialog .modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border, #e5e1dc);
}

.driver-preview-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.driver-preview-identity h2,
.driver-preview-style h3 {
  margin: 0;
}

.driver-preview-identity p {
  margin: 5px 0 0;
  color: var(--muted, #77736e);
}

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

.driver-preview-grid article,
.driver-preview-metrics article {
  background: var(--surface-soft, #faf8f5);
  border: 1px solid var(--border, #e5e1dc);
  border-radius: 12px;
  padding: 13px 14px;
}

.driver-preview-grid span,
.driver-preview-metrics span {
  display: block;
  color: var(--muted, #77736e);
  font-size: .8rem;
  margin-bottom: 5px;
}

.driver-preview-style {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--border, #e5e1dc);
}

.driver-preview-style-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.driver-preview-style-head small {
  color: var(--muted, #77736e);
}

.driver-preview-score {
  font-size: 1.7rem;
  color: var(--text, #2b2a28);
}

.driver-preview-score.good { color: #267a5d; }
.driver-preview-score.warning { color: #9a6817; }
.driver-preview-score.bad { color: #9a413c; }
.driver-preview-score small { font-size: .78rem; }

.driver-preview-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.driver-preview-metrics strong {
  font-size: 1.15rem;
}

html[data-theme="dark"] .driver-preview-button:hover,
html[data-theme="dark"] .driver-preview-button:focus-visible {
  background: #493425;
  color: #ffad5c;
}

@media (max-width: 700px) {
  .driver-list-toolbar {
    width: 100%;
    justify-content: stretch;
  }

  .driver-list-toolbar .table-selection-count {
    width: 100%;
  }

  .driver-list-toolbar .table-action-select,
  .driver-list-toolbar button {
    flex: 1 1 150px;
  }

  #modal.drivers-preview-dialog {
    width: 100vw;
    max-width: 100vw;
  }

  .driver-preview-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .driver-preview-head > .badge {
    grid-column: 2;
    justify-self: start;
  }

  .driver-preview-grid {
    grid-template-columns: 1fr;
  }

  .driver-preview-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* mobile-driver-cards-v1 */
@media (max-width: 700px) {
  .drivers-head-actions,
  .drivers-head-actions label,
  .drivers-head-actions button {
    width: 100%;
  }

  .drivers-inactive-toggle {
    min-height: 38px;
  }

  .driver-list-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .driver-list-toolbar .table-selection-count {
    grid-column: 1 / -1;
  }

  .driver-list-toolbar .table-action-select {
    width: 100%;
    min-width: 0;
  }

  #drivers-list .table-wrap {
    overflow: visible;
  }

  #drivers-list .drivers-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #drivers-list .drivers-table thead {
    display: none;
  }

  #drivers-list .drivers-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  #drivers-list .drivers-table tr {
    position: relative;
    display: grid;
    padding: 10px 12px;
    border: 1px solid var(--border, #e5e1dc);
    border-radius: 12px;
    background: var(--surface, #fff);
  }

  #drivers-list .drivers-table td {
    display: grid;
    grid-template-columns: minmax(92px, .7fr) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: auto;
    min-width: 0;
    padding: 9px 0;
    border: 0;
    border-bottom: 1px solid var(--border, #e5e1dc);
    text-align: left;
    overflow-wrap: anywhere;
  }

  #drivers-list .drivers-table td::before {
    content: attr(data-label);
    color: var(--muted, #77736e);
    font-size: .78rem;
    font-weight: 600;
  }

  #drivers-list .drivers-table .driver-main-cell {
    padding-right: 38px;
  }

  #drivers-list .drivers-table .driver-select-cell {
    position: absolute;
    z-index: 2;
    top: 12px;
    right: 12px;
    display: block;
    padding: 0;
    border: 0;
  }

  #drivers-list .drivers-table .driver-preview-cell {
    display: flex;
    justify-content: space-between;
    width: auto;
    padding-bottom: 0;
    border-bottom: 0;
  }

  #drivers-list .drivers-table .driver-preview-cell::before {
    content: attr(data-label);
    align-self: center;
  }
}

@media (max-width: 420px) {
  #drivers-list .drivers-table td {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}