:root {
  color-scheme: dark;
  --bg-main: #0b0f14;
  --bg-alt: #111827;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-strong: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef2ff;
  --muted: #9ba9c2;
  --primary: #ff6a00;
  --primary-strong: #ff8b3d;
  --success: #22c55e;
  --danger: #ef4444;
  --soft-danger: rgba(239, 68, 68, 0.14);
  --soft-success: rgba(34, 197, 94, 0.16);
  --shadow-soft: 0 20px 45px rgba(0, 0, 0, 0.28);
  --shadow-glow: 0 0 0 1px rgba(255, 106, 0, 0.45), 0 0 24px rgba(255, 106, 0, 0.28);
  --radius: 16px;
  --radius-sm: 12px;
  --tr-fast: 160ms ease;
  --tr-mid: 220ms ease;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI Variable", "SF Pro Display", "Manrope", "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
  background:
    radial-gradient(circle at 8% 10%, rgba(255, 106, 0, 0.18), transparent 22%),
    radial-gradient(circle at 78% 0%, rgba(59, 130, 246, 0.16), transparent 36%),
    linear-gradient(140deg, #070a10 8%, var(--bg-main) 42%, var(--bg-alt) 100%);
}

body.is-loading {
  cursor: wait;
}

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

button {
  cursor: pointer;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.screen {
  min-height: 100vh;
  padding: 18px;
}

.boot-screen,
.auth-screen {
  display: grid;
  place-items: center;
}

.dashboard-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

body.entity-modal-open .panel {
  backdrop-filter: none;
}

.auth-panel {
  width: min(100%, 460px);
}

.brand h1,
.topbar h1,
.section-head h2,
.section-head h3 {
  margin: 0;
}

.brand p,
.muted {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stack {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: rgba(11, 15, 20, 0.56);
  color: var(--text);
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast), background var(--tr-mid);
}

input::placeholder,
textarea::placeholder {
  color: #76839a;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(255, 106, 0, 0.62);
  box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.16), 0 0 18px rgba(255, 106, 0, 0.16);
  background: rgba(17, 24, 39, 0.86);
}

textarea {
  resize: vertical;
}

.primary,
.ghost,
.danger {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-height: 42px;
  transition: transform var(--tr-fast), border-color var(--tr-fast), background var(--tr-fast), color var(--tr-fast), box-shadow var(--tr-fast);
}

.primary {
  background: linear-gradient(135deg, #ff6a00 0%, #ff8c3f 100%);
  color: #fff;
  border-color: rgba(255, 136, 59, 0.45);
  box-shadow: 0 8px 20px rgba(255, 106, 0, 0.25);
}

.primary:hover,
.primary:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(255, 106, 0, 0.36);
}

.ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: var(--line);
}

.ghost:hover,
.ghost:focus-visible {
  border-color: rgba(255, 106, 0, 0.65);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 106, 0, 0.32) inset;
}

.danger {
  background: var(--soft-danger);
  color: #ffd7d7;
  border-color: rgba(239, 68, 68, 0.45);
}

.danger:hover,
.danger:focus-visible {
  background: rgba(239, 68, 68, 0.24);
}

.error {
  color: #fecaca;
}

.icon-button {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
}

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 20px;
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
  padding: 16px 14px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(11, 15, 20, 0.6);
  border: 1px solid var(--line);
}

.sidebar-logo,
.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff6a00, #ff9656);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(255, 106, 0, 0.35);
}

.sidebar-brand strong {
  display: block;
  font-size: 14px;
  line-height: 1.1;
}

.sidebar-brand small {
  color: #8da0bf;
  font-size: 11px;
}

.sidebar-menu {
  display: grid;
  align-content: start;
  gap: 8px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #cfdbf3;
  border: 1px solid transparent;
  transition: border-color var(--tr-fast), background var(--tr-fast), color var(--tr-fast), transform var(--tr-fast);
}

.sidebar-item-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
}

