:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #dfe4ea;
  --text: #171b22;
  --muted: #6b7280;
  --dark: #111820;
  --dark-2: #1f2933;
  --red: #ed1c24;
  --red-dark: #c81018;
  --orange: #f36b16;
  --blue: #1769d2;
  --green: #1c9b58;
  --shadow: 0 8px 24px rgba(20, 30, 40, 0.08);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

body.locked {
  overflow: hidden;
}

body.locked .app-shell {
  pointer-events: none;
  user-select: none;
}

.hidden-by-role {
  display: none !important;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(17, 24, 32, 0.92);
}

.login-screen.hidden {
  display: none;
}

.login-card {
  width: min(440px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  padding: 28px;
}

.login-brand {
  padding: 0 0 18px;
  color: var(--text);
}

.login-brand strong {
  color: var(--text);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.login-card p,
.login-card small {
  color: var(--muted);
}

.login-card label {
  display: grid;
  gap: 6px;
  margin: 16px 0;
  font-weight: 700;
}

.login-card select,
.login-card input {
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

.login-card .primary-action {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.login-error {
  min-height: 22px;
  margin-top: 10px;
  color: var(--red);
  font-weight: 700;
}

.sidebar {
  background: linear-gradient(180deg, #151d24 0%, #0d1318 100%);
  color: #fff;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 18px 20px;
}

.brand-mark {
  width: 78px;
  height: 52px;
  background: linear-gradient(135deg, #f3f4f6 0 35%, #b8c0ca 36% 48%, var(--red) 49% 72%, #8b0f15 73%);
  color: transparent;
  transform: skewX(-10deg);
  border-radius: 4px;
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.25);
}

.brand strong {
  display: block;
  font-size: 36px;
  line-height: 1;
}

.brand span {
  color: #b9c0ca;
  display: block;
  font-size: 26px;
  font-weight: 700;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: #d7dde4;
  background: transparent;
  text-align: left;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-item.active,
.nav-item:hover {
  background: var(--red);
  color: #fff;
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  font-size: 20px;
}

@media (max-height: 760px) {
  .brand {
    padding-bottom: 8px;
  }

  .brand strong {
    font-size: 30px;
  }

  .brand span {
    font-size: 20px;
  }

  .city-badge {
    display: none;
  }
}

.city-badge {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding: 22px 10px;
  color: #b8c1cb;
  text-transform: uppercase;
}

.city-badge strong,
.city-badge span {
  display: block;
}

.workspace {
  min-width: 0;
}

.topbar {
  height: 78px;
  background: var(--dark);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.icon-button,
.ghost-button,
.secondary-action,
.primary-action {
  border-radius: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

.icon-button {
  width: 42px;
  padding: 0;
  display: grid;
  place-items: center;
}

.primary-action {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  font-weight: 700;
}

.primary-action:hover {
  background: var(--red-dark);
}

.secondary-action {
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.ghost-button {
  background: #fff;
  color: var(--red);
  border-color: transparent;
  font-weight: 700;
}

.search {
  height: 48px;
  width: min(420px, 38vw);
  background: #2b333d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  color: #bfc7d1;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
}

.topbar-spacer {
  flex: 1;
}

.date-pill {
  color: #dfe5ec;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  padding: 18px 30px;
}

.notification {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: #fff;
}

.notification b {
  position: absolute;
  top: 2px;
  right: 4px;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--red);
  display: grid;
  place-items: center;
  font-size: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #d9dee6;
  color: #27313d;
  font-weight: 800;
}

.user-chip strong,
.user-chip span {
  display: block;
}

.user-chip span {
  color: #b9c2cd;
  font-size: 13px;
}

.logout-button {
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  padding: 0 10px;
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

main {
  padding: 28px 32px 38px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.page-title h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.compact {
  margin-bottom: 16px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card,
.panel,
.form-section,
.order-summary,
.phone {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi-card {
  min-height: 126px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 54px 1fr;
  column-gap: 14px;
  align-items: center;
}

.kpi-card p,
.kpi-card strong,
.kpi-card small {
  margin: 0;
  grid-column: 2;
}

.kpi-card p {
  color: var(--muted);
}

.kpi-card strong {
  font-size: 26px;
}

.kpi-card small {
  color: var(--muted);
}

.kpi-icon {
  grid-row: 1 / span 3;
  width: 50px;
  height: 50px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 26px;
}

.red {
  color: var(--red);
  background: #fff0f1;
}

.orange {
  color: var(--orange);
  background: #fff3eb;
}

.dark {
  color: var(--dark);
  background: #edf1f5;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.1fr 0.75fr;
  gap: 16px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.shipments-panel {
  grid-column: span 2;
}

.map-panel {
  grid-column: span 1;
}

.panel-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel h2,
.form-section h2,
.phone h2 {
  margin: 0;
  font-size: 20px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
  font-size: 14px;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

th {
  color: #4b5563;
  background: var(--surface-soft);
}

.badge {
  border: 1px solid currentColor;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 700;
}

.badge-red {
  color: var(--red);
  background: #fff4f4;
}

.badge-orange {
  color: var(--orange);
  background: #fff6ee;
}

.badge-green {
  color: var(--green);
  background: #effbf4;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-green {
  color: var(--green);
}

.status-blue {
  color: var(--blue);
}

.status-orange {
  color: var(--orange);
}

.status-gray {
  color: #8a94a2;
}

.status-red {
  color: var(--red);
}

.map-board,
.mini-map,
.ride-map {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #e8f0ea;
}

.map-board {
  height: 390px;
  border: 1px solid #d4e0d9;
}

.real-map {
  isolation: isolate;
}

.ol-viewport {
  font: inherit;
}

.map-board .ol-attribution {
  font-size: 10px;
}

.map-board .ol-control button {
  background: var(--dark);
  border-radius: 6px;
}

.map-board .ol-control button:hover {
  background: var(--red);
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.map-legend .map-info {
  flex: 1 1 260px;
  justify-content: flex-end;
  color: var(--text);
}

.map-info strong,
.map-info span {
  display: inline;
}

.map-info span {
  color: var(--muted);
}

.map-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.map-fallback {
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

.map-board svg {
  width: 100%;
  height: 100%;
  display: block;
}

.map-city {
  position: absolute;
  left: 45%;
  top: 44%;
  font-size: 28px;
  font-weight: 800;
}

.map-tag {
  position: absolute;
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.tag-blue {
  color: var(--blue);
}

.tag-orange {
  color: var(--orange);
}

.tag-green {
  color: var(--green);
}

.bar-chart {
  height: 210px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  align-items: end;
  padding: 14px 8px 0;
  border-bottom: 1px solid var(--border);
}

.bar-group {
  min-width: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 2px;
  height: 100%;
}

.bar-plan,
.bar-fact {
  border-radius: 3px 3px 0 0;
}

.bar-plan {
  background: #c3c9d0;
}

.bar-fact {
  background: var(--red);
}

.chart-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  color: var(--muted);
}

.chart-summary b {
  color: var(--red);
}

.material-row,
.event-row,
.equipment-row {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.material-row:last-child,
.event-row:last-child,
.equipment-row:last-child {
  border-bottom: 0;
}

.material-top,
.event-row,
.equipment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress {
  height: 6px;
  background: #edf1f5;
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: var(--value);
  background: var(--color);
}

.event-row small {
  color: var(--muted);
}

.equipment-row {
  min-height: 74px;
}

.equipment-thumb {
  width: 70px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, #eef2f6, #cfd8e3);
  position: relative;
}

.equipment-thumb::after {
  content: "";
  position: absolute;
  width: 42px;
  height: 20px;
  border-radius: 4px;
  left: 12px;
  bottom: 10px;
  background: #1f2933;
}

.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}

.order-main {
  min-width: 0;
}

.form-section {
  padding: 18px;
  margin-bottom: 16px;
  position: relative;
}

.section-number {
  position: absolute;
  left: 18px;
  top: 18px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--red);
  color: var(--red);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.form-section h2 {
  padding-left: 42px;
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid.two {
  grid-template-columns: repeat(2, 1fr);
}

.form-grid.three {
  grid-template-columns: repeat(3, 1fr);
}

.form-grid.four {
  grid-template-columns: repeat(4, 1fr);
  margin-top: 14px;
}

.form-grid.five {
  grid-template-columns: 1fr 1fr 0.8fr 0.8fr 1.2fr;
}

.form-grid.six {
  grid-template-columns: 1.1fr 0.9fr 0.9fr 0.9fr 0.8fr 0.8fr;
}

.inline-note {
  margin-top: 12px;
  border-left: 4px solid var(--orange);
  background: #fff8f2;
  border-radius: 6px;
  padding: 10px 12px;
  color: #7a3d0f;
  font-size: 13px;
}

label {
  color: var(--muted);
  font-size: 13px;
  display: grid;
  gap: 6px;
}

input,
select,
textarea {
  min-height: 42px;
  border: 1px solid #cfd6df;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

textarea {
  min-height: 76px;
  padding: 10px 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.12);
}

.object-grid {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 18px;
}

.mini-map {
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px solid #d5e0d9;
  color: #1f2933;
  background:
    linear-gradient(30deg, transparent 45%, rgba(255,255,255,.8) 46% 54%, transparent 55%),
    linear-gradient(130deg, transparent 42%, rgba(159,208,232,.8) 43% 52%, transparent 53%),
    #e9f1eb;
}

.mini-map b {
  font-size: 28px;
  z-index: 1;
}

.mini-map span {
  position: absolute;
  top: 24px;
  right: 38px;
  background: #fff;
  border-radius: 6px;
  padding: 8px 12px;
}

.mini-map i {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  background: var(--red);
  transform: rotate(-45deg);
  top: 72px;
  left: 50%;
}

.mini-map i::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  left: 9px;
  top: 9px;
}

.payment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.payment-split-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.payment-split-actions button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0 14px;
  font-weight: 700;
}

.payment-split-actions button:hover {
  border-color: var(--red);
  color: var(--red);
}

.payment-choice,
.payment-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  text-align: left;
}

.payment-choice.active,
.payment-card.active {
  border-color: var(--red);
  background: #fff6f6;
}

.payment-choice span,
.payment-card span,
.payment-card small {
  display: block;
  color: var(--muted);
}

.payment-card b {
  display: block;
  font-size: 26px;
  margin: 8px 0;
}

.order-summary {
  position: sticky;
  top: 100px;
  padding: 18px;
}

.order-summary dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 16px;
  margin: 0;
}

.order-summary dt {
  color: var(--muted);
}

.order-summary dd {
  margin: 0;
  font-weight: 700;
}

.order-summary hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.total-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0;
  font-size: 18px;
}

.total-line strong {
  color: var(--red);
  font-size: 28px;
}

.warning-box {
  border: 1px solid #ffb3b6;
  background: #fff5f5;
  color: #9a161c;
  border-radius: 8px;
  padding: 14px;
}

.order-actions {
  position: sticky;
  bottom: 0;
  background: rgba(244, 246, 248, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 18px 0 0;
  display: grid;
  grid-template-columns: 180px 240px minmax(260px, 1fr);
  gap: 14px;
}

.phone-stage {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 380px));
  justify-content: center;
  gap: 32px;
  padding: 20px 0 40px;
}

.phone {
  min-height: 720px;
  border: 10px solid #20262d;
  border-radius: 42px;
  padding: 22px 18px;
  box-shadow: 0 24px 70px rgba(10, 14, 20, 0.25);
  overflow: hidden;
}

.phone-top {
  height: 58px;
  margin: -22px -18px 22px;
  padding: 18px 22px;
  background: var(--dark);
  color: #fff;
  display: flex;
  justify-content: space-between;
}

.phone-top.light {
  background: #fff;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.phone h2 {
  font-size: 28px;
  margin-bottom: 16px;
}

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

.mobile-section-title h2 {
  margin: 0;
}

.mobile-section-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.task-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.task-tabs span {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}

.task-tabs .active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.task-card,
.ride-card,
.finish-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
  background: #fff;
}

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

.task-card strong {
  display: block;
  font-size: 20px;
  margin: 6px 0;
}

.task-card p {
  margin: 6px 0;
  color: #394150;
}

.task-card small {
  color: var(--muted);
}

.mobile-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mobile-card-head b {
  border-radius: 999px;
  background: #fff0f1;
  color: var(--red);
  padding: 5px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.mobile-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.mobile-meta-grid span {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 9px 10px;
  color: var(--text);
}

.mobile-meta-grid small,
.mobile-meta-grid b {
  display: block;
}

.mobile-meta-grid small {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 3px;
}

.mobile-meta-grid b {
  font-size: 14px;
  line-height: 1.2;
}

.order-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ebf1;
  margin: 10px 0 4px;
}

.order-progress i {
  display: block;
  height: 100%;
  width: var(--w);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--orange));
}

.red-task {
  border-left: 6px solid var(--red);
}

.orange-task {
  border-left: 6px solid var(--orange);
}

.selected-task {
  box-shadow: 0 0 0 2px rgba(231, 29, 35, .16);
}

.mobile-nav {
  margin-top: 34px;
  display: flex;
  justify-content: space-around;
  color: var(--muted);
}

.mobile-nav b {
  color: var(--red);
}

.ride-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--red);
  margin-bottom: 16px;
}

.ride-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 16px;
}

.ride-card dt {
  color: var(--muted);
}

.ride-card dd {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.ride-map {
  height: 160px;
  margin: 16px 0;
  background:
    radial-gradient(circle at 65% 45%, var(--red) 0 8px, transparent 9px),
    linear-gradient(150deg, transparent 42%, rgba(159,208,232,.9) 43% 52%, transparent 53%),
    linear-gradient(30deg, transparent 48%, #fff 49% 55%, transparent 56%),
    #e9f1eb;
}

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

.ride-actions button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--blue);
  font-weight: 700;
}

.status-line {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  color: var(--muted);
}

.status-line b,
.status-line span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 56px;
  min-height: 34px;
  border-radius: 999px;
  background: #edf1f5;
  font-size: 12px;
  font-weight: 800;
}

.status-line b {
  color: var(--red);
}

.status-line.progress-loaded b,
.status-line.progress-route b,
.status-line.progress-route span:nth-child(2),
.status-line.progress-arrived b,
.status-line.progress-arrived span:nth-child(2),
.status-line.progress-arrived span:nth-child(3),
.status-line.progress-delivered b,
.status-line.progress-delivered span {
  background: var(--red);
  color: #fff;
}

.route-call-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.route-call-grid a {
  min-height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-decoration: none;
  font-weight: 800;
  color: var(--blue);
  background: #eef5ff;
  border: 1px solid #cfe0fb;
}

.mobile-bottom-nav {
  display: none;
}

.finish-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.finish-card-head span,
.photo-note {
  color: var(--muted);
  font-size: 12px;
}

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

.photo-toolbar button {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

.photo-toolbar button:first-child {
  background: #fff0f1;
  border-color: #ffc7ca;
  color: var(--red);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  padding: 0 !important;
}

.photo-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.photo-tile,
.photo-add-tile,
.photo-empty {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.photo-tile {
  position: relative;
  overflow: hidden;
  background: #111820;
}

.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-tile button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(17, 24, 32, 0.82);
  color: #fff;
  font-size: 20px;
  line-height: 1;
}

.photo-tile small {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 5px 6px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.75));
  color: #fff;
  font-size: 10px;
}

.photo-add-tile,
.photo-empty {
  background: #fff;
  color: var(--muted);
  border: 1px dashed #aeb7c2;
}

.photo-add-tile {
  font-size: 28px;
}

.photo-empty {
  grid-column: span 2;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.signature {
  height: 120px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-family: "Segoe Script", cursive;
}

.payment-ok {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.payment-ok strong {
  color: var(--red);
}

.payment-ok span {
  color: var(--green);
}

.payment-ok b {
  grid-column: 1 / -1;
  font-size: 24px;
}

.mobile-primary {
  width: 100%;
  min-height: 54px;
  border-radius: 8px;
  border: 0;
  background: #0754c9;
  color: #fff;
  font-weight: 800;
}

.mobile-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.mobile-actions.two-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mobile-actions button,
.finish-card .secondary-action {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.mobile-actions button:not(:disabled):hover,
.finish-card .secondary-action:hover {
  border-color: var(--red);
  color: var(--red);
}

.mobile-actions button:disabled,
.ride-actions button:disabled {
  background: #f2f4f7;
  color: #aab2bd;
  cursor: not-allowed;
}

.operator-recipe h3,
.operator-recipe h4,
.finish-card h3 {
  margin: 0 0 12px;
}

.operator-recipe p {
  color: var(--muted);
  margin: 0 0 16px;
}

.operator-recipe h4 {
  margin-top: 18px;
  color: var(--red);
}

.shipment-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
}

.shipment-metrics div {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #fafbfc;
}

.shipment-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.shipment-metrics b {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.operator-load-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.operator-load-form label,
.finish-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.operator-load-form input,
.operator-load-form select,
.finish-card input {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

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

.shipment-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.shipment-row span {
  color: var(--text);
  font-weight: 800;
}

.shipment-row small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.empty-state.compact {
  min-height: auto;
  padding: 12px;
}

.split-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 9px 0;
}

.split-line span {
  color: var(--muted);
}

.finish-card {
  display: grid;
  gap: 12px;
}

.dispatcher-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.dispatcher-side {
  display: grid;
  gap: 16px;
  align-content: start;
}

.reports-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.report-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.report-kpi {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.report-kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.report-kpi strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-row header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e8edf2;
  display: flex;
}

.bar-track span {
  display: block;
  width: var(--w, 0%);
  background: var(--bar-color, var(--red));
}

.bar-track span + span {
  border-left: 1px solid rgba(255, 255, 255, .8);
}

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

.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 8px;
  padding: 0 8px;
  background: #eef4ff;
  color: var(--blue);
  font-weight: 700;
  font-size: 12px;
}

.role-pill.admin {
  background: #fff0f1;
  color: var(--red);
}

.role-pill.operator {
  background: #fff5ec;
  color: var(--orange);
}

.chat-panel {
  min-height: 620px;
}

.channel-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.channel-switch button {
  border: 0;
  min-height: 36px;
  padding: 0 14px;
  background: #fff;
}

.channel-switch .active {
  background: var(--red);
  color: #fff;
}

.chat-feed {
  display: grid;
  gap: 12px;
  min-height: 420px;
}

.dispatcher-input {
  width: 100%;
  min-height: 150px;
  margin-bottom: 14px;
  line-height: 1.45;
}

.certificate-panel {
  display: grid;
  gap: 12px;
}

.certificate-select-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.certificate-select-label select {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

.print-root {
  display: none;
}

.certificate-a5 {
  box-sizing: border-box;
  width: 148mm;
  min-height: 210mm;
  margin: 0 auto;
  padding: 9mm;
  background: #fff;
  color: #151b24;
  font-family: Arial, Helvetica, sans-serif;
  border: 1px solid #d9e1ea;
}

.certificate-a5 h1,
.certificate-a5 h2,
.certificate-a5 p {
  margin: 0;
}

.certificate-header {
  display: flex;
  justify-content: space-between;
  gap: 8mm;
  padding-bottom: 5mm;
  border-bottom: 2px solid #151b24;
}

.certificate-brand {
  display: flex;
  align-items: center;
  gap: 4mm;
}

.certificate-brand b,
.certificate-brand small,
.certificate-number span,
.certificate-number b {
  display: block;
}

.certificate-brand b {
  font-size: 17pt;
  line-height: 1;
}

.certificate-brand small,
.certificate-number span,
.certificate-grid span,
.certificate-main span,
.certificate-footer span,
.certificate-note {
  color: #596473;
}

.certificate-mark {
  width: 16mm;
  height: 16mm;
  display: grid;
  place-items: center;
  border-radius: 4mm;
  background: linear-gradient(135deg, #dfe5eb 0%, #fff 42%, #ec1c24 43%, #c81219 100%);
  color: #111821;
  font-size: 22pt;
  font-weight: 900;
  font-style: italic;
}

.certificate-number {
  text-align: right;
}

.certificate-number b {
  margin-top: 1.5mm;
  font-size: 13pt;
}

.certificate-a5 h1 {
  margin: 5mm 0 4mm;
  font-size: 18pt;
}

.certificate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3mm;
}

.certificate-grid div,
.certificate-main > div {
  border: 1px solid #d9e1ea;
  border-radius: 2mm;
  padding: 3mm;
}

.certificate-grid span,
.certificate-grid b,
.certificate-main span,
.certificate-main strong,
.certificate-main small {
  display: block;
}

.certificate-grid span,
.certificate-main span {
  margin-bottom: 1mm;
  font-size: 8.5pt;
}

.certificate-grid b {
  font-size: 9.5pt;
}

.certificate-main {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 3mm;
  margin: 4mm 0;
}

.certificate-main strong {
  font-size: 18pt;
}

.certificate-main small {
  margin-top: 1mm;
  color: #596473;
}

.certificate-block {
  margin-top: 4mm;
}

.certificate-block h2 {
  margin-bottom: 2mm;
  font-size: 11pt;
}

.certificate-a5 table {
  min-width: 0;
  width: 100%;
  border-collapse: collapse;
  font-size: 8.8pt;
}

.certificate-a5 th,
.certificate-a5 td {
  padding: 2mm;
  border: 1px solid #d9e1ea;
  white-space: normal;
}

.certificate-a5 th {
  background: #f1f4f7;
}

.certificate-footer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3mm;
  margin-top: 6mm;
}

.certificate-footer div {
  min-height: 15mm;
  border-bottom: 1px solid #151b24;
}

.certificate-footer span,
.certificate-footer b {
  display: block;
}

.certificate-note {
  margin-top: 4mm;
  font-size: 8pt;
  line-height: 1.35;
}

.quality-document {
  font-size: 10.5pt;
  line-height: 1.42;
}

.quality-document h1 {
  margin: 0 0 3mm;
  text-align: center;
  font-size: 16pt;
  letter-spacing: 0;
}

.quality-document h2 {
  margin: 0 0 7mm;
  text-align: center;
  font-size: 10.5pt;
  font-weight: 800;
}

.quality-lines {
  margin: 0;
  padding-left: 6mm;
}

.quality-lines li {
  margin: 0 0 3.5mm;
  padding-bottom: 1.5mm;
  border-bottom: 1px solid #9aa4b2;
}

.quality-lines span {
  font-weight: 800;
}

.quality-date,
.quality-note,
.quality-sign {
  margin-top: 6mm;
}

.quality-note {
  font-size: 9.5pt;
}

.quality-sign {
  display: flex;
  align-items: end;
  gap: 4mm;
  font-weight: 700;
}

.quality-sign span {
  width: 42mm;
  border-bottom: 1px solid #151b24;
}

.ttn-doc {
  box-sizing: border-box;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 10mm;
  background: #fff;
  color: #151b24;
  font-family: Arial, Helvetica, sans-serif;
  border: 1px solid #d9e1ea;
}

.ttn-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8mm;
  padding-bottom: 5mm;
  border-bottom: 2px solid #151b24;
}

.ttn-header b,
.ttn-header span,
.ttn-grid span,
.ttn-grid b,
.ttn-grid small,
.ttn-totals span,
.ttn-totals b {
  display: block;
}

.ttn-header b {
  font-size: 16pt;
}

.ttn-header span,
.ttn-grid span,
.ttn-grid small,
.ttn-totals span {
  color: #596473;
}

.ttn-grid,
.ttn-totals {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3mm;
  margin-top: 5mm;
}

.ttn-totals {
  grid-template-columns: repeat(4, 1fr);
}

.ttn-grid div,
.ttn-totals div {
  border: 1px solid #d9e1ea;
  border-radius: 2mm;
  padding: 3mm;
}

.ttn-table,
.ttn-block table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  margin-top: 5mm;
  font-size: 9pt;
}

.ttn-table th,
.ttn-table td,
.ttn-block th,
.ttn-block td {
  padding: 2mm;
  border: 1px solid #d9e1ea;
  white-space: normal;
  text-align: left;
}

.ttn-table th,
.ttn-block th {
  background: #f1f4f7;
}

.ttn-block h2 {
  margin: 6mm 0 0;
  font-size: 12pt;
}

.ttn-signatures {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5mm;
  margin-top: 12mm;
  font-weight: 700;
}

.ttn-signatures span {
  display: block;
  height: 12mm;
  border-bottom: 1px solid #151b24;
}

.combined-doc-a4 {
  box-sizing: border-box;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 8mm;
  background: #fff;
  color: #151b24;
  font-family: Arial, Helvetica, sans-serif;
  border: 1px solid #d9e1ea;
  font-size: 8.4pt;
  line-height: 1.26;
}

.combined-doc-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6mm;
  padding-bottom: 3mm;
  border-bottom: 2px solid #151b24;
}

.combined-doc-header b,
.combined-doc-header strong,
.combined-doc-header span,
.combined-info-grid span,
.combined-info-grid b,
.combined-info-grid small,
.combined-totals span,
.combined-totals b,
.combined-signatures small {
  display: block;
}

.combined-doc-header b,
.combined-doc-header strong {
  font-size: 13pt;
}

.combined-doc-header span,
.combined-info-grid span,
.combined-info-grid small,
.combined-note,
.combined-signatures small {
  color: #596473;
}

.combined-doc-section {
  margin-top: 3.5mm;
}

.combined-doc-section h1,
.combined-doc-section h2,
.combined-doc-section p {
  margin: 0;
}

.combined-doc-section h1 {
  margin-bottom: 1.8mm;
  font-size: 12pt;
}

.combined-doc-section h2 {
  margin-bottom: 2mm;
  font-size: 8.5pt;
  text-transform: uppercase;
}

.combined-info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2mm;
}

.combined-info-grid div,
.combined-totals span {
  border: 1px solid #d9e1ea;
  border-radius: 1.5mm;
  padding: 2mm;
}

.combined-table {
  width: 100%;
  min-width: 0;
  margin-top: 2.5mm;
  border-collapse: collapse;
  font-size: 7.8pt;
}

.combined-table.compact {
  margin-top: 2mm;
}

.combined-table th,
.combined-table td {
  padding: 1.3mm;
  border: 1px solid #d9e1ea;
  white-space: normal;
  text-align: left;
  vertical-align: top;
}

.combined-table th {
  background: #f1f4f7;
}

.combined-totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2mm;
  margin-top: 2mm;
}

