/* Кабинет «Изделия»: свой цвет и раскладка поверх общих стилей кабинета маникюра (/app.css).
   Цвета меняются здесь, в одном месте. Тёмная тема — те же имена ниже, в @media; новый цвет — в оба места,
   контраст текста — не ниже 4,5:1, рамок полей — не ниже 3:1. Цвет — изумрудный (выбор жены 30.11.2026, опросник,
   вопрос 22; её фон для фото — тоже изумрудный атлас). */
:root {
  --bg: #eff6f2; --card: #ffffff; --text: #1b2a23; --muted: #56695f; --line: #d3e4da;
  --accent: #0b6b4c; --accent-text: #ffffff; --accent-soft: #d6eee2;
  --field-line: #6f8a7d; --free-text: #8fa79b;
  --level-full: #2f6f4f; --level-half: #7a5c00; --level-low: #a8481f; --level-none: #8a3030;
  --tile-bg: #e3efe8;
  --toast-action: #b9ecd4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1813; --card: #17231d; --text: #e5f2eb; --muted: #a4bcb0; --line: #2d4036;
    --accent: #5fd3a3; --accent-text: #0e1f17; --accent-soft: #1d3d2f;
    --field-bg: #111c17; --field-line: #7b968a; --free-text: #8aa497;
    --level-full: #84d3a5; --level-half: #f0d27a; --level-low: #f29b78; --level-none: #f2a0a0;
    --tile-bg: #22302a;
    --toast-bg: #2d4036; --toast-action: #b9ecd4;
  }
}

body.biser main { padding-bottom: 96px; }
.screen-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 12px; }
.screen-head h1 { font-size: 22px; margin: 0; }
.screen-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-note { color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.login { max-width: 420px; margin: 40px auto; }
.more-list .row { min-height: 56px; }
.more-list .row:first-child { border-top: 0; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Нижняя панель на телефоне: пять кнопок; «Что купить», «Модели», «Камни», «Настройки» — в «Ещё» */
#tabs .wide-only { display: none; }
#tabs button { min-width: 0; }
#tabs .tab-ico { padding: 3px 12px; }
.tab-ico circle { fill: none; }

/* Компьютер: все разделы слева столбиком, «Ещё» не нужно */
@media (min-width: 900px) {
  #tabs { top: 0; right: auto; width: 220px; flex-direction: column; justify-content: flex-start; gap: 2px;
    border-top: 0; border-right: 1px solid var(--line); padding: 16px 8px; }
  #tabs::before { content: "Изделия"; font-weight: 700; font-size: 18px; color: var(--accent); padding: 4px 12px 14px; }
  #tabs button { flex: none; min-height: 48px; flex-direction: row; justify-content: flex-start; gap: 10px;
    padding: 0 12px; border-radius: 10px; font-size: 15px; }
  #tabs .tab-ico { padding: 0; width: 22px; height: 22px; }
  #tabs button.on { background: var(--accent-soft); }
  #tabs button.on .tab-ico { background: none; }
  #tabs .wide-only { display: inline-flex; }
  #tabs .phone-only { display: none; }
  body.biser main { margin-left: 220px; max-width: 1040px; padding: 20px 24px 40px; }
  body.biser #toast { left: 240px; }
  body.biser.signed-out main { margin: 0 auto; }
}

