/* ILB Workspace - App window shell (no body scroll) */
[hidden] {
  display: none !important;
}

html:has(.ws-body) {
  height: 100%;
  overflow: hidden;
}

#android-flow-panel[hidden],
#apple-flow-panel[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.ws-body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: #08090c;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 28px 28px;
}

.ws-app {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.ws-sidebar {
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  border-right: 1px solid #1e2128;
  background: linear-gradient(180deg, #0c0d11 0%, #090a0e 100%);
}

.ws-brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 32px;
  padding: 0 8px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.ws-brand-mark {
  color: var(--accent);
  font-size: 1.1rem;
}

.ws-brand-name {
  color: #e8e9ec;
  font-size: 0.95rem;
  font-weight: 600;
}

.ws-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.ws-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: #8b8e96;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.ws-nav-item:hover {
  color: #d5d8de;
  background: #14161c;
}

.ws-nav-item.disabled {
  cursor: not-allowed;
  color: #5f636c;
  background: transparent;
  pointer-events: none;
  user-select: none;
}

.ws-nav-item.disabled:hover {
  color: #5f636c;
  background: transparent;
}

.ws-nav-item small {
  display: block;
  margin-top: 2px;
  color: #747982;
  font-size: 0.68rem;
  font-weight: 600;
}

.ws-nav-item.active {
  color: var(--accent);
  background: linear-gradient(90deg, rgba(242, 138, 46, 0.14), transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.ws-nav-icon {
  width: 18px;
  text-align: center;
  opacity: 0.85;
}

.ws-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid #1e2128;
  border-radius: 14px;
  background: #0e1014;
}

.ws-user-avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a1d12, #1a1510);
  color: var(--accent);
  font-weight: 800;
}

.ws-user strong {
  display: block;
  font-size: 0.88rem;
  color: #eceef2;
}

.ws-user-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6d7179;
  font-size: 0.75rem;
}

.ws-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 8px rgba(85, 214, 139, 0.5);
}

/* Main */
.ws-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.ws-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 16px 28px;
  border-bottom: 1px solid #1a1d24;
}

.ws-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.ws-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ws-icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #2a2d35;
  border-radius: 10px;
  color: #a5a8b0;
  background: #111318;
  cursor: pointer;
}

.ws-icon-btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.ws-panel {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 20px 28px;
}

