:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --panel-bg: rgba(255, 255, 255, 0.92);
  --chat-panel-bg: rgba(252, 253, 255, 0.97);
  --surface-soft: #eef3fd;
  --surface-tint: #d3e3fd;
  --input-bg: #fbfcff;
  --primary: #0b57d0;
  --on-primary: #ffffff;
  --secondary: #00639b;
  --accent: #c5221f;
  --glow-a: rgba(66, 133, 244, 0.2);
  --glow-b: rgba(234, 67, 53, 0.08);
  --ink: #1f1f1f;
  --muted: #5f6368;
  --outline: #c4c7c5;
  --outline-strong: #747775;
  --soft-border: rgba(95, 99, 104, 0.16);
  --shadow: none;
  --editor-bg: #15171c;
  --radius: 28px;
  --radius-sm: 20px;
  --radius-xs: 16px;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131314;
  --surface: #1e1f20;
  --panel-bg: rgba(30, 31, 32, 0.94);
  --chat-panel-bg: rgba(24, 25, 26, 0.97);
  --surface-soft: #2a2d32;
  --surface-tint: #3a4455;
  --input-bg: #171717;
  --primary: #a8c7fa;
  --on-primary: #062e6f;
  --secondary: #7fcfff;
  --accent: #f28b82;
  --glow-a: rgba(168, 199, 250, 0.14);
  --glow-b: rgba(242, 139, 130, 0.1);
  --ink: #e3e3e3;
  --muted: #c4c7c5;
  --outline: #5f6368;
  --outline-strong: #9aa0a6;
  --soft-border: rgba(227, 227, 227, 0.12);
  --shadow: none;
}

body[data-palette="system"] {
  --primary: #111111;
  --on-primary: #ffffff;
  --surface-tint: #d9d9d9;
  --surface-soft: #efefef;
  --accent: #444444;
  --glow-a: rgba(255, 255, 255, 0.18);
  --glow-b: rgba(0, 0, 0, 0.1);
}

body[data-palette="pink"] {
  --primary: #c44d65;
  --on-primary: #ffffff;
  --surface-tint: #ffd9e0;
  --surface-soft: #ffe8ec;
  --accent: #8c1d38;
  --glow-a: rgba(244, 160, 174, 0.24);
  --glow-b: rgba(196, 77, 101, 0.12);
}

body[data-palette="orange"] {
  --primary: #9b5a00;
  --on-primary: #ffffff;
  --surface-tint: #ffddb4;
  --surface-soft: #ffeedb;
  --accent: #b35400;
  --glow-a: rgba(255, 183, 92, 0.24);
  --glow-b: rgba(155, 90, 0, 0.12);
}

body[data-palette="yellow"] {
  --primary: #765b00;
  --on-primary: #ffffff;
  --surface-tint: #ffe08a;
  --surface-soft: #fff4c7;
  --accent: #8a6500;
  --glow-a: rgba(248, 203, 38, 0.26);
  --glow-b: rgba(118, 91, 0, 0.12);
}

body[data-palette="green"] {
  --primary: #386a20;
  --on-primary: #ffffff;
  --surface-tint: #c4efae;
  --surface-soft: #e0f6d3;
  --accent: #146c2e;
  --glow-a: rgba(142, 211, 109, 0.24);
  --glow-b: rgba(56, 106, 32, 0.12);
}

body[data-palette="blue"] {
  --primary: #00639b;
  --on-primary: #ffffff;
  --surface-tint: #cde5ff;
  --surface-soft: #e5f2ff;
  --accent: #0b57d0;
  --glow-a: rgba(126, 197, 245, 0.25);
  --glow-b: rgba(0, 99, 155, 0.12);
}

body[data-palette="lavender"] {
  --primary: #50649f;
  --on-primary: #ffffff;
  --surface-tint: #dae2ff;
  --surface-soft: #edf1ff;
  --accent: #6750a4;
  --glow-a: rgba(174, 194, 238, 0.25);
  --glow-b: rgba(80, 100, 159, 0.12);
}

