@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500&display=swap");

#auth-disclosure>summary{cursor:pointer;min-height:44px;display:list-item;padding:8px 4px;font-weight:600}
#auth-disclosure>summary:focus-visible{outline:3px solid #efc673;outline-offset:4px}
#auth-disclosure[open]>summary{margin-bottom:16px}
.connect-fields{border:0;margin:0;padding:0;min-width:0}
.connect-fields:disabled{opacity:.65}

:root {
  color-scheme: light;
  --bg-top: #f6f8ff;
  --bg-bottom: #d8e7ff;
  --ink: #0e1b34;
  --ink-soft: rgba(14, 27, 52, 0.72);
  --ink-faint: rgba(14, 27, 52, 0.5);
  --line: rgba(120, 143, 187, 0.26);
  --line-strong: rgba(83, 114, 177, 0.34);
  --glass: rgba(255, 255, 255, 0.56);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-deep: rgba(233, 240, 255, 0.68);
  --glass-auth: rgba(232, 246, 242, 0.72);
  --glass-auth-strong: rgba(245, 252, 248, 0.9);
  --accent: #1368ff;
  --accent-strong: #084dc3;
  --mint: #1ba58d;
  --amber: #ef9d1f;
  --rose: #e94f72;
  --shadow: 0 18px 48px rgba(77, 101, 143, 0.2);
  --shadow-soft: 0 12px 24px rgba(77, 101, 143, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --blur: blur(26px);
  --nav-height: 86px;
  --app-max-width: 760px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: "Outfit", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 10%, rgba(19, 104, 255, 0.22), transparent 32%),
    radial-gradient(circle at 90% 4%, rgba(27, 165, 141, 0.14), transparent 28%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-faint);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(19, 104, 255, 0.42);
  box-shadow:
    0 0 0 3px rgba(19, 104, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

textarea {
  resize: none;
}

.hidden {
  display: none !important;
}

.glass-panel {
  background: linear-gradient(180deg, var(--glass-strong), var(--glass));
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.backdrop-orb,
.backdrop-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.backdrop-orb {
  filter: blur(44px);
  opacity: 0.76;
}

.orb-a {
  inset: -18% auto auto -12%;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(19, 104, 255, 0.26) 0%, rgba(19, 104, 255, 0) 70%);
}

.orb-b {
  inset: auto -12% 4% auto;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(27, 165, 141, 0.18) 0%, rgba(27, 165, 141, 0) 72%);
}

.backdrop-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.2), transparent 75%);
  opacity: 0.32;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(var(--app-max-width), 100%);
  height: 100dvh;
  margin: 0 auto;
  padding: 14px 14px calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 10px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-switcher {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border-radius: 18px;
}

.product-switch-link {
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 13px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
}

.product-switch-link.active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-soft);
}

.product-switch-link:focus-visible {
  outline: 3px solid rgba(19, 104, 255, 0.5);
  outline-offset: 2px;
}

.topbar,
.diagnostics,
.compact-card,
.list-card,
.connect-card,
.modal-card,
.bottom-nav {
  border-radius: var(--radius-xl);
}

.topbar {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 86px;
}

.topbar-title,
.card-title {
  margin: 0;
  line-height: 1.02;
}

.topbar-title {
  font-size: clamp(1.7rem, 5vw, 2.35rem);
  font-weight: 800;
}

.topbar-copy,
.card-copy,
.status-body,
.diagnostics-body,
.empty-copy,
.inline-note,
.mode-copy,
.list-meta,
.toggle-hint,
.modal-copy {
  color: var(--ink-soft);
}

.topbar-copy {
  margin: 6px 0 0;
  font-size: 14px;
}

.topbar-side {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.eyebrow,
.status-pill,
.topbar-badge,
.version-pill,
.settings-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.eyebrow,
.settings-label {
  color: var(--accent-strong);
}

.topbar-badge,
.version-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.page-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.page {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.985);
  transition:
    opacity 220ms ease,
    transform 260ms cubic-bezier(.2, .9, .24, 1);
}

.page.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.page.active::-webkit-scrollbar {
  display: none;
}

.page-stack {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 4px;
}

#auth-card.is-condensed .card-copy {
  display: none;
}

#auth-card {
  background:
    radial-gradient(circle at top right, rgba(27, 165, 141, 0.14), transparent 34%),
    linear-gradient(180deg, var(--glass-auth-strong), var(--glass-auth));
  border-color: rgba(107, 174, 157, 0.26);
}

