/* CNRG поле — интерфейс для работы с телефона в точке.
   Светлая тема по умолчанию (читается на солнце), тёмная — по настройке системы. */
:root {
  --bg: #f2f3f6; --surface: #ffffff; --surface-2: #f6f7f9; --line: #e3e6eb; --line-strong: #cfd4dc;
  --text: #0f172a; --text-2: #475569; --muted: #8a94a6;
  --primary: #1d4ed8; --primary-ink: #ffffff; --primary-soft: #e8efff;
  --brand: #e8a33d;
  --ok: #15803d; --ok-soft: #e7f6ec; --warn: #b45309; --warn-soft: #fff4e0; --err: #c62828; --err-soft: #fdecec;
  --r: 16px; --r-sm: 12px; --tap: 48px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f13; --surface: #171a20; --surface-2: #1e222a; --line: #2a2f39; --line-strong: #3a414e;
    --text: #eef1f6; --text-2: #b4bccb; --muted: #7f899a;
    --primary: #5b8cff; --primary-ink: #0b1020; --primary-soft: #1c2742;
    --ok: #3ecf8e; --ok-soft: #12291f; --warn: #f2b84b; --warn-soft: #2d230f; --err: #ff6b6b; --err-soft: #2e1515;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  padding-bottom: calc(84px + var(--safe-b)); }
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 26px; line-height: 1.15; margin: 6px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0; }
h3 { font-size: 13px; margin: 18px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
p { margin: 6px 0; }
small, .muted { color: var(--muted); }
.wrap { max-width: 720px; margin: 0 auto; padding: 8px 16px; }
.hidden { display: none !important; }

/* верхняя панель */
.bar { position: sticky; top: 0; z-index: 30; padding-top: var(--safe-t);
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); }
.bar .in { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 6px; height: 54px; padding: 0 10px; }
.bar .title { flex: 1; font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .logo { font-weight: 800; letter-spacing: .03em; }
.bar .logo b { color: var(--brand); }
.icon-btn { min-width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 12px; color: var(--text);
  font-size: 22px; background: none; border: 0; cursor: pointer; padding: 0 8px; }
.icon-btn:active { background: var(--line); }

/* нижнее меню */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b); }
.tabs .in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 62px;
  color: var(--muted); font-size: 11px; font-weight: 600; }
.tabs a .i { font-size: 22px; line-height: 1; filter: grayscale(1); opacity: .75; }
.tabs a.on { color: var(--primary); }
.tabs a.on .i { filter: none; opacity: 1; }
.tabs a.add .i { filter: none; opacity: 1; width: 50px; height: 50px; border-radius: 16px; background: var(--primary);
  color: var(--primary-ink); display: grid; place-items: center; font-size: 30px; font-weight: 300; margin-top: -4px;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 40%, transparent); }

/* поверхности */
.card { background: var(--surface); border-radius: var(--r); padding: 16px; margin: 0 0 12px; box-shadow: var(--shadow);
  border: 1px solid var(--line); }
.card.flat { box-shadow: none; }
.sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sec-head .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft);
  font-size: 18px; flex: none; }
