/* Дашборд конфигураторов — тёмный рабочий интерфейс. Шрифт — Manrope из assets/fonts. */
@font-face { font-family: "Manrope"; src: url("/api/fonts/file/Manrope-Regular.ttf"); font-weight: 400; }
@font-face { font-family: "Manrope"; src: url("/api/fonts/file/Manrope-Medium.ttf"); font-weight: 500; }
@font-face { font-family: "Manrope"; src: url("/api/fonts/file/Manrope-Bold.ttf"); font-weight: 600 700; }
@font-face { font-family: "Manrope"; src: url("/api/fonts/file/Manrope-ExtraBold.ttf"); font-weight: 800; }

:root {
  --bg: #0e0f12;
  --panel: #16171b;
  --panel-2: #1d1f24;
  --panel-3: #25272d;
  --line: #2a2c33;
  --line-2: #363841;
  --text: #ecebe8;
  --muted: #8f9099;
  --dim: #63646d;
  --accent: #f2c14e;
  --accent-ink: #1b1608;
  --accent-soft: rgba(242, 193, 78, .14);
  --ok: #4fc07d;
  --ok-soft: rgba(79, 192, 125, .14);
  --danger: #ef7a72;
  --danger-soft: rgba(239, 122, 114, .12);
  --info: #6aa8ff;
  --info-soft: rgba(106, 168, 255, .14);
  --r: 14px;
  --r-sm: 10px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------- оболочка */
.shell { max-width: 1240px; margin: 0 auto; padding: 14px 18px 120px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.brand { font-weight: 800; letter-spacing: .2px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.brand i { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: inline-block; }
.topbar .spacer { flex: 1; }
.who { color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; }
.livepill { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.livepill.ok { color: var(--ok); border-color: rgba(79,192,125,.35); }
.livepill.warn { color: var(--accent); border-color: rgba(242,193,78,.35); }

.nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin-bottom: 18px; }
.nav button { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 9px 6px; font-weight: 600; font-size: 13px; color: var(--text); line-height: 1.15; min-height: 42px; }
.nav button:hover { border-color: var(--line-2); }
.nav button.on { background: #e9e8ec; color: #111; border-color: #e9e8ec; }
.nav .aux { color: var(--muted); font-weight: 500; }

h1 { font-size: 28px; line-height: 1.15; margin: 4px 0 6px; font-weight: 800; letter-spacing: -.2px; }
h2 { font-size: 20px; margin: 26px 0 8px; font-weight: 800; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 700; }
.lead { color: var(--muted); max-width: 820px; margin: 0 0 16px; font-size: 15px; }
.kicker { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* ---------------------------------------------------------- кнопки */
.btn { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 14px; font-weight: 600; color: var(--text); white-space: nowrap; }
.btn:hover { background: var(--panel-3); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.light { background: #e9e8ec; color: #111; border-color: #e9e8ec; }
.btn.danger { color: var(--danger); }
.btn.ok { color: var(--ok); border-color: rgba(79,192,125,.4); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.big { padding: 12px 18px; font-size: 15px; border-radius: 12px; }

/* ---------------------------------------------------------- панели */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card + .card { margin-top: 12px; }
.card.flat { background: transparent; }
.note { border-left: 3px solid var(--accent); background: var(--panel); border-radius: 0 var(--r) var(--r) 0; padding: 12px 16px; color: #cfcdd4; }
.note.red { border-left-color: var(--danger); }
.note.green { border-left-color: var(--ok); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--panel-3); color: var(--muted); }
.badge.live { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--accent-soft); color: var(--accent); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }

/* ---------------------------------------------------------- редактор */
.editor { display: grid; grid-template-columns: 360px 1fr; gap: 22px; align-items: start; }
.editor.wide-left { grid-template-columns: 400px 1fr; }
.editor > .left { position: sticky; top: 12px; }
@media (max-width: 900px) { .editor, .editor.wide-left { grid-template-columns: 1fr; } .editor > .left { position: static; } }

.phone { position: relative; width: 100%; aspect-ratio: 9 / 16; border-radius: 26px; overflow: hidden; background: #000; border: 2px solid #2d2f36; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.phone img, .phone video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.phone .busy { position: absolute; top: 10px; right: 10px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin .7s linear infinite; opacity: 0; transition: opacity .2s; z-index: 5; }
.phone.loading .busy { opacity: 1; }
.phone .err { position: absolute; left: 10px; right: 10px; bottom: 10px; background: rgba(140, 30, 30, .85); color: #fff; font-size: 12px; padding: 8px 10px; border-radius: 10px; z-index: 6; }
.phone .tag { position: absolute; bottom: 12px; right: 12px; z-index: 4; background: rgba(0,0,0,.55); color: #fff; border: 0; border-radius: 10px; padding: 6px 12px; font-weight: 700; font-size: 12px; }
.ig { position: absolute; left: 0; right: 0; pointer-events: none; z-index: 3; font-size: 10px; font-weight: 700; color: #ff8e8e; padding: 4px 8px;
  background: repeating-linear-gradient(135deg, rgba(255,90,90,.16) 0 6px, transparent 6px 12px); }
.ig.top { top: 0; height: 11.5%; border-bottom: 1px dashed rgba(255,120,120,.8); }
.ig.bottom { bottom: 0; height: 20%; border-top: 1px dashed rgba(255,120,120,.8); display: flex; align-items: flex-start; }
.zone-mark { position: absolute; left: 0; right: 0; border: 2px dashed rgba(242,193,78,.9); background: rgba(242,193,78,.12); z-index: 3; pointer-events: none; }
.phone-under { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.phone-hint { color: var(--muted); font-size: 12px; text-align: center; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 600; color: var(--text); }
.seg button.on { border-color: var(--accent); color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.seg.solid button.on { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.seg.tabs button { border-radius: 10px; flex: 1; padding: 9px; }
.seg.tabs button.on { background: #e9e8ec; color: #111; border-color: #e9e8ec; box-shadow: none; }

/* поля формы */
.group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; }
.group > summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; align-items: baseline; gap: 10px; font-weight: 800; font-size: 13px; letter-spacing: .5px; text-transform: uppercase; color: var(--accent); }
.group > summary::-webkit-details-marker { display: none; }
.group > summary::before { content: "▸"; color: var(--accent); transition: transform .15s; display: inline-block; }
.group[open] > summary::before { transform: rotate(90deg); }
.group > summary .hint { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); font-size: 12px; margin-left: auto; }
.group .body { padding: 0 16px 14px; }
.group.deferred > summary { color: var(--muted); }
.field { display: grid; grid-template-columns: 200px 1fr; gap: 6px 14px; align-items: center; padding: 7px 0; border-top: 1px solid rgba(255,255,255,.03); }
.field:first-child { border-top: 0; }
.field.full { grid-template-columns: 1fr; }
.field > label { font-size: 13px; color: #d6d5db; }
.field > label .hint { display: block; color: var(--muted); font-size: 11.5px; }
.field.off { opacity: .38; pointer-events: none; }
.slider-row { display: grid; grid-template-columns: 1fr 74px; gap: 12px; align-items: center; }
.slider-row .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; }
.slider-row .val small { color: var(--muted); font-weight: 500; }
.ends { display: flex; justify-content: space-between; color: var(--dim); font-size: 11px; margin-top: -2px; }
.state { color: var(--accent); font-size: 12px; font-weight: 700; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 6px; background: linear-gradient(to right, var(--accent) var(--p, 50%), #3a3c44 var(--p, 50%)); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #f4f3f6; border: 2px solid #5b5d66; box-shadow: 0 1px 4px rgba(0,0,0,.4); cursor: grab; }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #f4f3f6; border: 2px solid #5b5d66; cursor: grab; }
.input, select.input, textarea.input { background: #101114; border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 11px; width: 100%; color: var(--text); }
.input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 70px; line-height: 1.45; }
.color-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.color-row input[type=color] { width: 54px; height: 32px; border: 1px solid var(--line-2); border-radius: 8px; background: none; padding: 0; }
.color-row .hex { width: 96px; font-family: ui-monospace, monospace; font-size: 12px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 26px; height: 26px; border-radius: 7px; border: 2px solid rgba(255,255,255,.08); }
.sw.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.toggle { width: 42px; height: 24px; border-radius: 24px; background: #3a3c44; border: 0; position: relative; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.on { background: var(--accent); }
.toggle.on::after { left: 21px; }

.fonts { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.fontcard { flex: 0 0 auto; min-width: 118px; max-width: 160px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 10px 6px; text-align: center; }
.fontcard .s { font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: clip; line-height: 1.35; }
.fontcard .n { font-size: 11px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fontcard .n b { color: var(--ok); }
.fontcard.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fontcard.nocyr .n { color: var(--danger); }

/* пресеты */
.presets { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; }
.presets h3 { display: flex; gap: 8px; align-items: center; }
.presets .line { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.presets select { flex: 1; min-width: 200px; }
.presets .status { color: var(--muted); font-size: 12px; }
.presets .status b { color: var(--text); }
.presets .dirty { color: var(--accent); }
.livebox { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.livebox .items { display: flex; gap: 6px; flex-wrap: wrap; }

/* хаб */
.hubgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.hubcard { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-height: 270px; }
.hubcard .who { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.hubcard h3 { font-size: 17px; margin: 4px 0 0; }
.hubcard p { margin: 0; color: var(--muted); font-size: 13px; }
.hubcard .stat { font-size: 13px; color: var(--muted); }
.hubcard .stat b { color: var(--ok); }
.hubcard .end { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.hubcard .names { font-size: 12px; color: #c9c8ce; background: var(--panel-2); border-radius: 10px; padding: 8px 10px; }

/* таблицы */
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
table.t td { padding: 8px; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: top; }

/* тексты */
.tcard { background: #141820; border: 1px solid #222837; border-left: 3px solid #39415a; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.tcard.changed { border-left-color: var(--accent); }
.tcard.locked { border-left-color: var(--ok); }
.tcard.bad { border-left-color: var(--danger); }
.tcard .k { font-family: ui-monospace, monospace; font-size: 11.5px; background: #0d1016; padding: 2px 7px; border-radius: 6px; color: #9fb0d0; }
.tcard .d { color: var(--muted); font-size: 12.5px; margin: 6px 0 8px; }
.bubble-wrap { background: #0f1a24 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='3' cy='3' r='1' fill='%23ffffff10'/%3E%3C/svg%3E"); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.bubble { background: #212d3b; color: #f1f4f8; border-radius: 14px 14px 14px 4px; padding: 9px 12px 18px; max-width: 520px; white-space: pre-wrap; word-wrap: break-word; position: relative; font-size: 14px; }
.bubble .time { position: absolute; right: 10px; bottom: 4px; font-size: 11px; color: #8ea0b4; }
.bubble .ph { background: #2b5278; border-radius: 5px; padding: 0 3px; }
.bubble a { color: #6ab3f3; }
.tbtn { display: inline-block; margin-top: 6px; background: #2b3a4c; color: #e6edf5; border-radius: 8px; padding: 6px 14px; font-size: 13px; }
.tcard .problems { color: var(--danger); font-size: 12px; margin-top: 6px; }
.cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 16px; }
.cats a { background: #142030; color: #79b0f0; border-radius: 999px; padding: 5px 11px; font-size: 12.5px; text-decoration: none; border: 1px solid #1e3550; }

/* палитра */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 7px 7px 8px; text-align: left; position: relative; }
.pcard .c { height: 52px; border-radius: 8px; border: 1px solid rgba(255,255,255,.15); }
.pcard .nm { font-size: 12.5px; font-weight: 700; margin-top: 6px; }
.pcard .hx { font-family: ui-monospace, monospace; font-size: 10.5px; color: var(--muted); }
.pcard .marks { position: absolute; top: 12px; right: 12px; display: flex; gap: 3px; }
.pcard .marks span { width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.pcard .mz { background: #fff; color: #111; }
.pcard .mp { background: var(--accent); color: #111; }
.pcard.on { border-color: var(--accent); }
.banner { border-radius: 14px; padding: 16px 18px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); }
.banner .big { font-weight: 900; font-size: 22px; letter-spacing: .3px; }

/* нижняя панель */
.dock { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 18px; background: linear-gradient(to top, rgba(14,15,18,1) 60%, rgba(14,15,18,0)); z-index: 20; }
.dock .in { max-width: 1240px; margin: 0 auto; display: flex; gap: 10px; }
.dock .in .btn { flex: 1; }
.dock .in .btn.fit { flex: 0 0 auto; }

/* всплывашки */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: #eceaf0; color: #111; padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 100; max-width: 90vw; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.toast.err { background: #ffd9d4; color: #4a0d07; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 90; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; padding: 18px; width: min(460px, 100%); max-height: 86vh; overflow: auto; }
.modal h3 { margin-bottom: 12px; }
.modal .line { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.modal label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }

/* вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(360px, 100%); }
.login h1 { font-size: 22px; }

/* прочее */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs button { padding: 0; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); background: #000; }
.thumbs button.on { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.places { position: absolute; inset: 0; z-index: 4; }
.place { position: absolute; border: 2px solid #fff; border-radius: 4px; background: rgba(255,255,255,.08); cursor: grab; }
.place.on { border-color: #d7f25a; box-shadow: 0 0 0 2px rgba(215,242,90,.35); }
.place .num { position: absolute; top: -10px; left: -10px; width: 20px; height: 20px; border-radius: 50%; background: #111; color: #d7f25a; border: 2px solid #d7f25a; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.place .grip { position: absolute; right: -9px; bottom: -9px; width: 16px; height: 16px; border-radius: 50%; background: #d7f25a; cursor: nwse-resize; }
.compare { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.compare figure { margin: 0; }
.compare figcaption { color: var(--muted); font-size: 12px; text-align: center; margin-top: 6px; }
.timeline { display: grid; grid-template-columns: 100px 1fr; gap: 8px 12px; align-items: center; font-size: 12px; }
.bar { height: 28px; border-radius: 8px; display: flex; overflow: hidden; border: 1px solid var(--line); }
.bar span { display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #111; white-space: nowrap; overflow: hidden; }
.code { background: #0b0c0f; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-family: ui-monospace, monospace; font-size: 12px; white-space: pre; overflow: auto; max-height: 360px; color: #cfd3dc; }
.decisions { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.decisions .card h3 { font-size: 14px; }
.decisions .ok { color: var(--ok); font-weight: 700; font-size: 12.5px; margin-top: 8px; }
.empty { color: var(--muted); padding: 20px; text-align: center; }
.tabs-inline { display: flex; gap: 4px; margin-bottom: 10px; }
.mini-screen { border-radius: 22px; overflow: hidden; border: 2px solid #2d2f36; height: 640px; background: #000; }
.mini-screen iframe { width: 100%; height: 100%; border: 0; }
.dots { display: flex; gap: 4px; }
.dots button { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); padding: 0; }
/* длинные карусели шрифтов не должны распирать колонку */
.editor > div, .field > *, .group .body { min-width: 0; }
.shell { overflow-x: hidden; }