#auth-card .card-copy {
  max-width: 40ch;
}

#auth-card.is-condensed {
  padding-top: 14px;
  padding-bottom: 14px;
}

#auth-card.is-condensed .card-head {
  margin-bottom: 6px;
  align-items: center;
}

#auth-card.is-condensed .auth-actions {
  justify-content: flex-end;
}

.compact-card,
.connect-card,
.list-card {
  padding: 18px;
}

.compact-card {
  flex: 0 0 auto;
}

.connect-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.list-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.card-head {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.card-title {
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-weight: 750;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#connect-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
  padding-right: 2px;
}

.field {
  display: grid;
  gap: 8px;
}

.field-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
}

.help-btn,
.mini-btn,
.primary-btn,
.nav-btn,
.method-pill,
.mode-card {
  transition:
    transform 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.help-btn {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(19, 104, 255, 0.12);
  color: var(--accent-strong);
  font-weight: 800;
  padding: 0;
}

.help-btn:active,
.mini-btn:active,
.primary-btn:active,
.nav-btn:active,
.mode-card:active {
  transform: scale(0.98);
}

.method-switch {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.62);
  margin: 14px 0 12px;
  width: fit-content;
}

.method-pill {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
}

.method-pill input {
  display: none;
}

.method-pill.active,
.method-pill.static-pill.active {
  background: rgba(19, 104, 255, 0.14);
  color: var(--accent-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.relay-card {
  display: grid;
  gap: 12px;
  margin: 8px 0 2px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(223, 241, 238, 0.68), rgba(243, 249, 248, 0.72));
  border: 1px solid rgba(27, 165, 141, 0.18);
}

.relay-fields {
  display: grid;
  gap: 12px;
}

.relay-toggle-row {
  margin: 0;
}

.relay-switch {
  margin: 0;
}

.mode-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.mode-card input {
  display: none;
}

.mode-card.active {
  background: linear-gradient(180deg, rgba(196, 220, 255, 0.9), rgba(181, 212, 255, 0.74));
  border-color: rgba(19, 104, 255, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 12px 24px rgba(19, 104, 255, 0.14);
}

.mode-title {
  font-size: 1rem;
  font-weight: 700;
}

.mode-copy {
  font-size: 13px;
  line-height: 1.35;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 0;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.toggle input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.toggle-hint {
  font-size: 12px;
  text-align: right;
}

.status-card {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(232, 241, 255, 0.56));
  border: 1px solid rgba(255, 255, 255, 0.65);
  min-height: 108px;
}

.status-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.status-body {
  font-size: 14px;
  line-height: 1.42;
}

.status-progress {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.status-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.status-progress-track {
  position: relative;
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: rgba(19, 104, 255, 0.08);
}

.status-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1ba58d, #1368ff);
  box-shadow: 0 8px 18px rgba(19, 104, 255, 0.22);
  transition: width 240ms ease;
}

.status-progress-log {
  display: grid;
  gap: 6px;
}

.status-log-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--ink-soft);
}

.status-log-line::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: 5px;
  flex: 0 0 7px;
  border-radius: 999px;
  background: rgba(19, 104, 255, 0.24);
}

.status-log-line.current {
  color: var(--ink);
  font-weight: 600;
}

.status-log-line.current::before {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(19, 104, 255, 0.1);
}

.status-checklist {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.status-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 13px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.62);
}

.status-step-badge {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  background: rgba(19, 104, 255, 0.08);
}

.status-step-title {
  font-size: 14px;
  font-weight: 700;
}

