/* ============ Тема ============ */
:root {
  --bg:        #0b1220;
  --bg-2:      #101a2e;
  --card:      #141f36;
  --card-2:    #1a2745;
  --border:    #24344f;
  --text:      #e8eefc;
  --muted:     #93a4c4;
  --accent:    #3b82f6;
  --accent-2:  #60a5fa;
  --good:      #22c55e;
  --good-bg:   rgba(34,197,94,.13);
  --warn:      #f59e0b;
  --warn-bg:   rgba(245,158,11,.13);
  --danger:    #ef4444;
  --danger-bg: rgba(239,68,68,.12);
  --shadow:    0 10px 30px rgba(0,0,0,.45);
  --r:         14px;
  --safe-b:    env(safe-area-inset-bottom, 0px);
  --tabs-h:    0px;
}
html[data-theme="light"] {
  --bg:        #f4f6fb;
  --bg-2:      #ffffff;
  --card:      #ffffff;
  --card-2:    #f2f5fb;
  --border:    #dfe5f0;
  --text:      #121a2b;
  --muted:     #5f6f8c;
  --accent:    #2563eb;
  --accent-2:  #1d4ed8;
  --good:      #16a34a;
  --good-bg:   rgba(22,163,74,.10);
  --danger-bg: rgba(239,68,68,.08);
  --shadow:    0 8px 24px rgba(20,35,70,.10);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}
input, select, textarea, button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.big { width: 46px; height: 46px; stroke-width: 1.4; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }

/* ============ Экран входа ============ */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-box {
  width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 20px;
  padding: 30px 26px; box-shadow: var(--shadow); text-align: center;
}
.login-logo { width: 62px; height: 62px; border-radius: 16px; align-self: center; }
.login-box h1 { margin: 4px 0 0; font-size: 23px; }
.login-sub { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.login-box .field { text-align: left; }
.login-err {
  background: var(--danger-bg); color: var(--danger); border-radius: 10px;
  padding: 9px 12px; font-size: 13.5px; text-align: left;
}

/* ============ Каркас ============ */
.app { max-width: 1400px; margin: 0 auto; padding: 0 14px calc(96px + var(--safe-b) + var(--tabs-h)); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin: 0 -14px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .2px; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; }
.brand-text { font-size: 16px; }

.search { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.search .ic { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; padding: 11px 40px;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.search .icon-btn.tiny { position: absolute; right: 6px; width: 30px; height: 30px; }

.top-actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 11px;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--card); color: var(--text); }
.icon-btn:active { transform: scale(.94); }

/* ---- индикатор синхронизации ---- */
.sync-chip {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); color: var(--muted); font-size: 12.5px;
}
.sync-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.sync-chip[data-state="ok"] .dot { background: var(--good); }
.sync-chip[data-state="syncing"] .dot { background: var(--accent); animation: blink 1s infinite; }
.sync-chip[data-state="offline"] .dot { background: var(--warn); }
.sync-chip[data-state="error"] .dot { background: var(--danger); }
.sync-chip[data-state="offline"] { border-color: var(--warn); color: var(--warn); }
.sync-chip[data-state="error"] { border-color: var(--danger); color: var(--danger); }
@keyframes blink { 50% { opacity: .3; } }

/* ---- вкладки ---- */
.tabs-top { display: flex; gap: 2px; }
.tabs-bottom { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px;
  border-radius: 11px; cursor: pointer; background: none; border: 0;
  color: var(--muted); font-weight: 500; white-space: nowrap; transition: .15s;
}
.tab:hover { background: var(--card); color: var(--text); }
.tab.on { background: var(--card); color: var(--text); }
.tab .badge-n {
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; padding: 1px 6px; min-width: 18px; text-align: center;
}

