/* Loaded after styles.css. Visibility and interaction state remain owned by the app. */
:root {
  color-scheme: dark;
  --bg-page: #0c1017;
  --bg-card: #141b26;
  --bg-card-hover: #1a2432;
  --bg-card-muted: #192332;
  --bg-input: #101620;
  --border-light: #253142;
  --border-focus: #80b5ff;
  --text-main: #ecf2fa;
  --text-muted: #98a9bf;
  --text-dim: #7e90a8;
  --primary: #3f83f8;
  --primary-hover: #3575e6;
  --success: #69d7b0;
  --warning: #e9bc73;
  --danger: #f87171;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --app-nav-width: 220px;
}

.app-layout {
  min-width: 0;
}

.app-layout :is(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
}

/* The global nav scrolls independently; its bottom notification popover is not clipped. */
.navbar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 900;
  width: var(--app-nav-width);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 26px 14px 18px;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 20px;
  background: #101620;
  border: 0;
  border-right: 1px solid var(--border-light);
}

.nav-left {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-height: 0;
  overflow-y: auto;
}

.navbar .brand-link {
  flex: 0 0 auto;
  padding: 0 10px;
  min-height: 38px;
}

.navbar .brand-logo-img {
  width: 32px;
  height: 32px;
}

.navbar .brand-name {
  font-size: var(--t-sec);
  font-weight: 650;
  letter-spacing: -.6px;
}

.workspace-label {
  margin: 26px 0 18px;
  padding: 11px 12px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  color: #cad6e6;
  font-size: var(--t-cap);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.workspace-label small {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: var(--t-cap);
  font-weight: 400;
}

.nav-links {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: visible;
}

.nav-group-label {
  margin: 18px 11px 6px;
  color: var(--text-dim);
  font-size: var(--t-cap);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.3px;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #a9b7ca;
  font: inherit;
  text-align: left;
  font-size: var(--t-cap);
  font-weight: 500;
  line-height: 1.4;
  white-space: normal;
}

.nav-link > svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.nav-link:hover {
  background: #192331;
  color: var(--text-main);
}

.nav-link.active {
  background: #1a2c46;
  color: #94c2ff;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 3px;
  background: var(--primary);
}

.nav-right {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.nav-right #btn-open-pair {
  width: auto;
  height: auto;
  min-height: 36px;
  padding: 8px 10px;
  font-size: var(--t-cap);
  white-space: nowrap;
}

.nav-right #btn-open-pair::before {
  content: none;
}

.nav-right .account-btn {
  flex: 0 0 32px;
}

.avatar-letter {
  background: #243950;
  color: #b4d5ff;
}

.navbar .notif-panel {
  top: auto;
  right: auto;
  bottom: 0;
  left: calc(var(--app-nav-width) - 2px);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}

.notif-head {
  gap: 10px;
}

.app-topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 34px;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-light);
}

.app-layout > .app-topbar,
.app-layout > .boost-banner,
body > .demo-banner,
body > .verify-banner,
body > .trial-banner {
  margin-left: var(--app-nav-width);
}

.workspace-title {
  color: #cad6e6;
  font-size: var(--t-cap);
  font-weight: 500;
}

.topbar-note {
  color: var(--text-muted);
  font-size: var(--t-cap);
}

.main-content {
  width: calc(100% - var(--app-nav-width));
  max-width: none;
  min-width: 0;
  margin: 0 0 0 var(--app-nav-width);
  padding: 34px;
}

.page-pane,
.studio-content,
.device-tab-pane {
  min-width: 0;
}

.page-header {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 26px;
}

.page-header h2 {
  font-size: var(--t-title);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -.8px;
}

.page-header p {
  margin-top: 7px;
  line-height: 1.6;
}

.header-actions {
  flex-wrap: wrap;
  max-width: 100%;
}

.search-input {
  min-height: 38px;
  max-width: 100%;
  background: var(--bg-input);
}

.btn {
  border-radius: 8px;
  line-height: 1.25;
}

.btn-secondary {
  background: var(--bg-card-muted);
  border-color: var(--border-light);
  color: #d2deee;
}

.btn-secondary:hover {
  background: #223149;
  border-color: #3c526e;
}

.btn-ghost {
  color: var(--text-muted);
}