.sec-head h2 { flex: 1; }
.list { display: grid; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap-ok { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 > *, .grid3 > * { min-width: 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* элемент списка */
.item { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; color: var(--text); box-shadow: var(--shadow); }
.item:active { transform: scale(.99); }
.item .av { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 22px; flex: none; }
.item .t { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { color: var(--text-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .chev { color: var(--muted); font-size: 20px; }

/* пилюли/бейджи */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.err { background: var(--err-soft); color: var(--err); }
.pill.pri { background: var(--primary-soft); color: var(--primary); }

/* формы */
label.l { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; }
input, select, textarea { width: 100%; min-height: var(--tap); background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 11px 14px; font: inherit; font-size: 17px; -webkit-appearance: none; appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.field { position: relative; }
.saved { position: absolute; right: 0; top: 14px; font-size: 12px; color: var(--ok); opacity: 0; transition: opacity .3s; }
.saved.on { opacity: 1; }
.saved.bad { color: var(--err); }

/* выбор пилюлями (радио/чекбоксы) */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices label { position: relative; }
.choices input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; min-height: 0; }
.choices span { display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 15px; font-weight: 550; cursor: pointer; user-select: none; }
.choices input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.choices input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }

/* плитки выбора типа точки */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tiles label { position: relative; }
.tiles input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.tiles span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 84px; padding: 6px;
  border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; text-align: center;
  line-height: 1.15; cursor: pointer; }
.tiles span b { font-size: 26px; font-weight: 400; }
.tiles input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px; border-radius: 14px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 650; font-size: 16px;
  cursor: pointer; text-align: center; }
.btn:active { transform: scale(.98); }
.btn.pri { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.btn.danger { color: var(--err); border-color: transparent; background: var(--err-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.block { width: 100%; }
.btn.lg { min-height: 56px; font-size: 17px; border-radius: 16px; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btns { display: flex; gap: 8px; margin-top: 14px; }
.btns > * { flex: 1; }
.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.big-actions .btn { flex-direction: column; min-height: 88px; gap: 4px; font-size: 14px; border-radius: 16px; }
.big-actions .btn b { font-size: 28px; font-weight: 400; }
input[type=file] { display: none; }

/* поиск и фильтры */
.search { position: sticky; top: calc(54px + var(--safe-t)); z-index: 20; padding: 4px 0 10px; background: var(--bg); }
.search input { background: var(--surface); padding-left: 42px; border-radius: 14px;
  background-image: radial-gradient(circle at 18px 21px, transparent 6px, var(--muted) 6.5px, var(--muted) 8px, transparent 8.5px); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chips a, .chips button { flex: none; min-height: 38px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.chips .on { background: var(--text); color: var(--surface); border-color: var(--text); }

/* сообщения */
.flash { border-radius: 14px; padding: 12px 14px; margin: 4px 0 12px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.flash.error { background: var(--err-soft); color: var(--err); }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600;
  transition: all .25s; z-index: 60; pointer-events: none; max-width: 90vw; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* прогресс */
.bar-p { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-p i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.bar-p.done i { background: var(--ok); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
.stat .n { font-size: 24px; font-weight: 800; }
.stat .l { font-size: 12.5px; color: var(--muted); }

/* таблицы */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 200px; }
tr.cnrg td { color: var(--warn); font-weight: 700; }

/* фото */
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.thumb { position: relative; display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .tag { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 999px; }
.thumb .st { position: absolute; right: 6px; bottom: 6px; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; }
.thumb.uploading::after { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.55); }
.upbar { height: 4px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.upbar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }

/* голос */
.rec { display: flex; align-items: center; gap: 14px; }
.rec .recbtn { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--err); color: #fff; font-size: 26px; cursor: pointer; flex: none;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--err) 35%, transparent); }
.rec.on .recbtn { border-radius: 18px; animation: pulse 1.2s infinite; }
.rec .time { font-variant-numeric: tabular-nums; font-size: 24px; font-weight: 700; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--err) 15%, transparent); } }
.audio { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; margin-top: 10px; }
.audio audio { width: 100%; margin-top: 6px; height: 40px; }
.transcript { white-space: pre-wrap; font-size: 14px; max-height: 280px; overflow: auto; background: var(--surface); border-radius: 10px;
  padding: 10px; margin-top: 8px; border: 1px solid var(--line); }

/* опросник */
.q { padding: 2px 0 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.q:last-child { border-bottom: 0; }
.q.draft { border-left: 3px solid var(--warn); padding-left: 10px; margin-left: -13px; }
.q .quote { font-size: 13px; color: var(--muted); font-style: italic; margin-top: 4px; }
.q-block { margin-top: 6px; }
.q-block > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 12px 0;
  font-weight: 700; border-bottom: 1px solid var(--line); }
.q-block > summary::-webkit-details-marker { display: none; }
.q-block > summary::after { content: "›"; font-size: 22px; color: var(--muted); transform: rotate(90deg); transition: transform .2s; }
.q-block:not([open]) > summary::after { transform: rotate(0); }

/* позиции SKU */
.sku { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: var(--surface); }
.sku.draft { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); background: color-mix(in srgb, var(--warn-soft) 55%, var(--surface)); }
.sku .g { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sku .g > * { min-width: 0; }
.sku label.l { margin: 6px 0 4px; font-size: 12px; }
.sku input, .sku select { min-height: 42px; padding: 8px 10px; font-size: 16px; }

/* развороты */
details.more > summary { list-style: none; cursor: pointer; }
details.more > summary::-webkit-details-marker { display: none; }

/* скоринг */
.score { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.score .choices span { min-width: 40px; min-height: 40px; padding: 0; justify-content: center; }

/* карточка-шапка точки */
.hero { padding: 4px 0 12px; }
.hero .meta { color: var(--text-2); font-size: 15px; }
.addr { display: flex; gap: 8px; align-items: stretch; }
.addr input { flex: 1; }
.addr .btn { flex: none; padding: 0 14px; }
.coords { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.sticky-cta { position: sticky; bottom: calc(72px + var(--safe-b)); z-index: 15; padding-top: 8px; }
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: none; place-items: center; z-index: 70; color: #fff; font-weight: 700; }
.overlay.on { display: grid; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* общие классы для второстепенных экранов */
label { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; }
.choices label, .tiles label, label.check { margin: 0; font-weight: inherit; color: inherit; font-size: inherit; }
.check { display: flex !important; align-items: center; gap: 10px; min-height: var(--tap); color: var(--text); font-size: 16px; }
.check input { width: 24px; min-height: 24px; height: 24px; accent-color: var(--primary); -webkit-appearance: checkbox; appearance: auto; }
.b { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.b.ok { background: var(--ok-soft); color: var(--ok); } .b.warn { background: var(--warn-soft); color: var(--warn); }
.b.err { background: var(--err-soft); color: var(--err); } .b.acc, .b.info { background: var(--primary-soft); color: var(--primary); }
.filters { display: grid; gap: 8px; margin-bottom: 12px; }
.item.col { display: block; }
.obs { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: var(--surface); }
.obs > summary { cursor: pointer; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu .sheet { position: absolute; right: 0; top: 48px; min-width: 250px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.18); z-index: 50; }
.menu .sheet a { display: flex; align-items: center; min-height: 46px; padding: 0 12px; border-radius: 10px; color: var(--text); font-weight: 550; }
.menu .sheet a:active { background: var(--surface-2); }
.wrap-ok { flex-wrap: wrap; }
.av-big { width: 56px; height: 56px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; font-size: 30px; flex: none; }
.item:not(:has(> .av)) { display: block; }