.ws-step {
  flex: 1;
  min-height: 0;
  max-width: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 24px 28px;
  border: 1px solid #22252d;
  border-radius: 16px;
  background: linear-gradient(160deg, #12141a 0%, #0d0e12 100%);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.ws-step--choose {
  justify-content: center;
}

.ws-step--choose .ws-step-head {
  flex-shrink: 0;
}

.ws-step--choose .ws-platform-grid {
  flex: 1;
  min-height: 0;
  align-content: center;
  max-height: 420px;
}

.ws-step--verify {
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.ws-step.hidden {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.ws-step--choose:not(.hidden) {
  position: relative;
  z-index: 2;
}

.ws-step--choose:not(.hidden) [data-platform-select] {
  pointer-events: auto;
  cursor: pointer;
}

.ws-step--verify.hidden {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.ws-step-head {
  margin-bottom: 28px;
}

.ws-step-pill {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(242, 138, 46, 0.12);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ws-step-head h2 {
  margin: 0 0 8px;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}

.ws-step-head p {
  margin: 0;
  color: #8b8f97;
}

/* Platform cards */
.ws-platform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.ws-platform-card {
  position: relative;
  min-height: 340px;
  padding: 36px 28px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 1px solid #2a2d36;
  border-radius: 18px;
  background: #0f1116;
  color: inherit;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.2s;
}

.ws-platform-card:hover {
  border-color: #4a4035;
  transform: translateY(-2px);
}

.ws-platform-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 40px rgba(242, 138, 46, 0.18);
}

.ws-platform-check {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1008;
  font-size: 0.85rem;
  font-weight: 900;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s, transform 0.2s;
}

.ws-platform-card.selected .ws-platform-check {
  opacity: 1;
  transform: scale(1);
}

.platform-logo,
.ws-platform-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

.ws-platform-logo--apple {
  filter: brightness(0) invert(1);
}

.ws-platform-logo--android {
  filter: none;
}

.ws-platform-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.ws-platform-badge--required {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.ws-platform-badge--recommended {
  color: #bbf7d0;
  background: rgba(61, 220, 132, 0.12);
  border: 1px solid rgba(61, 220, 132, 0.35);
}

.ws-platform-desc {
  margin: 0;
  max-width: 300px;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #9aa3b2;
}

.ws-platform-card p {
  margin: 0;
  max-width: 260px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.ws-platform-logo.is-fallback {
  opacity: 0.35;
}

.ws-platform-card h3 {
  margin: 0;
  font-size: 1.5rem;
  color: #f2f3f5;
}

.ws-platform-card p {
  margin: 0;
  max-width: 260px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.ws-android-connect {
  margin: 16px 0 20px;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.ws-android-connect-lead {
  margin: 0 0 14px;
  color: var(--ws-muted, #9aa3b2);
  font-size: 0.92rem;
  line-height: 1.5;
}

.ws-android-connect-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

#androidConnectError.error {
  color: #f87171;
  margin-bottom: 10px;
}

.ws-step-footer {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.ws-step--choose .ws-step-footer {
  flex-direction: column;
  align-items: flex-end;
}

.ws-step-status {
  width: 100%;
  margin: 0;
  font-size: 0.9rem;
  color: var(--ws-muted, #9aa3b2);
  text-align: right;
}

.ws-step-status.error {
  color: #f87171;
}

.ws-btn-primary,
.ws-btn-secondary,
.ws-btn-ghost {
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, background 0.2s;
}

.ws-btn-primary {
  color: #1a1008;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.ws-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ws-btn-secondary {
  color: #e8eaee;
  border: 1px solid #333842;
  background: #16181e;
  text-decoration: none;
}

.ws-btn-ghost {
  color: #9a9ea6;
  background: transparent;
  border: 1px solid #2a2d35;
}

/* Bridge banner */
.ws-bridge-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 20px;
  border: 1px solid #5c3d1f;
  border-radius: 14px;
  background: rgba(242, 138, 46, 0.06);
}

.ws-bridge-banner.hidden {
  display: none;
}

.ws-bridge-banner strong {
  display: block;
  color: var(--accent);
}

.ws-bridge-banner p {
  margin: 4px 0 0;
  font-size: 0.88rem;
}

/* Progress */
.ws-progress-card {
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid #252830;
  border-radius: 16px;
  background: #0c0e12;
}

.ws-progress-card.hidden {
  display: none;
}

.ws-progress-spinner {
  width: 32px;
  height: 32px;
  margin-bottom: 14px;
  border: 3px solid #2e333c;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ws-spin 0.85s linear infinite;
}

.ws-progress-title {
  margin: 0 0 16px;
  font-weight: 600;
  color: #e4e6ea;
}

.ws-progress-steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ws-progress-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  color: #6d7179;
  font-size: 0.88rem;
}

.ws-progress-steps li::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #333842;
  flex-shrink: 0;
}

.ws-progress-steps li.active {
  color: var(--accent);
}

.ws-progress-steps li.active::before {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(242, 138, 46, 0.5);
}

.ws-progress-steps li.done {
  color: var(--good);
}

.ws-progress-steps li.done::before {
  background: var(--good);
}

/* Device card */
.ws-device-card {
  border: 1px solid #2a2d36;
  border-radius: 16px;
  background: #0e1014;
  overflow: hidden;
}

.ws-device-card.hidden {
  display: none;
}

.ws-device-card summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  cursor: pointer;
  list-style: none;
}

.ws-device-card summary::-webkit-details-marker {
  display: none;
}

.ws-device-card-icon {
  font-size: 1.5rem;
}

.ws-device-card-title {
  font-weight: 700;
  color: #f0f2f5;
}

.ws-device-card-sub {
  margin-left: auto;
  color: #7a7e86;
  font-size: 0.82rem;
}

.ws-device-body {
  padding: 0 22px 22px;
  border-top: 1px solid #1e2128;
}

.ws-device-notice {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #28563d;
  background: #0f1812;
  font-size: 0.9rem;
}

.ws-device-notice strong {
  color: var(--good);
}

.ws-functions-accordion {
  margin-top: 20px;
  border: 1px solid #252830;
  border-radius: 14px;
  background: #0b0d10;
}

.ws-functions-accordion summary {
  padding: 16px 18px;
  cursor: pointer;
  font-weight: 600;
  color: #e0e3e8;
}

.ws-functions-wrap {
  padding: 0 18px 18px;
}

.ws-functions-summary {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: #8b8f97;
}

/* Reuse device grid from old workspace */
.device-data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.device-field {
  min-width: 0;
  padding: 14px;
  border: 1px solid #22252b;
  border-radius: 11px;
  background: #0a0b0e;
}

.device-field span,
.device-field strong {
  display: block;
}

.device-field span {
  color: var(--muted);
  font-size: 0.72rem;
}

.device-field strong {
  overflow-wrap: anywhere;
}

.device-field.available strong {
  color: var(--text);
}

.device-field.missing strong {
  color: #8a8d95;
  font-weight: 500;
  font-style: italic;
}

.device-empty {
  grid-column: 1 / -1;
  padding: 45px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 13px;
  color: var(--muted);
}

.capability-loading {
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 12px;
  background: #111820;
}

.capability-loading.hidden {
  display: none;
}

.capability-loading > span {
  width: 18px;
  height: 18px;
  border: 2px solid #47505a;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ws-spin 0.8s linear infinite;
}

.capability-loading p {
  margin: 0;
}

.ws-topbar .text-action {
  padding: 8px 12px;
  border: 1px solid #333842;
  border-radius: 10px;
  color: #c5c8ce;
  background: #14161c;
  cursor: pointer;
  font-weight: 700;
}

.ws-topbar .text-action:hover {
  color: #f0f2f5;
  border-color: #4a4035;
}

.loading-card {
  padding: 40px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.error-card {
  border-color: #6b3636;
  color: #ff9b9b;
}

.workspace-log {
  margin-top: 16px;
}

.workspace-log summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.8rem;
}

.safe-log {
  margin-top: 9px;
  padding: 13px;
  max-height: 220px;
  overflow: auto;
  border-radius: 10px;
  color: #b9bdc6;
  background: #08090b;
  font: 12px/1.7 "Cascadia Code", Consolas, monospace;
}

.safe-log p {
  margin: 0;
}

.safe-log .ok {
  color: var(--good);
}

.safe-log .error {
  color: #ff8e8e;
}

/* Terminal dialog */
.ws-terminal {
  width: min(640px, 92vw);
  padding: 0;
  border: 1px solid #333842;
  border-radius: 16px;
  background: #111318;
  color: inherit;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.65);
}

.ws-terminal::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.ws-terminal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #252830;
}

.ws-terminal-head small {
  display: block;
  color: #7a7e86;
  font-size: 0.72rem;
}

.ws-terminal-head strong {
  font-size: 1.05rem;
}

.ws-terminal-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
}

.ws-terminal-progress .progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: #292c32;
  overflow: hidden;
}

.ws-terminal-progress .progress-track span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s;
}

.ws-terminal-log {
  margin: 0 20px;
  max-height: 240px;
}

.ws-terminal .action-result {
  margin: 16px 20px;
  padding: 16px;
  border: 1px solid #252830;
  border-radius: 12px;
  background: #0c0e11;
}

.ws-terminal .action-result.hidden {
  display: none;
}

.ws-terminal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px 20px;
  border-top: 1px solid #252830;
}