/* Фото и схемы (задача 2) */
.files-block { margin: 8px 0; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb-btn { position: relative; width: 88px; height: 88px; padding: 0; overflow: hidden; border-radius: 12px; background: var(--tile-bg); }
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-btn.is-cover { outline: 3px solid var(--accent); outline-offset: -3px; }
.thumb-tag { position: absolute; left: 4px; bottom: 4px; font-size: 11px; background: var(--card); color: var(--text); border-radius: 6px; padding: 0 5px; }
.pdf-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; height: 100%; font-weight: 700; color: var(--accent); }
.pdf-tile small { font-weight: 400; font-size: 11px; color: var(--muted); max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-big { display: block; max-width: 100%; max-height: 60vh; margin: 0 auto 8px; border-radius: 10px; }
.crop-box { display: flex; justify-content: center; margin-bottom: 8px; }
.crop-canvas { border-radius: 8px; touch-action: none; max-width: 100%; }
.crop-canvas.movable { cursor: move; }
input[type="range"] { min-height: 44px; padding: 0; border: 0; background: none; accent-color: var(--accent); }

/* Списки и карточки (задача 3) */
.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.filters .chips button { min-height: 44px; font-size: 14px; }
/* На телефоне фильтры — одной строкой с прокруткой вбок, чтобы список был виден сразу */
@media (max-width: 899px) { .filters .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; } .filters .chips button { flex: none; } }
.card-list { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 900px) { .card-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
.mat-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 72px; padding: 8px; text-align: left; justify-content: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.row-thumb { width: 56px; height: 56px; flex: none; border-radius: 10px; object-fit: cover; background: var(--tile-bg); }
.no-photo { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.mat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mat-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.mat-main .sub, .sub { display: block; font-size: 13px; color: var(--muted); }
.mat-qty { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 14px; }
.level-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid currentColor; color: var(--muted); }
.level-full { color: var(--level-full); }
.level-half { color: var(--level-half); }
.level-low { color: var(--level-low); }
.level-none { color: var(--level-none); }
.tag-low { font-size: 12px; font-weight: 600; color: var(--on-warn); background: var(--warn); border-radius: 6px; padding: 1px 6px; }
.back-row { margin: -4px 0 4px; }
.back-row button { padding-left: 0; }
.stock-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.stock-qty { font-size: 20px; font-weight: 700; }
.hint { font-size: 14px; color: var(--muted); margin: 8px 0; }
button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline; font-size: inherit; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 8px; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; }
.note-text { white-space: pre-wrap; margin: 8px 0 0; }
.moves { margin-top: 6px; }
.move-row { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 6px 0; min-height: 44px; }
.move-date { width: 84px; flex: none; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.move-what { flex: 1; min-width: 0; }
.move-qty { flex: none; font-variant-numeric: tabular-nums; font-weight: 600; }
button.ghost.small { min-height: 44px; min-width: 44px; padding: 0; font-size: 20px; }
.two-fields { display: flex; gap: 10px; }
.two-fields .field { flex: 1; }
.more-fields { margin: 10px 0; }
.more-fields summary { min-height: 44px; display: flex; align-items: center; color: var(--accent); cursor: pointer; }
input[type="search"] { -webkit-appearance: none; appearance: none; }

/* Закупки (задача 4) */
.status-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.status-badge.st-received { background: var(--paid-bg); color: var(--ok); }
.status-badge.st-cancelled { background: var(--tile-bg); color: var(--muted); }
.spending .spend-row { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding: 6px 0; font-variant-numeric: tabular-nums; }
.spending strong { display: block; margin-bottom: 4px; }
.lines { margin: 6px 0; }
.line-row { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 8px 0; }
.line-main { flex: 1; min-width: 0; }
.line-main > button.link { font-weight: 600; text-decoration: none; text-align: left; }
a.small-link { min-height: 36px; font-size: 14px; }
.totals { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.totals dd { text-align: right; font-variant-numeric: tabular-nums; }
.track { font-family: ui-monospace, Menlo, Consolas, monospace; user-select: all; }
.sub-form { border-left: 3px solid var(--accent-soft); padding-left: 10px; margin: 4px 0 8px; }
.line-editor { border: 1px solid var(--line); border-radius: 12px; padding: 4px 10px; margin: 8px 0; }
.sub.warn { color: var(--warn); }

/* Изделия и модели (задачи 5–6) */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (min-width: 600px) { .tiles { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }
.tile { display: flex; flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-height: 0; }
.tile img, .tile-empty { width: 100%; aspect-ratio: 1; object-fit: cover; display: flex; align-items: center; justify-content: center; background: var(--tile-bg); color: var(--muted); }
.tile-empty .ico { width: 40px; height: 40px; }
.tile-text { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.tile-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-title { font-size: 17px; margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
.group-title .count { font-size: 13px; color: var(--muted); font-weight: 400; }
.parts-editor { margin: 6px 0 10px; }
.part-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.part-row select { flex: 1; min-width: 0; }
.qty-box { display: flex; align-items: center; gap: 4px; flex: 0 0 34%; }
.qty-box input { min-width: 0; }
.qty-box .unit { font-size: 13px; color: var(--muted); min-width: 28px; }
.check-state { flex: 0 0 45%; text-align: right; font-size: 14px; }
.check-ok .check-state { color: var(--ok); }
.check-short .check-state, .check-no .check-state, .check-busy .check-state { color: var(--warn); font-weight: 600; }
.check-maybe .check-state { color: var(--level-half); }
.chips.saved button.on { outline: 2px solid var(--ok); }

/* Плашка идущего таймера (задача 7) */
#timer-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  padding-top: max(6px, env(safe-area-inset-top)); background: var(--accent); color: var(--accent-text); }
#timer-bar .timer-item { flex: 1; min-width: 0; justify-content: flex-start; gap: 6px; border: 0; background: none; color: inherit; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
#timer-bar .timer-stop { flex: none; background: var(--accent-text); color: var(--accent); border: 0; font-weight: 600; }
.timer-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: none; animation: timer-blink 2s infinite; }
@keyframes timer-blink { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .timer-dot { animation: none; } }
@media (min-width: 900px) { #timer-bar { margin-left: 220px; } }

/* Что купить (задача 8) */
.tobuy-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; font-size: 14px; }
.line-row.covered { opacity: .6; }
.sub.ok { color: var(--ok); }

/* Подсказка цены и настройки (задача 9) */
.price-hint { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.price-hint .stock-head strong { font-size: 18px; }
.price-hint .facts dd { text-align: right; font-variant-numeric: tabular-nums; }
.check-field { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 6px 0; }
.check-field input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); }
.lines .row:first-child { border-top: 0; }

/* Памятка о камнях (задача 10) */
.draft-tag { display: inline-block; margin-left: 8px; font-size: 12px; color: var(--level-half); border: 1px solid currentColor; border-radius: 6px; padding: 0 5px; vertical-align: middle; }
.hint.law { border-left: 3px solid var(--accent); padding-left: 10px; }

/* Обзор (задача 12) */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { flex-direction: column; gap: 2px; min-height: 72px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; }
.stat strong { font-size: 22px; color: var(--accent); }
.stat span { font-size: 13px; color: var(--muted); }
.stat.warn strong { color: var(--warn); }
.mini-thumb { width: 40px; height: 40px; flex: none; border-radius: 8px; object-fit: cover; background: var(--tile-bg); }
.start-card ol { margin: 8px 0 0; padding-left: 20px; }
.start-card li { margin: 4px 0; }

/* Проверка (задача 13): всё, на что нажимают, — не ниже 44 точек, как в кабинете записи */
body.biser .small-actions button, body.biser .small-actions .btn, body.biser a.small-link { min-height: 44px; }
.line-main > button.link { min-height: 44px; display: inline-flex; align-items: center; padding: 0; }

/* Ответы жены (30.11.2026): обхваты кнопками */
.size-chips { margin-bottom: 6px; }
.size-chips button { min-height: 44px; min-width: 64px; }

/* Ячейки и наклейки (30.11.2026) */
.cell-row { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 8px 0; flex-wrap: wrap; }
.cell-row:first-child { border-top: 0; }
.cell-input { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.cell-input input { width: 96px; }
.cell-input .chips button { min-height: 44px; }
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.label { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 1px dashed var(--line); border-radius: 10px; padding: 10px; background: #ffffff; color: #000000; }
.label img { width: 120px; height: 120px; image-rendering: pixelated; }
.label span { font-size: 14px; font-weight: 600; text-align: center; }
@media print {
  #tabs, #timer-bar, #toast, .no-print, .back-row { display: none !important; }
  body.biser main { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .labels { grid-template-columns: repeat(4, 1fr); gap: 4mm; }
  .label { break-inside: avoid; border-color: #999999; }
}

/* Продажи и отчёты (этап 2, 30.11.2026) */
.chosen { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--accent); border-radius: 10px; padding: 0 0 0 12px; margin-bottom: 6px; }
.pick-list .sub { margin-left: 8px; }
.sale-card { border-color: var(--accent); }
.stat strong { font-size: 18px; }

/* Витрина для клиентки (30.11.2026): без меню и таймера, крупные фото */
body.showing #tabs, body.showing #timer-bar { display: none !important; }
body.showing main { margin: 0 auto !important; max-width: 960px; padding-bottom: 24px; }
.show-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.show-head h1 { margin: 0; font-size: 24px; }
.show-head p { margin: 4px 0 0; }
.show-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 700px) { .show-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.show-tile { display: flex; flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); text-align: left; }
.show-tile img, .show-tile .tile-empty { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.show-text { padding: 8px 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.show-price { color: var(--accent); font-weight: 700; }
.show-photos { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.show-photos img { width: 100%; border-radius: 12px; }

/* Обзор: быстрые кнопки и «что выложить сегодня» (30.11.2026) */
.small-actions.quick { margin: 0 0 12px; }
.small-actions.quick button { flex: 1 1 auto; }
.post-today { border-color: var(--accent); }

/* Вход мамы (30.11.2026): только её разделы внизу или слева */
body:not(.mom) #tabs .mom-only { display: none !important; }
body.mom #tabs button:not(.mom-only) { display: none !important; }
body.mom #tabs .mom-only { display: inline-flex !important; }

/* На ярмарке (30.11.2026) */
.fair-row { border-top: 1px solid var(--line); }
.fair-row:first-child { border-top: 0; }
.fair-row.bought { background: var(--accent-soft); border-radius: 10px; padding: 0 8px; }
.fair-inputs { display: flex; gap: 8px; padding-bottom: 8px; }
.fair-inputs .field { flex: 1; margin: 4px 0; }

/* Плитки с суммами: число и «₽» не разрываются, подпись — строкой ниже (30.11.2026) */
.stats .stat { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.stats .stat strong { white-space: nowrap; font-size: clamp(14px, 4.2vw, 20px); }