.sidebar-item-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-item:hover,
.sidebar-item:focus-visible {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.sidebar-item.active {
  border-color: rgba(255, 106, 0, 0.52);
  background: linear-gradient(140deg, rgba(255, 106, 0, 0.24), rgba(255, 106, 0, 0.08));
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.dashboard-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 14px;
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-radius: 0;
  border: none;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
}

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

.topbar-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: contain;
  flex: 0 0 auto;
}

.topbar-title-wrap {
  display: grid;
  gap: 2px;
  transform: translateY(-2px);
}

.topbar-title-wrap h1 {
  font-size: clamp(18px, 2vw, 26px);
  line-height: 1.05;
  letter-spacing: 0.02em;
}

.topbar-title-wrap span {
  color: #9fb1cf;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.topbar-profile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 260px;
  padding: 7px 10px;
}

.topbar-profile-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 106, 0, 0.8), rgba(255, 150, 86, 0.85));
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 18px rgba(255, 106, 0, 0.28);
  position: relative;
  flex: 0 0 auto;
}

.topbar-profile-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: #fff;
}

.topbar-profile-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 14px;
  height: 8px;
  border-radius: 8px 8px 5px 5px;
  transform: translateX(-50%);
  background: #fff;
}

.topbar-profile-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 10px;
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border-radius: 14px;
  border: 1px solid var(--line);
  color: #c4d1e7;
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  transition: border-color var(--tr-fast), color var(--tr-fast), background var(--tr-fast), box-shadow var(--tr-fast);
}

.tab:hover,
.tab:focus-visible {
  color: #fff;
  border-color: var(--line-strong);
}

.tab.active {
  border-color: rgba(255, 106, 0, 0.5);
  color: var(--primary);
  background: linear-gradient(150deg, rgba(255, 106, 0, 0.2), rgba(255, 106, 0, 0.06));
  box-shadow: var(--shadow-glow);
}

.content {
  display: grid;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.profile-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.profile-field {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}

.profile-field span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.profile-field strong {
  font-size: 18px;
  color: #f8fafc;
  line-height: 1.2;
}

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

.section-head.small {
  margin-bottom: 8px;
}

.inline-form,
.grid.two,
.form-actions,
.calendar-actions {
  display: grid;
  gap: 10px;
}

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

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

.form-actions,
.calendar-actions {
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
}

.entity-form-modal {
  position: fixed;
  z-index: 901;
  left: 50%;
  top: 50%;
  width: min(92vw, 620px);
  max-height: 88vh;
  overflow: auto;
  transform: translate(-50%, -50%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(17, 24, 39, 0.95), rgba(11, 15, 20, 0.94));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  padding: 18px;
  margin: 0;
}

.entity-form-modal.inline-form,
.entity-form-modal .grid.two {
  grid-template-columns: 1fr;
}

.entity-form-modal .form-actions,
.entity-form-modal.inline-form {
  gap: 10px;
}

.delivery-modal {
  z-index: 905;
  width: min(94vw, 700px);
}

.delivery-modal .section-head {
  margin-bottom: 12px;
}

.delivery-modal .stack {
  gap: 10px;
}

.entity-form-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(2, 6, 12, 0.68);
  backdrop-filter: blur(4px);
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color var(--tr-fast), background var(--tr-fast), transform var(--tr-fast);
}

.list-item:hover {
  border-color: rgba(255, 106, 0, 0.34);
  background: rgba(255, 255, 255, 0.05);
}

.list-item h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.list-item p {
  margin: 0;
  color: var(--muted);
}

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

.item-actions .ghost,
.item-actions .danger {
  padding: 6px 10px;
  font-size: 13px;
  min-height: 32px;
}

.client-search-wrap {
  display: grid;
  justify-content: center;
  margin: 4px 0 16px;
}

.client-search-wrap input {
  width: min(100%, 360px);
}

.clients-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: column;
  grid-template-rows: repeat(5, auto);
  align-items: start;
}

.clients-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  color: var(--muted);
}