.app-layout .btn-sm {
  min-height: 34px;
}

.info-card {
  border-radius: 12px;
  border-color: var(--border-light);
}

/* Both the legacy card classes and the new semantic wrappers use the same layout. */
.device-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 20px;
}

.device-card {
  min-width: 0;
  gap: 16px;
  padding: 18px;
  border-radius: 16px;
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color .15s ease, background-color .15s ease;
}

.device-card:hover {
  transform: none;
  border-color: #466384;
  background: #17202c;
}

.device-card-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 174px;
  margin: -18px -18px 0;
  padding: 24px;
  color: #8fa3bc;
  background: linear-gradient(145deg, #1c2a39, #14202e);
  border-bottom: 1px solid var(--border-light);
}

.device-card-visual > svg {
  width: 54px;
  height: 76px;
  flex: 0 0 auto;
}

.device-watch-open {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #536b87;
  border-radius: 8px;
  background: #152234;
  color: #dceaff;
  font: inherit;
  font-size: var(--t-cap);
  cursor: pointer;
}

.device-watch-open:hover {
  background: #21374f;
}

.device-watch-open svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.device-card-visual:has(.device-watch-open) {
  padding-bottom: 56px;
}

.device-visual-caption {
  color: #a0b1c6;
  font-size: var(--t-cap);
  letter-spacing: .7px;
  text-align: center;
}

.device-card :is(.card-top, .device-card-header) {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.device-card :is(.card-top, .device-card-header) > div {
  min-width: 0;
}

.device-card .device-name {
  overflow-wrap: anywhere;
  margin-bottom: 4px;
}

.device-card :is(.stats-summary-row, .device-card-body) {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  background: transparent;
  padding: 0;
}

.device-card :is(.stat-item, .device-stat) {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: var(--t-cap);
}

.device-card .stat-label {
  color: var(--text-muted);
  font-size: var(--t-cap);
}

.device-card .stat-val {
  color: #d2deee;
  font-size: var(--t-cap);
  font-weight: 500;
}

.device-card :is(.card-actions, .device-card-footer) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

.badge-status {
  flex-shrink: 0;
  border-radius: 5px;
  font-size: var(--t-cap);
}

.badge-online {
  background: #16352d;
  color: var(--success);
}

.badge-offline {
  background: #26303e;
  color: #a8b5c6;
}

.badge-unstable {
  background: #342b20;
  color: var(--warning);
}

.plan-hint {
  padding: 12px 16px;
  margin-bottom: 22px;
  border-radius: 10px;
}

.fh-state.plan-standard {
  color: var(--plan-standard);
  background: var(--plan-standard-bg);
}

.fh-state.plan-pro,
.fh-state.pro {
  color: var(--plan-pro);
  background: var(--plan-pro-bg);
}

.fleet-notifications {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  padding: 22px 24px;
  margin-bottom: 24px;
  background: #142236;
  border: 1px solid #2c405c;
  border-radius: 14px;
}

.fleet-notifications > div {
  flex: 1 1 240px;
  min-width: 0;
}

.fleet-notifications h3,
.fleet-notifications > div > strong {
  display: block;
  font-size: var(--t-strong);
  font-weight: 600;
  letter-spacing: -.2px;
}

.fleet-notifications p,
.fleet-notifications > div > span {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: var(--t-cap);
  line-height: 1.6;
}

.fleet-notifications > svg {
  flex: 0 0 24px;
  color: #94c2ff;
}

#btn-fleet-notifications {
  flex: 0 0 auto;
}

.empty-state {
  grid-column: 1 / -1;
  border-radius: 16px;
}

.qr-container {
  position: relative;
  width: 248px;
  max-width: 100%;
  padding: 16px;
  background: #fff;
}

#qr-canvas {
  position: relative;
  width: 216px;
  max-width: 100%;
  margin: 0 auto;
  line-height: 0;
}

#qr-canvas > canvas,
#qr-canvas > img {
  width: 216px;
  height: auto;
  max-width: 100%;
}

/* Center on the generated code, not its outer quiet-zone padding. */
.pairing-qr-logo {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 36px;
  height: 36px;
  padding: 4px;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 4px;
  object-fit: contain;
  pointer-events: none;
}

.pairing-qr-logo[hidden] {
  display: none;
}

