:root {
  --bg-deep: #0a1628;
  --bg-card: rgba(255, 255, 255, 0.04);
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.18);
  --success: #22c55e;
  --radius: 14px;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-tap-highlight-color: rgba(37, 99, 235, 0.15);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 20%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.bg-glow--1 {
  top: -200px;
  right: -100px;
  background: #1d4ed8;
}

.bg-glow--2 {
  bottom: -250px;
  left: -150px;
  background: #0ea5e9;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.logo-domain {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem 4rem;
  max-width: 720px;
  margin: 0 auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: var(--accent-soft);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 999px;
  font-size: 0.85rem;
  color: #93c5fd;
  margin-bottom: 1.5rem;
}

.badge-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero h1 {
  font-size: clamp(1.75rem, 4.5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.25;
  margin-bottom: 2.5rem;
}

.hero h1 span {
  background: linear-gradient(135deg, #60a5fa, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 520px;
  margin-bottom: 2.5rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem 2rem;
  min-width: 220px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn:focus-visible,
.logo:focus-visible,
.back-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: white;
  box-shadow: 0 12px 32px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 16px 40px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(148, 163, 184, 0.35);
}

.btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: 720px;
  margin-top: 3.5rem;
}

.feature {
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
}

.feature-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.feature h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.feature p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer {
  padding: 1.5rem 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* Placeholder pages */
.placeholder-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.placeholder-card {
  max-width: 480px;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
}

.placeholder-card h1 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.placeholder-card p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.back-link:hover {
  text-decoration: underline;
}

/* Auth / login page */
.page--auth .auth-page {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: calc(100vh - 160px);
  padding: 2rem 1.5rem;
}

.auth-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem 3rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 1.75rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input::placeholder {
  color: rgba(148, 163, 184, 0.6);
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrap input {
  padding-right: 3rem;
}

.password-toggle {
  position: absolute;
  right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.password-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#captcha-canvas {
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.captcha-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.captcha-refresh:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.captcha-refresh svg {
  width: 20px;
  height: 20px;
}

.form-error {
  color: #f87171;
  font-size: 0.9rem;
  text-align: center;
  padding: 0.5rem;
  background: rgba(248, 113, 113, 0.1);
  border-radius: 8px;
}

.btn-full {
  width: 100%;
  min-width: unset;
  margin-top: 0.5rem;
}

.auth-card .back-link {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

/* Client cabinet layout — light theme */
body.cabinet-mode {
  background: #dce9f7;
  color: #1e293b;
}

body.cabinet-mode .bg-grid,
body.cabinet-mode .bg-glow {
  display: none;
}

body.cabinet-mode .cabinet-layout {
  --cabinet-bg: #e5f0fa;
  --cabinet-surface: #ffffff;
  --cabinet-text: #1e293b;
  --cabinet-muted: #4a5d78;
  --cabinet-border: #b8d4f0;
  --cabinet-hover: #d6e8f8;
}

.cabinet-layout {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  background: var(--cabinet-bg, transparent);
}

#app {
  position: relative;
  z-index: 2;
  min-height: 100vh;
}

.cabinet-topbar__left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 42px;
  padding: 0 1rem;
  background: #2563eb;
  border: 1px solid #1d4ed8;
  border-radius: 10px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s, border-color 0.2s;
}

.menu-toggle:hover {
  background: #1d4ed8;
  border-color: #1e40af;
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.menu-toggle__label {
  line-height: 1;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 200;
  backdrop-filter: blur(2px);
}

.cabinet-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  max-width: 88vw;
  height: 100vh;
  background: #ffffff;
  border-right: 1px solid var(--cabinet-border, var(--border));
  box-shadow: 8px 0 32px rgba(37, 99, 235, 0.15);
  z-index: 201;
  transform: translateX(-105%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
}

.cabinet-drawer.is-open {
  transform: translateX(0);
}

.cabinet-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem 1rem 1.25rem;
  border-bottom: 1px solid var(--cabinet-border, var(--border));
  background: #edf4fc;
}

.cabinet-drawer__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1d4ed8;
}

.drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
}

.drawer-close:hover {
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}

.cabinet-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  overflow-y: auto;
}

.cabinet-nav__divider {
  height: 1px;
  background: var(--cabinet-border, var(--border));
  margin: 0.5rem 0;
}

