/* Двойное касание в Safari на iPhone приближало страницу — при сканировании и быстрых
   нажатиях это мешало (просьба владельца 14.09). touch-action: manipulation отключает
   именно двойной тап и убирает задержку 300 мс перед нажатием; щипок для увеличения
   при этом остаётся рабочим. Ставим и на весь документ, и отдельно на кликабельное —
   Safari иначе применяет правило не везде. */
html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
a, button, input, select, label, .btn, [role="button"], [onclick] {
  touch-action: manipulation;
}

:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #6b7686;
  --brand: #1f6feb;
  --brand-dark: #1857bd;
  --green: #1a8f4d;
  --red: #d43a3a;
  --amber: #b97a00;
  --border: #dfe4ec;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}

a { color: var(--brand); text-decoration: none; }

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { font-weight: 700; font-size: 17px; color: var(--text); }
.topbar nav { display: flex; gap: 12px; flex-wrap: wrap; }
.topbar .spacer { flex: 1; }
.topbar .lang a { padding: 2px 6px; border-radius: 6px; }
.topbar .lang a.active { background: var(--brand); color: #fff; }
.topbar .who { color: var(--muted); font-size: 14px; }

.container { max-width: 960px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

h1 { font-size: 22px; margin: 8px 0 14px; }
h2 { font-size: 17px; margin: 0 0 10px; }

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px;
  cursor: pointer;
  text-align: center;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: #e8edf5; color: var(--text); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.big { font-size: 18px; padding: 16px 24px; width: 100%; }
.btn.small { padding: 6px 12px; font-size: 13px; }

input[type=text], input[type=password], input[type=number], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: #fff;
}
form.inline { display: flex; gap: 8px; flex-wrap: wrap; }
form.inline input, form.inline select { flex: 1; min-width: 130px; width: auto; }
label { font-size: 13px; color: var(--muted); display: block; margin: 8px 0 4px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
.table-wrap { overflow-x: auto; }

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 600;
}
.badge.ok { background: #e3f5ea; color: var(--green); }
.badge.no { background: #fdeaea; color: var(--red); }
.badge.warn { background: #fdf3e0; color: var(--amber); }
.badge.info { background: #e7f0fe; color: var(--brand); }

.loc { color: var(--muted); font-size: 13.5px; }
.loc b { color: var(--text); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .lbl { font-size: 12.5px; color: var(--muted); }
.stat.alert .num { color: var(--red); }

.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }

.book-list { display: grid; gap: 10px; }
.book-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.book-item .meta { color: var(--muted); font-size: 13.5px; }

.msg { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 600; }
.msg.ok { background: #e3f5ea; color: var(--green); }
.msg.err { background: #fdeaea; color: var(--red); }

/* scanner */
#reader { width: 100%; max-width: 420px; margin: 0 auto; border-radius: var(--radius); overflow: hidden; }
.scan-step { text-align: center; }
.scan-result { font-size: 17px; }

/* kiosk */
.kiosk-body { background: #10203c; color: #fff; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; }
.kiosk-body h1 { font-size: 30px; }
.kiosk-body .card { color: var(--text); text-align: left; width: 100%; max-width: 720px; }

/* labels printing */
.labels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.label-item {
  border: 1px dashed #aaa;
  padding: 8px;
  text-align: center;
  background: #fff;
  break-inside: avoid;
}
.label-item img { width: 110px; height: 110px; }
.label-item .l1 { font-weight: 700; font-size: 13px; }
.label-item .l2 { font-size: 12px; color: #444; }

@media print {
  .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .container { max-width: none; padding: 0; }
}
