/* PAN · мобильное приложение. Тёмная и светлая темы, крупные touch-цели. */
:root {
  color-scheme: light;
  --bg: #eef2f8;
  --bg-soft: #f7f9fc;
  --panel: #ffffff;
  --panel-2: #f3f6fb;
  --text: #111827;
  --muted: #64748b;
  --line: #dfe6f1;
  --line-strong: #c9d5e6;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --brand-soft: #dbeafe;
  --green: #0f9f6e;
  --green-soft: #d9f7ec;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --red: #c0262d;
  --red-soft: #fee2e2;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --shadow-sm: 0 3px 12px rgba(15, 23, 42, .07);
  --radius: 18px;
  --radius-sm: 12px;
  --header-h: 58px;
  --nav-h: 66px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none;
  text-size-adjust: 100%;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070d18;
  --bg-soft: #0b1322;
  --panel: #111c2e;
  --panel-2: #16243a;
  --text: #e8eef8;
  --muted: #93a4bd;
  --line: #223149;
  --line-strong: #334662;
  --brand: #5b8cff;
  --brand-strong: #3f74f4;
  --brand-soft: #172c55;
  --green: #3ddc9a;
  --green-soft: #10372a;
  --amber: #fbbf24;
  --amber-soft: #3a2a0b;
  --red: #ff7a7a;
  --red-soft: #421b1f;
  --shadow: 0 14px 34px rgba(0, 0, 0, .35);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .25);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --bg: #070d18;
    --bg-soft: #0b1322;
    --panel: #111c2e;
    --panel-2: #16243a;
    --text: #e8eef8;
    --muted: #93a4bd;
    --line: #223149;
    --line-strong: #334662;
    --brand: #5b8cff;
    --brand-strong: #3f74f4;
    --brand-soft: #172c55;
    --green: #3ddc9a;
    --green-soft: #10372a;
    --amber: #fbbf24;
    --amber-soft: #3a2a0b;
    --red: #ff7a7a;
    --red-soft: #421b1f;
    --shadow: 0 14px 34px rgba(0, 0, 0, .35);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
svg { width: 22px; height: 22px; flex: none; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 8px);
}

/* ---------- Шапка ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: calc(var(--header-h) + var(--safe-top));
  padding: var(--safe-top) 14px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.app-title {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.app-title-main {
  font-weight: 800;
  letter-spacing: .04em;
  font-size: 17px;
}
.app-title-sub {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header-actions { display: flex; gap: 2px; }
.icon-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
}
.icon-btn:active { background: var(--panel-2); }
.icon-btn:disabled { opacity: .35; }

.app-main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 14px 8px;
  outline: none;
}
.app-main.is-scanning { padding: 0; max-width: none; }

/* ---------- Загрузка ---------- */
.boot-screen {
  min-height: 60dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}
.boot-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: .06em;
  box-shadow: var(--shadow);
}
.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(100deg, var(--panel-2) 30%, var(--line) 50%, var(--panel-2) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.1s infinite linear;
}
@keyframes shimmer { to { background-position: -120% 0; } }

/* ---------- Нижняя навигация ---------- */
.bottom-nav {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding: 4px 6px var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.bottom-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  min-width: 0;
  border-radius: 12px;
}
.bottom-link span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bottom-link.active { color: var(--brand); }
.bottom-link svg { width: 23px; height: 23px; }
.bottom-scan { position: relative; color: var(--muted); }
.scan-fab {
  width: 54px;
  height: 54px;
  margin-top: -26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .38);
  border: 4px solid var(--panel);
}
.bottom-scan.active .scan-fab { transform: translateY(-1px); }
.bottom-scan .scan-fab svg { width: 26px; height: 26px; }