.cabinet-nav__item--btn {
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.user-dropdown {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem 0.45rem 0.45rem;
  background: #ffffff;
  border: 1px solid var(--cabinet-border, var(--border));
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.user-menu-btn:hover,
.user-menu-btn[aria-expanded="true"] {
  background: #eef4fb;
  border-color: #93c5fd;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
}

.user-menu-btn__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.user-menu-btn__text {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-btn__arrow {
  width: 16px;
  height: 16px;
  color: #64748b;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: #ffffff;
  border: 1px solid var(--cabinet-border, var(--border));
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.15);
  z-index: 150;
  overflow: hidden;
}

.dropdown-menu__header {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
  background: #edf4fc;
  border-bottom: 1px solid var(--cabinet-border, var(--border));
}

.dropdown-menu__header strong {
  font-size: 0.95rem;
  color: #1e293b;
}

.dropdown-menu__header span {
  font-size: 0.8rem;
  color: #64748b;
}

.dropdown-menu__item {
  display: block;
  width: 100%;
  padding: 0.85rem 1rem;
  color: #334155;
  text-decoration: none;
  text-align: left;
  border: none;
  background: none;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-menu__item:hover {
  background: #eef4fb;
  color: #1d4ed8;
}

.dropdown-menu__item--btn {
  border-top: 1px solid var(--cabinet-border, var(--border));
}

body.drawer-open {
  overflow: hidden;
}

@media (min-width: 992px) {
  .menu-toggle,
  .drawer-close {
    display: none !important;
  }

  .drawer-overlay {
    display: none !important;
  }

  .cabinet-drawer {
    position: static;
    transform: none !important;
    width: 260px;
    max-width: none;
    height: auto;
    min-height: 100vh;
    flex-shrink: 0;
    box-shadow: 2px 0 12px rgba(37, 99, 235, 0.08);
    z-index: 1;
  }

  body.drawer-open {
    overflow: auto;
  }
}

.cabinet-sidebar {
  width: 300px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid #b8d4f0;
  padding: 0;
  box-shadow: 2px 0 16px rgba(37, 99, 235, 0.08);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.cabinet-sidebar__title {
  padding: 1.25rem 1.25rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: #1d4ed8;
  border-bottom: 1px solid #b8d4f0;
  background: #edf4fc;
}

.cabinet-nav__section-title {
  padding: 1rem 1rem 0.35rem;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cabinet-nav__item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 44px;
  padding: 0.75rem 0.9rem;
  color: var(--cabinet-muted, var(--text-muted));
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.cabinet-nav__item:hover {
  background: var(--cabinet-hover, rgba(255, 255, 255, 0.06));
  color: var(--cabinet-text, var(--text));
}

.cabinet-nav__item.is-active {
  background: #e8f2ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.cabinet-nav__item.is-disabled {
  color: #94a3b8;
  cursor: default;
  opacity: 0.75;
}

.cabinet-nav__item.is-disabled:hover {
  background: transparent;
  color: #94a3b8;
}

.cabinet-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--cabinet-border, var(--border));
  background: #edf4fc;
  box-shadow: 0 1px 8px rgba(37, 99, 235, 0.08);
}

body.cabinet-mode .logo {
  color: var(--cabinet-text);
}

body.cabinet-mode .logo-domain {
  color: var(--cabinet-muted);
}

.cabinet-user {
  color: var(--cabinet-muted, var(--text-muted));
  font-size: 0.9rem;
}

.cabinet-content {
  flex: 1;
  padding: 2rem;
  overflow-x: auto;
  background: linear-gradient(180deg, #e5f0fa 0%, #d4e6f7 100%);
}

.cabinet-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--cabinet-text, inherit);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--cabinet-border, var(--border));
  border-radius: var(--radius);
  background: var(--cabinet-surface, var(--bg-card));
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.06);
}

.dispatch-panel {
  background: #ffffff;
  border: 1px solid var(--cabinet-border, var(--border));
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.06);
  overflow: hidden;
}

.dispatch-panel__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--cabinet-border, var(--border));
  background: #ffffff;
}

.dispatch-panel__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--cabinet-text, inherit);
}

.dispatch-panel__meta {
  margin-top: 0.1rem;
  color: var(--cabinet-muted, var(--text-muted));
  font-size: 0.85rem;
}

.dispatch-panel__controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dispatch-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.35rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.85rem;
}

.dispatch-search select,
.dispatch-search input {
  border: none;
  outline: none;
  background: transparent;
  color: #1e293b;
  font: inherit;
}

.dispatch-search select {
  color: #2563eb;
  font-weight: 600;
}

.dispatch-search input {
  min-width: 180px;
}

