:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #edf6ff;
  background: #07111f;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 15% 0%, #17365e 0, #0a1728 34%, #060d18 100%); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }
.hidden { display: none !important; }
.updates-card { margin-top: 20px; }
.updates-versions, .updates-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.updates-versions { margin: 4px 0 24px; }
.updates-versions > div { display: grid; gap: 8px; padding: 16px; border-radius: 12px; background: #09192c; min-width: 0; }
.updates-versions span, .updates-versions small { color: #8fa8c3; }
.updates-versions strong { color: #76c9ff; overflow-wrap: anywhere; }
.updates-form { display: flex; flex-direction: column; gap: 12px; padding: 18px; border: 1px solid #294362; border-radius: 14px; min-width: 0; }
.updates-form h3 { margin: 0 0 6px; font-size: 17px; }
.updates-form input[type="text"] { box-sizing: border-box; width: 100%; min-height: 44px; padding: 10px; color: #edf6ff; background: #081525; border: 1px solid #385170; border-radius: 10px; }
.updates-form input[type="file"] { width: 100%; color: #bed0e3; font-size: 13px; }
.updates-form progress { width: 100%; height: 12px; accent-color: #16af7f; }
.updates-form small { color: #8fa8c3; overflow-wrap: anywhere; }
@media (max-width: 650px) { .updates-versions, .updates-columns { grid-template-columns: minmax(0, 1fr); } .updates-card { padding: 18px; } }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 64px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 4vw, 44px); letter-spacing: -.04em; }
h2 { margin-bottom: 20px; font-size: 24px; }
.eyebrow { margin-bottom: 8px; color: #65bfff; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.badge { padding: 10px 14px; border: 1px solid #2b4362; border-radius: 999px; background: #101e31; font-weight: 750; }
.badge.online { color: #7bf0c5; border-color: #1f8064; }
.badge.warning { color: #ffd178; border-color: #8d6522; }
.badge.danger { color: #ff9aac; border-color: #97384c; background: #29151f; }
.badge.neutral { color: #9eb2ca; }
.card, .metric { border: 1px solid rgba(113, 163, 219, .2); background: rgba(16, 32, 54, .88); box-shadow: 0 24px 70px rgba(0,0,0,.22); backdrop-filter: blur(16px); }
.card { border-radius: 22px; padding: 26px; }
.login { max-width: 520px; margin: 90px auto; }
.login form { display: grid; gap: 14px; }
label { color: #bed0e3; font-weight: 700; }
input[type="password"] { width: 100%; padding: 14px; color: #fff; border: 1px solid #385170; border-radius: 12px; outline: none; background: #081525; }
input:focus { border-color: #57b7ff; box-shadow: 0 0 0 3px rgba(62,164,240,.14); }
.safety-banner { display: flex; align-items: center; gap: 12px 20px; margin-bottom: 18px; padding: 14px 18px; border: 1px solid; border-radius: 14px; }
.safety-banner strong { flex: 0 0 auto; }
.safety-banner span { color: #d8e6f4; line-height: 1.45; }
.danger-banner { border-color: rgba(255, 105, 132, .55); background: rgba(105, 23, 44, .6); }
.warning-banner { border-color: rgba(255, 199, 91, .55); background: rgba(89, 60, 16, .58); }
.safe-banner { border-color: rgba(69, 217, 165, .45); background: rgba(15, 82, 64, .48); }
.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.metric { padding: 18px; border-radius: 16px; }
.metric span { display: block; margin-bottom: 8px; color: #8fa8c3; font-size: 13px; }
.metric strong { font-size: 19px; }
.vision-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; margin-bottom: 18px; }
.video-card { min-width: 0; }
.video-heading h2 { margin-bottom: 0; }
.media-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.media-actions label { color: #9bb8ce; font-size: .9rem; }
.media-actions select { width: 220px; min-width: 220px; margin: 0; }
.compact-button { min-height: 38px; padding: 0 14px; font-size: 13px; }
.status-rail { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.status-rail .badge { padding: 7px 10px; font-size: 12px; }
.overlay-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: -8px 0 12px; color: #8fa8c3; font-size: 11px; }
.overlay-legend span { display: inline-flex; align-items: center; gap: 6px; color: #c9d9e8; font-weight: 700; }
.overlay-legend span::before { width: 20px; height: 10px; border: 2px solid; border-radius: 2px; content: ''; }
.overlay-legend-person::before { border-color: #4cf0b8 !important; }
.overlay-legend-face::before { border-color: #ffd166 !important; border-style: dashed !important; }
.overlay-legend small { color: #7892ac; font-size: 11px; }
.video-stage { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; min-height: 280px; overflow: hidden; border: 1px solid rgba(104, 165, 218, .22); border-radius: 16px; background: #02070d; }
.video-stage video, .video-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.video-stage video { object-fit: contain; background: #02070d; }
.video-stage canvas { pointer-events: none; }
.video-placeholder { z-index: 1; display: grid; place-items: center; gap: 8px; width: min(420px, 80%); color: #8fa8c3; text-align: center; line-height: 1.5; }
.video-placeholder strong { color: #d8e8f7; }
.video-placeholder-icon { display: grid; width: 50px; height: 50px; place-items: center; border: 1px solid #315878; border-radius: 50%; color: #56bdff; font-size: 24px; }
.video-stage.has-video .video-placeholder { display: none; }
.media-stats { display: grid; grid-template-columns: repeat(4, minmax(105px, 1fr)); gap: 8px; margin: 12px 0 0; }
.media-stats > div { display: grid; gap: 4px; padding: 10px 11px; border: 1px solid rgba(98, 154, 207, .16); border-radius: 10px; background: rgba(7, 20, 35, .58); }
.media-stats dt { color: #7892ac; font-size: 11px; }
.media-stats dd { max-width: none; color: #d9ecfb; font-size: 12px; font-variant-numeric: tabular-nums; text-align: left; white-space: nowrap; }
.identity-summary { display: flex; align-items: center; gap: 14px; margin: -2px 0 8px; padding: 16px; border: 1px solid rgba(89, 176, 235, .22); border-radius: 15px; background: #08192b; }
.identity-summary > span { display: grid; flex: 0 0 auto; width: 48px; height: 48px; place-items: center; border-radius: 50%; color: #07111f; background: #66c7ff; font-size: 20px; font-weight: 900; }
.identity-summary div { min-width: 0; }
.identity-summary strong, .identity-summary div span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-summary div span { margin-top: 5px; color: #8fa8c3; font-size: 12px; }
.telemetry-list { margin-top: 12px; }
.telemetry-list dd { max-width: 190px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.pwm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 8px 0 28px; }
.pwm-grid > div { padding: 18px; border-radius: 14px; background: #09192c; }
.pwm-grid span { display: block; margin-bottom: 8px; color: #8fa8c3; }
.pwm-grid strong { color: #66c2ff; font-size: 24px; }
.keys { display: grid; grid-template-columns: repeat(3, minmax(76px, 122px)); grid-template-areas: ". w ." "a s d"; justify-content: center; gap: 12px; margin: 22px 0 30px; }
.key { display: grid; place-items: center; gap: 6px; min-height: 78px; color: #d9e9f8; border: 1px solid #365170; border-radius: 14px; background: linear-gradient(#182c45, #102138); transition: transform .08s ease, border-color .12s ease, background .12s ease; touch-action: none; }
.key-w { grid-area: w; }.key-a { grid-area: a; }.key-s { grid-area: s; }.key-d { grid-area: d; }
.key.active { transform: translateY(2px); color: #fff; border-color: #54baff; background: #176fa9; }
kbd { font-size: 22px; font-weight: 900; }
.key span { color: #a9c1da; font-size: 12px; }
.slider-label { display: flex; justify-content: space-between; margin-bottom: 10px; }
input[type="range"] { width: 100%; accent-color: #46b7ff; }
.ramp-controls, .mode-panel { margin: 22px 0 0; padding: 18px; border: 1px solid rgba(92, 158, 216, .22); border-radius: 14px; background: rgba(7, 20, 35, .5); }
.ramp-controls legend { padding: 0 8px; color: #65bfff; font-size: 13px; font-weight: 800; }
.mode-panel { margin: 0 0 16px; }
.mode-panel legend { padding: 0 8px; color: #65bfff; font-size: 13px; font-weight: 800; }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 12px; background: #071524; }
.segmented-control label { cursor: pointer; }
.segmented-control input { position: absolute; opacity: 0; pointer-events: none; }
.behavior-panel { margin-top: 14px; padding: 12px; border: 1px solid rgba(104, 165, 218, .22); border-radius: 12px; }
.behavior-panel legend { padding: 0 6px; color: #9db6cd; }
.segmented-control span { display: grid; min-height: 42px; place-items: center; border: 1px solid transparent; border-radius: 9px; color: #91abc4; font-size: 13px; }
.segmented-control input:checked + span { color: #fff; border-color: #3378a8; background: #16577e; }
.segmented-control input:focus-visible + span { outline: 3px solid #7fd0ff; outline-offset: 2px; }
.segmented-control input:disabled + span { cursor: not-allowed; opacity: .45; }
.stacked-label { display: block; margin: 16px 0 8px; font-size: 13px; }
select, input[type="number"] { width: 100%; min-height: 44px; padding: 0 12px; color: #edf6ff; border: 1px solid #385170; border-radius: 10px; outline: none; background: #081525; }
select:focus, input[type="number"]:focus { border-color: #57b7ff; box-shadow: 0 0 0 3px rgba(62,164,240,.14); }
.field-hint { margin: 10px 0 0; color: #839db6; font-size: 11px; line-height: 1.55; }
.emergency-button { width: 100%; min-height: 58px; margin-bottom: 16px; border-color: #e54d6d; background: linear-gradient(120deg, #a31d3b, #731c33); box-shadow: 0 8px 24px rgba(137, 21, 51, .3); font-size: 16px; }
.emergency-button span { margin-right: 7px; }
.emergency-button:not(:disabled):hover { background: linear-gradient(120deg, #c32448, #8e1f3d); }
.curve-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.curve-editor { min-width: 0; padding: 15px; border: 1px solid rgba(92, 158, 216, .18); border-radius: 12px; background: #081728; }
.curve-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.curve-header output { color: #75c9ff; font-size: 17px; font-weight: 850; }
.curve-svg { display: block; width: 100%; min-height: 210px; border-radius: 10px; background: linear-gradient(180deg, rgba(21, 52, 79, .46), rgba(5, 18, 32, .8)); touch-action: none; user-select: none; }
.curve-grid-lines { fill: none; stroke: rgba(123, 171, 214, .14); stroke-width: 1; }
.curve-axis { fill: none; stroke: #6483a3; stroke-width: 1.5; }
.curve-guide { stroke: rgba(98, 192, 255, .48); stroke-width: 1.5; stroke-dasharray: 5 5; }
.curve-path { fill: none; stroke: #4bbcff; stroke-width: 4; stroke-linecap: round; }
.curve-handle { fill: #4bbcff; stroke: #d6f1ff; stroke-width: 3; cursor: grab; filter: drop-shadow(0 2px 5px rgba(55, 183, 255, .45)); }
.curve-handle:active { cursor: grabbing; }
.curve-handle:focus { outline: none; stroke: #fff; stroke-width: 5; }
.curve-axis-label { fill: #7f9bb7; font-size: 11px; }
.curve-help { min-height: 38px; margin: 10px 0 6px; color: #8fa8c3; font-size: 12px; line-height: 1.55; }
.curve-value { display: block; color: #71c8ff; font-size: 11px; overflow-wrap: anywhere; }
.curve-slope { display: block; min-height: 34px; margin: 5px 0 12px; color: #8fa8c3; font-size: 11px; }
.curve-editor input[type="range"] { min-height: 44px; }
.curve-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.curve-presets button { min-height: 44px; padding: 0 12px; color: #aeddff; border-color: #2f506f; background: #10243b; font-size: 12px; }
.curve-presets button:hover { border-color: #58bdff; color: #fff; }
button:focus-visible, input[type="range"]:focus-visible, select:focus-visible, input[type="number"]:focus-visible { outline: 3px solid #7fd0ff; outline-offset: 3px; }
.hint { margin: 14px 0 0; color: #8fa8c3; font-size: 13px; line-height: 1.6; }
.button-stack { display: grid; gap: 10px; }
button { min-height: 44px; padding: 0 18px; color: #eef7ff; border: 1px solid transparent; border-radius: 11px; font-weight: 800; }
.primary { background: linear-gradient(120deg, #168fef, #536ef2); }
.safe { background: #16af7f; }.danger { background: #8a3150; }
.ghost { border-color: #34506d; background: #102139; }
.text-button { width: 100%; margin-top: 14px; color: #a8c2db; background: transparent; }
dl { margin: 24px 0 0; }
dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid rgba(119,158,201,.14); }
dt { color: #8fa8c3; } dd { margin: 0; max-width: 180px; text-align: right; overflow-wrap: anywhere; }
.management-layout { display: grid; grid-template-columns: minmax(320px, .8fr) minmax(0, 1.2fr); gap: 18px; margin-top: 18px; }
.management-layout h2 { margin-bottom: 0; }
.save-state { min-height: 18px; color: #7bf0c5; font-size: 12px; }
.settings-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(100px, 140px); align-items: center; gap: 14px 18px; margin-top: 24px; }
.settings-form label { display: grid; gap: 4px; }
.settings-form label small { color: #819ab3; font-weight: 500; }
.unit-input { position: relative; }
.unit-input input { padding-right: 38px; }
.unit-input span { position: absolute; top: 50%; right: 13px; color: #7591ab; transform: translateY(-50%); pointer-events: none; }
.form-error { grid-column: 1 / -1; min-height: 18px; margin: 0; color: #ff8ca5; font-size: 12px; }
.settings-submit { grid-column: 1 / -1; justify-self: end; min-width: 150px; }
.faces-hint { margin-top: 18px; }
.table-scroller { margin-top: 15px; overflow-x: auto; border: 1px solid rgba(98, 154, 207, .18); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 13px; border-bottom: 1px solid rgba(119,158,201,.13); text-align: left; vertical-align: middle; }
th { color: #8fa8c3; background: rgba(7, 20, 35, .7); font-size: 12px; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
td { color: #d7e5f3; font-size: 13px; }
.face-name-input { min-width: 140px; }
.face-state { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.face-state input { width: 18px; height: 18px; accent-color: #26ba8b; }
.face-actions { display: flex; gap: 7px; }
.face-actions button { min-height: 36px; padding: 0 10px; font-size: 12px; white-space: nowrap; }
.empty-state { padding: 28px 14px; color: #839db6; text-align: center; }
.error { min-height: 22px; margin: 10px 0 0; color: #ff8ca5; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 420px; margin: 0; padding: 14px 18px; border: 1px solid #396080; border-radius: 12px; background: #0b1c30; box-shadow: 0 14px 42px rgba(0,0,0,.38); }
@media (max-width: 820px) {
  .status-grid { grid-template-columns: 1fr 1fr; }
  .layout, .vision-layout, .management-layout { grid-template-columns: 1fr; }
  header { align-items: flex-start; flex-direction: column; }
  .vision-card { order: 2; }
  .media-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .shell { width: min(100% - 20px, 1180px); padding-top: 20px; }
  .card { padding: 19px; border-radius: 16px; }
  .status-grid, .pwm-grid { grid-template-columns: 1fr; }
  .curve-editor-grid { grid-template-columns: 1fr; }
  .safety-banner { align-items: flex-start; flex-direction: column; }
  .video-heading { align-items: flex-start; flex-direction: column; }
  .video-stage { min-height: 210px; }
  .media-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-form { grid-template-columns: 1fr; }
  .settings-form .unit-input, .settings-submit { grid-column: 1; width: 100%; }
  .settings-form label { margin-bottom: -8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