/* ---------- Общие элементы ---------- */
.page { display: flex; flex-direction: column; gap: 14px; }
.page-head { display: flex; align-items: flex-start; gap: 10px; }
.page-head h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -.02em;
}
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.page-head-actions { margin-left: auto; display: flex; gap: 6px; }
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 2px 0;
}
.section-title h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: .01em;
}
.section-title a, .section-title button {
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 18px;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(255,255,255,.22) 0%, transparent 55%),
    linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: #fff;
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -50px;
  bottom: -90px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
}
.hero-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; opacity: .78; }
.hero h1 { margin: 6px 0 0; font-size: 25px; letter-spacing: -.03em; }
.hero p { margin: 6px 0 0; font-size: 13px; opacity: .85; max-width: 40ch; }
.hero-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.hero .btn { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.24); backdrop-filter: blur(4px); }
.hero .btn-primary { background: #fff; color: #1d4ed8; border-color: #fff; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-align: left;
}
.stat:active { transform: scale(.985); }
.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
}
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-icon svg { width: 20px; height: 20px; }
.stat-value { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.stat-label { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-pad { padding: 15px; }
.card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.card-row:last-child { border-bottom: 0; }
.card-row:active { background: var(--panel-2); }
.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--brand);
  flex: none;
}
.card-icon svg { width: 20px; height: 20px; }
.card-main { min-width: 0; flex: 1; }
.card-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-sub {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-meta { color: var(--muted); font-size: 11px; margin-top: 4px; }
.chevron { color: var(--line-strong); flex: none; }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}
.list-item:last-child { border-bottom: 0; }
.list-item:active { background: var(--panel-2); }
button.list-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
button.list-item:last-child { border-bottom: 0; }
.list-item-main { min-width: 0; flex: 1; }
.list-title {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.list-sub {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.list-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex: none;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.3;
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-blue { background: var(--brand-soft); color: var(--brand); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-gray { background: var(--panel-2); color: var(--muted); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.chip:active { transform: scale(.97); }

.search-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  min-height: 46px;
  box-shadow: var(--shadow-sm);
}
.search-bar svg { color: var(--muted); width: 20px; height: 20px; }
.search-bar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 15px;
  padding: 12px 0;
}
.search-bar .icon-btn { width: 34px; height: 34px; margin-right: -6px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 650; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 12px 13px;
  font-size: 15px;
  outline: none;
  min-height: 46px;
}
.textarea { min-height: 86px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .wide { grid-column: 1 / -1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 10px 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-soft { background: var(--red-soft); border-color: transparent; color: var(--red); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 7px 11px; font-size: 12.5px; border-radius: 10px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; min-width: 130px; }

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #60a5fa);
  transition: width .25s ease;
}
.progress-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--muted); margin-top: 6px; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.detail-row {
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.detail-row:nth-last-child(-n+2) { border-bottom: 0; }
.detail-row.wide { grid-column: 1 / -1; }
.detail-row dt { font-size: 11px; color: var(--muted); margin: 0 0 3px; }
.detail-row dd { margin: 0; font-size: 13.5px; line-height: 1.4; word-break: break-word; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .95em; }
.muted { color: var(--muted); }
.pre-line { white-space: pre-line; }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: 11px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
}
.timeline-item:last-child { border-bottom: 0; }
.timeline-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
  margin-top: 5px;
  flex: none;
}
.timeline-main { min-width: 0; }
.timeline-title { font-size: 13px; line-height: 1.4; }
.timeline-date { font-size: 11px; color: var(--muted); margin-top: 2px; }

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
}
.empty svg { width: 40px; height: 40px; opacity: .5; margin-bottom: 8px; }
.empty p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.error-box {
  padding: 14px;
  border-radius: 14px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid color-mix(in srgb, var(--red) 25%, transparent);
}
.info-box {
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12.5px;
  line-height: 1.5;
}
.offline-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
}
.offline-banner svg { width: 17px; height: 17px; }

.barcode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
  border: 1px dashed var(--line-strong);
  word-break: break-all;
}
.qr-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
}
.qr-preview img, .qr-preview svg {
  width: 108px;
  height: 108px;
  border-radius: 10px;
  background: #fff;
  padding: 6px;
  flex: none;
}