.status-step-copy {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.status-step.is-done {
  border-color: rgba(27, 165, 141, 0.24);
  background: rgba(232, 250, 246, 0.72);
}

.status-step.is-done .status-step-badge {
  background: rgba(27, 165, 141, 0.14);
  color: var(--mint);
}

.status-step.is-current {
  border-color: rgba(19, 104, 255, 0.24);
  background: linear-gradient(180deg, rgba(221, 235, 255, 0.78), rgba(241, 247, 255, 0.78));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.status-step.is-current .status-step-badge {
  background: rgba(19, 104, 255, 0.14);
  color: var(--accent-strong);
}

.status-step.is-pending .status-step-badge {
  background: rgba(14, 27, 52, 0.06);
}

.action-row,
.auth-actions,
.diagnostics-actions,
.modal-actions,
.pin-row,
.add-profile-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.action-row {
  margin-top: auto;
  padding-top: 14px;
  padding-bottom: 4px;
  position: sticky;
  bottom: 0;
  z-index: 2;
  background:
    linear-gradient(
      180deg,
      rgba(233, 240, 255, 0) 0%,
      rgba(233, 240, 255, 0.82) 26%,
      rgba(233, 240, 255, 0.96) 100%
    );
}

.compact-switch {
  margin: 0;
  width: auto;
}

.list-side {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.profiles-protocol-row {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.primary-btn,
.mini-btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-btn {
  background: linear-gradient(180deg, #2f86ff, #0f62e9);
  color: white;
  box-shadow: 0 14px 26px rgba(19, 104, 255, 0.24);
}

.primary-btn.compact {
  padding-inline: 16px;
}

.primary-btn.compact,
.mini-btn.compact {
  padding: 10px 14px;
}

.mini-btn {
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.mini-btn.subtle {
  background: rgba(255, 255, 255, 0.44);
}

.diagnostics {
  padding: 16px 18px;
}

.diagnostics-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.diagnostics-title {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 4px;
}

.diagnostics-body,
.diagnostics-meta {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.42;
}

.diagnostics-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  word-break: break-all;
}

.server-picker {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scrollbar-width: none;
  min-height: 42px;
  padding-bottom: 6px;
  margin-bottom: -4px;
  -webkit-overflow-scrolling: touch;
}

.server-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.server-alias-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.server-alias-row input {
  flex: 1;
  min-width: 0;
}

.server-alias-hint {
  margin-top: 8px;
  color: var(--ink-faint);
  font-size: 12px;
}

.server-picker::-webkit-scrollbar {
  display: none;
}

.server-chip {
  border: 0;
  border-radius: 18px;
  padding: 10px 14px 11px;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.62);
  min-width: 138px;
  text-align: left;
}

.server-chip.active {
  background: rgba(19, 104, 255, 0.14);
  color: var(--accent-strong);
}

.server-chip-name {
  display: block;
  font-weight: 700;
  line-height: 1.18;
}

.server-chip-meta {
  display: block;
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 12px;
  line-height: 1.2;
}

.empty-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.48);
  border: 1px dashed rgba(99, 128, 186, 0.4);
  margin-top: 12px;
}

.empty-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.empty-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.add-profile-row {
  margin-top: 12px;
}

.add-profile-row input {
  flex: 1;
}

.list-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 2px;
}

.client-card,
.saved-server-card {
  padding: 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(232, 241, 255, 0.54));
  border: 1px solid rgba(255, 255, 255, 0.64);
  box-shadow: var(--shadow-soft);
}

.client-top,
.saved-server-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.client-name,
.saved-server-name {
  font-weight: 750;
  margin-bottom: 6px;
}

.client-meta,
.saved-server-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink-faint);
  font-size: 12px;
}

.client-actions,
.saved-server-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tiny-btn {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.66);
}

.tiny-btn.danger {
  color: var(--rose);
}

.client-inline {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(120, 143, 187, 0.16);
  display: grid;
  gap: 10px;
}

.client-card.is-recent {
  order: -1;
}

.inline-result-head {
  display: flex;
  align-items: center;
}