.result-state {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.result-data {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.result-row {
  padding: 10px;
  border-radius: 8px;
  background: #0a0b0e;
}

.result-row span,
.result-row strong {
  display: block;
  font-size: 0.78rem;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: grid;
  gap: 8px;
}

.toast {
  max-width: 380px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #20232a;
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.5);
}

.toast.error {
  border-color: #743939;
}

.toast.good {
  border-color: #2c6844;
}

@keyframes ws-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .ws-app {
    grid-template-columns: 1fr;
  }

  .ws-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-right: none;
    border-bottom: 1px solid #1e2128;
  }

  .ws-brand {
    margin-bottom: 0;
  }

  .ws-nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: unset;
    width: 100%;
  }

  .ws-user {
    width: 100%;
  }

  .ws-platform-grid {
    grid-template-columns: 1fr;
  }

  .ws-platform-card {
    min-height: 280px;
  }

  .ws-panel {
    padding: 16px;
  }

  .ws-step {
    padding: 20px;
  }
}

.ws-android-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.ws-android-mode-step {
  margin: 0 0 20px;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.ws-android-mode-lead {
  margin: 0 0 4px;
  color: #9aa3b2;
  font-size: 0.92rem;
}

.ws-bridge-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 20px;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid rgba(255, 140, 42, 0.25);
  background: rgba(255, 140, 42, 0.06);
}