body[data-theme="dark"][data-palette="system"] {
  --primary: #f2f2f2;
  --on-primary: #111111;
  --surface-tint: #505050;
  --surface-soft: #2c2c2c;
  --accent: #d0d0d0;
}

body[data-theme="dark"][data-palette="pink"] {
  --primary: #ffb1c0;
  --on-primary: #5f1127;
  --surface-tint: #5b2630;
  --surface-soft: #34252a;
}

body[data-theme="dark"][data-palette="orange"] {
  --primary: #ffb95f;
  --on-primary: #512d00;
  --surface-tint: #563716;
  --surface-soft: #342a1e;
}

body[data-theme="dark"][data-palette="yellow"] {
  --primary: #e8c349;
  --on-primary: #3e2e00;
  --surface-tint: #4d421b;
  --surface-soft: #302d21;
}

body[data-theme="dark"][data-palette="green"] {
  --primary: #a8d98f;
  --on-primary: #123800;
  --surface-tint: #2b4726;
  --surface-soft: #243124;
}

body[data-theme="dark"][data-palette="blue"] {
  --primary: #91cef8;
  --on-primary: #003351;
  --surface-tint: #1d4059;
  --surface-soft: #202d38;
}

body[data-theme="dark"][data-palette="lavender"] {
  --primary: #b7c8ff;
  --on-primary: #203560;
  --surface-tint: #303b5f;
  --surface-soft: #262c3d;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(115deg, var(--glow-a), transparent 34%),
    linear-gradient(250deg, var(--glow-b), transparent 38%),
    var(--bg);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[hidden] {
  display: none !important;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.material-symbols-rounded {
  font-variation-settings: "FILL" 0, "wght" 600, "GRAD" 0, "opsz" 24;
  line-height: 1;
}

.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  flex-direction: column;
  padding: 20px;
  gap: 16px;
}

.topbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 8px 10px 8px 18px;
  border: 1px solid var(--soft-border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand-logo {
  width: min(280px, 100%);
  height: auto;
  display: block;
  object-fit: contain;
  filter: none;
}

.topbar-actions,
.chat-header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.workspace {
  display: grid;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 16px;
  grid-template-columns: minmax(0, 1.6fr) minmax(340px, 0.74fr);
}

.panel {
  display: flex;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--soft-border);
  background: var(--panel-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--soft-border);
}

.brand h1,
.panel-header h2,
.settings-card h2,
.auth-card h2 {
  margin: 0;
}

.panel-header h2,
.settings-card h2,
.auth-card h2 {
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.2;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.segmented {
  display: inline-grid;
  overflow: hidden;
  min-height: 42px;
  border: 1px solid var(--outline);
  background: color-mix(in srgb, var(--surface-soft) 86%, transparent);
  border-radius: 999px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segment {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  color: var(--muted);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 700;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.segment.active {
  color: var(--on-primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 78%, white 22%);
}

.segment.in-dev {
  min-width: 108px;
}

.icon-button {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--primary);
  background: color-mix(in srgb, var(--surface-tint) 84%, transparent);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--outline) 66%, transparent);
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.link-button {
  text-decoration: none;
}

.icon-button:hover,
.send-button:hover,
.run-button:hover,
.filled-button:hover,
.close-preview:hover {
  transform: translateY(-1px);
}

.icon-button:hover,
.mini-button:hover,
.text-button:hover {
  background: color-mix(in srgb, var(--surface-tint) 94%, var(--surface) 6%);
}

.editor-surface {
  min-height: 0;
  flex: 1;
  background: var(--editor-bg);
}

.cm-editor {
  height: 100%;
  background: var(--editor-bg);
  font-size: 14px;
}

.cm-scroller {
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
}

.cm-gutters {
  border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--soft-border);
  background: var(--surface);
}

.status-stack {
  display: grid;
  gap: 8px;
}

.status-pill,
.session-badge,
.notice-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 700;
}

.status-pill {
  color: var(--muted);
}

.status-pill .material-symbols-rounded {
  color: #2f7d32;
  font-size: 1.1rem;
}

.session-badge {
  padding: 10px 14px;
  color: var(--primary);
  background: color-mix(in srgb, var(--surface-soft) 82%, transparent);
}

