/* Ternit operations panel. The tokens, faces and logo are ternit.ru's (site/assets/style.css, commit f9e66d1d3):
   an institutional navy on cool paper, amber kept for measured numbers. Both themes authored by hand. Served by the
   product itself: no request leaves the server. */

@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/ops/assets/golos-cyr.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/ops/assets/golos-lat.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2212; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/ops/assets/jbm-cyr.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/ops/assets/jbm-lat.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2212; }

:root {
  --sans: "Golos Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --page: 76rem;
  --gut: clamp(1rem, 3.5vw, 2.5rem);
  --ease: cubic-bezier(.2, .7, .3, 1);
  --r: 10px;
}

:root, :root[data-theme="light"] {
  color-scheme: light;
  --bg: #FFFFFF; --bg-2: #F4F6F9; --bg-deep: #0E2233; --on-deep: #E8EEF3;
  --ink: #0E1B26; --ink-2: #4F6070; --ink-3: #7C8B99;
  --line: #E2E8EE; --line-2: #C8D3DC;
  --brand: #10466A; --brand-2: #1B6A97; --brand-bg: #EAF1F6; --on-brand: #FFFFFF;
  --signal: #8F5A0C; --signal-bg: #FAF2E4; --ok: #1F6B4A; --ok-bg: #E7F3EC;
  --bad: #A8322D; --bad-bg: #FBECEA;
  --shadow: 0 14px 30px -24px rgba(14, 34, 51, .55);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0A1219; --bg-2: #0F1A23; --bg-deep: #E8EEF3; --on-deep: #0A1219;
    --ink: #E7EEF4; --ink-2: #9DAEBC; --ink-3: #748695;
    --line: #1B2833; --line-2: #2A3A47;
    --brand: #5EA9D2; --brand-2: #8AC6E8; --brand-bg: #10222F; --on-brand: #07141D;
    --signal: #DFA75A; --signal-bg: #231C10; --ok: #58B98C; --ok-bg: #0F2219;
    --bad: #F08A80; --bad-bg: #2A1513;
    --shadow: 0 16px 34px -26px rgba(0, 0, 0, .9);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --s8: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A1219; --bg-2: #0F1A23; --bg-deep: #E8EEF3; --on-deep: #0A1219;
  --ink: #E7EEF4; --ink-2: #9DAEBC; --ink-3: #748695;
  --line: #1B2833; --line-2: #2A3A47;
  --brand: #5EA9D2; --brand-2: #8AC6E8; --brand-bg: #10222F; --on-brand: #07141D;
  --signal: #DFA75A; --signal-bg: #231C10; --ok: #58B98C; --ok-bg: #0F2219;
  --bad: #F08A80; --bad-bg: #2A1513;
  --shadow: 0 16px 34px -26px rgba(0, 0, 0, .9);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --s8: #e66767;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg-2); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg-2); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3 { margin: 0; letter-spacing: -.018em; text-wrap: balance; }
p { margin: 0; }
a { color: var(--brand); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 3px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.lab { font-family: var(--mono); font-size: .6875rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--brand); }
.mute { color: var(--ink-3); }
.wrap { width: 100%; max-width: var(--page); margin-inline: auto; padding-inline: var(--gut); }

/* header */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: .75rem 1.5rem; min-height: 4rem; padding-block: .55rem; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--ink); margin-right: auto; }
.logo svg { width: 2rem; height: 2rem; flex: none; }
.logo b { font-size: 1.05rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; display: block; line-height: 1.15; }
.logo i { font-style: normal; font-size: .75rem; color: var(--ink-3); display: block; line-height: 1.2; }
.menu { display: flex; gap: 1.25rem; overflow-x: auto; scrollbar-width: none; }
.menu a { color: var(--ink-2); text-decoration: none; font-size: .9rem; font-weight: 500; padding-block: .25rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.menu a:hover { color: var(--ink); border-bottom-color: var(--line-2); }
.top-act { display: flex; align-items: center; gap: .5rem; }
.pill { display: inline-flex; align-items: center; gap: .45rem; font-size: .8125rem; color: var(--ink-2); padding: .3rem .7rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg); white-space: nowrap; }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--signal); }
.dot.live { animation: pulse 1.6s var(--ease) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 100% { box-shadow: 0 0 0 .5rem transparent; } }
.tgl { width: 2.15rem; height: 2.15rem; display: grid; place-items: center; padding: 0; background: none; border: 1px solid var(--line-2);
  border-radius: 6px; color: var(--ink-2); cursor: pointer; transition: color .18s var(--ease), border-color .18s var(--ease); }
