:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5b6270;
  --border: #dde1e7;
  --accent: #1d4ed8;
  --accent-text: #ffffff;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --success: #067647;
  --success-bg: #ecfdf3;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --text: #e8eaee;
    --muted: #9aa2b1;
    --border: #2a2f3a;
    --accent: #6b8cff;
    --accent-text: #0b0d12;
    --danger: #f97066;
    --danger-bg: #2b1513;
    --success: #47cd89;
    --success-bg: #0f2419;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.brand { font-weight: 650; letter-spacing: -0.01em; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }

/* Sign-in */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.card h1 { font-size: 20px; margin: 20px 0 4px; }
.card p.lead { margin: 0 0 20px; color: var(--muted); }
label { display: block; font-weight: 550; font-size: 13px; margin: 14px 0 6px; }
input {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
button {
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  border: 1px solid transparent;
}
button.primary { width: 100%; margin-top: 20px; background: var(--accent); color: var(--accent-text); }
button.primary:disabled { opacity: 0.6; cursor: progress; }
button.link { background: none; color: var(--accent); padding: 0; font-weight: 500; }
button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.row { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-size: 14px; }
.alert { border-radius: 8px; padding: 10px 12px; margin-top: 16px; font-size: 14px; }
.alert.error { color: var(--danger); background: var(--danger-bg); }
.alert.info { color: var(--success); background: var(--success-bg); }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
[hidden] { display: none !important; }

/* Portal */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; min-width: 0; }
.topbar .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main.portal { max-width: 960px; margin: 0 auto; padding: 28px 24px 48px; }
main.portal h1 { font-size: 22px; margin: 0 0 4px; }
main.portal > p { color: var(--muted); margin: 0 0 24px; }
.studio { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; }
.studio h2 { font-size: 15px; margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.studio ul { list-style: none; margin: 0; padding: 0; }
.studio li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 18px; border-top: 1px solid var(--border); }
.studio li:first-child { border-top: 0; }
.studio li a { font-weight: 550; text-decoration: none; overflow-wrap: anywhere; }
.studio li a:hover { text-decoration: underline; }
.studio .meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.notice { color: var(--muted); font-size: 13px; }
@media (max-width: 560px) {
  .topbar { padding: 12px 16px; }
  main.portal { padding: 20px 16px 40px; }
  .studio li { flex-direction: column; gap: 2px; }
}
