:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0c0b12;
  color: #f3efff;
  --surface: #15131d;
  --border: #302a3d;
  --muted: #aaa3b8;
  --purple: #a855f7;
  --pink: #e879f9;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 50% 0, #241237, #0c0b12 55%); }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 18px max(24px, calc((100% - 1440px) / 2)); border-bottom: 1px solid var(--border); background: rgba(12,11,18,.9); }
.brand { font-weight: 900; letter-spacing: .12em; text-decoration: none; }
.brand span { color: var(--pink); }
.account { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: .9rem; }
.portal-shell { width: min(1440px, 100% - 40px); margin: 48px auto; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(480px, 100%); padding: 36px; }
.page-heading { margin-bottom: 28px; }
.eyebrow { color: var(--pink); font-size: .72rem; font-weight: 800; letter-spacing: .16em; margin: 0 0 10px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin-bottom: 10px; }
h2 { font-size: 1.3rem; margin-bottom: 0; }
.muted { color: var(--muted); line-height: 1.6; }
.small { font-size: .85rem; }
.panel { background: rgba(21,19,29,.94); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 48px rgba(0,0,0,.2); }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 20px; align-items: start; }
.editor-panel, .copilot-panel { padding: 24px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
label { display: grid; gap: 7px; color: #d7d1e1; font-size: .82rem; font-weight: 650; margin: 14px 0; }
input, select, textarea { width: 100%; background: #0d0c12; color: #f3efff; border: 1px solid var(--border); border-radius: 8px; padding: 11px 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(168,85,247,.5); border-color: var(--purple); }
textarea { min-height: 460px; resize: vertical; font: .78rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2; }
.prompt-input { min-height: 110px; font: inherit; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; border: 1px solid transparent; border-radius: 8px; padding: 9px 14px; font-weight: 700; text-decoration: none; cursor: pointer; transition: filter .16s, transform .16s; }
.button:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }
.button:disabled { opacity: .48; cursor: not-allowed; }
.primary { color: white; background: linear-gradient(110deg, #7c3aed, #c026d3); }
.secondary { color: white; background: #292338; border-color: #443855; }
.ghost { color: #e7e0f0; border-color: var(--border); background: transparent; }
.inline-status, .page-status { min-height: 1.4em; color: var(--muted); font-size: .83rem; }
.error { color: #ff9a9a; }
.service-status { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.status-chip { color: #f4d57b; background: rgba(161,117,20,.14); border: 1px solid rgba(219,171,54,.25); border-radius: 20px; padding: 5px 10px; font-size: .75rem; }
.status-chip.ready { color: #7ce0ae; background: rgba(30,130,79,.14); border-color: rgba(81,205,139,.25); }
.chat-log { min-height: 290px; max-height: 520px; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding: 12px; margin: 12px 0; border: 1px solid var(--border); border-radius: 9px; background: #0d0c12; }
.chat-message { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .86rem; line-height: 1.55; }
.chat-message strong { display: block; color: var(--pink); margin-bottom: 5px; }
.chat-empty { color: var(--muted); font-size: .85rem; align-self: center; margin: auto; text-align: center; }
.fine-print { margin: 24px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
@media (max-width: 900px) { .workspace-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .portal-shell { width: min(100% - 24px, 1440px); margin: 28px auto; }
  .topbar { padding: 14px 12px; }
  .account { gap: 8px; font-size: .76rem; }
  .editor-panel, .copilot-panel { padding: 17px; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  textarea { min-height: 340px; }
}