.pairing-qr-logo img {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.detail-header {
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
}

.device-detail-title-row {
  min-width: 0;
  flex-wrap: wrap;
}

#detail-device-name {
  overflow-wrap: anywhere;
  letter-spacing: -.5px;
}

/* A quieter, narrower device nav keeps the two navigation levels distinct. */
.studio-layout {
  gap: 24px;
}

.studio-sidebar {
  width: 192px;
  min-width: 192px;
  padding: 0 16px 0 0;
  gap: 22px;
  border: 0;
  border-right: 1px solid var(--border-light);
  border-radius: 0;
  background: transparent;
  overflow: visible;
  -webkit-mask-image: none;
  mask-image: none;
}

.studio-nav-section {
  min-width: 0;
  gap: 5px;
}

.studio-nav-header {
  display: block;
  margin-bottom: 5px;
  padding: 4px 8px;
  font-size: var(--t-cap);
  line-height: 1.5;
  letter-spacing: .8px;
  color: var(--text-dim);
}

.studio-sidebar .device-tab {
  min-height: 42px;
  padding: 9px 8px;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--t-cap);
  font-weight: 500;
  white-space: normal;
}

.studio-sidebar .device-tab > svg {
  flex-shrink: 0;
}

.studio-sidebar .device-tab.active {
  color: #94c2ff;
  border-color: #304865;
  background: #1a2c46;
  font-weight: 600;
}

.studio-tab-hint {
  font-size: var(--t-cap);
  letter-spacing: .2px;
}

/* Keep the existing disclosure, upload, progress and pagination behaviour intact. */
.files-card {
  padding: 22px;
}

.files-head {
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-light);
}

.files-head-title,
.files-head-actions {
  flex-wrap: wrap;
}

.files-title {
  font-size: var(--t-body);
  font-weight: 600;
}

.files-actions {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  align-items: start;
  gap: 20px;
  margin-top: 20px;
}

.files-panel {
  min-width: 0;
  gap: 12px;
}

.files-panel h4 {
  font-size: var(--t-cap);
  font-weight: 500;
  letter-spacing: .3px;
  text-transform: none;
}

.files-panel .file-picker-card {
  border: 1px dashed #3d526d;
  border-radius: 10px;
  background: var(--bg-input);
  padding: 14px;
}

.files-panel .file-picker-main {
  flex-wrap: wrap;
}

.files-panel .file-picker-info {
  min-width: 0;
  flex: 1 1 120px;
}

.files-download {
  flex-wrap: wrap;
}

.files-download input {
  flex-basis: 150px;
}

.files-sandbox {
  padding: 12px 14px;
  border-radius: 10px;
  line-height: 1.6;
}

.files-sandbox code {
  min-width: 0;
  overflow-wrap: anywhere;
}

#sandbox-files-container {
  max-width: 100%;
  overflow-x: auto;
}

.file-table th,
.file-table td {
  border-color: var(--border-light);
}

.file-table th {
  color: var(--text-muted);
  font-weight: 500;
}

.file-table tbody tr:hover {
  background: rgba(128, 181, 255, .035);
}

.fh-steps {
  gap: 20px;
}

.fh-card {
  min-width: 0;
  padding: 24px;
}

.fh-card h3 {
  font-weight: 600;
  margin-bottom: 8px;
}

.fh-card h3 .n {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 8px;
  background: #1a2c46;
  color: #94c2ff;
}

.fh-card > p {
  margin-bottom: 20px;
}

.fh-dest {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
  gap: 14px;
  align-items: start;
}

.fh-dest-card {
  min-width: 0;
  background: var(--bg-input);
  border-radius: 12px;
}

.fh-dest-card.open {
  border-color: #3c526e;
}

.fh-dest-head {
  height: auto;
  min-height: 88px;
  gap: 10px;
  padding: 16px;
  flex-wrap: wrap;
  overflow: visible;
}

.fh-dest-head > div:not(.fh-dest-ic) {
  flex-basis: 120px;
}

.fh-dest-head small {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  margin-top: 4px;
  line-height: 1.5;
}

.fh-dest-body {
  padding: 4px 16px 18px;
}

.fh-field {
  min-width: 0;
  margin-top: 14px;
}

.fh-help {
  overflow-wrap: anywhere;
  line-height: 1.7;
}

