/* ProtoChat Studio — Base Design Tokens, Forms, Signed-Out Entry & Legal Chrome */
:root {
  color-scheme: light dark;
  --bg: #101214;
  --surface: #16191d;
  --surface-raised: #1c2026;
  --control: #21262e;
  --hover: #282e37;
  --ink: #f3f5f8;
  --muted: #9ea6b0;
  --line: #262b31;
  --line-strong: #363d45;
  --accent: #ff5a1f;
  --accent-hover: #ff7440;
  --accent-text: #ff7d4d;
  --accent-ink: #0a0c0e;
  --ok: #4ade80;
  --ok-bg: rgba(74, 222, 128, 0.12);
  --ok-line: rgba(74, 222, 128, 0.36);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.12);
  --warn-line: rgba(245, 158, 11, 0.36);
  --bad: #f87171;
  --bad-bg: rgba(248, 113, 113, 0.12);
  --bad-line: rgba(248, 113, 113, 0.36);
  --stage-bg: #0d1014;
  --sans: 'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  --mono: 'SFMono-Regular', ui-monospace, Menlo, Monaco, Consolas, monospace;
  font-family: var(--sans);
  accent-color: var(--accent);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  color-scheme: dark;
}

:root:has(> head > meta[name="color-scheme"][content="light"]) {
  color-scheme: light;
}

:root[data-theme="light"] {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-raised: #eef0f4;
  --control: #e7eaf0;
  --hover: #dce1ea;
  --ink: #101214;
  --muted: #454e58;
  --line: #d2d8e0;
  --line-strong: #b0b8c4;
  --accent: #c93908;
  --accent-hover: #b33106;
  --accent-text: #b83208;
  --accent-ink: #ffffff;
  --ok: #0f5c2e;
  --ok-bg: rgba(15, 92, 46, 0.1);
  --ok-line: rgba(15, 92, 46, 0.35);
  --warn: #92400e;
  --warn-bg: rgba(146, 64, 14, 0.1);
  --warn-line: rgba(146, 64, 14, 0.35);
  --bad: #991b1b;
  --bad-bg: rgba(153, 27, 27, 0.1);
  --bad-line: rgba(153, 27, 27, 0.35);
  --stage-bg: #e8eaee;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-underline-offset: 4px; }
a:hover { color: var(--accent-text); }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* 48px Unified ProtoChat Studio Topbar */
header.pc-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  max-width: none;
  height: 48px;
  margin: 0;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.pc-top-left, .pc-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.brand span { color: var(--accent); }

.pc-sep {
  width: 1px;
  height: 16px;
  background: var(--line-strong);
  flex: none;
}

.pc-top-ctx {
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.pc-top-link {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  transition: color 0.14s ease, background-color 0.14s ease;
}

.pc-top-link:hover {
  color: var(--ink);
  background: var(--control);
}

.pc-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  opacity: 0.86;
  cursor: pointer;
  transition: opacity 0.14s ease, background-color 0.14s ease;
}

.pc-theme-btn:hover {
  opacity: 1;
  background: var(--control);
}

:root:not([data-theme="light"]) .pc-ico-moon { display: none; }
:root[data-theme="light"] .pc-ico-sun { display: none; }

/* Main Containers */
main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  min-height: calc(100dvh - 106px);
}

main.pc-legal {
  max-width: 760px;
  padding: 40px 24px 64px;
}

main.pc-legal h2 {
  margin: 28px 0 10px;
  font-size: 19px;
}

main.pc-legal p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.eyebrow {
  font: 600 11px/1.4 var(--mono);
  color: var(--accent-text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}

.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--accent);
  flex: none;
}

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.18;
  color: var(--ink);
}

h1 {
  font-size: clamp(28px, 3.4vw, 44px);
  margin: 0 0 14px;
}

h2 { font-size: 22px; margin: 0 0 12px; }
h3 { font-size: 18px; margin: 0 0 10px; }
p { max-width: 72ch; }

.pc-intro-lead {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
  margin: 0 0 20px;
}

#status {
  font: 500 12px/1.5 var(--mono);
  color: var(--muted);
  margin: 14px 0;
  min-height: 18px;
}