.tgl:hover { color: var(--ink); border-color: var(--ink-3); }
.tgl svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.tgl .i-moon { display: none; }
:root[data-theme="dark"] .tgl .i-moon { display: block; } :root[data-theme="dark"] .tgl .i-sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tgl .i-moon { display: block; } :root:not([data-theme="light"]) .tgl .i-sun { display: none; } }
@media (max-width: 44rem) { .menu { order: 3; width: 100%; } .logo i { display: none; } }

/* sections and cards */
main { padding-block: 1.5rem 4rem; }
.sec { margin-top: clamp(2rem, 4vw, 3rem); scroll-margin-top: 6rem; }
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.sec-head h2 { font-size: clamp(1.3rem, 2.4vw, 1.65rem); line-height: 1.2; font-weight: 700; margin-top: .35rem; }
.sec-head p { color: var(--ink-2); font-size: .9375rem; max-width: 60ch; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: clamp(1rem, 2.4vw, 1.5rem);
  transition: border-color .3s var(--ease); min-width: 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); }
.split { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 56rem) { .split { grid-template-columns: minmax(0, 1fr); } }

/* figures */
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.fig { background: var(--bg); padding: 1.1rem 1.2rem; margin: 0; }
.fig dt { font-size: .8125rem; color: var(--ink-3); margin-bottom: .35rem; }
.fig dd { margin: 0; font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; font-size: clamp(1.25rem, 2.4vw, 1.55rem);
  line-height: 1.15; color: var(--signal); }
.fig dd small { display: block; margin-top: .35rem; font-family: var(--sans); font-size: .8125rem; font-weight: 400; color: var(--ink-2); }
.flash { animation: flash 1.4s var(--ease); }
@keyframes flash { 0% { background: var(--signal-bg); } 100% { background: var(--bg); } }

/* state badge */
.badge { display: inline-flex; align-items: center; gap: .45rem; font-size: .8125rem; font-weight: 600; padding: .28rem .7rem; border-radius: 999px;
  background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line); transition: background-color .4s var(--ease), color .4s var(--ease); }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--signal-bg); color: var(--signal); border-color: transparent; }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }

