/* Ket Logistic — unified dark-blue theme */

:root {
  --ket-bg: #f0f4f8;
  --ket-bg-deep: #e4eaf1;
  --ket-surface: rgba(255, 255, 255, 0.96);
  --ket-surface-solid: #ffffff;
  --ket-border: rgba(30, 58, 95, 0.09);
  --ket-text: #0f1c2e;
  --ket-muted: #5b6b80;
  --ket-accent: #2563eb;
  --ket-accent2: #3b82f6;
  --ket-accent-soft: rgba(37, 99, 235, 0.10);
  --ket-accent-hover: rgba(37, 99, 235, 0.16);
  --ket-gradient: linear-gradient(135deg, #0f2847 0%, #1e3a5f 40%, #1a4b8c 100%);
  /* Сайдбар: светлые тона в духе основной панели */
  --ket-sidebar-bg: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 50%, #eef2ff 100%);
  --ket-sidebar-active: rgba(37, 99, 235, 0.12);
  --ket-sidebar-active-border: rgba(37, 99, 235, 0.22);
  --ket-sidebar-ico-bg: rgba(37, 99, 235, 0.1);
  --ket-sidebar-ico-bg-hover: rgba(37, 99, 235, 0.18);
  --ket-shadow: 0 20px 60px rgba(15, 28, 46, 0.10), 0 4px 16px rgba(15, 28, 46, 0.06);
  --ket-shadow-soft: 0 8px 28px rgba(15, 28, 46, 0.07);
  --ket-radius: 18px;
  --ket-radius-sm: 12px;
  --ket-font: "DM Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--ket-font);
  color: var(--ket-text);
  background: var(--ket-bg);
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════
   LOGIN PAGE — логистика: карта, рейсы, маршруты
   ══════════════════════════════════════ */

@keyframes loginFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33%      { transform: translateY(-14px) rotate(1.5deg); }
  66%      { transform: translateY(10px) rotate(-1deg); }
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes loginGlow {
  0%, 100% { box-shadow: 0 24px 56px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.8); }
  50%      { box-shadow: 0 28px 64px rgba(37, 99, 235, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.95); }
}

@keyframes loginOrb {
  0%   { transform: translate(0, 0) scale(1); }
  25%  { transform: translate(50px, -35px) scale(1.08); }
  50%  { transform: translate(-25px, -70px) scale(0.96); }
  75%  { transform: translate(35px, 25px) scale(1.04); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes loginShine {
  0%   { left: -100%; }
  100% { left: 200%; }
}

@keyframes loginMapDrift {
  0%   { transform: rotate(-6deg) scale(1.15) translate(0, 0); }
  50%  { transform: rotate(-6deg) scale(1.15) translate(-24px, -18px); }
  100% { transform: rotate(-6deg) scale(1.15) translate(0, 0); }
}

@keyframes loginRouteDash {
  to { stroke-dashoffset: -400; }
}

@keyframes loginPlaneFly1 {
  0%   { transform: translate(-8vw, 78vh) rotate(-18deg) scale(1); opacity: 0.88; }
  15%  { opacity: 1; }
  100% { transform: translate(92vw, -8vh) rotate(-18deg) scale(1.05); opacity: 0.88; }
}

@keyframes loginPlaneFly2 {
  0%   { transform: translate(102vw, 8vh) rotate(168deg) scale(0.88); opacity: 0.78; }
  18%  { opacity: 1; }
  100% { transform: translate(-10vw, 90vh) rotate(168deg) scale(0.88); opacity: 0.78; }
}

@keyframes loginPlaneFly3 {
  0%   { transform: translate(-12vw, 42vh) rotate(-10deg) scale(0.72); opacity: 0.82; }
  100% { transform: translate(90vw, 12vh) rotate(-10deg) scale(0.72); opacity: 0.82; }
}

@keyframes loginPlaneFly4 {
  0%   { transform: translate(96vw, 62vh) rotate(-172deg) scale(0.62); opacity: 0.8; }
  100% { transform: translate(-8vw, 28vh) rotate(-172deg) scale(0.62); opacity: 0.8; }
}

@keyframes loginParcelFloat {
  0%, 100% { transform: translateY(0) rotate(var(--pr, 0deg)) scale(1); }
  50%      { transform: translateY(-18px) rotate(calc(var(--pr, 0deg) + 4deg)) scale(1.03); }
}

@keyframes loginCourierDrive {
  0%   { transform: translateX(-8%) translateY(0); }
  50%  { transform: translateX(4%) translateY(-4px); }
  100% { transform: translateX(-8%) translateY(0); }
}

@keyframes loginCourierDriveB {
  0%   { transform: translateX(10%) translateY(0); }
  50%  { transform: translateX(-6%) translateY(-3px); }
  100% { transform: translateX(10%) translateY(0); }
}

@keyframes loginCourierDriveC {
  0%   { transform: translateX(-14%) translateY(2px); }
  50%  { transform: translateX(8%) translateY(-5px); }
  100% { transform: translateX(-14%) translateY(2px); }
}

@keyframes loginKzMeshDash {
  to { stroke-dashoffset: -220; }
}

@keyframes loginKzDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.28); opacity: 0.88; }
}

@keyframes loginPinPulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50%      { transform: scale(1.35); opacity: 0.35; }
}

@keyframes loginMapPulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.55; }
}

body.page-login {
  color: var(--ket-text);
}

.page-login {
  background:
    radial-gradient(ellipse 90% 70% at 50% -5%, rgba(191, 219, 254, 0.45) 0%, transparent 52%),
    radial-gradient(ellipse 60% 45% at 100% 90%, rgba(254, 215, 170, 0.35) 0%, transparent 48%),
    radial-gradient(ellipse 55% 40% at 0% 75%, rgba(204, 251, 241, 0.5) 0%, transparent 50%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 45%, #eef2ff 100%);
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.login-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-map-grid {
  position: absolute;
  inset: -15%;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.14) 1px, transparent 1px);
  background-size: 56px 56px;
  animation: loginMapDrift 45s ease-in-out infinite;
  opacity: 0.85;
}

.login-map-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
  animation: loginMapPulse 8s ease-in-out infinite;
}

.login-kz-svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0.92;
  pointer-events: none;
}

.login-kz-outline {
  filter: drop-shadow(0 0 24px rgba(59, 130, 246, 0.08));
}

.login-kz-route--mesh {
  stroke-dashoffset: 0;
  animation: loginKzMeshDash 26s linear infinite;
}

.login-kz-svg .login-kz-dot {
  transform-box: fill-box;
  transform-origin: center;
  animation: loginKzDotPulse 2.9s ease-in-out infinite;
}

.login-kz-svg g.login-kz-city:nth-of-type(2) .login-kz-dot { animation-delay: 0.4s; }
.login-kz-svg g.login-kz-city:nth-of-type(3) .login-kz-dot { animation-delay: 0.8s; }
.login-kz-svg g.login-kz-city:nth-of-type(4) .login-kz-dot { animation-delay: 1.2s; }
.login-kz-svg g.login-kz-city:nth-of-type(5) .login-kz-dot { animation-delay: 0.2s; }
.login-kz-svg g.login-kz-city:nth-of-type(6) .login-kz-dot { animation-delay: 1.6s; }
.login-kz-svg g.login-kz-city:nth-of-type(7) .login-kz-dot { animation-delay: 0.6s; }

.login-route-svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0.72;
}

.login-route-path {
  stroke-dashoffset: 0;
  animation: loginRouteDash 28s linear infinite;
}

.login-route-path--2 {
  animation-duration: 22s;
  animation-direction: reverse;
  opacity: 0.6;
}

.login-plane {
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  color: #ea580c;
  filter: drop-shadow(0 2px 8px rgba(234, 88, 12, 0.45)) drop-shadow(0 0 12px rgba(251, 146, 60, 0.5));
}

.login-plane--1 {
  animation: loginPlaneFly1 20s linear infinite;
}

.login-plane--2 {
  width: 32px;
  height: 32px;
  color: #c2410c;
  animation: loginPlaneFly2 27s linear infinite;
  animation-delay: -7s;
  filter: drop-shadow(0 2px 6px rgba(194, 65, 12, 0.4)) drop-shadow(0 0 10px rgba(251, 146, 60, 0.45));
}

.login-plane--3 {
  width: 28px;
  height: 28px;
  color: #f97316;
  animation: loginPlaneFly3 17s linear infinite;
  animation-delay: -4s;
}

.login-plane--4 {
  width: 24px;
  height: 24px;
  color: #ea580c;
  opacity: 0.95;
  animation: loginPlaneFly4 23s linear infinite;
  animation-delay: -12s;
}

.login-plane svg {
  width: 100%;
  height: 100%;
  display: block;
}

.login-parcel {
  position: absolute;
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.95);
  color: #2563eb;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  --pr: -6deg;
  animation: loginParcelFloat 5s ease-in-out infinite;
}

