﻿:root {
  --bg1: #17161a;
  --bg2: #232228;
  --bg3: #1c1f29;
  --panel: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.16);

  --brand-light: #ff7462;
  --brand: #ff5f4d;
  --brand-dark: #f24f3f;

  --nav-off-1: #4b4d52;
  --nav-off-2: #35373c;
  --nav-off-border: rgba(255, 255, 255, 0.24);
  --nav-active-glow: rgba(255, 95, 77, 0.48);

  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --ok: #4caf50;
  --warn: #ffb347;
  --danger: #ff5f6d;
  --topbar-side-gap: clamp(8px, 1.1vw, 14px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  min-height: 100dvh;
  font-family: "Cairo", sans-serif;
  background:
    radial-gradient(circle at 8% 42%, rgba(255, 88, 66, 0.14) 0%, transparent 38%),
    radial-gradient(circle at 60% 48%, rgba(74, 108, 184, 0.08) 0%, transparent 42%),
    linear-gradient(110deg, var(--bg1) 0%, var(--bg2) 52%, var(--bg3) 100%);
  color: var(--text);
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -50%;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.015) 0,
      rgba(255, 255, 255, 0.015) 2px,
      transparent 2px,
      transparent 34px
    ),
    radial-gradient(circle at 16% 45%, rgba(255, 97, 73, 0.18) 0%, transparent 52%),
    radial-gradient(circle at 86% 83%, rgba(255, 122, 106, 0.1) 0%, transparent 50%);
  animation: drift 18s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: -32%;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 28%),
    radial-gradient(circle at 82% 76%, rgba(255, 244, 220, 0.08) 0%, transparent 30%);
  animation: ambient-light 16s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: screen;
  opacity: 0.48;
}

@keyframes drift {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
  50% {
    transform: translate(34px, 34px) rotate(4deg);
  }
}

@keyframes ambient-light {
  0%,
  100% {
    transform: translate3d(-18px, -10px, 0) scale(1);
    opacity: 0.38;
  }
  50% {
    transform: translate3d(20px, 12px, 0) scale(1.05);
    opacity: 0.56;
  }
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  transform-origin: top center;
  transition: transform 0.18s ease;
}

.topbar {
  position: sticky;
  top: 8px;
  z-index: 20;
  display: block;
  padding: 10px 16px;
  margin: 0 var(--topbar-side-gap);
  background: linear-gradient(180deg, rgba(31, 30, 35, 0.94) 0%, rgba(25, 25, 29, 0.9) 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24), 0 0 20px rgba(255, 118, 88, 0.08);
  overflow: visible;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 14% 40%, rgba(255, 140, 115, 0.16) 0%, transparent 38%),
    radial-gradient(circle at 88% 62%, rgba(255, 255, 255, 0.08) 0%, transparent 34%);
  pointer-events: none;
  animation: topbar-pulse 5.4s ease-in-out infinite;
}

.topbar::after {
  content: "";
  position: absolute;
  top: -150%;
  left: -46%;
  width: 42%;
  height: 360%;
  background: linear-gradient(
    110deg,
    transparent 0%,
    rgba(255, 255, 255, 0.18) 50%,
    transparent 100%
  );
  transform: rotate(14deg);
  pointer-events: none;
  animation: topbar-sweep 7.2s linear infinite;
}

@keyframes topbar-pulse {
  0%,
  100% {
    opacity: 0.46;
  }
  50% {
    opacity: 0.78;
  }
}

@keyframes topbar-sweep {
  0% {
    transform: translateX(-12%) rotate(14deg);
    opacity: 0;
  }
  9% {
    opacity: 0.82;
  }
  22% {
    opacity: 0;
  }
  100% {
    transform: translateX(290%) rotate(14deg);
    opacity: 0;
  }
}

body.home-view .topbar {
  display: none;
}

body.home-view .mode-nav-wrap {
  display: none;
}

body.home-view .app-shell {
  grid-template-rows: minmax(0, 1fr);
}

.topbar-main {
  position: relative;
  z-index: 1;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: nowrap;
}