.clients-pagination button {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.clients-pagination button.active {
  background: rgba(255, 106, 0, 0.2);
  border-color: rgba(255, 106, 0, 0.56);
  color: #fff;
}

.calendar-panel {
  display: grid;
  gap: 14px;
}

.calendar-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.calendar-title-wrap {
  display: grid;
  gap: 6px;
}

.calendar-title-wrap h2 {
  font-size: clamp(24px, 2.4vw, 36px);
  line-height: 1.05;
}

.calendar-title-wrap .muted {
  margin: 0;
  font-size: 17px;
}

.calendar-actions {
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
}

.calendar-arrows {
  display: grid;
  grid-auto-flow: column;
  gap: 8px;
}

.calendar-arrows .ghost {
  width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 20px;
}

.view-switch {
  display: grid;
  grid-auto-flow: column;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.view-btn {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #b8c6df;
  transition: background var(--tr-fast), color var(--tr-fast), box-shadow var(--tr-fast);
}

.view-btn.active {
  color: #fff;
  background: linear-gradient(145deg, rgba(255, 106, 0, 0.3), rgba(255, 106, 0, 0.16));
  box-shadow: 0 0 0 1px rgba(255, 106, 0, 0.45) inset;
}

.calendar-search-label {
  min-width: 220px;
}

.calendar-search-label input {
  min-height: 42px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(180px, 1fr));
  gap: 10px;
}

.calendar-day-tabs {
  display: none;
}

.calendar-column {
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.calendar-head {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 15, 20, 0.45);
}

.calendar-head strong,
.calendar-head span {
  display: block;
}

.calendar-head strong {
  text-transform: capitalize;
  font-size: 17px;
}

.calendar-head span {
  margin-top: 4px;
  color: #9aa9c4;
}

.calendar-body {
  padding: 10px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.route-card,
.add-card {
  border-radius: 12px;
  padding: 10px;
}

.route-card {
  border: 1px solid rgba(255, 106, 0, 0.3);
  background: linear-gradient(160deg, rgba(255, 106, 0, 0.14), rgba(17, 24, 39, 0.82));
  color: var(--text);
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast), transform var(--tr-fast);
}

.route-card:hover,
.route-card:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 106, 0, 0.62);
  box-shadow: 0 12px 26px rgba(255, 106, 0, 0.22);
}

.route-card h4 {
  margin: 0;
  font-size: 16px;
}

.route-card-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 0 0 8px;
}

.route-meta {
  margin: 0;
  color: #c7d4ea;
  font-size: 14px;
}

.route-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #b6c4dc;
}

.route-status {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
}

.route-status.collecting {
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

.route-status.filled {
  background: rgba(251, 191, 36, 0.2);
  color: #fde68a;
}

.route-status.transit {
  background: rgba(34, 197, 94, 0.22);
  color: #bbf7d0;
}

.route-status.completed {
  background: rgba(59, 130, 246, 0.2);
  color: #bfdbfe;
}

.route-card-actions {
  display: none;
  gap: 8px;
  margin-top: 10px;
}

.route-card:hover .route-card-actions,
.route-card:focus-within .route-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.add-card {
  border: 1px dashed rgba(255, 106, 0, 0.65);
  background: rgba(255, 106, 0, 0.08);
  color: #ff9b52;
  width: 100%;
  min-height: 44px;
}

.add-card:hover,
.add-card:focus-visible {
  border-color: rgba(255, 106, 0, 0.9);
  background: rgba(255, 106, 0, 0.14);
}

.route-main-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 720px;
}

.route-workspace-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  padding: 5px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.route-workspace-tab {
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #c3d1e6;
  min-height: 38px;
  padding: 8px 12px;
  font-weight: 600;
  transition: border-color var(--tr-fast), background var(--tr-fast), color var(--tr-fast), box-shadow var(--tr-fast);
}

.route-workspace-tab:hover,
.route-workspace-tab:focus-visible {
  border-color: var(--line-strong);
  color: #fff;
}