.dispatch-export-btn {
  min-height: 42px;
  padding: 0 1rem;
  border: none;
  border-radius: 10px;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, box-shadow 0.2s;
}

.dispatch-export-btn:hover {
  background: #1d4ed8;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.22);
}

.dispatch-table-wrap {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

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

.dispatch-table th:nth-child(1),
.dispatch-table th:nth-child(2),
.dispatch-table td:nth-child(1),
.dispatch-table td:nth-child(2) {
  width: 1%;
  white-space: nowrap;
}

.dispatch-table th:nth-child(6),
.dispatch-table th:nth-child(7),
.dispatch-table th:nth-child(8),
.dispatch-table td:nth-child(6),
.dispatch-table td:nth-child(7),
.dispatch-table td:nth-child(8) {
  text-align: right;
  white-space: nowrap;
}

.dispatch-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dispatch-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: #eaf2ff;
  color: #2563eb;
  cursor: pointer;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px #bfdbfe;
  transition: transform 0.16s, background 0.16s, color 0.16s, box-shadow 0.16s;
}

.dispatch-icon-btn:hover,
.dispatch-icon-btn:focus-visible {
  background: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(29, 78, 216, 0.24);
  outline: none;
  transform: translateY(-1px);
}

.dispatch-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  pointer-events: none;
}

.dispatch-card-list {
  display: none;
}

.dispatch-empty--cards {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--cabinet-muted, var(--text-muted));
}

.dispatch-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1rem;
  border-bottom: 1px solid var(--cabinet-border, #b8d4f0);
  background: #ffffff;
}

.dispatch-card:last-child {
  border-bottom: none;
}

.dispatch-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.dispatch-card__id {
  display: inline-block;
  color: #1d4ed8;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  word-break: break-all;
}

.dispatch-card__id:hover {
  text-decoration: underline;
}

.dispatch-card__meta {
  margin-top: 0.25rem;
  color: var(--cabinet-muted, #4a5d78);
  font-size: 0.82rem;
}

.dispatch-card__route {
  display: grid;
  gap: 0.75rem;
}

.dispatch-card__point {
  display: grid;
  gap: 0.2rem;
}

.dispatch-card__label {
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.dispatch-card__value {
  color: #1e293b;
  font-size: 0.95rem;
  line-height: 1.4;
  word-break: break-word;
}

.dispatch-card__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.dispatch-card__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 42px;
  padding: 0.55rem 0.7rem;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eaf2ff;
  color: #1d4ed8;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.dispatch-card__action svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

.dispatch-card__action:nth-child(2) {
  background: #eefdf5;
  border-color: #bbf7d0;
  color: #15803d;
}

.dispatch-card__action:nth-child(3) {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

.dispatch-card__action:nth-child(4) {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

.dispatch-card__action--print,
.dispatch-card__action:nth-child(5) {
  grid-column: 1 / -1;
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}

.dispatch-icon-btn:nth-child(2) {
  background: #eefdf5;
  color: #15803d;
  box-shadow: inset 0 0 0 1px #bbf7d0;
}

.dispatch-icon-btn:nth-child(2):hover,
.dispatch-icon-btn:nth-child(2):focus-visible {
  background: #15803d;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(21, 128, 61, 0.22);
}

.dispatch-icon-btn:nth-child(3) {
  background: #f8fafc;
  color: #475569;
  box-shadow: inset 0 0 0 1px #cbd5e1;
}

.dispatch-icon-btn:nth-child(3):hover,
.dispatch-icon-btn:nth-child(3):focus-visible {
  background: #475569;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(71, 85, 105, 0.2);
}

.dispatch-icon-btn:nth-child(5) {
  background: #fff7ed;
  color: #c2410c;
  box-shadow: inset 0 0 0 1px #fdba74;
}

.dispatch-icon-btn:nth-child(5):hover,
.dispatch-icon-btn:nth-child(5):focus-visible {
  background: #c2410c;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(194, 65, 12, 0.22);
}

.dispatch-row-check {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
}

.text-break-word {
  min-width: 220px;
  max-width: 340px;
  white-space: normal;
  word-break: break-word;
}

.dispatch-empty {
  padding: 2rem !important;
  text-align: center !important;
  color: var(--cabinet-muted, var(--text-muted));
}

.dispatch-create {
  display: flex;
  flex-direction: column;
  max-width: 980px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid var(--cabinet-border, var(--border));
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.06);
  overflow: hidden;
}

.dispatch-stepper__header {
  padding: 1rem 1.25rem;
  background: #2563eb;
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 700;
}

.dispatch-create__section {
  background: #ffffff;
  border: 1px solid var(--cabinet-border, var(--border));
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.06);
  overflow: hidden;
}

.dispatch-create__section-head {
  padding: 1rem 1.25rem;
  background: #edf4fc;
  border-bottom: 1px solid var(--cabinet-border, var(--border));
}

.dispatch-create__section-head h3 {
  font-size: 1rem;
  color: #1d4ed8;
}

.dispatch-create__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
}

.dispatch-step {
  position: relative;
  padding-left: 4rem;
}

.dispatch-step::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2rem;
  width: 2px;
  background: #cfe0f4;
}

