  :root { --bg:#0e1014; --card:#171b22; --card2:#1d222b; --line:#262d38; --text:#e6e9ef; --muted:#8a929c; --accent:#38bdf8; --green:#4ade80; --amber:#fbbf24; --red:#f87171; }
  * { box-sizing:border-box; margin:0; padding:0; }
  body { background:var(--bg); color:var(--text); font-family:'Segoe UI',system-ui,sans-serif; padding:18px; }
  .wrap { max-width:1100px; margin:0 auto; }
  header { background:linear-gradient(135deg,#0ea5e9 0%,#2563eb 55%,#7c3aed 100%); border-radius:16px; padding:22px 26px; margin-bottom:18px; box-shadow:0 10px 30px rgba(37,99,235,.25); }
  header h1 { font-size:26px; }
  header .sub { color:#dbeafe; margin-top:4px; font-size:14px; }
  .grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
  .card { background:var(--card); border:1px solid var(--line); border-radius:14px; padding:16px 18px; }
  .card.full { grid-column:1 / -1; }
  .card h2 { font-size:15px; color:var(--accent); }
  .card .desc { color:var(--muted); font-size:12.5px; margin-bottom:12px; }
  .row { display:flex; align-items:center; gap:10px; margin:8px 0; flex-wrap:wrap; }
  .row label { min-width:170px; font-size:13px; }
  /* MCB v1.4.2+: метки источника значений (сайт сети / пользовательское) */
  .ntag { font-size:10.5px; padding:2px 8px; border-radius:999px; white-space:nowrap; display:none; cursor:help; }
  .ntag.site { display:inline-block; background:rgba(74,222,128,.12); color:var(--green); border:1px solid rgba(74,222,128,.4); }
  .ntag.user { display:inline-block; background:rgba(96,165,250,.12); color:#60a5fa; border:1px solid rgba(96,165,250,.4); }
  .netstatus { font-size:12px; color:var(--muted); background:var(--card2); border:1px dashed var(--line); border-radius:8px; padding:7px 11px; margin:2px 0 10px; }
  .netstatus.ok { color:var(--green); border-color:rgba(74,222,128,.4); }
  .netstatus.warn { color:var(--amber); border-color:rgba(251,191,36,.4); }
  input[type=text], input[type=number], input[type=password], select { background:var(--card2); color:var(--text); border:1px solid var(--line); border-radius:8px; padding:8px 10px; font-size:13.5px; min-width:150px; outline:none; }
  input:focus, select:focus { border-color:var(--accent); }
  .chk { display:flex; align-items:center; gap:8px; font-size:13px; margin:6px 0; cursor:pointer; }
  .chk input { width:17px; height:17px; accent-color:var(--accent); cursor:pointer; }
  .chk.off { opacity:.4; cursor:not-allowed; }
  .chk.off input { cursor:not-allowed; }
  .compat-note { display:none; margin:8px 0 2px; padding:8px 10px; border:1px solid var(--accent); border-radius:8px; font-size:12.5px; color:var(--accent); background:rgba(56,189,248,.06); }
  /* MCB v1.9.2е: расчёт калибровки АКБ по мультиметру (три поля + показание узла) */
  .adc-calc { display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; margin:6px 0 2px; }
  .adc-calc .ac-cell { display:flex; flex-direction:column; gap:4px; }
  .adc-calc .ac-cell small { color:var(--muted); font-size:11px; line-height:1.2; }
  .adc-calc .ac-cell input { min-width:0; }
  .adc-calc .ac-cell input[readonly] { color:var(--accent); border-style:dashed; cursor:default; }
  .adc-calc .ac-cell:nth-child(1) input { width:110px; }
  .adc-calc .ac-cell:nth-child(2) input { width:120px; }
  .adc-calc .ac-cell:nth-child(3) input { width:130px; }
  .adc-calc .ac-cell:nth-child(4) input { width:110px; }
  .sensors { display:grid; grid-template-columns:1fr 1fr; gap:2px 18px; }
  .btn { background:linear-gradient(135deg,#10b981,#059669); color:#fff; border:none; border-radius:10px; padding:13px 26px; font-size:15px; font-weight:600; cursor:pointer; }
  .btn:hover { filter:brightness(1.1); }
  .btn:disabled { filter:grayscale(.6); cursor:not-allowed; }
  .btn.ghost { background:var(--card2); color:var(--text); border:1px solid var(--line); padding:9px 16px; font-size:13px; }
  .toolbar { display:flex; gap:12px; align-items:center; margin:16px 0 10px; flex-wrap:wrap; }
  .badge { font-size:12px; padding:3px 10px; border-radius:20px; background:var(--card2); border:1px solid var(--line); color:var(--muted); }
  .badge.ok { color:var(--green); border-color:rgba(74,222,128,.4); }
  .badge.err { color:var(--red); border-color:rgba(248,113,113,.4); }
  .badge.run { color:var(--amber); border-color:rgba(251,191,36,.4); }
  .log-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
  .log { background:#0a0c10; border:1px solid var(--line); border-radius:12px; height:250px; overflow-y:auto; padding:12px 14px; font-family:'Cascadia Mono','Consolas',monospace; font-size:12.5px; white-space:pre-wrap; word-break:break-all; margin-top:14px; }
  .log .l-ok { color:var(--green); }
  .log .l-err { color:var(--red); }
  .log .l-warn { color:var(--amber); }
  .dl { display:flex; gap:10px; flex-wrap:wrap; margin-top:10px; }
  .dl a { background:var(--card2); border:1px solid var(--accent); color:var(--accent); border-radius:9px; padding:9px 16px; text-decoration:none; font-size:13px; }
  .dl a.instr { background:linear-gradient(135deg,#0ea5e9,#2563eb); color:#fff; border-color:transparent; }

  /* --- MCB v1.2.0: занятость очереди, футер, статистика --- */
  .btn.ready { background:linear-gradient(135deg,#10b981,#059669); }
  .btn.busy { background:linear-gradient(135deg,#ef4444,#b91c1c); animation:blink 1.1s ease-in-out infinite; cursor:not-allowed; }
  @keyframes blink { 50% { opacity:.4; } }
  .queueinfo { color:var(--amber); font-size:12.5px; min-height:16px; margin-top:6px; }
  footer { margin-top:22px; padding:14px 6px 4px; border-top:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; color:var(--muted); font-size:12px; flex-wrap:wrap; gap:8px; }
  footer a { color:var(--accent); cursor:pointer; }
  .stat-fab { position:fixed; right:18px; bottom:18px; width:46px; height:46px; border-radius:50%; background:linear-gradient(135deg,#0ea5e9,#2563eb); color:#fff; border:none; font-size:19px; cursor:pointer; box-shadow:0 6px 18px rgba(37,99,235,.35); z-index:50; display:flex; align-items:center; justify-content:center; }
  .stat-fab:hover { filter:brightness(1.12); }
  .modal-overlay { position:fixed; inset:0; background:rgba(5,8,12,.66); display:none; align-items:flex-start; justify-content:center; z-index:100; padding:36px 14px; overflow-y:auto; }
  .modal-overlay.open { display:flex; }
  .modal { background:var(--card); border:1px solid var(--line); border-radius:16px; max-width:560px; width:100%; box-shadow:0 18px 60px rgba(0,0,0,.5); }
  .m-head { display:flex; justify-content:space-between; align-items:center; padding:15px 20px; border-bottom:1px solid var(--line); }
  .m-head h2 { font-size:16px; color:var(--accent); }
  .m-close { background:none; border:none; color:var(--muted); font-size:24px; cursor:pointer; line-height:1; }
  .m-body { padding:18px 20px 20px; }
  .tiles { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-bottom:16px; }
  .tile { background:var(--card2); border:1px solid var(--line); border-radius:10px; padding:10px 6px; text-align:center; }
  .tile .v { font-size:20px; font-weight:700; }
  .tile .t { font-size:10.5px; color:var(--muted); margin-top:2px; }
  .tile.ok .v { color:var(--green); } .tile.bad .v { color:var(--red); } .tile.all .v { color:var(--accent); }
  .dayrow { display:grid; grid-template-columns:86px 1fr 132px; gap:8px; align-items:center; font-size:12px; padding:4px 0; border-bottom:1px solid rgba(38,45,56,.5); }
  .dayrow .bar { height:10px; border-radius:6px; background:#0a0c10; overflow:hidden; display:flex; }
  .dayrow .bar .g { background:linear-gradient(90deg,#10b981,#4ade80); height:100%; }
  .dayrow .bar .b { background:linear-gradient(90deg,#b91c1c,#f87171); height:100%; }
  .dayrow .nums { text-align:right; color:var(--muted); white-space:nowrap; }
  .m-empty { color:var(--muted); font-size:13px; padding:8px 0; }

  /* --- MCB v1.6.0: serial-прошивка (DFU) --- */
  .serial-block { margin-top:14px; padding-top:12px; border-top:1px dashed var(--line); }
  .serial-block h2 { width:100%; font-size:14px; color:var(--accent); margin-bottom:8px; }
  .serial-block .note { color:var(--muted); font-size:12px; }
  .btn.danger { background:linear-gradient(135deg,#ef4444,#b91c1c); color:#fff; border-color:transparent; }
  .btn.danger:hover { filter:brightness(1.1); }
  .btn[disabled] { opacity:.45; cursor:not-allowed; }
  .warnbox { background:rgba(248,113,113,.08); border:1px solid rgba(248,113,113,.45); border-radius:10px; padding:12px 14px; font-size:12.5px; line-height:1.55; color:var(--text); margin-bottom:12px; }
  .warnbox b { color:var(--red); }
  .portlist { display:flex; flex-direction:column; gap:6px; margin:6px 0 4px; }
  .portlist .prow { display:flex; align-items:center; gap:10px; padding:9px 12px; background:var(--card2); border:1px solid var(--line); border-radius:10px; cursor:pointer; font-size:13px; }
  .portlist .prow:hover { border-color:var(--accent); }
  .portlist .prow input { width:16px; height:16px; accent-color:var(--accent); cursor:pointer; flex:none; }
  .portlist .prow .pdesc { color:var(--muted); font-size:12px; margin-left:auto; text-align:right; }
  .portlist .prow .pdfu { color:var(--amber); font-size:11px; border:1px solid rgba(251,191,36,.4); background:rgba(251,191,36,.1); border-radius:999px; padding:1px 8px; white-space:nowrap; }
  .portlist .prow.sel { border-color:var(--accent); box-shadow:0 0 0 1px var(--accent) inset; }
  .m-hint { color:var(--muted); font-size:11.5px; line-height:1.5; margin-top:8px; }
  /* MCB v1.6.1: секции диалога порта — «этот компьютер (браузер)» / «сервер» */
  .m-sec { border:1px solid var(--line); border-radius:12px; padding:10px 12px 12px; margin:10px 0; background:rgba(255,255,255,.02); }
  .m-sec-title { font-size:13.5px; font-weight:700; color:var(--text); margin-bottom:4px; display:flex; align-items:center; gap:8px; }
  .m-sec-title .reco { font-size:10.5px; font-weight:600; color:var(--green); border:1px solid rgba(74,222,128,.45); background:rgba(74,222,128,.08); border-radius:999px; padding:1px 9px; white-space:nowrap; }
  .m-sec .portlist { margin:8px 0 2px; }
  .m-foot { padding:14px 20px 18px; border-top:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
  .m-foot .m-actions { display:flex; gap:10px; margin-left:auto; }
  .m-foot .chk { margin:0; color:var(--text); }
  
  .q-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent); color: #000; font-size: 9px; font-weight: bold;
    cursor: help; margin-left: 6px; position: relative; vertical-align: middle;
  }
  .q-mark:hover::after {
    content: attr(data-tip);
    position: absolute; bottom: 125%; left: 50%; transform: translateX(-50%);
    background: var(--card2); color: var(--text); border: 1px solid var(--line);
    padding: 8px 10px; border-radius: 6px; white-space: normal; width: 220px;
    z-index: 10; font-size: 12px; font-weight: normal; text-align: left;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3); pointer-events: none;
  }
  /* --- MCB v1.2.2: тултип индикатора памяти --- */
  #memBadge { cursor: help; position: relative; }
  #memBadge:hover::after {
    content: attr(data-tip);
    position: absolute; bottom: 130%; left: 0; transform: none;
    background: var(--card2); color: var(--text); border: 1px solid var(--line);
    padding: 10px 12px; border-radius: 8px; white-space: pre-line; width: 340px;
    z-index: 20; font-size: 11.5px; font-weight: normal; text-align: left;
    line-height: 1.45; box-shadow: 0 8px 22px rgba(0,0,0,.45); pointer-events: none;
    max-height: 72vh; overflow-y: auto;
  }
  @media (max-width:860px){ .grid{grid-template-columns:1fr;} .sensors{grid-template-columns:1fr;} .tiles{grid-template-columns:1fr 1fr;} .dayrow{grid-template-columns:74px 1fr;} .dayrow .nums{grid-column:1 / -1; text-align:left;} }

  /* --- MCB v1.8.0: «Своя прошивка» (dropzone) и CLI-терминал --- */
  .dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 22px 14px; text-align: center;
    cursor: pointer; transition: border-color .15s, background .15s; background: rgba(255,255,255,.02); }
  .dropzone:hover, .dropzone.over { border-color: var(--accent); background: rgba(255,255,255,.045); }
  .dropzone .m-hint { margin-top: 4px; }
  .termlog { background: #0a0c10; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
    font-family: 'Cascadia Mono','Consolas',monospace; font-size: 12.5px; line-height: 1.5;
    white-space: pre-wrap; word-break: break-all; overflow-y: auto; height: 34vh; min-height: 180px;
    margin-top: 10px; color: var(--text); }
  #cfwResult .detline { font-size: 13px; line-height: 1.55; margin: 10px 0 4px; }
  #cfwResult .detline b { color: var(--accent); }
  #cfwResult .parts { margin: 6px 0; padding-left: 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
  #cfwResult .ctlrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
  #cfwResult .ctlrow label { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
  #cfwResult .ctlrow input[type=text] { width: 90px; }
  #cfwResult .ctlrow select { width: auto; }

  /* MCB v1.9.0: журнал статистики сборок и прошивок */
  .tile.f .v { color: var(--amber); }
  .stfrow { display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin:2px 0 10px; }
  .stfbtn { background:var(--card2); border:1px solid var(--line); color:var(--muted); border-radius:8px; padding:5px 12px; font-size:12px; cursor:pointer; }
  .stfbtn:hover { color:var(--fg, #dbe4f0); }
  .stfbtn.on { border-color:var(--accent); color:var(--accent); }
  .sttable { width:100%; border-collapse:collapse; font-size:12px; }
  .sttable th { text-align:left; color:var(--muted); font-weight:500; padding:4px 8px; border-bottom:1px solid var(--line); }
  .sttable td { padding:6px 8px; border-bottom:1px solid rgba(38,45,56,.5); vertical-align:top; }
  .sttable .nowrap { white-space:nowrap; }
  .sttable .muted { color:var(--muted); font-size:11px; }
  .tag { border-radius:6px; padding:2px 8px; font-size:11px; white-space:nowrap; }
  .tag.b { background:rgba(14,165,233,.16); color:#7dd3fc; }
  .tag.f { background:rgba(16,185,129,.16); color:#6ee7b7; }
  .rok { color:var(--green); font-weight:600; }
  .rbad { color:var(--red); font-weight:600; }
  #stJournal { max-height:320px; overflow-y:auto; border:1px solid var(--line); border-radius:10px; padding:4px 6px; }

  /* MCB v1.9.2р: кнопки скачивания загрузчика в модалке «Скачать бутлоадер» */
  .boot-dl { display:flex; flex-direction:column; gap:10px; margin:12px 0 2px; }
  .bootbtn { display:flex; flex-direction:column; gap:3px; background:var(--card2); border:1px solid var(--accent); border-radius:10px; padding:11px 16px; text-decoration:none; cursor:pointer; transition:filter .15s; }
  .bootbtn:hover { filter:brightness(1.18); }
  .bootbtn .bt { color:var(--accent); font-weight:600; font-size:14px; }
  .bootbtn .bs { color:var(--muted); font-size:11.5px; line-height:1.45; }
  .bootbtn.rec { border-color:rgba(74,222,128,.55); }
  .bootbtn.rec .bt { color:var(--green); }
