:root {
  --bg: #eef3f8;
  --paper: #ffffff;
  --ink: #0b1f33;
  --muted: #607386;
  --line: #d5e0e9;
  --navy: #073a67;
  --navy-deep: #061f3a;
  --navy-soft: #0f5278;
  --green: #078a4b;
  --blue: #116aa8;
  --yellow: #ffc928;
  --orange: #f26122;
  --red: #b42318;
  --focus: #2f80c4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f7fbff 0, var(--bg) 180px),
    var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  background:
    linear-gradient(135deg, var(--navy-deep), var(--navy) 58%, var(--navy-soft));
  color: white;
  position: relative;
  z-index: 100;
  box-shadow: 0 2px 0 rgba(6, 31, 58, .22);
}

.topbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--orange), var(--yellow), var(--orange));
  pointer-events: none;
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: min(470px, 100%);
  padding: 8px 16px 8px 10px;
  border: 1px solid rgba(255, 255, 255, .24);
  border-left: 7px solid var(--orange);
  border-radius: 10px;
  background:
    radial-gradient(circle at 118px 46px, rgba(242, 97, 34, .2), transparent 54px),
    rgba(0, 0, 0, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09);
}

.brand-mark {
  width: 150px;
  max-width: 34vw;
  height: auto;
  max-height: 78px;
  flex: 0 0 150px;
  object-fit: contain;
  filter: drop-shadow(0 4px 9px rgba(0, 0, 0, .24));
}

.brand-logo-original {
  border-radius: 0;
}

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

.brand-name {
  display: block;
  color: #ffcf32;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.05;
}

.topbar p {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, .86);
  font-size: 14px;
}

.top-actions,
.actions,
.section-head {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.top-actions {
  justify-content: flex-end;
  flex: 1 1 auto;
  gap: 6px;
}

.topbar-btn,
.topbar .options-panel summary {
  min-height: 30px;
  padding: 5px 9px;
}

.topbar .options-panel {
  position: relative;
  border-color: rgba(255, 255, 255, .34);
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

.topbar .options-panel summary {
  color: #fff;
}

.topbar-options .actions {
  position: fixed;
  top: 68px;
  right: 0;
  left: max(10px, calc(100vw - 910px));
  width: auto;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 16px 34px rgba(6, 31, 58, .24);
  background: #fff;
  color: var(--ink);
  z-index: 60;
}

.topbar-options .options-menu-c {
  left: max(10px, calc(100vw - 1040px));
  width: auto;
  max-height: min(74vh, 650px);
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  border-top: 4px solid var(--orange);
  background:
    linear-gradient(180deg, #f7fbff 0, #fff 92px),
    #fff;
}

.options-search-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-bottom: 2px;
}

.options-search {
  flex: 1 1 310px;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
}

.options-main-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

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

.options-category {
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.options-category-primary {
  border-left-color: var(--red);
}

.options-category-wide {
  grid-column: span 2;
  border-left-color: var(--orange);
}

.options-category-head {
  padding: 10px 11px 8px;
  border-bottom: 1px solid #e5edf4;
  background: #f8fbff;
}

.options-category-head strong {
  display: block;
  color: var(--navy-deep);
  font-size: 15px;
}

.options-category-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.options-category-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px;
}

.signature-actions {
  align-items: flex-start;
}

.options-search-empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  background: #f8fbff;
}

.topbar-dashboard {
  position: relative;
  flex: 1 1 420px;
  max-width: 620px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 6px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

.topbar .topbar-dashboard {
  flex: 1 1 420px;
  max-width: 620px;
  border: 1px solid rgba(255, 255, 255, .34);
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

.topbar-dashboard summary {
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  min-height: 30px;
  padding: 4px 8px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
}

.topbar-dashboard summary::-webkit-details-marker {
  display: none;
}

.topbar-dashboard summary span:first-child {
  font-weight: 700;
  color: #d9edf9;
}

.topbar-dashboard summary strong {
  color: #fff;
}

.topbar-dashboard-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  width: min(900px, calc(100vw - 28px));
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--line);
  border-top: 4px solid #fff;
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(6, 31, 58, .24);
  background: #fff;
  color: var(--ink);
}

.topbar-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(260px, .8fr);
  gap: 0;
}

.topbar-dashboard-grid > div + div {
  border-left: 1px solid var(--line);
}

.topbar-dashboard .stats-scroll,
.topbar-dashboard .mail-list {
  max-height: 250px;
}

.stats-export-tools,
.attendance-export-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.stats-export-tools label,
.attendance-export-tools label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #40566b;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.stats-export-tools input,
.stats-export-tools select,
.attendance-export-tools input {
  width: 128px;
  min-height: 30px;
  border: 1px solid #c9d8e4;
  border-radius: 6px;
  padding: 4px 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.stats-export-tools select {
  width: 190px;
}

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

.ops-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: #f8fbfd;
}

.ops-metric {
  min-width: 0;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
}

.ops-metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.ops-metric strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 14px;
}

.test-warning {
  position: absolute;
  top: 102px;
  left: 14px;
  z-index: 30;
  width: min(420px, calc(100vw - 28px));
  padding: 0;
  border-bottom: 1px solid #dfb645;
  border-radius: 8px;
  background: #fff8dd;
  color: #3a2b00;
  box-shadow: 0 12px 28px rgba(6, 31, 58, .18);
}

.test-warning summary {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
}

.test-warning summary::-webkit-details-marker {
  display: none;
}

.test-warning strong {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--red), #d8432f);
  color: #fff;
  font-size: 12px;
}

.test-warning summary span {
  font-weight: 800;
}

.test-warning p {
  margin: 0;
  padding: 0 12px 10px;
  line-height: 1.35;
}