.topbar-main-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.lang-toggle {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 99px;
  padding: 6px 13px;
  font-family: "Cairo", sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.lang-toggle:hover {
  background: rgba(240, 93, 78, 0.22);
  border-color: rgba(240, 93, 78, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.28);
}

.brand-left {
  display: none;
  align-items: center;
  gap: 0;
  text-decoration: none;
  color: var(--text);
  font-family: "Changa", sans-serif;
  font-size: 1rem;
  flex-shrink: 0;
}

.brand-left img {
  height: 74px;
  width: auto;
}

body.mode-view .brand-left {
  display: inline-flex;
}

.topbar-ble-dot {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(242, 104, 86, 0.16);
  border: 1px solid rgba(242, 104, 86, 0.36);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.topbar-ble-dot-core {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand-light);
  box-shadow: 0 0 10px rgba(255, 116, 98, 0.52);
}

.topbar-ble-dot.connected {
  background: rgba(76, 175, 80, 0.18);
  border-color: rgba(76, 175, 80, 0.42);
}

.topbar-ble-dot.connected .topbar-ble-dot-core {
  background: var(--ok);
  box-shadow: 0 0 12px rgba(76, 175, 80, 0.58);
}

.topbar-ble-dot.pending {
  background: rgba(255, 179, 71, 0.18);
  border-color: rgba(255, 179, 71, 0.42);
}

.topbar-ble-dot.pending .topbar-ble-dot-core {
  background: var(--warn);
  box-shadow: 0 0 12px rgba(255, 179, 71, 0.54);
}

.topbar-ble-dot.error .topbar-ble-dot-core {
  background: var(--danger);
  box-shadow: 0 0 12px rgba(255, 95, 109, 0.54);
}

.utility-toggle {
  border: none;
  border-radius: 14px;
  padding: 10px 16px;
  font-family: "Cairo", sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand-dark) 100%);
  box-shadow: 0 7px 18px rgba(242, 104, 86, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.utility-toggle:hover,
.utility-toggle.active {
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.28), 0 8px 20px rgba(242, 104, 86, 0.42);
}

.nav-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
  margin: 0;
}

.mode-nav-wrap {
  position: relative;
  z-index: 19;
  display: flex;
  justify-content: center;
  margin: 16px var(--topbar-side-gap) 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.mode-nav {
  max-width: 100%;
}

.topbar-nav {
  margin-left: auto;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--nav-off-border);
  background: linear-gradient(135deg, var(--nav-off-1) 0%, var(--nav-off-2) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 7px 18px rgba(0, 0, 0, 0.34);
  color: rgba(255, 255, 255, 0.92);
  font-family: "Cairo", sans-serif;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.nav-btn:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 10px 22px rgba(0, 0, 0, 0.38);
}

.nav-btn.active {
  border-color: rgba(255, 255, 255, 0.52);
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand) 62%, var(--brand-dark) 100%);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.36), 0 10px 24px var(--nav-active-glow);
}

.shared-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mode-shared-controls {
  margin-left: 0;
  justify-content: center;
  flex-wrap: wrap;
}

.shared-btn {
  border: none;
  border-radius: 14px;
  min-height: 44px;
  padding: 10px 16px;
  font-family: "Cairo", sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand-dark) 100%);
  box-shadow: 0 7px 18px rgba(242, 104, 86, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.shared-btn.disconnect {
  background: linear-gradient(135deg, #4c4c4c 0%, #333333 100%);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.34);
}

.shared-btn.camera {
  background: linear-gradient(135deg, #66717d 0%, #46515d 100%);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.34);
}

.shared-btn.active {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.28), 0 8px 20px rgba(242, 104, 86, 0.42);
}

.shared-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(242, 104, 86, 0.4);
}

.shared-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.status-indicator {
  min-width: 160px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid rgba(242, 104, 86, 0.35);
  background: rgba(242, 104, 86, 0.14);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  color: var(--brand-light);
}

.status-indicator.connected {
  border-color: rgba(76, 175, 80, 0.4);
  background: rgba(76, 175, 80, 0.14);
  color: var(--ok);
}

.status-indicator.pending {
  border-color: rgba(255, 179, 71, 0.42);
  background: rgba(255, 179, 71, 0.14);
  color: var(--warn);
}

.status-indicator.error {
  border-color: rgba(255, 95, 109, 0.42);
  background: rgba(255, 95, 109, 0.14);
  color: var(--danger);
}

.mode-utility-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 16px;
  z-index: 30;
  width: min(780px, calc(100vw - (var(--topbar-side-gap) * 2) - 16px));
  min-height: 214px;
  pointer-events: none;
}