.combined-quality-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1mm 5mm;
}

.combined-quality-list p {
  padding-bottom: 1mm;
  border-bottom: 1px solid #d9e1ea;
}

.combined-note {
  margin-top: 2mm;
  font-size: 7.6pt;
}

.combined-signatures {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4mm;
  margin-top: 4mm;
  font-weight: 700;
}

.combined-signatures span {
  display: block;
  height: 8mm;
  border-bottom: 1px solid #151b24;
}

.settings-wide {
  grid-column: 1 / -1;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-top: 22px;
}

.check-line input {
  width: 18px;
  height: 18px;
}

.warehouse-history-summary {
  margin: 12px 0;
}

.warehouse-history-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.warehouse-history-card dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0 0;
}

.warehouse-history-card dt {
  color: var(--muted);
  font-size: 12px;
}

.warehouse-history-card dd {
  margin: 0;
  font-weight: 800;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.chat-feed p {
  max-width: 76%;
  margin: 0;
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.45;
}

.incoming {
  background: #eef3f8;
}

.ai {
  background: #fff3f3;
  justify-self: end;
  border: 1px solid #ffd0d2;
}

.composer {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 10px;
  margin-top: 16px;
}

.status-pill {
  color: var(--orange);
  background: #fff4ec;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
}

.status-pill.bad {
  color: var(--red);
  background: #fff0f1;
}

.decision-card,
.rule-list,
.decision-actions,
.timeline,
.command-list {
  display: grid;
  gap: 12px;
}

.decision-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.decision-card dl {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
}

.decision-card dt {
  color: var(--muted);
}

.decision-card dd {
  margin: 0;
  font-weight: 700;
}

.rule-list span {
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 700;
}

.ok {
  color: var(--green);
  background: #ecfbf3;
}

.warn {
  color: var(--orange);
  background: #fff4ec;
}

.decision-actions {
  grid-template-columns: 1fr 1fr;
  margin-top: 16px;
}

.timeline span {
  display: block;
  width: var(--w);
  min-width: 220px;
  border-radius: 8px;
  background: #fff4f4;
  border-left: 5px solid var(--red);
  padding: 12px;
  font-weight: 700;
}

.command-list button {
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  text-align: left;
  padding: 0 14px;
  font-weight: 700;
}

.two-column-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.7fr);
  gap: 16px;
  align-items: start;
}

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

