:root {
  color-scheme: light dark;
  --bg: #f7f7f5;
  --panel: #ffffff;
  --text: #111111;
  --muted: #686868;
  --border: #d8d8d4;
  --soft: #eeeeeb;
  --inverse: #ffffff;
  --focus: #777777;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0d;
    --panel: #151515;
    --text: #f3f3f1;
    --muted: #a0a09b;
    --border: #343432;
    --soft: #222220;
    --inverse: #111111;
    --focus: #a0a0a0;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

.shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.topbar,
.intro,
.connection-row,
.connection-actions,
.inline-form {
  display: flex;
  align-items: center;
}

.topbar {
  min-height: 44px;
  justify-content: space-between;
  margin-bottom: 48px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 650;
  text-decoration: none;
}

.brand-mark {
  width: 14px;
  height: 14px;
  border: 4px solid currentColor;
  border-radius: 50%;
}

h1,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 6vw, 48px);
  line-height: 1;
  letter-spacing: -0.04em;
}

h2,
h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 16px;
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted,
.empty {
  color: var(--muted);
  line-height: 1.55;
}

.auth-panel {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 320px);
  gap: 56px;
  align-items: start;
}

.form-stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 25%, transparent);
}

.primary-button,
.secondary-button,
.text-button,
.action-link,
.copy-action {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 13px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

.primary-button {
  min-height: 44px;
  border-color: var(--text);
  background: var(--text);
  color: var(--inverse);
  font-weight: 700;
}

.text-button {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.intro {
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 24px;
}

.intro-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.intro-actions > .muted {
  max-width: 320px;
  margin-bottom: 0;
  text-align: right;
}

.connections {
  border-top: 1px solid var(--border);
}

.subscription-card {
  display: grid;
  gap: 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 16px;
  background: var(--panel);
}

.subscription-card p {
  margin-bottom: 0;
}

.subscription-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(120px, 0.55fr);
  gap: 10px;
}

.onboarding {
  display: grid;
  gap: 12px;
  margin: 0 0 24px;
}

.onboarding-top,
.onboarding-actions,
.onboarding-dots {
  display: flex;
  align-items: center;
}

.onboarding-top {
  justify-content: space-between;
}

.onboarding-card {
  display: flex;
  min-height: 310px;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: clamp(22px, 4vw, 34px);
  background: var(--panel);
}

.onboarding-card p {
  margin-bottom: 0;
  line-height: 1.45;
}

.onboarding-card h2 {
  max-width: 520px;
  font-size: clamp(30px, 6vw, 54px);
  line-height: 0.95;
}

.onboarding-icon {
  display: inline-flex;
  width: 64px;
  height: 64px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.onboarding-actions {
  justify-content: space-between;
  gap: 10px;
}

.onboarding-actions button {
  flex: 1;
}

.onboarding-dots {
  justify-content: center;
  gap: 7px;
}

.dot {
  width: 7px;
  height: 7px;
  min-height: 0;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: var(--border);
}

.dot.active {
  width: 24px;
  background: var(--text);
}

.connection-row {
  min-height: 62px;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
}

.connection-name {
  min-width: 0;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-actions {
  flex: none;
  gap: 7px;
}

.row-badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
}

.action-link,
.copy-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 14px;
  font-size: 14px;
}

.primary-action {
  min-height: 66px;
  justify-content: space-between;
  border-color: var(--text);
  font-size: 16px;
  font-weight: 750;
}

.copy-action {
  width: 100%;
}

.app-section {
  display: grid;
  gap: 16px;
  margin-top: 30px;
}

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

.app-link,
.wide-link {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  background: var(--panel);
  color: inherit;
  font-weight: 650;
  text-decoration: none;
}

.app-link span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.wide-link {
  margin-bottom: 14px;
}

.details-list {
  margin-top: 34px;
  border-top: 1px solid var(--border);
}

details {
  border-bottom: 1px solid var(--border);
}

summary {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 650;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  margin-left: 12px;
  color: var(--muted);
  font-size: 20px;
  font-weight: 400;
}

details[open] summary::after {
  content: "−";
}

.status-badge {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.details-body {
  padding: 0 0 24px;
  line-height: 1.55;
}

.inline-form {
  gap: 10px;
  align-items: end;
}

.inline-form label {
  flex: 1;
}

.steps {
  margin: 20px 0 0;
  padding-left: 22px;
}

.steps li + li {
  margin-top: 8px;
}

.compact-form {
  max-width: 420px;
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(240px, 420px) 1fr;
  gap: 28px;
  align-items: start;
}

.passkey-panel {
  display: grid;
  gap: 14px;
}

.passkey-list {
  display: grid;
  gap: 8px;
}

.passkey-row {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--panel);
}

.passkey-row strong,
.passkey-row span {
  display: block;
}

.passkey-row span {
  margin-top: 3px;
  font-size: 12px;
}

.error {
  margin: 0;
  color: #a00000;
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100% - 40px));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgb(0 0 0 / 12%);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .shell {
    width: min(100% - 28px, 760px);
  }

  .auth-panel,
  .account-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  .shell {
    width: min(100% - 20px, 760px);
    padding-top: 14px;
  }

  .topbar {
    margin-bottom: 48px;
  }

  .auth-panel {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .intro {
    display: block;
  }

  .intro-actions {
    justify-items: start;
  }

  .intro-actions > .muted {
    max-width: none;
    text-align: left;
  }

  .connection-row {
    display: block;
    padding: 15px 0;
  }

  .subscription-actions {
    grid-template-columns: 1fr;
  }

  .onboarding-card {
    min-height: 360px;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .connection-name {
    margin-bottom: 11px;
  }

  .connection-actions {
    display: flex;
  }

  .inline-form {
    display: grid;
  }
}