.ws-bridge-banner-connected {
  border-color: rgba(80, 200, 120, 0.35);
  background: rgba(80, 200, 120, 0.08);
}

.ws-bridge-connected-panel {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ws-bridge-connected-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(140px, 1.4fr);
  gap: 8px 16px;
  margin: 0 0 12px;
}

.ws-bridge-connected-grid div {
  display: contents;
}

.ws-bridge-connected-grid dt {
  margin: 0;
  color: #9aa3b2;
  font-size: 0.88rem;
}

.ws-bridge-connected-grid dd {
  margin: 0;
  color: #e8ebf0;
  font-size: 0.92rem;
  word-break: break-word;
}

.ws-bridge-connected-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ws-bridge-hb {
  margin: 0 0 8px;
  font-size: 0.88rem;
}

.ws-bridge-hb-ok {
  color: #7dcea0;
}

.ws-bridge-hb-warn {
  color: #f0c674;
}

.ws-bridge-connected-hint {
  margin: 0 0 8px;
  color: #9aa3b2;
  font-size: 0.86rem;
}

.ws-bridge-test-result {
  margin: 10px 0 0;
  font-size: 0.9rem;
}

.ws-bridge-test-result.ok {
  color: #7dcea0;
}

.ws-bridge-test-result.error {
  color: #ff8b8b;
}

.ws-bridge-code-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.ws-bridge-code-field {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid #333842;
  border-radius: 10px;
  background: #0f1116;
  overflow: hidden;
}

.ws-bridge-code-prefix {
  padding: 10px 0 10px 12px;
  color: #ff8c2a;
  font-family: Consolas, "Courier New", monospace;
  font-weight: 700;
  font-size: 0.95rem;
  user-select: none;
}

.ws-bridge-code-field input {
  width: 7.5rem;
  padding: 10px 12px 10px 4px;
  border: none;
  background: transparent;
  color: #f2f3f5;
  font-family: Consolas, "Courier New", monospace;
  font-size: 1rem;
  letter-spacing: 0.08em;
}

.ws-bridge-code-field input:focus {
  outline: none;
}

.ws-bridge-code-error {
  margin: 8px 0 0;
  color: #f87171;
  font-size: 0.88rem;
}

.ws-bridge-code-actions {
  margin-top: 10px;
}