/* buttons */
.act { display: grid; gap: .3rem; align-content: start; }
.act + .act { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.why { font-size: .8125rem; color: var(--ink-3); line-height: 1.45; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .62rem 1.1rem; border-radius: 6px; border: 1px solid transparent;
  font-family: var(--sans); font-size: .9rem; font-weight: 600; cursor: pointer; white-space: nowrap; background: none; color: var(--ink);
  transition: background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), transform .12s var(--ease); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-solid { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-solid:hover:not(:disabled) { background: var(--brand-2); border-color: var(--brand-2); }
.btn-line { border-color: var(--line-2); }
.btn-line:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn-warn { border-color: color-mix(in srgb, var(--bad) 55%, var(--line-2)); color: var(--bad); }
.btn-warn:hover:not(:disabled) { background: var(--bad-bg); }
.btn-sm { padding: .38rem .75rem; font-size: .8125rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
input[type=text], input[type=password], textarea, select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line-2);
  border-radius: 6px; padding: .55rem .7rem; min-width: 0; transition: border-color .18s var(--ease); }
input:focus, textarea:focus { border-color: var(--brand); outline: none; }
input.mono, textarea { font-family: var(--mono); font-size: .8125rem; }
textarea { width: 100%; min-height: 18rem; resize: vertical; line-height: 1.5; }

/* machines */
.m-head { display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
.m-head h3 { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.m-role { font-size: .875rem; color: var(--ink-2); margin-top: .15rem; }
.m-sub { font-size: .75rem; color: var(--ink-3); margin-top: .9rem; }
.gpu { margin-top: 1rem; }
.gpu-top { display: flex; justify-content: space-between; gap: .5rem; font-size: .8125rem; color: var(--ink-2); }
.gpu-top b { font-weight: 600; color: var(--ink); }
.meter { height: .5rem; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; margin-top: .35rem; }
.meter > i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--brand); transition: width .7s var(--ease); }
.meter.hot > i { background: var(--signal); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .25rem .9rem; font-size: .8125rem; margin-top: 1rem; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; color: var(--ink-2); text-align: right; overflow-wrap: anywhere; min-width: 0; }
.ev { margin-top: .3rem; overflow-wrap: anywhere; }
.gpu-top .num { white-space: nowrap; }
@media (max-width: 30rem) { .pill span:last-child { max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis; } .m-head .chip { display: none; } }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .8rem; }
.chip { font-size: .75rem; font-weight: 500; padding: .2rem .55rem; border-radius: 999px; background: var(--brand-bg); color: var(--brand); }
.chip.idle { background: var(--bg-2); color: var(--ink-3); }
.alert { margin-top: .9rem; font-size: .8125rem; padding: .6rem .75rem; border-radius: 6px; background: var(--bad-bg); color: var(--bad); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: .875rem; }
.tbl th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: .75rem; padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .axis-t { fill: var(--ink-3); font-family: var(--mono); font-size: 10.5px; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .cross { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .mk { stroke: var(--bg); stroke-width: 2; }
.tip { position: absolute; pointer-events: none; background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow);
  padding: .5rem .65rem; font-size: .75rem; min-width: 9rem; opacity: 0; transition: opacity .12s var(--ease); z-index: 5; }
.tip b { display: block; font-family: var(--mono); font-weight: 500; color: var(--ink-2); margin-bottom: .25rem; }
.tip div { display: flex; align-items: center; gap: .4rem; justify-content: space-between; color: var(--ink-2); }
.tip span.v { font-family: var(--mono); color: var(--ink); }
.sw { width: .7rem; height: .18rem; border-radius: 2px; flex: none; display: inline-block; }
.sw.dash { background-image: linear-gradient(90deg, currentColor 55%, transparent 55%) !important; background-size: .35rem 100%; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.lg { display: inline-flex; align-items: center; gap: .4rem; font-size: .8125rem; color: var(--ink-2); padding: .25rem .6rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); cursor: pointer; transition: border-color .18s var(--ease), opacity .18s var(--ease); }
.lg[aria-pressed="false"] { opacity: .5; }
.lg[aria-pressed="true"] { border-color: var(--line-2); }
#r-more { opacity: 1; border-style: dashed; color: var(--brand); }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--ink-3); font-size: .875rem; }

/* toast and dialog */
.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translate(-50%, 1rem); max-width: min(36rem, calc(100% - 2rem)); background: var(--bg-deep);
  color: var(--on-deep); padding: .75rem 1rem; border-radius: 8px; font-size: .875rem; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease); z-index: 50; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }
dialog { border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); color: var(--ink); padding: 1.4rem; max-width: min(30rem, calc(100% - 2rem));
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .5); }
dialog::backdrop { background: rgba(10, 18, 25, .45); backdrop-filter: blur(2px); }
dialog h3 { font-size: 1.1rem; } dialog p { color: var(--ink-2); font-size: .9rem; margin-top: .6rem; }
dialog .row { margin-top: 1.2rem; justify-content: flex-end; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login .card { width: min(24rem, 100%); padding: 2rem; }
.login h1 { font-size: 1.4rem; margin-top: 1.4rem; }
.login p { color: var(--ink-2); font-size: .9rem; margin-top: .4rem; }
.login form { display: grid; gap: .8rem; margin-top: 1.4rem; }
.login .err { color: var(--bad); background: var(--bad-bg); padding: .55rem .75rem; border-radius: 6px; font-size: .875rem; margin-top: 1rem; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