.login-parcel--2 {
  color: #0d9488;
  border-color: rgba(45, 212, 191, 0.45);
}

.login-parcel--3 {
  color: #7c3aed;
  border-color: rgba(167, 139, 250, 0.5);
}

.login-parcel svg {
  width: 100%;
  height: 100%;
  display: block;
}

.login-parcel--1 {
  top: 18%;
  left: 8%;
  animation-delay: 0s;
  animation-duration: 7s;
}

.login-parcel--2 {
  top: 52%;
  right: 8%;
  --pr: 8deg;
  animation-delay: -2s;
  animation-duration: 6s;
}

.login-parcel--3 {
  bottom: 22%;
  left: 18%;
  --pr: 3deg;
  animation-delay: -4s;
  animation-duration: 8s;
}

.login-courier {
  position: absolute;
  width: 50px;
  height: 50px;
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.18), rgba(52, 211, 153, 0.12));
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #047857;
  box-shadow: 0 12px 32px rgba(16, 185, 129, 0.2);
}

.login-courier--1 {
  bottom: 9%;
  left: 4%;
  right: auto;
  animation: loginCourierDrive 11s ease-in-out infinite;
}

.login-courier--2 {
  bottom: 7%;
  right: 5%;
  left: auto;
  width: 46px;
  height: 46px;
  color: #0369a1;
  background: linear-gradient(145deg, rgba(14, 165, 233, 0.2), rgba(56, 189, 248, 0.12));
  border-color: rgba(14, 165, 233, 0.4);
  box-shadow: 0 10px 28px rgba(14, 165, 233, 0.18);
  animation: loginCourierDriveB 13s ease-in-out infinite;
  animation-delay: -3s;
}

.login-courier--3 {
  bottom: 12%;
  left: 38%;
  right: auto;
  width: 44px;
  height: 44px;
  animation: loginCourierDriveC 9.5s ease-in-out infinite;
  animation-delay: -1.5s;
}

.login-courier--4 {
  bottom: 15%;
  right: 22%;
  left: auto;
  width: 48px;
  height: 48px;
  color: #0f766e;
  background: linear-gradient(145deg, rgba(13, 148, 136, 0.22), rgba(45, 212, 191, 0.12));
  border-color: rgba(13, 148, 136, 0.38);
  animation: loginCourierDrive 12s ease-in-out infinite;
  animation-delay: -6s;
}

.login-courier--5 {
  bottom: 6%;
  left: 52%;
  right: auto;
  width: 42px;
  height: 42px;
  color: #1d4ed8;
  background: linear-gradient(145deg, rgba(37, 99, 235, 0.18), rgba(96, 165, 250, 0.1));
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.15);
  animation: loginCourierDriveB 10s ease-in-out infinite;
  animation-delay: -8s;
}

.login-courier svg {
  width: 100%;
  height: 100%;
  display: block;
}

.login-pin {
  position: absolute;
  width: 28px;
  height: 28px;
  top: 42%;
  left: 22%;
}

.login-pin--2 {
  top: 28%;
  right: 28%;
  left: auto;
}

.login-pin-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: #059669;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.35), 0 4px 14px rgba(5, 150, 105, 0.4);
  z-index: 1;
}

.login-pin--2 .login-pin-dot {
  background: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.35), 0 4px 14px rgba(124, 58, 237, 0.45);
}

.login-pin-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 2px solid rgba(5, 150, 105, 0.35);
  animation: loginPinPulse 2.4s ease-out infinite;
}

.login-pin--2 .login-pin-ring {
  border-color: rgba(124, 58, 237, 0.4);
}

.login-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  opacity: 0.42;
  z-index: 0;
}

.login-bg-orb--1 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(147, 197, 253, 0.9) 0%, transparent 72%);
  top: -12%; left: -8%;
  animation: loginOrb 22s ease-in-out infinite;
}

.login-bg-orb--2 {
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(253, 230, 138, 0.85) 0%, transparent 72%);
  bottom: -8%; right: -6%;
  animation: loginOrb 20s ease-in-out infinite reverse;
}

.login-bg-orb--3 {
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(196, 181, 253, 0.75) 0%, transparent 72%);
  top: 45%; left: 55%;
  animation: loginOrb 18s ease-in-out infinite 4s;
}

.login-backdrop {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  box-shadow:
    0 24px 56px rgba(15, 23, 42, 0.08),
    0 0 0 1px rgba(226, 232, 240, 0.8);
  padding: 2.75rem 2.25rem 2.5rem;
  text-align: center;
  animation: loginCardIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) both, loginGlow 5s ease-in-out infinite 0.75s;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  border-radius: 18px;
  background: linear-gradient(135deg, #2563eb 0%, #6366f1 100%);
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.3);
  animation: loginFloat 7s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

.login-logo::after {
  content: "";
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: loginShine 3.5s ease-in-out infinite 1.2s;
}

.login-logo svg {
  width: 30px;
  height: 30px;
  color: #fff;
  position: relative;
  z-index: 1;
}

.login-title {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.login-subtitle {
  margin: 0 0 2rem;
  font-size: 0.92rem;
  color: #64748b;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  text-align: left;
}

.login-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.login-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  transition: all 0.2s ease;
}

.login-input::placeholder { color: #94a3b8; }

.login-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.login-field-error {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: #fca5a5;
}

.login-alert {
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  text-align: left;
}

.login-alert p { margin: 0; }

.login-alert--info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.login-btn {
  margin-top: 0.75rem;
  width: 100%;
  padding: 0.85rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(14, 165, 233, 0.35);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.login-btn::after {
  content: "";
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s ease;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 44px rgba(37, 99, 235, 0.45);
}

.login-btn:hover::after { left: 200%; }

.login-btn:active { transform: translateY(0); }

.login-btn--ghost {
  background: #fff;
  color: var(--ket-text);
  border: 1px solid var(--ket-border);
  box-shadow: none;
}

.login-btn--ghost::after {
  display: none;
}

.login-btn--ghost:hover {
  background: #f8fafc;
  transform: none;
}

.login-partner-hint {
  margin: 0 0 1rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: #64748b;
  text-align: left;
}

.login-card--partner .login-subtitle {
  margin-bottom: 0.5rem;
}

.login-partner-switch {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.82rem;
}

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

.login-partner-switch-link:hover {
  text-decoration: underline;
}

.partner-crm-denied-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}

.partner-crm-denied-actions .login-btn {
  width: 100%;
  box-sizing: border-box;
}

.login-footer {
  margin-top: 1.75rem;
  font-size: 0.78rem;
  color: #94a3b8;
}

.login-footer-sep {
  margin: 0 0.35rem;
  opacity: 0.7;
}

.login-footer-link {
  color: #64748b;
  font-weight: 600;
  text-decoration: none;
}

.login-footer-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

.login-footer-hint {
  font-weight: 400;
  opacity: 0.92;
}

@media (prefers-reduced-motion: reduce) {
  .login-map-grid,
  .login-map-glow,
  .login-route-path,
  .login-kz-route--mesh,
  .login-kz-svg .login-kz-dot,
  .login-plane,
  .login-parcel,
  .login-courier,
  .login-pin-ring,
  .login-bg-orb,
  .login-logo,
  .login-logo::after,
  .login-card {
    animation: none !important;
  }
}

/* ══════════════════════════════════════
   PANEL LAYOUT
   ══════════════════════════════════════ */

body.page-panel {
  overflow: hidden;
  height: 100vh;
}

.panel-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
}

@media (max-width: 960px) {
  .panel-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
    min-height: 100vh;
  }
  .panel-sidebar { position: relative; width: 100%; }
  .panel-main { min-height: 60vh; }
}

/* ─── Sidebar ─── */

@keyframes sbSlide {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes sbPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  50%      { box-shadow: 0 0 0 5px rgba(52, 211, 153, 0); }
}

@keyframes sbIconBounce {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.15); }
}

.panel-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--ket-sidebar-bg);
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  border-right: 1px solid rgba(15, 28, 46, 0.08);
  box-shadow: 4px 0 32px rgba(15, 28, 46, 0.04);
}

.panel-sidebar::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 200px;
  background: radial-gradient(ellipse 100% 100% at 50% -15%, rgba(59, 130, 246, 0.14) 0%, transparent 62%);
  pointer-events: none;
}

.panel-sidebar svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: block;
}

.panel-sidebar .sb-ico svg[fill="none"] {
  stroke: currentColor;
}

.panel-sidebar::-webkit-scrollbar { width: 4px; }
.panel-sidebar::-webkit-scrollbar-thumb { background: rgba(15, 28, 46, 0.12); border-radius: 4px; }

/* Brand */

.sb-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.25rem 1.1rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(15, 28, 46, 0.08);
  animation: sbSlide 0.4s ease both;
  animation-delay: calc(var(--d, 0) * 40ms);
  transition: background 0.2s ease;
  position: relative;
  z-index: 1;
}