.route-workspace-tab.active {
  color: var(--primary);
  border-color: rgba(255, 106, 0, 0.5);
  background: linear-gradient(145deg, rgba(255, 106, 0, 0.2), rgba(255, 106, 0, 0.07));
  box-shadow: var(--shadow-glow);
}

.route-workspace-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.route-pane {
  display: grid;
  gap: 12px;
}

.route-cities-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.route-city-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.add-route-city-button {
  width: 42px;
}

.route-pane .form-actions {
  justify-content: start;
}

#route-deliveries-list {
  max-height: min(64vh, 560px);
  overflow: auto;
  padding-right: 4px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(17, 24, 39, 0.5));
  padding: 14px;
  display: grid;
  gap: 6px;
}

.metric-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.metric-card strong {
  font-size: clamp(22px, 2vw, 34px);
  letter-spacing: 0.01em;
}

.metric-delta {
  font-size: 13px;
  color: #9bb0ce;
}

.metric-delta.success {
  color: #86efac;
}

.metric-delta.danger {
  color: #fca5a5;
}

.list.compact {
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  align-items: stretch;
}

.list.compact .list-item {
  box-shadow: none;
}

.delivery-tile {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 9px;
  display: grid;
  gap: 6px;
  align-content: space-between;
  transition: border-color var(--tr-fast), background var(--tr-fast), box-shadow var(--tr-fast), transform var(--tr-fast);
}

.delivery-tile:not(.add-delivery-tile) {
  cursor: pointer;
}

.delivery-tile:not(.add-delivery-tile):hover,
.delivery-tile:not(.add-delivery-tile):focus-within {
  transform: translateY(-2px);
  border-color: rgba(255, 106, 0, 0.56);
  box-shadow: 0 14px 30px rgba(255, 106, 0, 0.16);
}

.delivery-tile.delivery-status-0 {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
}

.delivery-tile.delivery-status-1 {
  background: rgba(255, 106, 0, 0.1);
  border-color: rgba(255, 106, 0, 0.35);
}

.delivery-tile.delivery-status-2 {
  background: rgba(34, 197, 94, 0.11);
  border-color: rgba(34, 197, 94, 0.4);
}

.add-delivery-tile {
  border: 1px solid rgba(255, 106, 0, 0.45);
  background: rgba(255, 106, 0, 0.18);
  color: #fff;
  justify-items: center;
  align-content: center;
  text-align: center;
}

.add-delivery-tile:hover {
  background: rgba(255, 106, 0, 0.26);
}

.add-delivery-plus {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  font-size: 30px;
  line-height: 1;
}

.delivery-tile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  position: relative;
}

.delivery-tile-head strong,
.delivery-client p,
.delivery-city {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delivery-client p,
.delivery-tile p,
.delivery-tile b {
  margin: 0;
  font-size: 13px;
}

.delivery-tile p {
  color: var(--muted);
}

.delivery-meta {
  display: grid;
  gap: 3px;
}

.delivery-meta span {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.delivery-meta small {
  min-width: 42px;
  color: var(--muted);
  font-size: 11px;
}

.delivery-footer {
  display: grid;
  gap: 4px;
  justify-items: start;
}

.delivery-city {
  color: #ffd3b7;
  font-weight: 700;
}

.order-status-label {
  width: fit-content;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  font-weight: 700;
  font-size: 12px;
}

.client-fields {
  display: grid;
  gap: 2px;
}

.client-suggestions {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.client-suggestion {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 9px 10px;
  color: var(--text);
  text-align: left;
}

.client-suggestion:hover {
  border-color: rgba(255, 106, 0, 0.55);
  background: rgba(255, 106, 0, 0.1);
}

.client-suggestion span {
  color: var(--muted);
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 6, 12, 0.74);
  backdrop-filter: blur(5px);
}

.dialog-box {
  width: min(100%, 420px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(17, 24, 39, 0.96), rgba(11, 15, 20, 0.95));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
  padding: 20px;
}

.dialog-box h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.dialog-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 12, 0.7);
  backdrop-filter: blur(3px);
}

