:root {
  --bg: #101410; --panel: #181d19; --raised: #222922; --line: #2e382f; --text: #e7eee6; --muted: #8d9a8c;
  --accent: #d6f25c; --accent-fg: #14180c; --danger: #e07a6a; --warn: #e2b657; --ok: #8dcea8;
  --ok-bg: rgba(141, 206, 168, .14); --warn-bg: rgba(226, 182, 87, .14); --danger-bg: rgba(224, 122, 106, .14);
  --radius: 14px; --radius-sm: 10px;
  --font: "Manrope", "Segoe UI", system-ui, sans-serif; --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.4; min-height: 100vh; font-size: 16px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 16px; }
h1 { font-size: 22px; margin: 0 0 6px; } h2 { font-size: 17px; margin: 0 0 10px; } h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .mono { font-family: var(--mono); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .danger { color: var(--danger); }

input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; min-height: 46px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
button, .btn { background: var(--accent); color: var(--accent-fg); border: 0; border-radius: var(--radius-sm); padding: 11px 16px; min-height: 46px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
button:disabled { opacity: .5; }
.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.danger-btn { background: var(--danger-bg); color: var(--danger); }
.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 160px; }
.row > .fit { flex: 0 0 auto; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; flex: 0 0 auto; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--raised); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.bad { background: var(--danger-bg); color: var(--danger); }
.flash { background: rgba(214, 242, 92, .1); border: 1px solid rgba(214, 242, 92, .3); padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid rgba(255, 255, 255, .05); vertical-align: top; }
.table-wrap { overflow-x: auto; }

/* админка */
.adm { max-width: 1100px; margin: 0 auto; padding: 18px 16px 60px; }
.adm-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 14px; }
.tabs a.on { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.stores { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.stores label { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; }
.login { max-width: 380px; margin: 8vh auto; padding: 0 16px; }

/* приложение */
#app { max-width: 720px; margin: 0 auto; padding-bottom: 90px; }
.bar { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 14px; display: flex; align-items: center; gap: 10px; }
.bar h1 { margin: 0; font-size: 18px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar button { min-height: 40px; padding: 6px 12px; }
.net { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.net.on { background: var(--ok-bg); color: var(--ok); } .net.off { background: var(--warn-bg); color: var(--warn); }
.pad { padding: 14px; }
.list > * { margin-bottom: 10px; }
.item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; align-items: center; cursor: pointer; }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.item .s { color: var(--muted); font-size: 13px; }
.item .q { font-family: var(--mono); font-size: 18px; text-align: right; white-space: nowrap; }
.item.done { border-left: 4px solid var(--ok); }
.item.over { border-left: 4px solid var(--danger); }
.search { position: sticky; top: 59px; z-index: 9; background: var(--bg); padding: 10px 14px; display: flex; gap: 8px; border-bottom: 1px solid var(--line); }
.search input { flex: 1; }
.tabs2 { display: flex; gap: 6px; padding: 10px 14px 0; }
.tabs2 button { flex: 1; background: var(--raised); color: var(--muted); min-height: 40px; font-size: 14px; }
.tabs2 button.on { background: var(--accent); color: var(--accent-fg); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; top: 0; background: rgba(0, 0, 0, .6); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet > div { background: var(--panel); border: 1px solid var(--line); border-radius: 20px 20px 0 0; width: 100%; max-width: 720px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 92vh; overflow-y: auto; }
.qty { font-family: var(--mono); font-size: 34px; text-align: center; min-height: 64px; }
.pad-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.pad-btns button { background: var(--raised); color: var(--text); }
.foot { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 10px; z-index: 20; max-width: 720px; margin: 0 auto; }
.foot > * { flex: 1; }
.scan { position: fixed; inset: 0; background: #000; z-index: 40; display: flex; flex-direction: column; }
.scan video { flex: 1; width: 100%; object-fit: cover; min-height: 0; }
.scan .hud { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: var(--bg); display: flex; gap: 10px; align-items: center; }
.scan .hud > div { flex: 1; font-size: 14px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; background: var(--raised); border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px; z-index: 60; max-width: 90%; text-align: center; }
.diff.pos { color: var(--warn); } .diff.neg { color: var(--danger); }
.big-btn { width: 100%; min-height: 56px; font-size: 17px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* страница входа и первого запуска */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-logo { width: 46px; height: 46px; border-radius: 13px; border: 2px solid var(--accent); display: grid; place-items: center; color: var(--accent); font-family: var(--mono); font-weight: 500; font-size: 15px; letter-spacing: .04em; flex: none; }
.auth-brand b { display: block; font-size: 20px; line-height: 1.15; }
.auth-brand span { color: var(--muted); font-size: 13px; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px 20px; }
.auth-card h1 { margin: 0 0 4px; }
.auth-card .hint { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > * { flex: none; }
.auth-card button { width: 100%; min-height: 52px; font-size: 17px; margin-top: 4px; }
.auth-err { background: var(--danger-bg); border: 1px solid rgba(224, 122, 106, .4); color: var(--danger); padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
