/* ============================================
   Ozon Cleaner SaaS — стили
   ============================================ */

:root {
  --bg:            #f0f2f7;
  --surface:       #ffffff;
  --sidebar-bg:    #1c2340;
  --sidebar-hover: #262d4d;
  --sidebar-active:#4f46e5;
  --sidebar-text:  #8892b0;
  --sidebar-title: #ccd6f6;
  --primary:       #4f46e5;
  --primary-h:     #4338ca;
  --success:       #10b981;
  --danger:        #ef4444;
  --warning:       #f59e0b;
  --info:          #3b82f6;
  --text:          #1f2937;
  --text-muted:    #6b7280;
  --border:        #e5e7eb;
  --radius:        10px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:     0 4px 12px rgba(0,0,0,.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== AUTH PAGES ===== */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1c2340 0%, #2d3561 100%);
  padding: 20px;
}

.auth-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.auth-logo p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

/* ===== LAYOUT ===== */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-logo h1 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo span.badge {
  font-size: 10px;
  background: var(--primary);
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.nav-section {
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px;
  margin: -8px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}
.sidebar-user:hover { background: var(--sidebar-hover); }
.sidebar-user.active { background: var(--sidebar-active); }

.sidebar-user .avatar {
  width: 34px; height: 34px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 14px;
  flex-shrink: 0;
}

.sidebar-user .info { flex: 1; min-width: 0; }
.sidebar-user .info .name { color: var(--sidebar-title); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .info .sub  { color: var(--sidebar-text); font-size: 11px; }

.profile-page { max-width: 560px; }
.profile-msg { font-size: 13px; min-height: 18px; margin-top: 12px; color: var(--text-muted); }
.profile-msg.ok { color: var(--success); }
.profile-msg.err { color: var(--danger); }
.profile-page .btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.profile-page .btn-primary:hover { background: var(--primary-h); }
.profile-page .btn-primary:disabled { opacity: 0.5; cursor: default; }

/* Main content */
.main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

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

.page-content {
  padding: 28px;
  flex: 1;
}

/* ===== COMPONENTS ===== */

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.card-body { padding: 20px; }

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #eff6ff; }
.stat-icon.green  { background: #f0fdf4; }
.stat-icon.yellow { background: #fffbeb; }
.stat-icon.red    { background: #fef2f2; }
.stat-icon.purple { background: #f5f3ff; }

.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1; }

/* Tables */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-gray    { background: #f3f4f6; color: #374151; }
.badge-purple  { background: #ede9fe; color: #5b21b6; }

/* Forms */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 5px;
}

input[type=text], input[type=email], input[type=password], input[type=number],
select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

input[type=checkbox] { width: auto; }

.form-help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, box-shadow .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(.98); }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); text-decoration: none; color: #fff; }

.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; text-decoration: none; color: #fff; }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; text-decoration: none; color: #fff; }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f9fafb; text-decoration: none; }

.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-full { width: 100%; justify-content: center; }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* Separator */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Pagination */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  padding: 16px 0 4px;
}

.pagination a, .pagination span {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
}

.pagination a:hover { background: var(--bg); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }

/* Shop card */
.shop-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.shop-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border-left: 4px solid var(--border);
  transition: box-shadow .15s;
}

.shop-card:hover { box-shadow: var(--shadow-md); }
.shop-card.status-ok    { border-left-color: var(--success); }
.shop-card.status-error { border-left-color: var(--danger); }
.shop-card.status-running { border-left-color: var(--warning); }
.shop-card.inactive { opacity: .6; }

.shop-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.shop-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.shop-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.shop-meta-item .label { font-size: 11px; color: var(--text-muted); margin-bottom: 1px; }
.shop-meta-item .value { font-size: 13.5px; font-weight: 600; }

.shop-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 38px; height: 22px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #d1d5db;
  border-radius: 22px;
  transition: .2s;
}

.slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}

input:checked + .slider { background: var(--success); }
input:checked + .slider::before { transform: translateX(16px); }

/* Utilities */
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 12.5px; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.fw-600      { font-weight: 600; }
.fw-700      { font-weight: 700; }
.mt-4        { margin-top: 4px; }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.mb-16       { margin-bottom: 16px; }
.mb-24       { margin-bottom: 24px; }
.d-flex      { display: flex; }
.align-center{ align-items: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.flex-1      { flex: 1; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main    { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .shop-cards { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

/* ===== Labels module overrides ===== */
:root {
  --muted: var(--text-muted);
  --accent: var(--primary);
  --accent-fg: #fff;
  --border-mid: #d1d5db;
  --info-bg: #eff6ff;
  --info-text: #1e40af;
}

#loginPage, #registerPage, #appPage { display: none; }
#appPage.app-layout.open { display: flex; }

.auth-card h1 { font-size: 20px; font-weight: 700; margin-bottom: 0.25rem; }
.auth-card .subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 1.5rem; }
.auth-card .field { margin-bottom: 1rem; }
.auth-card .field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.auth-card .field input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 7px; font-size: 14px; background: #f9fafb; color: var(--text); outline: none; }
.auth-card .field input:focus { border-color: var(--primary); background: #fff; }
.auth-card .btn { width: 100%; justify-content: center; display: flex; background: var(--primary); color: #fff; }
.auth-card .btn:hover { background: var(--primary-h); }
.auth-card .btn:disabled { opacity: 0.45; cursor: default; }
.hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.err-msg { font-size: 12px; color: var(--danger); margin-top: 0.75rem; min-height: 18px; }
.switch-link { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: 1.25rem; }
.switch-link a { color: var(--primary); cursor: pointer; text-decoration: underline; }
.section-sep { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); margin: 1.5rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.api-notice { background: var(--info-bg); color: var(--info-text); font-size: 12px; border-radius: 7px; padding: 10px 12px; margin-bottom: 1rem; line-height: 1.5; }

.nav-item { border: none; background: none; width: 100%; text-align: left; font: inherit; }
.nav-item.sub { padding-left: 42px; font-size: 12.5px; }
.nav-group { margin-bottom: 4px; }
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--sidebar-title);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.nav-group-toggle:hover { background: var(--sidebar-hover); color: #fff; }
.nav-group-toggle .label { flex: 1; }
.nav-group-toggle .chevron {
  font-size: 11px;
  color: rgba(255,255,255,.45);
  transition: transform .2s ease;
}
.nav-group.open .nav-group-toggle .chevron { transform: rotate(180deg); }
.nav-sub {
  display: none;
  padding-bottom: 6px;
}
.nav-group.open .nav-sub { display: block; }
.nav-group.open > .nav-group-toggle { color: #fff; }

.topbar-user-wrap { position: relative; }
.topbar-user-btn { font-size: 13px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 6px 10px; cursor: pointer; }
.topbar-user-btn:hover { background: #e5e7eb; }
.cabinet-pop { display: none; position: absolute; right: 0; top: calc(100% + 8px); width: min(360px, calc(100vw - 2rem)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); padding: 14px; z-index: 60; }
.cabinet-pop.open { display: block; }
.cabinet-pop h2 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.cabinet-pop .field { margin-bottom: 0.7rem; }
.cabinet-pop .field label { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.cabinet-pop .field input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; background: #f9fafb; color: var(--text); outline: none; }
.cabinet-actions { display: flex; gap: 8px; margin-top: 4px; }
.cabinet-actions .btn { width: auto; flex: 1; justify-content: center; background: var(--primary); color: #fff; }
.cabinet-msg { font-size: 12px; min-height: 16px; margin-top: 8px; color: var(--text-muted); }
.cabinet-msg.ok { color: var(--success); }
.cabinet-msg.err { color: var(--danger); }

.view { display: none; }
.view.active { display: block; }
.stub-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; max-width: 640px; }
.stub-card h3 { font-size: 18px; margin-bottom: 8px; }
.stub-card p { color: var(--text-muted); line-height: 1.5; }

.card .field { margin-bottom: 1rem; }
.card .field:last-of-type { margin-bottom: 1.25rem; }
.card .field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.card .field input[type="text"],
.card .field input[type="email"],
.card .field input[type="number"],
.card .field input[type="password"] {
  width: 100%; max-width: 420px; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 7px; font-size: 14px; background: #f9fafb; color: var(--text); outline: none;
}
.card .field input:focus { border-color: var(--primary); background: #fff; }
.card .field input[type="checkbox"] { width: auto; margin-right: 6px; vertical-align: middle; }
.card .field label:has(input[type="checkbox"]) {
  display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); cursor: pointer;
}

.cleaner-settings { max-width: 640px; display: flex; flex-direction: column; gap: 0; }
.mb-16 { margin-bottom: 16px; }
.card-body .shop-card-meta { margin-top: 0; }
.card-body .alert { margin-bottom: 0; }
.card-body .alert.mb-16 { margin-bottom: 16px; }

.controls-sticky { position: sticky; top: 0; z-index: 9; background: rgba(240,242,247,0.96); backdrop-filter: blur(8px); padding: 0 0 0.75rem; margin: 0 0 1rem; border-bottom: 1px solid var(--border); }
.filters-bar { display: flex; gap: 10px; margin-bottom: 0.75rem; flex-wrap: wrap; align-items: flex-end; }
.filters-bar-filter { margin-bottom: 1rem; }
.filters-bar-filter .filter-input-wrap input { min-width: 280px; }
.filters-bar label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 3px; }
.filters-bar select, .filters-bar input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; background: var(--surface); color: var(--text); width: auto; }
.filters-bar input { min-width: 220px; }
.filter-group { display: flex; gap: 8px; align-items: flex-end; }
.filter-group > div { display: flex; flex-direction: column; }
.filter-input-wrap { position: relative; }
.filter-input-wrap input { padding-right: 30px; }
.filter-clear { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border: none; border-radius: 50%; background: rgba(0,0,0,0.08); color: var(--text-muted); cursor: pointer; font-size: 14px; line-height: 18px; display: none; }
.filter-clear.visible { display: block; }
.btn-load { padding: 8px 18px; background: var(--primary); color: #fff; border: none; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-load:disabled { opacity: 0.4; cursor: default; }
.status { font-size: 12px; color: var(--text-muted); margin-bottom: 1rem; min-height: 18px; }
.status.err { color: var(--danger); }
.status.ok { color: var(--success); }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar label { font-size: 13px; display: flex; align-items: center; gap: 6px; cursor: pointer; margin-bottom: 0; font-weight: 400; }
.btn-print { padding: 10px 22px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; flex: 0 0 auto; white-space: nowrap; }
.btn-print:disabled { opacity: 0.35; cursor: default; }
.btn-print:hover:not(:disabled) { background: var(--primary-h); }

.print-dock {
  position: fixed;
  left: 240px;
  right: 0;
  bottom: 0;
  z-index: 80;
  display: flex;
  justify-content: center;
  padding: 0 20px 20px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .2s ease, transform .2s ease;
}
.print-dock.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.print-dock-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 920px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  padding: 12px 16px;
}
.print-dock-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 110px;
}
.print-dock-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.print-dock-clear {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.print-dock-clear:hover { background: #e5e7eb; color: var(--text); }
.print-dock-opts {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  flex-wrap: wrap;
}
.print-dock-opts label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
}
.print-dock-opts select {
  width: auto;
  min-width: 200px;
  max-width: 260px;
  padding: 7px 10px;
  font-size: 13px;
  flex: 0 0 auto;
}
body.print-dock-open #view-labels .orders {
  padding-bottom: 100px;
}

@media (max-width: 900px) {
  .print-dock { left: 0; }
  .print-dock-inner { flex-direction: column; align-items: stretch; }
  .print-dock-opts { width: 100%; }
  .print-dock-opts select { max-width: none; width: 100%; }
  .btn-print { width: 100%; }
}
#statusFilter { display: none; }

.orders-rail-wrap {
  --rail-pad: 84px;
  --rail-inset: 56px;
  --dot-size: 12px;
  position: relative;
  max-width: 900px;
}
.orders-rail-wrap.has-rail {
  max-width: calc(900px + var(--rail-pad));
}
.orders {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 900px;
  position: relative;
}
.orders-rail-wrap.has-rail .orders {
  max-width: 100%;
  padding-right: var(--rail-pad);
  box-sizing: border-box;
}
/* полоса привязана к .orders — тому же боксу, от которого считается left:100% у карточек */
.orders-rail-wrap.has-rail .orders::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: var(--rail-inset);
  width: 2px;
  background: #d1d5db;
  border-radius: 1px;
  pointer-events: none;
  z-index: 1;
}
.group-rail-mark {
  display: none;
  position: absolute;
  left: 100%;
  top: 16px;
  /* центр точки на центре полосы: (pad - inset) + 1px - half dot */
  margin-left: calc(var(--rail-pad) - var(--rail-inset) + 1px - var(--dot-size) / 2);
  align-items: center;
  gap: 8px;
  width: auto;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}
.orders-rail-wrap.has-rail .group-rail-mark { display: flex; }
.group-rail-dot {
  display: block;
  flex: 0 0 auto;
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #d1d5db;
  box-sizing: border-box;
}
.group-rail-count {
  display: inline-block;
  margin: 0;
  padding: 2px 7px;
  border-radius: 6px;
  background: #111827;
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.package { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.package-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.package.unprinted .package-bar { background: #fff8e6; border-color: #f1d77a; }
.package-title { font-size: 13px; font-weight: 600; }
.package-meta { font-size: 12px; color: var(--text-muted); }
.package-select { font-size: 12px; display: flex; align-items: center; gap: 6px; cursor: pointer; margin-left: auto; }
.btn-pack-pdf { padding: 6px 12px; font-size: 12px; background: var(--primary); color: #fff; border: none; border-radius: 6px; cursor: pointer; }
.order-card { background: #fafaf8; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; position: relative; box-shadow: var(--shadow); }
.order-card.printed { background: #eef8f2; border-color: rgba(16, 185, 129, 0.35); }
.order-card.multi { background: #f5f0fa; border-color: rgba(120, 90, 160, 0.18); }
.order-card.multi.printed { background: #e8f3f0; border-color: rgba(40, 130, 110, 0.25); }
.order-card.group-start { border-left: 6px solid #f1d77a; margin-top: 10px; }
.order-card.group-start::before { content: attr(data-group-label); position: absolute; left: -6px; top: -9px; max-width: 70%; padding: 2px 8px; border-radius: 999px; background: #fff3bf; color: #6b5600; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 1; }
.order-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.order-num { font-size: 14px; font-weight: 600; }
.order-num-btn { font: inherit; font-weight: 600; background: none; border: none; padding: 0; cursor: pointer; color: inherit; text-align: left; }
.order-num-btn:hover { text-decoration: underline; }
.order-num .num-highlight { background: #fff3bf; border: 1px solid #f1d77a; border-radius: 4px; padding: 0 3px; font-weight: 800; }
.order-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--info-bg); color: var(--info-text); }
.order-badge.done { background: #e8f7ef; color: var(--success); }
.order-date { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.btn-icon { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 4px 8px; font-size: 13px; cursor: pointer; }
.orders table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.orders th { text-align: left; font-weight: 500; color: var(--text-muted); padding: 4px 6px 4px 0; border-bottom: 1px solid var(--border); background: transparent; text-transform: none; letter-spacing: 0; font-size: 12px; }
.orders td { padding: 5px 6px 5px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.orders tr:last-child td { border-bottom: none; }
.td-name { max-width: 280px; line-height: 1.4; }
.name-cell { display: flex; align-items: flex-start; gap: 8px; }
.prod-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 5px; background: #ececec; flex-shrink: 0; }
.qty-pill { display: inline-block; background: var(--bg); border-radius: 4px; padding: 1px 7px; font-weight: 600; font-size: 11.5px; }
.empty { text-align: center; padding: 4rem 1rem; color: var(--text-muted); font-size: 14px; }
.spinner { display: inline-block; width: 11px; height: 11px; border: 1.5px solid var(--border); border-top-color: var(--text); border-radius: 50%; animation: spin 0.7s linear infinite; margin-right: 5px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(20,20,20,0.45); z-index: 200; display: none; align-items: center; justify-content: center; padding: 1rem; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border-radius: 12px; width: min(640px, 100%); max-height: min(90vh, 860px); overflow: auto; box-shadow: 0 18px 50px rgba(0,0,0,0.22); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-title { font-size: 16px; font-weight: 600; flex: 1; }
.modal-close { border: none; background: var(--bg); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 18px; color: var(--text-muted); }
.modal-body { padding: 1rem 1.25rem 1.35rem; }
.modal-loading, .modal-error { font-size: 13px; color: var(--text-muted); padding: 1.5rem 0; text-align: center; }
.modal-error { color: var(--danger); }
.detail-grid { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 13px; margin-bottom: 1.1rem; }
.detail-grid .k { color: var(--text-muted); }
.detail-grid .v { word-break: break-word; }
.detail-section { margin-top: 0.85rem; }
.detail-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 8px; }
.pvz-box { background: #f4f7ff; border: 1px solid #d7e2ff; border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.45; }
.pvz-box strong { display: block; margin-bottom: 6px; }
.pvz-main { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.pvz-meta { color: var(--text-muted); font-size: 12.5px; }
.detail-products { display: flex; flex-direction: column; gap: 8px; }
.detail-product { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.detail-product img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: #ececec; }
.detail-product .p-name { font-size: 13px; font-weight: 500; }
.detail-product .p-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

@media screen { .print-only { display: none !important; } }
@media print {
  body > *:not(.print-only) { display: none !important; }
  .print-only { display: block !important; }
  @page { size: 58mm 80mm; margin: 0; }
  .label-pair { page-break-after: always; }
  .label { width: 58mm; height: 80mm; overflow: hidden; padding: 3mm; font-family: Arial, sans-serif; display: flex; flex-direction: column; }
  .label-mine { font-size: 7.5pt; gap: 1.5mm; display: flex; flex-direction: column; }
  .lm-title { font-size: 9pt; font-weight: bold; line-height: 1.35; padding-bottom: 1.5mm; margin-bottom: 1mm; border-bottom: 0.4px solid #ddd; }
  .lm-row { display: flex; justify-content: space-between; gap: 2mm; }
  .lm-key { color: #777; flex-shrink: 0; }
  .lm-val { font-weight: 700; text-align: right; }
  .lm-order { font-size: 6.5pt; color: #aaa; margin-top: auto; padding-top: 1.5mm; border-top: 0.4px solid #eee; }
}

@media (max-width: 768px) {
  .sidebar { display: flex !important; position: relative; width: 100%; min-width: 0; height: auto; }
  .app-layout { flex-direction: column; }
  .main { margin-left: 0; }
}