.notice-box {
  padding: 14px 16px;
  color: var(--primary);
  background: color-mix(in srgb, var(--surface-soft) 82%, transparent);
  border-radius: var(--radius-sm);
  line-height: 1.45;
}

.run-button,
.filled-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  color: var(--on-primary);
  background: var(--primary);
  border-radius: 999px;
  box-shadow: none;
  font-weight: 700;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.chat-panel {
  position: relative;
  background: var(--chat-panel-bg);
}

.chat-list-panel {
  position: absolute;
  top: 78px;
  right: 16px;
  left: 16px;
  z-index: 8;
  display: grid;
  gap: 12px;
  max-height: min(380px, 55vh);
  padding: 16px;
  border: 1px solid var(--soft-border);
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.chat-list-header,
.chat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-list-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--soft-border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.project-card-top,
.project-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.project-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.projects-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px;
}

.projects-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 10px 12px 10px 18px;
  border: 1px solid var(--soft-border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.projects-logo {
  width: min(240px, 100%);
}

.projects-layout {
  display: grid;
  gap: 14px;
}

.projects-section {
  padding-bottom: 18px;
}

.projects-hero-copy,
.projects-hero-actions {
  padding: 0 16px;
}

.projects-hero-copy p {
  margin: 0;
  max-width: 64ch;
  color: var(--muted);
  line-height: 1.55;
}

.projects-hero-actions {
  display: flex;
  gap: 10px;
}

.projects-list,
.projects-import-form {
  display: grid;
  gap: 12px;
  padding: 0 16px;
}

.danger-button {
  color: var(--accent);
}

.projects-page {
  overflow: hidden;
}

.compact-projects-shell {
  display: grid;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr);
}

.compact-projects-topbar {
  margin-bottom: 0;
}

.compact-projects-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compact-projects-layout {
  min-height: 0;
  overflow: hidden;
}

.projects-layout-regular {
  grid-template-columns: minmax(240px, 0.62fr) minmax(0, 1.18fr) minmax(0, 1.18fr);
}

.projects-layout-admin {
  grid-template-columns: minmax(220px, 0.56fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
}

.admin-layout {
  grid-template-columns: minmax(280px, 0.8fr) minmax(280px, 0.8fr) minmax(0, 1.4fr);
}

.compact-projects-sidebar,
.compact-projects-column {
  min-height: 0;
}

.compact-projects-sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.compact-projects-copy {
  padding-bottom: 8px;
}

.compact-projects-copy p {
  max-width: 30ch;
  font-size: 0.95rem;
}

.compact-import-form {
  align-content: start;
  min-height: 0;
}

.compact-projects-list {
  min-height: 0;
  overflow: auto;
  align-content: start;
  padding-bottom: 16px;
}

.project-card-heading {
  min-width: 0;
}

.project-card-heading strong {
  display: block;
}

.admin-list-card {
  cursor: pointer;
}

.admin-list-card:hover {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--soft-border));
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface) 28%);
}

.admin-detail-panel {
  min-width: 0;
}

.admin-detail-content {
  align-content: start;
}

.admin-code-preview {
  max-height: 360px;
  border-radius: var(--radius-xs);
}

.chat-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.chat-row-main,
.chat-row-delete {
  border-radius: var(--radius-xs);
}

.chat-row-main {
  display: grid;
  flex: 1;
  gap: 4px;
  padding: 14px 16px;
  text-align: left;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-soft) 82%, transparent);
}

.chat-row-main span {
  color: var(--muted);
  font-size: 0.77rem;
}

.chat-row.active .chat-row-main {
  outline: 2px solid var(--primary);
}

.chat-row-delete {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--accent);
  background: var(--surface-soft);
}

.chat-list-empty {
  padding: 12px;
  color: var(--muted);
  text-align: center;
}

.chat-log {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.message {
  display: grid;
  gap: 8px;
  max-width: 100%;
}

.message.user {
  justify-items: end;
}

.bubble {
  width: fit-content;
  max-width: min(100%, 620px);
  padding: 14px 16px;
  border-radius: 24px;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-soft) 82%, transparent);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.user .bubble {
  color: var(--on-primary);
  background: var(--primary);
}