.sb-brand:hover { background: rgba(37, 99, 235, 0.06); }

.sb-brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #6366f1);
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.4);
  flex-shrink: 0;
  overflow: hidden;
  transition: transform 0.25s ease;
}

.sb-brand:hover .sb-brand-icon { transform: scale(1.08) rotate(-3deg); }

.sb-brand-icon svg { display: block; width: 20px; height: 20px; color: #fff; flex-shrink: 0; }

.sb-brand-text { display: flex; flex-direction: column; }

.sb-brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ket-text);
  letter-spacing: 0.01em;
}

.sb-brand-tag {
  font-size: 0.66rem;
  color: var(--ket-muted);
  margin-top: 2px;
}

/* Navigation */

.sb-nav {
  flex: 1;
  padding: 0.6rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  z-index: 1;
}

.sb-section {
  padding: 0.9rem 0.5rem 0.3rem;
  animation: sbSlide 0.4s ease both;
  animation-delay: calc(var(--d, 0) * 40ms);
}

.sb-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #94a3b8;
}

.sb-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.45rem 0.5rem;
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  color: #334155;
  text-decoration: none;
  background: transparent;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  animation: sbSlide 0.35s ease both;
  animation-delay: calc(var(--d, 0) * 40ms);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.sb-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 55%;
  border-radius: 0 3px 3px 0;
  background: #2563eb;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sb-link:hover {
  color: #0f172a;
  background: rgba(37, 99, 235, 0.08);
}

.sb-link:hover .sb-ico {
  background: var(--ket-sidebar-ico-bg-hover);
  color: #1d4ed8;
}

.sb-link.is-active {
  color: #1e3a8a;
  background: var(--ket-sidebar-active);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--ket-sidebar-active-border);
}

.sb-link.is-active::before {
  transform: translateY(-50%) scaleY(1);
}

.sb-link.is-active .sb-ico {
  background: rgba(37, 99, 235, 0.2);
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2);
}

/* Иконка в «пилюле» как у активного дашборда — для всех пунктов */
.sb-ico {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 10px;
  background: var(--ket-sidebar-ico-bg);
  color: #2563eb;
  overflow: visible;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.sb-ico svg {
  display: block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Badge */

.sb-badge {
  margin-left: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.sb-badge:empty { display: none; }

.sb-badge--pulse {
  animation: sbBadgeGlow 2.4s ease-in-out infinite;
}

@keyframes sbBadgeGlow {
  0%, 100% { box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35); }
  50% { box-shadow: 0 2px 14px rgba(59, 130, 246, 0.55); }
}

.sb-section--doc {
  margin-top: 0.35rem;
}

.sb-link--doc-main .sb-ico {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
}

.sb-link--doc-main.is-active .sb-ico {
  background: rgba(99, 102, 241, 0.22);
  color: #4338ca;
}

.sb-section--doc-bottom {
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
}

.sb-doc-sublinks {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: -0.15rem 0 0.65rem 0.35rem;
  padding: 0.35rem 0 0.5rem 0.85rem;
  border-left: 2px solid rgba(99, 102, 241, 0.25);
}

.sb-doc-sublink {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ket-muted);
  text-decoration: none;
  padding: 0.2rem 0;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.sb-doc-sublink:hover {
  color: #4338ca;
  background: rgba(99, 102, 241, 0.06);
}

/* Online dot */

.sb-dot {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sb-dot--green {
  background: #34d399;
  animation: sbPulse 2s ease-in-out infinite;
}

/* Danger link (logout) */

.sb-link--danger {
  color: #b91c1c;
}

.sb-link--danger:hover {
  color: #991b1b;
  background: rgba(248, 113, 113, 0.12);
}

.sb-link--danger .sb-ico {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.35);
}

.sb-link--danger:hover .sb-ico {
  background: rgba(239, 68, 68, 0.2);
  color: #b91c1c;
}

.sb-link--danger::before { background: #ef4444; }

/* Footer */

.sb-footer {
  margin-top: auto;
  border-top: 1px solid rgba(15, 28, 46, 0.08);
  padding: 0.6rem 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  z-index: 1;
}

.sb-logout-form { margin: 0; padding: 0; }

.sb-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.sb-user:hover { background: rgba(37, 99, 235, 0.06); }

.sb-user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #6366f1);
  text-transform: uppercase;
  flex-shrink: 0;
}

.sb-user-info { display: flex; flex-direction: column; min-width: 0; }

.sb-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ket-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-user-role {
  font-size: 0.66rem;
  color: var(--ket-muted);
}

/* ─── Main area ─── */

.panel-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--ket-bg);
}

/* ─── Content ─── */

.panel-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.5rem 1.5rem 2rem;
}

.panel-content-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.panel-page-title {
  margin: 0 0 1rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ket-text);
}

.panel-placeholder {
  padding: 2rem 1.5rem;
  border-radius: var(--ket-radius);
  background: var(--ket-surface-solid);
  border: 1px solid var(--ket-border);
  box-shadow: var(--ket-shadow-soft);
  color: var(--ket-muted);
  line-height: 1.55;
}

/* ══════════════════════════════════════
   SETTINGS — горизонтальные вкладки
   ══════════════════════════════════════ */

.settings-page {
  max-width: 900px;
}

.settings-lead {
  margin: -0.35rem 0 1.25rem;
  font-size: 0.9rem;
  color: var(--ket-muted);
  line-height: 1.5;
}

.settings-tabs {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.settings-tabs::-webkit-scrollbar {
  height: 4px;
}

.settings-tabs::-webkit-scrollbar-thumb {
  background: rgba(15, 28, 46, 0.12);
  border-radius: 4px;
}

.settings-tab {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ket-muted);
  background: var(--ket-surface-solid);
  border: 1px solid var(--ket-border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-tab:hover {
  color: var(--ket-text);
  border-color: rgba(37, 99, 235, 0.25);
  background: var(--ket-accent-soft);
}

.settings-tab.is-active {
  color: #1d4ed8;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.12), rgba(37, 99, 235, 0.06));
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.settings-panels {
  position: relative;
}

.settings-panel:not(.is-active) {
  display: none;
}

.settings-panel.is-active {
  display: block;
  animation: settingsPanelIn 0.25s ease both;
}

@keyframes settingsPanelIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.settings-card {
  padding: 1.35rem 1.4rem 1.5rem;
  border-radius: var(--ket-radius);
  background: var(--ket-surface-solid);
  border: 1px solid var(--ket-border);
  box-shadow: var(--ket-shadow-soft);
}

.settings-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.settings-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ket-text);
}

.settings-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  background: #f1f5f9;
  border-radius: 6px;
  border: 1px solid rgba(15, 28, 46, 0.06);
}

.settings-card-desc {
  margin: 0 0 1.15rem;
  font-size: 0.86rem;
  color: var(--ket-muted);
  line-height: 1.5;
}

.settings-fields {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

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

.settings-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ket-muted);
}

.settings-input,
.settings-select {
  width: 100%;
  max-width: 420px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.88rem;
  color: var(--ket-text);
  background: #f8fafc;
  border: 1px solid var(--ket-border);
  border-radius: 10px;
  transition: border-color 0.15s ease;
}

.settings-input:focus:not(:disabled),
.settings-select:focus:not(:disabled) {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
}

.settings-input:disabled,
.settings-select:disabled,
.settings-file:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.settings-file {
  font-size: 0.82rem;
  max-width: 420px;
}

.settings-card--map .settings-card-desc a {
  color: var(--ket-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.settings-card--map .settings-card-desc a:hover {
  color: #1d4ed8;
}

.settings-map-wrap {
  margin-top: 0.25rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--ket-border);
  background: #e8eef5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.settings-map {
  width: 100%;
  height: min(420px, 55vh);
  min-height: 280px;
  z-index: 0;
}

.settings-map .leaflet-control-attribution {
  font-size: 10px;
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ══════════════════════════════════════
   NOTIFICATIONS (рассылка)
   ══════════════════════════════════════ */

.notify-page {
  max-width: 640px;
}

.notify-lead {
  margin: -0.35rem 0 1.25rem;
  font-size: 0.9rem;
  color: var(--ket-muted);
  line-height: 1.5;
}

.notify-alerts {
  margin-bottom: 1rem;
}

.notify-alert {
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  font-size: 0.88rem;
  border: 1px solid var(--ket-border);
  background: var(--ket-surface-solid);
}

.notify-alert--ok {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
  color: #047857;
}

.notify-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.notify-card {
  padding: 1.25rem 1.35rem 1.35rem;
  border-radius: var(--ket-radius);
  background: var(--ket-surface-solid);
  border: 1px solid var(--ket-border);
  box-shadow: var(--ket-shadow-soft);
}

.notify-card-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ket-text);
}

.notify-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--ket-muted);
}

.notify-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.notify-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ket-muted);
}

