:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --text: #19212a;
  --muted: #657281;
  --line: #d8e0e7;
  --accent: #126a64;
  --accent-2: #0f5752;
  --danger: #b42318;
  --warn: #b76b00;
  --ok: #1f7a45;
  --shadow: 0 12px 28px rgba(28, 43, 56, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px clamp(16px, 4vw, 44px);
  background: #17212b;
  color: #fff;
}

.topbar h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
}

.topbar p {
  margin: 8px 0 0;
  color: #b9c5cf;
}

.top-actions,
.form-actions,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #dfe9ef;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 12px clamp(16px, 4vw, 44px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab,
.button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 8px 14px;
  white-space: nowrap;
}

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

.button.primary:hover {
  background: var(--accent-2);
}

.button.ghost {
  background: transparent;
  color: inherit;
}

.button.danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.file-button input {
  display: none;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto;
  gap: 8px;
  margin-bottom: 16px;
  align-items: end;
}

main {
  padding: 22px clamp(16px, 4vw, 44px) 40px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

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

.summary-card,
.content-section,
.editor,
.item-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-card {
  padding: 16px;
}

.summary-card strong {
  display: block;
  font-size: 30px;
  line-height: 1.1;
}

.summary-card span {
  color: var(--muted);
}

.content-section {
  padding: 16px;
  margin-bottom: 18px;
}

.layout {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.grow {
  flex: 1;
  min-width: 0;
}

.editor {
  width: 340px;
  padding: 16px;
  position: sticky;
  top: 12px;
}

.editor h2,
.section-title h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.editor label {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
}

textarea {
  resize: vertical;
}

.form-actions {
  margin-top: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title span {
  color: var(--muted);
}

.search {
  max-width: 240px;
}

.schedule-filter {
  min-width: 180px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.wages-grid {
  display: grid;
  gap: 18px;
}

.wage-group {
  display: grid;
  gap: 10px;
}

.compact-title {
  margin-bottom: 0;
}

.compact-title h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.wage-cards {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.wage-card {
  box-shadow: none;
}

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

.wage-table th,
.wage-table td {
  text-align: center;
  vertical-align: middle;
}

.wage-table .wage-name {
  min-width: 210px;
  text-align: left;
  font-weight: 700;
}

.wage-input {
  width: 96px;
  min-height: 36px;
  padding: 6px 8px;
  text-align: right;
}

.wage-cash-cell { min-width: 118px; }
.wage-extras-cell { position: relative; }
.wage-comment-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: #c8171f; box-shadow: 0 1px 3px rgba(0,0,0,.35); pointer-events: none; }
.wage-commented-cell .wage-input { border-color: #c8171f; background: #fff8e8; }

.wage-sum {
  min-width: 100px;
  font-weight: 800;
  white-space: nowrap;
}

.item-card {
  padding: 14px;
}

.item-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.item-card h3 {
  margin: 0;
  font-size: 18px;
}

.muted {
  color: var(--muted);
}

.details {
  display: grid;
  gap: 8px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--surface-2);
  padding-top: 8px;
}

.detail-row span:first-child {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 13px;
  background: var(--surface-2);
  color: var(--text);
}

.badge.ok {
  background: #e3f3ea;
  color: var(--ok);
}

.badge.warn {
  background: #fff2d9;
  color: var(--warn);
}

.badge.danger {
  background: #fde4e1;
  color: var(--danger);
}

.card-actions {
  display: flex;
  gap: 6px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

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

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #f8fafb;
}

.daily-table {
  max-width: 680px;
}

.daily-vehicle-select {
  width: 100%;
  min-width: 150px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 4px 28px 4px 8px;
}

.daily-vehicle-select:focus {
  border-color: #003a70;
  box-shadow: 0 0 0 2px rgba(0, 58, 112, .18);
  outline: none;
}

.daily-table th,
.daily-table td {
  text-align: center;
}

.daily-table td:nth-child(2),
.daily-driver-row td {
  text-align: left;
}

.daily-driver-row td {
  color: var(--muted);
  padding-top: 0;
}

.daily-breakdowns {
  max-width: 980px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px solid #f2c7ca;
}

.daily-breakdowns-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.daily-breakdowns-header h3,
.daily-breakdowns-header p {
  margin: 0;
}

#dailyBreakdownList {
  display: grid;
  gap: 10px;
}

.daily-breakdown-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(220px, 1.4fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid #f2c7ca;
  border-left: 5px solid var(--danger);
  border-radius: 8px;
  background: #fff8f8;
}

.daily-breakdown-row label {
  display: grid;
  gap: 5px;
  color: var(--danger);
  font-weight: 700;
}

.daily-breakdown-row select,
.daily-breakdown-row input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 7px 9px;
}

.daily-breakdown-empty {
  margin: 0;
}

.daily-available-vehicles {
  max-width: 980px;
  margin-top: 18px;
  padding: 16px;
  border: 2px solid #9bd3aa;
  border-radius: 12px;
  background: #eaf8ee;
}

.daily-available-vehicles-header {
  margin-bottom: 12px;
}

.daily-available-vehicles-header h3,
.daily-available-vehicles-header p {
  margin: 0;
}

.daily-available-vehicles-header h3 {
  color: #146c43;
}

#dailyAvailableVehicleList {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.daily-available-vehicle {
  padding: 12px 14px;
  border-left: 5px solid #198754;
  border-radius: 8px;
  background: #d1f0d9;
  color: #0f5132;
  font-weight: 800;
}

.daily-available-empty {
  margin: 0;
  color: #146c43;
}

.vehicle-breakdowns-section {
  margin-top: 18px;
}

.vehicle-breakdowns-title,
.vehicle-breakdown-export {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.vehicle-breakdowns-title h2,
.vehicle-breakdowns-title p {
  margin: 0;
}

.vehicle-breakdown-export {
  justify-content: flex-start;
  margin: 14px 0;
}

.vehicle-breakdown-export label {
  display: grid;
  gap: 4px;
  font-weight: 700;
}

.vehicle-breakdown-history-title {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 2px solid var(--line);
}

.vehicle-breakdown-history-title h2,
.vehicle-breakdown-history-title p {
  margin: 0;
}

.vehicle-breakdown-table {
  min-width: 1180px;
}

.vehicle-breakdown-table th,
.vehicle-breakdown-table td {
  vertical-align: middle;
}

.vehicle-breakdown-table select,
.vehicle-breakdown-table input[type="text"],
.vehicle-breakdown-table input[type="date"],
.vehicle-breakdown-table input:not([type]) {
  width: 100%;
  min-width: 145px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 7px 9px;
}

.vehicle-breakdown-table td:nth-child(3) input {
  min-width: 220px;
}

.vehicle-breakdown-table td:nth-child(4),
.vehicle-breakdown-table td:nth-child(5),
.vehicle-breakdown-table td:nth-child(6) {
  text-align: center;
}

.replacement-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.replacement-check input {
  width: 20px;
  height: 20px;
}

.vehicle-breakdown-actions {
  display: flex;
  gap: 6px;
}

.vehicle-breakdown-completed {
  background: #f5f7f8;
  color: var(--muted);
}

.daily-route {
  display: inline-flex;
  justify-content: center;
  min-width: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  font-weight: 700;
}

.alert-list {
  display: grid;
  gap: 8px;
}

.notification-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.notification-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--dark);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.notification-filter strong {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #edf1f4;
  text-align: center;
}

.notification-filter.active {
  border-color: var(--dark);
  box-shadow: 0 0 0 2px rgba(30, 42, 54, .12);
}

.notification-filter.danger strong { background: #fde4e5; color: #a51218; }
.notification-filter.urgent strong { background: #fff0d8; color: #8b5100; }
.notification-filter.upcoming strong { background: #e1f3e9; color: #176342; }

.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.alert-item.notification-overdue { border-left: 6px solid #c8171f; background: #fff7f7; }
.alert-item.notification-week { border-left: 6px solid #d78a16; background: #fffaf1; }
.alert-item.notification-month { border-left: 6px solid #247454; background: #f5fbf8; }

.data-quality-total {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 11px;
  border-radius: 999px;
  background: #edf1f4;
  font-weight: 800;
}

.data-quality-total.danger { background: #fde4e5; color: #a51218; }
.data-quality-total.warn { background: #fff0d8; color: #8b5100; }
.data-quality-total.ok { background: #e1f3e9; color: #176342; }

.data-quality-list {
  display: grid;
  gap: 8px;
}

.data-quality-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.data-quality-item.danger { border-left: 6px solid #c8171f; }
.data-quality-item.warn { border-left: 6px solid #d78a16; }

.data-quality-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: #edf1f4;
  font-weight: 900;
}

.data-quality-item.danger .data-quality-icon { background: #fde4e5; color: #a51218; }
.data-quality-item.warn .data-quality-icon { background: #fff0d8; color: #8b5100; }

.data-quality-ok {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px;
  border: 1px solid #bfe1ce;
  border-radius: 10px;
  background: #f2fbf6;
  color: #176342;
}

.alert-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.reminder-button {
  white-space: nowrap;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
}

.legend span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px 10px;
}

.monthly-wrap {
  max-height: calc(100vh - 250px);
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.monthly-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.monthly-table th,
.monthly-table td {
  min-width: 0;
  padding: 3px 1px;
  text-align: center;
  border-right: 1px solid var(--line);
}

.monthly-table th {
  position: sticky;
  top: 0;
  z-index: 4;
}

.monthly-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 30px;
  min-width: 30px;
  background: #fff;
}

.monthly-table .sticky-col.name-col {
  left: 30px;
  width: 142px;
  min-width: 142px;
  text-align: left;
}

.monthly-table th.sticky-col {
  z-index: 5;
  background: #f8fafb;
}

.monthly-table .route-col {
  min-width: 0;
  font-weight: 700;
}

.monthly-table .wage-col {
  width: 88px;
  min-width: 72px;
  font-weight: 700;
}

.monthly-table .weekend {
  background: #f2f5f7;
}

.monthly-table input {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 3px 0;
  font-size: 10px;
  text-align: center;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid #c6d3de;
  border-radius: 4px;
  outline: none;
  font-family: inherit;
  line-height: 1.2;
  box-sizing: border-box;
  caret-color: #003a70;
  pointer-events: auto;
  user-select: text;
}

#monthlyMonth { pointer-events: auto; }

.copy-driver-schedule {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 5px 7px;
  border: 1px solid #aeb7c0;
  border-radius: 6px;
  background: #fff;
  color: #252c34;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.copy-driver-schedule:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-driver-schedule.copied {
  border-color: #2f8f46;
  background: #e7f6eb;
  color: #246f37;
}

.monthly-table input:focus {
  border-color: #003a70;
  box-shadow: 0 0 0 2px rgba(0, 58, 112, .18);
  position: relative;
  z-index: 3;
}

.monthly-commented-cell {
  position: relative;
}

.monthly-comment-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 6;
  width: 8px;
  height: 8px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: #c8171f;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  pointer-events: none;
}

.monthly-comment-menu {
  position: fixed;
  z-index: 10000;
  min-width: 180px;
  padding: 6px;
  border: 1px solid #b8c0c8;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .24);
}

.monthly-comment-menu button {
  display: block;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #20262d;
  text-align: left;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.monthly-comment-menu button:hover {
  background: #eef2f5;
}

.monthly-comment-menu button.danger {
  color: #a70f16;
}

.monthly-table tr.employment-fulltime td:nth-child(1),
.monthly-table tr.employment-fulltime td:nth-child(2) {
  background: #f0faef;
}

.monthly-table tr.employment-contract td:nth-child(1),
.monthly-table tr.employment-contract td:nth-child(2) {
  background: #eef8ff;
}

.monthly-table tr.employment-fulltime .sticky-col,
.monthly-table tr.employment-contract .sticky-col {
  background: inherit;
}

.monthly-table input.code-work {
  border-color: #98d8c9;
  background: #e7f6f2;
}

.monthly-table input.code-yellow {
  border-color: #e4cb70;
  background: #fff2b8;
}

.daily-route.code-yellow {
  border-color: #e4cb70;
  background: #fff2b8;
}

.monthly-table input.code-trf61 {
  border-color: #e7a56d;
  background: #f9cba6;
}

.daily-route.code-trf61 {
  border-color: #e7a56d;
  background: #f9cba6;
}

.monthly-table input.code-purple {
  border-color: #b8a4d6;
  background: #d8caee;
}

.daily-route.code-purple {
  border-color: #b8a4d6;
  background: #d8caee;
}

.monthly-table input.code-free {
  border-color: #d7dde3;
  background: #f1f4f6;
}

.daily-route.code-available,
.monthly-table input.code-available {
  border-color: #71c884;
  background: #dff5e5;
}

.monthly-table input.code-leave {
  border-color: #f0ca79;
  background: #fff5dc;
}

.monthly-table input.code-sick {
  border-color: #efa35d;
  background: #ffe0bf;
}

.monthly-table input.is-active {
  border-color: #003a70;
  box-shadow: 0 0 0 3px rgba(0, 58, 112, .32);
  outline: 2px solid #003a70;
  outline-offset: 1px;
  position: relative;
  z-index: 4;
}

.monthly-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: #fff;
  font-weight: 700;
}

.monthly-table tfoot .wage-total-label {
  text-align: right;
  background: #e8f1f8;
  color: #17324a;
}

.monthly-table tfoot .wage-total {
  background: #003a70;
  color: #fff;
  white-space: nowrap;
}

.monthly-table tfoot td.total-low {
  background: #ff4a4a;
  color: #fff;
}

.monthly-table tfoot td.total-exact {
  background: #fff2b8;
  color: #4d3b00;
}

.monthly-table tfoot td.total-high {
  background: #7fd95d;
  color: #173b12;
}

.monthly-table tfoot td.route-count-alert {
  background: #d82029;
  color: #fff;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px #9f0d14;
}

@media (max-width: 900px) {
  .topbar,
  .layout,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .editor,
  .search {
    width: 100%;
    max-width: none;
  }

  .editor {
    order: 2;
    position: static;
  }

  .grow {
    order: 1;
  }

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

@media (max-width: 520px) {
  body {
    min-width: 0;
  }

  .topbar {
    padding: 16px;
    gap: 12px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    font-size: 26px;
  }

  .top-actions,
  .filters,
  .form-actions,
  .inline-form {
    width: 100%;
  }

  .top-actions > *,
  .filters > *,
  .form-actions > * {
    flex: 1 1 auto;
  }

  .schedule-filter {
    min-width: 0;
  }

  .tab,
  .button,
  input,
  select,
  textarea {
    min-height: 44px;
  }

  .tabs {
    padding: 8px 12px;
    gap: 6px;
  }

  .tab {
    padding: 9px 12px;
  }

  main {
    padding: 14px 10px 28px;
  }

  .content-section,
  .editor,
  .item-card {
    padding: 12px;
  }

  .section-title {
    gap: 10px;
  }

  .daily-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  .daily-vehicle-select {
    min-width: 0;
    min-height: 42px;
  }

  .daily-table th:first-child,
  .daily-table td:first-child {
    width: 46px;
  }

  .daily-table th:last-child,
  .daily-table td:last-child {
    width: 76px;
  }

  .daily-route {
    min-width: 64px;
    padding: 7px 8px;
  }

  .daily-breakdowns-header {
    align-items: stretch;
    flex-direction: column;
  }

  .daily-breakdown-row {
    grid-template-columns: 1fr;
  }

  .monthly-wrap {
    max-height: calc(100vh - 210px);
    border-radius: 6px;
  }

  .monthly-table th,
  .monthly-table td {
    min-width: 58px;
    padding: 4px;
  }

  .monthly-table .sticky-col {
    min-width: 34px;
  }

  .monthly-table .sticky-col.name-col {
    left: 34px;
    min-width: 132px;
    font-size: 12px;
  }

  .monthly-table input {
    width: 50px;
    min-height: 38px;
    padding: 4px 2px;
    font-size: 14px;
  }

  .monthly-table .wage-col {
    min-width: 92px;
  }

  .alert-item {
    align-items: stretch;
    flex-direction: column;
  }

  .alert-actions {
    justify-content: space-between;
    width: 100%;
  }

  .notification-filters {
    justify-content: flex-start;
  }

  .data-quality-item {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .data-quality-item .button {
    grid-column: 1 / -1;
    width: 100%;
  }

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

@media (pointer: coarse) {
  .icon-button {
    width: 44px;
    height: 44px;
  }

  .monthly-table input,
  .daily-vehicle-select {
    touch-action: manipulation;
  }
}

/* MAW Trans visual refresh — 1.0.10 */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f3f5f7;
  --text: #161a20;
  --muted: #66717d;
  --line: #d9dee4;
  --accent: #c8171f;
  --accent-2: #9f1017;
  --accent-soft: #fff0f1;
  --dark: #15191f;
  --dark-2: #232a32;
  --danger: #a70f16;
  --warn: #b66a00;
  --ok: #167149;
  --shadow: 0 10px 30px rgba(24, 30, 37, .08);
  --shadow-hover: 0 16px 38px rgba(24, 30, 37, .14);
}

body {
  background:
    radial-gradient(circle at 92% 2%, rgba(200, 23, 31, .08), transparent 24rem),
    linear-gradient(180deg, #f7f8fa 0, var(--bg) 520px);
}

.topbar {
  min-height: 132px;
  padding: 20px clamp(18px, 4vw, 52px);
  background:
    linear-gradient(110deg, rgba(200, 23, 31, .14), transparent 38%),
    linear-gradient(135deg, #0e1115, #20262d 68%, #15191f);
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 10px 32px rgba(0, 0, 0, .22);
}

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

.brand-logo-wrap {
  width: 98px;
  height: 92px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 4px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .65);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28), 0 0 0 4px rgba(255, 255, 255, .07);
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.brand-kicker {
  display: block;
  margin-bottom: 6px;
  color: #ff4b52;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .22em;
}

.topbar h1 {
  font-size: clamp(25px, 3vw, 37px);
  font-weight: 800;
  letter-spacing: -.035em;
}

.topbar p {
  margin-top: 7px;
  color: #c4ccd4;
  font-size: 14px;
}

.top-actions {
  justify-content: flex-end;
  align-items: center;
}

.sync-badge {
  position: relative;
  min-height: 42px;
  padding: 10px 13px 10px 31px;
  border-color: rgba(255, 255, 255, .15);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: #eef2f5;
  backdrop-filter: blur(8px);
}

.sync-badge::before {
  content: "";
  position: absolute;
  left: 13px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #56d68b;
  box-shadow: 0 0 0 4px rgba(86, 214, 139, .14);
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  gap: 7px;
  padding: 11px clamp(16px, 4vw, 52px);
  border-bottom: 1px solid #d8dde3;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 5px 20px rgba(26, 32, 39, .07);
  backdrop-filter: blur(12px);
}

.global-period-picker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 5px 8px 5px 11px;
  border: 1px solid #d8dde3;
  border-radius: 10px;
  background: #fff;
  color: #525d68;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.global-period-picker input {
  min-height: 30px;
  width: 142px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.global-period-picker input:focus {
  outline: 2px solid rgba(200, 23, 31, .28);
  outline-offset: 2px;
}

.tab,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 10px;
  font-weight: 700;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

.button[data-icon]::before,
.file-button[data-icon]::before {
  content: attr(data-icon);
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.tab {
  border-color: transparent;
  background: transparent;
  color: #525d68;
}

.tab:hover {
  border-color: #e2e5e9;
  background: #f5f6f8;
  color: var(--text);
}

.tab.active {
  border-color: var(--dark);
  background: var(--dark);
  color: #fff;
  box-shadow: 0 7px 17px rgba(21, 25, 31, .2);
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(24, 30, 37, .13);
}

.button.primary {
  border-color: var(--accent);
  background: linear-gradient(135deg, #d82029, #b30f17);
  box-shadow: 0 7px 16px rgba(200, 23, 31, .23);
}

.button.primary:hover {
  border-color: var(--accent-2);
  background: linear-gradient(135deg, #c8171f, #941017);
}

.button.ghost {
  border-color: #cfd5db;
  background: #fff;
  color: #303942;
}

.topbar .button.ghost {
  border-color: rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.topbar .button.ghost:hover {
  border-color: rgba(255, 255, 255, .38);
  background: rgba(255, 255, 255, .15);
}

.button.danger {
  border-color: #e4545b;
  background: transparent;
  color: #ffb8bc;
}

main {
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: 28px clamp(14px, 3vw, 42px) 48px;
}

.summary-grid {
  gap: 16px;
}

.summary-card,
.content-section,
.editor,
.item-card {
  border-color: rgba(205, 211, 217, .9);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.summary-card {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 20px;
  border-top: 4px solid var(--dark);
}

.summary-card::after {
  content: "";
  position: absolute;
  width: 94px;
  height: 94px;
  right: -42px;
  top: -48px;
  border-radius: 50%;
  background: rgba(200, 23, 31, .08);
}

.summary-card:nth-child(2) { border-top-color: #c8171f; }
.summary-card:nth-child(3) { border-top-color: #d78a16; }
.summary-card:nth-child(4) { border-top-color: #247454; }

.summary-card strong {
  margin-bottom: 6px;
  font-size: 34px;
  font-weight: 850;
  letter-spacing: -.04em;
}

.summary-card span {
  font-weight: 600;
}

.content-section,
.editor {
  padding: 20px;
}

.content-section:hover,
.item-card:hover {
  border-color: #c8ced5;
  box-shadow: var(--shadow-hover);
}

.section-title {
  padding-bottom: 13px;
  border-bottom: 1px solid #edf0f2;
}

.section-title h2,
.editor h2 {
  color: #171c22;
  font-weight: 800;
  letter-spacing: -.02em;
}

.editor {
  border-top: 4px solid var(--accent);
}

.editor label {
  color: #535f6b;
  font-weight: 650;
}

input,
select,
textarea {
  min-height: 42px;
  border-color: #cdd4db;
  border-radius: 9px;
  background: #fbfcfd;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aeb7c0;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(200, 23, 31, .12);
}

.item-card {
  border-left: 4px solid #343c45;
  padding: 17px;
}

.item-card h3 {
  font-weight: 800;
}

.badge {
  border: 0;
  border-radius: 999px;
  font-weight: 700;
}

.badge.ok { background: #e5f5ed; color: #12683f; }
.badge.warn { background: #fff1d9; color: #8d5200; }
.badge.danger { background: #ffe5e7; color: #9e1118; }

.icon-button {
  border-color: #d5dbe0;
  border-radius: 9px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

th {
  border-bottom: 2px solid #cfd5da;
  background: #f1f3f5;
  color: #3e4954;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .035em;
}

tbody tr:hover td {
  background-color: #fafbfc;
}

.legend span {
  border: 0;
  border-radius: 999px;
  background: #f1f3f5;
  color: #4a5560;
  font-weight: 650;
}

.monthly-wrap {
  border-color: #cbd2d9;
  border-radius: 12px;
  box-shadow: inset 0 1px 0 #fff;
}

.monthly-table th {
  background: #252c34;
  color: #fff;
  border-color: #3d4650;
}

.monthly-table th.sticky-col {
  background: #1a1f25;
}

.monthly-table input {
  border-radius: 7px;
}

.monthly-table input:focus,
.monthly-table input.is-active {
  border-color: var(--accent);
  outline-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 23, 31, .22);
  caret-color: var(--accent);
}

.monthly-table tfoot .wage-total-label {
  background: #303842;
  color: #fff;
}

.monthly-table tfoot .wage-total {
  background: var(--accent);
}

.alert-item {
  border-left: 4px solid #d88912;
  border-radius: 10px;
  background: #fffdf8;
}

@media (max-width: 900px) {
  .topbar {
    align-items: stretch;
  }

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

@media (max-width: 520px) {
  .topbar {
    min-height: auto;
    padding: 14px;
  }

  .brand {
    gap: 12px;
  }

  .brand-logo-wrap {
    width: 68px;
    height: 68px;
    border-radius: 13px;
  }

  .brand-kicker {
    margin-bottom: 3px;
    font-size: 10px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .topbar p {
    display: none;
  }

  .sync-badge {
    width: 100%;
    justify-content: center;
  }

  .tabs {
    padding: 8px 10px;
  }

  .global-period-picker {
    margin-left: 0;
  }

  .tab {
    min-height: 42px;
    padding: 8px 11px;
  }

  main {
    padding-top: 16px;
  }

  .content-section,
  .editor {
    padding: 14px;
    border-radius: 12px;
  }
}

/* Fallback brand layout for the existing header markup */
.topbar > div:first-child { display: flex; align-items: center; gap: 18px; min-width: 0; }
.topbar > div:first-child::before { content: ""; width: 98px; height: 92px; flex: 0 0 auto; border-radius: 18px; background: #fff url("logo-maw-trans.png") center / contain no-repeat; border: 1px solid rgba(255,255,255,.65); box-shadow: 0 10px 28px rgba(0,0,0,.28), 0 0 0 4px rgba(255,255,255,.07); }
.topbar > div:first-child h1::before { content: "MAW TRANS"; display: block; margin-bottom: 7px; color: #ff4b52; font-size: 12px; font-weight: 900; letter-spacing: .22em; }
.tab::before { display: none !important; content: none !important; }
#generateMonthlyBtn::before { content: "+"; }
#importMonthlyBtn::before { content: "↑"; }
#exportMonthlyBtn::before, #exportBtn::before { content: "↓"; }
@media (max-width: 520px) {
.topbar > div:first-child { gap: 12px; }
.topbar > div:first-child::before { width: 68px; height: 68px; border-radius: 13px; }
.topbar > div:first-child h1::before { margin-bottom: 3px; font-size: 10px; }
}
/* Weekend contrast fix — 1.0.11 */
.monthly-table th.weekend { background: #4a2528 !important; color: #ffffff !important; border-color: #6a3539 !important; }
.monthly-table td.weekend { background-color: #f7ecee; color: #2d2022; }
.monthly-table th.weekend.sticky-col { background: #371a1d !important; }
/* Driver details and annual leave */
.driver-info-button { min-height: 34px; padding: 7px 12px; }
.driver-info-grid { display: grid; grid-template-columns: minmax(280px, .85fr) minmax(420px, 1.4fr); gap: 18px; align-items: start; }
.driver-details-card, .driver-leave-card { padding: 20px; border: 1px solid #dce3ec; border-radius: 16px; background: #fff; box-shadow: 0 8px 24px rgba(22, 34, 51, .07); }
.driver-details-card h3, .driver-leave-card h3 { margin: 0 0 16px; }
.driver-notes { margin: 16px 0; padding: 14px; border-radius: 12px; background: #f5f7fa; }
.driver-notes span { color: #687387; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.driver-notes p { margin: 7px 0 0; white-space: pre-wrap; }
.leave-inputs { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.leave-inputs label { display: grid; gap: 7px; color: #465268; font-size: 13px; font-weight: 700; }
.leave-inputs input { width: 100%; }
.leave-metrics { display: grid; grid-template-columns: repeat(2, minmax(170px, 1fr)); gap: 12px; }
.leave-metric { min-height: 94px; padding: 15px; border: 1px solid #dce3ec; border-radius: 13px; background: #f7f9fc; }
.leave-metric span { display: block; min-height: 34px; color: #657187; font-size: 12px; font-weight: 750; }
.leave-metric strong { display: block; margin-top: 7px; font-size: 25px; }
.leave-metric.good, .leave-metric.positive { border-color: #a9ddc0; background: #eefaf3; color: #14753c; }
.leave-metric.warn, .leave-metric.negative { border-color: #f3cd83; background: #fff8e8; color: #9a5b00; }
.leave-metric.carryover { border-color: #d8b7ef; background: #f8f0ff; color: #71369a; }
.leave-metric.total { grid-column: 1 / -1; border-color: #9ebcf2; background: #edf4ff; color: #174d9b; }
@media (max-width: 900px) { .driver-info-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .leave-inputs, .leave-metrics { grid-template-columns: 1fr; } .leave-metric.carryover { border-color: #d8b7ef; background: #f8f0ff; color: #71369a; }
.leave-metric.total { grid-column: auto; } }
/* Driver list and internal editor layout — 1.0.21 */
.driver-cards { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.driver-summary-card header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.driver-summary-card h3 { min-width: 0; overflow-wrap: anywhere; }
.driver-summary-card .card-actions { flex: 0 0 auto; align-items: center; white-space: nowrap; }
.driver-summary-card .driver-info-button { min-width: 102px; }
.driver-list-title .filters { flex-wrap: wrap; }
.driver-editor-section { max-width: 820px; margin: 0 auto; }
.driver-editor-form { position: relative; z-index: 1; width: 100%; max-width: 640px; margin: 0 auto; }
.driver-editor-form input:not([type="hidden"]),
.driver-editor-form select,
.driver-editor-form textarea {
  position: relative;
  z-index: 2;
  pointer-events: auto !important;
  user-select: text;
  touch-action: manipulation;
}
.driver-editor-form input:focus,
.driver-editor-form select:focus,
.driver-editor-form textarea:focus {
  border-color: #174d9b;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(23,77,155,.16);
  outline: none;
}
@media (max-width: 460px) {
  .driver-cards { grid-template-columns: 1fr; }
  .driver-summary-card header { grid-template-columns: 1fr; }
  .driver-summary-card .card-actions { width: 100%; justify-content: space-between; }
  .driver-summary-card .driver-info-button { flex: 1 1 auto; }
}
/* Vehicle details, assignments and card reminders — 1.0.22 */
.car-cards { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.car-summary-card header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.car-summary-card .card-actions { white-space: nowrap; }
.car-info-button { min-height: 34px; min-width: 102px; padding: 7px 12px; }
.card-reminders { display: grid; gap: 8px; margin-top: 14px; padding: 13px; border: 1px solid #cfd9e7; border-radius: 12px; background: #f7faff; }
.card-reminders > strong { color: #33445e; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.reminder-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 8px; border-top: 1px solid #e1e7f0; font-size: 13px; }
.reminder-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.car-info-grid { display: grid; grid-template-columns: minmax(300px, 760px); justify-content: center; }
.car-editor-section { max-width: 820px; margin: 0 auto; }
.car-editor-form { width: 100%; max-width: 640px; margin: 0 auto; }
@media (max-width: 500px) {
  .car-cards { grid-template-columns: 1fr; }
  .car-summary-card header { grid-template-columns: 1fr; }
  .car-summary-card .card-actions { width: 100%; justify-content: space-between; }
  .car-info-button { flex: 1 1 auto; }
  .reminder-row { align-items: flex-start; flex-direction: column; }
}
/* Wage totals and leave-card actions — 1.0.23 */
.wage-group-total td { border-top: 2px solid #9ba9bc; background: #eef3f9; font-weight: 900; }
.wage-group-total td:first-child { text-align: right; }
.wage-deduction, .wage-deduction-cell { color: #b31318 !important; }
.wage-deduction { border-color: #e2aeb0 !important; background: #fff5f5 !important; font-weight: 800; }
.wage-overall-summary { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 14px; margin-top: 18px; }
.wage-overall-summary > div { padding: 18px; border: 1px solid #cdd9e8; border-radius: 14px; background: #f5f9ff; }
.wage-overall-summary span, .wage-overall-summary strong { display: block; }
.wage-overall-summary span { color: #52627a; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.wage-overall-summary strong { margin-top: 8px; color: #174d9b; font-size: 22px; }
.wage-overall-summary .wage-overall-grand { background: #eef8f1; border-color: #aed7bb; }
.wage-overall-summary .wage-overall-grand strong { color: #14753c; }
@media (max-width: 850px) { .wage-overall-summary { grid-template-columns: 1fr; } }
.leave-card-col { min-width: 165px; }
.leave-card-button, .settlement-button { width: 100%; min-height: 36px; padding: 7px 8px; white-space: normal; font-size: 12px; line-height: 1.15; }
/* Other tools, information buttons and Saturday wages — 1.0.24 */
.driver-info-button, .car-info-button { background: #edf5ff; border-color: #b8cdeb; color: #214f86; }
.driver-info-button:hover, .car-info-button:hover { background: #dfeeff; border-color: #8fb1de; }
.other-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 430px)); gap: 18px; }
.document-action-card { display: grid; gap: 14px; padding: 20px; border: 1px solid #d7e0eb; border-radius: 16px; background: linear-gradient(145deg, #f8fbff, #eef4fa); box-shadow: 0 8px 24px rgba(22,34,51,.06); }
.document-action-card h3, .document-action-card p { margin: 0; }
.document-action-card label { display: grid; gap: 7px; color: #465268; font-weight: 700; }
.document-action-card select, .document-action-card input { width: 100%; }
/* Stopka i pomoc */
.app-rights { padding: 16px 24px 22px; color: #687387; font-size: 12px; text-align: right; border-top: 1px solid #dce3ec; background: #f7f9fc; }
.help-section { max-width: 1180px; margin-inline: auto; }
.help-quick-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.help-quick-links button { min-height: 36px; padding: 8px 11px; border: 1px solid #c9d5e5; border-radius: 999px; background: #f4f8fd; color: #174d9b; font: inherit; font-size: 13px; font-weight: 750; cursor: pointer; }
.help-quick-links button:hover, .help-quick-links button:focus-visible { border-color: #174d9b; background: #e7f0fc; outline: none; }
.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.help-grid details { align-self: start; border: 1px solid #d7e0eb; border-radius: 12px; background: #fff; overflow: hidden; }
.help-grid summary { padding: 14px 16px; background: #f5f8fc; color: #26364d; font-weight: 800; cursor: pointer; }
.help-grid details[open] summary { border-bottom: 1px solid #dfe6ef; background: #edf4ff; color: #174d9b; }
.help-grid details > div { padding: 14px 18px; color: #3f4d61; line-height: 1.55; }
.help-grid p, .help-grid ul, .help-grid ol { margin: 0; }
.help-grid ul, .help-grid ol { padding-left: 21px; }
.help-grid li + li { margin-top: 6px; }
@media (max-width: 760px) { .help-grid { grid-template-columns: 1fr; } .help-quick-links { gap: 6px; } .help-quick-links button { padding: 7px 9px; font-size: 12px; } }
.leave-inputs input { position: relative; z-index: 1; pointer-events: auto !important; min-height: 44px; padding: 10px 12px; border: 1px solid #aeb9c8; border-radius: 9px; background: #fff; color: #172033; }
.leave-inputs input:focus { border-color: #174d9b; box-shadow: 0 0 0 3px rgba(23,77,155,.16); outline: none; }
@media (max-width: 760px) {
  .app-rights { padding: 12px 14px 18px; text-align: center; }
}
/* Logowanie i zdjęcie paszportowe kierowcy */
.auth-gate { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at top, #24364f, #101927 60%, #090f18); }
.auth-gate[hidden] { display: none; }
.auth-card { width: min(420px, 100%); display: grid; gap: 14px; padding: 30px; border-radius: 20px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.42); }
.auth-card > img { width: 94px; height: 74px; object-fit: contain; justify-self: center; }
.auth-card h1, .auth-card p { margin: 0; text-align: center; }
.auth-eyebrow { color: #c62027; font-size: 12px; font-weight: 900; letter-spacing: .2em; }
.auth-card label { display: grid; gap: 7px; color: #465268; font-size: 13px; font-weight: 750; }
.auth-card label[hidden] { display: none; }
.auth-card input { min-height: 46px; padding: 10px 12px; border: 1px solid #aeb9c8; border-radius: 9px; font-size: 16px; }
.auth-error { min-height: 20px; color: #b31318; font-size: 13px; font-weight: 700; }
body.auth-locked > :not(.auth-gate) { visibility: hidden; }
.logout-tab { margin-left: auto; color: #ffd9da; }
.driver-photo-editor { display: grid; grid-template-columns: 140px minmax(0,1fr); gap: 18px; align-items: center; padding: 16px; border: 1px solid #dce3ec; border-radius: 14px; background: #f7f9fc; }
.passport-photo-frame, .driver-passport-photo { width: 105px; height: 135px; overflow: hidden; border: 1px solid #aeb9c8; border-radius: 6px; background: #e9edf2; }
.passport-photo-frame img, .driver-passport-photo img { display: none; width: 100%; height: 100%; object-fit: cover; }
.passport-photo-frame img.has-photo, .driver-passport-photo img { display: block; }
.driver-passport-photo { float: right; margin: 0 0 14px 18px; display: grid; place-items: center; }
.driver-passport-photo span { padding: 8px; color: #7b8698; font-size: 11px; text-align: center; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.file-button { cursor: pointer; }
.mobile-camera-button { display: none; }
@media (max-width: 760px) {
  .mobile-camera-button { display: inline-flex; }
  .driver-photo-editor { grid-template-columns: 105px minmax(0,1fr); padding: 12px; }
  .photo-actions .button { width: 100%; justify-content: center; }
  .logout-tab { margin-left: 0; }
}
/* Zdjęcie samochodu */
.car-photo-editor { display: grid; grid-template-columns: minmax(220px, 320px) minmax(0,1fr); gap: 18px; align-items: center; padding: 16px; border: 1px solid #dce3ec; border-radius: 14px; background: #f7f9fc; }
.car-photo-frame, .car-info-photo { width: 240px; aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid #aeb9c8; border-radius: 10px; background: #e9edf2; }
.car-photo-frame img, .car-info-photo img { display: none; width: 100%; height: 100%; object-fit: cover; }
.car-photo-frame img.has-photo, .car-info-photo img { display: block; }
.car-info-photo { float: right; margin: 0 0 16px 20px; display: grid; place-items: center; }
.car-info-photo span { color: #7b8698; font-size: 12px; }
@media (max-width: 650px) { .car-photo-editor { grid-template-columns: 1fr; } .car-photo-frame, .car-info-photo { width: 100%; max-width: 320px; } .car-info-photo { float: none; margin: 0 auto 16px; } }
/* Motogodziny — 1.0.33 */
.checkbox-option { display: flex !important; align-items: center; gap: 10px; min-height: 44px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: #f7f9fc; }
.checkbox-option input { width: 20px !important; height: 20px; margin: 0; accent-color: #174d9b; }
.other-subtabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid #dce3ec; }
.other-view { display: none; }
.other-view.active { display: block; }
.engine-hours-toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.engine-hours-toolbar label { display: grid; gap: 7px; color: #465268; font-size: 13px; font-weight: 750; }
.engine-hours-toolbar input { min-height: 42px; padding: 8px 10px; border: 1px solid #aeb9c8; border-radius: 9px; background: #fff; }
.engine-hours-table { width: 100%; min-width: 760px; border-collapse: collapse; table-layout: fixed; margin-top: 16px; background: #fff; }

/* Grafik miesięczny zawsze dopasowany do szerokości dostępnego ekranu. */
.monthly-wrap { overflow-x: hidden !important; }
.monthly-table { width:100% !important; min-width:0 !important; table-layout:fixed !important; }
.monthly-table th,.monthly-table td { min-width:0 !important; padding-left:1px !important; padding-right:1px !important; overflow:hidden; text-overflow:ellipsis; }
.monthly-table .sticky-col { width:28px !important; min-width:28px !important; }
.monthly-table .sticky-col.name-col { left:28px !important; width:126px !important; min-width:126px !important; }
.monthly-table input { width:100% !important; min-width:0 !important; padding-left:0 !important; padding-right:0 !important; font-size:clamp(8px,.72vw,11px) !important; }
.monthly-table .wage-col { width:76px !important; min-width:64px !important; font-size:10px; }
.monthly-table .leave-card-col { width:118px !important; min-width:118px !important; padding:2px !important; overflow:visible !important; text-overflow:clip !important; }
.monthly-table .leave-card-col .button { display:flex; width:100%; min-width:0; max-width:100%; padding:5px 4px; white-space:normal; overflow:visible; text-overflow:clip; font-size:10px; line-height:1.15; }
@media(max-width:700px){.monthly-table .sticky-col.name-col{width:86px !important;min-width:86px !important;font-size:9px}.monthly-table .sticky-col{width:22px !important;min-width:22px !important}.monthly-table .sticky-col.name-col{left:22px !important}.monthly-table th,.monthly-table td{font-size:8px !important}.monthly-table input{min-height:30px !important;font-size:8px !important}.monthly-table .wage-col{width:54px !important;min-width:48px !important}}

/* Pełna szerokość grafiku miesięcznego i nieucięte etykiety przycisków. */
body:has(#monthly.active) main { width:calc(100% - 24px); max-width:none; margin-left:auto; margin-right:auto; padding-left:12px; padding-right:12px; }
#monthly.active .content-section { padding-left:12px; padding-right:12px; }
#monthly .section-title { align-items:flex-start; }
#monthly .filters { flex:0 0 auto; justify-content:flex-end; }
#monthly .filters .button { flex:0 0 auto; min-width:max-content; white-space:nowrap; overflow:visible; text-overflow:clip; padding-left:12px; padding-right:12px; }
#monthly .copy-driver-schedule { white-space:normal; overflow:visible; text-overflow:clip; font-size:10px; line-height:1.15; }
@media(max-width:900px){#monthly .section-title{flex-direction:row;align-items:center;flex-wrap:wrap}#monthly .filters{width:auto;flex:1 1 auto}#monthly .filters .button{width:auto}}
.management-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.owner-report-grid { display:grid; grid-template-columns:repeat(3,minmax(120px,1fr)); gap:10px; }
.owner-report-grid > div { padding:14px; border:1px solid var(--line); border-radius:10px; background:#f7f9fb; }
.owner-report-grid span,.owner-report-grid small { display:block; color:var(--muted); }
.owner-report-grid strong { display:block; margin-top:5px; font-size:20px; }
.vehicle-cost-form { grid-template-columns:1.1fr .8fr 1fr .8fr 1.4fr auto; margin-bottom:14px; }
.validation-list,.audit-log,#managementAlerts { display:grid; gap:7px; }
.validation-error,.management-alert { padding:9px 11px; border-left:4px solid #c8171f; background:#fff0f1; border-radius:6px; }
.validation-ok { padding:11px; color:#166534; background:#ecfdf3; border:1px solid #86d6a5; border-radius:8px; }
.audit-row { display:grid; grid-template-columns:145px 150px 1fr; gap:8px; padding:8px; border-bottom:1px solid var(--line); font-size:12px; }
.audit-row time { color:var(--muted); }
.search-results { display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:8px; margin-top:12px; }
.search-results button { display:flex; gap:8px; text-align:left; padding:10px; border:1px solid var(--line); border-radius:8px; background:#fff; cursor:pointer; }
.vehicle-work-card { min-width:0; }
.work-card-scan-status { margin:10px 0; padding:10px; background:#f5f7fa; border-radius:8px; overflow-wrap:anywhere; }
.work-card-inputs { display:grid; grid-template-columns:1fr 1fr auto; gap:10px; align-items:end; }
.management-month-picker { display:grid; gap:5px; color:#465268; font-size:12px; font-weight:750; }
.management-month-picker input { min-height:38px; padding:7px 10px; border:1px solid #aeb9c8; border-radius:8px; font:inherit; }
.work-card-preview-modal .modal-card { width:min(1100px,95vw); }
.work-card-preview { max-height:72vh; overflow:auto; padding:12px; border-radius:10px; background:#eef2f7; }
.work-card-preview img { display:block; max-width:100%; height:auto; margin:0 auto; background:#fff; box-shadow:0 3px 18px rgba(0,0,0,.16); }
.vehicle-work-history { min-width:0; }
.vehicle-work-history table { width:100%; }
.consumption-result { display:grid; grid-template-columns:1fr auto; gap:4px 12px; margin-top:12px; padding:14px; border-radius:10px; background:#f3f4f6; }
.consumption-result strong { font-size:22px; }
.consumption-result small { grid-column:1/-1; }
.consumption-result.workcard-good { background:#dcfce7; color:#166534; }
.consumption-result.workcard-danger { background:#fee2e2; color:#991b1b; }
@media(max-width:950px){.management-grid{grid-template-columns:1fr}.vehicle-cost-form{grid-template-columns:1fr 1fr}.owner-report-grid{grid-template-columns:1fr 1fr}.audit-row{grid-template-columns:1fr}.work-card-inputs{grid-template-columns:1fr}}
.month-locked::before { content:"Miesiąc zamknięty — edycja jest zablokowana. Możesz otworzyć go ponownie w zakładce Zarządzanie."; display:block; margin:0 0 10px; padding:10px 14px; border-radius:8px; background:#fff3cd; color:#664d03; font-weight:700; }
.engine-hours-table th, .engine-hours-table td { border: 2px solid #27313f; padding: 10px; text-align: center; vertical-align: middle; }
.engine-hours-table th { height: 58px; background: #fff200; color: #111; font-size: 12px; line-height: 1.2; }
.engine-hours-table th:first-child { width: 22%; }
.engine-hours-table th:not(:first-child) { width: 26%; }
.engine-hours-table input { width: 100%; min-height: 40px; padding: 7px 9px; border: 1px solid #aeb9c8; border-radius: 7px; text-align: center; font-size: 15px; }
.engine-hours-table td:last-child strong { font-size: 17px; }
@media (max-width: 720px) { .engine-hours-toolbar .button { width: 100%; } }
/* Szkody i harmonogram potrąceń — 1.0.34 */
.damage-form { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 14px; margin: 18px 0 24px; padding: 20px; border: 1px solid #cbd7e6; border-radius: 16px; background: #f7faff; }
.damage-form[hidden] { display: none; }
.damage-form label { display: grid; gap: 7px; color: #465268; font-size: 13px; font-weight: 750; }
.damage-form input, .damage-form select, .damage-form textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #aeb9c8; border-radius: 8px; background: #fff; font: inherit; }
.damage-description { grid-column: 1 / -1; }
.damage-schedule-preview { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.damage-schedule-preview strong { grid-column: 1 / -1; }
.damage-schedule-preview span { padding: 9px 11px; border-radius: 8px; background: #eaf2ff; color: #214f86; }
.damage-form-actions { grid-column: 1 / -1; display: flex; gap: 10px; justify-content: flex-end; }
.damage-list { display: grid; gap: 15px; }
.damage-card { padding: 19px; border: 1px solid #d8e0ea; border-radius: 15px; background: #fff; box-shadow: 0 7px 22px rgba(22,34,51,.06); }
.damage-card header { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.damage-card h3, .damage-card p { margin: 0; }
.damage-card > p { margin-top: 13px; white-space: pre-wrap; }
.damage-status { padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 850; }
.damage-status.active { background: #fff1d7; color: #955600; }
.damage-status.paid { background: #e7f7ed; color: #14753c; }
.damage-amount { display: flex; justify-content: space-between; margin-top: 15px; padding: 12px; border-radius: 10px; background: #f4f7fb; }
.damage-installments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.damage-installments > span { padding: 7px 9px; border: 1px solid #d6dfeb; border-radius: 8px; background: #fafcff; font-size: 12px; }
.damage-card .card-actions { margin-top: 15px; }
@media (max-width: 850px) { .damage-form { grid-template-columns: 1fr; } .damage-description, .damage-schedule-preview, .damage-form-actions { grid-column: 1; } }

/* Modu? Tachografy ? 1.0.37 */
.tachograph-reminder-box { margin: 16px 0 22px; padding: 17px; border: 1px solid #cdd9e8; border-radius: 15px; background: #f6f9fd; }
.tachograph-reminder-box h3 { margin: 0 0 12px; }
.tachograph-reminder-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid #dde5ef; }
.tachograph-reminder-row:first-of-type { border-top: 0; }
.tachograph-reminder-row div { display: grid; gap: 4px; }
.tachograph-reminder-row span { color: #627087; font-size: 12px; }
.tachograph-companies { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.tachograph-company-card { padding: 19px; border: 1px solid #d5deea; border-radius: 15px; background: #fff; box-shadow: 0 8px 24px rgba(22,34,51,.06); cursor: pointer; }
.tachograph-company-card h3, .tachograph-company-card p { margin: 0; }
.tachograph-company-card p { margin-top: 7px; color: #647187; }
.tachograph-company-card > div, .tachograph-company-card footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 9px; margin-top: 14px; }
.tachograph-company-card footer { align-items: center; padding-top: 13px; border-top: 1px solid #e2e8f0; }
.tachograph-company-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; margin: 18px 0; padding: 17px; border-radius: 14px; background: #eef4fb; }
.tachograph-company-header h2, .tachograph-company-header p { margin: 0; }
.tachograph-company-header p { margin-top: 5px; color: #607088; }
.tachograph-list-section { margin-top: 18px; padding: 17px; border: 1px solid #d8e0ea; border-radius: 14px; background: #fff; }
.tachograph-list-section .small { padding: 6px 9px; font-size: 12px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 12000; display: grid; place-items: center; padding: 18px; background: rgba(12,20,31,.62); }
.modal-backdrop[hidden] { display: none; }
.modal-card { width: min(620px, 100%); max-height: calc(100vh - 36px); overflow: auto; padding: 22px; border-radius: 17px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.35); }
.monthly-comment-modal-card label { display: grid; gap: 8px; color: #465268; font-weight: 750; }
.monthly-comment-modal-card textarea { width: 100%; min-height: 120px; resize: vertical; padding: 11px; border: 1px solid #aeb9c8; border-radius: 8px; font: inherit; }

/* A full month cannot fit into a phone viewport without losing readable cells. */
@media (max-width: 900px) {
  #monthly .monthly-wrap { overflow-x: auto !important; max-width: 100%; -webkit-overflow-scrolling: touch; }
  #monthly .monthly-table { min-width: 1800px !important; table-layout: fixed !important; }
  #monthly .monthly-table th, #monthly .monthly-table td { font-size: 12px !important; }
  #monthly .monthly-table input { font-size: 12px !important; min-height: 36px !important; }
  #monthly .monthly-table .sticky-col { width: 30px !important; min-width: 30px !important; }
  #monthly .monthly-table .sticky-col.name-col { left: 30px !important; width: 142px !important; min-width: 142px !important; white-space: normal; }
  #monthly .monthly-table .wage-col { width: 88px !important; min-width: 88px !important; }
}
.work-card-totals-modal-card label { display:grid; gap:8px; margin-top:15px; color:#26364d; font-weight:800; }
.work-card-totals-modal-card input[type="text"] { width:100%; min-height:52px; padding:11px 13px; border:2px solid #7890ad; border-radius:10px; background:#fff; color:#101828; font:700 20px/1.2 inherit; }
.work-card-totals-modal-card input[type="text"]:focus { border-color:#174d9b; outline:3px solid rgba(23,77,155,.18); }
.tachograph-modal-card > div:not(.section-title):not(.modal-actions) { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.tachograph-modal-card > div[hidden] { display: none !important; }
.tachograph-modal-card label { display: grid; gap: 7px; color: #465268; font-size: 13px; font-weight: 750; }
.tachograph-modal-card input { width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid #aeb9c8; border-radius: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
@media (max-width: 700px) { .tachograph-company-header { grid-template-columns: 1fr; } .tachograph-modal-card > div:not(.section-title):not(.modal-actions) { grid-template-columns: 1fr; } .tachograph-reminder-row { align-items: flex-start; flex-direction: column; } }

.tab[data-tab="tachographs"].tachograph-alert { color: #d31f2b !important; font-weight: 900; }
.tab[data-tab="tachographs"].tachograph-alert.active { color: #ff5a63 !important; }

/* Profesjonalny pulpit operacyjny */
:root { --navy:#101923; --navy-2:#1b2a38; --brand:#087a70; --brand-soft:#e4f5f2; --focus:0 0 0 3px rgba(8,122,112,.18); }
body { background:linear-gradient(180deg,#eef3f6 0,#f7f9fb 360px); }
.topbar { min-height:92px; padding-block:18px; background:linear-gradient(120deg,#101923 0%,#1d3040 68%,#0c625c 140%); box-shadow:0 12px 30px rgba(10,24,36,.18); }
.brand-lockup { display:flex; align-items:center; gap:15px; }
.brand-lockup img { width:58px; height:58px; object-fit:contain; padding:7px; border-radius:15px; background:#fff; box-shadow:0 8px 22px #0004; }
.topbar h1 { font-size:30px; font-weight:780; letter-spacing:-.03em; }
.topbar p { margin-top:5px; }
.tabs { position:sticky; top:0; z-index:1000; align-items:center; gap:4px; padding-block:9px; box-shadow:0 5px 18px rgba(23,39,53,.07); }
.tab { border-color:transparent; background:transparent; font-weight:650; }
.tab:hover { background:#edf4f4; color:var(--brand); }
.tab.active { border-radius:10px; background:var(--navy); box-shadow:0 5px 14px rgba(16,25,35,.18); }
.tab[data-count]:not([data-count="0"])::after { content:attr(data-count); display:inline-grid; place-items:center; min-width:19px; height:19px; margin-left:6px; padding:0 5px; border-radius:20px; background:#c92732; color:#fff; font-size:10px; }
.workspace-status { display:flex; align-items:center; gap:20px; padding:8px clamp(16px,4vw,44px); border-bottom:1px solid #d7e0e6; background:#f9fbfc; color:#5a6875; font-size:12px; }
.workspace-status>span { display:flex; align-items:center; gap:6px; }
.workspace-status .button { margin-left:auto; }
.status-dot { width:8px; height:8px; border-radius:50%; background:#18a66f; box-shadow:0 0 0 4px #d9f5e9; }
.button.compact { min-height:32px; padding:5px 11px; }
.content-section { border:1px solid rgba(203,215,224,.86); border-radius:16px; box-shadow:0 8px 25px rgba(25,45,60,.055); }
.command-center { overflow:hidden; border-color:#c8ddd9; background:linear-gradient(145deg,#fff 0%,#f2fbf9 100%); }
.eyebrow { margin:0 0 4px; color:var(--brand); font-size:11px; font-weight:850; letter-spacing:.13em; }
.today-work-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.today-work-item { display:grid; grid-template-columns:32px 1fr auto; align-items:center; gap:10px; min-width:0; padding:12px; border:1px solid #dce5ea; border-radius:12px; background:#fff; text-align:left; cursor:pointer; }
.today-work-item:hover { transform:translateY(-1px); border-color:#9fcac4; box-shadow:0 8px 18px #17334412; }
.today-work-item span:nth-child(2) { min-width:0; }
.today-work-item strong,.today-work-item small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.today-work-item small { margin-top:3px; color:var(--muted); }
.today-work-item>b { color:var(--brand); font-size:12px; }
.today-work-icon { display:grid; place-items:center; width:30px; height:30px; border-radius:9px; background:#e9f7f4; color:#087a70; font-weight:900; }
.today-work-item.danger .today-work-icon { background:#fee8e8; color:#b42318; }
.today-work-item.warn .today-work-icon { background:#fff2d7; color:#976000; }
.today-work-empty { grid-column:1/-1; display:flex; align-items:center; gap:12px; padding:18px; border:1px dashed #93c8b8; border-radius:12px; color:#176c50; background:#f1fbf7; }
.today-work-empty>span { font-size:24px; }
.today-work-empty strong,.today-work-empty small { display:block; }
.today-work-empty small { margin-top:3px; color:#54806e; }
.document-wizard-card { width:min(900px,100%); border-top:5px solid var(--brand); }
.wizard-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:13px; }
.wizard-grid label { display:grid; gap:6px; color:#445361; font-size:12px; font-weight:750; }
.wizard-grid input,.wizard-grid select { width:100%; min-height:42px; padding:8px 10px; border:1px solid #b8c5ce; border-radius:9px; background:#fff; }
.wizard-grid input:focus,.wizard-grid select:focus { outline:0; border-color:var(--brand); box-shadow:var(--focus); }
.wizard-wide { grid-column:1/-1; }
.wizard-summary { display:flex; gap:22px; margin-top:15px; padding:13px 15px; border-radius:11px; background:#edf5f7; }
.wizard-summary span { color:#5b6975; }
.wizard-summary strong { margin-left:5px; color:#16242f; }
.toast-stack { position:fixed; right:20px; bottom:20px; z-index:20000; display:grid; gap:8px; width:min(390px,calc(100vw - 40px)); }
.app-toast { padding:13px 15px; border-left:5px solid #13835e; border-radius:10px; background:#fff; box-shadow:0 15px 40px #14283833; font-weight:700; animation:toast-in .2s ease-out; }
.app-toast.danger { border-left-color:#b42318; }
@keyframes toast-in { from{opacity:0;transform:translateY(8px)} }
@media(max-width:900px){.workspace-status{gap:10px;overflow-x:auto}.workspace-status>span{white-space:nowrap}.today-work-list{grid-template-columns:1fr}.wizard-grid{grid-template-columns:1fr 1fr}.wizard-wide{grid-column:1/-1}}
@media(max-width:620px){.topbar{align-items:flex-start}.brand-lockup img{width:46px;height:46px}.top-actions{width:100%}.workspace-status{padding-inline:10px}.workspace-status .button{position:fixed;right:14px;bottom:14px;z-index:1100;width:52px;height:52px;border-radius:50%;font-size:0}.workspace-status .button::after{content:"+";font-size:26px}.wizard-grid{grid-template-columns:1fr}.wizard-wide{grid-column:1}.wizard-summary{flex-direction:column;gap:6px}.today-work-item{grid-template-columns:32px 1fr}.today-work-item>b{display:none}}
.more-tabs{position:relative;display:flex}.more-tabs-menu{position:fixed;z-index:12000;min-width:230px;padding:8px;background:#fff;border:1px solid #d7e0ea;border-radius:14px;box-shadow:0 18px 44px rgba(12,35,60,.18)}
.more-tabs-menu[hidden]{display:none}.more-tabs-menu .tab{display:block;width:100%;margin:0;padding:11px 14px;text-align:left;color:#1a2d42;background:transparent;border-radius:9px}.more-tabs-menu .tab:hover,.more-tabs-menu .tab.active{background:#edf4fb;color:#0a5796}
.document-recognition{display:flex;align-items:center;gap:12px;margin:2px 0 16px;padding:12px 14px;border:1px dashed #a9bfd3;border-radius:12px;background:#f5f9fc;color:#476178;font-size:.9rem}.document-recognition span{line-height:1.35}
body[data-role="driver"] .top-actions #exportBtn,body[data-role="driver"] .top-actions .file-button,body[data-role="driver"] .top-actions #resetBtn{display:none}
@media(max-width:900px){.more-tabs{position:static}.more-tabs-menu{left:12px!important;right:12px;top:auto!important;bottom:74px;min-width:0}.document-recognition{align-items:flex-start;flex-direction:column}.document-recognition .button{width:100%}}