.need-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.need-row small,
.need-row span {
  display: block;
  color: var(--muted);
}

.ok-row {
  background: #f3fcf7;
  border-color: #ccefdc;
}

.bad-row {
  background: #fff3f4;
  border-color: #ffbdc1;
}

.warehouse-row {
  display: grid;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.warehouse-row:first-child {
  padding-top: 0;
}

.warehouse-row:last-child {
  border-bottom: 0;
}

.warehouse-row small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.warehouse-row dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 12px;
  margin: 0;
}

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

.warehouse-row dd {
  margin: 0;
  font-weight: 800;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 260px;
}

.row-actions button {
  min-height: 34px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.row-actions button:not(:disabled):hover {
  border-color: var(--red);
  color: var(--red);
}

.row-actions button:disabled {
  color: #aab2bd;
  cursor: not-allowed;
  background: #f2f4f7;
}

.empty-state {
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 14px;
}

.catalog-warning {
  margin-bottom: 14px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: 420px;
  border-radius: 8px;
  background: var(--dark);
  color: #fff;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
  padding: 14px 16px;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--red);
}

@media (max-width: 1350px) {
  .app-shell {
    grid-template-columns: 96px 1fr;
  }

  .brand div:not(.brand-mark),
  .nav-item:not(.active) {
    font-size: 0;
  }

  .brand {
    padding: 0;
  }

  .brand-mark {
    width: 58px;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .city-badge {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .shipments-panel,
  .map-panel {
    grid-column: span 2;
  }
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 12;
    padding: 10px;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .brand {
    flex: 0 0 auto;
  }

  .side-nav {
    display: flex;
    min-width: max-content;
  }

  .topbar {
    height: auto;
    padding: 12px;
    flex-wrap: wrap;
  }

  .search {
    width: 100%;
    order: 10;
  }

  .date-pill,
  .user-chip {
    display: none;
  }

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

  .page-title {
    align-items: stretch;
    flex-direction: column;
  }

  .kpi-grid,
  .dashboard-grid,
  .order-layout,
  .dispatcher-grid,
  .phone-stage {
    grid-template-columns: 1fr;
  }

  .shipments-panel,
  .map-panel {
    grid-column: span 1;
  }

  .form-grid.two,
  .form-grid.three,
  .form-grid.four,
  .form-grid.five,
  .form-grid.six,
  .object-grid,
  .payment-grid,
  .order-actions,
  .composer,
  .decision-actions,
  .two-column-grid {
    grid-template-columns: 1fr;
  }

  .need-row,
  .warehouse-row dl {
    grid-template-columns: 1fr;
  }

  .order-summary {
    position: static;
  }

  .phone-stage {
    justify-items: center;
  }

  .phone {
    width: min(100%, 390px);
  }
}

@media (max-width: 720px) {
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) {
    background: #f3f6f9;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .app-shell {
    display: block;
    min-height: 100dvh;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 10px;
    overflow: visible;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .brand {
    min-width: 0;
    padding: 0;
    gap: 8px;
    justify-content: start;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .brand div:not(.brand-mark) {
    font-size: inherit;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .brand strong {
    font-size: 18px;
    line-height: 1;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .brand span {
    font-size: 12px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .side-nav {
    grid-column: 1 / -1;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    min-width: 0;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 0 4px;
    scrollbar-width: none;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .side-nav::-webkit-scrollbar {
    display: none;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .nav-item,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .nav-item:not(.active) {
    width: auto;
    min-width: max-content;
    height: 40px;
    justify-content: start;
    gap: 8px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 13px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .nav-icon {
    width: 20px;
    height: 20px;
    font-size: 16px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    gap: 8px;
    padding: 10px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .search {
    order: 1;
    width: 100%;
    height: 42px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .topbar-spacer,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .date-pill {
    display: none;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .notification {
    order: 2;
    width: 42px;
    height: 42px;
    margin-left: auto;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .user-chip {
    order: 3;
    display: flex;
    width: 100%;
    justify-content: space-between;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .avatar {
    width: 36px;
    height: 36px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .user-chip strong {
    font-size: 14px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .user-chip span {
    font-size: 12px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) main {
    padding: 14px 10px 24px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .page-title {
    gap: 12px;
    margin-bottom: 14px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .page-title h1 {
    font-size: 24px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .page-subtitle {
    font-size: 14px;
    line-height: 1.35;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .page-title .primary-action,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .panel-head .ghost-button,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .certificate-panel .secondary-action,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .composer button,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .decision-actions button {
    width: 100%;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .panel,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .form-section,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .order-summary,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .report-kpi {
    padding: 14px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .panel-head {
    min-height: 0;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .panel h2,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .form-section h2 {
    font-size: 18px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .kpi-grid,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .dashboard-grid,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .reports-grid,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .settings-grid,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .dispatcher-grid,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .order-layout,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .two-column-grid,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .form-grid.two,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .form-grid.three,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .form-grid.four,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .form-grid.five,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .form-grid.six,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .object-grid,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .payment-grid,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .order-actions,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .composer,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .decision-actions {
    grid-template-columns: 1fr;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .report-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .report-kpi strong {
    font-size: 20px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .table-wrap {
    overflow: visible;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) table {
    display: block;
    min-width: 0;
    font-size: 14px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) thead {
    display: none;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) tbody,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) tr,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) td {
    display: block;
    width: 100%;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) tr {
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) td {
    display: grid;
    grid-template-columns: minmax(96px, 0.42fr) minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    padding: 7px 0;
    border: 0;
    white-space: normal;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) td[colspan] {
    display: block;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) td[colspan]::before,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) td:empty {
    display: none;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .row-actions {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .row-actions button {
    min-height: 40px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .chat-panel {
    min-height: auto;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .dispatcher-input {
    min-height: 220px;
    font-size: 16px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .channel-switch,
  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .certificate-select-label select {
    width: 100%;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .channel-switch button {
    flex: 1;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .chat-feed {
    min-height: auto;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .chat-feed p {
    max-width: 100%;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .decision-card dl {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  body:not([data-active-screen="operator"]):not([data-active-screen="driver"]) .timeline span {
    width: auto;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  body[data-active-screen="operator"],
  body[data-active-screen="driver"] {
    background: #eef1f5;
  }

  body[data-active-screen="operator"] .app-shell,
  body[data-active-screen="driver"] .app-shell {
    min-height: 100dvh;
    display: block;
  }

  body[data-active-screen="operator"] .sidebar,
  body[data-active-screen="operator"] .topbar,
  body[data-active-screen="operator"] #operator > .page-title,
  body[data-active-screen="driver"] .sidebar,
  body[data-active-screen="driver"] .topbar,
  body[data-active-screen="driver"] #driver > .page-title {
    display: none;
  }

  body[data-active-screen="operator"] main,
  body[data-active-screen="driver"] main {
    min-height: 100dvh;
    padding: 0;
  }

  body[data-active-screen="operator"] .screen.active,
  body[data-active-screen="driver"] .screen.active {
    min-height: 100dvh;
    padding: 0 0 78px;
  }

  body[data-active-screen="operator"] .role-mobile-stage,
  body[data-active-screen="driver"] .role-mobile-stage {
    display: block;
    padding: 0;
  }

  body[data-active-screen="operator"] .phone,
  body[data-active-screen="driver"] .phone {
    width: 100%;
    min-height: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    padding: 76px 14px 14px;
    background: #eef1f5;
  }

  body[data-active-screen="operator"] .phone + .phone,
  body[data-active-screen="driver"] .phone + .phone {
    padding-top: 14px;
  }

  body[data-active-screen="operator"] .phone-top,
  body[data-active-screen="driver"] .phone-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    height: 62px;
    margin: 0;
    padding: 14px 16px;
    align-items: center;
    border-radius: 0;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
  }

  body[data-active-screen="operator"] .phone:not(:first-child) .phone-top,
  body[data-active-screen="driver"] .phone:not(:first-child) .phone-top {
    position: static;
    height: auto;
    margin: 0 0 10px;
    padding: 0;
    background: transparent;
    color: var(--text);
    box-shadow: none;
    border-bottom: 0;
    font-size: 20px;
    font-weight: 900;
  }

  body[data-active-screen="operator"] .mobile-section-title h2,
  body[data-active-screen="driver"] .mobile-section-title h2 {
    font-size: 26px;
  }

  body[data-active-screen="operator"] .task-card,
  body[data-active-screen="operator"] .ride-card,
  body[data-active-screen="operator"] .finish-card,
  body[data-active-screen="driver"] .task-card,
  body[data-active-screen="driver"] .ride-card,
  body[data-active-screen="driver"] .finish-card,
  body[data-active-screen="operator"] .operator-recipe {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
  }

  body[data-active-screen="operator"] .task-card strong,
  body[data-active-screen="driver"] .task-card strong {
    font-size: 19px;
  }

  body[data-active-screen="operator"] .mobile-actions,
  body[data-active-screen="driver"] .mobile-actions {
    grid-template-columns: 1fr;
  }

  body[data-active-screen="operator"] .mobile-actions.two-actions,
  body[data-active-screen="driver"] .mobile-actions.two-actions,
  body[data-active-screen="driver"] .ride-actions,
  body[data-active-screen="driver"] .route-call-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-active-screen="operator"] .mobile-actions button,
  body[data-active-screen="operator"] .mobile-primary,
  body[data-active-screen="driver"] .mobile-actions button,
  body[data-active-screen="driver"] .mobile-primary,
  body[data-active-screen="driver"] .ride-actions button,
  body[data-active-screen="driver"] .route-call-grid a,
  body[data-active-screen="driver"] .finish-card .secondary-action {
    min-height: 48px;
  }

  body[data-active-screen="operator"] .operator-load-form input,
  body[data-active-screen="operator"] .operator-load-form select,
  body[data-active-screen="driver"] .finish-card input {
    min-height: 52px;
    font-size: 18px;
  }

  body[data-active-screen="operator"] .shipment-metrics,
  body[data-active-screen="driver"] .mobile-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-active-screen="driver"] .ride-map {
    height: 190px;
    border-radius: 12px;
  }

  body[data-active-screen="driver"] .photo-row {
    grid-template-columns: repeat(3, 1fr);
  }

  body[data-active-screen="operator"] .mobile-bottom-nav,
  body[data-active-screen="driver"] .mobile-bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 40;
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 16px 44px rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(14px);
  }

  body[data-active-screen="operator"] .mobile-bottom-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  body[data-active-screen="driver"] .mobile-bottom-nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .mobile-bottom-nav button {
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    background: #f1f5f9;
    color: var(--text);
    font-weight: 900;
  }

  .mobile-bottom-nav button:first-child {
    background: var(--red);
    color: #fff;
  }

  .mobile-bottom-nav b {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    margin-left: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.24);
    font-size: 12px;
  }
}

@media print {
  @page certificate-a5 {
    size: A5 portrait;
    margin: 7mm;
  }

  @page ttn-a4 {
    size: A4 portrait;
    margin: 10mm;
  }

  @page combined-a4 {
    size: A4 portrait;
    margin: 8mm;
  }

  body {
    background: #fff;
  }

  body * {
    visibility: hidden !important;
  }

  #certificatePrintRoot,
  #certificatePrintRoot * {
    visibility: visible !important;
  }

  #certificatePrintRoot {
    display: block !important;
    position: static;
    inset: auto;
  }

  .app-shell,
  .login-screen,
  .toast {
    display: none !important;
  }

  .certificate-a5 {
    page: certificate-a5;
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    font-size: 9.5pt;
  }

  .ttn-doc {
    page: ttn-a4;
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    font-size: 9pt;
  }

  .combined-doc-a4 {
    page: combined-a4;
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    font-size: 8.2pt;
  }

  .certificate-header {
    padding-bottom: 4mm;
  }

  .certificate-brand b {
    font-size: 16pt;
  }

  .certificate-mark {
    width: 14mm;
    height: 14mm;
    font-size: 18pt;
  }

  .certificate-a5 h1 {
    margin: 4mm 0 3mm;
    font-size: 16pt;
  }

  .certificate-grid {
    gap: 2.5mm;
  }

  .certificate-grid div,
  .certificate-main > div {
    padding: 2.5mm;
  }

  .certificate-main {
    margin: 3mm 0;
    gap: 2.5mm;
  }

  .certificate-main strong {
    font-size: 16pt;
  }

  .certificate-block {
    margin-top: 3mm;
  }

  .certificate-a5 th,
  .certificate-a5 td,
  .ttn-doc th,
  .ttn-doc td,
  .combined-doc-a4 th,
  .combined-doc-a4 td {
    display: table-cell !important;
    width: auto !important;
    padding: 1.4mm;
    border: 1px solid #d9e1ea !important;
    white-space: normal !important;
  }

  .certificate-a5 table,
  .ttn-doc table,
  .combined-doc-a4 table {
    display: table !important;
    min-width: 0 !important;
  }

  .certificate-a5 thead,
  .ttn-doc thead,
  .combined-doc-a4 thead {
    display: table-header-group !important;
  }

  .certificate-a5 tbody,
  .ttn-doc tbody,
  .combined-doc-a4 tbody {
    display: table-row-group !important;
  }

  .certificate-a5 tr,
  .ttn-doc tr,
  .combined-doc-a4 tr {
    display: table-row !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .certificate-a5 td::before,
  .ttn-doc td::before,
  .combined-doc-a4 td::before {
    content: none !important;
    display: none !important;
  }

  .certificate-footer {
    margin-top: 5mm;
  }
}
