/* Пульт поставщика — свой строгий вид (23.09.2026): серо-синий, без палитры клиента.
   Цвета — именами: второй экран возьмёт те же, а не подберёт свои на глаз. */
:root {
  --ink: #1d2733;
  --muted: #5b6b7d;
  --line: #d5dce4;
  --paper: #f4f6f9;
  --card: #ffffff;
  --accent: #2f5d8a;
  --accent-ink: #ffffff;
  --danger: #a33a3a;
  --ok: #2f7a4f;
  --radius: 6px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }

.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--ink);
  color: #e8edf3;
}
.top .brand { color: #fff; font-weight: 700; letter-spacing: .04em; text-decoration: none; }
.top .nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.top .nav a { color: #c5d0dc; text-decoration: none; padding: 6px 10px; border-radius: var(--radius); }
.top .nav a[aria-current="page"] { background: #2e3b4a; color: #fff; }
.top .who { color: #c5d0dc; font-size: 14px; }
.top .quiet { background: transparent; color: #e8edf3; border: 1px solid #4a5a6b; }

.main { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.entry { max-width: 380px; margin: 10vh auto 0; }
.entry h1 { margin: 0 0 4px; font-size: 22px; }
.entry .hint { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

label { display: block; margin: 0 0 14px; font-size: 14px; color: var(--muted); }
input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 10px;
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input.code { font-size: 22px; letter-spacing: .3em; text-align: center; }

button {
  font: inherit;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}
button:disabled { opacity: .6; cursor: default; }
button.link { background: none; border: none; color: var(--accent); padding: 0; }
.actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.error { color: var(--danger); font-size: 14px; min-height: 1.2em; margin: 0 0 12px; }
.done { color: var(--ok); }

h2 { font-size: 20px; margin: 0 0 16px; }
.muted { color: var(--muted); }

@media (max-width: 640px) {
  .top { flex-wrap: wrap; padding: 10px 16px; }
  .entry { margin-top: 24px; }
}

/* Схема (23.09.2026): рамки — матрёшка клиент → ящик → бренд, квадраты — сайты, заведения
   и организации iiko. Холст прокручивается сам по себе: страница вбок не едет. */
.mapwrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.canvas { overflow: auto; padding: 12px; }
.side-card h3 { margin: 4px 0 12px; font-size: 18px; overflow-wrap: anywhere; }
.side-card .kind { margin: 0; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 16px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.risks { color: var(--danger); margin: 0 0 16px; padding-left: 20px; }
ul.card.risks { padding: 12px 12px 12px 32px; border-color: var(--danger); }

#map text { font-size: 13px; fill: var(--ink); pointer-events: none; }
#map .title { font-weight: 600; }
#map .note { fill: var(--muted); font-size: 12px; }
#map .muted { fill: var(--muted); }
#map [role=button] { cursor: pointer; }
#map [role=button]:focus { outline: none; }
#map .frame rect { stroke-width: 1.5; }
#map .client > rect { fill: #eef2f6; stroke: #9aa9b9; }
#map .box > rect { fill: #f7f9fb; stroke: #7d8fa3; stroke-dasharray: 6 3; }
#map .brand > rect { fill: #fff; stroke: #b6c2cf; }
#map .frame.risk > rect { stroke: var(--danger); stroke-width: 2.5; stroke-dasharray: none; }
#map .frame.frozen > rect { fill: #e6e6e6; }
#map .node rect { stroke: #7d8fa3; }
#map .node.site rect { fill: #e6eef7; }
#map .node.venue rect { fill: #e9f3ec; }
#map .node.org rect { fill: #f5efe3; }
#map .edge { stroke: #7d8fa3; stroke-width: 1.5; }
#map marker path { fill: #7d8fa3; }
#map .chosen > rect, #map [role=button]:focus > rect { stroke: var(--accent); stroke-width: 3; }

@media (max-width: 900px) {
  .mapwrap { grid-template-columns: minmax(0, 1fr); }
}

/* Мастер и кнопки «+ …» на карточках. */
select { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; font: inherit; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.wizard { max-width: 640px; }
.wizard h3 { margin: 20px 0 8px; font-size: 16px; }
.wizard .step:empty { display: none; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
label.check input { width: auto; margin: 0; }
.add { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.add form { margin-top: 10px; }
ul.plain { margin: 0 0 12px; padding-left: 18px; font-size: 14px; }
.lead { font-weight: 600; }

/* iiko: пределы строками — что это, число, кнопка. */
.limits .limit { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: 6px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.limits .limit:first-of-type { border-top: 0; }
.limits .limit .what p { margin: 2px 0 0; }
.limits .limit input { margin: 0; }
.limits .limit .error, .limits .limit .advice { grid-column: 1 / -1; margin: 0; min-height: 0; }
.advice { color: var(--muted); font-size: 14px; }
.small { font-size: 12px; }
.own-limit label { margin-bottom: 4px; }
.own-limit { margin-bottom: 8px; }
@media (max-width: 640px) {
  .limits .limit { grid-template-columns: minmax(0, 1fr) 100px; }
  .limits .limit button { grid-column: 1 / -1; }
}

/* Сервер и состояние. */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.card + .card { margin-top: 16px; }
.grid2 .card + .card { margin-top: 0; }
.facts-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.facts-table th, .facts-table td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.facts-table th { font-weight: 500; color: var(--muted); width: 45%; }
.facts-table tr.bad th, .facts-table tr.bad td { color: var(--danger); font-weight: 600; }
.danger { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.danger:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.danger h3 { margin: 0 0 6px; font-size: 16px; }
.box-health.bad { border-color: var(--danger); }
.journal th { width: auto; }
.journal tr.bad td { color: var(--danger); }
.card { overflow-x: auto; }

/* Опасные действия: отдельная зона, красная кнопка. */
.danger-zone { border: 1px solid #e3c5c5; background: #fbf5f5; border-radius: var(--radius); padding: 12px; }
.danger-button { background: var(--danger); border-color: var(--danger); }
.side-card h4 { margin: 18px 0 8px; font-size: 15px; }
