/* Shared portal design tokens. */
:root {
  color-scheme: dark;
  --ui-background: #101011;
  --ui-card: #19191b;
  --ui-foreground: #f4f4f5;
  --ui-muted: #a6a6af;
  --ui-border: #37373b;
  --ui-field: #202023;
  --ui-primary: #f2f2f3;
  --ui-primary-foreground: #18181a;
  --ui-ring: #b7b7c7;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font: 16px/1.55 var(--font-sans);
  background: var(--ui-background);
  color: var(--ui-foreground);
}

.auth-page main {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}

.signup {
  width: min(100%, 400px);
  border: 1px solid var(--ui-border);
  border-radius: 20px;
  corner-shape: squircle;
  background: var(--ui-card);
  box-shadow: 0 14px 40px #0004;
}

.signup-entry { padding: clamp(20px, 6vw, 32px); }
.signup #access, .signup #reset { margin: 0; }
.signup h1 {
  margin: 0 0 24px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.25;
}

.signup h1:has(+ .signup-intro:not([hidden])) { margin-bottom: 6px; }
.signup-intro {
  margin: 0 0 24px;
  color: var(--ui-muted);
  text-align: center;
  font-size: 13px;
}

.signup form { gap: 16px; }
.auth-field, .auth-label-row { display: grid; gap: 6px; }
.auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.signup label {
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.signup input {
  min-height: 42px;
  border: 1px solid var(--ui-border);
  border-radius: 11px;
  corner-shape: squircle;
  background: var(--ui-field);
  color: var(--ui-foreground);
  font: inherit;
  font-size: 14px;
}

.signup input::placeholder { color: var(--ui-muted); }
.signup input:hover { border-color: var(--ui-muted); }
.signup :focus-visible { outline: 2px solid var(--ui-ring); outline-offset: 2px; }

.signup-password {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 6px;
}

.signup-password input { padding-right: 68px; }
.signup .text {
  min-height: 32px;
  color: var(--ui-foreground);
  font-size: 13px;
  font-weight: 500;
  text-decoration-color: var(--ui-muted);
  text-underline-offset: 4px;
}
.signup .text:hover { text-decoration-color: currentColor; }

.signup-password .text {
  position: absolute;
  right: 8px;
  padding: 0 5px;
  text-decoration: none;
}

#password-hint {
  margin: 6px 0 0;
  color: var(--ui-muted);
  font-size: 12px;
}

.signup-submit {
  justify-content: center;
  width: 100%;
  min-height: 42px;
  border-color: transparent;
  border-radius: 11px;
  corner-shape: squircle;
  background: var(--ui-primary);
  color: var(--ui-primary-foreground);
  font-size: 14px;
  font-weight: 600;
}

.signup-submit:hover { background: #dedee3; }
.signup-switch, .signup-help {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  color: var(--ui-muted);
  font-size: 13px;
}
.signup-help { margin-top: 2px; }

.signup #auth-message {
  margin: 0 0 14px;
  background: #26312a;
  color: #d4e5d8;
  font-size: 13px;
}

.signup #auth-message.error {
  background: #382326;
  color: #ffc3c9;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main, #account-header {
  width: min(100% - 40px, 1080px);
  margin-inline: auto;
}
button, input, textarea { font: inherit; }
button, .button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--ui-ring); outline-offset: 3px; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  corner-shape: squircle;
  background: var(--ui-primary);
  color: var(--ui-primary-foreground);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

button:hover, .button:hover { background: #dedee3; }

button.secondary {
  border-color: var(--ui-border);
  background: var(--ui-field);
  color: var(--ui-foreground);
}
button.secondary:hover { background: #2a2a2f; }

button.text {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ui-foreground);
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--ui-muted);
  text-underline-offset: 4px;
}
button.text:hover { text-decoration-color: currentColor; }

form, label { display: grid; gap: 8px; }
label { font-size: 13px; font-weight: 500; }

input, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--ui-border);
  border-radius: 11px;
  corner-shape: squircle;
  background: var(--ui-field);
  color: var(--ui-foreground);
  font-size: 14px;
}
input::placeholder, textarea::placeholder { color: var(--ui-muted); }
textarea { resize: vertical; }

.notice {
  margin: 16px 0;
  padding: 10px 14px;
  border-radius: 11px;
  background: #26312a;
  color: #d4e5d8;
}
.notice.error { background: #382326; color: #ffc3c9; }

#account-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding-block: 12px;
  border-bottom: 1px solid var(--ui-border);
}
.account-brand { margin-right: auto; font-size: 16px; font-weight: 650; }
#account-label { color: var(--ui-muted); font-size: 13px; overflow-wrap: anywhere; }
#logout { flex-shrink: 0; min-height: 36px; }

#workspace { padding: 32px 0 48px; }
#workspace h1, #workspace h2, #workspace h3 { margin: 0; font-weight: 600; }

.section-title, .section-heading, .subscription-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  flex-wrap: wrap;
}
.section-title { margin-bottom: 24px; }
.section-title h1 {
  font-size: clamp(1.7rem, 4vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -.04em;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--ui-muted);
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .11em;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  background: var(--ui-card);
  color: var(--ui-muted);
  font-size: 12px;
}
.badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}
.badge.is-active { color: #b1d6b7; }

#workspace p:not(.eyebrow, .plan-price) { color: var(--ui-muted); font-size: 14px; }
.subscription-actions { margin: -8px 0 20px; justify-content: flex-start; }
.subscription-actions p, .section-heading p { margin: 0; }

#plans { margin-bottom: 24px; }
.section-heading { margin-bottom: 10px; }
#workspace h2 { font-size: 17px; letter-spacing: -.015em; }
#workspace h3 { font-size: 14px; }
.plans, .workspace { display: grid; gap: 14px; }
.plans { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.workspace { grid-template-columns: minmax(0, 1fr); }
.workspace-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.workspace-nav button[aria-pressed="true"] { background: var(--ui-primary); color: var(--ui-primary-foreground); }
#connections-panel h3 { margin-top: 18px; }
#chatgpt-code { font: 650 1.4rem ui-monospace, monospace; letter-spacing: .09em; }

.panel {
  min-width: 0;
  padding: clamp(16px, 3vw, 22px);
  border: 1px solid var(--ui-border);
  border-radius: 20px;
  corner-shape: squircle;
  background: var(--ui-card);
}
.panel p { margin: 6px 0 14px; }
.plan-card { display: flex; flex-direction: column; align-items: flex-start; }
.plan-card .plan-price {
  margin: 7px 0 0;
  font-size: 29px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -.035em;
}
.plan-price span { color: var(--ui-muted); font-size: 13px; font-weight: 400; letter-spacing: 0; }
.plan-card button { margin-top: auto; }

#pair-form > button, #chat-form > button { justify-self: start; }
.linked-devices { margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--ui-border); }
#devices { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; }
#devices li:not(.device) { color: var(--ui-muted); }
li.device { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-block: 8px; }
li.device span { flex: 1; overflow-wrap: anywhere; }
li.device small { display: block; color: var(--ui-muted); }

.chat-panel { display: flex; gap: 12px; min-height: 300px; flex-direction: column; }
#conversation { display: flex; max-height: 360px; flex-direction: column; gap: 8px; overflow: auto; }
#conversation:empty { display: none; }
#workspace #conversation p {
  max-width: 90%;
  margin: 0;
  padding: 8px 12px;
  border-radius: 11px;
  background: var(--ui-field);
  color: var(--ui-foreground);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message-user { align-self: flex-end; }
.message-assistant { align-self: flex-start; }
#chat-form { margin-top: auto; padding-top: 12px; }

@media (max-width: 640px) {
  main, #account-header { width: min(100% - 28px, 1080px); }
  .plans, .workspace { grid-template-columns: 1fr; }
  #workspace { padding-top: 24px; }
}
