:root {
  --bg: #06100d;
  --surface: #0b1915;
  --surface-2: #10231d;
  --line: rgba(255,255,255,.09);
  --text: #eef8f3;
  --muted: #82958d;
  --green: #9de82f;
  --green-dark: #152909;
  --red: #ff6464;
  --amber: #ffc857;
  --radius: 20px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% 0, rgba(92,160,42,.12), transparent 32%), var(--bg); color: var(--text); font: 15px/1.5 Inter, ui-sans-serif, system-ui, sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
.topbar { height: 76px; padding: 0 max(24px, calc((100vw - 1240px)/2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(6,16,13,.85); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--green); color: #071008; font-weight: 900; letter-spacing: -.08em; }
.brand strong, .brand small { display: block; line-height: 1; letter-spacing: .15em; }
.brand small { color: var(--green); font-size: 9px; margin-top: 6px; letter-spacing: .38em; }
.connection { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 14px currentColor; }
.status-dot.ok { background: var(--green); }
.status-dot.error { background: var(--red); }
.text-button { border: 0; border-left: 1px solid var(--line); background: none; color: var(--text); padding-left: 14px; margin-left: 6px; }
main { width: min(calc(100% - 40px), 1240px); margin: auto; padding-bottom: 80px; }
.hero { min-height: 310px; display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.eyebrow { margin: 0 0 10px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .2em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(40px, 5vw, 68px); line-height: 1.02; letter-spacing: -.055em; }
h1 span { color: var(--green); }
h2 { margin-bottom: 0; font-size: 30px; letter-spacing: -.03em; }
.button { border: 1px solid var(--green); border-radius: 999px; min-height: 44px; padding: 0 20px; background: var(--green); color: #081108; font-weight: 800; }
.button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
.summary { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: rgba(11,25,21,.66); }
.summary article { min-height: 118px; padding: 24px 28px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; }
.summary article:last-child { border: 0; }
.summary span { color: var(--muted); }
.summary strong { font-size: 32px; }
.section-heading { margin: 76px 0 24px; display: flex; justify-content: space-between; }
.device-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.device-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; background: linear-gradient(145deg, rgba(16,35,29,.95), rgba(8,20,16,.95)); transition: .2s; }
.device-card:hover { border-color: rgba(157,232,47,.35); transform: translateY(-2px); }
.card-top { display: flex; justify-content: space-between; gap: 20px; }
.card-top h3 { margin-bottom: 5px; font-size: 20px; }
.muted { color: var(--muted); }
.badge { height: 27px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 999px; background: rgba(255,100,100,.1); color: #ff9696; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.badge.online { color: var(--green); background: rgba(157,232,47,.1); }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 25px 0; }
.metric { padding: 14px 10px; background: rgba(255,255,255,.035); border-radius: 12px; }
.metric span, .metric strong { display: block; }
.metric span { color: var(--muted); font-size: 11px; }
.metric strong { font-size: 18px; margin-top: 4px; }
.motor { display: flex; align-items: center; justify-content: space-between; padding-top: 18px; border-top: 1px solid var(--line); }
.motor-state { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.motor-state i { width: 8px; height: 8px; border-radius: 50%; background: #55645e; }
.motor-state.running i { background: var(--green); box-shadow: 0 0 12px rgba(157,232,47,.6); }
.details-button { border: 0; background: none; color: var(--green); font-weight: 800; }
.error-line { margin-top: 15px; padding: 10px 12px; border-radius: 10px; background: rgba(255,100,100,.08); color: #ff9d9d; font-size: 12px; }
.empty-state { grid-column: 1/-1; padding: 60px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
dialog { width: min(calc(100% - 32px), 1020px); max-height: calc(100vh - 32px); padding: 30px; border: 1px solid var(--line); border-radius: 24px; background: #091712; color: var(--text); box-shadow: 0 30px 100px rgba(0,0,0,.65); }
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; }
.icon-button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 25px; }
.control-grid { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 12px; margin: 28px 0 38px; }
.control { min-height: 82px; border: 1px solid var(--line); border-radius: 16px; color: var(--text); background: var(--surface-2); display: flex; align-items: center; justify-content: center; gap: 10px; }
.control.start span { color: var(--green); }
.control.stop span { color: var(--red); }
.frequency-control { padding: 13px 15px; border: 1px solid var(--line); border-radius: 16px; }
.frequency-control label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 7px; }
.frequency-control div { display: flex; align-items: center; gap: 8px; }
input { min-width: 0; width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #06100d; color: var(--text); padding: 0 12px; outline: none; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(157,232,47,.08); }
.history-header { display: flex; align-items: baseline; justify-content: space-between; margin-top: 28px; }
.history-header h3 { margin-bottom: 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 13px 15px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
tbody tr:last-child td { border-bottom: 0; }
.command-history { display: flex; flex-wrap: wrap; gap: 8px; }
.command-pill { padding: 8px 11px; border-radius: 10px; background: rgba(255,255,255,.05); color: var(--muted); font-size: 12px; }
.command-pill b { color: var(--text); }
.message { padding: 11px 14px; margin-top: 18px; border-radius: 12px; color: var(--green); background: rgba(157,232,47,.08); }
.token-dialog { width: min(calc(100% - 32px), 460px); }
.token-dialog label { display: block; margin: 24px 0 7px; font-weight: 700; }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 20px; }
.toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 20px; padding: 12px 18px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 700; opacity: 0; pointer-events: none; transition: .2s; z-index: 30; }
.toast.show { opacity: 1; translate: -50% 0; }
@media (max-width: 900px) {
  .device-grid { grid-template-columns: repeat(2, 1fr); }
  .control-grid { grid-template-columns: 1fr 1fr; }
  .frequency-control { grid-column: 1/-1; }
}
@media (max-width: 620px) {
  main { width: min(calc(100% - 24px), 1240px); }
  .topbar { padding: 0 14px; }
  .connection > span:not(.status-dot) { display: none; }
  .hero { min-height: 280px; align-items: flex-start; justify-content: center; flex-direction: column; }
  .summary { grid-template-columns: 1fr 1fr; }
  .summary article:nth-child(2) { border-right: 0; }
  .summary article { border-bottom: 1px solid var(--line); }
  .summary article:nth-child(n+3) { border-bottom: 0; }
  .device-grid { grid-template-columns: 1fr; }
  dialog { padding: 20px; }
  .control-grid { grid-template-columns: 1fr; }
  .frequency-control { grid-column: auto; }
}