.notify-input,
.notify-textarea,
.notify-select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.88rem;
  color: var(--ket-text);
  background: #f8fafc;
  border: 1px solid var(--ket-border);
  border-radius: 10px;
  transition: border-color 0.15s ease;
}

.notify-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

.notify-input:focus,
.notify-textarea:focus,
.notify-select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
}

.notify-file {
  font-size: 0.82rem;
  padding: 0.35rem 0;
}

.notify-file-hint {
  font-size: 0.72rem;
  color: #94a3b8;
}

.notify-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.notify-chip {
  position: relative;
  cursor: pointer;
}

.notify-chip-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.notify-chip-ui {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ket-muted);
  background: #f8fafc;
  border: 1px solid var(--ket-border);
  border-radius: 10px;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.notify-chip-input:focus-visible + .notify-chip-ui {
  outline: 2px solid rgba(37, 99, 235, 0.45);
  outline-offset: 2px;
}

.notify-chip-input:checked + .notify-chip-ui {
  color: #1d4ed8;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.12), rgba(37, 99, 235, 0.05));
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.notify-chip:hover .notify-chip-ui {
  border-color: rgba(37, 99, 235, 0.22);
  color: var(--ket-text);
}

.notify-subblock {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(15, 28, 46, 0.06);
}

.notify-subblock .notify-label {
  display: block;
  margin-bottom: 0.4rem;
}

.notify-actions {
  padding-top: 0.25rem;
}

.notify-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.35rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.notify-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.notify-submit:active {
  transform: translateY(0);
}

/* ══════════════════════════════════════
   CLIENTS
   ══════════════════════════════════════ */

.clients-page {
  max-width: 960px;
}

.clients-head .clients-lead {
  margin: -0.35rem 0 1rem;
  font-size: 0.88rem;
  color: var(--ket-muted);
  line-height: 1.5;
}

.clients-alerts {
  margin-bottom: 1rem;
}

.clients-msg {
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  font-size: 0.86rem;
  margin-bottom: 0.35rem;
  border: 1px solid var(--ket-border);
  background: var(--ket-surface-solid);
}

.clients-msg--ok {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
  color: #047857;
}

.clients-msg--err {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #b91c1c;
}

.clients-add-panel .dash-panel-title {
  margin-bottom: 0.85rem;
}

.clients-add-form {
  margin: 0;
}

.clients-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.clients-add-field {
  flex: 1 1 160px;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.clients-add-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ket-muted);
}

.clients-add-input {
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: 0.88rem;
  border: 1px solid var(--ket-border);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--ket-text);
}

.clients-add-input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
}

.clients-add-actions {
  flex: 0 0 auto;
  padding-bottom: 1px;
}

.clients-add-btn {
  padding: 0.5rem 1.1rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.clients-add-btn:hover {
  filter: brightness(1.05);
}

.clients-list-panel .td-num {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ket-text);
}

/* ══════════════════════════════════════
   COURIERS
   ══════════════════════════════════════ */

.couriers-page {
  max-width: 1100px;
}

.couriers-head .couriers-lead,
.couriers-edit-head .couriers-lead {
  margin: -0.35rem 0 1rem;
  font-size: 0.88rem;
  color: var(--ket-muted);
  line-height: 1.5;
}

.couriers-alerts {
  margin-bottom: 1rem;
}

.couriers-msg {
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  font-size: 0.86rem;
  margin-bottom: 0.35rem;
  border: 1px solid var(--ket-border);
  background: var(--ket-surface-solid);
}

.couriers-msg--ok {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
  color: #047857;
}

.couriers-msg--err {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #b91c1c;
}

.couriers-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--ket-surface-solid);
  border: 1px solid var(--ket-border);
  border-radius: var(--ket-radius);
  box-shadow: var(--ket-shadow-soft);
}

.couriers-toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 160px;
}

.couriers-toolbar-field--grow {
  flex: 1 1 220px;
}

.couriers-toolbar-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ket-muted);
}

.couriers-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding-bottom: 1px;
}

.couriers-select,
.couriers-input {
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: 0.88rem;
  border: 1px solid var(--ket-border);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--ket-text);
}

.couriers-input--toolbar {
  min-width: 200px;
}

.couriers-select:focus,
.couriers-input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
}

.couriers-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.12s ease, background 0.12s ease;
}

.couriers-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.couriers-btn--primary:hover {
  filter: brightness(1.05);
  color: #fff;
}

.couriers-btn--ghost {
  background: transparent;
  color: var(--ket-muted);
  border: 1px solid var(--ket-border);
}

.couriers-btn--ghost:hover {
  color: var(--ket-accent);
  border-color: rgba(37, 99, 235, 0.35);
}

.couriers-btn--outline-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: #b91c1c;
  background: #fff;
  border: 1px solid rgba(220, 38, 38, 0.45);
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.couriers-btn--outline-danger:hover {
  background: rgba(254, 226, 226, 0.6);
  border-color: #dc2626;
  color: #991b1b;
}

.couriers-btn--lg {
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
}

.couriers-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  width: 100%;
}

.couriers-list-head-titles {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.couriers-btn--add {
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.28);
}

.couriers-btn--add svg {
  flex-shrink: 0;
}

.couriers-add-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(10, 20, 40, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: modalFadeIn 0.2s ease both;
}

.couriers-add-overlay.is-open {
  display: flex;
}

.couriers-add-modal {
  width: min(560px, 100%);
  max-height: min(92vh, 900px);
  overflow-y: auto;
  background: var(--ket-surface-solid);
  border: 1px solid var(--ket-border);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(15, 28, 46, 0.22);
  padding: 1.35rem 1.5rem 1.5rem;
  animation: modalSlideIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.couriers-add-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.couriers-add-modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ket-text);
  letter-spacing: -0.02em;
}

.couriers-add-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin: -0.25rem -0.35rem 0 0;
  border: none;
  border-radius: 10px;
  background: rgba(15, 28, 46, 0.06);
  color: var(--ket-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.couriers-add-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.couriers-add-modal-lead {
  margin: 0 0 1rem;
  font-size: 0.84rem;
  color: var(--ket-muted);
  line-height: 1.45;
}

.couriers-add-modal-actions {
  justify-content: flex-end;
  flex-direction: row;
  flex-wrap: wrap;
}

.couriers-add-form {
  margin: 0;
}

.couriers-add-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem 1rem;
  align-items: start;
}

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

.couriers-field--file {
  grid-column: 1 / -1;
}

.couriers-field--switch {
  grid-column: 1 / -1;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
}

/* Переключатель «Неактивен · Активен» */
.couriers-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
  flex-wrap: wrap;
}

.couriers-switch-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.couriers-switch-input:focus-visible + .couriers-switch-track {
  outline: 2px solid var(--ket-accent);
  outline-offset: 3px;
}

.couriers-switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.22s ease;
  box-shadow: inset 0 1px 3px rgba(15, 28, 46, 0.12);
}

.couriers-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 28, 46, 0.18);
  transition: transform 0.22s ease;
}

.couriers-switch-input:checked + .couriers-switch-track {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.couriers-switch-input:checked + .couriers-switch-track::after {
  transform: translateX(20px);
}

.couriers-switch-words {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ket-muted);
}

.couriers-switch-sep {
  opacity: 0.45;
  font-weight: 400;
}

.couriers-switch-off,
.couriers-switch-on {
  transition: color 0.2s ease, opacity 0.2s ease, font-weight 0.2s ease;
}

.couriers-switch-input:not(:checked) ~ .couriers-switch-words .couriers-switch-off {
  font-weight: 700;
  color: var(--ket-text);
}

.couriers-switch-input:not(:checked) ~ .couriers-switch-words .couriers-switch-on {
  opacity: 0.45;
  font-weight: 500;
}

.couriers-switch-input:checked ~ .couriers-switch-words .couriers-switch-on {
  font-weight: 700;
  color: #047857;
}

.couriers-switch-input:checked ~ .couriers-switch-words .couriers-switch-off {
  opacity: 0.45;
  font-weight: 500;
}

/* Только отображение в таблице (без input) */
.couriers-switch--static {
  cursor: default;
}

.couriers-switch--static .couriers-switch-track {
  pointer-events: none;
}

.couriers-switch--inactive .couriers-switch-track {
  background: #cbd5e1;
}

.couriers-switch--inactive .couriers-switch-track::after {
  transform: translateX(0);
}

.couriers-switch--active .couriers-switch-track {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.couriers-switch--active .couriers-switch-track::after {
  transform: translateX(20px);
}

.couriers-switch--inactive .couriers-switch-off {
  font-weight: 700;
  color: var(--ket-text);
}

.couriers-switch--inactive .couriers-switch-on {
  opacity: 0.45;
}

.couriers-switch--active .couriers-switch-on {
  font-weight: 700;
  color: #047857;
}

.couriers-switch--active .couriers-switch-off {
  opacity: 0.45;
}

.couriers-td-status {
  white-space: nowrap;
  vertical-align: middle;
}

.couriers-field--submit {
  grid-column: 1 / -1;
}

.couriers-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ket-muted);
}

