:root {
  --bg: #030913;
  --bg-2: #061326;
  --panel: #06152b;
  --line: #19314d;
  --line-soft: #142941;
  --text: #deecff;
  --muted: #94a8c4;
  --blue: #2f91ff;
  --blue-soft: #1f4b7b;
  --ok: #39af72;
  --danger: #ad344a;
  --warn: #9a7a2e;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  min-height: 100dvh;
  background:
    radial-gradient(circle at 8% -20%, #0c2f57 0, rgba(12, 47, 87, 0) 42%),
    radial-gradient(circle at 95% 0%, #102f4e 0, rgba(16, 47, 78, 0) 38%),
    linear-gradient(180deg, #02070f 0%, #040c17 100%);
}

.app {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 10px;
  display: grid;
  gap: 10px;
}

.panel {
  background: linear-gradient(100deg, rgba(6, 21, 43, .95), rgba(5, 17, 35, .95));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(109, 151, 205, .08), 0 12px 28px rgba(0, 0, 0, .38);
  padding: 14px;
}

h1, h2, h3 { margin: 0; font-weight: 700; }
h1 { font-size: 1.95rem; letter-spacing: .01em; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.34rem; }

.top-shell {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.top-shell__left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 700;
  font-size: .95rem;
  border: 1px solid;
  line-height: 1;
}
.is-offline { color: #ffc2cc; background: rgba(122, 19, 34, .3); border-color: #8f2939; }
.is-online { color: #bcf7d6; background: rgba(12, 90, 57, .3); border-color: #2a8f60; }
.rtt { color: var(--muted); font-weight: 600; }

.profile-pills { display: flex; gap: 8px; }
.pill {
  text-decoration: none;
  display: inline-block;
  background: #071729;
  border: 1px solid var(--line);
  color: #9ab8df;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: .95rem;
}
.pill.active { border-color: #2f7ed6; color: #dcecff; background: #0b2139; }

.auth-panel { display: grid; gap: 8px; }
.auth-grid {
  display: grid;
  grid-template-columns: minmax(200px, 220px) minmax(220px, 260px) auto;
  gap: 10px;
  align-items: center;
}
input {
  width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: #08192f;
  color: var(--text);
  padding: 11px 14px;
  font-size: 1rem;
}
input::placeholder { color: #7794ba; }
.broker-note { margin: 0; }
code { color: #a5cbff; }

.compact-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.layout-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 10px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.camera-box {
  min-height: 415px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #030a16 0%, #07142a 100%);
  display: grid;
  place-items: center;
  color: #7c95b5;
  letter-spacing: .12em;
  font-size: .86rem;
}

.camera-frame {
  width: 100%;
  height: 100%;
  min-height: inherit;
  border: 0;
  border-radius: 12px;
  background: #000;
  object-fit: cover;
  display: block;
}

.panel-foot {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-chip {
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: #07182e;
  color: #9cb3cf;
  padding: 6px 11px;
  font-weight: 600;
}
.stat-chip strong { color: #e2eeff; }

.btn {
  border: 1px solid var(--line-soft);
  background: #0b2038;
  color: #dcecff;
  border-radius: 13px;
  padding: 9px 16px;
  font-size: 1.06rem;
  font-weight: 700;
  cursor: pointer;
  transition: .15s ease;
}
.btn:hover { border-color: #2a5f98; }
.btn:active { transform: translateY(1px); }
.btn-primary { border-color: #2a7bca; background: #0f2d4d; }
.btn-success { border-color: #256e4f; background: #0c2a20; }
.btn-warning { border-color: #7f6231; background: #352815; }
.btn-danger { border-color: #944152; background: #3c1721; }
.btn-chip { background: #0a1c31; }
.btn-control { min-height: 48px; width: 100%; }

.btn.is-active,
.btn-group .is-active {
  background: linear-gradient(180deg, #22405f 0%, #162d46 100%);
  border-color: #4d95dd;
  box-shadow: inset 0 0 0 1px rgba(127, 184, 245, .26);
  color: #f0f7ff;
}

#proCommandGroup .btn {
  opacity: .72;
}

#proCommandGroup .btn.is-active {
  opacity: 1;
  border-color: #8ed1ff;
  box-shadow:
    inset 0 0 0 1px rgba(191, 229, 255, .36),
    0 0 0 1px rgba(81, 151, 220, .55),
    0 0 14px rgba(75, 157, 232, .35);
  transform: translateY(-1px);
}

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.status-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.status-card {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: #081a30;
  padding: 10px;
  color: #c6d8f2;
  font-weight: 600;
}

.control-block {
  margin-top: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: rgba(8, 22, 42, .55);
  padding: 12px;
}
.line-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.grid-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 8px;
}
.grid-control.slim { grid-template-columns: repeat(2, 1fr); }

.row { display: flex; align-items: flex-start; }
.wrap { flex-wrap: wrap; }
.split { justify-content: space-between; gap: 10px; }
.tiny-label { margin: 0 0 6px; color: var(--muted); font-size: .9rem; }

.joystick-pad {
  width: min(300px, 84vw);
  aspect-ratio: 1 / 1;
  margin: 2px auto;
  border-radius: 50%;
  border: 2px solid #36587d;
  background: radial-gradient(circle at 50% 50%, #132947 0 35%, #09192f 36% 100%);
  position: relative;
  touch-action: none;
}

.joystick-knob {
  width: 32%;
  aspect-ratio: 1;
  border-radius: 50%;
  position: absolute;
  left: 34%;
  top: 34%;
  border: 2px solid #7fb9f3;
  background: radial-gradient(circle at 35% 30%, #a4d3ff 0 15%, #426997 16% 100%);
  box-shadow: 0 10px 18px rgba(0, 0, 0, .38);
}

.hint-note {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.45;
}


.pill.is-disabled {
  opacity: .45;
  cursor: not-allowed;
}
.pill:disabled { cursor: not-allowed; }

.pro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 10px;
  margin: 10px 0;
}
.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .9rem;
}


.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.table-wrap { overflow-x: auto; margin-top: 8px; }
.motor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.motor-table th,
.motor-table td {
  border: 1px solid var(--line-soft);
  padding: 6px 8px;
  text-align: left;
}
.motor-table th {
  background: #0b2139;
  color: #bcd7f8;
}

.log-box {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #041120;
  color: #b5cee8;
  padding: 10px;
  min-height: 96px;
  max-height: 160px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin: 10px 0;
}


.page { display: block; }
.basic-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
}

.muted { color: var(--muted); }
.hidden { display: none !important; }

body.screen-locked {
  position: fixed;
  inset: 0;
  overflow: hidden;
  width: 100%;
}

@media (max-width: 1024px) {
  .layout-grid { grid-template-columns: 1fr; }
  .camera-box { min-height: 300px; }
}

@media (max-width: 760px) {
  h1 { font-size: 1.3rem; }
  h2 { font-size: 1.2rem; }
  h3 { font-size: 1rem; }
  .auth-grid { grid-template-columns: 1fr; }
  .status-cards { grid-template-columns: 1fr 1fr; }
  .panel-head,
  .compact-session,
  .line-head { flex-direction: column; align-items: stretch; }
  .btn-group .btn { width: 100%; }
  .basic-grid { grid-template-columns: 1fr; }
  .pro-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .telemetry-grid { grid-template-columns: 1fr; }
}


.password-wrap { position: relative; width: 100%; }
.password-wrap input { padding-right: 48px; }
.toggle-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  border: 1px solid var(--line-soft);
  background: #0b2038;
  color: #dcecff;
  border-radius: 10px;
  width: 34px;
  height: 34px;
  font-size: 16px;
  cursor: pointer;
}
.toggle-eye:hover { border-color: #2a7bca; }


select {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101915;
  color: var(--text);
  padding: 10px;
  font-size: 1rem;
}
.text-ok { color: #9de3ba; }
