/* Layout: консоль оператора в фирменной тёмной палитре EORA. Слева навигация и статус шлюза,
   справа рабочая область. Главный объект интерфейса — черновик: правки копятся до явного «Применить». */
:root {
  --bg: #141415;
  --surface: #1d1d20;
  --surface-2: #252527;
  --line: #38383d;
  --fg: #f2f4fa;
  --muted: #919192;
  --accent: #ffcd2e;
  --accent-hover: #daae21;
  --accent-ink: #141415;
  --accent-soft: #3a3318;
  --accent-text: #ffcd2e;
  --ok: #4fd18b;
  --ok-soft: #123324;
  --warn: #ff9a47;
  --warn-soft: #3b2512;
  --bad: #ff6b61;
  --bad-soft: #3d1b19;
  --code-bg: #101011;
  --add-bg: #123324;
  --del-bg: #3d1b19;
  --logo-ink: #f2f4fa;
  --shadow: 0 16px 40px rgba(0, 0, 0, .6);
  --font-ui: "Inter", Arial, system-ui, sans-serif;
  --font-mono: "Source Code Pro", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f4f6; --surface: #ffffff; --surface-2: #ececef; --line: #dcdce1;
    --fg: #141415; --muted: #6b6b72; --accent-hover: #daae21; --accent-soft: #fff0b8; --accent-text: #6e5200;
    --ok: #12794f; --ok-soft: #d8f2e4; --warn: #a64b00; --warn-soft: #ffe6cc; --bad: #c0281b; --bad-soft: #fadad6;
    --code-bg: #f1f1f4; --add-bg: #d8f2e4; --del-bg: #fadad6; --logo-ink: #141415; --shadow: 0 16px 40px rgba(20, 20, 21, .2);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f4f4f6; --surface: #ffffff; --surface-2: #ececef; --line: #dcdce1;
  --fg: #141415; --muted: #6b6b72; --accent-hover: #daae21; --accent-soft: #fff0b8; --accent-text: #6e5200;
  --ok: #12794f; --ok-soft: #d8f2e4; --warn: #a64b00; --warn-soft: #ffe6cc; --bad: #c0281b; --bad-soft: #fadad6;
  --code-bg: #f1f1f4; --add-bg: #d8f2e4; --del-bg: #fadad6; --logo-ink: #141415; --shadow: 0 16px 40px rgba(20, 20, 21, .2);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font-ui); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.app { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: env(safe-area-inset-top, 0px); align-self: start; height: 100vh;
  padding: 22px 14px 18px max(18px, env(safe-area-inset-left, 0px)); border-right: 1px solid var(--line);
  background: var(--surface); display: flex; flex-direction: column; gap: 20px;
}
.brand { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.brand .logo { height: 30px; width: auto; display: block; }
.brand span { font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.host { font: 12px var(--font-mono); color: var(--muted); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--code-bg); }
.host b { color: var(--fg); font-weight: 500; display: block; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; justify-content: space-between; align-items: center; text-decoration: none; padding: 9px 12px; border-radius: 999px; color: var(--muted); }
.nav a:hover { background: var(--surface-2); color: var(--fg); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.badge { font: 600 11px var(--font-mono); background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 1px 8px; }
.badge:empty { display: none; }
.themebtn { margin-top: auto; align-self: flex-start; background: none; border: 0; padding: 6px 0; color: var(--muted); font-size: 12px; cursor: pointer; }
.themebtn:hover { color: var(--fg); }
.me { margin-top: 8px; display: flex; align-items: center; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.me .av { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 600; }
.me small { display: block; color: var(--muted); }
.me a { margin-left: auto; font-size: 12px; color: var(--muted); }
.main { min-width: 0; padding: 20px max(24px, env(safe-area-inset-right, 0px)) 64px 28px; }
.head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; }
h1 { font-size: 28px; line-height: 1.15; margin: 0; font-weight: 600; letter-spacing: -.02em; text-wrap: balance; }
.sub { color: var(--muted); margin: 6px 0 0; max-width: 64ch; }
.btn { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 8px 18px; cursor: pointer; font-weight: 500; transition: background-color .2s, color .2s, border-color .2s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.sm { padding: 3px 12px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }
.draft { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: 20px; padding: 12px 18px; margin-bottom: 18px; }
.draft b { color: var(--fg); font-weight: 600; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tools input, .tools select, .f input, .f select, .f textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; min-width: 0; }
.tools input { flex: 1 1 220px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 8px 14px; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.row { cursor: pointer; }
tbody tr.row:hover { background: var(--surface-2); }
tr.pend td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.down { background: var(--bad); }
.tag { display: inline-block; font: 500 11px var(--font-mono); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; margin-right: 4px; color: var(--muted); }
.tag.hot { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.tag.new { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 20px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.pill { font: 12px var(--font-mono); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; display: flex; align-items: center; background: var(--code-bg); }
.pill .dot { margin-right: 6px; } .pill em { font-style: normal; color: var(--muted); margin-left: 6px; }
h2 { font-size: 16px; margin: 0 0 4px; font-weight: 600; letter-spacing: -.01em; }
.cap { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 0 3px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 6px; }
.kv label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.kv input { background: var(--code-bg); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; font: 12.5px var(--font-mono); min-width: 0; }
pre.code, textarea.code { font: 12.5px/1.55 var(--font-mono); background: var(--code-bg); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 0; overflow-x: auto; width: 100%; color: var(--fg); white-space: pre; }
textarea.code { min-height: 250px; resize: vertical; }
.diff { font: 12.5px/1.6 var(--font-mono); border: 1px solid var(--line); border-radius: 16px; overflow-x: auto; background: var(--code-bg); padding: 6px 0; }
.diff div { padding: 0 14px; white-space: pre; min-width: max-content; }
.diff .a { background: var(--add-bg); } .diff .d { background: var(--del-bg); } .diff .h { color: var(--muted); padding-top: 6px; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; }
.ic { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--font-mono); background: var(--ok-soft); color: var(--ok); }
.ic.warn { background: var(--warn-soft); color: var(--warn); } .ic.run { background: var(--surface-2); color: var(--muted); }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 16px; align-items: start; }
.over { position: fixed; inset: 0; background: rgba(5, 5, 6, .6); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(540px, 100%); background: var(--surface); z-index: 41; box-shadow: var(--shadow); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px); border-left: 1px solid var(--line); }
.drawer header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.drawer .body { padding: 18px 22px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.drawer footer { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.f { display: flex; flex-direction: column; gap: 4px; }
.f label { font-size: 12px; color: var(--muted); }
.f .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.f .hint { font-size: 12px; color: var(--muted); } .f .err { font-size: 12px; color: var(--bad); }
.chk { display: flex; flex-wrap: wrap; gap: 14px; }
.chk label { display: flex; gap: 6px; align-items: center; color: var(--fg); font-size: 14px; }
.chk input { accent-color: var(--accent); }
.modal { position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100% - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--accent); color: var(--accent-ink); font-weight: 500; padding: 11px 20px; border-radius: 999px; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.confirm { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; border: 1px solid var(--line); background: var(--surface-2); border-radius: 20px; padding: 14px 16px; margin-top: 14px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px max(16px, env(safe-area-inset-left, 0px)); }
.login .card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; }
.logbox { font: 12.5px/1.7 var(--font-mono); border: 1px solid var(--line); border-radius: 16px; background: var(--code-bg); max-height: 460px; overflow: auto; padding: 6px 0; }
.lr { display: grid; grid-template-columns: 70px 120px 50px minmax(190px, 1fr) 70px 80px; gap: 10px; padding: 1px 14px; min-width: 680px; white-space: nowrap; }
.lr:hover { background: var(--surface-2); } .lr.lh { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; position: sticky; top: 0; background: var(--code-bg); }
.st.s2 { color: var(--ok); } .st.s4 { color: var(--warn); } .st.s5 { color: var(--bad); }
.ltext { padding: 1px 14px; white-space: pre; min-width: max-content; }
.sw { display: flex; align-items: center; gap: 8px; } .sw input { accent-color: var(--accent); width: 16px; height: 16px; }
.msg { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px; padding: 10px 14px; background: var(--code-bg); font-size: 13px; white-space: pre-wrap; }
.res { margin-top: 8px; font-size: 13px; }
.bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; min-width: 96px; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--ok); } .bar.warn i { background: var(--warn); } .bar.bad i { background: var(--bad); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 14px 16px; min-width: 0; }
.tile .k { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.tile .v { font: 600 28px/1.2 var(--font-ui); letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .v small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.tile .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile.warn { border-color: var(--warn); } .tile.warn .v { color: var(--warn); } .tile.bad { border-color: var(--bad); } .tile.bad .v { color: var(--bad); }
.tile svg { display: block; width: 100%; height: 28px; margin-top: 8px; }
.chgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; margin-bottom: 16px; }
.ch { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 16px 16px 10px; min-width: 0; }
.ch h2 { margin: 0 0 2px; } .ch svg { width: 100%; height: auto; display: block; margin-top: 6px; }
.gl { stroke: var(--line); stroke-width: 1; } .tx { fill: var(--muted); font: 11px var(--font-mono); }
.ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; } .ln.a { stroke: var(--accent); } .ln.k { stroke: var(--ok); } .ln.w { stroke: var(--warn); } .ln.b { stroke: var(--bad); } .ln.m { stroke: var(--muted); }
.ar.ok { fill: var(--ok); fill-opacity: .65; } .ar.warn { fill: var(--warn); fill-opacity: .85; } .ar.bad { fill: var(--bad); fill-opacity: .95; }
.lgd { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.lgd i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; } .i-a { background: var(--accent); } .i-k { background: var(--ok); } .i-w { background: var(--warn); } .i-b { background: var(--bad); } .i-m { background: var(--muted); }
.spark { fill: none; stroke: var(--accent); stroke-width: 1.6; } .spark.bad { stroke: var(--bad); } .spark.k { stroke: var(--ok); }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; } .meter i { display: block; height: 100%; background: var(--ok); } .meter.warn i { background: var(--warn); } .meter.bad i { background: var(--bad); }
.sysrow { display: grid; grid-template-columns: 110px minmax(0, 1fr) 60px; gap: 10px; align-items: center; font-size: 13px; margin: 8px 0; } .sysrow span:last-child { text-align: right; font-family: var(--font-mono); }
.tcw { position: relative; } .tcw .cur { position: absolute; top: 6%; bottom: 13%; width: 1px; background: var(--fg); opacity: .45; display: none; pointer-events: none; }
.ttb { position: absolute; top: 2px; display: none; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 12px; pointer-events: none; z-index: 2; white-space: nowrap; line-height: 1.5; }
.band { fill: var(--warn); fill-opacity: .15; } .band.sel { fill: var(--accent); fill-opacity: .32; }
.hline { stroke-width: 1.2; stroke-dasharray: 5 4; } .hline.m { stroke: var(--muted); } .hline.w { stroke: var(--warn); }
.ar.acc { fill: var(--accent); fill-opacity: .16; }
.hm { fill: var(--accent); } .hm0 { fill: var(--surface-2); }
.tcw { cursor: crosshair; user-select: none; } .selb { position: absolute; top: 6%; bottom: 13%; background: var(--accent); opacity: .2; border-left: 1px solid var(--accent); border-right: 1px solid var(--accent); display: none; pointer-events: none; }
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); border-right: 0; border-bottom: 1px solid var(--line); }
  .brand span, .host { display: none; } .nav { flex-direction: row; overflow-x: auto; max-width: 100%; } .nav a { white-space: nowrap; gap: 8px; } .me { margin: 0 0 0 auto; border: 0; padding: 0; } .themebtn { margin: 0; }
  .main { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 60px max(16px, env(safe-area-inset-left, 0px)); }
  .row2 { grid-template-columns: minmax(0, 1fr); } h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: no-preference) { .drawer { animation: slide .18s ease-out; } @keyframes slide { from { transform: translateX(40px); opacity: .4; } } }