.couriers-label--inline {
  font-size: 0.86rem;
  font-weight: 500;
}

.couriers-err {
  font-size: 0.75rem;
  color: #b91c1c;
}

.couriers-file {
  font-size: 0.82rem;
}

.couriers-hint {
  font-size: 0.75rem;
  color: var(--ket-muted);
}

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

.couriers-th-photo {
  width: 56px;
}

.couriers-th-actions {
  width: 140px;
  text-align: right;
}

.couriers-td-photo {
  vertical-align: middle;
}

.couriers-thumb {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
}

.couriers-thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #6366f1);
}

.couriers-td-iin {
  font-variant-numeric: tabular-nums;
  font-size: 0.84rem;
  letter-spacing: 0.02em;
}

.couriers-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 20px;
}

.couriers-pill--on {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.couriers-pill--off {
  background: rgba(100, 116, 139, 0.12);
  color: var(--ket-muted);
}

.couriers-td-actions {
  text-align: right;
  white-space: nowrap;
}

.couriers-link-action {
  display: inline;
  padding: 0;
  margin-left: 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ket-accent);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.couriers-link-action:first-child {
  margin-left: 0;
}

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

.couriers-link-action--danger {
  color: #dc2626;
}

.couriers-inline-form {
  display: inline;
  margin: 0;
}

.couriers-empty {
  margin-top: 0.5rem;
}

.couriers-edit-head .panel-page-title {
  margin-bottom: 0.25rem;
}

.couriers-back {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ket-muted);
  text-decoration: none;
}

.couriers-back:hover {
  color: var(--ket-accent);
}

.couriers-edit-preview {
  max-width: 120px;
  max-height: 120px;
  border-radius: 12px;
  object-fit: cover;
  margin-bottom: 0.5rem;
  border: 1px solid var(--ket-border);
}

.couriers-edit-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.courier-avatar--img {
  object-fit: cover;
}

/* ══════════════════════════════════════
   PARTNERS
   ══════════════════════════════════════ */

.partners-page {
  max-width: 1120px;
}

.partners-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--ket-radius);
  padding: 1.35rem 1.5rem 1.5rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #0f2847 0%, #1e3a5f 45%, #1e40af 100%);
  color: #f1f5f9;
  box-shadow: 0 16px 48px rgba(15, 40, 71, 0.2);
}

.partners-hero-text {
  position: relative;
  z-index: 1;
  max-width: 520px;
}

.partners-page .panel-page-title {
  margin: 0 0 0.35rem;
  color: #fff;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.partners-hero-lead {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: rgba(241, 245, 249, 0.82);
}

.partners-hero-crm {
  margin: 0.85rem 0 0;
  font-size: 0.86rem;
  line-height: 1.45;
}

.partners-hero-crm-link {
  font-weight: 600;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.partners-hero-crm-link:hover {
  color: #bfdbfe;
}

.partners-hero-crm-hint {
  color: rgba(241, 245, 249, 0.78);
}

.partners-hero-crm-code {
  padding: 0.1rem 0.35rem;
  font-size: 0.78rem;
  font-family: ui-monospace, monospace;
  color: rgba(241, 245, 249, 0.95);
  background: rgba(15, 23, 42, 0.35);
  border-radius: 6px;
}

.partners-hero-deco {
  position: absolute;
  right: -20%;
  top: -40%;
  width: 55%;
  height: 180%;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.25) 0%, transparent 65%);
  pointer-events: none;
}

.partners-toolbar {
  margin-bottom: 1.35rem;
}

.partners-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-bottom: 1rem;
}

.partners-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ket-text);
}

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

.partner-card {
  position: relative;
  padding: 1.1rem 1.15rem 1rem;
  background: var(--ket-surface-solid);
  border: 1px solid var(--ket-border);
  border-radius: 16px;
  box-shadow: var(--ket-shadow-soft);
  animation: rowSlide 0.4s ease both;
  animation-delay: calc(var(--i, 0) * 45ms + 80ms);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.partner-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(15, 28, 46, 0.1);
}

.partner-card-top {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.partner-card-logo-wrap {
  flex-shrink: 0;
}

.partner-card-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
  background: #f8fafc;
  border: 1px solid var(--ket-border);
}

.partner-card-logo--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  border: none;
}

.partner-card-main {
  min-width: 0;
}

.partner-card-name {
  margin: 0 0 0.25rem;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ket-text);
  line-height: 1.25;
}

.partner-card-city {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4338ca;
  background: rgba(67, 56, 202, 0.1);
  border-radius: 6px;
}

.partner-card-line {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--ket-text);
}

.partner-card-line--email {
  word-break: break-all;
}

.partner-card-k {
  color: var(--ket-muted);
  font-weight: 500;
  margin-right: 0.25rem;
}

.partner-card-address {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ket-muted);
}

.partner-card-coords {
  margin: 0.55rem 0 0;
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  color: var(--ket-muted);
}

.partner-card-maplink {
  margin-left: 0.45rem;
  font-weight: 600;
  color: var(--ket-accent);
  text-decoration: none;
}

.partner-card-maplink:hover {
  text-decoration: underline;
}

.partner-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ket-border);
}

.partner-card-btn {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ket-accent);
  cursor: pointer;
  text-decoration: none;
}

.partner-card-btn:hover {
  text-decoration: underline;
}

.partner-card-btn--danger {
  color: #dc2626;
}

.partners-empty {
  margin-top: 0.5rem;
}

.partners-add-modal {
  width: min(620px, 100%);
}

.partners-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem 1rem;
  align-items: start;
}

.partners-field--full {
  grid-column: 1 / -1;
}

.partners-form-grid .partners-field--full,
.partners-form-grid--edit .partners-field--full {
  grid-column: 1 / -1;
}

.partners-input,
.partners-select,
.partners-textarea {
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: 0.88rem;
  border: 1px solid var(--ket-border);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--ket-text);
  width: 100%;
}

.partners-textarea {
  resize: vertical;
  min-height: 72px;
}

.partners-input:focus,
.partners-select:focus,
.partners-textarea:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
}

.partners-coords-hint {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ket-muted);
  background: rgba(37, 99, 235, 0.06);
  border-radius: 10px;
  border: 1px solid rgba(37, 99, 235, 0.12);
}

.partners-coords-hint strong {
  color: var(--ket-text);
}

.partners-coords-hint--modal {
  margin: 0;
  grid-column: 1 / -1;
}

.partners-nonfield {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.partners-edit-sub {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ket-muted);
}

.partners-edit-page {
  max-width: 760px;
}

.partners-edit-page .dash-panel + .dash-panel {
  margin-top: 1.5rem;
}

.partners-edit-panel {
  max-width: 760px;
}

.partners-edit-panel-head {
  align-items: flex-start;
}

.partners-edit-panel-head-text .dash-panel-title {
  margin: 0 0 0.25rem;
}

.partners-edit-panel-desc {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ket-muted);
  font-weight: 500;
}

.partners-edit-panel-body {
  padding: 0 1.1rem 1.1rem;
}

.partners-edit-main-form {
  margin: 0;
}

.partners-edit-group {
  margin: 0 0 1.25rem;
  padding: 1rem 1rem 1.05rem;
  background: rgba(248, 250, 252, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 14px;
}

.partners-edit-group:last-of-type {
  margin-bottom: 0;
}

.partners-edit-group--status {
  background: rgba(239, 246, 255, 0.65);
  border-color: rgba(191, 219, 254, 0.65);
}

.partners-edit-group-title {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ket-muted);
}

.partners-edit-group-hint {
  margin: -0.25rem 0 0.75rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ket-muted);
}

.partners-edit-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.partners-edit-status-switch {
  margin: 0;
}

.partners-edit-field-logo {
  grid-column: 1 / -1;
}

.partners-edit-footer {
  margin-top: 1.35rem;
  padding: 1.1rem 1rem 0.25rem;
  border-top: 1px solid var(--ket-border);
}

.partners-edit-footer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.partners-edit-footer-cancel {
  font-size: 0.88rem;
}

.partners-edit-footer-hint {
  margin: 0.75rem 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--ket-muted);
  max-width: 42em;
}

.partners-edit-logo-preview {
  margin-bottom: 0.5rem;
}

.partners-edit-logo-img {
  max-height: 100px;
  max-width: 200px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--ket-border);
  background: #fff;
}

/* ══════════════════════════════════════
   LOGOUT CONFIRMATION MODAL
   ══════════════════════════════════════ */

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.logout-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 20, 40, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: modalFadeIn 0.2s ease both;
}

.logout-overlay.is-open { display: flex; }

.logout-modal {
  width: min(380px, 100%);
  background: var(--ket-surface-solid);
  border: 1px solid var(--ket-border);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(15, 28, 46, 0.2);
  padding: 2rem 1.75rem 1.5rem;
  text-align: center;
  animation: modalSlideIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.logout-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(239, 68, 68, 0.08);
  margin-bottom: 1rem;
}