/* ============ Панель фильтров ============ */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 0 2px; }
.chips { display: flex; gap: 7px; overflow-x: auto; flex: 1; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  font-size: 13.5px; transition: .15s;
}
.chip:hover { color: var(--text); }
.chip b { font-weight: 600; }
.chip .n { opacity: .65; font-size: 12px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.on .n { opacity: .85; }

.sortbox select { padding: 8px 10px; border-radius: 10px; cursor: pointer; background: var(--card); border: 1px solid var(--border); outline: none; }
.stats { color: var(--muted); font-size: 12.5px; padding: 8px 2px 12px; }

.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 2px 14px; flex-wrap: wrap; }
.view-head h2 { margin: 0; font-size: 20px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ Карточки каталога ============ */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.rows { display: flex; flex-direction: column; gap: 8px; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden; cursor: pointer; text-align: left; padding: 0;
  transition: transform .12s, border-color .15s, box-shadow .15s;
  display: flex; flex-direction: column; color: inherit;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: var(--shadow); }
.card:active { transform: scale(.985); }
.card .ph { position: relative; aspect-ratio: 4/3; background: var(--card-2); display: grid; place-items: center; color: var(--muted); }
.card .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .badge, .card .cnt {
  position: absolute; top: 8px;
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--border); padding: 3px 8px; font-size: 11.5px;
}
.card .badge { left: 8px; border-radius: 8px; font-weight: 600; letter-spacing: .3px; font-family: ui-monospace, Consolas, monospace; }
.card .cnt { right: 8px; border-radius: 999px; }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .nm { font-weight: 600; font-size: 14.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .art { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
.card .price { font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.card .price small { font-size: 12px; font-weight: 500; color: var(--muted); }
.card .pl { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12.5px; }
.card .pl .ic { width: 14px; height: 14px; }
.card .save { align-self: flex-start; background: var(--good-bg); color: var(--good); border-radius: 7px; padding: 2px 7px; font-size: 11.5px; font-weight: 600; }

.rows .card { flex-direction: row; align-items: stretch; }
.rows .card .ph { width: 92px; aspect-ratio: 1; flex: none; }
.rows .card .badge, .rows .card .cnt { display: none; }
.rows .card .body { flex-direction: row; align-items: center; gap: 14px; flex-wrap: wrap; }
.rows .card .main { flex: 1; min-width: 140px; }
.rows .card .nm { -webkit-line-clamp: 1; }

/* ============ Пустые состояния / кнопки ============ */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h2 { color: var(--text); font-size: 18px; margin: 14px 0 6px; }
.empty p { margin: 0 0 18px; }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: 11px; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  font-weight: 500; transition: .15s;
}
.btn:hover { background: var(--card-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.small { padding: 7px 12px; font-size: 13.5px; border-radius: 9px; }
.btn.wide { flex: 1; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger-text { color: var(--danger); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }

.fab {
  position: fixed; right: 18px; bottom: calc(18px + var(--safe-b) + var(--tabs-h)); z-index: 40;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 15px 20px; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #fff; border: 0; font-weight: 600;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform .12s, background .15s;
}
.fab:hover { background: var(--accent-2); }
.fab:active { transform: scale(.95); }

/* ============ Диалоги ============ */
dialog { border: 0; padding: 0; color: var(--text); background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(4,8,18,.62); backdrop-filter: blur(3px); }

.sheet {
  width: min(720px, 100%); max-height: 92vh; margin: auto;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow); overflow: hidden;
}
.sheet.wide-sheet { width: min(880px, 100%); }
.sheet.narrow { width: min(520px, 100%); }
.sheet[open] { display: flex; flex-direction: column; }
.sheet form { display: flex; flex-direction: column; min-height: 0; }
.sheet-head {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--bg-2);
}
.sheet-title { flex: 1; font-weight: 650; font-size: 16px; text-align: center; }
.sheet-body { padding: 16px; overflow: auto; -webkit-overflow-scrolling: touch; }

.modal {
  width: min(440px, calc(100% - 32px)); margin: auto; padding: 22px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 8px; font-size: 17px; }
.modal p { margin: 0 0 16px; color: var(--muted); white-space: pre-wrap; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }

/* ============ Форма ============ */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.field > span i { color: var(--accent); font-style: normal; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border-radius: 11px;
  background: var(--card); border: 1px solid var(--border); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.field input.bad { border-color: var(--danger); }
.fhint { font-size: 12.5px; color: var(--warn); font-style: normal; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-foot { display: flex; gap: 10px; align-items: center; padding-top: 4px; }
.hint { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }

/* ---- фото в форме ---- */
.photo-zone {
  border: 1.5px dashed var(--border); border-radius: var(--r); padding: 12px;
  display: flex; flex-direction: column; gap: 10px; align-items: center; transition: .15s;
}
.photo-zone.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; }
.photo-strip .thumb {
  position: relative; width: 96px; height: 96px; border-radius: 10px; overflow: hidden;
  background: var(--card); border: 1px solid var(--border);
}
.photo-strip .thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-strip .thumb .rm {
  position: absolute; right: 3px; top: 3px; width: 24px; height: 24px; border-radius: 8px;
  background: rgba(8,12,24,.72); color: #fff; border: 0; display: grid; place-items: center; cursor: pointer;
}
.photo-strip .thumb .rm .ic { width: 14px; height: 14px; }
.photo-strip .thumb .main-mark {
  position: absolute; left: 3px; bottom: 3px; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px;
}
.photo-strip .none { color: var(--muted); font-size: 13px; display: grid; place-items: center; gap: 6px; padding: 20px 0; }
.photo-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ============ Карточка товара ============ */
.detail-hero { display: flex; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.gallery { width: 260px; flex: none; }
.gallery .big-pic {
  width: 100%; aspect-ratio: 1; border-radius: var(--r); overflow: hidden;
  background: var(--card-2); display: grid; place-items: center; color: var(--muted); cursor: zoom-in;
}
.gallery .big-pic img { width: 100%; height: 100%; object-fit: cover; }
.gallery .strip { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.gallery .strip::-webkit-scrollbar { display: none; }
.gallery .strip button {
  width: 54px; height: 54px; flex: none; border-radius: 8px; overflow: hidden; padding: 0;
  border: 2px solid transparent; background: var(--card-2); cursor: pointer;
}
.gallery .strip button.on { border-color: var(--accent); }
.gallery .strip img { width: 100%; height: 100%; object-fit: cover; }

.detail-hero .meta { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 8px; }
.detail-hero h2 { margin: 0; font-size: 20px; line-height: 1.25; }
.art-code {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px;
  background: var(--card); border: 1px solid var(--border); border-radius: 9px; padding: 5px 10px; cursor: pointer;
}
.art-code .ic { width: 14px; height: 14px; color: var(--muted); }
.spread { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 11px; padding: 9px 13px; }
.kpi span { display: block; font-size: 11.5px; color: var(--muted); }
.kpi b { font-size: 17px; }
.kpi.best b { color: var(--good); }
.hero-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

.sec-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.sec-title:first-child { margin-top: 0; }

.offer {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px;
}
.offer.best { border-color: var(--good); background: var(--good-bg); }
.offer .o-main { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 3px; }
.offer .o-place { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.offer .o-place .ic { width: 15px; height: 15px; color: var(--muted); }
.offer .o-sub { font-size: 12.5px; color: var(--muted); }
.offer .o-price { font-size: 19px; font-weight: 700; text-align: right; white-space: nowrap; }
.offer .o-price small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.offer.best .o-price { color: var(--good); }
.offer .o-acts { display: flex; gap: 2px; }
.tagline { display: inline-block; background: var(--good); color: #fff; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; letter-spacing: .3px; }
.o-note { flex-basis: 100%; font-size: 13px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 8px; white-space: pre-wrap; }
.o-note a { color: var(--accent-2); }
.trend { font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 6px; }
.trend.up { background: var(--danger-bg); color: var(--danger); }
.trend.down { background: var(--good-bg); color: var(--good); }

/* ---- история цен ---- */
.spark { width: 100%; height: 90px; display: block; }
.hist-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.hist-row:last-child { border-bottom: 0; }
.hist-row .h-date { color: var(--muted); font-size: 12.5px; width: 92px; flex: none; }
.hist-row .h-place { flex: 1; min-width: 120px; }
.hist-row .h-price { font-weight: 600; white-space: nowrap; }
.hist-row .h-by { color: var(--muted); font-size: 12px; }
.box { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.box-pad { padding: 12px 14px; }

/* ============ Список закупки ============ */
.cart-place { margin-bottom: 16px; }
.cart-place h3 {
  margin: 0 0 8px; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cart-place h3 .sum { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 13.5px; }
.cart-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: 0; }
.cart-item.done { opacity: .5; }
.cart-item.done .ci-name { text-decoration: line-through; }
.cart-item .ci-pic { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; background: var(--card-2); flex: none; }
.cart-item .ci-main { flex: 1; min-width: 130px; }
.cart-item .ci-name { font-weight: 600; font-size: 14px; }
.cart-item .ci-sub { color: var(--muted); font-size: 12.5px; }
.qty { display: flex; align-items: center; gap: 4px; }
.qty input { width: 62px; text-align: center; padding: 7px 4px; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--border); outline: none; }
.qty .icon-btn { width: 32px; height: 32px; border: 1px solid var(--border); }
.cart-item .ci-sum { font-weight: 700; min-width: 92px; text-align: right; }
.check {
  width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--border);
  background: none; cursor: pointer; display: grid; place-items: center; color: transparent; flex: none;
}
.check.on { background: var(--good); border-color: var(--good); color: #fff; }
.check .ic { width: 16px; height: 16px; stroke-width: 3; }
.cart-total {
  position: sticky; bottom: calc(8px + var(--safe-b) + var(--tabs-h)); margin-top: 18px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 18px; display: flex; justify-content: space-between; align-items: center;
  box-shadow: var(--shadow); font-weight: 700; font-size: 17px;
}

/* ============ Места ============ */
.place-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 8px; display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap;
}
.place-card .pc-main { flex: 1; min-width: 180px; }
.place-card h3 { margin: 0 0 4px; font-size: 15.5px; }
.place-card .pc-sub { color: var(--muted); font-size: 13px; white-space: pre-wrap; }
.place-card .pc-stat { text-align: right; color: var(--muted); font-size: 13px; }
.place-card .pc-stat b { display: block; color: var(--text); font-size: 17px; }

/* ============ Настройки ============ */
.settings-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px; }
.panel h3 { margin: 0 0 4px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.panel .desc { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13.5px; border-bottom: 1px dashed var(--border); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; }

.user-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.user-row:last-child { border-bottom: 0; }
.user-row .u-main { flex: 1; min-width: 140px; }
.user-row .u-name { font-weight: 600; }
.user-row .u-sub { color: var(--muted); font-size: 12.5px; }
.role-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--card-2); color: var(--muted); }
.role-badge.admin { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent-2); }
.role-badge.off { background: var(--danger-bg); color: var(--danger); }
.pass-box {
  background: var(--card-2); border: 1px dashed var(--border); border-radius: 10px;
  padding: 12px; font-family: ui-monospace, Consolas, monospace; font-size: 17px;
  text-align: center; letter-spacing: 1px; margin: 10px 0; user-select: all;
}

/* ============ Просмотр фото ============ */
.viewer { width: 100vw; height: 100dvh; max-width: none; background: rgba(4,8,18,.94); }
.viewer[open] { display: grid; place-items: center; }
.viewer img { max-width: 94vw; max-height: 88dvh; object-fit: contain; border-radius: 8px; }
.viewer .icon-btn { position: fixed; color: #fff; background: rgba(255,255,255,.1); width: 46px; height: 46px; }
.viewer-close { top: 16px; right: 16px; }
.viewer-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.viewer-next { right: 12px; top: 50%; transform: translateY(-50%); }
.viewer-count { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); color: #fff; opacity: .75; font-size: 13px; }

/* ============ Тост / загрузка ============ */
.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b) + var(--tabs-h)); transform: translateX(-50%);
  z-index: 200; max-width: calc(100% - 32px);
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 18px; box-shadow: var(--shadow); font-size: 14px; text-align: center;
  animation: pop .18s ease-out;
}
.toast.err { border-color: var(--danger); color: var(--danger); }
.toast.ok { border-color: var(--good); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }

.busy {
  position: fixed; inset: 0; z-index: 300; display: flex; gap: 14px;
  align-items: center; justify-content: center; flex-direction: column;
  background: rgba(4,8,18,.6); backdrop-filter: blur(3px); color: #fff;
}
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Телефон ============ */
@media (max-width: 860px) {
  :root { --tabs-h: 62px; }
  .app { padding: 0 10px calc(96px + var(--safe-b) + var(--tabs-h)); }
  .topbar { flex-wrap: wrap; padding: 8px 10px; margin: 0 -10px; }
  .brand-text { display: none; }
  .brand { flex: none; }
  .search { order: 3; flex-basis: 100%; }
  .tabs-top { display: none; }
  .top-actions { margin-left: auto; }
  .sync-chip { padding: 6px 10px; }

  .tabs-bottom {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    display: flex; justify-content: space-around; align-items: stretch;
    padding: 6px 4px calc(6px + var(--safe-b));
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(14px); border-top: 1px solid var(--border);
  }
  .tabs-bottom .tab {
    flex-direction: column; gap: 3px; padding: 5px 8px; font-size: 11px; flex: 1;
    border-radius: 10px; position: relative;
  }
  .tabs-bottom .tab.on { background: none; color: var(--accent); }
  .tabs-bottom .tab .badge-n { position: absolute; top: 0; right: 22%; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .card .price { font-size: 17px; }
  .fab span { display: none; }
  .fab { padding: 17px; right: 14px; }
  .sheet, .sheet.wide-sheet, .sheet.narrow { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
  .row-2 { grid-template-columns: 1fr; }
  .gallery { width: 100%; }
  .gallery .big-pic { aspect-ratio: 4/3; }
  .offer .o-price { font-size: 17px; }
  .cart-item .ci-sum { min-width: 70px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