#status:empty { display: none; }

section { min-width: 0; }

/* Form Primitives */
label {
  display: block;
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

input, select, textarea, button { font: inherit; }

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink);
  border-radius: 6px;
  font-size: 13.5px;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.72;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
button { min-height: 40px; }

textarea {
  resize: vertical;
  line-height: 1.6;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--control);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

button:hover:not(:disabled) {
  background: var(--hover);
  border-color: var(--muted);
}

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button:disabled {
  opacity: 0.78;
  color: var(--muted);
  cursor: not-allowed;
}

.muted {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.notice {
  font-size: 12.5px;
  line-height: 1.6;
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
  cursor: pointer;
}

.check input[type="checkbox"],
.check input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  min-width: 16px;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--accent);
}

audio {
  width: 100%;
  margin-top: 12px;
}

/* Signed-Out Studio Layout */
main:has(#signed-out:not([hidden])) {
  max-width: 1020px;
  padding: 44px 24px 64px;
}

@media (min-width: 960px) {
  main:has(#signed-out:not([hidden])) {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) 396px;
    grid-auto-rows: min-content;
    column-gap: 56px;
    align-items: start;
  }
  main:has(#signed-out:not([hidden])) > .pc-intro-copy {
    grid-column: 1;
    grid-row: 1;
    padding-top: 10px;
  }
  main:has(#signed-out:not([hidden])) > #price-line {
    grid-column: 1;
    grid-row: 2;
  }
  main:has(#signed-out:not([hidden])) > #status {
    grid-column: 1;
    grid-row: 3;
  }
  main:has(#signed-out:not([hidden])) > #signed-out {
    grid-column: 2;
    grid-row: 1 / 5;
    margin: 0;
  }
}

#signed-out {
  max-width: 420px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

#signed-out h2 {
  font-size: 19px;
  margin: 0 0 18px;
}

#google {
  width: 100%;
  min-height: 44px;
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  font-weight: 700;
}

#google:hover:not(:disabled) {
  opacity: 0.9;
  background: var(--ink);
  border-color: var(--ink);
}

#signed-out > .muted {
  text-align: center;
  margin: 16px 0 6px;
}

#login-form .actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 8px;
}

#login-form .actions button[type="submit"] {
  width: 100%;
}

#reset {
  grid-column: 1 / -1;
  justify-self: start;
  border: 0;
  background: transparent;
  padding: 2px 0;
  min-height: 28px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
}

#reset:hover:not(:disabled) {
  background: transparent;
  border-color: transparent;
  color: var(--ink);
}

#verify {
  width: 100%;
  margin-top: 12px;
}

.price-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 4px 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  max-width: 560px;
}

.price-line p { margin: 0; }
.price-line > p:first-child {
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
}

.price-line > p:first-child strong {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--accent-text);
  margin-right: 4px;
}

.price-line ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.price-line li {
  font-size: 11.5px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--ink);
}

.price-line > .muted {
  flex-basis: 100%;
  font-size: 12px;
}

/* Attachments */
.attachments { display: grid; gap: 8px; margin-block: 10px; }
.attachments-lead { margin: 0; font-size: 12.5px; }
.attachments-warning {
  font-weight: 600;
  color: var(--warn);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--warn-line);
  background: var(--warn-bg);
}

.attachment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.attachment-list li {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  font-size: 12.5px; min-width: 0; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface-raised);
}
.attachment-list a { overflow-wrap: anywhere; min-width: 0; font-weight: 600; }
.attachment-list img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0, 0, 0); white-space: nowrap; border: 0;
}

/* Footer */
footer {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  border-top: 1px solid var(--line);
  padding: 18px 24px 28px;
  font-size: 12px;
  color: var(--muted);
}

footer a:last-child { margin-left: auto; }

@media (max-width: 640px) {
  header.pc-topbar { padding: 0 12px; }
  .pc-top-ctx, .pc-sep { display: none; }
  main { padding: 20px 16px 36px; }
  main:has(#signed-out:not([hidden])) { padding: 24px 16px 40px; }
  #signed-out { padding: 20px; max-width: none; }
  footer { padding: 16px; }
  footer a:last-child { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