.logout-modal-icon svg {
  width: 26px;
  height: 26px;
  color: #ef4444;
}

.logout-modal h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ket-text);
}

.logout-modal p {
  margin: 0 0 1.5rem;
  font-size: 0.88rem;
  color: var(--ket-muted);
}

.logout-modal-actions {
  display: flex;
  gap: 0.65rem;
}

.logout-modal-btn {
  flex: 1;
  padding: 0.7rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.logout-modal-btn--cancel {
  color: var(--ket-muted);
  background: var(--ket-bg);
  border: 1px solid var(--ket-border);
}

.logout-modal-btn--cancel:hover {
  background: var(--ket-bg-deep);
}

.logout-modal-btn--confirm {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
}

.logout-modal-btn--confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.35);
}

/* ══════════════════════════════════════
   DASHBOARD
   ══════════════════════════════════════ */

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeScale {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50%      { opacity: 0.65; transform: scale(1.18); }
}

@keyframes rowSlide {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

/* Greeting */

.dash-greeting {
  animation: slideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

.dash-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ket-text);
}

.dash-date {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  color: var(--ket-muted);
}

/* Stat cards */

.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}

@media (max-width: 900px) { .dash-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .dash-stats { grid-template-columns: 1fr; } }

.stat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: var(--ket-surface-solid);
  border: 1px solid var(--ket-border);
  overflow: hidden;
  cursor: default;
  animation: fadeScale 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(15, 28, 46, 0.1);
}

.stat-glow {
  position: absolute;
  top: -30%;
  right: -20%;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  filter: blur(28px);
  animation: pulse-glow 3s ease-in-out infinite;
  pointer-events: none;
}

.stat-card--blue  { border-left: 3px solid #2563eb; }
.stat-card--blue  .stat-glow { background: #2563eb; }
.stat-card--blue  .stat-icon { color: #2563eb; background: rgba(37, 99, 235, 0.08); }

.stat-card--amber { border-left: 3px solid #f59e0b; }
.stat-card--amber .stat-glow { background: #f59e0b; }
.stat-card--amber .stat-icon { color: #f59e0b; background: rgba(245, 158, 11, 0.08); }

.stat-card--green { border-left: 3px solid #10b981; }
.stat-card--green .stat-glow { background: #10b981; }
.stat-card--green .stat-icon { color: #10b981; background: rgba(16, 185, 129, 0.08); }

.stat-card--red   { border-left: 3px solid #ef4444; }
.stat-card--red   .stat-glow { background: #ef4444; }
.stat-card--red   .stat-icon { color: #ef4444; background: rgba(239, 68, 68, 0.08); }

.stat-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  transition: transform 0.2s ease;
}

.stat-card:hover .stat-icon { transform: scale(1.1) rotate(-4deg); }

.stat-icon svg { width: 22px; height: 22px; }

.stat-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  z-index: 1;
}

.stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ket-text);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ket-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Mini stats bar */

.dash-mini-stats {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.7rem 1.1rem;
  border-radius: 14px;
  background: var(--ket-surface-solid);
  border: 1px solid var(--ket-border);
  animation: slideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

.mini-stat { display: flex; align-items: baseline; gap: 0.4rem; }
.mini-stat-num { font-size: 1.05rem; font-weight: 700; color: var(--ket-text); }
.mini-stat-label { font-size: 0.78rem; color: var(--ket-muted); }

.mini-divider { width: 1px; height: 20px; background: var(--ket-border); }

@media (max-width: 600px) {
  .dash-mini-stats { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .mini-divider { display: none; }
}

/* Grid: orders + couriers */

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0.85rem;
}

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

.dash-panel {
  background: var(--ket-surface-solid);
  border: 1px solid var(--ket-border);
  border-radius: 16px;
  overflow: hidden;
  animation: slideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

.dash-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--ket-border);
}

.dash-panel-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ket-text);
}

.dash-panel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ket-accent);
  background: var(--ket-accent-soft);
  border-radius: 20px;
}

/* Orders table */

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

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.dash-table thead th {
  padding: 0.55rem 0.75rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ket-muted);
  background: rgba(37, 99, 235, 0.03);
  border-bottom: 1px solid var(--ket-border);
  white-space: nowrap;
}

.dash-table-row {
  animation: rowSlide 0.35s ease both;
  animation-delay: calc(var(--row, 0) * 40ms + 400ms);
  transition: background 0.12s ease;
}

.dash-table-row:hover { background: rgba(37, 99, 235, 0.04); }

.dash-table-row td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(30, 58, 95, 0.05);
  white-space: nowrap;
}

.td-id { font-weight: 700; color: var(--ket-accent); font-size: 0.82rem; }
.td-name { font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.td-phone { color: var(--ket-muted); font-size: 0.82rem; }
.td-courier { color: var(--ket-muted); }
.td-date { color: var(--ket-muted); font-size: 0.8rem; }

/* Status badges */

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.status-badge--new         { background: rgba(37, 99, 235, 0.10); color: #1d4ed8; }
.status-badge--confirmed   { background: rgba(99, 102, 241, 0.10); color: #4338ca; }
.status-badge--assigned    { background: rgba(245, 158, 11, 0.10); color: #b45309; }
.status-badge--in_progress { background: rgba(245, 158, 11, 0.13); color: #92400e; }
.status-badge--delivered   { background: rgba(16, 185, 129, 0.10); color: #047857; }
.status-badge--failed      { background: rgba(239, 68, 68, 0.10);  color: #b91c1c; }
.status-badge--post        { background: rgba(139, 92, 246, 0.10); color: #6d28d9; }

/* Courier list */

.courier-list { list-style: none; margin: 0; padding: 0.4rem 0; }

.courier-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1.1rem;
  animation: rowSlide 0.35s ease both;
  animation-delay: calc(var(--row, 0) * 50ms + 450ms);
  transition: background 0.12s ease;
}

.courier-row:hover { background: rgba(37, 99, 235, 0.04); }

.courier-avatar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  text-transform: uppercase;
}

.courier-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.courier-name { font-size: 0.86rem; font-weight: 600; color: var(--ket-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.courier-zone { font-size: 0.74rem; color: var(--ket-muted); }

.courier-orders-count {
  flex: 0 0 auto;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 20px;
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
}

.courier-free { background: rgba(16, 185, 129, 0.1); color: #047857; }

/* Empty state */

.dash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  color: var(--ket-muted);
  text-align: center;
}

.dash-empty-ico { width: 40px; height: 40px; margin-bottom: 0.6rem; opacity: 0.35; }
.dash-empty p { margin: 0; font-size: 0.88rem; }

/* Partner cards: active toggle + trusted badge */
.partner-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.45);
}

.partner-card-toggle-form {
  margin: 0;
}

.partner-card-toggle-form .couriers-switch {
  margin: 0;
}

a.partner-api-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid rgba(37, 99, 235, 0.28);
  transition: background 0.15s ease, border-color 0.15s ease;
}

a.partner-api-badge:hover {
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(37, 99, 235, 0.45);
}

a.partner-api-badge--unused {
  color: #64748b;
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.35);
}

a.partner-api-badge--unused:hover {
  background: rgba(148, 163, 184, 0.22);
  border-color: rgba(100, 116, 139, 0.45);
}

a.partner-api-badge--live {
  color: #047857;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(5, 150, 105, 0.45);
}

a.partner-api-badge--live:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(5, 150, 105, 0.6);
}

.partner-api-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.35);
  flex-shrink: 0;
  animation: partnerApiPulse 2s ease-in-out infinite;
}

@keyframes partnerApiPulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.85;
    transform: scale(0.92);
  }
}

@media (prefers-reduced-motion: reduce) {
  .partner-api-dot {
    animation: none;
  }
}

a.partner-api-badge--stale {
  color: #92400e;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(217, 119, 6, 0.35);
}

a.partner-api-badge--stale:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(217, 119, 6, 0.5);
}

.partners-api-key-status {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
}

.partners-api-key-status--ok {
  color: #047857;
}

.partners-api-key-status--muted {
  color: var(--ket-muted);
}

.partner-trusted-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
  border-radius: 8px;
}

.partner-trusted-badge svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.partner-trusted-badge--empty {
  color: var(--ket-muted);
  background: rgba(148, 163, 184, 0.12);
}

/* Partner edit: trusted person block */
.partners-trusted-panel {
  max-width: 760px;
}

.partners-trusted-panel-head {
  align-items: flex-start;
}

.partners-trusted-panel-head-text .dash-panel-title {
  margin: 0 0 0.35rem;
}

.partners-trusted-panel-desc {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ket-muted);
  max-width: 520px;
}

.partners-trusted-panel-desc a {
  color: var(--ket-accent);
  font-weight: 600;
  text-decoration: none;
}

