:root {
  color-scheme: dark;
  --bg: #060b13;
  --surface: #0b1422;
  --surface-2: #101d2f;
  --surface-3: #14243a;
  --line: #213752;
  --line-soft: rgba(118, 157, 199, .12);
  --text: #e8f1fb;
  --muted: #71869d;
  --blue: #3d8cff;
  --cyan: #22c7ef;
  --green: #26d39b;
  --purple: #9c7dff;
  --orange: #f3aa4e;
  --red: #fb5c74;
  --shadow: 0 22px 60px rgba(0, 0, 0, .32);
  --radius: 15px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { min-height: 100vh; margin: 0; color: var(--text); background: radial-gradient(circle at 80% -20%, rgba(61,140,255,.09), transparent 28%), var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-screen { min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden; padding: 24px; background: linear-gradient(145deg, #050910 0%, #081221 52%, #06101c 100%); }
.login-grid { position: absolute; inset: 0; opacity: .15; background-image: linear-gradient(rgba(94,143,190,.17) 1px, transparent 1px), linear-gradient(90deg, rgba(94,143,190,.17) 1px, transparent 1px); background-size: 52px 52px; mask-image: linear-gradient(to bottom, transparent, black 35%, transparent); }
.login-glow { position: absolute; width: 420px; height: 420px; border-radius: 50%; filter: blur(90px); opacity: .13; }
.glow-a { left: -120px; top: -100px; background: var(--blue); }
.glow-b { right: -110px; bottom: -130px; background: var(--purple); }
.login-card { z-index: 1; width: min(440px, 100%); padding: 42px; border: 1px solid rgba(101, 145, 191, .2); border-radius: 24px; background: linear-gradient(145deg, rgba(14,27,45,.94), rgba(8,17,30,.96)); box-shadow: 0 40px 100px rgba(0,0,0,.5); backdrop-filter: blur(22px); }
.login-card h1 { margin: 18px 0 9px; font-size: clamp(30px, 7vw, 42px); letter-spacing: -.045em; }
.login-card h1 span, .brand em { color: var(--cyan); font-style: normal; }
.login-card > .muted { margin: 0 0 28px; line-height: 1.6; }
.login-card label, .form-panel label, .device-modal label { display: grid; gap: 8px; margin: 0 0 15px; color: #a9bad0; font-size: 12px; font-weight: 700; }
input, select { width: 100%; min-height: 45px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; outline: 0; color: var(--text); background: #091321; transition: border .2s, box-shadow .2s; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(61,140,255,.12); }
.secure-line { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; color: #60768f; font-size: 10px; }
.secure-line i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.form-error { padding: 10px 12px; border: 1px solid rgba(251,92,116,.25); border-radius: 9px; color: #ff9aaa; background: rgba(251,92,116,.08); font-size: 11px; }

.brand-mark { width: 39px; height: 39px; display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 3px; padding: 8px; border: 1px solid rgba(34,199,239,.28); border-radius: 11px; background: linear-gradient(150deg, rgba(61,140,255,.17), rgba(34,199,239,.04)); box-shadow: inset 0 0 18px rgba(34,199,239,.08); }
.brand-mark i { display: block; border-radius: 2px 2px 1px 1px; background: linear-gradient(to top, var(--blue), var(--cyan)); box-shadow: 0 0 8px rgba(34,199,239,.35); }
.brand-mark i:nth-child(1) { height: 42%; }.brand-mark i:nth-child(2) { height: 82%; }.brand-mark i:nth-child(3) { height: 58%; }
.brand-mark.large { width: 52px; height: 52px; padding: 10px; border-radius: 14px; }
.eyebrow { margin: 0; color: var(--blue); font-size: 9px; font-weight: 900; letter-spacing: .2em; }
.muted { color: var(--muted); }

.app-shell { min-height: 100vh; }
.topbar { height: 68px; position: sticky; z-index: 1000; top: 0; display: flex; align-items: center; gap: 20px; padding: 0 22px; border-bottom: 1px solid var(--line-soft); background: rgba(7,14,24,.91); backdrop-filter: blur(20px); }
.brand { min-width: 250px; display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand strong, .brand small { display: block; }.brand strong { font-size: 17px; letter-spacing: -.02em; }.brand small { margin-top: 3px; color: #57708c; font-size: 7px; font-weight: 900; letter-spacing: .18em; }
.main-nav { flex: 1; display: flex; justify-content: center; gap: 4px; }
.nav-button { min-height: 38px; padding: 0 15px; border: 0; border-radius: 9px; color: #71879f; background: transparent; font-size: 11px; font-weight: 800; transition: color .2s, background .2s; }
.nav-button span { display: inline-block; margin-right: 7px; color: #59728e; font-size: 15px; }.nav-button:hover { color: #b7c8d9; }.nav-button.active { color: #c7e8ff; background: rgba(61,140,255,.12); }.nav-button.active span { color: var(--cyan); }
.mobile-nav-head, .menu-toggle { display: none; }
.top-actions { min-width: 250px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.connection-chip { min-height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid rgba(251,92,116,.19); border-radius: 99px; color: #f17d90; background: rgba(251,92,116,.06); font-size: 9px; font-weight: 800; }.connection-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); }.connection-chip.online { color: #66dcb5; border-color: rgba(38,211,155,.2); background: rgba(38,211,155,.06); }.connection-chip.online i { background: var(--green); box-shadow: 0 0 9px var(--green); }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line-soft); border-radius: 9px; color: #8ca1b8; background: rgba(15,28,45,.7); font-size: 18px; }
.icon-button:hover { color: #d4e3f1; border-color: var(--line); }

main { min-height: calc(100vh - 68px); }
.view { display: none; }.view.active { display: block; animation: view-in .24s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }
.page-view { width: min(1450px, 100%); margin: 0 auto; padding: 42px clamp(18px, 4vw, 52px) 70px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }.page-header h1 { margin: 7px 0 5px; font-size: clamp(27px, 4vw, 38px); letter-spacing: -.04em; }.page-header p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.hardware-badge { padding: 9px 12px; border: 1px solid rgba(61,140,255,.22); border-radius: 8px; color: #82b5ff; background: rgba(61,140,255,.07); font-size: 8px; font-weight: 900; letter-spacing: .09em; }

.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 16px; border: 1px solid transparent; border-radius: 9px; font-size: 11px; font-weight: 900; transition: transform .15s, opacity .15s, box-shadow .15s; }.button:hover:not(:disabled) { transform: translateY(-1px); }.button:disabled { cursor: not-allowed; opacity: .42; }.button.primary { color: white; border-color: #337fe9; background: linear-gradient(135deg, #347feb, #2b6bd1); box-shadow: 0 10px 25px rgba(41,109,213,.2); }.button.secondary { color: #9fb2c7; border-color: var(--line); background: #101c2c; }.button.danger { color: #ff9aaa; border-color: rgba(251,92,116,.25); background: rgba(251,92,116,.08); }.button.wide { width: 100%; }
.panel { border: 1px solid var(--line-soft); border-radius: var(--radius); background: linear-gradient(145deg, rgba(14,27,45,.93), rgba(9,18,31,.93)); box-shadow: 0 15px 50px rgba(0,0,0,.14); }
.panel-title { display: flex; align-items: center; gap: 12px; }.panel-title h2, .panel-title p { margin: 0; }.panel-title h2 { font-size: 14px; }.panel-title p { margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.4; }.panel-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.icon-box { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 9px; font-size: 16px; }.icon-box.blue { color: var(--blue); background: rgba(61,140,255,.08); }.icon-box.cyan { color: var(--cyan); background: rgba(34,199,239,.08); }.icon-box.green { color: var(--green); background: rgba(38,211,155,.08); }.icon-box.purple { color: var(--purple); background: rgba(156,125,255,.08); }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid rgba(112,135,160,.2); border-radius: 99px; color: #8095ac; background: rgba(112,135,160,.06); font-size: 8px; font-weight: 900; letter-spacing: .06em; }.status-badge.online, .status-badge.ready { color: #57dcad; border-color: rgba(38,211,155,.22); background: rgba(38,211,155,.07); }.status-badge.offline { color: #f17d90; border-color: rgba(251,92,116,.22); background: rgba(251,92,116,.07); }.status-badge.warning { color: #f4b969; border-color: rgba(243,170,78,.25); background: rgba(243,170,78,.08); }

.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }.summary-item { min-height: 88px; padding: 17px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(13,25,42,.72); }.summary-item small, .summary-item strong { display: block; }.summary-item small { color: var(--muted); font-size: 9px; font-weight: 800; }.summary-item strong { margin-top: 8px; font-size: 22px; }.summary-item strong.green { color: var(--green); }.summary-item strong.cyan { color: var(--cyan); }
.device-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.empty-state { grid-column: 1 / -1; min-height: 180px; display: grid; place-items: center; padding: 24px; border: 1px dashed #223750; border-radius: var(--radius); color: var(--muted); background: rgba(12,23,38,.45); text-align: center; }.empty-state b { display: block; margin-bottom: 6px; color: #a9bbcd; font-size: 14px; }
.device-card { overflow: hidden; }.device-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 19px; border-bottom: 1px solid var(--line-soft); }.device-card-head h2 { margin: 0; font-size: 16px; }.device-card-head p { margin: 6px 0 0; color: var(--muted); font-size: 9px; }.device-card-body { padding: 17px 19px; }.presence-display { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line-soft); border-radius: 11px; background: rgba(4,10,18,.25); }.radar-orb { width: 50px; height: 50px; position: relative; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #29415d; border-radius: 50%; color: #6d8197; background: radial-gradient(circle, rgba(114,134,156,.16), transparent 65%); }.radar-orb::before, .radar-orb::after { content: ''; position: absolute; border: 1px solid currentColor; border-radius: 50%; opacity: .28; }.radar-orb::before { inset: 8px; }.radar-orb::after { inset: 16px; }.radar-orb.on { color: var(--green); border-color: rgba(38,211,155,.48); box-shadow: 0 0 24px rgba(38,211,155,.12); }.radar-orb.on::after { background: var(--green); box-shadow: 0 0 9px var(--green); animation: radar 1.7s infinite; }@keyframes radar { 50% { opacity: .8; transform: scale(1.2); } }
.presence-display small, .presence-display strong { display: block; }.presence-display small { color: var(--muted); font-size: 8px; }.presence-display strong { margin: 5px 0 3px; font-size: 12px; }.presence-display span { color: #6b829a; font-size: 9px; }
.device-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }.device-metrics div { padding: 10px; border: 1px solid var(--line-soft); border-radius: 9px; }.device-metrics small, .device-metrics b { display: block; }.device-metrics small { color: var(--muted); font-size: 8px; }.device-metrics b { margin-top: 5px; font-size: 10px; }
.device-actions { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(145px, auto) auto; gap: 8px; }.settings-button { width: 43px; padding: 0; }.update-button { padding-inline: 12px; font-size: 9px; }
.activity-panel { padding: 20px; }.timeline-list { margin-top: 17px; display: grid; gap: 2px; }.timeline-item { position: relative; display: grid; grid-template-columns: 80px 1fr; gap: 14px; padding: 10px 0 10px 20px; border-left: 1px solid #203750; color: #94a7ba; font-size: 10px; }.timeline-item::before { content: ''; position: absolute; left: -4px; top: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 8px rgba(61,140,255,.55); }.timeline-item time { color: #516980; }.timeline-item b { color: #bfcee0; }

.devices-layout { display: grid; grid-template-columns: 360px 1fr; gap: 16px; }.devices-layout > .panel { padding: 21px; }.span-all { grid-column: 1 / -1; }.form-panel .panel-title { margin-bottom: 20px; }.waiting-list, .discovered-list, .number-list { margin-top: 17px; display: grid; gap: 9px; }.waiting-item, .discovered-item, .number-item { display: flex; align-items: center; justify-content: space-between; gap: 13px; padding: 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(5,11,19,.23); }.waiting-item strong, .waiting-item small, .discovered-item strong, .discovered-item small, .number-item strong, .number-item small { display: block; }.waiting-item strong, .discovered-item strong, .number-item strong { font-size: 10px; }.waiting-item small, .discovered-item small, .number-item small { margin-top: 4px; color: var(--muted); font-size: 8px; }.item-actions { display: flex; gap: 6px; }.mini-button { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: #9ab0c6; background: #101d2e; font-size: 8px; font-weight: 900; }.mini-button.danger { color: #ff8fa2; border-color: rgba(251,92,116,.2); background: rgba(251,92,116,.06); }
.flash-layout { display: grid; grid-template-columns: 1fr 1.1fr .9fr; gap: 16px; margin-top: 20px; }.firmware-card, .flash-station, .flash-steps { min-height: 180px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(4,10,18,.24); }.firmware-card { display: flex; align-items: center; gap: 16px; padding: 20px; }.firmware-orb { width: 64px; height: 64px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(156,125,255,.35); border-radius: 50%; color: #c2b2ff; background: radial-gradient(circle, rgba(156,125,255,.18), rgba(156,125,255,.02)); font-size: 17px; font-weight: 900; }.firmware-card small { color: var(--purple); font-size: 8px; font-weight: 900; letter-spacing: .13em; }.firmware-card h3 { margin: 6px 0; font-size: 15px; }.firmware-card p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; }.flash-station { display: grid; align-content: center; gap: 12px; padding: 18px; }.usb-visual { display: flex; align-items: center; justify-content: center; gap: 10px; color: #8299b1; font-size: 9px; }.usb-visual b { padding: 7px; border: 1px solid #314964; border-radius: 5px; background: #121e2c; }.usb-visual span { width: 35px; border-top: 2px solid #314964; }.usb-visual strong { color: #a9bfd5; }.flash-station p { margin: 0; color: var(--muted); font-size: 9px; text-align: center; }.flash-note { display: block; padding: 10px; color: #f3b56b; font-size: 9px; text-align: center; }.flash-steps { margin: 0; padding: 17px 17px 8px 42px; }.flash-steps li { padding: 0 0 17px 4px; color: #7890a7; font-size: 9px; }.flash-steps b, .flash-steps span { display: block; }.flash-steps b { margin-bottom: 4px; color: #aabed1; }.discovered-item select { width: min(230px, 100%); min-height: 34px; }

.notice { padding: 14px 16px; border-radius: 10px; font-size: 10px; line-height: 1.6; }.warning-notice { margin-bottom: 16px; color: #d6ad75; border: 1px solid rgba(243,170,78,.22); background: rgba(243,170,78,.07); }.danger-notice { margin-top: 17px; color: #e58a9a; border: 1px solid rgba(251,92,116,.2); background: rgba(251,92,116,.06); }
.two-column { display: grid; grid-template-columns: 360px 1fr; gap: 16px; }.two-column > .panel { padding: 21px; }.sms-flow-panel { margin-top: 16px; padding: 21px; }.sms-flow { display: flex; align-items: center; gap: 10px; margin-top: 20px; overflow-x: auto; padding-bottom: 5px; }.sms-bubble { min-width: 180px; padding: 13px; border: 1px solid var(--line); border-radius: 12px 12px 12px 3px; background: #0b1829; }.sms-bubble.outgoing { border-color: rgba(61,140,255,.25); border-radius: 12px 12px 3px 12px; background: rgba(61,140,255,.08); }.sms-bubble.success { border-color: rgba(38,211,155,.25); background: rgba(38,211,155,.08); }.sms-bubble small, .sms-bubble b { display: block; }.sms-bubble small { margin-bottom: 6px; color: var(--muted); font-size: 8px; }.sms-bubble b { color: #b8cadc; font-size: 9px; line-height: 1.5; }.sms-arrow { color: #3f5872; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }.settings-card { padding: 21px; }.detail-list { margin: 18px 0 0; }.detail-list div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line-soft); }.detail-list dt { color: var(--muted); font-size: 9px; }.detail-list dd { margin: 0; color: #b1c3d5; font: 9px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }.wiring-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 18px; }.wiring-grid div { padding: 13px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(5,11,19,.2); }.wiring-grid small, .wiring-grid strong, .wiring-grid span { display: block; }.wiring-grid small { color: var(--muted); font-size: 8px; }.wiring-grid strong { margin: 5px 0; color: #b7cae0; font: 11px ui-monospace, Consolas, monospace; }.wiring-grid span { color: #5f7790; font-size: 8px; }

.modal { width: min(460px, calc(100vw - 24px)); padding: 0; border: 1px solid #294461; border-radius: 18px; color: var(--text); background: linear-gradient(145deg, #101f34, #081321); box-shadow: 0 35px 90px rgba(0,0,0,.7); }.modal::backdrop { background: rgba(1,5,10,.76); backdrop-filter: blur(5px); }.modal > form { position: relative; padding: 29px; }.modal h2 { margin: 7px 0 9px; font-size: 23px; }.modal p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }.modal-icon { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 18px; border: 1px solid rgba(61,140,255,.28); border-radius: 14px; color: #80b3ff; background: rgba(61,140,255,.09); font-size: 25px; }.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }.dialog-close { position: absolute; right: 18px; top: 16px; border: 0; color: #71879f; background: transparent; font-size: 25px; }.device-modal { width: min(560px, calc(100vw - 24px)); }.device-modal h2 { margin-bottom: 22px; }.form-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast-host { position: fixed; z-index: 4000; right: 18px; top: 82px; display: grid; gap: 8px; }.toast { min-width: 260px; max-width: 380px; padding: 12px 15px; border: 1px solid #2a4362; border-radius: 10px; color: #c6d5e6; background: #122136; box-shadow: var(--shadow); font-size: 10px; animation: toast-in .25s ease-out; }.toast.error { color: #ff9dac; border-color: rgba(251,92,116,.35); }.toast.success { color: #7ce8c1; border-color: rgba(38,211,155,.3); }@keyframes toast-in { from { transform: translateX(15px); opacity: 0; } }

@media (max-width: 1050px) {
  .brand, .top-actions { min-width: auto; }.brand small, .connection-chip span { display: none; }.device-grid { grid-template-columns: 1fr 1fr; }.flash-layout { grid-template-columns: 1fr 1fr; }.flash-steps { grid-column: 1 / -1; }.wiring-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .login-card { padding: 30px 23px; }.topbar { height: 62px; padding: 0 10px; gap: 10px; }.menu-toggle { width: 38px; height: 38px; display: grid; align-content: center; gap: 4px; padding: 8px; border: 1px solid var(--line-soft); border-radius: 9px; background: #0f1b2b; }.menu-toggle span { display: block; border-top: 2px solid #8ca2b9; }.brand { flex: 1; }.brand .brand-mark { width: 32px; height: 32px; padding: 6px; }.brand strong { font-size: 14px; }.top-actions .connection-chip { display: none; }.main-nav { position: fixed; z-index: 1300; inset: 0 auto 0 0; width: min(84vw, 330px); padding: 14px; display: flex; flex-direction: column; justify-content: flex-start; gap: 6px; border-right: 1px solid var(--line); background: #08111e; box-shadow: 20px 0 60px rgba(0,0,0,.5); transform: translateX(-105%); transition: transform .24s ease; }.app-shell.nav-open .main-nav { transform: translateX(0); }.mobile-nav-head { min-height: 48px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; border-bottom: 1px solid var(--line-soft); }.mobile-nav-head button { border: 0; color: #b4c4d5; background: transparent; font-size: 27px; }.nav-button { width: 100%; min-height: 48px; text-align: left; font-size: 12px; }.nav-backdrop { position: fixed; z-index: 900; inset: 0; border: 0; background: rgba(0,0,0,.65); }.page-view { padding: 27px 14px 50px; }.page-header { align-items: flex-start; flex-direction: column; }.summary-strip { grid-template-columns: 1fr 1fr; }.device-grid, .devices-layout, .two-column, .settings-grid, .flash-layout { grid-template-columns: 1fr; }.span-all, .flash-steps { grid-column: auto; }.devices-layout > .panel, .two-column > .panel, .firmware-panel, .discovered-panel { padding: 17px; }.device-grid { gap: 10px; }.flash-steps { min-height: 0; }.wiring-grid { grid-template-columns: 1fr; }.sms-flow { align-items: stretch; flex-direction: column; }.sms-arrow { transform: rotate(90deg); text-align: center; }.sms-bubble { min-width: 0; }.form-split { grid-template-columns: 1fr; }.device-actions { grid-template-columns: 1fr auto; }.update-button { grid-column: 1 / -1; grid-row: 2; }.toast-host { left: 12px; right: 12px; top: 72px; }.toast { min-width: 0; max-width: none; }
}
