/* Shared product UI. Loaded after feature styles so every workspace uses the
   same controls, spacing and states. Feature-specific data layouts stay local. */
:root {
  --blue: #2854cf;
  --ink: #1c2d47;
  --muted: #53647c;
  --line: #dce3ed;
  --surface: #fff;
  --canvas: #f5f7fa;
  --surface-subtle: #f8fafc;
  --soft-blue: #edf2ff;
  --radius-control: 8px;
  --radius-panel: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --control-height: 44px;
  background: var(--canvas);
}
body, .workspace { background: var(--canvas); }
::selection { background: #cfddff; color: #182f66; }
input, textarea { caret-color: var(--blue); }
* { scrollbar-color: #aebbd0 transparent; scrollbar-width: thin; }
:is(button,a,input,select,textarea,summary,[tabindex]):focus-visible {
  outline: 3px solid var(--blue); outline-offset: 3px;
}
.sidebar :is(button,a,summary):focus-visible { outline-color: #ffca55; }
button:disabled, .btn:disabled { cursor: not-allowed; opacity: .55; }
button, a, input, select, textarea { -webkit-tap-highlight-color: #2854cf20; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 150; padding: 12px 20px; background: var(--surface); color: var(--blue); border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.main:focus { outline: none; }
.sidebar { padding-top: 24px; }
.sidebar .nav { flex: 1; margin-top: 20px; }
.sidebar .nav a { min-height: 44px; border-radius: 8px; }
.profile-switcher { padding-top: 14px; margin-top: 12px; }
.profile-switcher summary { color: #d5e3ff; font-size: 12px; cursor: pointer; min-height: 44px; padding: 12px 10px; }
.profile-switcher button { min-height: 44px; }
.sidebar-foot { margin-top: 8px; padding-top: 8px; }
.topbar { height: 72px; border-color: var(--line); }
.workspace .main { padding: 28px 32px 40px; }
.workspace .page-heading { min-height: 44px; margin-bottom: 24px; gap: 16px; }
.workspace .page-heading h1 { font-size: 24px; line-height: 1.3; font-weight: 750; letter-spacing: -.5px; }
.section-title { margin: 0 0 14px; font-size: 16px; line-height: 1.5; font-weight: 700; }
.btn, .select-period, .heading-controls .btn,
.operational-view .table-tools > .btn, .weekly-actions .btn,
.settlement-workspace .btn, .finance-cash-filters .btn {
  min-height: var(--control-height); padding: 10px 14px;
  border-radius: var(--radius-control); border-color: var(--line);
  font-size: 13px; line-height: 1.5; font-weight: 650;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #2045af; border-color: #2045af; }
.btn:not(.primary):hover { background: var(--soft-blue); border-color: #b3c5ec; }
.btn:active { background: #dce6fa; }
.btn.primary:active { background: #193889; }
.icon-btn, .modal-close, .mobile-menu, .table-action { min-width: 44px; min-height: 44px; }
.panel, .dash-grid .panel { border-color: var(--line); border-radius: var(--radius-panel); }
.panel-title, .dash-grid .panel-title { color: var(--ink); font-size: 16px; font-weight: 700; }
.panel-link { min-height: 36px; font-size: 13px; white-space: normal; }
.section-toolbar, .table-tools { gap: 16px; flex-wrap: wrap; }
.table-tools, .operational-view .table-tools { padding: 16px 20px; }
.tabs, .operational-view .tabs, .section-tabs, .workday-tabs { gap: 4px; }
.section-tabs { margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.tab, .operational-view .tab, .section-tabs a, .workday-tab,
.settlement-workspace > .section-tabs a {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 12px; font-size: 13px; line-height: 1.5;
  color: var(--muted); font-weight: 650; background: transparent;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  text-decoration: none;
}
.tab.active, .operational-view .tab.active, .section-tabs a.active, .workday-tab.active {
  color: var(--blue); background: transparent; border-bottom-color: var(--blue); font-weight: 750;
}
.tab:hover, .section-tabs a:hover, .workday-tab:hover { background: var(--soft-blue); color: var(--blue); }
.tab span, .operational-view .tab span { font-size: 12px; color: var(--muted); }
.data-table th, .operational-view .cars-table th, .weekly-table thead th {
  background: var(--surface-subtle); color: var(--muted); font-size: 12px; font-weight: 650;
  padding-block: 14px; border-color: var(--line);
}
.data-table td, .operational-view .cars-table td { font-size: 14px; padding-block: 18px; border-color: #e9edf3; }
.data-table tbody tr:hover, .operational-view .cars-table tbody tr:hover { background: var(--surface-subtle); }
.cell-title, .operational-view .cars-table .cell-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.cell-sub, .operational-view .cars-table .cell-sub, .maintenance-notice.weekly,
.detail-notes, .detail-event small, .detail-row > span:first-child,
.field small, .activity-meta, .activity-time, .task-date { color: var(--muted); font-size: 12px; line-height: 1.6; }
.cell-link:hover, .table-action-label:hover, .panel-link:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.table-action-label, .operational-view .cars-table .table-action-label { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.plate, .operational-view .cars-table .plate { border-left-width: 1px; font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.rental-rate, .weekly-number, .stat-value, .detail-row, .entity-summary strong { font-variant-numeric: tabular-nums; }
.data-table .rate-cell { text-align: right; }
.drivers-table { width: 100%; table-layout: fixed; }
.drivers-table th:nth-child(1) { width: 25%; }
.drivers-table th:nth-child(2) { width: 20%; }
.drivers-table th:nth-child(3) { width: 18%; }
.drivers-table th:nth-child(4) { width: 20%; }
.drivers-table th:nth-child(5) { width: 17%; }
.driver-history { display: grid; gap: 28px; }
.driver-history > section { min-width: 0; }
.driver-history .detail-section { margin: 0 0 12px; }
.driver-history-event { padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-subtle); }
.driver-history-event + .driver-history-event { margin-top: 10px; }
.driver-history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.driver-history-head .table-action-label { min-height: 32px; font-weight: 700; text-align: left; }
.driver-history-status { padding: 4px 9px; border-radius: 6px; background: #e9edf3; color: var(--muted); font-size: 12px; font-weight: 650; }
.driver-history-status.active { background: #e5f5ef; color: #176b50; }
.driver-history-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 10px; font-size: 13px; }
.driver-history-facts span { min-width: 0; overflow-wrap: anywhere; }
.driver-history-facts small { display: block; color: var(--muted); margin-bottom: 3px; }
.driver-history-notes { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.driver-history-notes p { margin: 4px 0; }
.driver-history .revision-entry { padding: 12px 0; border-bottom: 1px solid var(--line); }
.driver-history .revision-entry p { margin: 5px 0; }
@media (max-width: 600px) { .driver-history-facts { grid-template-columns: 1fr 1fr; } }
.table-bottom { padding: 14px 20px; font-size: 12px; background: var(--surface-subtle); }
.badge, .document-status, .weekly-status { border-radius: 6px; font-size: 12px; line-height: 1.5; }
.maintenance-notice.weekly { margin-top: 6px; color: #81500a; }
.finance-modes { display: flex; gap: 4px; padding: 4px; width: fit-content; max-width: 100%; margin-bottom: 24px; background: #e8edf5; border-radius: 10px; }
.finance-modes a { display: flex; align-items: center; justify-content: center; padding: 10px 18px; min-height: 44px; color: #43536c; font-size: 14px; font-weight: 650; border-radius: 7px; text-decoration: none; text-align: center; }
.finance-modes a[aria-current] { background: var(--surface); color: var(--blue); }
.finance-modes a:hover { color: var(--blue); }
.finance-scope { gap: 16px; margin-bottom: 16px; }
.finance-filter { flex: 1 1 240px; max-width: 360px; }
.finance-filter > label, .weekly-toolbar label, .settlement-filter-grid label { font-size: 13px; color: var(--muted); }
.settlement-filter-panel { padding: 16px; margin-bottom: 24px; }
.weekly-toolbar :is(input,select), .document-filters :is(input,select),
.field :is(input,select,textarea), .settlement-filter-grid select { min-height: 44px; border-radius: 8px; border-color: #c5cfdd; font-size: 14px; }
input::placeholder, textarea::placeholder { color: #62728a; opacity: 1; }
.weekly-table { font-size: 13px; }
.weekly-table .cell-sub { font-size: 12px; }
.weekly-table thead tr > th:first-child { background: var(--surface-subtle); }
.weekly-table abbr { text-decoration: underline dotted; text-underline-offset: 4px; cursor: help; }
.weekly-footnote { font-size: 13px; line-height: 1.7; }
.weekly-heading, .weekly-toolbar { padding-inline: 20px; }
.weekly-heading { padding-top: 20px; }
.document-workspace .section-toolbar { margin-bottom: 4px; }
.empty, .workday-empty { color: var(--muted); font-size: 14px; padding: 32px 24px; }
.workday-controls { align-items: center; }
.workday-row-overdue { border-left-width: 1px; }
.workday-actions .btn.primary { color: var(--blue); background: var(--soft-blue); border-color: #c5d3f5; }
.workday-actions .btn.primary:hover { background: #dce6fc; }
.dashboard-priority { margin-bottom: 32px; }
.dashboard-priority .overview-links { gap: 0; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.dashboard-priority .overview-links a { padding: 18px 20px; min-width: 0; }
.dashboard-priority .overview-links strong { font-size: 23px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.dashboard-priority .overview-links .amount-negative { color: #a63742; }
.dashboard-priority .overview-links span { font-size: 13px; color: var(--muted); }
.dashboard-work .task-list { padding-top: 12px; }
.dashboard-work .task-row { align-items: center; min-height: 60px; padding: 12px 0; }
.task-check, .operational-view .task-check { width: 24px; height: 24px; margin: 0; }
.task-check:checked::after { left: 5px; top: 1px; font-size: 15px; }
.task-text { font-size: 14px; }
.task-text .cell-sub { margin-top: 3px; }
.dash-sync { margin: 0 0 16px; color: var(--muted); }
.dash-grid { gap: 24px; }
.dash-grid .panel { padding: 24px; }
.dash-totals a { color: var(--muted); font-size: 13px; }
.dash-totals strong { font-size: 26px; letter-spacing: -.5px; }
.dash-no-data { min-height: 120px; padding: 24px 12px; }
.dash-no-data-small { min-height: 140px; }
.is-empty-period .dash-finance { align-self: start; }
.is-empty-period .dash-empty-symbol { display: none; }
.is-empty-period .dash-average { align-self: start; }
.dash-data { color: var(--muted); font-size: 12px; }
.dash-data summary { min-height: 32px; padding: 6px 0; }
.dashboard-secondary { align-items: start; }
.dashboard-secondary .maintenance-overview { margin: 0; }
.maintenance-alert-row { min-height: 52px; }
dialog { border: 0; box-shadow: 0 16px 64px #14264340; border-radius: 14px; }
dialog { width: min(880px, calc(100vw - 32px)); max-width: 880px; }
dialog:has(.document-detail) { width: min(880px, calc(100vw - 32px)); max-width: 880px; }
dialog::backdrop { background: #17253f65; backdrop-filter: none; }
.modal-header { position: sticky; top: 0; z-index: 5; background: var(--surface); padding: 16px 24px; }
.modal-close { border-radius: 8px; }
.modal-close:hover { color: var(--blue); background: var(--soft-blue); }
.modal-footer { position: sticky; bottom: 0; z-index: 4; background: var(--surface); flex-wrap: wrap; }
.modal-footer .btn { max-width: 100%; white-space: normal; }
.handover-contract-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.handover-contract-actions .btn { white-space: normal; }
.identity-notice { padding: 15px 16px; border: 1px solid #eedbbb; border-radius: 9px; background: #fffbf3; color: #253756; }
.identity-notice > strong { display: block; font-size: 14px; }
.identity-notice ul { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.identity-notice li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid #f0e2c9; border-radius: 7px; background: #fff; }
.identity-notice li div { display: grid; gap: 3px; min-width: 0; }
.identity-notice li strong { font-size: 13px; }
.identity-notice li span, .identity-notice p { color: #715735; font-size: 12px; }
.identity-notice p { margin: 0; line-height: 1.5; }
.handover-contract-warning { margin: 8px 0 0; padding: 10px 12px; border: 1px solid #ead6a8; border-radius: 8px; background: #fff8e9; color: #754713; font-size: 13px; line-height: 1.5; }
.modal-body { padding: 24px; }
.field label { color: var(--ink); font-size: 13px; font-weight: 650; }
.form-error { color: #962d35; background: #fff0f1; font-size: 14px; }
dialog:has(.entity-detail) { width: min(880px, calc(100vw - 48px)); max-width: 880px; }
.entity-detail { padding: 24px 32px 32px; }
.entity-heading { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.entity-heading > div { flex: 1; min-width: 0; }
.entity-heading h3 { font-size: 23px; line-height: 1.35; margin: 0 0 8px; overflow-wrap: anywhere; }
.entity-heading > h3 { flex: 1; margin: 0; }
.entity-heading .car-photo { width: 80px; height: 64px; border-radius: 10px; }
.entity-heading .avatar { width: 48px; height: 48px; font-size: 15px; }
.entity-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.entity-summary { display: flex; flex-wrap: wrap; gap: 24px 48px; padding: 18px 0; border-block: 1px solid var(--line); margin-bottom: 20px; }
.entity-summary > div { display: grid; gap: 4px; }
.entity-summary span { color: var(--muted); font-size: 13px; }
.entity-summary strong { font-size: 24px; }
.entity-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.entity-tabs button { min-height: 44px; border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 10px 14px; font: inherit; font-size: 14px; color: var(--muted); }
.entity-tabs button[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); font-weight: 700; }
.entity-tabs button:hover { background: var(--soft-blue); }
.entity-panel[hidden] { display: none; }
.entity-panel { min-height: 160px; }
.entity-panel > .detail-section:first-child { margin-top: 0; }
.entity-panel .document-context { margin-top: 0; }
.entity-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 32px; }
.entity-facts .detail-row { align-items: flex-start; flex-direction: column; gap: 5px; padding: 14px 0; font-size: 14px; }
.entity-facts .detail-row > span:last-child { text-align: left; font-weight: 600; }
.entity-panel .detail-section { font-size: 15px; margin-top: 24px; }
.entity-panel .detail-event, .entity-panel .detail-notes { font-size: 13px; }
@media (max-width:1100px) {
  .workspace .main { padding-inline: 24px; }
  .dash-grid { gap: 20px; }
  .dash-totals { grid-template-columns: 1fr; gap: 12px; }
  .dash-totals > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
  .dash-totals div + div { border: 0; padding-left: 0; }
}
@media (max-width:1100px) {
  .workspace .page-heading { flex-wrap: wrap; align-items: flex-start; }
  .workspace .page-heading .heading-controls { flex-wrap: wrap; max-width: 100%; }
  .responsive-records, .responsive-records tbody { display: block; width: 100%; min-width: 0; white-space: normal; }
  .operational-view .cars-table.responsive-records { min-width: 0; table-layout: auto; }
  .responsive-records thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .responsive-records tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; padding: 20px 16px; border-bottom: 1px solid var(--line); }
  .responsive-records tbody tr:last-child { border: 0; }
  .data-table.responsive-records td, .operational-view .cars-table.responsive-records td { display: block; padding: 0; border: 0; min-width: 0; width: auto; text-align: left; overflow-wrap: anywhere; }
  .responsive-records td:first-child { grid-column: 1 / -1; }
  .responsive-records td[data-label]:not(:first-child):not(.actions-cell)::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; font-weight: 500; }
  .responsive-records .car-name, .responsive-records .driver-name { width: 100%; white-space: normal; min-height: 44px; }
  .responsive-records .cell-title { font-size: 16px; }
  .responsive-records .actions-cell { align-self: end; }
  .responsive-records .row-links { display: flex; }
  .responsive-records .table-action-label, .operational-view .cars-table.responsive-records .table-action-label { padding: 8px 12px; background: var(--soft-blue); border-radius: 8px; white-space: normal; }
  .responsive-records td a[href^="tel:"] { display: inline-flex; min-height: 44px; align-items: center; }
  .responsive-records .car-owner-link { white-space: normal; }
}
@media (max-width:760px) {
  .workspace .main { padding: 20px 16px 32px; }
  .workspace .page-heading { align-items: flex-start; margin-bottom: 20px; }
  .workspace .page-heading h1 { font-size: 22px; }
  .workspace .page-heading .heading-controls { max-width: 100%; flex-wrap: wrap; }
  .heading-controls .btn { min-height: 44px; font-size: 13px; }
  .topbar { height: 64px; padding-inline: 12px; gap: 8px; }
  .search-box input { min-width: 0; font-size: 14px; }
  .section-toolbar .tabs { max-width: 100%; }
  .section-tabs, .tabs { flex-wrap: wrap; }
  .table-tools, .operational-view .table-tools { padding: 12px 16px; gap: 12px; }
  .table-tools > .btn { min-height: 44px; }
  .finance-modes { width: 100%; }
  .finance-modes a { flex: 1; padding-inline: 10px; font-size: 13px; }
  .finance-filter { max-width: none; }
  .finance-scope { align-items: stretch; }
  .finance-scope > * { width: 100%; }
  input, select, textarea, .field :is(input,select,textarea),
  .weekly-toolbar :is(input,select), .document-filters :is(input,select),
  .settlement-filter-grid select, .workday-search input, .workday-kind select { font-size: 16px; }
  .weekly-table tr > th:first-child { min-width: 150px; width: 150px; max-width: 150px; }
  .weekly-table .weekly-driver { white-space: normal; min-height: 44px; }
  .dashboard-priority { margin-bottom: 24px; }
  .dashboard-priority .overview-links { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-priority .overview-links a { padding: 16px; border: 0; }
  .dashboard-priority .overview-links a:nth-child(even) { border-left: 1px solid var(--line); }
  .dashboard-priority .overview-links a:nth-child(n+3) { border-top: 1px solid var(--line); }
  .dashboard-priority .overview-links strong { font-size: 21px; }
  .dash-grid .panel { padding: 20px; }
  .dash-fleet { grid-template-columns: 110px minmax(0,1fr); gap: 16px; }
  .dash-ring { width: 110px; }
  .dash-ring strong { font-size: 24px; }
  .dash-no-data, .dash-no-data-small { min-height: 100px; }
  .dashboard-secondary { grid-template-columns: 1fr; }
  .workday-tabs { width: 100%; display: flex; flex-wrap: nowrap; }
  .workday-tab { flex: 1; padding-inline: 6px; gap: 4px; font-size: 12px; }
  .workday-tab span { min-width: auto; }
  .workday-filters { width: 100%; }
  .workday-row-overdue { border-left: 0; }
  .modal-body, .entity-detail { padding: 20px; }
  dialog:has(.entity-detail) { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  .modal-header { padding: 12px 16px; }
  .modal-header h2 { font-size: 18px; }
  .modal-footer { padding: 14px 16px max(14px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .modal-footer .btn { flex: 1; }
  .entity-heading { gap: 12px; }
  .entity-heading h3 { font-size: 20px; }
  .entity-heading .car-photo { width: 56px; height: 48px; }
  .entity-heading > .badge { margin-left: 68px; }
  .entity-actions .btn { flex: 1 1 130px; white-space: normal; text-align: center; }
  .entity-tabs { gap: 0; }
  .entity-tabs button { padding-inline: 10px; font-size: 13px; }
  .entity-facts { grid-template-columns: 1fr; }
  .entity-summary { gap: 20px; }
  .entity-summary strong { font-size: 22px; }
  .entity-panel .modal-buttons .btn { flex: 1 1 130px; white-space: normal; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .select-period { transition: none; }
}

.identity-notice .identity-exception { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #eedbbb; cursor: pointer; color: #253756; line-height: 1.4; }
.identity-notice .identity-exception input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; flex: 0 0 18px; padding: 0; margin: 0; accent-color: #2854cf; }