.partners-trusted-panel-desc a:hover {
  text-decoration: underline;
}

.partners-trusted-panel-body {
  padding: 0 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.partners-trusted-card {
  padding: 1rem 1.05rem;
  border-radius: 14px;
  border: 1px solid var(--ket-border);
  background: var(--ket-surface-solid);
}

.partners-trusted-card--login {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(248, 250, 252, 1) 100%);
  border-color: rgba(16, 185, 129, 0.22);
}

.partners-trusted-card-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ket-muted);
  margin-bottom: 0.35rem;
}

.partners-trusted-login-value {
  margin: 0;
  font-size: 1.05rem;
}

.partners-trusted-login-value code {
  padding: 0.2rem 0.55rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f766e;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 8px;
}

.partners-trusted-card-title {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ket-text);
}

.partners-trusted-card-title--danger {
  color: #991b1b;
}

.partners-trusted-card-lead {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ket-muted);
}

.partners-trusted-card--password .partners-trusted-card-lead {
  margin-bottom: 0.85rem;
}

.partners-trusted-card--danger {
  background: rgba(254, 242, 242, 0.65);
  border-color: rgba(252, 165, 165, 0.65);
}

.partners-trusted-card--danger .partners-trusted-card-lead {
  margin-bottom: 1rem;
}

.partners-trusted-pw-form {
  margin: 0;
}

.partners-form-grid--password {
  margin-bottom: 0.25rem;
}

.partners-trusted-card-actions {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.45);
}

.partners-trusted-card--create .partners-trusted-card-actions {
  border-top: none;
  padding-top: 0.35rem;
  margin-top: 0.5rem;
}

.partners-trusted-remove-form {
  margin: 0;
}

/* Partner CRM (доверенное лицо) */
body.page-partner-crm {
  overflow: hidden;
  height: 100vh;
}

.pcrm-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
}

.pcrm-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0.75rem 0;
  background: var(--ket-sidebar-bg);
  border-right: 1px solid rgba(15, 28, 46, 0.08);
  box-shadow: 4px 0 24px rgba(15, 28, 46, 0.04);
}

.pcrm-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem 0.85rem;
  text-decoration: none;
  color: inherit;
}

.pcrm-brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  flex-shrink: 0;
}

.pcrm-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pcrm-brand-name {
  font-family: "Fraunces", Georgia, serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ket-text);
}

.pcrm-brand-tag {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ket-muted);
}

.pcrm-partner-name {
  margin: 0 1rem 0.75rem;
  padding: 0.45rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ket-text);
  background: rgba(37, 99, 235, 0.08);
  border-radius: 10px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pcrm-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.pcrm-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ket-text);
  text-decoration: none;
  transition: background 0.15s ease;
}

.pcrm-link:hover {
  background: rgba(37, 99, 235, 0.08);
}

.pcrm-link.is-active {
  background: var(--ket-sidebar-active);
  border: 1px solid var(--ket-sidebar-active-border);
}

.pcrm-ico {
  display: flex;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #2563eb;
}

.pcrm-ico svg {
  width: 20px;
  height: 20px;
}

.pcrm-link--muted {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ket-muted);
}

.pcrm-sidebar-footer {
  padding: 0.75rem 1rem 0;
  border-top: 1px solid rgba(15, 28, 46, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pcrm-logout-btn {
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ket-text);
  background: #fff;
  border: 1px solid var(--ket-border);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
}

.pcrm-logout-btn:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.pcrm-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--ket-bg);
}

.pcrm-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--ket-surface-solid);
  border-bottom: 1px solid var(--ket-border);
  box-shadow: var(--ket-shadow-soft);
}

.pcrm-page-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ket-text);
}

.pcrm-user-name {
  font-size: 0.86rem;
  color: var(--ket-muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pcrm-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem 1.5rem 2.5rem;
}

.pcrm-alerts {
  margin-bottom: 1rem;
}

.pcrm-lead {
  margin: 0 0 1.25rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ket-muted);
  max-width: 720px;
}

.pcrm-lead a {
  color: var(--ket-accent);
  font-weight: 600;
}

.pcrm-home {
  margin-bottom: 1.5rem;
}

.pcrm-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
}

.pcrm-stat-card {
  padding: 1rem 1rem;
  border-radius: var(--ket-radius);
  background: var(--ket-surface-solid);
  border: 1px solid var(--ket-border);
  box-shadow: var(--ket-shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
}

.pcrm-stat-card--total {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(99, 102, 241, 0.06));
  border-color: rgba(37, 99, 235, 0.2);
}

@media (min-width: 640px) {
  .pcrm-stat-card--total {
    grid-column: span 2;
  }
}

.pcrm-stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ket-text);
  letter-spacing: -0.02em;
}

.pcrm-stat-label {
  font-size: 0.75rem;
  color: var(--ket-muted);
  line-height: 1.3;
}

.pcrm-link-inline {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ket-accent);
  text-decoration: none;
}

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

.pcrm-recent-panel {
  max-width: 1100px;
}

.pcrm-orders-head {
  margin-bottom: 0.5rem;
}

.pcrm-toolbar {
  margin-bottom: 1rem;
}

.pcrm-company-body {
  padding: 0 1.1rem 1.25rem;
}

.pcrm-company-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.pcrm-company-logo img {
  width: 120px;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--ket-border);
}

.pcrm-dl {
  flex: 1;
  min-width: 240px;
  margin: 0;
  display: grid;
  gap: 0.65rem 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.pcrm-dl--full {
  grid-column: 1 / -1;
}

.pcrm-dl dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ket-muted);
}

.pcrm-dl dd {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  color: var(--ket-text);
}

.pcrm-ok {
  color: #047857;
  font-weight: 600;
}

.pcrm-warn {
  color: #b45309;
  font-weight: 600;
}

.pcrm-int-body {
  padding: 0 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.pcrm-int-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ket-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pcrm-int-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.65rem;
}

.pcrm-int-code {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.78rem;
  word-break: break-all;
  color: #1e3a8a;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.pcrm-int-pre {
  margin: 0;
  padding: 1rem;
  font-size: 0.76rem;
  line-height: 1.45;
  overflow-x: auto;
  color: var(--ket-text);
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid var(--ket-border);
  border-radius: 12px;
}

.pcrm-int-pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre;
}

.pcrm-int-warn {
  margin: 0;
  font-size: 0.88rem;
  color: #b45309;
  line-height: 1.5;
}

.pcrm-int-docs {
  margin: 0;
}

.pcrm-docs-link {
  font-weight: 600;
  color: var(--ket-accent);
}

@media (max-width: 900px) {
  .pcrm-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: auto;
    min-height: 100vh;
  }

  body.page-partner-crm {
    overflow: auto;
    height: auto;
    min-height: 100vh;
  }

  .pcrm-sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(15, 28, 46, 0.08);
  }

  .pcrm-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding-bottom: 0.5rem;
  }

  .pcrm-link span:last-child {
    white-space: nowrap;
  }

  .pcrm-main {
    min-height: 60vh;
  }
}

/* Partner portal (legacy class — убран отдельный шаблон) */
.partner-portal-shell {
  min-height: 100vh;
  background: linear-gradient(165deg, #f8fafc 0%, #eef2ff 100%);
}

.partner-portal-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--ket-border);
  backdrop-filter: blur(8px);
}

.partner-portal-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.partner-portal-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
}

.partner-portal-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ket-muted);
}

.partner-portal-name {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ket-text);
  margin-top: 0.1rem;
}

.partner-portal-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.partner-portal-user-name {
  font-size: 0.86rem;
  color: var(--ket-text);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.partner-portal-logout-btn {
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ket-text);
  background: #fff;
  border: 1px solid var(--ket-border);
  border-radius: 10px;
  cursor: pointer;
}

.partner-portal-logout-btn:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.partner-portal-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

.partner-portal-orders {
  margin-top: 0;
}

.partner-portal-empty p {
  margin: 0;
  font-size: 0.9rem;
}

/* Partner API key block */
.partners-api-panel {
  max-width: 760px;
}

.partners-api-panel-body {
  padding: 0 1.1rem 1.1rem;
}

.partners-api-key-box {
  padding: 1rem 1.05rem;
  border-radius: 14px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  background: linear-gradient(145deg, rgba(238, 242, 255, 0.9) 0%, #fff 55%);
}

.partners-api-key-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 0.35rem 0 0;
}

.partners-api-key-code {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  word-break: break-all;
  color: #312e81;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
}

.partners-api-key-hint {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ket-muted);
}

.partners-api-key-hint kbd {
  padding: 0.1rem 0.35rem;
  font-size: 0.72rem;
  font-family: ui-monospace, monospace;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 4px;
}

.partners-api-regen-form {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ket-border);
}

/* Orders list page */
.orders-page {
  max-width: 1120px;
}

