/* «Пульт» (public/pult.html): темна сторінка для телевізора, комп'ютера й телефона. Угорі продажі, унизу камери. */
:root { --bg: #0f1311; --panel: #181e1a; --line: #28312b; --ink: #eef3ee; --muted: #8f9b92; --up: #3fd16b; --down: #ff5a4d; --accent: #8fc16a; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 16px/1.3 system-ui, 'Segoe UI', Roboto, sans-serif; font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 8px 14px; }
button:hover { border-color: var(--accent); }
button.primary { background: #2f6b3a; border-color: #2f6b3a; }
.muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }

/* Вхід */
.login { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; }
.login h1 { margin: 0; font-size: 28px; }
.people { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 640px; }
.people button { font-size: 20px; padding: 14px 22px; }
.people button.on { background: #2f6b3a; border-color: var(--accent); }
.pin-row { display: flex; gap: 10px; }
.pin-row input { width: 170px; font-size: 24px; text-align: center; letter-spacing: 6px; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }
.login-error { color: var(--down); min-height: 1.3em; }

/* Каркас: шапка, продажі, камери */
.pult { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.bar h1 { margin: 0; font-size: 18px; flex: 1; }
.bar .stamp { color: var(--muted); font-size: 14px; }
.bar button { padding: 6px 12px; font-size: 14px; }
.sales { flex: 1 1 50%; min-height: 0; display: grid; gap: 10px; padding: 10px 14px; grid-template-columns: 1.35fr repeat(var(--n, 3), minmax(0, 1fr)); align-content: stretch; overflow: hidden; }
.cams { flex: 1 1 50%; min-height: 0; position: relative; border-top: 1px solid var(--line); padding: 8px 14px 12px; display: flex; }
.cam-empty { margin: auto; color: var(--muted); font-size: 20px; display: flex; gap: 12px; align-items: center; }
.cam-grid { flex: 1; display: grid; gap: 8px; grid-template-columns: repeat(5, 1fr); grid-auto-rows: 1fr; min-height: 0; }
@media (max-width: 1500px) { .cam-grid { grid-template-columns: repeat(4, 1fr); } }

/* Картка продажів */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; min-height: 0; }
.card .name { color: var(--muted); font-size: clamp(13px, 1.1vw, 20px); }
.card .money { font-size: clamp(28px, 3.4vw, 64px); font-weight: 700; line-height: 1.05; white-space: nowrap; }
.card.total .money { font-size: clamp(34px, 4.8vw, 92px); }
.card .sub { color: var(--muted); font-size: clamp(12px, 1vw, 18px); }
.cmp { display: flex; justify-content: space-between; gap: 8px; font-size: clamp(12px, 1vw, 18px); }
.cmp .pct { font-weight: 700; white-space: nowrap; }
.cmp[hidden] { display: none; }
.spark { flex: 1; min-height: 30px; width: 100%; }
.spark .y { stroke: #5b6a5f; stroke-dasharray: 4 3; fill: none; stroke-width: 1.5; }
.spark .t { stroke: var(--accent); fill: none; stroke-width: 2.5; }

/* Камери */
.tile { position: relative; background: #000; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; min-height: 0; cursor: pointer; }
.tile video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.tile .label { position: absolute; left: 6px; bottom: 6px; font-size: 12px; background: rgba(0, 0, 0, .55); padding: 2px 6px; border-radius: 4px; pointer-events: none; }
.tile.off { background: #3a3f3b; }
.tile.off video { visibility: hidden; }
.tile .off-note { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; color: #b9c2bb; font-size: 14px; text-align: center; padding: 8px; }
.tile.off .off-note { display: flex; }
.tile.big { position: fixed; inset: 0; z-index: 20; border-radius: 0; }
.tile.big .label { font-size: 16px; }

/* Вікно налаштувань власника */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 12px; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: min(900px, 100%); max-height: 92vh; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.sheet h2 { margin: 0; font-size: 18px; }
.sheet h3 { margin: 0; font-size: 15px; color: var(--muted); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.checks label { display: flex; gap: 6px; align-items: center; }
.cam-row { display: grid; grid-template-columns: 1.2fr 1.6fr 1fr 1fr 70px auto auto auto; gap: 6px; align-items: center; }
.cam-row input, .cam-row select { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px; min-width: 0; width: 100%; }
.cam-row input[type=checkbox] { width: auto; }
.cam-row.rec-cam { grid-template-columns: 1.6fr 1fr 70px auto auto auto; }
.rec-row { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.rec-main { display: grid; grid-template-columns: 1fr 1.2fr 1.2fr 80px 1fr 1fr 70px 90px; gap: 6px; align-items: center; }
.rec-main input, .rec-main select, .rec-more input { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px; min-width: 0; width: 100%; }
.rec-more { color: var(--muted); font-size: 13px; }
.rec-more label { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.rec-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.hint { color: var(--muted); font-size: 13px; }
.sheet .err { color: var(--down); min-height: 1.2em; }

/* Телефон: продажі зверху, камери нижче, вся сторінка прокручується */
@media (max-width: 800px) {
  .pult { height: auto; min-height: 100dvh; }
  .sales { grid-template-columns: 1fr 1fr; overflow: visible; }
  .card.total { grid-column: 1 / -1; }
  .card .money { font-size: 30px; }
  .card.total .money { font-size: 42px; }
  .spark { min-height: 50px; }
  .cams { min-height: 55vh; }
  .cam-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 28vw; }
  .cam-row, .cam-row.rec-cam { grid-template-columns: 1fr 1fr; }
  .rec-main { grid-template-columns: 1fr; }
  .bar { flex-wrap: wrap; }
}