/* Дополнения к макету */
.err-box { background: var(--bad-soft); color: var(--bad); border-radius: 16px; padding: 10px 14px; font-size: 13px; white-space: pre-wrap; }
.ok-box { background: var(--ok-soft); color: var(--ok); border-radius: 16px; padding: 10px 14px; font-size: 13px; white-space: pre-wrap; }
.warn-box { background: var(--warn-soft); color: var(--warn); border-radius: 16px; padding: 10px 14px; font-size: 13px; white-space: pre-wrap; }
.issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.issues li.error { color: var(--bad); } .issues li.warning { color: var(--warn); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sp .8s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }
.empty { padding: 22px; color: var(--muted); }
.radio { display: flex; gap: 14px; flex-wrap: wrap; } .radio label { display: flex; gap: 6px; align-items: center; color: var(--fg); font-size: 14px; } .radio input { accent-color: var(--accent); }
.loading { padding: 40px 0; color: var(--muted); }
.srvbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.kvt { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; font-size: 13px; } .kvt dt { color: var(--muted); } .kvt dd { margin: 0; font-family: var(--font-mono); font-size: 12.5px; overflow-wrap: anywhere; }
.fdiff summary { cursor: pointer; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 13px; }
.fdiff[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 0; }
.fdiff[open] .diff { border-top-left-radius: 0; border-top-right-radius: 0; max-height: 70vh; overflow: auto; }
.tools input[type=checkbox], .tools input[type=radio] { flex: none; }
.tools .sw { flex: none; white-space: nowrap; }
.logbox { padding-top: 0; }
.lr.lh { z-index: 1; box-shadow: 0 1px 0 var(--line); }
.sysrow { grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 60px; }
.sysrow > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.selcell { width: 34px; padding-right: 0; } .selcell input { accent-color: var(--accent); width: 16px; height: 16px; }
.selbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: 8px 14px; margin-bottom: 10px; font-size: 13px; }
.btn.xs { padding: 2px 9px; font-size: 12px; line-height: 1.5; }
td.acts { text-align: right; white-space: nowrap; width: 1%; }
td.acts .btn + .btn { margin-left: 4px; }