.loading-box {
  display: grid;
  justify-items: center;
  gap: 12px;
  min-width: 150px;
  padding: 18px 22px;
  border-radius: 12px;
  background: #0f172a;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-soft);
  color: var(--text);
  font-weight: 700;
}

.boot-loading-box {
  box-shadow: none;
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1500px) {
  .calendar-grid {
    grid-template-columns: repeat(7, minmax(170px, 1fr));
  }

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

@media (max-width: 1200px) {
  .dashboard-screen {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-template-rows: auto;
    gap: 12px;
  }

  .sidebar-menu {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-content: stretch;
  }

  .sidebar-item {
    justify-content: center;
    text-align: center;
    min-height: 48px;
    padding: 8px;
  }

  .sidebar-item-icon {
    display: none;
  }

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

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

  #route-deliveries-list {
    max-height: none;
  }
}

@media (max-width: 900px) {
  .route-workspace-tabs {
    display: grid;
    width: 100%;
  }

  .route-workspace-tab {
    min-height: 36px;
    padding: 7px 8px;
    font-size: 13px;
  }

  .screen {
    padding: 12px;
  }

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

  .topbar-actions {
    justify-content: space-between;
  }

  .topbar-profile {
    min-width: 0;
    max-width: none;
    justify-content: flex-start;
  }

  .tabs {
    display: flex;
    gap: 8px;
    margin: 0 -4px;
    padding: 0 4px 4px;
    overflow-x: auto;
  }

  .tab {
    flex: 0 0 auto;
    min-width: 132px;
  }

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

  .inline-form,
  .grid.two,
  .clients-list {
    grid-template-columns: 1fr;
    grid-auto-flow: row;
    grid-template-rows: none;
  }

  .list-item {
    display: grid;
  }

  .calendar-top {
    align-items: stretch;
  }

  .calendar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
  }

  .calendar-actions > * {
    width: 100%;
  }

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

  .calendar-grid {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .calendar-day-tabs {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    margin: 0 0 10px;
  }

  .calendar-day-tabs button {
    min-width: 0;
    min-height: 58px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    padding: 6px 4px;
    display: grid;
    justify-items: center;
    gap: 1px;
  }

  .calendar-day-tabs button.active {
    border-color: rgba(255, 106, 0, 0.52);
    background: rgba(255, 106, 0, 0.18);
    color: #fff;
  }

  .calendar-day-tabs span {
    font-size: 11px;
    text-transform: capitalize;
  }

  .calendar-day-tabs strong {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
  }

  .calendar-day-tabs small {
    min-width: 18px;
    border-radius: 999px;
    background: rgba(255, 106, 0, 0.16);
    color: #ffd8bc;
    font-size: 11px;
    line-height: 16px;
  }

  .calendar-column {
    display: none;
    min-height: auto;
  }

  .calendar-column.mobile-active {
    display: flex;
  }

  .calendar-head {
    position: sticky;
    top: 0;
    z-index: 1;
  }

  .route-card,
  .add-card,
  .delivery-tile {
    min-height: auto;
  }

  .route-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .list.compact {
    grid-template-columns: 1fr;
  }

  .route-city-row {
    grid-template-columns: 1fr;
  }

  .item-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .item-actions .ghost,
  .item-actions .danger {
    width: 100%;
    min-height: 40px;
  }

  .entity-form-modal {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
    width: auto;
    max-height: min(88svh, 700px);
    transform: none;
    padding: 14px;
  }
}

@media (max-width: 640px) {
  .sidebar-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .dialog-overlay {
    align-items: end;
    padding: 10px;
  }

  .dialog-box {
    width: 100%;
    padding: 16px;
  }
}

@media (max-width: 380px) {
  .item-actions {
    grid-template-columns: 1fr;
  }

  .tab {
    min-width: 116px;
  }
}