.mode-utility-panel[hidden] {
  display: none;
}

.utility-panel-section {
  position: absolute;
  top: 0;
  min-width: 0;
  max-height: calc(100vh - 100px);
  max-height: calc(100dvh - 100px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.15s ease;
  display: grid;
  gap: 10px;
  padding: 12px;
  pointer-events: auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(31, 30, 35, 0.96) 0%, rgba(25, 25, 29, 0.94) 100%);
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.32), 0 0 20px rgba(255, 118, 88, 0.08);
}

.utility-panel-section:hover,
.utility-panel-section:focus-within {
  scrollbar-color: rgba(255, 255, 255, 0.32) transparent;
}

.utility-panel-section::-webkit-scrollbar {
  width: 8px;
}

.utility-panel-section::-webkit-scrollbar-track {
  background: transparent;
}

.utility-panel-section::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.utility-panel-section:hover::-webkit-scrollbar-thumb,
.utility-panel-section:focus-within::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
}

.utility-panel-section:hover::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.42);
}

.utility-section-title {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.46);
}

.utility-section-note {
  max-width: 42ch;
  font-size: 0.74rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.66);
}

.utility-nav-panel {
  right: 0;
  width: 220px;
}

.utility-robot-panel {
  right: 236px;
  width: min(528px, calc(100% - 236px));
}

html[dir="rtl"] .topbar-main-actions {
  margin-left: 0;
  margin-right: auto;
}

html[dir="rtl"] .topbar-main-actions .lang-toggle {
  direction: ltr;
}

html[dir="rtl"] .mode-utility-panel {
  right: auto;
  left: 16px;
}

html[dir="rtl"] .utility-nav-panel {
  right: auto;
  left: 0;
}

html[dir="rtl"] .utility-robot-panel {
  right: auto;
  left: 236px;
}

html[dir="rtl"] .mode-utility-nav .nav-btn {
  justify-content: flex-end;
  text-align: right;
  flex-direction: row-reverse;
}

.utility-panel-top {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.mode-utility-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
}

.mode-utility-nav .nav-btn {
  width: 100%;
  min-height: 50px;
  justify-content: flex-start;
  text-align: left;
  white-space: normal;
  line-height: 1.35;
  gap: 10px;
  border-radius: 16px;
}

.mode-utility-nav .nav-btn::before {
  content: "";
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.24);
  flex-shrink: 0;
}

.mode-utility-nav .nav-btn[data-mode="home"]::before {
  content: "H";
}

.mode-utility-nav .nav-btn[data-mode="remote"]::before {
  content: "R";
}

.mode-utility-nav .nav-btn[data-mode="vision"]::before {
  content: "V";
}

.utility-controls {
  width: 100%;
  margin-left: 0;
  justify-content: flex-start;
  flex-wrap: wrap;
  align-items: stretch;
}

.utility-panel-top .utility-controls {
  width: 100%;
}

.utility-status {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.45;
  flex-shrink: 0;
}