.quickbar {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.hidden-panel {
  display: none;
}

.top-options {
  min-width: 0;
}

.top-options[open] {
  flex: 0 0 auto;
}

.top-options .actions {
  padding-top: 0;
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, var(--editor-width, 520px)) 28px minmax(480px, 1fr) minmax(280px, 340px);
  gap: 6px;
  min-height: 480px;
  height: calc(100vh - 106px);
  padding: 8px;
}

.layout.preview-collapsed {
  grid-template-columns: minmax(300px, var(--editor-width, 520px)) 28px minmax(480px, 1fr) 44px;
}

.editor,
.table-area,
.mail-preview {
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: 0 1px 3px rgba(6, 31, 58, .08);
}

.editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
}

.splitter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.splitter-btn {
  width: 22px;
  height: 34px;
  border: 1px solid #b8c8d6;
  border-radius: 6px;
  background: #fff;
  color: var(--navy);
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
}

.splitter-btn:hover {
  background: #e8f2f8;
}

.section-head {
  justify-content: space-between;
  padding-bottom: 4px;
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
}

.editor > .section-head:first-child,
.table-area > .section-head,
.mail-preview-content > .section-head {
  margin: -10px -10px 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #bfd5e6;
  background: linear-gradient(90deg, #f4fbff, #ffffff);
}

.editor > .section-head:first-child h2,
.table-area > .section-head h2,
.mail-preview-content > .section-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-size: 18px;
}

.editor > .section-head:first-child h2::before,
.table-area > .section-head h2::before,
.mail-preview-content > .section-head h2::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--orange), var(--yellow));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 700;
  font-size: 12px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
  color: #053a70;
  font-size: 15px;
  font-weight: 800;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search:focus,
.admin-mail-field input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 128, 196, .16);
  outline: none;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #64748b;
  font-weight: 600;
}

.field textarea {
  min-height: 78px;
  resize: vertical;
  line-height: 1.3;
}

.editor .field input,
.editor .field select,
.editor .field textarea {
  border-color: #8fc8ef;
  background: #eaf7ff;
  color: #004b8d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9);
}

.editor .field input::placeholder,
.editor .field textarea::placeholder {
  color: #4f6f92;
}

.editor .field input:focus,
.editor .field select:focus,
.editor .field textarea:focus {
  border-color: #006bb6;
  background: #f7fcff;
  color: #003b73;
  box-shadow: 0 0 0 3px rgba(0, 107, 182, .2);
}

.points-after-delivery {
  max-width: 220px;
}

