:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: #101621;
  --panel2: #0c111a;
  --border: #253144;
  --text: #edf4ff;
  --muted: #8492a8;
  --accent: #9aff65;
  --cyan: #61e7e1;
  --danger: #ff7185;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 80% 0%, #142b35 0, transparent 35%),
    radial-gradient(ellipse at 0% 35%, #17172c 0, transparent 35%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 "IBM Plex Mono", "Cascadia Code", "DejaVu Sans Mono", monospace;
  min-height: 100vh;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .15;
  background-image: linear-gradient(#34455b 1px, transparent 1px),
                    linear-gradient(90deg, #34455b 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}
.shell { max-width: 1120px; margin: auto; padding: 0 28px; position: relative; z-index: 1; }
.topbar {
  min-height: 78px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid #263142;
}
.brand { display: inline-flex; gap: 11px; align-items: center; color: var(--text);
  text-decoration: none; font-weight: 800; letter-spacing: .12em; font-size: 14px; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  background: var(--accent); color: #0b1109; font-size: 13px; font-weight: 900;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 72% 100%, 0 100%);
}
.top-right, .eyebrow, .device-meta, .logout {
  font: 10px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .13em;
}
.top-right { color: var(--muted); display: flex; gap: 9px; align-items: center; }
.live-dot, .status i, .event-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 12px #9aff6570;
}
.welcome { padding: 52px 0 42px; }
.terminal-line {
  color: var(--muted); font-size: 12px; margin: 0 0 28px;
  border-left: 2px solid var(--accent); padding-left: 12px;
}
.prompt { color: var(--accent); }
.terminal-cursor {
  display: inline-block; width: .62em; height: 1.05em; margin-left: 4px;
  vertical-align: -.16em; background: var(--accent); animation: blink 1s steps(1) infinite;
}
.terminal-line { cursor: pointer; user-select: none; }
.easter-terminal {
  max-width: 760px; margin: -8px 0 30px; padding: 14px 16px;
  background: #05080d; border: 1px solid #294238; border-radius: 5px;
  box-shadow: 0 12px 30px #0005; color: #b9c8ba; font: 12px/1.6 monospace;
}
.terminal-output { max-height: 150px; overflow-y: auto; }
.terminal-output p { margin: 0; }
.terminal-reply { color: var(--accent); }
.terminal-form { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.terminal-form input { min-width: 0; flex: 1; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .terminal-cursor { animation: none; }
}
.eyebrow { color: var(--cyan); margin: 0 0 13px; }
h1 { font-size: clamp(38px, 6vw, 64px); line-height: 1.05; letter-spacing: -.075em; margin: 0 0 17px; }
h1 span { color: var(--accent); }
h2 { font-size: 22px; letter-spacing: -.03em; margin: 8px 0; }
.muted { color: var(--muted); }
.tiny { font-size: 10px; }
.section-heading { display: flex; align-items: center; gap: 15px; margin: 12px 0 18px; }
.section-heading .eyebrow { margin: 0; white-space: nowrap; }
.line { height: 1px; background: var(--border); flex: 1; }
.device-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.panel {
  background: linear-gradient(145deg, #121a27ed, #0c1119f5);
  border: 1px solid var(--border); border-radius: 9px;
  box-shadow: 0 16px 40px #0002;
}
.device-card { padding: 22px; min-width: 0; position: relative; }
.device-card::before {
  content: ""; position: absolute; top: 0; left: 22px; right: 22px; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: .55;
}
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.device-icon { font-size: 27px; color: var(--accent); }
.status { color: var(--accent); display: flex; align-items: center; gap: 7px;
  font: 10px ui-monospace, monospace; letter-spacing: .1em; }
.status-idle { color: var(--muted); }
.status-idle i { background: #687487; box-shadow: none; }
.device-card .muted { min-height: 48px; font-size: 13px; }
.device-meta { display: flex; justify-content: space-between; gap: 8px; color: #7f8ca1;
  border-top: 1px solid var(--border); padding-top: 14px; margin: 22px 0 16px; font-size: 9px; }
button, input { font: inherit; }
button { cursor: pointer; font-family: inherit; }
.primary, .secondary {
  min-height: 44px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; border-radius: 5px; padding: 0 14px; font-size: 11px;
  font-weight: 800; letter-spacing: .1em; transition: .15s ease;
}
.primary { background: var(--accent); border: 1px solid var(--accent); color: #10160d; }
.primary:hover { background: #b7ff93; box-shadow: 0 0 22px #9aff6526; }
.primary:disabled { opacity: .55; cursor: wait; }
.secondary { background: #171e29; color: #647185; border: 1px solid #293446; cursor: not-allowed; }
.full { width: 100%; }
[hidden] { display: none !important; }
.confirm { border: 1px solid var(--accent); border-radius: 5px; padding: 12px; }
.confirm p { margin: 0 0 10px; font-size: 13px; }
.confirm-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.confirm-buttons .primary { justify-content: center; }
.cancel { min-height: 44px; border-radius: 5px; font-size: 11px; font-weight: 800;
  letter-spacing: .1em; background: transparent; color: var(--muted); border: 1px solid var(--border); }
.cancel:hover { color: var(--text); border-color: var(--muted); }
.result { min-height: 20px; margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.success { color: var(--accent); }
.failure { color: var(--danger); }
.log-heading { margin-top: 42px; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; padding: 20px; }
.stats .eyebrow { display: block; margin: 0 0 6px; color: var(--muted); font-size: 10px; }
.stats b { font-size: 18px; font-weight: 700; }
.activity { padding: 4px 20px; }
.event { display: flex; gap: 13px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid #202a39; }
.event:last-child { border-bottom: 0; }
.event-dot.bad { background: var(--danger); box-shadow: 0 0 12px #ff718570; }
.event-dot { margin-top: 7px; flex: 0 0 6px; width: 6px; height: 6px; }
.event-copy { flex: 1; min-width: 0; }
.event-copy strong { font-size: 12px; font-weight: 600; }
.event-copy p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.event time { color: #748198; font: 10px ui-monospace, monospace; overflow-wrap: anywhere; }
.bottom { margin-top: 32px; padding: 24px 0; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 16px; color: var(--muted);
  font: 10px ui-monospace, monospace; letter-spacing: .1em; }
.accent { color: var(--accent); }
.bottom form { margin: 0; }
.logout { background: transparent; border: 0; color: var(--muted); padding: 0; }
.logout:hover { color: var(--accent); }
.login-wrap { width: min(440px, calc(100% - 36px)); margin: 12vh auto 0; position: relative; }
.login-wrap .brand { margin-bottom: 48px; }
.login-panel { padding: 30px; margin-top: 24px; }
.login-panel h1 { font-size: 34px; letter-spacing: -.04em; }
.login-panel .muted { font-size: 13px; }
.login-panel form { margin-top: 26px; }
label { display: block; color: #b5c2d4; font-size: 12px; margin-bottom: 8px; }
input[type=password] {
  width: 100%; min-height: 46px; padding: 0 12px; margin-bottom: 16px;
  background: #080d15; color: var(--text); border: 1px solid #303d50; border-radius: 5px;
  outline: none;
}
input[type=password]:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px #61e7e11c; }
.error { color: var(--danger); background: #ff718510; border: 1px solid #ff718533;
  border-radius: 5px; padding: 10px 12px; margin: 18px 0; font-size: 12px; }
.login-panel .tiny { margin: 22px 0 0; }
.login-wrap footer { text-align: center; color: #58667b; font: 10px ui-monospace, monospace;
  letter-spacing: .12em; margin-top: 26px; }
.login-wrap footer span { color: var(--accent); }
@media (max-width: 800px) {
  .device-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .device-card .muted { min-height: 0; }
  .welcome { padding-top: 48px; }
}
@media (max-width: 480px) {
  .shell { padding: 0 17px; }
  .top-right { font-size: 8px; }
  .device-card { padding: 18px; }
  .event { flex-wrap: wrap; }
  .event time { margin-left: 19px; }
  .login-panel { padding: 22px; }
}

/* Minimal monochrome interface */
:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #0a0a0a;
  --panel2: #111;
  --border: #303030;
  --text: #fff;
  --muted: #aaa;
  --accent: #fff;
  --cyan: #fff;
  --danger: #fff;
  --gap: 18px;
}
body {
  background: #000;
  color: #fff;
  font: 17px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-y: scroll;
}
body::before { display: none; }
.shell { max-width: 980px; }
.topbar { min-height: 64px; border-color: #303030; }
.brand { color: #fff; }
.brand-mark { width: auto; height: auto; background: none; color: #fff; clip-path: none; font-size: 14px; }
.top-right, .eyebrow, .device-meta, .logout { color: #aaa; }
.live-dot { display: none; }
.welcome { padding: 46px 0 30px; }
.terminal-line { color: #777; border-left-color: #fff; margin-bottom: 22px; }
.terminal-line { font-size: 15px; }
.prompt, h1 span, .accent { color: #fff; }
h1 { font-size: clamp(30px, 5vw, 48px); letter-spacing: -.06em; }
h2 { font-size: 21px; }
.eyebrow { font-size: 12px; }
.top-right { font-size: 12px; }
.section-heading { margin: 22px 0 12px; }
.line { background: #303030; }
.device-grid { display: block; }
.panel { background: #0a0a0a; border-color: #303030; box-shadow: none; border-radius: 3px; }
.device-card { max-width: 560px; padding: 20px; }
.device-card::before { display: none; }
.device-icon { color: #fff; }
.status, .status-idle { color: #fff; }
.status i, .status-idle i { background: #fff; box-shadow: none; }
.device-meta { border-color: #303030; }
.primary { background: #fff; border-color: #fff; color: #000; border-radius: 2px; }
.primary, .secondary { font-size: 13px; }
.primary:hover { background: #ddd; box-shadow: none; }
.secondary { background: #111; border-color: #444; color: #777; }
.confirm { border-color: #fff; border-radius: 2px; }
.cancel { border-radius: 2px; color: #aaa; border-color: #444; }
.success, .failure { color: #fff; }
.stats { grid-template-columns: repeat(8, minmax(0, 1fr)); background: #0a0a0a; border-radius: 3px; }
.stats .eyebrow { color: #888; }
.activity { background: #0a0a0a; border-radius: 3px; }
.event { border-color: #222; }
.event-dot, .event-dot.bad { background: #fff; box-shadow: none; margin-left: 5px; margin-top: 9px; }
.event time { color: #777; }
.bottom { border-color: #303030; }
.easter-terminal { background: #000; border-color: #444; border-radius: 2px; box-shadow: none; }
.easter-terminal { position: relative; z-index: 2; width: 100%; margin: 12px 0 var(--gap); overflow: hidden; }
.easter-terminal { display: flex; flex-direction: column; }
.terminal-output { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-wrap: anywhere; padding-bottom: 4px; }
.terminal-output { max-height: none; }
.terminal-form { margin-top: auto; flex: 0 0 auto; padding-top: 2px; }
.terminal-output { scrollbar-width: thin; scrollbar-color: #fff transparent; }
.terminal-output::-webkit-scrollbar { width: 3px; }
.terminal-output::-webkit-scrollbar-track { background: transparent; }
.terminal-output::-webkit-scrollbar-thumb { background: #fff; border-radius: 0; }
.terminal-cursor { background: #fff; }
.error { color: #fff; background: #111; border-color: #555; }
input[type=password] { background: #000; color: #fff; border-color: #555; border-radius: 2px; }
input[type=password]:focus { border-color: #fff; box-shadow: none; }
.welcome { padding: 28px 0 0; }
.welcome .terminal-line { margin: 0; }
.device-card { max-width: 100%; padding: 16px; }
.device-card h2 { margin: 0 0 14px; font-size: 16px; }
.card-top { margin-bottom: 8px; }
.stats { margin-top: 16px; padding: 14px 16px; gap: 12px; }
.stats .eyebrow { font-size: 9px; }
.stats b { font-size: 14px; }
.stats b { font-size: 17px; }
.stats .eyebrow { font-size: 11px; }
.activity-log { margin-top: var(--gap); padding: 0; }
.activity-log summary { padding: 13px 16px; color: #aaa; cursor: pointer; font-size: 12px; list-style-position: inside; }
.activity-log[open] summary { border-bottom: 1px solid #303030; color: #fff; }
.activity { border: 0; padding: 0 16px; }
.activity-log summary { font-size: 14px; }
.event-copy strong, .event-copy p { font-size: 14px; }
.event time { font-size: 12px; }
.network-log { margin-top: var(--gap); }
.network-log summary { padding: 8px 0; color: #aaa; cursor: pointer; font-size: 14px; }
.network-log summary, .activity-log summary { list-style: none; }
.network-log summary::-webkit-details-marker, .activity-log summary::-webkit-details-marker { display: none; }
.network-list { padding: 6px 0 10px; }
.network-device { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid #222; font-size: 13px; }
.network-device:last-child { border-bottom: 0; }
.network-map { display: block; width: 100%; max-width: 760px; height: 360px; margin: 8px 0; }
.network-link { stroke: #444; stroke-width: 1; stroke-dasharray: 4 5; }
.network-link.active { stroke: #fff; animation: network-flow 1.2s linear infinite; }
@keyframes network-flow { to { stroke-dashoffset: -18; } }
.network-node circle { fill: #000; stroke: #777; stroke-width: 1; filter: drop-shadow(0 0 4px #fff8); }
.network-node text { fill: #aaa; text-anchor: middle; font: 12px monospace; }
.network-node.online circle { stroke: #fff; filter: drop-shadow(0 0 8px #fff); }
.network-node.offline circle { stroke: #444; }
.network-node { transition: transform .25s cubic-bezier(.2,.8,.2,1); transform-origin: center; }
.activity-log, .network-log { overflow: hidden; }
.activity-log > .activity, .network-log > .network-map, .network-log > .network-list { animation: reveal-content .3s ease-out; }
@keyframes reveal-content { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
.network-online { color: #fff; }
.network-offline { color: #777; }
.dashboard-right .network-log { order: 1; }
.dashboard-right .activity-log { order: 2; }
.command-palette { position: fixed; z-index: 20; top: 18%; left: 50%; transform: translateX(-50%); width: min(620px, calc(100% - 32px)); padding: 14px; background: #050505; border: 1px solid #555; box-shadow: 0 18px 60px #000; }
.command-palette form { display: flex; gap: 8px; align-items: center; border-bottom: 1px solid #333; padding-bottom: 10px; }
.command-palette input { flex: 1; background: transparent; border: 0; outline: 0; color: #fff; font: inherit; }
.palette-item { padding: 10px 4px; cursor: pointer; }
.palette-item:hover, .palette-item.selected { background: #222; }
.boot-screen { position: fixed; inset: 0; z-index: 50; display: grid; align-content: start; padding: 32px 10vw; background: #000; color: #fff; font: 14px/1.8 monospace; overflow: auto; }
.boot-screen[hidden] { display: none; }
.boot-screen { display: grid; }
body[data-boot="no"] .boot-screen { display: none; }
body[data-boot="yes"] .shell { visibility: hidden; }
body.boot-complete .shell { visibility: visible; }
.boot-screen button { position: fixed; right: 32px; bottom: 24px; margin: 0; width: max-content; padding: 6px 10px; background: transparent; border: 0; color: #aaa; font: inherit; }
.boot-screen { transition: opacity .5s ease; }
.boot-screen.boot-fading { opacity: 0; }
.boot-final-prompt { margin-top: 10px; color: #fff; animation: final-prompt-in .35s ease-out; }
.boot-transfer-prompt { position: fixed; z-index: 70; margin: 0; color: #fff; font: inherit; pointer-events: none; white-space: nowrap; }
@keyframes final-prompt-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
body[data-boot="yes"] .shell { opacity: 0; transition: opacity .5s ease .08s; }
body.boot-complete .shell { opacity: 1; }
.topbar { border-bottom: 0; }
.topbar .top-right { margin-left: auto; }
.topbar .terminal-line { margin: 0; }
.topbar .terminal-line { border-left: 0; padding-left: 0; }
.bottom { border-top: 0; margin-top: 10px; padding-top: 12px; }
.bottom > span { display: none; }
/* Flat console layout: no cards, panels, or decorative separators. */
.panel, .device-card, .stats, .activity-log { background: transparent; border: 0; box-shadow: none; border-radius: 0; }
.device-card { padding: 12px 0; }
.stats { margin-top: 18px; padding: 12px 0; border-top: 1px solid #303030; border-bottom: 1px solid #303030; }
.activity-log { margin-top: var(--gap); }
.activity-log summary { padding: 8px 0; list-style-position: outside; }
.activity-log[open] summary { border-bottom: 1px solid #303030; }
.activity { padding: 0; }
.event { padding: 10px 0; }
.device-grid { display: block; }
.metric-history { margin: var(--gap) 0 0; color: #888; font: 11px/1.5 monospace; }
.metric-history > div { display: flex; align-items: center; gap: 10px; height: 68px; }
.metric-history > div > span { width: 38px; }
.metric-history svg { flex: 1; height: 64px; background: linear-gradient(to bottom, transparent 49%, #222 50%, transparent 51%); }
.graph-line { fill: none; stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; animation: graph-draw .5s ease-out; }
.graph-area { fill: #fff; opacity: .08; }
.matrix-canvas { position: fixed; inset: 0; z-index: 40; width: 100%; height: 100%; background: transparent; pointer-events: none; }
.starfield { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.star-layer { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
@keyframes graph-draw { from { opacity: 0; } to { opacity: 1; } }
.system-panel { margin-top: var(--gap); border-top: 1px solid #444; border-bottom: 1px solid #444; transition: border-color .25s ease, opacity .25s ease; }
.system-panel.is-loading { opacity: .55; }
.system-head { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0 8px; color: #aaa; font-size: 12px; letter-spacing: .08em; }
.stats { margin: 0; padding: 8px 0 14px; border: 0; }
.metric { position: relative; min-width: 0; padding: 9px 0; transition: transform .18s ease; }
.metric:hover { transform: translateX(4px); }
.metric .eyebrow { display: block; margin: 0 0 3px; color: #888; font-size: 10px; }
.metric b { display: block; min-height: 24px; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { display: block; height: 2px; margin-top: 7px; background: #222; overflow: hidden; }
.meter em { display: block; width: 2%; height: 100%; background: #fff; transition: width .65s cubic-bezier(.2,.8,.2,1); }
body[data-pc-state="online"] #pc-status i { animation: pulse-status 1.8s ease-in-out infinite; }
@keyframes pulse-status { 50% { opacity: .35; transform: scale(.7); } }
.primary { transition: transform .15s ease, background-color .15s ease, opacity .15s ease; }
.primary:active { transform: translateY(1px); }
.status { transition: color .25s ease; }
.network-device, .event { transition: background-color .15s ease, padding-left .15s ease; }
.network-device:hover, .event:hover { background: #0d0d0d; padding-left: 5px; }
.command-palette { animation: palette-in .16s ease-out; }
@keyframes palette-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.boot-screen { animation: boot-in .2s ease-out; }
@keyframes boot-in { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 600px) {
  .shell { width: 100%; padding: 0 14px; overflow: hidden; }
  .topbar { min-height: 56px; }
  .brand { font-size: 12px; letter-spacing: .04em; }
  .top-right { font-size: 10px; }
  .welcome { padding: 22px 0 0; }
  .terminal-line { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .easter-terminal { font-size: 12px; }
  .primary, .cancel { min-height: 48px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
  .system-head { font-size: 10px; }
  .metric b { font-size: 14px; }
  .metric-history > div { height: 54px; }
  .metric-history svg { height: 50px; min-width: 0; }
  .network-map { height: 280px; margin-left: -6px; width: calc(100% + 12px); }
  .network-node text { font-size: 11px; }
  .network-list { font-size: 12px; }
  .network-device { padding: 10px 0; }
  .event { gap: 9px; }
  .event time { width: 100%; margin-left: 20px; }
  .bottom { justify-content: flex-end; }
  .boot-screen { padding: 20px 14px; font-size: 12px; }
  .boot-screen button { right: 14px; bottom: 18px; }
}

/* Wide desktop workspace: use the full 16:9 canvas without changing the mobile layout. */
@media (min-width: 1000px) {
  body { min-height: 100vh; }
  .shell { display: flex; flex-direction: column; width: calc(100% - 32px); max-width: none; min-height: 100vh; padding: 0; }
  .shell > main { flex: 1; }
  .shell > main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr; gap: var(--gap); align-content: start; }
  .welcome { display: contents; }
  .topbar .terminal-line { grid-column: auto; grid-row: auto; align-self: center; padding: 0; }
  .dashboard-left, .dashboard-right { min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
  .dashboard-left { grid-column: 1; grid-row: 3; }
  .dashboard-right { grid-column: 2; grid-row: 2 / span 2; }
  .device-grid, .system-panel, .metric-history, .activity-log, .network-log { grid-column: auto; grid-row: auto; margin-top: 0; }
  .network-map { height: 360px; }
  .device-card { padding: 18px 0; }
  .device-card .primary { max-width: 420px; }
  /* Графики тянутся до низа правого столбца: блок забирает остаток высоты,
     а три графика делят её поровну. */
  .metric-history { flex: 1 1 auto; display: flex; flex-direction: column; }
  .metric-history > div { flex: 1 1 0; height: auto; min-height: 68px; align-items: stretch; }
  .metric-history > div > span { align-self: center; }
  .metric-history svg { height: auto; align-self: stretch; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .bottom { margin-top: auto; }
  .easter-terminal, .device-card, .system-panel, .metric-history, .activity-log, .network-log { border: 1px solid #333; padding: 18px; }
  .easter-terminal { grid-column: 1; grid-row: 2; max-width: none; width: 100%; margin: 0; padding-bottom: 6px; }
  .welcome .easter-terminal { height: 255px; min-height: 0; }
  .activity-log, .network-log { padding: 0 18px 18px; }
  .activity-log summary, .network-log summary { padding: 18px 0; }
  .device-grid, .system-panel, .metric-history, .activity-log, .network-log { width: 100%; }
  .device-grid, .device-card { height: auto; }
  .device-card { display: block; }
  .activity-log { min-height: 0; }
}

@media (max-width: 999px) {
  .dashboard-left, .dashboard-right { display: contents; }
}
.dashboard-title { margin: 0 0 14px; font-size: clamp(24px, 3vw, 42px); letter-spacing: .08em; font-weight: 600; }
.dashboard-title span { color: #aaa; }
.login-panel { background: #0a0a0a; border: 1px solid #303030; border-radius: 3px; padding: 30px; }
.login-wrap .brand-mark { color: #fff; }
.login-wrap .eyebrow { color: #aaa; }
.login-terminal-page { min-height: 100vh; background: #000; }
.login-terminal { width: min(560px, calc(100% - 40px)); margin: 14vh auto 0; }
.login-prompt-line { display: flex; align-items: center; gap: 8px; border: 0; padding: 0; }
.login-mark { color: #fff; font: 17px/1 monospace; }
.login-prompt-line input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 0; background: transparent; color: #fff; font: 16px/1.4 monospace; }
.login-silent-error { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 600px) {
  .login-panel { padding: 22px; }
}

/* ---------- Тетрис ---------- */
.tetris-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 18px;
  background: #000d; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.tetris-panel {
  width: min(560px, calc(100vw - 24px));
  max-height: 96vh; overflow: auto; padding: 16px;
  background: #050505; border: 1px solid #3a3a3a;
  box-shadow: 0 24px 80px #000; outline: none;
  animation: tetris-in .18s ease-out;
}
@keyframes tetris-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.tetris-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 12px; color: #ddd; font: 12px/1.4 monospace; letter-spacing: .18em;
}
.tetris-head .muted { color: #666; }
.tetris-close {
  padding: 4px 8px; background: transparent; border: 1px solid #444;
  border-radius: 2px; color: #999; font: 10px/1.4 monospace; letter-spacing: .12em;
}
.tetris-close:hover { color: #fff; border-color: #fff; }
.tetris-body { display: flex; gap: 18px; align-items: flex-start; justify-content: center; }
.tetris-board-wrap { position: relative; line-height: 0; flex: 0 0 auto; }
#tetris-canvas { display: block; height: min(70vh, 600px); width: auto; max-width: 100%; background: #000; border: 1px solid #333; }
.tetris-side { width: 148px; display: flex; flex-direction: column; gap: 14px; color: #aaa; font: 11px/1.5 monospace; }
.tetris-side .eyebrow { display: block; margin: 0 0 3px; color: #777; font-size: 9px; letter-spacing: .14em; }
.tetris-side b { display: block; color: #fff; font-size: 22px; font-weight: 500; line-height: 1.1; }
#tetris-next { display: block; width: 90px; height: 90px; background: #000; border: 1px solid #2a2a2a; }
.tetris-help { margin: 2px 0 0; color: #777; font-size: 10px; line-height: 1.8; }
.tetris-message {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; padding: 20px;
  text-align: center; background: #000c; color: #fff; line-height: 1.5;
}
.tetris-message strong { font-size: 20px; font-weight: 500; letter-spacing: .18em; }
.tetris-message span { max-width: 220px; color: #aaa; font-size: 11px; }
.tetris-touch { display: none; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.tetris-touch button {
  min-height: 42px; background: #0b0b0b; border: 1px solid #333; border-radius: 2px;
  color: #ccc; font: 14px/1 monospace; cursor: pointer; touch-action: manipulation;
}
.tetris-touch button:active { background: #1c1c1c; color: #fff; border-color: #fff; }
body.tetris-open { overflow: hidden; }

@media (max-width: 700px), (pointer: coarse) {
  .tetris-touch { display: grid; }
}
@media (max-width: 560px) {
  .tetris-overlay { padding: 8px; }
  .tetris-panel { padding: 10px; max-height: 98vh; }
  .tetris-body { flex-direction: column; align-items: center; gap: 10px; }
  #tetris-canvas { height: min(56vh, 520px); }
  .tetris-side { width: 100%; flex-direction: row; flex-wrap: wrap; justify-content: space-between; gap: 8px 14px; }
  .tetris-side > div { min-width: 58px; }
  .tetris-side b { font-size: 16px; }
  #tetris-next { width: 56px; height: 56px; }
  .tetris-help { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tetris-panel { animation: none; }
}