.meta {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.thinking {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(23, 107, 85, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.prompt-note,
.code-offer {
  width: 100%;
  border: 1px solid var(--soft-border);
  background: var(--surface);
  border-radius: var(--radius-sm);
}

.prompt-note summary,
.code-offer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.prompt-note p {
  margin: 0;
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.code-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
}

.mini-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.79rem;
  font-weight: 800;
}

.mini-button {
  color: var(--primary);
  background: color-mix(in srgb, var(--surface-tint) 82%, transparent);
}

.text-button {
  color: var(--primary);
  background: color-mix(in srgb, var(--surface-soft) 58%, transparent);
}

.code-preview {
  display: none;
  overflow: auto;
  max-height: 310px;
  margin: 0;
  padding: 12px;
  color: #d8dee9;
  background: #15171c;
  border-top: 1px solid rgba(98, 112, 106, 0.18);
  font: 0.78rem/1.55 "Cascadia Code", Consolas, monospace;
  white-space: pre;
}

.code-offer.open .code-preview {
  display: block;
}

.composer {
  display: grid;
  align-items: end;
  gap: 10px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--soft-border);
  background: var(--surface);
  grid-template-columns: minmax(0, 1fr) auto;
}

.composer textarea {
  width: 100%;
  min-height: 60px;
  max-height: 150px;
  resize: vertical;
  border: 1px solid var(--outline);
  outline: none;
  padding: 14px 16px;
  color: var(--ink);
  background: var(--input-bg);
  border-radius: 24px;
  line-height: 1.35;
}

.composer textarea:focus,
.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 22%, transparent);
}

.send-button {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: var(--on-primary);
  background: var(--primary);
  border-radius: 999px;
  box-shadow: none;
  transition: transform 140ms ease;
}

.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #ffffff;
}

.preview-overlay[hidden],
.chat-list-panel[hidden] {
  display: none;
}

.preview-overlay iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.close-preview {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 101;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  color: var(--on-primary);
  background: var(--primary);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.settings-dialog,
.auth-dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  background: transparent;
}

.settings-dialog::backdrop,
.auth-dialog::backdrop {
  background: rgba(21, 32, 27, 0.42);
  backdrop-filter: blur(6px);
}

.settings-card,
.auth-card {
  display: grid;
  gap: 14px;
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--soft-border);
}

.auth-card {
  gap: 18px;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--surface-soft) 78%, transparent), transparent 48%),
    var(--surface);
}

.dialog-title-row,
.dialog-actions,
.switch-row,
.auth-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-tabs {
  width: 100%;
  justify-content: flex-start;
}

.auth-tabs .segment {
  min-height: 42px;
  width: 100%;
}

.auth-hero {
  align-items: flex-start;
}

.auth-subtitle {
  margin: 10px 0 0;
  max-width: 44ch;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.compact-subtitle {
  margin: 0;
  font-size: 0.86rem;
}

.auth-close-button {
  flex-shrink: 0;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.field input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--outline);
  outline: 0;
  padding: 0 16px;
  color: var(--ink);
  background: var(--input-bg);
  border-radius: 18px;
}