.fh-choice {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

.fh-toggle {
  padding: 16px 0;
}

.fh-device-row > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.demo-banner,
.verify-banner,
.trial-banner {
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 20px;
  font-size: var(--t-cap);
  line-height: 1.6;
}

.demo-banner {
  position: relative;
  background: #24213b;
  color: #dfd7ff;
  border-bottom: 1px solid #4b426d;
}

.verify-banner {
  background: #30291d;
  color: #f5d69f;
  border-bottom: 1px solid #5d4c2e;
}

.verify-banner input {
  min-width: 0;
  max-width: 100%;
  border-color: #6e5937;
  background: var(--bg-input);
  color: var(--text-main);
}

.verify-banner input:focus {
  outline-color: var(--border-focus);
}

.verify-banner button {
  background: #f5d69f;
  color: #30291d;
}

/* At intermediate widths the device tools wrap, rather than squeezing the workspace. */
@media (max-width: 1199px) {
  .main-content {
    padding: 26px;
  }

  .studio-layout {
    flex-direction: column;
  }

  .studio-sidebar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    gap: 14px;
    padding: 0 0 18px;
    border: 0;
    border-bottom: 1px solid var(--border-light);
  }

  .studio-nav-section {
    display: flex;
    flex-direction: column;
    flex: initial;
  }

  .studio-sidebar .device-tab {
    width: 100%;
  }

  .studio-tab-hint {
    display: inline;
  }

  .studio-content {
    width: 100%;
  }
}

/* The same links and controls remain present on tablet and phone. */
@media (max-width: 1023px) {
  .navbar {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    min-height: 60px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'brand actions' 'workspace workspace' 'links links';
    gap: 10px 12px;
    padding: 14px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--border-light);
  }

  .nav-left {
    display: contents;
  }

  .navbar .brand-link {
    grid-area: brand;
    min-width: 0;
    padding: 0;
  }

  .workspace-label {
    grid-area: workspace;
    margin: 0;
    padding: 0;
    border: 0;
    color: var(--text-muted);
    font-size: var(--t-cap);
  }

  .workspace-label small {
    display: inline;
    margin-left: 8px;
  }

  .nav-right {
    grid-area: actions;
    justify-content: flex-end;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .nav-links {
    grid-area: links;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    overflow: visible;
  }

  .nav-group-label {
    flex-basis: 100%;
    margin: 8px 8px 2px;
  }

  .nav-link {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 9px 10px;
    gap: 7px;
    font-size: var(--t-cap);
  }

  .navbar .notif-panel {
    position: fixed;
    inset: 64px 12px auto auto;
    width: 360px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 76px);
    max-height: calc(100dvh - 76px);
  }

  .app-layout > .app-topbar,
  .app-layout > .boost-banner,
  body > .demo-banner,
  body > .verify-banner,
  body > .trial-banner {
    margin-left: 0;
  }

  .app-topbar {
    min-height: 58px;
    padding: 16px 24px;
  }

  .main-content {
    width: 100%;
    margin: 0;
    padding: 26px 24px;
  }
}

@media (max-width: 600px) {
  .navbar {
    padding: 12px 14px;
    gap: 8px;
  }

  .navbar .brand-name {
    font-size: var(--t-sec);
  }

  .navbar .brand-logo-img {
    width: 26px;
    height: 26px;
  }

  .nav-right {
    gap: 7px;
  }

  .nav-right #btn-open-pair {
    width: auto;
    height: auto;
    padding: 8px;
    font-size: var(--t-cap);
  }

  .nav-right #btn-open-pair::before {
    content: none;
  }

  .nav-link {
    font-size: var(--t-cap);
    padding: 8px;
  }

  .nav-link > svg {
    width: 15px;
    height: 15px;
    flex-basis: 15px;
  }

  .app-topbar {
    padding: 14px 16px;
    gap: 6px 12px;
  }

  .main-content {
    padding: 24px 16px 32px;
  }

  .page-header {
    gap: 16px;
    margin-bottom: 22px;
  }

  .page-header h2 {
    font-size: var(--t-title);
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .search-input {
    flex: 1 1 180px;
    width: auto;
    min-width: 0;
  }

  .device-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .studio-sidebar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    overflow: visible;
  }

  .studio-nav-section {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px;
  }

  .studio-nav-header {
    display: block;
    flex: 0 0 100%;
    margin: 0;
  }

  .studio-sidebar .device-tab {
    flex: 1 1 140px;
    width: auto;
    min-width: 0;
    min-height: 42px;
    padding: 9px 8px;
  }

  .studio-tab-hint {
    display: inline;
  }

  .files-card,
  .fh-card {
    padding: 16px;
  }

  .files-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .files-head-actions {
    width: 100%;
    justify-content: space-between;
  }

  .fh-dest {
    grid-template-columns: minmax(0, 1fr);
  }

  .fh-dest-head {
    padding: 14px;
  }

  .fh-device-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px 0;
  }

  .demo-banner,
  .verify-banner,
  .trial-banner {
    padding: 12px 16px;
  }

  .boost-banner-inner {
    padding: 12px 16px;
  }
}