.ws-bridge-debug {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #2a3140;
  color: #a8b3c7;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 180px;
}

.ws-bridge-debug.hidden {
  display: none;
}

.ws-android-mode-card {
  text-align: left;
  border: 1px solid #2a3140;
  background: #151922;
  border-radius: 14px;
  padding: 18px;
  cursor: pointer;
  color: inherit;
}

.ws-android-mode-card.selected {
  border-color: #ff8c2a;
  box-shadow: 0 0 0 1px rgba(255, 140, 42, 0.35);
}

.ws-android-mode-card h4 {
  margin: 0 0 8px;
  color: #ff8c2a;
}

.ws-android-mode-card p {
  margin: 0;
  color: #b8beca;
  font-size: 0.92rem;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .ws-android-mode-grid {
    grid-template-columns: 1fr;
  }
}

.ws-platform-mismatch {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 140, 42, 0.45);
  background: rgba(255, 140, 42, 0.08);
  color: #f0e6dc;
}

.ws-platform-mismatch p {
  margin: 0 0 10px;
}

.ws-advanced-diagnostics {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed #2a3140;
  background: rgba(10, 12, 16, 0.6);
}

.ws-advanced-diagnostics summary {
  cursor: pointer;
  color: #9aa3b2;
  font-size: 0.88rem;
  font-weight: 600;
}

.ws-advanced-diagnostics[open] summary {
  margin-bottom: 10px;
}

.ws-bridge-connected-hint {
  margin: 0 0 10px;
  color: #d5d8de;
  font-weight: 600;
}