.dispatch-step:last-of-type::before {
  bottom: 2rem;
}

.dispatch-step__tab {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 1rem 1.25rem 0.75rem 0;
}

.dispatch-step__dot {
  position: absolute;
  left: -2.95rem;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #cfe0f4;
  color: #64748b;
  font-size: 1rem;
}

.dispatch-step.is-active .dispatch-step__dot {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.dispatch-step__title {
  color: #1e293b;
  font-weight: 700;
}

.dispatch-step__content {
  padding: 0 1.25rem 1rem 0;
}

.dispatch-step:not(.is-active) .dispatch-step__content {
  padding-bottom: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

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

.field--street {
  grid-column: 1 / -1;
}

.field-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0.5rem;
}

.field-row--dims {
  grid-template-columns: 1fr auto 1fr auto 1fr auto minmax(90px, 1fr);
  align-items: center;
}

.field-row--dims input[name="volumetricWeight"] {
  background: #eef2ff;
  color: #1e293b;
  font-weight: 700;
  cursor: default;
}

.field-dims-sep {
  color: #64748b;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0 0.2rem;
  user-select: none;
}

.field span {
  color: var(--cabinet-muted, var(--text-muted));
  font-size: 0.86rem;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 0.75rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #1e293b;
  font: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input[name="weight"],
.field input[name="length"],
.field input[name="width"],
.field input[name="height"],
.field input[name="volumetricWeight"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.field input[name="weight"]::-webkit-outer-spin-button,
.field input[name="weight"]::-webkit-inner-spin-button,
.field input[name="length"]::-webkit-outer-spin-button,
.field input[name="length"]::-webkit-inner-spin-button,
.field input[name="width"]::-webkit-outer-spin-button,
.field input[name="width"]::-webkit-inner-spin-button,
.field input[name="height"]::-webkit-outer-spin-button,
.field input[name="height"]::-webkit-inner-spin-button,
.field input[name="volumetricWeight"]::-webkit-outer-spin-button,
.field input[name="volumetricWeight"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field textarea {
  min-height: 86px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.dispatch-create__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1.25rem;
  border-top: 1px solid var(--cabinet-border, var(--border));
  background: #f8fafc;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.55);
}

.modal-card {
  width: min(520px, 100%);
  padding: 1.5rem;
  border: 1px solid var(--cabinet-border, var(--border));
  border-radius: 18px;
  background: var(--cabinet-surface, #ffffff);
  color: var(--cabinet-text, #0f172a);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
}

.modal-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.modal-card__header h3 {
  margin: 0;
  color: var(--cabinet-text, #0f172a);
}

.modal-card__close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--cabinet-border, var(--border));
  border-radius: 999px;
  background: #f8fafc;
  color: var(--cabinet-text, #0f172a);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}

.courier-time-range {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.courier-time-range input[type="time"] {
  flex: 1 1 7rem;
  min-width: 7rem;
}

.courier-time-range__sep {
  color: var(--cabinet-muted, var(--text-muted));
  font-size: 0.9rem;
  white-space: nowrap;
}

.cabinet-table th,
.cabinet-table td {
  padding: 0.9rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--cabinet-border, var(--border));
  color: var(--cabinet-text, inherit);
}

.cabinet-table th {
  color: var(--cabinet-muted, var(--text-muted));
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #d6e8f8;
}

.cabinet-table tr:hover td {
  background: var(--cabinet-hover, rgba(255, 255, 255, 0.03));
}

body.cabinet-mode .link {
  color: #2563eb;
}

/* Уникальный цвет для каждого статуса накладной */
.status-created {
  background: #f1f5f9;
  color: #475569;
}

.status-awaiting,
.status-confirmation {
  background: #fef3c7;
  color: #b45309;
}

.status-confirmed {
  background: #dcfce7;
  color: #15803d;
}

.status-to-courier {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-courier-confirmed {
  background: #e0e7ff;
  color: #4338ca;
}

.status-picked-up {
  background: #cffafe;
  color: #0e7490;
}

.status-in-work {
  background: #ffedd5;
  color: #c2410c;
}

.status-transit {
  background: #e0f2fe;
  color: #0369a1;
}

.status-warehouse {
  background: #f3e8ff;
  color: #7e22ce;
}

.status-done {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.detail-card {
  padding: 1.5rem;
  background: var(--cabinet-surface, var(--bg-card));
  border: 1px solid var(--cabinet-border, var(--border));
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.detail-card h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: #2563eb;
}

.detail-card dt {
  font-size: 0.8rem;
  color: var(--cabinet-muted, var(--text-muted));
}

.detail-card dd {
  font-weight: 500;
  color: var(--cabinet-text, inherit);
}

.hint-text {
  color: var(--cabinet-muted, var(--text-muted));
  margin-bottom: 1rem;
}

.track-link {
  display: block;
  padding: 0.85rem 1rem;
  background: var(--cabinet-surface, var(--bg-card));
  border: 1px solid var(--cabinet-border, var(--border));
  border-radius: 10px;
  color: var(--cabinet-text, var(--text));
  text-decoration: none;
  transition: background 0.2s;
}

.track-link:hover {
  background: var(--cabinet-hover, rgba(255, 255, 255, 0.06));
}

.track-search-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 1rem;
  align-items: end;
  padding: 1.25rem;
  border-top: 1px solid var(--cabinet-border, var(--border));
  border-bottom: 1px solid var(--cabinet-border, var(--border));
  background: #f8fafc;
}

.track-result-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
  background: var(--cabinet-surface, #fff);
}

.track-result-card > div {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.timeline-item {
  position: relative;
  padding-left: 2rem;
  padding-bottom: 1.5rem;
  border-left: 2px solid var(--cabinet-border, var(--border));
}

.timeline-date,
.timeline-place {
  color: var(--cabinet-muted, var(--text-muted));
}

.timeline-receiver {
  display: inline-block;
  margin-top: 0.2rem;
  color: #0f172a;
  font-weight: 600;
}

.timeline-status {
  font-weight: 600;
  margin: 0.2rem 0;
  color: var(--cabinet-text, inherit);
}

.timeline-status--done {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.track-result-card .status-badge.status-done,
.track-panel .status-badge.status-done {
  background: #fef3c7 !important;
  border: 1px solid #fcd34d;
  color: #92400e !important;
}

body.cabinet-mode .btn-secondary {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
}

body.cabinet-mode .btn-secondary:hover {
  background: #eef4fb;
  border-color: #93c5fd;
}

body.cabinet-mode .footer {
  color: var(--cabinet-muted);
  border-top-color: var(--cabinet-border);
  background: #edf4fc;
}

body.cabinet-mode .back-link {
  color: #2563eb;
}

.cabinet-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 1rem;
}

.cabinet-nav__icon {
  font-size: 1.1rem;
}

.cabinet-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cabinet-topbar__right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  min-width: unset;
  font-size: 0.85rem;
}

.cabinet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.cabinet-table tr:last-child td {
  border-bottom: none;
}

.link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.link:hover {
  text-decoration: underline;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.actions-cell {
  white-space: nowrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.detail-card dl {
  display: grid;
  gap: 0.75rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.empty-msg {
  color: #f87171;
  margin-bottom: 1rem;
}

.track-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.timeline {
  margin: 1.5rem 0;
  padding-left: 1rem;
}

.timeline-item.is-last {
  border-left-color: transparent;
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline-item.is-last .timeline-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

.timeline-date {
  font-size: 0.85rem;
}

.timeline-place {
  font-size: 0.9rem;
}

.profile-card {
  max-width: 480px;
}

@media (max-width: 991px) {
  .cabinet-layout {
    display: block;
  }

  .cabinet-topbar {
    padding: 0.85rem 1rem;
    gap: 0.75rem;
  }

  .cabinet-topbar__left {
    gap: 0.6rem;
    min-width: 0;
  }

  .cabinet-topbar__left .logo {
    font-size: 1rem;
  }

  .cabinet-content {
    padding: 1rem;
  }

  .cabinet-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }

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

  .dispatch-panel__controls {
    width: 100%;
  }

  .dispatch-search {
    flex: 1;
    min-width: 0;
  }

  .dispatch-search input {
    min-width: 0;
    width: 100%;
  }

  .dispatch-create__grid {
    grid-template-columns: 1fr;
  }

  .dispatch-step {
    padding-left: 3.25rem;
  }

  .dispatch-step::before {
    left: 1.35rem;
  }

  .dispatch-step__dot {
    left: -2.35rem;
    width: 36px;
    height: 36px;
  }

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

  .track-result-card {
    grid-template-columns: 1fr 1fr;
  }

  .modal-backdrop {
    padding: 1rem;
    align-items: flex-end;
  }

  .modal-card {
    width: 100%;
    border-radius: 18px 18px 12px 12px;
  }

  .detail-actions,
  .dispatch-create__actions {
    flex-direction: column;
  }

  .detail-actions .btn,
  .dispatch-create__actions .btn {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .dispatch-table-wrap--desktop {
    display: none;
  }

  .dispatch-card-list {
    display: block;
  }

  .dispatch-search {
    width: 100%;
  }

  .dispatch-search__label {
    flex-shrink: 0;
  }

  .dispatch-export-btn {
    width: 100%;
  }

  /* Card layout for all cabinet tables on phones/tablets */
  .cabinet-table thead {
    display: none;
  }

  .cabinet-table tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid var(--cabinet-border, var(--border));
    border-radius: 10px;
    padding: 0.5rem;
    background: #ffffff;
  }

  .cabinet-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .cabinet-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    border-bottom: 1px solid var(--cabinet-border, var(--border));
    padding: 0.65rem 0.5rem;
    word-break: break-word;
  }

  .cabinet-table td::before {
    content: attr(data-label);
    color: var(--cabinet-muted, var(--text-muted));
    font-weight: 600;
    flex: 0 0 42%;
    max-width: 42%;
  }

  .cabinet-table td:last-child {
    border-bottom: none;
  }

  .cabinet-table td:not([data-label])::before,
  .cabinet-table td[data-label=""]::before {
    content: none;
    display: none;
  }

  .cabinet-table .dispatch-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .table-wrap:not(.dispatch-table-wrap--desktop) {
    border: none;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .dispatch-icon-btn {
    width: 44px;
    height: 44px;
  }

  .field input,
  .field select,
  .field textarea,
  .auth-form input,
  .form-group input,
  .system-status-select,
  .system-bulk-bar__status select {
    font-size: 16px; /* prevent iOS zoom on focus */
  }

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

  .field-row--dims {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
  }

  .field-row--dims .field-dims-sep {
    display: none;
  }

  .field-row--dims input[name="volumetricWeight"] {
    grid-column: 1 / -1;
  }

  .user-menu-btn__text,
  .user-menu-btn__arrow {
    display: none;
  }

  .user-menu-btn {
    padding: 0.35rem;
    min-width: 44px;
    min-height: 44px;
  }

  .menu-toggle__label {
    display: none;
  }

  .menu-toggle {
    width: 44px;
    height: 44px;
    padding: 0;
  }

  .cabinet-drawer {
    width: min(320px, 88vw);
  }

  .page,
  .cabinet-layout,
  .cabinet-content {
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
  }

  .cabinet-topbar {
    padding-top: max(0.85rem, env(safe-area-inset-top, 0px));
  }

  .auth-page {
    padding: 1rem;
    width: 100%;
  }

  .auth-card {
    width: 100%;
    max-width: 420px;
  }
}

@media (max-width: 540px) {
  .header {
    padding: 1rem;
  }

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

  .btn {
    min-width: unset;
    width: 100%;
  }

  .track-result-card {
    grid-template-columns: 1fr;
  }

  .dispatch-step {
    padding-left: 2.75rem;
  }

  .dispatch-step::before {
    left: 1.1rem;
  }

  .dispatch-step__dot {
    left: -2.05rem;
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .dispatch-stepper__header,
  .dispatch-step__content,
  .dispatch-create__actions {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .cabinet-title {
    font-size: 1.15rem;
  }

  .login-card,
  .auth-card {
    margin: 0 auto;
  }

  .field-row--dims {
    grid-template-columns: 1fr;
  }

  .password-toggle {
    min-width: 44px;
    min-height: 44px;
  }

  .captcha-row {
    flex-wrap: wrap;
  }

  .modal-backdrop {
    padding: 0.5rem;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
  }

  .modal-card {
    max-height: min(92vh, 100dvh);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Tablet landscape / small laptops: keep usable content width */
@media (min-width: 769px) and (max-width: 1100px) {
  .cabinet-content {
    padding: 1.25rem;
  }

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

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