.mobile-main-nav,
#mobile-nav-dismiss {
  display: none;
}

/* More exposes the full existing navigation; the bottom bar is only a shortcut. */
@media (max-width: 820px) {
  .navbar {
    grid-template-areas: 'brand actions';
    min-height: 62px;
    padding: 12px 16px;
  }

  .navbar .workspace-label {
    display: none;
  }

  .navbar .nav-links {
    display: none;
    position: fixed;
    z-index: 901;
    inset: auto 12px calc(76px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: calc(100vh - 108px - env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 108px - env(safe-area-inset-bottom, 0px));
    padding: 14px;
    margin: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid #35475e;
    border-radius: 16px;
    background: #141d2b;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .3);
  }

  body.mobile-nav-open .navbar .nav-links {
    display: grid;
  }

  .navbar .nav-group-label {
    grid-column: 1 / -1;
    margin: 8px 10px 4px;
  }

  .navbar .nav-link {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 10px;
    font-size: var(--t-cap);
    white-space: normal;
  }

  .navbar .nav-link > svg {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
  }

  body.mobile-nav-open #mobile-nav-dismiss:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 880;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(4, 8, 14, .62);
    cursor: pointer;
  }

  .mobile-main-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 910;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    min-height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px));
    gap: 4px;
    border-top: 1px solid #2c3a4e;
    background: #101823;
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    min-height: 51px;
    padding: 7px 4px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: var(--t-cap);
    line-height: 1.2;
    font-weight: 500;
    cursor: pointer;
  }

  .mobile-nav-item svg {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
  }

  .mobile-nav-item:hover,
  .mobile-nav-item.active,
  .mobile-nav-item[aria-current="page"],
  #btn-mobile-more[aria-expanded="true"] {
    background: #1a2c46;
    color: #94c2ff;
  }

  .mobile-nav-item:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: -2px;
  }

  .app-topbar {
    min-height: 42px;
    padding: 10px 16px;
    gap: 5px 12px;
  }

  .app-topbar .topbar-note {
    font-size: var(--t-cap);
  }

  .main-content {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }

  .toast-container {
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }

  /* Every device tool stays in the same keyboard- and touch-scrollable strip. */
  .studio-sidebar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    gap: 6px;
    padding: 4px 2px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scroll-padding-inline: 4px;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .studio-sidebar::-webkit-scrollbar {
    display: block;
    height: 4px;
  }

  .studio-nav-section {
    display: contents;
  }

  .studio-nav-header {
    display: none;
  }

  .studio-sidebar .device-tab {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    width: auto;
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
    white-space: nowrap;
  }
}

/* Chatwoot injects its own high-priority positioning after the app styles. */
@media (max-width: 820px) {
  #cw-bubble-holder:not(.woot--hide),
  .woot--bubble-holder:not(.woot--hide) {
    position: relative;
    z-index: 860 !important;
  }

  .woot-widget-bubble:not(.woot--hide) {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 860 !important;
  }

  #cw-widget-holder:not(.woot--hide),
  .woot-widget-holder:not(.woot--hide) {
    z-index: 860 !important;
  }

  /* Reserve the launcher/close button below the open conversation. */
  .woot-widget-holder:not(.woot--hide) {
    top: auto !important;
    bottom: calc(160px + env(safe-area-inset-bottom, 0px)) !important;
    right: 12px !important;
    left: auto !important;
    width: min(400px, calc(100vw - 24px)) !important;
    height: calc(100vh - 184px - env(safe-area-inset-bottom, 0px)) !important;
    height: calc(100dvh - 184px - env(safe-area-inset-bottom, 0px)) !important;
    max-height: 640px !important;
    min-height: 0 !important;
  }

  .woot-widget-holder.has-unread-view:not(.woot--hide) {
    height: auto !important;
    max-height: calc(100vh - 184px - env(safe-area-inset-bottom, 0px)) !important;
    max-height: calc(100dvh - 184px - env(safe-area-inset-bottom, 0px)) !important;
  }

  .woot-widget-holder iframe {
    max-width: 100% !important;
    max-height: 100% !important;
  }
}