.palette-field {
  display: grid;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.palette-options {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 8px;
}

.palette-swatch {
  position: relative;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border: 2px solid transparent;
  background: var(--swatch);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 8px 18px rgba(0, 0, 0, 0.12);
}

.palette-swatch.system {
  --swatch: conic-gradient(#f7f8fa 0 25%, #c9cacc 0 50%, #555 0 75%, #f7f8fa 0);
}

.palette-swatch.pink {
  --swatch: #f5a0ad;
}

.palette-swatch.orange {
  --swatch: #ffb75c;
}

.palette-swatch.yellow {
  --swatch: #f8cb26;
}

.palette-swatch.green {
  --swatch: #8ed36d;
}

.palette-swatch.blue {
  --swatch: #7ec5f5;
}

.palette-swatch.lavender {
  --swatch: #adc2ee;
}

.palette-swatch.active {
  border-color: var(--primary);
}

.palette-swatch.active::after {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  content: "check";
  color: var(--on-primary);
  background: var(--primary);
  border: 3px solid var(--surface);
  border-radius: 50%;
  font-family: "Material Symbols Rounded";
  font-size: 16px;
  font-variation-settings: "FILL" 0, "wght" 700, "GRAD" 0, "opsz" 20;
}

.switch-row {
  min-height: 48px;
  padding: 4px 2px;
  color: var(--ink);
  font-weight: 700;
}

.switch-row input {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 auto;
  appearance: none;
  border: 2px solid var(--outline);
  background: var(--surface-soft);
  border-radius: 999px;
  transition: background 160ms ease, border-color 160ms ease;
}

.switch-row input::before {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 16px;
  height: 16px;
  content: "";
  background: var(--muted);
  border-radius: 50%;
  transition: transform 160ms ease, background 160ms ease;
}

.switch-row input:checked {
  border-color: var(--primary);
  background: var(--primary);
}

.switch-row input:checked::before {
  background: var(--on-primary);
  transform: translateX(20px);
}

.dialog-actions {
  justify-content: flex-end;
  padding-top: 4px;
}

.auth-form,
.auth-footer {
  display: grid;
  gap: 12px;
}

.auth-actions {
  justify-content: space-between;
  align-items: stretch;
  flex-wrap: nowrap;
}

.auth-actions > * {
  flex: 1 1 0;
}

.account-manage-note {
  margin: 0;
}

.auth-error {
  margin: 0;
  padding: 12px 14px;
  color: #a50e0e;
  background: rgba(229, 57, 53, 0.12);
  border-radius: 18px;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .projects-page {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
    padding: 12px;
  }

  .workspace {
    overflow: visible;
    grid-template-columns: 1fr;
  }

  .editor-panel {
    min-height: 68vh;
  }

  .chat-panel {
    min-height: 58vh;
  }

  .chat-list-panel {
    top: 86px;
    right: 12px;
    left: 12px;
    max-height: min(56vh, 420px);
  }

  .compact-projects-shell {
    display: block;
    height: auto;
    overflow: visible;
  }

  .compact-projects-layout {
    overflow: visible;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .topbar,
  .panel-header,
  .editor-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .chat-header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .brand-logo {
    width: min(260px, 100%);
  }

  .app-shell {
    gap: 10px;
    padding: 10px;
  }

  .panel-header,
  .editor-footer,
  .dialog-title-row,
  .dialog-actions,
  .auth-actions {
    gap: 10px;
  }

  .segmented,
  .run-button {
    width: 100%;
  }

  .workspace {
    gap: 10px;
  }

  .editor-panel {
    min-height: 54vh;
  }

  .chat-panel {
    min-height: 52vh;
  }

  .chat-log {
    padding: 12px;
  }

  .session-badge,
  .status-pill {
    width: 100%;
    justify-content: center;
  }

  .composer {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .composer textarea {
    min-height: 112px;
  }

  .send-button {
    width: 100%;
    height: 46px;
  }

  .settings-dialog,
  .auth-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    margin: 8px;
  }

  .settings-card,
  .auth-card {
    gap: 12px;
    padding: 16px;
  }

  .dialog-title-row {
    align-items: flex-start;
  }

  .auth-hero {
    flex-direction: row;
  }

  .auth-subtitle {
    font-size: 0.88rem;
  }

  .palette-options {
    gap: 10px;
  }

  .palette-swatch {
    width: 48px;
    height: 48px;
  }

  .chat-list-panel {
    right: 10px;
    left: 10px;
    padding: 12px;
  }

  .close-preview {
    top: 10px;
    right: 10px;
  }

  .bubble {
    max-width: 100%;
  }

  .auth-actions,
  .dialog-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .auth-actions .filled-button,
  .auth-actions .text-button,
  .dialog-actions .filled-button,
  .dialog-actions .text-button {
    width: 100%;
  }

  .projects-hero-actions,
  .project-card-top,
  .project-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .compact-projects-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }
}
