/* ═══════════════════════════════════════════════════════════
   WiFi Management — iOS-inspired grouped list design
   ═══════════════════════════════════════════════════════════ */

/* Container overrides for the wifi-management section */
#wifi-management {
  padding: 0 0 24px;
}

/* ── Status bar ─────────────────────────────────────────── */
.wm-status-bar {
  padding: 10px 16px;
  font-size: 0.88em;
  font-weight: 500;
  border-radius: var(--radius-md, 12px);
  margin: 0 0 20px;
  display: none;               /* shown by JS */
}
.wm-status-bar.connected {
  display: block;
  background: var(--success-light, #d4edda);
  color: var(--success-color, #155724);
  border: 1px solid var(--success-color, #28a745);
}
.wm-status-bar.disconnected {
  display: block;
  background: var(--warning-light, #fff3cd);
  color: #856404;
  border: 1px solid var(--warning-color, #ffc107);
}
.wm-status-bar.error {
  display: block;
  background: var(--error-light, #f8d7da);
  color: var(--error-color, #721c24);
  border: 1px solid var(--error-color, #dc3545);
}

/* ── Section header (uppercase label like iOS) ──────────── */
.wm-section {
  margin-bottom: 24px;
}
.wm-section-header {
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, #8e8e93);
  padding: 0 16px 6px;
}

/* ── Grouped card ───────────────────────────────────────── */
.wm-group {
  background: var(--background-secondary, #fff);
  border-radius: var(--radius-md, 12px);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  border: 1px solid var(--background-tertiary, #e5e5ea);
}

/* ── Scrollable group (e.g. large Other Networks list) ──── */
.wm-group-scroll {
  max-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#step5NearbyNetworks {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

/* ── Row (single network item) ──────────────────────────── */
.wm-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 10px;
  border-bottom: 1px solid var(--background-tertiary, #e5e5ea);
  transition: background .12s;
  min-height: 48px;
}
.wm-row:last-child {
  border-bottom: none;
}
.wm-row-placeholder {
  color: var(--text-muted, #8e8e93);
  font-size: 0.9em;
  justify-content: center;
  padding: 20px 16px;
}

/* Tappable row */
.wm-row.tappable {
  cursor: pointer;
  flex-wrap: wrap;
}
/* Saved rows always wrap so long SSIDs stay fully visible above action buttons. */
.wm-saved-hotspot-row {
  flex-wrap: wrap;
  align-items: flex-start;
}
.wm-saved-hotspot-row .wm-info {
  flex: 1 1 auto;
  min-width: 0;
}
.wm-saved-hotspot-row .wm-name {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.wm-saved-hotspot-row .wm-actions {
  flex: 1 0 100%;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 4px;
}
.wm-saved-hotspot-row.wm-row-active {
  background: #eaf2ff;
  border-bottom-color: transparent;
}
.wm-row.tappable:hover {
  background: var(--background-tertiary, #f2f2f7);
}
.wm-row.tappable:active {
  background: var(--background-tertiary, #e5e5ea);
}
.wm-row.tappable.wm-row-active {
  background: #eaf2ff;
  box-shadow: inset 3px 0 0 var(--primary-color, #007aff);
  border-bottom-color: transparent;
}
.wm-row.tappable.wm-row-active .wm-name {
  font-weight: 600;
}
.wm-row.tappable.wm-row-active .wm-meta {
  color: #6f7892;
}
.wm-row.tappable .wm-chevron {
  transition: transform 0.16s ease, color 0.16s ease;
}
.wm-row.tappable.wm-row-active .wm-chevron {
  transform: rotate(90deg);
  color: var(--primary-color, #007aff);
}

/* ── Checkmark (connected indicator) ────────────────────── */
.wm-check {
  flex-shrink: 0;
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wm-check svg {
  display: block;
}

/* ── Network info text ──────────────────────────────────── */
.wm-info {
  flex: 1;
  min-width: 0;
}
.wm-name {
  font-size: 0.95em;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wm-meta {
  font-size: 0.78em;
  color: var(--text-muted, #8e8e93);
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.wm-hotspot-scan-note {
  justify-content: center;
  margin-top: 8px;
  text-align: center;
}

/* ── Signal & lock icons ────────────────────────────────── */
.wm-signal {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.wm-lock {
  flex-shrink: 0;
  color: var(--primary-color, #0b2182);
  opacity: 0.85;
}

/* ── Slot badge ─────────────────────────────────────────── */
.wm-slot-badge {
  font-size: 0.72em;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--primary-color, #007aff);
  color: #fff;
  white-space: nowrap;
}

/* ── Not in range badge ─────────────────────────────────── */
.wm-badge-muted {
  font-size: 0.72em;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--background-tertiary, #e5e5ea);
  color: var(--text-muted, #8e8e93);
  white-space: nowrap;
}

/* ── Action buttons row ─────────────────────────────────── */
.wm-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wm-btn {
  font-size: 0.82em;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s, transform .1s;
}
.wm-btn:active {
  transform: scale(0.95);
}
.wm-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.wm-btn-connect {
  background: var(--primary-color, #007aff);
  color: #fff;
}
.wm-btn-connect:hover {
  opacity: 0.85;
}
.wm-btn-remove {
  background: transparent;
  color: var(--error-color, #ff3b30);
  border: 1px solid var(--error-color, #ff3b30);
}
.wm-btn-remove:hover {
  background: var(--error-color, #ff3b30);
  color: #fff;
}

/* ── Empty slot row ─────────────────────────────────────── */
.wm-row.wm-empty {
  background: var(--background-tertiary, #f7f8fb);
}
.wm-empty-label {
  color: var(--text-muted, #8e8e93);
  font-size: 0.9em;
  font-weight: 500;
}
.wm-saved-empty-intro {
  align-items: flex-start;
  background: rgba(11, 33, 130, 0.05);
  border-bottom-color: rgba(11, 33, 130, 0.08);
}
.wm-saved-empty-intro .wm-name {
  color: var(--primary-color, #0b2182);
  font-weight: 700;
}
.wm-saved-empty-intro .wm-meta {
  margin-top: 3px;
  line-height: 1.35;
}
.wm-add-hotspot-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--background-tertiary, #e5e5ea);
  background: var(--background-secondary, #fff);
  color: var(--primary-color, #0b2182);
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.wm-add-hotspot-row:hover,
.wm-add-hotspot-row:focus-visible {
  background: #f4f7ff;
  outline: none;
}
.wm-add-hotspot-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 33, 130, 0.1);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.wm-add-hotspot-text {
  font-weight: 700;
}
.wm-continue-hotspot-btn {
  width: 100%;
  margin-top: 14px;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius-md, 12px);
  background: var(--primary-color, #0b2182);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.wm-continue-hotspot-btn:hover,
.wm-continue-hotspot-btn:focus-visible {
  box-shadow: 0 6px 16px rgba(11, 33, 130, 0.22);
  outline: none;
}
.wm-section-attention {
  animation: wmSectionAttention 1.4s ease-out;
}
.wm-section-attention > summary {
  animation: wmSectionSummaryAttention 1.4s ease-out;
}
@keyframes wmSectionAttention {
  0% {
    border-color: rgba(11, 33, 130, 0.3);
    box-shadow: 0 0 0 0 rgba(11, 33, 130, 0);
  }
  22% {
    border-color: rgba(11, 33, 130, 0.75);
    box-shadow: 0 8px 24px rgba(11, 33, 130, 0.18);
  }
  100% {
    border-color: rgba(11, 33, 130, 0.3);
    box-shadow: 0 0 0 0 rgba(11, 33, 130, 0);
  }
}
@keyframes wmSectionSummaryAttention {
  0% {
    background: #fff;
  }
  22% {
    background: #eef4ff;
  }
  100% {
    background: #fff;
  }
}
@media (prefers-reduced-motion: reduce) {
  .wm-section-attention,
  .wm-section-attention > summary {
    animation: none;
  }
  .wm-section-attention > summary {
    background: #eef4ff;
  }
}

/* ── Inline connect form ────────────────────────────────── */
.wm-connect-form {
  background: var(--background-secondary, #fff);
  border: 1px solid var(--primary-color, #007aff);
  border-radius: var(--radius-md, 12px);
  padding: 14px 16px;
  margin: -10px 0 16px;
  box-shadow: 0 4px 16px rgba(0,122,255,.12);
  animation: wmSlideDown .25s ease-out;
}
@keyframes wmSlideDown {
  from { opacity:0; transform: translateY(-8px); }
  to   { opacity:1; transform: translateY(0); }
}

.wm-connect-form .wm-form-title {
  font-weight: 600;
  font-size: 0.92em;
  margin-bottom: 10px;
  color: var(--text-primary);
}
.wm-connect-form .wm-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.wm-connect-form .wm-pwd-wrap {
  flex: 1 1 auto;
  min-width: 180px;
  display: flex;
  border: 1px solid var(--background-tertiary, #e5e5ea);
  border-radius: 8px;
  overflow: hidden;
  background: var(--background-primary, #fff);
}
.wm-connect-form .wm-pwd-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  padding: 8px 10px;
  font-size: 0.9em;
  background: transparent;
  color: var(--text-primary);
}
.wm-connect-form .wm-pwd-toggle {
  background: none;
  border: none;
  border-left: 1px solid var(--background-tertiary, #e5e5ea);
  color: var(--primary-color, #0b2182);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
}
.wm-pwd-toggle-icon {
  width: 18px;
  height: 18px;
  display: block;
}
.wm-connect-form .wm-form-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 0 1 auto;
  justify-content: flex-end;
  min-width: 0;
}
.wm-connect-form .wm-form-actions--single {
  width: 100%;
}
.wm-connect-form .wm-form-actions .wm-btn {
  flex: 1 1 110px;
  min-width: 0;
}
.wm-connect-form .wm-status-line {
  margin-top: 8px;
  font-size: 0.85em;
  padding: 6px 10px;
  border-radius: 6px;
}
.wm-status-spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
  vertical-align: -2px;
}

.wm-inline-form-row {
  flex: 0 0 100%;
  width: 100%;
  background: transparent;
  border: none;
  box-shadow: none;
  margin-top: 6px;
  padding: 0 0 4px 32px;
}
.wm-connect-form.wm-connect-form--inline {
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 0 0 2px;
  animation: none;
}
.wm-connect-form.wm-connect-form--inline .wm-pwd-wrap {
  background: #f3f7ff;
  border-color: #c6d6ff;
}
.wm-connect-form.wm-connect-form--inline .wm-form-title {
  display: none;
}
.wm-connect-form.wm-connect-form--inline .wm-form-actions {
  margin-top: 6px;
}
.wm-connect-form.wm-connect-form--inline .wm-form-actions .wm-btn-connect {
  min-height: 38px;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.wm-open-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(12, 18, 32, 0.48);
}
.wm-open-modal {
  width: min(100%, 420px);
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
  animation: wmSlideDown .18s ease-out;
}
.wm-open-warning {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md, 12px);
  background: #fffaf0;
  border: 2px solid #d98200;
}
.wm-open-warning__title {
  font-size: 1rem;
  font-weight: 800;
  color: #744100;
  margin-bottom: 6px;
}
.wm-open-warning__text {
  margin: 0 0 14px;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.45;
}
.wm-open-warning__type-label {
  display: block;
  margin: 0 0 6px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
}
.wm-open-warning__type-input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1.5px solid #d98200;
  border-radius: 9px;
  background: #ffffff;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.95rem;
}
.wm-open-warning__type-input::placeholder {
  color: rgba(116, 65, 0, 0.45);
}
.wm-open-warning__type-input:focus {
  outline: 3px solid rgba(217, 130, 0, 0.22);
  border-color: #a85800;
}
.wm-open-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.wm-saved-hotspot-row .wm-inline-form-row {
  padding-left: 0;
}

/* ── Scan button ────────────────────────────────────────── */
.wm-scan-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--background-secondary, #fff);
  color: var(--primary-color, #007aff);
  border: 1px solid var(--primary-color, #007aff);
  border-radius: var(--radius-full, 20px);
  padding: 10px 24px;
  font-size: 0.92em;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.wm-scan-btn:hover {
  background: var(--primary-color, #007aff);
  color: #fff;
}
.wm-scan-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Chevron (iOS detail arrow) ─────────────────────────── */
.wm-chevron {
  flex-shrink: 0;
  color: var(--text-muted, #c7c7cc);
  font-size: 0.85em;
}

/* ── Note banner (Step 5 top info) ─────────────────────── */
.wm-note-banner {
  font-size: 0.88em;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: var(--radius-md, 12px);
  border-left: 4px solid var(--info-color, #17a2b8);
  background: var(--info-light, #e8f4fd);
  color: var(--text-primary);
  line-height: 1.45;
}

/* ── Step 7 share section ─────────────────────────────────── */
#step7ShareWifi {
  margin-top: 20px;
}

/* ── LED dot (shared with help page) ──────────────────────── */
.led-dot {
  display: inline-block;
  font-size: 2.2em;
  line-height: 1;
  vertical-align: middle;
  text-shadow:
    0 0 6px currentColor,
    0 0 12px currentColor,
    0 1px #000,
    0 -1px #000;
}
.led-dot--blink {
  animation: led-blink 1s steps(1, end) infinite;
}
.led-dot--pulse {
  animation: led-pulse 2.2s ease-in-out infinite;
}
@keyframes led-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.2; }
}
@keyframes led-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.28; }
}
@media (prefers-reduced-motion: reduce) {
  .led-dot--blink,
  .led-dot--pulse { animation: none; }
}

/* ── Step 6: Check Sensor Lights ──────────────────────────── */
.led-check-expected {
  background: var(--background-secondary, #f5f5f7);
  border-radius: var(--radius-md, 12px);
  padding: 14px 16px;
  margin-top: 14px;
}
.led-check-expected__title {
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted, #8e8e93);
  margin-bottom: 10px;
}
.led-check-expected__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.led-check-expected__row + .led-check-expected__row {
  border-top: 1px solid var(--border-color, #e5e5ea);
}
.led-check-expected__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 0.82em;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
}
.led-check-expected__badge--r {
  background: var(--primary-color, #007aff);
}
.led-check-expected__badge--l {
  background: var(--text-muted, #8e8e93);
}
.led-check-expected__label {
  font-size: 0.9em;
}

/* ── LED info panel (collapsible) ─────────────────────────── */
.led-check-info-panel {
  margin-top: 12px;
}
.led-check-info-panel__summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88em;
  font-weight: 600;
  color: var(--primary-color, #007aff);
  padding: 6px 0;
  user-select: none;
}
.led-check-info-panel__summary::-webkit-details-marker {
  display: none;
}
.led-check-info-panel__summary::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.led-check-info-panel[open] > .led-check-info-panel__summary::after {
  transform: rotate(45deg);
}
.led-check-info-panel__body {
  background: var(--background-secondary, #f5f5f7);
  border-radius: var(--radius-md, 12px);
  padding: 12px 16px;
  margin-top: 8px;
}
.led-check-info-panel__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 0.88em;
}
.led-check-info-panel__item + .led-check-info-panel__item {
  border-top: 1px solid var(--border-color, #e5e5ea);
}

/* ── Share WiFi panel (after validation) ───────────────── */
.wm-share-panel,
.wm-share-panel-wrapper {
  border-radius: var(--radius-md, 12px);
  padding: 12px 14px;
  margin-top: 8px;
  border: 1px solid transparent;
}
.wm-share-panel--success {
  background: var(--success-light, #d4edda);
  border-color: var(--success-color, #28a745);
  color: var(--text-primary);
}
.wm-share-panel--error {
  background: var(--error-light, #f8d7da);
  border-color: var(--error-color, #dc3545);
  color: var(--text-primary);
}
.wm-share-panel--pending {
  background: var(--info-light, #e8f4fd);
  border-color: var(--info-color, #17a2b8);
  color: var(--text-primary);
}
.wm-share-panel-title {
  font-size: 0.92em;
  font-weight: 700;
  margin-bottom: 6px;
}
.wm-share-panel-text {
  font-size: 0.86em;
  line-height: 1.45;
}
.wm-share-panel-actions {
  margin-top: 10px;
  text-align: center;
}

.step7-share-primary-btn {
  width: min(100%, 440px);
  min-height: 48px;
  font-size: 1.02em;
  font-weight: 700;
  justify-content: center;
}

.step7-network-spoiler {
  margin-top: 12px;
  border: 1px solid rgba(11, 33, 130, 0.24);
  border-radius: 10px;
  background: #eaf1ff;
}

.step7-network-spoiler > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  font-size: 0.88em;
  font-weight: 600;
  color: var(--text-primary);
  background: #eaf1ff;
  transition: background 0.15s ease;
}

.step7-network-spoiler > summary::-webkit-details-marker {
  display: none;
}

.step7-network-spoiler > summary::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--primary-color, #007aff);
  border-bottom: 2px solid var(--primary-color, #007aff);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.step7-network-spoiler > summary:hover,
.step7-network-spoiler > summary:focus-visible {
  background: #dfeaff;
  outline: none;
}

.step7-network-spoiler[open] > summary::after {
  transform: rotate(45deg);
}

.step7-network-spoiler .step7-network-list {
  margin: 0;
  border-top: 1px solid var(--border-color, #e5e5ea);
}

.step7-share-note {
  margin-top: 8px;
  padding: 0 2px;
}

/* ── Full-width primary scan button ────────────────────── */
.wm-scan-btn--primary {
  width: 100%;
  justify-content: center;
  background: var(--primary-color, #007aff);
  color: #fff;
  border-color: var(--primary-color, #007aff);
}
.wm-scan-btn--primary:hover {
  opacity: 0.9;
  background: var(--primary-color, #007aff);
  color: #fff;
}

/* ── Hidden section (shown by JS) ──────────────────────── */
.wm-section--hidden {
  display: none;
}

/* ── Saved Networks collapsible ────────────────────────── */
.wm-saved-details {
  margin-bottom: 24px;
}
.wm-saved-details > summary {
  justify-content: flex-start;
}
.wm-saved-summary {
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, #8e8e93);
  padding: 6px 16px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
  border-radius: var(--radius-md, 12px);
  transition: background 0.15s;
}
.wm-saved-summary:hover {
  background: var(--background-tertiary, #f2f2f7);
}
.wm-saved-summary::-webkit-details-marker {
  display: none;
}
.wm-saved-summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  display: inline-block;
  flex-shrink: 0;
}
.wm-saved-details[open] > .wm-saved-summary::after {
  transform: rotate(45deg);
}
.wm-saved-count {
  margin-left: auto;
  font-size: 0.72em;
  font-weight: 600;
  color: var(--text-muted, #8e8e93);
  vertical-align: middle;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .wm-row {
    padding: 10px 12px;
    gap: 8px;
  }
  .wm-actions {
    flex-direction: column;
    gap: 4px;
  }
  .wm-btn {
    font-size: 0.78em;
    padding: 4px 10px;
  }
  .wm-connect-form .wm-form-row {
    flex-direction: column;
  }
  .wm-connect-form .wm-form-actions {
    width: 100%;
    flex: 0 1 auto;
  }
  .wm-connect-form .wm-pwd-wrap {
    width: 100%;
    flex: 0 1 auto;
    min-width: 0;
  }
  .wm-connect-form .wm-form-actions .wm-btn {
    flex: 1;
  }
}

/* ── View Switch (Setup ↔ Advanced) ───────────────────── */
.view-switch-bar {
  position: absolute;
  top: 0;
  right: 4px;
  z-index: 2;
  padding: 4px;
}
.view-switch-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted, #8e8e93);
  text-decoration: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  user-select: none;
  line-height: 1;
}
.view-switch-link:hover {
  color: var(--text-primary);
  background: var(--background-tertiary, #f2f2f7);
}
.view-switch-icon {
  flex-shrink: 0;
  opacity: 0.7;
}
.view-switch-link:hover .view-switch-icon {
  opacity: 1;
}

.sensor-view {
  display: none;
  animation: fadeIn 0.25s ease;
}
.sensor-view.active {
  display: block;
}

/* ── Advanced Configuration ─────────────────────────────── */
#advancedConfigSection {
  margin-top: 20px;
}

.adv-panel {
  margin-top: 12px;
  background: var(--background-secondary, #fff);
  border: 1px solid var(--background-tertiary, #e5e5ea);
  border-radius: var(--radius-md, 12px);
  padding: 14px;
}

.adv-row {
  margin-bottom: 12px;
}

.adv-select {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--background-tertiary, #e5e5ea);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.92em;
  color: var(--text-primary);
  background: var(--background-primary, #fff);
}

.adv-checkbox-row {
  margin-top: 6px;
}

.adv-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9em;
  color: var(--text-primary);
}

.adv-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 14px 0 10px;
}

.wm-btn-secondary {
  background: var(--background-tertiary, #f2f2f7);
  color: var(--text-primary, #1c1c1e);
  border: 1px solid var(--background-tertiary, #e5e5ea);
}
.wm-btn-secondary:hover {
  background: var(--background-tertiary, #e5e5ea);
}

.adv-btn-reload {
  min-width: 130px;
}

.adv-btn-primary {
  flex: 1;
  box-shadow: 0 6px 16px rgba(0, 122, 255, 0.2);
}

.adv-btn-primary:hover {
  box-shadow: 0 8px 18px rgba(0, 122, 255, 0.24);
}

.adv-status {
  margin-top: 4px;
}

.adv-help {
  color: var(--text-muted, #8e8e93);
  line-height: 1.4;
}

/* ── Step 7: Read-only network list ──────────────────────── */
.step7-network-list {
  margin: 12px 0 16px;
}
.step7-network-list .wm-row {
  padding: 10px 16px;
  min-height: 40px;
}
.step7-network-list .wm-name {
  font-size: 0.9em;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ── Step 7: Post-share LED guide ────────────────────────── */
.step7-led-guide {
  background: var(--background-secondary, #f5f5f7);
  border-radius: var(--radius-md, 12px);
  padding: 16px;
  margin-top: 14px;
}
.step7-led-guide__title {
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted, #8e8e93);
  margin-bottom: 12px;
}
.step7-led-guide__row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
}
.step7-led-guide__row + .step7-led-guide__row {
  border-top: 1px solid var(--border-color, #e5e5ea);
}
.step7-led-guide__row--warning {
  background: var(--warning-light, #fff3cd);
  border-radius: var(--radius-md, 12px);
  margin: 0 -12px;
  padding: 10px 12px;
}
.step7-led-guide__row--warning + .step7-led-guide__row {
  border-top: none;
}
.step7-led-guide__row + .step7-led-guide__row--warning {
  border-top: none;
  margin-top: 4px;
}
.step7-led-guide__leds {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 100px;
}
.step7-led-guide__label {
  font-size: 0.88em;
  line-height: 1.4;
  flex: 1;
}
.step7-led-guide__label strong {
  color: var(--text-primary);
}
.step7-led-guide__action {
  font-size: 0.82em;
  color: var(--text-muted, #8e8e93);
  margin-top: 2px;
}
.step7-led-guide__footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color, #e5e5ea);
  font-size: 0.84em;
  color: var(--text-muted, #8e8e93);
  line-height: 1.45;
}
.step7-led-guide__footer a {
  color: var(--primary-color, #007aff);
}

@media (max-width: 480px) {
  .adv-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .adv-btn-reload {
    min-width: 0;
  }

  .step7-led-guide__row {
    flex-direction: column;
    gap: 6px;
  }
  .step7-led-guide__leds {
    min-width: auto;
  }
}

.adv-panel.adv-panel--disconnected {
  opacity: 0.5;
  pointer-events: none;
}
.adv-disconnected-notice {
  text-align: center;
  padding: 12px;
  font-size: 0.9em;
  color: var(--text-muted, #8e8e93);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
   Sensor hotspot manager: outer gate + full-page manager
   ═══════════════════════════════════════════════════════════ */

/* ── Outer gate (outside the sensor) ─────────────────────── */
.sensor-gate {
  padding-top: 34px;
}

.wm-hotspot-missing-help {
  margin: 10px 0 0;
  padding: 10px 2px 2px;
  color: var(--text-secondary);
  font-size: 0.88em;
  line-height: 1.45;
}
.wm-hotspot-missing-help__title {
  margin: 0 0 4px;
  color: var(--text-primary);
  font-weight: 700;
}
.wm-hotspot-missing-help p {
  margin: 0;
}

.wm-credential-limit-help {
  margin: 4px 0 2px;
  padding: 10px 2px 2px;
  color: var(--text-secondary);
  font-size: 0.88em;
  line-height: 1.45;
}
.wm-credential-limit-help__title,
.wm-credential-limit-status .wm-credential-limit-help__title {
  margin: 0 0 4px;
  color: var(--text-primary);
  font-weight: 700;
}
.wm-credential-limit-help p,
.wm-credential-limit-status p {
  margin: 0;
}
.wm-status-line.wm-credential-limit-status {
  padding: 10px 12px;
}

.sensor-flow--animating {
  position: relative;
  overflow: hidden;
}
.sensor-flow--animating > #sensorGate,
.sensor-flow--animating > #sensorManager {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  will-change: transform, opacity;
}
@media (prefers-reduced-motion: reduce) {
  .sensor-flow--animating > #sensorGate,
  .sensor-flow--animating > #sensorManager {
    will-change: auto;
  }
}

.sensor-gate__actions {
  margin-top: 18px;
  margin-bottom: 14px;
}
.sensor-view--complete .sensor-setup-help-link {
  display: none;
}

.sensor-gate__btn {
  width: 100%;
  min-height: 52px;
  font-size: 1.05em;
  font-weight: 700;
  margin: 6px 0 8px;
}
.sensor-gate__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sensor-gate__status {
  text-align: center;
  font-size: 0.9em;
  font-weight: 600;
  color: var(--text-muted, #8e8e93);
  margin: 0 0 12px;
}
.sensor-gate__status--ok {
  color: var(--success-color, #28a745);
}

.unpaired-support-card {
  margin: 0 0 14px;
  padding: 16px;
  background: #fffdf7;
  border: 1px solid rgba(169, 118, 28, 0.35);
  border-left: 4px solid var(--warning-color, #ffc107);
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 8px 20px rgba(27, 37, 54, 0.08);
}
.unpaired-support-card[hidden] {
  display: none !important;
}
.unpaired-support-card__eyebrow {
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8a5a09;
}
.unpaired-support-card h3 {
  margin: 0 0 8px;
  color: var(--text-primary);
}
.unpaired-support-card p {
  margin: 0 0 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.unpaired-support-card__id-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid rgba(11, 33, 130, 0.14);
  border-radius: var(--radius-md, 10px);
}
.unpaired-support-card__id-row span {
  color: var(--text-muted, #8e8e93);
  font-size: 0.85rem;
  font-weight: 600;
}
.unpaired-support-card__id-row strong {
  color: var(--text-primary);
  font-size: 0.92rem;
  text-align: right;
  word-break: break-word;
}
.unpaired-support-card__note {
  font-size: 0.88rem;
}
.unpaired-support-card__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin: 2px 0 10px;
  padding: 10px 16px;
  background: var(--primary-color);
  color: #ffffff;
  border-radius: var(--radius-full, 999px);
  font-weight: 800;
  text-decoration: none;
}
.unpaired-support-card__button:hover {
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(11, 33, 130, 0.22);
}
.unpaired-support-card__button:focus-visible {
  outline: 2px solid rgba(11, 33, 130, 0.28);
  outline-offset: 2px;
}
.unpaired-support-card__small {
  margin-bottom: 0 !important;
  font-size: 0.82rem;
  color: var(--text-muted, #8e8e93) !important;
}

.sensor-gate__help {
  margin-top: 0;
}

/* ── Manager view (inside the sensor) ────────────────────── */
.sensor-manager__bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 10px;
}
.sensor-manager__back {
  background: transparent;
  border: none;
  color: var(--primary-color);
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
}
.sensor-manager__back:hover {
  text-decoration: underline;
}

.sensor-manager__card {
  background: transparent;
  padding: 0;
  border-left: 0;
  border-radius: 0;
  margin-bottom: 0;
}
.hotspot-flow-intro {
  margin: 0 0 16px;
  padding: 0;
  text-align: center;
}
.sensor-manager__title {
  margin: 0;
  color: var(--primary-color, #0b2182);
  font-size: 1.15rem;
  font-weight: 600;
}
.hotspot-flow-step.current-status {
  margin-top: 12px;
  border-left-color: var(--primary-color, #0b2182);
}
.hotspot-flow-step--left.current-status {
  border-left-color: #6d7487;
}
.hotspot-flow-step > summary h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.hotspot-flow-step__hint {
  margin: 0 0 12px;
  color: var(--text-secondary, #666);
  line-height: 1.45;
}

/* ── Confirm & share (gated by "Left sensor is on") ──────── */
.confirm-share {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.confirm-share__instruction {
  margin: 0 0 10px;
  color: var(--text-secondary, #666);
  font-size: 0.9rem;
  line-height: 1.45;
}
.confirm-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95em;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  margin-bottom: 10px;
}
.confirm-check input {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--primary-color, #007aff);
  cursor: pointer;
}
.confirm-share.share-locked #step7ShareWifiBtn {
  opacity: 0.5;
  cursor: not-allowed;
}
.confirm-share.share-needs-confirmation .confirm-check {
  animation: confirmCheckNudge 0.38s ease;
}
.confirm-share.share-needs-confirmation .confirm-check span {
  color: var(--primary-color, #0b2182);
}
.confirm-share.share-needs-confirmation .confirm-check input {
  box-shadow: 0 0 0 4px rgba(11, 33, 130, 0.14);
}
.confirm-share .wm-share-panel-wrapper {
  margin-top: 0;
  padding: 0;
  border: 0;
}
.confirm-share .wm-share-panel {
  margin-top: 0;
}
.confirm-share .wm-share-panel--success {
  padding: 0;
  background: transparent;
  border: 0;
}
.confirm-share .wm-share-panel--pending {
  padding: 10px 12px;
}
.confirm-share .wm-share-panel-title {
  margin: 0 0 8px;
  color: var(--text-secondary, #666);
  font-size: 0.88rem;
  font-weight: 600;
}
.confirm-share .wm-share-panel-actions {
  margin-top: 12px;
}
.confirm-share .step7-network-spoiler {
  margin-top: 2px;
  border: 0;
  background: transparent;
}
.confirm-share .step7-network-spoiler > summary {
  display: list-item;
  list-style: disclosure-closed inside;
  padding: 4px 0;
  color: #1c1c1e;
  background: transparent;
  font-weight: 400;
}
.confirm-share .step7-network-spoiler > summary::-webkit-details-marker {
  display: inline-block;
}
.confirm-share .step7-network-spoiler > summary::after {
  display: none;
}
.confirm-share .step7-network-spoiler > summary:hover,
.confirm-share .step7-network-spoiler > summary:focus-visible {
  background: transparent;
  text-decoration: underline;
}
.confirm-share .step7-network-spoiler[open] > summary {
  list-style-type: disclosure-open;
}
.confirm-share .step7-network-spoiler .step7-network-list {
  margin-top: 8px;
  border: 1px solid var(--border-color, #e5e5ea);
}
.confirm-share .step7-share-note {
  margin-top: 8px;
  color: var(--text-muted, #8e8e93);
  text-align: center;
}

@keyframes confirmCheckNudge {
  0% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

#sensorSetupComplete.current-status {
  border-left: 0;
}

.sensor-complete__bar {
  margin-bottom: 14px;
}

/* ── Sharing transition (before post-share light check) ───── */
.sharing-check {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 24px 16px;
}
.sharing-check__spinner.loading {
  width: 44px;
  height: 44px;
  margin-right: 0;
  border-width: 4px;
}
.sharing-check__title {
  font-size: 1.18em;
  font-weight: 700;
  color: var(--text-primary);
}
.sharing-check__hint {
  max-width: 360px;
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ── Light check (post-share outcome selection) ──────────── */
.light-check__kicker {
  margin-bottom: 4px;
  color: var(--text-muted, #8e8e93);
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.light-check__title {
  font-size: 1.22em;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.light-check__hint {
  color: var(--text-secondary);
  margin: 0 0 14px;
  line-height: 1.45;
}
.light-check__options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.light-check__option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--background-secondary, #fff);
  border: 1px solid var(--background-tertiary, #e5e5ea);
  border-radius: var(--radius-md, 12px);
  padding: 14px 16px;
  font-size: 0.95em;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.light-check__option:hover {
  border-color: var(--primary-color, #007aff);
}
.light-check__option:focus-within {
  border-color: var(--primary-color, #007aff);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.16);
}
.light-check__option--active {
  border-color: var(--primary-color, #007aff);
  background: var(--info-light, #e8f4fd);
  box-shadow: inset 0 0 0 1px var(--primary-color, #007aff);
}
.light-check__radio {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--primary-color, #007aff);
  cursor: pointer;
}
.light-check__leds {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 56px;
}

.light-check__result {
  margin-top: 16px;
  border-radius: var(--radius-md, 12px);
  padding: 14px 16px;
  border: 1px solid transparent;
}
.light-check__result-title {
  font-weight: 700;
  font-size: 0.98em;
  margin-bottom: 6px;
}
.light-check__result--success {
  background: var(--success-light, #d4edda);
  border-color: var(--success-color, #28a745);
}
.light-check__result--warning {
  background: var(--warning-light, #fff3cd);
  border-color: var(--warning-color, #ffc107);
}
.light-check__result--info {
  background: var(--info-light, #e8f4fd);
  border-color: var(--info-color, #17a2b8);
}
.light-check__result a {
  color: var(--primary-color, #007aff);
}
.light-check__footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color, #e5e5ea);
  color: var(--text-muted, #8e8e93);
  line-height: 1.45;
}