/* On phones Chatwoot provides its close control inside the conversation iframe. */
@media (max-width: 667px) {
  .woot-widget-holder:not(.woot--hide):not(.has-unread-view) {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
    height: calc(100vh - 108px - env(safe-area-inset-bottom, 0px)) !important;
    height: calc(100dvh - 108px - env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-link,
  .device-card,
  .studio-sidebar .device-tab {
    transition: none;
  }
}

/* Live ticker preview: the handset itself, at real 9:19.5 proportions. A phone-shaped frame that is
   not phone-shaped teaches the wrong thing, so the body is sized from a single height variable and
   turns with the Orientation control. */
.led-phone-stage { display: flex; justify-content: center; align-items: center; padding: 20px 0 10px;
  margin: 14px 0; border-radius: var(--radius-md, 12px);
  background: radial-gradient(120% 120% at 50% 0%, #16202e, #0b1017); }
.led-phone { --phone-h: 430px; position: relative; display: flex; flex-direction: column; align-items: center;
  width: calc(var(--phone-h) * 9 / 19.5); height: var(--phone-h);
  border-radius: 34px; background: linear-gradient(155deg, #3c424b, #23272d 40%, #14171b);
  border: 1px solid #4d545e; box-shadow: 0 20px 44px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.14);
  padding: 8px; transition: width .28s ease, height .28s ease, border-radius .28s ease; }
.led-phone[data-orientation="landscape"] { width: var(--phone-h); height: calc(var(--phone-h) * 9 / 19.5); border-radius: 30px; }
.led-phone-body { position: relative; flex: 1; width: 100%; display: flex; flex-direction: column;
  border-radius: 27px; background: #050608; overflow: hidden; }
.led-phone[data-orientation="landscape"] .led-phone-body { border-radius: 24px; }
.led-phone-notch { position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 2;
  display: flex; align-items: center; gap: 6px; padding: 7px 12px 8px; border-radius: 0 0 12px 12px; background: #050608; }
.led-phone[data-orientation="landscape"] .led-phone-notch { top: 50%; left: 0; transform: translateY(-50%);
  flex-direction: column; padding: 12px 7px 12px 8px; border-radius: 0 12px 12px 0; }
.led-phone-camera { width: 7px; height: 7px; border-radius: 50%; background: #0b1220;
  box-shadow: inset 0 0 0 1px #38414d, 0 0 6px rgba(80,140,255,.25); }
.led-phone-speaker { width: 34px; height: 4px; border-radius: 3px; background: #0b1220; box-shadow: inset 0 1px 0 #3f4854; }
.led-phone[data-orientation="landscape"] .led-phone-speaker { width: 26px; }
/* The screen fills the body, which is what "exactly how it will look" means. */
.led-phone .led-shop-signboard-screen { flex: 1; height: auto; border: 0; border-radius: 0;
  align-items: center; padding-top: 26px; padding-bottom: 18px; }
.led-phone[data-orientation="landscape"] .led-shop-signboard-screen { padding-top: 0; padding-left: 24px; }
.led-phone-home { position: absolute; bottom: 7px; left: 50%; transform: translateX(-50%);
  width: 62px; height: 4px; border-radius: 3px; background: #4c545f; opacity: .85; }
.led-phone[data-orientation="landscape"] .led-phone-home { bottom: 50%; left: auto; right: 7px;
  transform: translateY(50%); width: 4px; height: 40px; }
.led-phone-btn { position: absolute; background: linear-gradient(180deg, #41474f, #22262b); border-radius: 3px; }
.led-phone-btn-power { right: -2px; top: 22%; width: 3px; height: 46px; }
.led-phone-btn-volume { left: -2px; top: 17%; width: 3px; height: 30px; box-shadow: 0 52px 0 #33383f; }
.led-phone-rotate { position: absolute; top: 12px; right: 12px; z-index: 3; width: 30px; height: 30px;
  display: grid; place-items: center; border-radius: 50%; color: #cfd8e4; cursor: pointer;
  background: rgba(10,14,20,.72); border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(4px); }
.led-phone-rotate:hover { background: rgba(30,40,54,.9); color: #fff; }
.led-phone-caption { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%);
  font-size: var(--t-cap); font-weight: 700; letter-spacing: .14em; color: #7e8792; white-space: nowrap; }
@media (max-width: 640px) {
  .led-phone { --phone-h: min(380px, 64vh); }
  .led-phone-caption { bottom: -20px; font-size: var(--t-cap); }
}

/* Motion rules: the detection zone is drawn on the same handset the signboard preview uses, so the
   frame you drag on is the shape the phone streams. 292x520 is the 9:16 camera ratio, and the
   .led-phone.zone-phone pair outranks the signboard sizing rules above. */
.zone-phone-stage { padding: 22px 0 26px; }
.led-phone.zone-phone { width: 536px; height: 308px; padding: 8px; }
.led-phone.zone-phone[data-orientation="portrait"] { width: 308px; height: 536px; }
.led-phone.zone-phone .led-phone-body { padding: 0; }
.zone-screen { position: relative; flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #000; }
.led-phone.zone-phone #zone-frame { position: absolute; inset: 0; width: 100%; height: 100%;
  max-width: none; margin: 0; background: #000; border: 0; border-radius: 0; box-shadow: none; }
.led-phone.zone-phone #zone-coords-display { position: absolute; bottom: 8px; left: 8px; z-index: 3;
  background: rgba(0,0,0,.85); font-size: var(--t-cap); font-family: 'JetBrains Mono', monospace;
  padding: 3px 8px; border-radius: 4px; color: #93c5fd; border: 1px solid rgba(255,255,255,.12); }
/* Top-left, because the rotate control owns the top-right corner in both orientations. */
.led-phone.zone-phone #zone-frame-badge { position: absolute; top: 8px; left: 8px; right: auto; z-index: 3;
  background: rgba(0,0,0,.75); font-size: var(--t-cap); font-family: 'JetBrains Mono', monospace;
  padding: 2px 7px; border-radius: 3px; color: var(--text-dim); border: 1px solid rgba(255,255,255,.12); }
.led-phone.zone-phone[data-orientation="portrait"] #zone-frame-badge { top: 30px; left: 8px; }
@media (max-width: 640px) {
  .led-phone.zone-phone { width: min(100%, 536px); height: auto; aspect-ratio: 536 / 308; }
  .led-phone.zone-phone[data-orientation="portrait"] { width: min(100%, 308px); height: auto; aspect-ratio: 308 / 536; }
}

/* ---- Help marks and their explanation -------------------------------------------------------
   A help mark has one job: tell the reader it is worth asking. The old one was a 16px circle in
   the muted text colour, which looked like a stray character. It is now outlined, always legible
   and turns blue on its own hover, and the explanation is a real bubble instead of a native title. */
.tooltip-trigger {
  width: 17px;
  height: 17px;
  border: 1px solid rgba(148, 163, 184, .45);
  background: rgba(148, 163, 184, .16);
  color: var(--text-main);
  font-size: var(--t-cap);
  flex: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.tooltip-trigger:hover,
.tooltip-trigger:focus-visible,
.tooltip-trigger.ui-tip-pinned {
  background: rgba(59, 130, 246, .3);
  border-color: var(--primary);
  color: #dbeafe;
  outline: none;
}

.ui-tip {
  position: fixed;
  z-index: 4000;
  max-width: min(320px, calc(100vw - 24px));
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, .35);
  background: #0f172a;
  color: var(--text-main);
  font-size: var(--t-cap);
  line-height: 1.5;
  text-align: left;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .12s ease, transform .12s ease;
  pointer-events: none;
}
.ui-tip[data-placement="above"] { transform: translateY(4px); }
.ui-tip.is-open { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .ui-tip, .tooltip-trigger { transition: none; }
}