.field-with-suggestions {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.field-with-suggestions .field {
  margin: 0;
}

.suggestions {
  display: grid;
  gap: 4px;
  margin-top: -4px;
  padding: 6px;
  border: 1px solid #bfd1df;
  border-radius: 6px;
  background: #f8fbfd;
}

.suggestions.hidden-panel {
  display: none;
}

.suggestion-btn {
  width: 100%;
  border: 1px solid #d4e0ea;
  border-radius: 5px;
  padding: 6px 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.25;
  white-space: pre-line;
}

.suggestion-btn:hover,
.suggestion-btn:focus {
  border-color: #7aa9c7;
  background: #eaf5fb;
}

.suggestion-btn.city-suggestion {
  border-color: #b8d8c0;
  background: #eef9ef;
  color: #154f29;
  font-weight: 800;
}

.suggestion-btn.city-suggestion:hover,
.suggestion-btn.city-suggestion:focus {
  border-color: #168a52;
  background: #dff2e3;
}

.absence-bonus-row {
  align-items: start;
}

.absence-suggestions {
  z-index: 30;
  gap: 6px;
  margin-top: 7px;
  padding: 8px;
  border: 2px solid #ffb020;
  background: #fff7dc;
  box-shadow: 0 12px 24px rgba(8, 35, 63, .18);
}

.absence-suggestions .suggestion-btn {
  min-height: 38px;
  border-color: #f7c04c;
  background: #fffdf5;
  color: #073a67;
  font-size: 14px;
  font-weight: 900;
}

.absence-suggestions .suggestion-btn:hover,
.absence-suggestions .suggestion-btn:focus {
  border-color: var(--orange);
  background: #ffe9ad;
  color: #061f3a;
}

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

.checkline {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
}

.checkline input {
  width: 18px;
  height: 18px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .12s ease, background-color .12s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(6, 31, 58, .13);
}

.btn.small {
  padding: 5px 8px;
  font-size: 12px;
}

.btn:disabled {
  opacity: .55;
  cursor: wait;
}

.primary {
  background: linear-gradient(135deg, #078a4b, #0a9f62);
  color: #fff;
}

.blue {
  background: linear-gradient(135deg, var(--blue), #0d5da5);
  color: #fff;
}

.yellow {
  background: linear-gradient(135deg, var(--yellow), #ffb300);
  color: #111;
}

.danger {
  background: linear-gradient(135deg, var(--red), #d23a27);
  color: #fff;
}

.neutral {
  border-color: var(--line);
  background: linear-gradient(180deg, #ffffff, #f4f8fb);
  color: var(--ink);
}

.secondary {
  padding-top: 2px;
}

.options-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.options-panel summary {
  padding: 8px 10px;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.options-panel .actions {
  padding: 0 10px 8px;
}

.options-panel .secondary {
  padding-top: 0;
}

.admin-mail-field {
  display: flex;
  gap: 6px;
  align-items: center;
  font-weight: 700;
  font-size: 12px;
}

.admin-mail-field input,
.admin-mail-field select,
.admin-mail-field textarea {
  width: 230px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.signature-select-field select {
  width: 150px;
}

.signature-text-field input {
  width: 260px;
}

.signature-text-field textarea {
  width: 300px;
  min-height: 52px;
  max-height: 86px;
  resize: vertical;
  line-height: 1.25;
}

.log {
  min-height: 42px;
  margin: 0;
  padding: 8px;
  border-radius: 6px;
  background: #111827;
  color: #e5e7eb;
  white-space: pre-wrap;
  font-size: 12px;
}

.ops-report {
  position: fixed;
  top: 126px;
  right: 14px;
  bottom: 14px;
  z-index: 70;
  display: flex;
  width: min(760px, calc(100vw - 28px));
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 36px rgba(11, 31, 47, .26);
}

.ops-report.hidden-panel {
  display: none;
}

.ops-report-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.ops-report-head h2 {
  margin: 0;
  font-size: 18px;
}

.ops-report-head p {
  margin: 3px 0 0;
}

.ops-report-body {
  display: grid;
  gap: 9px;
  overflow: auto;
  padding: 10px;
}

.ops-report-phase {
  border: 1px solid var(--line);
  border-left: 6px solid var(--muted);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}

.ops-report-phase.blocked {
  border-left-color: var(--red);
  background: #fff8f7;
}

.ops-report-phase.warning {
  border-left-color: #d99a00;
  background: #fffaf0;
}

.ops-report-phase.ok {
  border-left-color: var(--green);
}

.ops-report-phase-head {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ops-report-phase h3 {
  margin: 0;
  font-size: 15px;
}

.ops-report-phase p {
  margin: 7px 0 0;
  line-height: 1.35;
}

.ops-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 700;
  font-size: 11px;
}

.ops-status.blocked {
  background: #f4c7c7;
  color: #711313;
}

.ops-status.warning {
  background: #fff2cc;
  color: #5f4700;
}

.ops-status.ok {
  background: #d9ead3;
  color: #154f29;
}

.ops-report-list {
  margin-top: 8px;
  padding: 8px;
  border-radius: 6px;
}

.ops-report-list.blocked {
  background: #fdecec;
}

.ops-report-list.warning {
  background: #fff5da;
}

.ops-report-list ul {
  margin: 6px 0 0 18px;
  padding: 0;
}

.ops-report-list li + li {
  margin-top: 4px;
}

.table-area {
  display: flex;
  flex-direction: column;
}

.mail-preview {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
}

.table-area .section-head,
.mail-preview .section-head {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.mail-preview-content {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}

.mail-preview-toggle {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: -18px;
  width: 36px;
  height: 68px;
  border: 1px solid #8db5d1;
  border-radius: 999px;
  background: linear-gradient(145deg, #ffffff 0%, #dff0fb 48%, #0f5e92 100%);
  box-shadow: 0 6px 18px rgba(6, 31, 58, .20), inset 0 1px 0 rgba(255, 255, 255, .95);
  color: var(--navy);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
}

.mail-preview-toggle:hover {
  border-color: var(--orange);
  box-shadow: 0 8px 22px rgba(6, 31, 58, .24), 0 0 0 3px rgba(255, 122, 24, .15);
}

.mail-preview-collapsed {
  align-items: center;
  justify-content: center;
  overflow: visible;
  background: linear-gradient(180deg, #08395f, #0f5e92);
}

.mail-preview-collapsed .mail-preview-content {
  display: none;
}

.mail-preview-collapsed .mail-preview-toggle {
  position: static;
  width: 34px;
  height: 110px;
  border-color: rgba(255, 255, 255, .65);
  border-radius: 999px;
  background: linear-gradient(155deg, #ffffff 0%, #e7f7ff 38%, #ffcf33 66%, #ff7a18 100%);
  color: #06233b;
  transform: none;
}

.mail-preview-collapsed .mail-preview-toggle::after {
  content: "MAIL";
  display: block;
  margin-top: 8px;
  font-size: 9px;
  letter-spacing: .8px;
  writing-mode: vertical-rl;
}

.section-head.compact {
  padding: 8px 10px;
}

.table-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.search {
  width: min(360px, 48vw);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}

.quick-filters {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin: -2px 10px 6px;
  padding: 6px;
  border: 1px solid #d7e4ee;
  border-radius: 8px;
  background: #f8fbfd;
}

.quick-filter {
  border: 1px solid #c9d9e6;
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.quick-filter:hover {
  border-color: var(--blue);
  background: #eaf4fb;
}

.quick-filter.active {
  border-color: var(--navy);
  background: linear-gradient(135deg, var(--navy), #0f5e92);
  color: #fff;
}

.planning-summary-strip {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
  margin: -2px 10px 6px;
  padding: 5px 6px;
  border: 1px solid #cddfed;
  border-left: 4px solid var(--orange);
  border-radius: 7px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  box-shadow: 0 8px 18px rgba(6, 31, 58, .06);
}

.planning-summary-strip .btn {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 12px;
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid #cddfed;
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.summary-pill.ok {
  border-color: #acd5b8;
  background: #e7f7ec;
  color: #15562b;
}

.summary-pill.warn {
  border-color: #f0c25e;
  background: #fff4cf;
  color: #6c4d00;
}

.summary-pill.info {
  border-color: #bfd7ed;
  background: #e9f4ff;
  color: #0a4776;
}

.summary-pill.neutral {
  background: #f7fafc;
  color: #52677b;
}

.fix-panel {
  flex: 0 0 auto;
  margin: 0 10px 4px;
  overflow: hidden;
  border: 1px solid #e9c46a;
  border-left: 4px solid var(--orange);
  border-radius: 7px;
  background: #fff8dd;
}

.fix-panel.hidden-panel {
  display: none;
}

.fix-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  min-height: 30px;
  padding: 4px 8px;
}

.fix-panel-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.fix-panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.fix-body {
  display: none;
  gap: 5px;
  max-height: 96px;
  overflow: auto;
  padding: 6px 8px;
  border-top: 1px solid #edd188;
}

.fix-panel.fix-panel-open .fix-body {
  display: grid;
}

.fix-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  border: 1px solid #f0dca6;
  border-radius: 6px;
  padding: 5px 7px;
  background: #fffdf5;
}

.fix-title {
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
}

.fix-reason {
  margin-top: 1px;
  color: #725c17;
  font-size: 11px;
}

.fix-more {
  padding: 3px 2px;
  color: #725c17;
  font-size: 11px;
  font-weight: 700;
}

.done-panel {
  flex: 0 0 auto;
  margin: 0 10px 4px;
  overflow: hidden;
  border: 1px solid #b9ddc4;
  border-left: 4px solid var(--green);
  border-radius: 7px;
  background: #edf9f1;
}

.done-panel.hidden-panel {
  display: none;
}

.done-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  min-height: 30px;
  padding: 4px 8px;
}

.done-panel-head h3 {
  margin: 0;
  color: #053c22;
  font-size: 14px;
}

.done-panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.done-panel-body {
  display: none;
  gap: 5px;
  max-height: 112px;
  overflow: auto;
  padding: 6px 8px;
  border-top: 1px solid #b9ddc4;
}

.done-panel.done-panel-open .done-panel-body {
  display: grid;
}

.done-panel-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid #cfe8d7;
  border-radius: 6px;
  padding: 5px 7px;
  background: #fbfffc;
}

.done-panel-title {
  color: #064c2d;
  font-weight: 800;
  font-size: 13px;
}

.done-panel-meta {
  overflow: hidden;
  margin-top: 1px;
  color: #375b45;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.done-panel-buttons {
  display: flex;
  gap: 5px;
  align-items: center;
}

.done-panel-more {
  padding: 3px 2px;
  color: #326143;
  font-size: 11px;
  font-weight: 700;
}

.table-scroll {
  min-height: 0;
  overflow: auto;
  flex: 1 1 auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px;
  border-bottom: 1px solid #d69b00;
  background: linear-gradient(90deg, var(--yellow), #ffd94c);
  color: #111;
  text-align: left;
  font-size: 12px;
}

td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tbody tr.driver-group td {
  background: #ffffff;
}

tbody tr.driver-group-alt td {
  background: #f8fbfd;
}

tbody tr.driver-start td {
  border-top: 3px solid #78acd0;
}

tbody tr.driver-start td:first-child {
  box-shadow: inset 4px 0 0 var(--navy);
}

tbody tr.done-row td,
tbody tr.done-row:hover td {
  background: #7c3aed;
  color: #fff;
}

tbody tr.done-row td:first-child {
  box-shadow: inset 5px 0 0 #4c1d95;
}

tbody tr.selected-row td,
tbody tr.selected-row:hover td {
  background: #fff59d;
}

tbody tr.selected-row td:first-child {
  box-shadow: inset 5px 0 0 #c28a00;
}

tbody tr.selected-row .name {
  color: #7a4b00;
}

tbody tr:hover td {
  background: #eef6fb;
}

tbody tr.status-row-empty:not(.selected-row) td {
  background: #fff8df;
  border-bottom-color: #f3d27a;
}

tbody tr.status-row-ready:not(.selected-row) td {
  background: #eaf8ef;
  border-bottom-color: #b9ddc4;
}

tbody tr.status-row-sent:not(.selected-row) td {
  background: #eaf5ff;
  border-bottom-color: #b5d5ef;
}

tbody tr.status-row-opened:not(.selected-row) td {
  background: #e7f7ed;
  border-bottom-color: #acd9bc;
}

tbody tr.status-row-error:not(.selected-row) td {
  background: #fff0ee;
  border-bottom-color: #efb0ac;
}

tbody tr.status-row-absent:not(.selected-row) td {
  background: #f3f5f7;
  border-bottom-color: #ccd5dd;
}

tbody tr.status-row-night:not(.selected-row) td {
  background: #f3ecff;
  border-bottom-color: #ccb8ef;
}

tbody tr.done-row:not(.selected-row) td,
tbody tr.status-row-done:not(.selected-row) td {
  background: #7c3aed;
  border-bottom-color: #4c1d95;
  color: #fff;
}

tbody tr.done-row:not(.selected-row):hover td,
tbody tr.status-row-done:not(.selected-row):hover td {
  background: #6d28d9;
}

tbody tr.done-row:not(.selected-row) td:first-child {
  box-shadow: inset 5px 0 0 #4c1d95;
}

tbody tr.done-row:not(.selected-row) .name,
tbody tr.status-row-done:not(.selected-row) .name,
tbody tr.done-row:not(.selected-row) .driver-preview-link,
tbody tr.status-row-done:not(.selected-row) .driver-preview-link {
  color: #fff;
}

tbody tr.done-row:not(.selected-row) .muted,
tbody tr.status-row-done:not(.selected-row) .muted {
  color: #ede9fe;
}

tbody tr.done-row:not(.selected-row) .driver-preview-link:hover,
tbody tr.status-row-done:not(.selected-row) .driver-preview-link:hover,
tbody tr.done-row:not(.selected-row) .driver-preview-link:focus-visible,
tbody tr.status-row-done:not(.selected-row) .driver-preview-link:focus-visible {
  color: #fff7ad;
}

tbody tr.done-row.selected-row td,
tbody tr.status-row-done.selected-row td,
tbody tr.done-row.selected-row:hover td,
tbody tr.status-row-done.selected-row:hover td {
  background: #7c3aed;
  border-bottom-color: #4c1d95;
  color: #fff;
}

tbody tr.done-row.selected-row:hover td,
tbody tr.status-row-done.selected-row:hover td {
  background: #6d28d9;
}

tbody tr.done-row.selected-row td:first-child,
tbody tr.status-row-done.selected-row td:first-child {
  box-shadow: inset 5px 0 0 #2e1065;
}

tbody tr.done-row.selected-row .name,
tbody tr.status-row-done.selected-row .name,
tbody tr.done-row.selected-row .driver-preview-link,
tbody tr.status-row-done.selected-row .driver-preview-link {
  color: #fff;
}

tbody tr.done-row.selected-row .muted,
tbody tr.status-row-done.selected-row .muted,
tbody tr.done-row.selected-row .details,
tbody tr.status-row-done.selected-row .details {
  color: #ede9fe;
}

tbody tr.done-row.selected-row .driver-preview-link:hover,
tbody tr.status-row-done.selected-row .driver-preview-link:hover,
tbody tr.done-row.selected-row .driver-preview-link:focus-visible,
tbody tr.status-row-done.selected-row .driver-preview-link:focus-visible {
  color: #fff7ad;
}

tbody tr.status-row-empty:not(.selected-row) td:first-child {
  box-shadow: inset 5px 0 0 #f5a400;
}

tbody tr.status-row-ready:not(.selected-row) td:first-child,
tbody tr.status-row-done:not(.selected-row) td:first-child {
  box-shadow: inset 5px 0 0 #4c1d95;
}

tbody tr.status-row-sent:not(.selected-row) td:first-child {
  box-shadow: inset 5px 0 0 #2374ab;
}

tbody tr.status-row-opened:not(.selected-row) td:first-child {
  box-shadow: inset 5px 0 0 #16a065;
}

tbody tr.status-row-error:not(.selected-row) td:first-child {
  box-shadow: inset 5px 0 0 #cf3d32;
}

tbody tr.status-row-night:not(.selected-row) td:first-child {
  box-shadow: inset 5px 0 0 #8b5cf6;
}

tbody tr.status-row-absent:not(.selected-row) td:first-child {
  box-shadow: inset 5px 0 0 #8393a3;
}

.name {
  font-weight: 700;
  color: #064c91;
}

.driver-preview-link {
  display: inline;
  border: 0;
  padding: 0;
  background: transparent;
  color: #064c91;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.driver-preview-link:hover,
.driver-preview-link:focus-visible {
  color: var(--orange);
  text-decoration: underline;
  text-underline-offset: 3px;
}

tbody tr.selected-row .driver-preview-link {
  color: #7a4b00;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eaf2f8;
  color: #173854;
  font-weight: 700;
  font-size: 12px;
}

.badge.done {
  background: #d7b1ff;
  color: #29134a;
}

.badge.night {
  background: #d85f5f;
  color: #fff;
}

.badge.absent {
  background: #f4c7c7;
  color: #711313;
}

.badge.mail-ready {
  background: #fff2cc;
  color: #5f4700;
}

.badge.mail-sent {
  background: #d9ead3;
  color: #154f29;
}

.badge.mail-opened {
  background: #cfe2ff;
  color: #06396f;
}

.badge.mail-error {
  background: #f4c7c7;
  color: #711313;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  white-space: nowrap;
}

.status-badge.status-empty {
  border-color: #e5a812;
  background: #fff0b8;
  color: #654000;
}

.status-badge.status-ready,
.status-badge.status-done {
  border-color: #8acb9f;
  background: #d9f3e2;
  color: #0b5a2a;
}

.status-badge.status-sent {
  border-color: #9cc9ec;
  background: #d8ecff;
  color: #064f86;
}

.status-badge.status-opened {
  border-color: #8ed0aa;
  background: #d7f2e1;
  color: #095d32;
}

.status-badge.status-error {
  border-color: #efb0ac;
  background: #ffdedb;
  color: #8a1f17;
}

.status-badge.status-absent {
  border-color: #c7d0d9;
  background: #eef2f5;
  color: #53616f;
}

.status-badge.status-night {
  border-color: #bca7ea;
  background: #e4d8ff;
  color: #432174;
}

.details {
  max-width: 780px;
  line-height: 1.3;
  white-space: pre-line;
}

.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.access-dialog {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 31, 58, .55);
}

.access-dialog.hidden-panel {
  display: none;
}

.access-card {
  width: min(430px, 96vw);
  border: 1px solid #b9cfdd;
  border-left: 7px solid var(--orange);
  border-radius: 12px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(6, 31, 58, .34);
}

.access-card-head {
  margin-bottom: 14px;
}

.access-card h2 {
  margin: 0;
  color: var(--navy);
  font-size: 22px;
}

.access-card p {
  margin: 6px 0 0;
  color: #40566b;
  line-height: 1.35;
}

.access-error {
  min-height: 18px;
  margin-top: 8px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.access-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}

.route-map-overlay {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(6, 31, 58, .42);
}

.route-map-overlay.hidden-panel {
  display: none;
}

.route-map-window {
  display: flex;
  flex-direction: column;
  width: min(960px, 96vw);
  height: min(650px, 88vh);
  overflow: hidden;
  border: 1px solid #b7cddd;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 22px 55px rgba(6, 31, 58, .30);
}

.route-map-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #ffffff, #eef7fd);
}

.route-map-head h2 {
  margin: 0;
  color: var(--navy);
  font-size: 20px;
}

.route-map-head p {
  margin: 3px 0 0;
}

.route-map-body {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(320px, 1fr);
  min-height: 0;
  flex: 1 1 auto;
}

.route-map-stops {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: #f8fbfd;
}

.route-map-stops h3 {
  margin: 0;
  color: var(--navy);
  font-size: 15px;
}

.route-stop {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: flex-start;
  border: 1px solid #d7e4ee;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.route-stop.route-origin {
  border-color: #b8d8c0;
  background: #eef9ef;
}

.route-stop-number {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--navy), #0f5e92);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.route-origin .route-stop-number {
  background: linear-gradient(135deg, #078a4b, #0ba864);
}

.route-stop strong,
.route-stop span {
  display: block;
}

.route-stop strong {
  color: var(--ink);
  font-size: 13px;
}

.route-stop span,
.route-map-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.route-map-open {
  margin-top: auto;
  text-align: center;
  text-decoration: none;
}

.route-map-frame {
  width: 100%;
  height: 100%;
  min-height: 360px;
  border: 0;
  background: #e8f2f8;
}

.mail-panel {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.stats-panel {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: #fff;
}

.stats-totals {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.stats-totals strong {
  color: var(--ink);
}

.stats-scroll {
  max-height: 190px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.stats-table th {
  background: #e8f2f8;
  border-bottom-color: var(--line);
}

.stats-table td {
  padding: 6px 8px;
}

.number {
  text-align: right;
  font-weight: 700;
}

.mail-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 6px;
  max-height: 150px;
  overflow: auto;
  padding: 8px 10px 10px;
}

.mail-due {
  margin: 8px 10px 0;
  border: 1px solid #d9b650;
  border-radius: 6px;
  padding: 7px 8px;
  background: #fff7d6;
  color: #5f4700;
  font-size: 12px;
  font-weight: 700;
}

.mail-due.due,
.mail-due.overdue {
  border-color: #e69b9b;
  background: #fde2e2;
  color: #711313;
}

.mail-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px;
  background: #fff;
}

.mail-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.mail-preview-body {
  display: flex;
  min-height: 0;
  overflow: auto;
  flex: 1 1 auto;
  padding: 12px;
  background: #f2f7fb;
}

.mail-preview-card {
  width: 100%;
  align-self: start;
  border: 1px solid #cddce8;
  border-radius: 10px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(6, 31, 58, .10);
}

.mail-preview-card h3 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 20px;
}

.mail-preview-meta {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  color: #40566b;
  font-size: 12px;
}

.driver-mail {
  border: 1px solid #d6e3ec;
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  line-height: 1.45;
}

.driver-mail p {
  margin: 0 0 10px;
}

.driver-mail-signature-logo-wrap {
  display: block;
  margin: 6px 0 8px;
}

.driver-mail-signature-logo {
  display: block;
  width: 150px;
  max-width: 100%;
  height: auto;
  border: 0;
}

.driver-mail-important {
  margin: 10px 0 12px;
  border: 1px solid #f1c15a;
  border-left: 6px solid var(--orange);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff4cf;
  color: #4d3700;
  font-weight: 700;
}

.driver-mail-important strong {
  display: block;
  margin-bottom: 4px;
  color: #a14407;
  font-size: 12px;
  letter-spacing: .4px;
}

.driver-mail-row {
  margin-top: 10px;
  border-top: 1px solid #e4edf4;
  padding-top: 10px;
}

.driver-mail-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.driver-mail-row-missing {
  color: #765500;
}

.driver-mail-row-title {
  margin-bottom: 6px;
  color: var(--navy);
  font-weight: 800;
}

.driver-mail-line {
  margin: 4px 0;
}

.driver-mail-line strong {
  color: var(--ink);
}

.driver-mail-details {
  margin: 4px 0 0;
  white-space: pre-line;
}

.driver-mail-missing {
  display: inline-flex;
  border: 1px solid #f1c15a;
  border-radius: 999px;
  padding: 3px 8px;
  background: #fff4cf;
  color: #765500;
  font-size: 12px;
  font-weight: 800;
}

.mail-preview-note {
  margin-top: 12px;
  border-radius: 8px;
  padding: 9px 10px;
  background: #eaf4fb;
  color: #37546b;
  font-size: 12px;
  font-weight: 700;
}

.mail-preview-empty {
  width: 100%;
  align-self: start;
  border: 1px dashed #b8c8d6;
  border-radius: 10px;
  padding: 14px;
  background: #fff;
  color: var(--muted);
  line-height: 1.4;
}

.attendance-panel,
.drivers-panel {
  margin: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.attendance-scroll {
  max-height: 420px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.attendance-table th,
.drivers-table th {
  background: #e8f2f8;
  border-bottom-color: var(--line);
}

.attendance-table td,
.drivers-table td {
  padding: 6px 8px;
}

.presence-select,
.presence-note {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px;
  background: #fff;
}

.presence-note {
  min-width: 260px;
}

.attendance-absent td,
.attendance-maladie td {
  background: #fff0f0;
}

.attendance-retard td {
  background: #fff7df;
}

.attendance-conges td,
.attendance-repos td {
  background: #eef7f0;
}

.attendance-auto td {
  background: #edf7ff;
}

.attendance-auto.attendance-absent td {
  background: #fff0f0;
}

.attendance-auto .presence-select,
.attendance-auto .presence-note {
  border-color: #b7d6ec;
  background: #f2f8fc;
  color: #446174;
}

.attendance-inactive td {
  background: #f5f7f9;
  color: #627286;
}

.attendance-inactive .name {
  color: #4d5c6b;
}

.attendance-out-contract td {
  background: #f6f3ee;
  color: #6d6257;
}

.attendance-out-contract .presence-select,
.attendance-out-contract .presence-note {
  border-color: #d9d0c5;
  background: #fbf8f3;
  color: #6d6257;
}

.attendance-flag {
  display: inline-flex;
  margin-top: 3px;
  border: 1px solid #cdd7df;
  border-radius: 999px;
  padding: 2px 7px;
  background: #fff;
  color: #687887;
  font-size: 11px;
  font-weight: 800;
}

.driver-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  align-items: end;
}

.driver-panel-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.driver-pay-field {
  grid-column: span 2;
}

.driver-pay-field textarea {
  min-height: 58px;
}

.driver-active {
  min-height: 38px;
  align-self: end;
}

.payroll-note-cell {
  min-width: 220px;
  max-width: 320px;
  white-space: pre-wrap;
  color: #5b3f00;
  font-size: 12px;
  font-weight: 700;
}

.payroll-locked {
  color: #637381;
  font-style: italic;
}

.drivers-scroll {
  max-height: 360px;
  margin-top: 10px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.status-yes {
  color: var(--green);
  font-weight: 700;
}

.status-no {
  color: var(--red);
  font-weight: 700;
}

@media (max-width: 980px) {
  .options-category-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .options-category-wide {
    grid-column: span 1;
  }

  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .splitter {
    display: none;
  }

  .topbar-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .topbar-dashboard-grid > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .topbar-options .actions {
    top: 122px;
    right: 8px;
    left: 8px;
    max-height: calc(100vh - 134px);
  }

  .topbar-options .options-menu-c {
    left: 8px;
    right: 8px;
  }

  .test-warning {
    position: static;
    width: auto;
    margin: 8px;
  }

  .ops-report {
    top: 110px;
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }

  .admin-mail-field {
    flex: 1 1 100%;
  }

  .admin-mail-field input {
    width: min(100%, 280px);
  }

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

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

@media (max-width: 680px) {
  .options-category-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body {
    overflow-x: hidden;
    font-size: 13px;
  }

  button,
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .topbar {
    position: sticky;
    top: 0;
    gap: 8px;
    padding: 8px;
  }

  .brand {
    width: 100%;
    min-width: 0;
    gap: 8px;
    padding: 6px 10px 6px 8px;
    border-left-width: 5px;
    border-radius: 8px;
  }

  .brand-mark {
    width: 76px;
    max-width: 24vw;
    max-height: 54px;
    flex: 0 0 76px;
  }

  .brand-name {
    font-size: 12px;
    letter-spacing: 0;
  }

  .topbar h1 {
    font-size: 20px;
    line-height: 1.08;
  }

  .topbar p {
    font-size: 12px;
  }

  .top-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .topbar-btn,
  .top-actions > .btn,
  .topbar .options-panel,
  .top-actions > .pill {
    width: 100%;
    min-width: 0;
  }

  .top-actions > .pill {
    justify-content: center;
    min-height: 34px;
  }

  .topbar-dashboard {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
  }

  .topbar-dashboard summary {
    justify-content: flex-start;
    min-height: 34px;
    overflow: hidden;
  }

  .topbar-dashboard summary span:nth-child(n+4) {
    display: none;
  }

  .topbar-dashboard-panel,
  .topbar-options .actions,
  .topbar-options .options-menu-c {
    position: fixed;
    top: 8px;
    right: 8px;
    left: 8px;
    width: auto;
    max-height: calc(100vh - 16px);
    overflow: auto;
    border-radius: 10px;
  }

  .options-search-row,
  .options-main-actions,
  .options-category-actions,
  .stats-export-tools,
  .attendance-export-tools,
  .attendance-panel-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .options-search,
  .admin-mail-field input,
  .admin-mail-field select,
  .admin-mail-field textarea,
  .stats-export-tools input,
  .stats-export-tools select,
  .attendance-export-tools input {
    width: 100%;
    min-width: 0;
  }

  .test-warning {
    margin: 6px 8px 0;
  }

  .layout,
  .layout.preview-collapsed {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    height: auto;
    min-height: 0;
    padding: 8px;
  }

  .editor,
  .table-area,
  .mail-preview {
    width: 100%;
    min-width: 0;
    overflow: visible;
  }

  .editor {
    max-height: none;
    padding: 8px;
  }

  .editor > .section-head:first-child,
  .table-area > .section-head,
  .mail-preview-content > .section-head {
    margin: -8px -8px 8px;
    padding: 10px;
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 42px;
  }

  .two,
  .absence-bonus-row {
    grid-template-columns: 1fr;
  }

  .points-after-delivery {
    max-width: none;
  }

  .planning-summary-strip,
  .quick-filters,
  .fix-panel,
  .done-panel {
    margin-right: 8px;
    margin-left: 8px;
  }

  .planning-summary-strip,
  .quick-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }

  .planning-summary-strip > *,
  .quick-filters > * {
    flex: 0 0 auto;
  }

  .table-tools {
    display: grid;
    grid-template-columns: 1fr auto;
    width: 100%;
  }

  .search {
    width: 100%;
  }

  .fix-body,
  .done-panel-body {
    max-height: 170px;
  }

  .fix-item,
  .done-panel-item {
    grid-template-columns: 1fr;
  }

  .done-panel-buttons,
  .row-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .table-scroll {
    overflow: visible;
    padding: 0 8px 10px;
  }

  .planning-table,
  .planning-table thead,
  .planning-table tbody,
  .planning-table tr,
  .planning-table td {
    display: block;
    width: 100%;
  }

  .planning-table thead {
    display: none;
  }

  .planning-table tbody {
    display: grid;
    gap: 8px;
  }

  .planning-table tbody tr {
    position: relative;
    overflow: hidden;
    border: 1px solid #c9dae8;
    border-left: 5px solid var(--navy);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(6, 31, 58, .08);
  }

  .planning-table tbody tr.driver-group td,
  .planning-table tbody tr.driver-group-alt td,
  .planning-table tbody tr.driver-start td,
  .planning-table tbody tr.selected-row td,
  .planning-table tbody tr.status-row-empty:not(.selected-row) td,
  .planning-table tbody tr.status-row-ready:not(.selected-row) td,
  .planning-table tbody tr.status-row-sent:not(.selected-row) td,
  .planning-table tbody tr.status-row-opened:not(.selected-row) td,
  .planning-table tbody tr.status-row-error:not(.selected-row) td,
  .planning-table tbody tr.status-row-absent:not(.selected-row) td,
  .planning-table tbody tr.status-row-night:not(.selected-row) td,
  .planning-table tbody tr.status-row-done:not(.selected-row) td,
  .planning-table tbody tr.done-row:not(.selected-row) td {
    background: transparent;
  }

  .planning-table tbody tr.status-row-empty:not(.selected-row) {
    border-left-color: #f5a400;
    background: #fff8df;
  }

  .planning-table tbody tr.status-row-ready:not(.selected-row) {
    border-left-color: #16a065;
    background: #eaf8ef;
  }

  .planning-table tbody tr.status-row-sent:not(.selected-row) {
    border-left-color: #2374ab;
    background: #eaf5ff;
  }

  .planning-table tbody tr.status-row-opened:not(.selected-row) {
    border-left-color: #16a065;
    background: #e7f7ed;
  }

  .planning-table tbody tr.status-row-error:not(.selected-row) {
    border-left-color: #cf3d32;
    background: #fff0ee;
  }

  .planning-table tbody tr.status-row-absent:not(.selected-row) {
    border-left-color: #8393a3;
    background: #f3f5f7;
  }

  .planning-table tbody tr.status-row-night:not(.selected-row) {
    border-left-color: #8b5cf6;
    background: #f3ecff;
  }

  .planning-table tbody tr.done-row:not(.selected-row),
  .planning-table tbody tr.status-row-done:not(.selected-row) {
    border-color: #4c1d95;
    border-left-color: #4c1d95;
    background: #7c3aed;
    color: #fff;
  }

  .planning-table tbody tr.selected-row {
    border-color: #d69b00;
    border-left-color: #c28a00;
    background: #fff59d;
  }

  .planning-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    min-height: 34px;
    padding: 7px 10px;
    border-bottom: 1px solid rgba(86, 112, 133, .18);
  }

  .planning-table td::before {
    content: attr(data-label);
    flex: 0 0 112px;
    color: #4d6478;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .planning-table tbody tr.done-row:not(.selected-row) td,
  .planning-table tbody tr.status-row-done:not(.selected-row) td {
    border-bottom-color: rgba(255, 255, 255, .2);
    color: #fff;
  }

  .planning-table tbody tr.done-row:not(.selected-row) td::before,
  .planning-table tbody tr.status-row-done:not(.selected-row) td::before {
    color: #ede9fe;
  }

  .planning-table td:first-child {
    position: absolute;
    top: 8px;
    right: 10px;
    width: auto;
    min-height: 0;
    padding: 0;
    border-bottom: 0;
    color: inherit;
    font-size: 11px;
    font-weight: 800;
    opacity: .72;
  }

  .planning-table td:first-child::before,
  .planning-table td:nth-child(2)::before {
    display: none;
  }

  .planning-table td:nth-child(2) {
    display: block;
    min-height: 48px;
    padding-right: 42px;
  }

  .planning-table td:nth-child(7),
  .planning-table td:nth-child(8) {
    display: block;
  }

  .planning-table td:nth-child(7)::before,
  .planning-table td:nth-child(8)::before {
    display: block;
    margin-bottom: 4px;
  }

  .planning-table td:last-child {
    border-bottom: 0;
  }

  .planning-table .name,
  .planning-table .driver-preview-link {
    font-size: 15px;
  }

  .planning-table .details {
    white-space: pre-wrap;
  }

  .mail-preview {
    min-height: 0;
  }

  .mail-preview-toggle {
    top: 14px;
    left: auto;
    right: 10px;
    width: 40px;
    height: 40px;
    transform: none;
  }

  .mail-preview-collapsed {
    min-height: 52px;
    align-items: stretch;
    background: linear-gradient(180deg, #08395f, #0f5e92);
  }

  .mail-preview-collapsed .mail-preview-toggle {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  .mail-preview-collapsed .mail-preview-toggle::after {
    content: "";
    display: none;
  }

  .mail-preview-body {
    max-height: 70vh;
    padding: 10px;
  }

  .mail-preview-card,
  .driver-mail {
    padding: 12px;
  }

  .attendance-panel,
  .drivers-panel {
    margin: 8px;
    overflow: hidden;
  }

  .attendance-scroll,
  .drivers-scroll,
  .stats-scroll {
    overflow-x: auto;
  }

  .route-map-window {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }
}

@media (max-width: 420px) {
  .top-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-dashboard,
  .top-actions > .pill {
    grid-column: 1 / -1;
  }

  .brand-mark {
    width: 64px;
    flex-basis: 64px;
  }

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

  .planning-table td {
    display: block;
  }

  .planning-table td::before {
    display: block;
    margin-bottom: 3px;
  }
}

.planning-table tbody tr.done-row td,
.planning-table tbody tr.done-row:hover td,
.planning-table tbody tr.status-row-done td,
.planning-table tbody tr.status-row-done:hover td {
  background: #7c3aed !important;
  border-bottom-color: #4c1d95 !important;
  color: #fff !important;
}

.planning-table tbody tr.done-row:hover td,
.planning-table tbody tr.status-row-done:hover td {
  background: #6d28d9 !important;
}

.planning-table tbody tr.done-row td:first-child,
.planning-table tbody tr.status-row-done td:first-child {
  box-shadow: inset 5px 0 0 #2e1065 !important;
}

.planning-table tbody tr.done-row .name,
.planning-table tbody tr.status-row-done .name,
.planning-table tbody tr.done-row .driver-preview-link,
.planning-table tbody tr.status-row-done .driver-preview-link {
  color: #fff !important;
}

.planning-table tbody tr.done-row .muted,
.planning-table tbody tr.status-row-done .muted,
.planning-table tbody tr.done-row .details,
.planning-table tbody tr.status-row-done .details {
  color: #ede9fe !important;
}
