/* ══ TOPBAR (Верхняя панель) ══ */
#topbar { grid-row: 1; grid-column: 2; background: var(--bg2); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 clamp(10px, calc(1.2 * var(--u)), 20px); gap: 0; position: relative; z-index: 10; }
.top-vsep { width: 1px; height: clamp(18px, 2.2vh, 30px); background: var(--border); margin: 0 clamp(8px, calc(0.9 * var(--u)), 16px); flex-shrink: 0; }
.top-weather { display: flex; align-items: center; gap: clamp(5px, calc(0.5 * var(--u)), 10px); flex-shrink: 0; }
.top-weather-ico { width: clamp(14px, calc(1.1 * var(--u)), 22px); height: clamp(14px, calc(1.1 * var(--u)), 22px); color: var(--text3); flex-shrink: 0; }
.top-w-sensor { display: flex; align-items: baseline; gap: clamp(2px, calc(0.18 * var(--u)), 4px); }
.top-w-val { font-family: var(--mono); font-size: clamp(15px, calc(1.35 * var(--u)), 32px); font-weight: 600; color: var(--text); line-height: 1; }
.top-w-unit { font-family: var(--mono); font-size: clamp(8px, calc(0.6 * var(--u)), 13px); color: var(--text3); }
.top-w-dot { font-family: var(--mono); font-size: clamp(8px, calc(0.6 * var(--u)), 13px); color: var(--border2); margin: 0 clamp(1px, calc(0.1 * var(--u)), 3px); }
.top-w-sublabel { font-family: var(--mono); font-size: clamp(7px, calc(0.55 * var(--u)), 11px); font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .04em; margin-right: clamp(1px, calc(0.1 * var(--u)), 3px); }
.top-w-vsep { width: 1px; height: clamp(16px, calc(1.3 * var(--u)), 26px); background: var(--border); flex-shrink: 0; margin: 0 clamp(2px, calc(0.2 * var(--u)), 5px); }
.top-center { flex: 1; display: flex; align-items: center; justify-content: center; gap: clamp(8px, var(--u), 18px); }
.conn-chip { position: relative; overflow: hidden; display: flex; align-items: center; gap: clamp(5px, calc(0.6 * var(--u)), 10px); font-family: var(--mono); color: var(--text2); height: clamp(30px, calc(2.3 * var(--u)), 46px); padding: 0 clamp(10px, calc(1.1 * var(--u)), 18px); border-radius: var(--r); border: 1px solid var(--border); background: var(--bg); white-space: nowrap; transition: border-color .18s; }
.conn-logout { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: clamp(4px, calc(0.4 * var(--u)), 7px); background: var(--red-l); color: var(--red); border-radius: inherit; opacity: 0; pointer-events: none; transition: opacity .18s; cursor: pointer; font-size: clamp(11px, calc(1.0 * var(--u)), 15px); font-weight: 700; font-family: var(--mono); }
.conn-logout svg { width: clamp(12px, calc(1.0 * var(--u)), 16px); height: clamp(12px, calc(1.0 * var(--u)), 16px); }
.conn-chip:hover .conn-logout { opacity: 1; pointer-events: auto; }
.conn-chip:hover { border-color: rgba(224,48,48,.45) !important; }
.conn-info { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.conn-name { font-size: clamp(12px, calc(1.15 * var(--u)), 18px); font-weight: 700; color: var(--text); line-height: 1; }
.conn-mac { font-size: clamp(8px, calc(0.68 * var(--u)), 11px); font-weight: 400; color: var(--text3); line-height: 1; letter-spacing: 0.04em; }
.conn-dot { width: clamp(7px, calc(0.7 * var(--u)), 11px); height: clamp(7px, calc(0.7 * var(--u)), 11px); border-radius: 50%; background: var(--text3); flex-shrink: 0; }
.conn-chip.ok { border-color: rgba(13,168,106,.35); }
.conn-chip.ok .conn-dot { background: var(--green); box-shadow: 0 0 7px rgba(13,168,106,.55); }
.conn-chip.err { border-color: rgba(224,48,48,.4); color: var(--red); }
.conn-chip.err .conn-dot { background: var(--red); }
.conn-dot.flash { animation: dot-flash 0.25s ease-out; }
@keyframes dot-flash { 0%{transform:scale(1)} 40%{transform:scale(2);box-shadow:0 0 10px #fff,0 0 18px var(--green);background:#fff} 100%{transform:scale(1)} }
.top-right { display: flex; align-items: center; gap: clamp(6px, calc(0.7 * var(--u)), 12px); flex-shrink: 0; }
.time-block { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.time-val { font-family: var(--mono); font-size: clamp(18px, calc(1.46 * var(--u)), 44px); font-weight: 700; color: var(--text); line-height: 1; }
.time-label { font-family: var(--mono); font-size: clamp(7px, calc(0.65 * var(--u)), 10px); color: var(--text3); text-transform: uppercase; letter-spacing: .07em; }
.err-badge { position: relative; }
.err-btn { display: flex; align-items: center; gap: clamp(4px, calc(0.4 * var(--u)), 7px); height: clamp(30px, calc(2.3 * var(--u)), 46px); padding: 0 clamp(8px, calc(0.9 * var(--u)), 16px); border-radius: var(--r); border: 1px solid; font-family: var(--mono); font-size: clamp(9px, calc(0.9 * var(--u)), 14px); font-weight: 600; background: transparent; transition: all .15s; white-space: nowrap; }
.err-btn.ok { border-color: rgba(13,168,106,.4); color: var(--green); background: var(--green-l); }
.err-btn.has-err { border-color: rgba(224,48,48,.5); color: var(--red); background: var(--red-l); animation: blink-err 1s ease-in-out infinite; }
@keyframes blink-err { 0%,100%{opacity:1} 50%{opacity:.4} }
.err-btn .err-count { background: var(--red); color: #fff; border-radius: 3px; padding: 1px clamp(3px, calc(0.3 * var(--u)), 6px); font-size: clamp(8px, calc(0.8 * var(--u)), 12px); }
.err-dropdown { display: none; position: absolute; top: calc(100% + 6px); right: 0; min-width: clamp(240px, 22vw, 340px); background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r2); box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 200; overflow: hidden; }
.err-dropdown.open { display: block; }
.err-drop-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 600; color: var(--text2); }
.err-clear-btn { font-size: 12px; padding: 4px 10px; border-radius: 4px; border: 1px solid var(--border2); background: var(--bg3); color: var(--text2); font-family: var(--mono); }
.err-list { max-height: 240px; overflow-y: auto; }
.err-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--bg3); font-size: 14px; }
.err-item-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.err-item-dot.red { background: var(--red); }
.err-item-dot.orange { background: var(--orange); }
.err-item-text { color: var(--text); line-height: 1.4; flex: 1; }
.err-item-time { color: var(--text3); font-family: var(--mono); font-size: 12px; }
.profile-btn { display: flex; align-items: center; justify-content: center; width: clamp(30px, calc(2.3 * var(--u)), 46px); height: clamp(30px, calc(2.3 * var(--u)), 46px); border-radius: var(--r); border: 1px solid var(--border); background: var(--bg); color: var(--text3); transition: all .15s; flex-shrink: 0; }
.profile-btn svg { width: clamp(14px, calc(1.1 * var(--u)), 22px); height: clamp(14px, calc(1.1 * var(--u)), 22px); }
.profile-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-l); }