.utility-profile-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.utility-field {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.utility-field-compact {
  font-size: 0.62rem;
}

.utility-select,
.utility-input {
  width: 100%;
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: "Cairo", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 9px;
}

.utility-select:focus,
.utility-input:focus {
  outline: none;
  border-color: rgba(255, 143, 118, 0.72);
  box-shadow: 0 0 0 2px rgba(255, 123, 95, 0.24);
}

.utility-input[readonly] {
  opacity: 0.86;
  cursor: not-allowed;
}

.utility-select option {
  background: #232228;
  color: #fff;
}

.utility-transport-grid {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.utility-transport-card {
  display: grid;
  gap: 7px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
}

.utility-transport-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.utility-transport-actions .shared-btn {
  flex: 1 1 auto;
  min-height: 36px;
  padding: 8px 10px;
  font-size: 0.7rem;
}

.utility-transport-title {
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.86);
}

.utility-inline-field {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
}

.utility-controls-compact {
  gap: 6px;
}

.utility-controls-compact .shared-btn {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 0.7rem;
}

.utility-status-compact {
  font-size: 0.68rem;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.utility-transport-foot {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.utility-transport-note {
  font-size: 0.69rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.67);
  max-width: 56ch;
}

.utility-rx-status {
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.69rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.tx-rx-floating {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  pointer-events: none;
}

.tx-rx-floating-item {
  pointer-events: auto;
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(25, 25, 29, 0.78);
  backdrop-filter: blur(10px);
  font-family: "Cairo", sans-serif;
  font-size: 0.69rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
  white-space: nowrap;
  max-width: min(360px, calc(100vw - 32px));
  overflow: hidden;
  text-overflow: ellipsis;
}

html[dir="rtl"] .tx-rx-floating {
  right: auto;
  left: 16px;
  align-items: flex-start;
}

.utility-connection-summary {
  width: 100%;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 8px 10px;
  line-height: 1.45;
}

.utility-feedback {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 8px 10px;
  line-height: 1.45;
}

.utility-feedback.ok {
  border-color: rgba(76, 175, 80, 0.45);
  background: rgba(76, 175, 80, 0.15);
  color: var(--ok);
}

.utility-feedback.warn {
  border-color: rgba(255, 179, 71, 0.45);
  background: rgba(255, 179, 71, 0.15);
  color: var(--warn);
}

.utility-feedback.error {
  border-color: rgba(255, 95, 109, 0.45);
  background: rgba(255, 95, 109, 0.15);
  color: var(--danger);
}

.utility-feedback.pending {
  border-color: rgba(255, 179, 71, 0.45);
  background: rgba(255, 179, 71, 0.15);
  color: var(--warn);
}

.utility-dev-tools {
  width: 100%;
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.utility-dev-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.utility-dev-toggle {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 8px 12px;
  cursor: pointer;
}

.utility-dev-toggle:hover {
  background: rgba(255, 95, 77, 0.18);
  border-color: rgba(255, 95, 77, 0.42);
}

.utility-dev-panel {
  display: grid;
  gap: 8px;
}

.utility-dev-note {
  font-size: 0.7rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.7);
}

.utility-command-list,
.utility-command-log {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  min-height: 44px;
}

.utility-command-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.72rem;
  font-weight: 700;
}

.utility-command-chip.muted {
  color: rgba(255, 255, 255, 0.65);
}

.stage {
  position: relative;
  min-height: 0;
  height: 100%;
}

.home-screen,
.mode-screen {
  position: absolute;
  inset: 0;
  transition: opacity 0.28s ease;
}

.home-screen {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: clamp(12px, 3vw, 20px);
  overflow: auto;
}

.home-lang-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 4px 2px;
}

.home-lang-bar .lang-toggle {
  font-size: 0.72rem;
}

body.mode-view .home-lang-bar {
  display: none;
}

.mode-screen {
  display: none;
  overflow: hidden;
}

body.home-view .home-screen {
  display: grid;
  opacity: 1;
}

body.home-view .mode-screen {
  display: none;
  opacity: 0;
}

body.mode-view .home-screen {
  display: none;
  opacity: 0;
}

body.mode-view .mode-screen {
  display: block;
  opacity: 1;
}

.home-hero {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.03) 100%);
  padding: 22px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
}

.hero-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.hero-logo img {
  width: clamp(312px, 50.6vw, 473px);
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 7px 16px rgba(0, 0, 0, 0.34));
}

.home-hero h1 {
  font-family: "Changa", sans-serif;
  font-size: clamp(1.2rem, 2.4vw, 1.9rem);
}

.home-hero p {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.home-actions {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin-top: 10px;
}

.home-install-btn {
  border: none;
  border-radius: 14px;
  padding: 11px 18px;
  font-family: "Cairo", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand-dark) 100%);
  box-shadow: 0 8px 18px rgba(255, 95, 77, 0.32);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.home-install-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(255, 95, 77, 0.38);
}

.home-install-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.home-install-note {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.6);
}