.inline-result-title {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(19, 104, 255, 0.12);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.result-layout {
  display: grid;
  grid-template-columns: 152px 1fr;
  gap: 14px;
  align-items: start;
}

.inline-qr {
  width: 152px;
  height: 152px;
  border-radius: 22px;
  background: white;
  object-fit: contain;
  padding: 12px;
  box-shadow: 0 12px 24px rgba(77, 101, 143, 0.14);
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-text {
  min-height: 92px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  line-height: 1.4;
}

.client-card.result-emphasis {
  border-color: rgba(19, 104, 255, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 0 0 3px rgba(19, 104, 255, 0.1),
    0 18px 32px rgba(19, 104, 255, 0.16);
}

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-block {
  display: grid;
  gap: 10px;
}

.inline-note {
  font-size: 13px;
}

.debug-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.debug-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.debug-log {
  margin: 0;
  min-height: 124px;
  max-height: 160px;
  overflow: auto;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: rgba(12, 22, 41, 0.86);
  color: rgba(231, 240, 255, 0.96);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.popover {
  position: fixed;
  z-index: 10;
  max-width: min(260px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(13, 23, 43, 0.9);
  color: white;
  box-shadow: 0 18px 42px rgba(8, 16, 34, 0.34);
  font-size: 13px;
  line-height: 1.4;
}

.bottom-nav {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  height: var(--nav-height);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(241, 241, 246, 0.54));
  box-shadow:
    0 24px 54px rgba(49, 72, 111, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.bottom-nav::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.nav-btn {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--ink-faint);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
}

.nav-btn.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(232, 238, 251, 0.78));
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 12px 24px rgba(87, 106, 143, 0.18);
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
}

.nav-icon svg {
  width: 22px;
  height: 22px;
}

.nav-label {
  font-size: 12px;
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 32, 0.34);
}

.modal-card {
  position: relative;
  width: min(420px, calc(100vw - 28px));
  padding: 18px;
}

.modal-actions {
  margin-top: 16px;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .field-grid.two,
  .mode-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-side {
    justify-items: start;
  }

  .result-layout {
    grid-template-columns: 1fr;
  }

  .inline-qr {
    width: 96px;
    height: 96px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 12px 12px calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 8px);
  }

  .topbar,
  .diagnostics,
  .compact-card,
  .connect-card,
  .list-card,
  .modal-card {
    border-radius: 24px;
  }

  .topbar-copy {
    display: none;
  }

  .compact-card,
  .connect-card,
  .list-card {
    padding: 16px;
  }

  .action-row,
  .auth-actions,
  .diagnostics-actions,
  .modal-actions,
  .pin-row {
    flex-wrap: wrap;
  }

  .action-row > .primary-btn,
  .action-row > .mini-btn,
  .auth-actions > .primary-btn,
  .auth-actions > .mini-btn,
  .diagnostics-actions > .mini-btn,
  .modal-actions > .mini-btn,
  .modal-actions > .primary-btn,
  .pin-row > .mini-btn,
  .pin-row > .primary-btn {
    width: 100%;
    justify-content: center;
  }

  .add-profile-row,
  .server-head-actions {
    flex-wrap: nowrap;
    align-items: center;
  }

  .add-profile-row .primary-btn,
  .add-profile-row .mini-btn,
  .server-head-actions .mini-btn {
    width: auto;
    flex: 0 0 auto;
    justify-content: center;
  }

  .toggle-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .server-alias-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .server-alias-row .mini-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-height: 820px) {
  :root {
    --nav-height: 78px;
  }

  .app-shell {
    gap: 8px;
    padding: 10px 10px calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 8px);
  }

  .product-switcher {
    padding: 4px;
  }

  .product-switch-link {
    min-height: 38px;
    padding: 8px 9px;
    font-size: 0.82rem;
  }

  .topbar {
    min-height: 64px;
    padding: 12px 14px;
  }

  .topbar-title {
    font-size: clamp(1.45rem, 4.8vw, 1.95rem);
  }

  .topbar-copy,
  .version-pill {
    display: none !important;
  }

  .topbar-side {
    gap: 0;
  }

  .compact-card,
  .connect-card,
  .list-card,
  .diagnostics,
  .modal-card {
    padding: 14px;
  }

  .page-stack {
    gap: 8px;
  }

  .card-head {
    margin-bottom: 10px;
  }

  .card-title {
    font-size: clamp(1rem, 3.7vw, 1.28rem);
  }

  .card-copy,
  .status-body,
  .mode-copy,
  .empty-copy,
  .inline-note,
  .list-meta,
  .toggle-hint {
    font-size: 13px;
    line-height: 1.28;
  }

  #remember-server-hint {
    display: none;
  }

  .field-grid,
  .mode-grid,
  .auth-actions,
  .diagnostics-actions,
  .modal-actions,
  .pin-row,
  .add-profile-row {
    gap: 8px;
  }

  input,
  textarea {
    padding: 11px 13px;
  }

  .method-switch {
    margin: 10px 0 8px;
    padding: 4px;
    gap: 6px;
  }

  .method-pill {
    padding: 8px 12px;
  }

  .mode-card {
    padding: 10px;
    gap: 4px;
  }

  .mode-title {
    font-size: 0.94rem;
  }

  .mode-copy {
    display: none;
  }

  .toggle-row {
    gap: 6px;
  }

  .status-card {
    margin-top: 10px;
    min-height: auto;
    padding: 10px 12px;
  }

  .status-title {
    font-size: 0.95rem;
    margin-bottom: 0;
  }

  .status-body {
    display: none;
  }

  .status-progress {
    margin-top: 10px;
    gap: 8px;
  }

  .status-progress-head,
  .status-step-copy,
  .status-log-line {
    font-size: 12px;
  }

  .status-step {
    padding: 10px 11px;
    gap: 8px;
  }

  .status-step-title {
    font-size: 13px;
  }

  .action-row {
    padding-top: 10px;
  }

  #auth-card.is-condensed {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  #auth-card.is-condensed .card-head {
    margin-bottom: 0;
    align-items: center;
  }

  #auth-card.is-condensed .eyebrow {
    margin-bottom: 2px;
  }

  #auth-card.is-condensed .card-title {
    font-size: 1.02rem;
  }

  #auth-card.is-condensed .auth-actions {
    margin-top: 6px;
  }

  #auth-card.is-condensed .mini-btn,
  #auth-card.is-condensed .primary-btn {
    width: auto;
    padding: 10px 14px;
  }

  .bottom-nav {
    left: 10px;
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    padding: 8px;
  }

  .nav-label {
    font-size: 11px;
  }
}