/* ---------- Сканер ---------- */
.scan-page {
  min-height: calc(100dvh - var(--nav-h) - var(--safe-bottom));
  margin: -14px;
  background: #05080f;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.camera-wrap {
  position: relative;
  flex: 1;
  min-height: 58dvh;
  background: #05080f;
}
.camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, transparent 0 26%, rgba(0,0,0,.52) 60%, rgba(0,0,0,.72) 100%);
  pointer-events: none;
}
.scan-frame {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(68vw, 290px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 22px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .18);
  pointer-events: none;
}
.scan-frame::before,
.scan-frame::after,
.scan-frame span::before,
.scan-frame span::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  border: 3px solid #fff;
  border-radius: 4px;
}
.scan-frame::before { left: -1px; top: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: 20px; }
.scan-frame::after { right: -1px; top: -1px; border-left: 0; border-bottom: 0; border-top-right-radius: 20px; }
.scan-frame span::before { left: -1px; bottom: -1px; border-right: 0; border-top: 0; border-bottom-left-radius: 20px; }
.scan-frame span::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: 20px; }
.scan-line {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 12%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #60a5fa, transparent);
  animation: scanline 2.2s ease-in-out infinite;
}
@keyframes scanline {
  0%, 100% { transform: translateY(0); opacity: .5; }
  50% { transform: translateY(min(58vw, 250px)); opacity: 1; }
}
.camera-top {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: 0;
  padding: calc(var(--safe-top) + 10px) 14px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, rgba(0,0,0,.55), transparent);
}
.camera-top .icon-btn { color: #fff; background: rgba(255,255,255,.14); }
.camera-title { flex: 1; font-weight: 700; font-size: 15px; }
.camera-bottom {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 16px calc(16px + var(--safe-bottom));
  background: linear-gradient(0deg, rgba(0,0,0,.78), rgba(0,0,0,0));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.camera-hint {
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
  max-width: 32ch;
  color: rgba(255,255,255,.86);
}
.camera-actions { display: flex; align-items: center; gap: 14px; }
.round-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.14);
  color: #fff;
  display: grid;
  place-items: center;
  backdrop-filter: blur(8px);
}
.round-btn.active { background: #fff; color: #111827; }
.round-btn:disabled { opacity: .35; }
.scan-status {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  font-size: 12.5px;
  text-align: center;
}
.scan-status.error { background: rgba(220, 38, 38, .25); border-color: rgba(255, 120, 120, .5); }
.scan-manual {
  position: relative;
  z-index: 3;
  padding: 14px 16px calc(18px + var(--safe-bottom));
  background: #0b1220;
  border-top: 1px solid rgba(255,255,255,.12);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.scan-manual .field > span { color: rgba(255,255,255,.6); }
.scan-manual .input {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.18);
  color: #fff;
}
.scan-manual .input::placeholder { color: rgba(255,255,255,.38); }
.scan-result {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 24px 24px 0 0;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 -20px 60px rgba(0,0,0,.4);
  padding: 8px 0 calc(14px + var(--safe-bottom));
  animation: slideUp .22s ease;
  max-height: 72dvh;
  overflow-y: auto;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: .4; } }
.scan-result-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 8px;
}
.scan-result-head h2 { margin: 0; font-size: 18px; line-height: 1.25; flex: 1; min-width: 0; }
.scan-result-body { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.scan-result-actions { display: flex; gap: 8px; padding: 14px 16px 0; flex-wrap: wrap; }
.scan-result-actions .btn { flex: 1; min-width: 130px; }

/* ---------- Модальные окна ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(4, 9, 20, .55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn .16s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.sheet {
  width: 100%;
  max-width: 760px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--panel);
  border-radius: 22px 22px 0 0;
  padding-bottom: calc(16px + var(--safe-bottom));
  animation: slideUp .2s ease;
}
.sheet-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 16px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font-size: 17px; flex: 1; }
.sheet-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.sheet-actions { display: flex; gap: 8px; padding: 4px 16px 0; flex-wrap: wrap; }
.sheet-actions .btn { flex: 1; min-width: 130px; }
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: var(--panel-2);
  color: var(--muted);
  display: grid;
  place-items: center;
}

/* ---------- Тосты ---------- */
.toast-root {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  transform: translateX(-50%);
  width: min(92vw, 440px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border-radius: 13px;
  background: #111827;
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 12px 30px rgba(0,0,0,.3);
  animation: toastIn .2s ease;
}
.toast.success { background: #0b7a55; }
.toast.error { background: #a51f26; }
.toast.warn { background: #92400e; }
.toast svg { width: 18px; height: 18px; margin-top: 1px; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Ярлык QR ---------- */
.label-page {
  min-height: 100dvh;
  background: #eef2f8;
  color: #111827;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 40px;
  gap: 16px;
}
.label-card {
  width: min(100%, 360px);
  background: #fff;
  border: 1px solid #d8e0ec;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(15,23,42,.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.label-qr { width: 220px; height: 220px; }
.label-qr svg { width: 100%; height: 100%; }
.label-title { margin: 0; font-size: 17px; line-height: 1.3; }
.label-sub { margin: 0; color: #64748b; font-size: 13px; }
.label-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f1f5f9;
  word-break: break-all;
}
.label-meta { color: #64748b; font-size: 11.5px; }
.label-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.label-actions .btn { min-height: 40px; }
@media print {
  .label-page { background: #fff; padding: 0; }
  .label-card { box-shadow: none; border: 0; width: 100%; }
  .label-actions { display: none; }
}

/* ---------- Адаптив ---------- */
@media (min-width: 560px) {
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-row:nth-last-child(-n+2) { border-bottom: 1px solid var(--line); }
  .detail-row:nth-last-child(-n+3) { border-bottom: 0; }
}
@media (max-width: 360px) {
  .bottom-link { font-size: 9.5px; }
  .scan-fab { width: 50px; height: 50px; }
  .stat { padding: 11px; gap: 9px; }
  .stat-value { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
