@font-face { font-family: 'Barlow'; src: url('/fonts/barlow-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/fonts/barlow-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/fonts/barlow-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/fonts/barlow-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('/fonts/barlow-condensed-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('/fonts/barlow-condensed-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('/fonts/barlow-condensed-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --ink: #1B2220;
  --ink-2: #3A4542;
  --muted: #6B7470;
  --faint: #9AA39E;
  --rule: #D3D7D0;
  --rule-2: #E6E8E3;
  --bg: #E7E9E4;
  --paper: #FCFCFA;
  --paper-2: #F4F5F2;
  --ok: #1F8A4C;
  --alarm: #C62E25;
  --warn: #B7791F;
  --info: #2E5E8C;
  --yellow: #F2C230;
  --ph-r: #C8372D;
  --ph-s: #C99700;
  --ph-t: #1B2220;
  --good-zone: #CFE5D6;
  --bad-zone: #F2C9C5;
  --amber-zone: #F3E1B8;
  --radius: 4px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: Barlow, system-ui, sans-serif; background: var(--bg); color: var(--ink);
  font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.cond { font-family: 'Barlow Condensed', Barlow, sans-serif; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- top bar ---------- */
.top { background: var(--ink); color: #C9CFCB; height: 60px; display: flex; align-items: center; padding: 0 clamp(16px, 4vw, 60px); position: sticky; top: 0; z-index: 30; }
.mark { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: 16px; margin-right: 36px; white-space: nowrap; }
.nav { display: flex; height: 60px; }
.nav a { display: flex; align-items: center; gap: 7px; padding: 0 14px; font-weight: 500; color: #C9CFCB; position: relative; white-space: nowrap; }
.nav a:hover { color: #fff; }
.nav a.on { color: #fff; }
.nav a.on::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px; background: var(--yellow); }
.badge { background: var(--alarm); color: #fff; font-size: 11.5px; font-weight: 600; border-radius: 9px; padding: 0 6px; line-height: 17px; min-width: 17px; text-align: center; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 20px; font-size: 13.5px; }
.lamp { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.lamp.ok { background: #3CCB7F; box-shadow: 0 0 0 3px rgba(60, 203, 127, .22); }
.lamp.bad { background: #FF5A4E; box-shadow: 0 0 0 3px rgba(255, 90, 78, .25); }
.lamp.off { background: #8D9692; }
.conn { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.conn.alarm { color: #FF8A80; }
.clock { color: #8D9692; white-space: nowrap; }
.iconbtn { background: none; border: 0; color: #C9CFCB; cursor: pointer; display: grid; place-items: center; position: relative; padding: 4px; }
.iconbtn:hover { color: #fff; }
.iconbtn .badge { position: absolute; top: -4px; right: -8px; }
.av { width: 34px; height: 34px; border-radius: 50%; background: #3A4542; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; border: 0; cursor: pointer; }
.menu { position: absolute; right: 0; top: 46px; background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--radius); min-width: 230px; box-shadow: 0 8px 24px rgba(27, 34, 32, .12); padding: 6px; z-index: 40; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--rule-2); margin-bottom: 4px; }
.menu button, .menu a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 3px; cursor: pointer; font-weight: 500; }
.menu button:hover, .menu a:hover { background: var(--paper-2); }
.devsel { background: #2A3330; color: #fff; border: 1px solid #3C4744; border-radius: 3px; padding: 4px 8px; }

.sub { background: var(--paper-2); border-bottom: 1px solid var(--rule); height: 46px; display: flex; align-items: center; padding: 0 clamp(16px, 4vw, 60px); gap: 6px; }
.sub a { padding: 7px 12px; border-radius: 3px; font-weight: 500; color: var(--muted); border: 1px solid transparent; }
.sub a:hover { color: var(--ink); }
.sub a.on { background: #fff; color: var(--ink); border-color: var(--rule); }

/* ---------- page ---------- */
.page { padding: 30px clamp(16px, 4vw, 60px) 48px; max-width: 1560px; margin: 0 auto; }
.ph { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; gap: 30px; flex-wrap: wrap; }
.ph h1 { font-family: 'Barlow Condensed'; font-weight: 600; font-size: 38px; line-height: 1.05; letter-spacing: -.2px; display: flex; align-items: center; gap: 14px; }
.ph h1.alarm { color: var(--alarm); }
.ph p { color: var(--muted); margin-top: 6px; font-size: 15px; max-width: 760px; }
.acts { display: flex; gap: 10px; flex-wrap: wrap; }
.biglamp { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.biglamp.ok { background: var(--ok); box-shadow: 0 0 0 5px rgba(31, 138, 76, .18); }
.biglamp.bad { background: var(--alarm); box-shadow: 0 0 0 5px rgba(198, 46, 37, .18); }
.biglamp.warn { background: var(--warn); box-shadow: 0 0 0 5px rgba(183, 121, 31, .18); }
.biglamp.off { background: var(--faint); box-shadow: 0 0 0 5px rgba(154, 163, 158, .25); }

.grid { display: grid; gap: 20px; }
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); min-width: 0; }
.pad { padding: 16px 22px; }
.pt { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 22px 0; flex-wrap: wrap; }
.pt h2, h2.t { font-size: 16px; font-weight: 600; }
.pt .d, .d { color: var(--muted); font-size: 13.5px; }
.rowline { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.divide { border-top: 1px solid var(--rule-2); }

.num { font-family: 'Barlow Condensed'; font-weight: 600; line-height: 1; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 14px; padding: 9px 16px; border-radius: 3px; border: 1px solid #BFC5BE; background: #FCFCFA; color: var(--ink); white-space: nowrap; cursor: pointer; }
.btn:hover { background: #F1F2EE; }
.btn.ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ink:hover { background: #2C3633; }
.btn.red { background: var(--alarm); border-color: var(--alarm); color: #fff; }
.btn.red:hover { background: #A9251D; }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; background: none; border: 0; padding: 0; }

.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 3px; overflow-x: auto; background: #fff; max-width: 100%; }
.seg button { padding: 5px 12px; font-size: 13px; font-weight: 500; color: var(--muted); border: 0; border-left: 1px solid var(--rule); background: none; cursor: pointer; white-space: nowrap; }
.seg button:first-child { border-left: 0; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--ink); color: #fff; }
.seg.full { display: flex; }
.seg.full button { flex: 1; }

.sw { width: 40px; height: 22px; border-radius: 11px; background: #C3C9C2; position: relative; display: inline-block; flex-shrink: 0; border: 0; cursor: pointer; transition: background .15s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.sw.on { background: var(--ok); }
.sw.on::after { left: 21px; }
.sw:disabled { opacity: .5; cursor: not-allowed; }

.inp { border: 1px solid #BFC5BE; border-radius: 3px; background: #fff; padding: 0 11px; display: flex; align-items: center; gap: 8px; height: 40px; min-width: 0; }
.inp:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.inp input, .inp select { border: 0; outline: 0; background: none; flex: 1; min-width: 0; height: 100%; font-weight: 500; }
.inp .u { color: var(--muted); font-size: 13px; white-space: nowrap; }
.lab { font-size: 13.5px; font-weight: 500; margin-bottom: 6px; display: block; }
.field { margin-bottom: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.err { color: var(--alarm); font-size: 13.5px; font-weight: 500; }
.ck { width: 17px; height: 17px; border-radius: 3px; border: 1.5px solid #9AA39E; display: inline-grid; place-items: center; flex-shrink: 0; background: #fff; }
.ck.on { background: var(--ink); border-color: var(--ink); color: #fff; }
label.check { display: flex; align-items: center; gap: 10px; padding: 5px 0; cursor: pointer; user-select: none; }
label.check input { position: absolute; opacity: 0; pointer-events: none; }
label.check input:focus-visible + .ck { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- tables ---------- */
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-weight: 500; font-size: 13px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--rule-2); font-size: 14px; }
tr:last-child td { border-bottom: 0; }
.r { text-align: right; }
.c { text-align: center; }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 22px; }
.tablewrap { overflow-x: auto; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; }
.ax { font-size: 12px; fill: #7D8682; font-family: Barlow; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12.5px; padding: 7px 9px; border-radius: 3px; white-space: nowrap; z-index: 5; line-height: 1.5; }
.tip b { font-weight: 600; }
.empty { padding: 40px 22px; text-align: center; color: var(--muted); }

/* ---------- toast & modal ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--radius); max-width: 380px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: 14px; border-left: 4px solid var(--yellow); }
.toast.alarm { border-left-color: #FF5A4E; }
.toast.ok { border-left-color: #3CCB7F; }
.toast b { display: block; }
.scrim { position: fixed; inset: 0; background: rgba(27, 34, 32, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--paper); border-radius: var(--radius); width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 8px; }
.modal header h3 { font-family: 'Barlow Condensed'; font-size: 26px; font-weight: 600; }
.modal .body { padding: 8px 22px 6px; }
.modal footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; }

/* ---------- responsive ---------- */
.hide-sm { }
@media (max-width: 1180px) {
  .clock { display: none; }
  .mark { margin-right: 16px; }
  .nav a { padding: 0 10px; }
}
@media (max-width: 900px) {
  .top { flex-wrap: wrap; height: auto; padding-top: 10px; }
  .nav { order: 3; width: 100%; overflow-x: auto; height: 46px; }
  .top-right { gap: 14px; }
  .conn span.txt { display: none; }
  .ph h1 { font-size: 30px; }
  .hide-sm { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