/* Service-tool layout: status bar, terminal, readinfo sections */
.ws-service-header {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.ws-service-chip {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #252932;
  background: linear-gradient(180deg, #12141a 0%, #0d0f14 100%);
  min-height: 58px;
}

.ws-service-label {
  display: block;
  color: #7d8491;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.ws-service-chip strong {
  color: #eef1f6;
  font-size: 0.92rem;
  font-weight: 600;
  word-break: break-word;
}

.ws-console {
  margin-bottom: 18px;
  border: 1px solid #252932;
  border-radius: 14px;
  overflow: hidden;
  background: #0a0b0f;
}

.ws-console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #1d2129;
  background: #111318;
  color: #c7ccd4;
  font-size: 0.88rem;
}

.ws-console-log {
  min-height: 180px;
  max-height: 280px;
  overflow: auto;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
}

.ws-console-log p {
  margin: 0 0 4px;
  color: #b8bec8;
}

.ws-console-log p.ok { color: #7dcea0; }
.ws-console-log p.warn { color: #f0b35a; }
.ws-console-log p.error { color: #ff8a8a; }

.ws-readinfo-results {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.ws-readinfo-section {
  border: 1px solid #252932;
  border-radius: 14px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #101218 0%, #0b0d12 100%);
}

.ws-readinfo-heading {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: #eef1f6;
}

.ws-functions-panel {
  margin-top: 16px;
  border: 1px solid #252932;
  border-radius: 14px;
  padding: 14px 16px 16px;
  background: #0d0f14;
}

.ws-functions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ws-functions-head h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #eef1f6;
}

@media (max-width: 960px) {
  .ws-service-header {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.router-function-grid {
  margin-top: 4px;
}

.router-function-card.coming-soon {
  opacity: 0.68;
}

.router-support-text {
  display: block;
  margin-top: 8px;
  color: #9aa3b2;
  font-size: 0.78rem;
  line-height: 1.45;
}

.router-dev-meta {
  margin: 10px 0 0;
  color: #7f8794;
  font-size: 0.68rem;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.tag.status-available {
  color: #9ef0b8;
  border-color: #29553d;
}

.tag.status-coming-soon {
  color: #b8bec8;
  border-color: #3a404a;
}

.router-route-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ── App-window flow: bridge screen, terminal stage, phases ── */

.ws-step-head--compact {
  flex-shrink: 0;
  margin-bottom: 12px;
}

.ws-step--verify .ws-step-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 12px 4px 0;
}

/* Bridge connect screen (Zustand 2) */
.ws-bridge-screen {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border: 1px solid #22252d;
  border-radius: 16px;
  background: linear-gradient(160deg, #12141a 0%, #0d0e12 100%);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.ws-bridge-screen.hidden {
  display: none;
}

.ws-bridge-screen-inner {
  width: min(480px, 100%);
  text-align: center;
}

.ws-workspace-title {
  margin: 0 0 12px;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f0f2f5;
}

.ws-step--verify[data-platform="android"] .ws-workspace-title {
  color: #e8f4ea;
}

.ws-step--verify[data-platform="apple"] .ws-workspace-title {
  color: #f2f2f7;
}

.ws-bridge-prompt {
  margin: 0 0 24px;
  color: #8b8f97;
  font-size: 0.95rem;
  line-height: 1.55;
}

.ws-bridge-status {
  margin: 0 0 20px;
  font-size: 0.92rem;
  font-weight: 600;
}

.ws-bridge-status.ok {
  color: var(--good);
}

.ws-bridge-status.error {
  color: #ff8a8a;
}

.ws-bridge-screen-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.ws-bridge-screen-actions .ws-btn-ghost {
  font-size: 0.86rem;
  padding: 8px 14px;
}

.ws-bridge-screen .ws-bridge-code-panel {
  margin-top: 20px;
  text-align: left;
}

.ws-bridge-screen .ws-bridge-code-panel p {
  color: #9aa3b2;
  font-size: 0.88rem;
}

/* Flow stage (Zustände 3–6) */
.ws-flow-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid #22252d;
  border-radius: 16px;
  background: linear-gradient(160deg, #12141a 0%, #0d0e12 100%);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.ws-flow-stage.hidden {
  display: none;
}

.ws-flow-upper {
  flex: 1 1 50%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #1d2129;
  transition: flex 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.45s ease,
    transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.ws-flow-lower {
  flex: 1 1 50%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Phase: terminal dismisses upward after ReadInfo */
.ws-step--verify[data-ws-phase="results"] .ws-flow-upper,
.ws-step--verify[data-ws-phase="functions"] .ws-flow-upper {
  flex: 0 0 0;
  opacity: 0;
  transform: translateY(-24px);
  pointer-events: none;
  border-bottom: none;
  overflow: hidden;
}

.ws-step--verify[data-ws-phase="functions"] .ws-flow-lower {
  flex: 1 1 100%;
}

.ws-step--verify[data-ws-phase="reading"] .ws-readinfo-status {
  display: block;
}

/* Console in flow upper half */
.ws-flow-upper .ws-console {
  flex: 1;
  min-height: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  border: none;
  border-radius: 0;
  background: #0a0b0f;
}

.ws-flow-upper .ws-console.hidden {
  display: none;
}

.ws-flow-upper .ws-console-head {
  flex-shrink: 0;
}

.ws-flow-upper .ws-console-log {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  margin: 0;
}

.ws-readinfo-status {
  flex-shrink: 0;
  padding: 8px 14px;
  border-top: 1px solid #1d2129;
  background: #0e1014;
  color: var(--accent);
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Waiting zone (Zustand 3) */
.ws-waiting-zone {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
}

.ws-waiting-zone.hidden {
  display: none;
}

.ws-waiting-pulse {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(242, 138, 46, 0.25);
  position: relative;
}

.ws-waiting-pulse::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: rgba(242, 138, 46, 0.35);
  animation: ws-wait-pulse 2s ease-in-out infinite;
}

@keyframes ws-wait-pulse {
  0%, 100% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1); opacity: 1; }
}

.ws-waiting-label {
  margin: 0;
  color: #6d7179;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

/* Results zone (Zustände 5–6) */
.ws-results-zone {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px;
  gap: 12px;
}

.ws-results-zone.hidden {
  display: none;
}

.ws-step--verify[data-ws-phase="waiting"] .ws-results-zone,
.ws-step--verify[data-ws-phase="reading"] .ws-results-zone {
  display: none;
}

.ws-step--verify[data-ws-phase="results"] .ws-results-zone,
.ws-step--verify[data-ws-phase="functions"] .ws-results-zone {
  display: flex;
}

.ws-step--verify[data-ws-phase="waiting"] .ws-waiting-zone,
.ws-step--verify[data-ws-phase="reading"] .ws-waiting-zone {
  display: none;
}

.ws-step--verify[data-ws-phase="waiting"] .ws-flow-upper,
.ws-step--verify[data-ws-phase="reading"] .ws-flow-upper {
  flex: 1 1 100%;
  border-bottom: none;
}

.ws-step--verify[data-ws-phase="waiting"] .ws-flow-lower,
.ws-step--verify[data-ws-phase="reading"] .ws-flow-lower {
  flex: 0 0 0;
  min-height: 0;
  overflow: hidden;
  display: none;
}

.ws-step--verify[data-ws-phase="waiting"] .ws-flow-stage,
.ws-step--verify[data-ws-phase="reading"] .ws-flow-stage {
  min-height: 0;
}

.ws-readinfo-results {
  flex-shrink: 0;
  max-height: 42%;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease 0.15s, transform 0.55s cubic-bezier(0.4, 0, 0.2, 1) 0.15s;
}

.ws-step--verify[data-ws-phase="results"] .ws-readinfo-results,
.ws-step--verify[data-ws-phase="functions"] .ws-readinfo-results {
  opacity: 1;
  transform: translateY(0);
}

.ws-step--verify[data-ws-phase="functions"] .ws-functions-panel {
  opacity: 1;
  transform: translateY(0);
}

.ws-functions-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 0;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.45s ease 0.35s, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.35s;
}

.ws-functions-panel.hidden {
  display: none;
}

.ws-functions-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.ws-functions-scroll::-webkit-scrollbar {
  width: 6px;
}

.ws-functions-scroll::-webkit-scrollbar-thumb {
  background: #333842;
  border-radius: 999px;
}

/* Inline function terminal (Zustand 6 – Funktion läuft) */
.ws-inline-terminal {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #252932;
  border-radius: 12px;
  background: #0a0b0f;
  overflow: hidden;
}

.ws-inline-terminal.hidden {
  display: none;
}

.ws-step--verify[data-ws-phase="functions"].ws-function-running .ws-functions-panel {
  flex: 0 0 auto;
  max-height: 120px;
  overflow: hidden;
  opacity: 0.45;
  pointer-events: none;
}

.ws-step--verify[data-ws-phase="functions"].ws-function-running .ws-functions-scroll {
  overflow: hidden;
}

.ws-step--verify[data-ws-phase="functions"].ws-function-running .ws-readinfo-results {
  max-height: 28%;
}

.ws-inline-terminal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 10px 14px;
  border-bottom: 1px solid #1d2129;
  background: #111318;
}

.ws-inline-terminal-head strong {
  font-size: 0.92rem;
  color: #e8eaee;
}

.ws-inline-terminal-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 10px 14px;
}

.ws-inline-terminal-progress .progress-track {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: #292c32;
  overflow: hidden;
}

.ws-inline-terminal-progress .progress-track span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s;
}

.ws-inline-terminal-log {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  margin: 0 14px 14px;
}

/* Platform accent on verify step */
.ws-step--verify[data-platform="android"] .ws-flow-stage {
  border-color: rgba(61, 220, 132, 0.12);
}

.ws-step--verify[data-platform="apple"] .ws-flow-stage,
.ws-step--verify[data-platform="apple"] .ws-bridge-screen {
  border-color: rgba(160, 174, 192, 0.15);
}

/* Hide step pills and legacy headings in app flow */
.ws-step-pill,
#verifyStepHead {
  display: none !important;
}

/* Hide legacy panels in app flow */
.ws-step--verify .ws-progress-card,
.ws-step--verify .ws-bridge-banner,
.ws-step--verify .ws-android-mode-step,
.ws-step--verify #androidConnectPanel {
  display: none !important;
}

.device-data-item {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #22252b;
  border-radius: 10px;
  background: #0a0b0e;
}

.device-data-item span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.device-data-item strong {
  display: block;
  overflow-wrap: anywhere;
  color: #e8eaee;
  font-size: 0.88rem;
}

@media (max-width: 900px) {
  html:has(.ws-body) {
    overflow: hidden;
  }

  .ws-app {
    grid-template-columns: 1fr;
    height: 100dvh;
    max-height: 100dvh;
  }

  .ws-flow-upper,
  .ws-flow-lower {
    flex: 1 1 45%;
  }

  .ws-platform-card {
    min-height: 220px;
  }

  .ws-panel {
    padding: 12px;
  }

  .ws-step--choose {
    padding: 16px;
  }

  .ws-readinfo-results {
    max-height: 36%;
  }
}

/* ── App-window v2: strict viewport shell, phase-driven layout ── */

.ws-step--verify {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

.ws-step--verify .ws-platform-mismatch {
  flex-shrink: 0;
  margin: 0 0 10px;
}

.ws-step--verify .ws-step-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 10px 4px 0;
}

.ws-step--verify[data-ws-phase="bridge"] .ws-step-footer,
.ws-step--verify[data-ws-phase="waiting"] .ws-step-footer,
.ws-step--verify[data-ws-phase="reading"] .ws-step-footer {
  padding-top: 8px;
}

.ws-step--verify #btnStep2Continue {
  display: none !important;
}

.ws-step--choose {
  overflow: hidden;
}

.ws-step--choose .ws-platform-grid {
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Terminal + waiting split (Zustände 3–4) */
.ws-step--verify[data-ws-phase="waiting"] .ws-flow-upper,
.ws-step--verify[data-ws-phase="reading"] .ws-flow-upper {
  flex: 1 1 52%;
}

.ws-step--verify[data-ws-phase="waiting"] .ws-flow-lower,
.ws-step--verify[data-ws-phase="reading"] .ws-flow-lower {
  flex: 1 1 48%;
}

/* Results transition (Zustand 5) */
.ws-step--verify[data-ws-phase="results"] .ws-flow-upper {
  flex: 0 0 0;
  min-height: 0;
  opacity: 0;
  transform: translateY(-28px);
  pointer-events: none;
  border-bottom: none;
}

.ws-step--verify[data-ws-phase="results"] .ws-flow-lower,
.ws-step--verify[data-ws-phase="functions"] .ws-flow-lower {
  flex: 1 1 100%;
}

.ws-step--verify[data-ws-phase="results"] .capability-loading {
  display: flex;
}

.ws-step--verify[data-ws-phase="functions"] .capability-loading.hidden {
  display: none;
}

/* Legacy panels never visible in app flow */
.ws-step--verify .ws-device-card,
.ws-step--verify .ws-service-header,
.ws-step--verify #connectionLogPanel {
  display: none !important;
}

/* Function run: minimize list, expand inline terminal */
.ws-step--verify.ws-function-running .ws-functions-scroll {
  max-height: 72px;
  overflow: hidden;
  mask-image: linear-gradient(180deg, #000 40%, transparent);
}

.ws-step--verify.ws-function-running .ws-inline-terminal {
  flex: 1;
  min-height: 140px;
}

@media (prefers-reduced-motion: reduce) {
  .ws-flow-upper,
  .ws-readinfo-results,
  .ws-functions-panel {
    transition: none !important;
  }
}