@media (max-height: 820px) and (max-width: 720px) {
  .field-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mode-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-height: 720px) {
  .topbar {
    min-height: 58px;
    padding: 10px 12px;
  }

  #app-eyebrow {
    display: none;
  }

  .compact-card,
  .connect-card,
  .list-card,
  .diagnostics {
    padding: 12px;
  }

  .field {
    gap: 6px;
  }

  .help-btn {
    width: 20px;
    height: 20px;
  }

  .status-card {
    min-height: 74px;
    padding: 10px 11px;
  }

  .status-body {
    font-size: 12px;
  }
}

body.compact-height.compact-width .app-shell {
  gap: 6px;
  padding: 8px 8px calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 6px);
}

body.compact-height.compact-width .product-switcher {
  gap: 4px;
  padding: 4px;
}

body.compact-height.compact-width .product-switch-link {
  min-height: 36px;
  padding: 7px 8px;
  font-size: 0.78rem;
}

body.compact-height.compact-width .page-stack {
  gap: 6px;
}

body.compact-height.compact-width .topbar {
  min-height: 54px;
  padding: 10px 12px;
}

body.compact-height.compact-width #app-eyebrow,
body.compact-height.compact-width .topbar-badge,
body.compact-height.compact-width .version-pill {
  display: none !important;
}

body.compact-height.compact-width .topbar-title {
  font-size: clamp(1.28rem, 5.2vw, 1.7rem);
}

body.compact-height.compact-width .compact-card,
body.compact-height.compact-width .connect-card,
body.compact-height.compact-width .list-card,
body.compact-height.compact-width .diagnostics,
body.compact-height.compact-width .modal-card {
  padding: 12px;
}

body.compact-height.compact-width .card-head {
  margin-bottom: 8px;
}

body.compact-height.compact-width .card-title {
  font-size: 1.06rem;
}

body.compact-height.compact-width .field,
body.compact-height.compact-width .settings-block {
  gap: 6px;
}

body.compact-height.compact-width .field-label {
  gap: 6px;
  font-size: 0.95rem;
}

body.compact-height.compact-width .help-btn {
  width: 20px;
  height: 20px;
}

body.compact-height.compact-width input,
body.compact-height.compact-width textarea {
  padding: 10px 12px;
}

body.compact-height.compact-width .method-switch {
  margin: 8px 0 6px;
  padding: 4px;
  gap: 5px;
}

body.compact-height.compact-width .method-pill {
  padding: 7px 11px;
}

body.compact-height.compact-width .mode-grid {
  gap: 6px;
  margin: 8px 0;
}

body.compact-height.compact-width .mode-card {
  padding: 8px 10px;
  gap: 2px;
  border-radius: 18px;
}

body.compact-height.compact-width .mode-title {
  font-size: 0.9rem;
}

body.compact-height.compact-width .toggle-row {
  gap: 4px;
  margin-top: 6px;
}

body.compact-height.compact-width .toggle {
  gap: 8px;
  font-size: 0.94rem;
}

body.compact-height.compact-width .toggle input {
  width: 16px;
  height: 16px;
}

body.compact-height.compact-width .toggle-hint {
  display: none;
}

body.compact-height.compact-width .status-card {
  margin-top: 8px;
  min-height: 0;
  padding: 8px 10px;
}

body.compact-height.compact-width .status-title {
  font-size: 0.88rem;
}

body.compact-height.compact-width .status-progress {
  margin-top: 8px;
  gap: 6px;
}

body.compact-height.compact-width .status-progress-head,
body.compact-height.compact-width .status-log-line,
body.compact-height.compact-width .status-step-copy {
  font-size: 11px;
}

body.compact-height.compact-width .status-step {
  padding: 9px 10px;
  gap: 7px;
}