.orders-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1.35rem 1.5rem;
  border-radius: var(--ket-radius);
  background: linear-gradient(135deg, #0c1929 0%, #1e3a5f 42%, #1d4ed8 100%);
  color: #f1f5f9;
  box-shadow: 0 16px 40px rgba(12, 25, 41, 0.22);
}

.orders-hero .panel-page-title {
  margin: 0 0 0.35rem;
  color: #fff;
  font-size: 1.5rem;
}

.orders-hero-lead {
  margin: 0;
  max-width: 520px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(241, 245, 249, 0.85);
}

.orders-hero-stat {
  text-align: right;
}

.orders-hero-stat-num {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.orders-hero-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.75;
}

.orders-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.orders-toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.orders-toolbar-field--grow {
  flex: 1;
  min-width: 200px;
}

.orders-toolbar-field--date {
  min-width: 10.5rem;
}

.orders-toolbar-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ket-muted);
}

.orders-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.orders-filter-note {
  margin: -0.35rem 0 1rem;
  font-size: 0.84rem;
  color: var(--ket-muted);
}

.orders-table-panel {
  margin-top: 0;
}

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

/* Таблица заказов: колонки не «ломают» соседние; свежие заказы — по убыванию № в запросе */
.orders-table.orders-table--fixed {
  table-layout: fixed;
  width: 100%;
}

.orders-table.orders-table--fixed .orders-col-id {
  width: 4.25rem;
}

.orders-table.orders-table--fixed .orders-col-ext {
  width: 7rem;
}

.orders-table.orders-table--fixed .orders-col-name {
  width: 11%;
  min-width: 7rem;
}

.orders-table.orders-table--fixed .orders-col-phone {
  width: 8.5rem;
}

.orders-table.orders-table--fixed .orders-col-addr {
  width: 28%;
  min-width: 15rem;
}

.orders-table.orders-table--fixed .orders-col-items {
  width: 18%;
  min-width: 9.5rem;
}

.orders-table.orders-table--fixed .orders-col-partner {
  width: 9%;
  min-width: 6.5rem;
}

.orders-table.orders-table--fixed .orders-col-status {
  width: 9.5rem;
  min-width: 8.25rem;
}

.orders-table.orders-table--fixed .orders-col-date {
  width: 9.25rem;
  min-width: 8rem;
}

.orders-table.orders-table--fixed .orders-col-status,
.orders-table.orders-table--fixed .orders-col-date {
  vertical-align: top;
}

.orders-table.orders-table--fixed .orders-col-date {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.orders-table.orders-table--fixed .orders-col-status .status-badge {
  white-space: nowrap;
  max-width: 100%;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.orders-id-link {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

.orders-id-link:hover {
  color: var(--ket-accent, #6366f1);
  text-decoration: underline;
}

.orders-row .td-partner {
  font-size: 0.84rem;
  color: var(--ket-muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orders-ext-id {
  display: inline-block;
  max-width: 120px;
  padding: 0.15rem 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #4338ca;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-order-place {
  vertical-align: top;
  overflow: hidden;
}

.orders-addr {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--ket-text);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.orders-comment {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--ket-muted);
  font-style: italic;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.td-items {
  vertical-align: top;
  overflow: hidden;
}

.orders-item-line {
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--ket-text);
}

.orders-item-qty {
  font-weight: 600;
  color: var(--ket-muted);
}

.orders-item-more {
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--ket-muted);
}

.orders-items-empty {
  color: var(--ket-muted);
}

.orders-empty {
  padding: 2rem 1rem;
}

/* Карточка заказа (детали) */
.order-detail-head {
  margin-bottom: 1.25rem;
}

.order-detail-back {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ket-muted);
  text-decoration: none;
}

.order-detail-back:hover {
  color: var(--ket-accent, #6366f1);
}

.order-detail-meta {
  margin-left: 0.75rem;
  font-size: 0.92rem;
  color: var(--ket-muted);
  font-weight: 500;
}

.order-detail-panel {
  margin-bottom: 1rem;
}

.order-detail-dl {
  margin: 0;
  padding: 0 1rem 1rem;
  display: grid;
  gap: 0;
}

.order-detail-row {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) 1fr;
  gap: 0.75rem 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.order-detail-row:last-child {
  border-bottom: none;
}

.order-detail-row dt {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ket-muted);
}

.order-detail-row dd {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ket-text);
  word-break: break-word;
}

.order-detail-items-table .order-detail-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  width: 6rem;
}

.order-history-list {
  margin: 0;
  padding: 0 1rem 1rem;
  list-style: none;
}

.order-history-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  font-size: 0.88rem;
}

.order-history-item:last-child {
  border-bottom: none;
}

.order-history-time {
  font-variant-numeric: tabular-nums;
  color: var(--ket-muted);
  margin-right: 0.5rem;
}

.order-history-status {
  font-weight: 600;
}

.order-history-user {
  margin-left: 0.35rem;
  color: var(--ket-muted);
  font-size: 0.82rem;
}

.order-history-note {
  margin-top: 0.35rem;
  font-size: 0.84rem;
  color: var(--ket-text);
}

/* API documentation — публичная страница (не внутри панели) */
body.page-doc-api {
  overflow: auto;
  min-height: 100%;
  height: auto;
}

.doc-api-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.doc-api-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.25rem;
  background: var(--ket-surface-solid);
  border-bottom: 1px solid var(--ket-border);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 4px 20px rgba(15, 28, 46, 0.06);
}

.doc-api-brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  text-decoration: none;
  color: inherit;
}

.doc-api-brand:hover .doc-api-brand-name {
  color: var(--ket-accent);
}

.doc-api-brand-name {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ket-text);
  letter-spacing: -0.02em;
  transition: color 0.15s ease;
}

.doc-api-brand-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ket-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.doc-api-topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.doc-api-topbar-link {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.9rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ket-accent);
  text-decoration: none;
  border-radius: var(--ket-radius-sm);
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: var(--ket-accent-soft);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.doc-api-topbar-link:hover {
  background: var(--ket-accent-hover);
  border-color: rgba(37, 99, 235, 0.5);
}

.doc-api-main {
  flex: 1;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.75rem;
  box-sizing: border-box;
}

/* API documentation page */
.doc-page {
  max-width: 1100px;
}

.doc-hero {
  margin: -0.25rem -0.5rem 1.75rem;
  padding: 2rem 1.75rem;
  border-radius: 20px;
  background: linear-gradient(145deg, #1e1b4b 0%, #312e81 40%, #4338ca 100%);
  color: #eef2ff;
  box-shadow: 0 20px 50px rgba(30, 27, 75, 0.35);
}

.doc-hero-inner {
  max-width: 720px;
}

.doc-hero-badge {
  display: inline-block;
  margin-bottom: 0.65rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c7d2fe;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.doc-hero-title {
  margin: 0 0 0.65rem;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.doc-hero-lead {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(238, 242, 255, 0.88);
}

.doc-hero-url {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.doc-hero-url-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.75;
}

.doc-hero-url-code {
  display: block;
  font-size: 0.82rem;
  word-break: break-all;
  color: #fef08a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.doc-layout {
  display: grid;
  grid-template-columns: min(220px, 32%) 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .doc-layout {
    grid-template-columns: 1fr;
  }
  .doc-toc {
    position: static;
  }
}

.doc-toc {
  position: sticky;
  top: 1rem;
  padding: 1rem 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid var(--ket-border);
  background: rgba(248, 250, 252, 0.95);
}

.doc-toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.doc-toc-link {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ket-text);
  text-decoration: none;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

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

.doc-toc-cta {
  display: block;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.5);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ket-accent);
  text-decoration: none;
}

.doc-toc-cta:hover {
  text-decoration: underline;
}

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

.doc-section {
  scroll-margin-top: 5.5rem;
  margin-bottom: 2.25rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--ket-border);
}

.doc-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.doc-section-title {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ket-text);
}

.doc-p {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--ket-text);
}

.doc-p--muted {
  color: var(--ket-muted);
  font-size: 0.86rem;
}

.doc-list {
  margin: 0 0 0.5rem;
  padding-left: 1.25rem;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ket-text);
}

.doc-table-wrap {
  overflow-x: auto;
  margin: 0.5rem 0 1rem;
  border-radius: 12px;
  border: 1px solid var(--ket-border);
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.doc-table th,
.doc-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--ket-border);
  vertical-align: top;
}

.doc-table th {
  font-weight: 600;
  color: var(--ket-muted);
  background: rgba(248, 250, 252, 0.9);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.doc-table code {
  font-size: 0.8rem;
  color: #4338ca;
}

.doc-table a {
  color: var(--ket-accent);
  font-weight: 600;
  text-decoration: none;
}

.doc-table a:hover {
  text-decoration: underline;
}

.doc-code-block {
  margin: 0.75rem 0 1rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #0f172a;
}

.doc-code-head {
  padding: 0.4rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.doc-code {
  margin: 0;
  padding: 1rem 1rem 1.1rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: #e2e8f0;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