.home-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 14px;
  max-width: 980px;
  margin-inline: auto;
  width: 100%;
}

.home-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.028) 100%);
  padding: 14px;
  display: grid;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.home-card::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  right: -60px;
  top: -70px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 124, 94, 0.25) 0%, rgba(255, 124, 94, 0) 74%);
  pointer-events: none;
}

.home-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.home-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(150deg, rgba(255, 116, 98, 0.75) 0%, rgba(242, 79, 63, 0.7) 100%);
  box-shadow: 0 10px 20px rgba(242, 104, 86, 0.32);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  color: #fff;
}

.home-card[data-mode="remote"] .home-card-icon::before {
  content: "R";
}

.home-card[data-mode="vision"] .home-card-icon::before {
  content: "V";
}

.home-card-tag {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.home-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 122, 106, 0.58);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.home-card h2 {
  font-size: 1rem;
  font-weight: 800;
}

.home-card p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.home-card button {
  border: none;
  border-radius: 14px;
  padding: 11px 12px;
  font-family: "Cairo", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand-dark) 100%);
  box-shadow: 0 8px 18px rgba(255, 95, 77, 0.32);
  pointer-events: none;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.mode-loading {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(10, 10, 10, 0.5);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.9rem;
  font-weight: 800;
  z-index: 2;
}

.mode-loading.active {
  display: grid;
}

#mode-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #0f0f0f;
  display: block;
  transform-origin: top left;
}

.mode-screen {
  overflow: hidden;
}

@media (max-width: 1120px) {
  .topbar-main {
    flex-wrap: nowrap;
  }

  .topbar-nav {
    margin-left: 0;
  }

  .shared-controls {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .status-indicator {
    min-width: 190px;
  }

  .mode-utility-panel {
    width: min(700px, calc(100vw - 32px));
  }

  .utility-nav-panel {
    width: 200px;
  }

  .utility-robot-panel {
    right: 216px;
    width: min(484px, calc(100% - 216px));
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .nav-btn {
    min-height: 38px;
    padding: 0 12px;
    font-size: 0.71rem;
  }

  .home-cards {
    grid-template-columns: 1fr 1fr;
  }

  .mode-utility-panel {
    width: min(620px, calc(100vw - 16px));
    min-height: 0;
    display: grid;
    gap: 10px;
    pointer-events: auto;
  }

  .utility-panel-section {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
  }

  .utility-panel-top,
  .utility-controls,
  .mode-utility-nav {
    flex-wrap: wrap;
  }

  .utility-profile-grid,
  .utility-transport-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 680px) {
  .topbar {
    top: 6px;
    margin: 0 8px;
    padding: 10px;
    border-radius: 14px;
  }

  .mode-nav-wrap {
    margin: 14px 8px 6px;
  }

  .nav-group {
    gap: 6px;
  }

  .topbar-main {
    min-height: 48px;
    flex-wrap: nowrap;
  }

  .brand-left img {
    height: 65px;
  }

  .utility-toggle {
    font-size: 0.72rem;
    padding: 8px 10px;
  }

  .lang-toggle {
    font-size: 0.68rem;
    padding: 5px 11px;
  }

  .topbar-main-actions {
    gap: 8px;
  }

  .shared-controls {
    gap: 6px;
  }

  .mode-utility-panel {
    right: 10px;
    width: min(calc(100vw - 16px), 100%);
    padding: 12px;
    min-height: 0;
    gap: 8px;
  }

  html[dir="rtl"] .mode-utility-panel {
    right: auto;
    left: 10px;
  }

  .utility-panel-top {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .utility-controls,
  .mode-utility-nav {
    width: 100%;
  }

  .utility-panel-top .utility-controls {
    width: 100%;
  }

  .utility-status {
    width: 100%;
    min-width: 0;
  }

  .utility-transport-note {
    max-width: 100%;
  }

  .utility-rx-status {
    width: 100%;
    text-align: center;
  }

  .shared-btn {
    font-size: 0.72rem;
    padding: 8px 10px;
  }

  .status-indicator {
    width: 100%;
    min-width: 0;
  }

  .home-cards {
    grid-template-columns: 1fr;
  }
}