body.compact-height.compact-width .status-step-title {
  font-size: 12px;
}

body.compact-height.compact-width .debug-log {
  min-height: 96px;
  max-height: 122px;
  padding: 10px 11px;
  font-size: 10px;
}

body.compact-height.compact-width .list-side {
  gap: 6px;
}

body.compact-height.compact-width .compact-switch {
  padding: 4px;
  gap: 4px;
}

body.compact-height.compact-width .compact-switch .method-pill {
  padding: 7px 9px;
  font-size: 12px;
}

body.compact-height.compact-width .action-row {
  padding-top: 8px;
  padding-bottom: 2px;
}

body.compact-height.compact-width .primary-btn,
body.compact-height.compact-width .mini-btn {
  padding: 12px 14px;
}

body.compact-height.compact-width #auth-card {
  padding-top: 10px;
  padding-bottom: 10px;
}

body.compact-height.compact-width #auth-card.is-condensed .eyebrow,
body.compact-height.compact-width #auth-card.is-condensed .auth-actions {
  display: none;
}

body.compact-height.compact-width #auth-card.is-condensed .card-head {
  margin-bottom: 0;
  align-items: center;
}

body.compact-height.compact-width #auth-card.is-condensed .card-title {
  font-size: 0.98rem;
}

body.compact-height.compact-width .bottom-nav {
  left: 8px;
  right: 8px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
  padding: 6px;
}

body.compact-height.compact-width .nav-label {
  font-size: 10px;
}

body.ultra-compact-height.compact-width {
  --nav-height: 68px;
}

body.ultra-compact-height.compact-width .topbar {
  min-height: 48px;
  padding: 8px 10px;
}

body.ultra-compact-height.compact-width .topbar-title {
  font-size: 1.16rem;
}

body.ultra-compact-height.compact-width .compact-card,
body.ultra-compact-height.compact-width .connect-card,
body.ultra-compact-height.compact-width .list-card,
body.ultra-compact-height.compact-width .diagnostics {
  padding: 10px;
}

body.ultra-compact-height.compact-width .card-head {
  gap: 8px;
  margin-bottom: 6px;
}

body.ultra-compact-height.compact-width .card-title {
  font-size: 1rem;
}

body.ultra-compact-height.compact-width .field-grid,
body.ultra-compact-height.compact-width .mode-grid {
  gap: 5px;
}

body.ultra-compact-height.compact-width .field {
  gap: 4px;
}

body.ultra-compact-height.compact-width .field-label {
  font-size: 0.9rem;
}

body.ultra-compact-height.compact-width input,
body.ultra-compact-height.compact-width textarea {
  padding: 9px 11px;
}

body.ultra-compact-height.compact-width .method-switch {
  margin: 6px 0 5px;
}

body.ultra-compact-height.compact-width .mode-card {
  padding: 7px 8px;
}

body.ultra-compact-height.compact-width .mode-title {
  font-size: 0.86rem;
}

body.ultra-compact-height.compact-width .toggle {
  font-size: 0.9rem;
}

body.ultra-compact-height.compact-width .status-card {
  margin-top: 6px;
  padding: 7px 9px;
}

body.ultra-compact-height.compact-width .status-title {
  font-size: 0.82rem;
}

body.ultra-compact-height.compact-width .status-step {
  padding: 8px 9px;
}

body.ultra-compact-height.compact-width .status-step-badge {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

body.ultra-compact-height.compact-width .debug-head {
  gap: 6px;
}

body.ultra-compact-height.compact-width .compact-switch .method-pill {
  padding: 6px 8px;
  font-size: 11px;
}

body.ultra-compact-height.compact-width .debug-log {
  min-height: 88px;
  max-height: 108px;
  padding: 9px 10px;
}

body.ultra-compact-height.compact-width .primary-btn,
body.ultra-compact-height.compact-width .mini-btn {
  padding: 11px 13px;
}

body.ultra-compact-height.compact-width .action-row {
  padding-top: 6px;
  padding-bottom: 2px;
}

body.ultra-compact-height.compact-width .bottom-nav {
  padding: 5px;
}

body.ultra-compact-height.compact-width .nav-btn {
  gap: 4px;
}

body.ultra-compact-height.compact-width .nav-icon,
body.ultra-compact-height.compact-width .nav-icon svg {
  width: 19px;
  height: 19px;
}

body.micro-compact-height.compact-width .topbar {
  display: none;
}

body.micro-compact-height.compact-width .status-card {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
