﻿:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: #ffffff;
  --panel-2: #fbfbfc;
  --text: #111113;
  --muted: #6b6b73;
  --soft: #8e8e93;
  --line: #dfdfe4;
  --line-strong: #c8c8cf;
  --black: #111113;
  --black-hover: #2a2a2d;
  --button-bg: #111113;
  --button-text: #ffffff;
  --button-hover: #2a2a2d;
  --control-bg: #ffffff;
  --hover-bg: #f0f0f2;
  --soft-bg: #fafafa;
  --chip-bg: #eeeeef;
  --table-alt: #f7f7f8;
  --danger-bg: #fff8f8;
  --danger-hover: #fff1f1;
  --success: #1f7a3f;
  --warning: #8a5a00;
  --danger: #9b1c1c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
  --font-sans: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI Variable Text", "Segoe UI", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei UI", "Microsoft YaHei", "Hiragino Sans GB", Arial, sans-serif;
  --font-display: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI Variable Display", "Segoe UI Variable Text", "Segoe UI", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei UI", "Microsoft YaHei", "Hiragino Sans GB", Arial, sans-serif;
  --font-mono: "SF Mono", "SFMono-Regular", ui-monospace, "Cascadia Code", "Cascadia Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --radius-ui: 10px;
  --radius-control: 9px;
  --radius-small: 7px;
  --radius-pill: 999px;
  --weight-regular: 400;
  --weight-medium: 450;
  --weight-semibold: 600;
  --weight-bold: 700;
  --ui-font-scale: 1;
}

html[data-reading-size="smaller"] { --ui-font-scale: 0.9; }
html[data-reading-size="medium"] { --ui-font-scale: 1.1; }
html[data-reading-size="large"] { --ui-font-scale: 1.2; }
html[data-reading-size="extra-large"] { --ui-font-scale: 1.3; }

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111113;
  --panel: #1b1b1e;
  --panel-2: #202024;
  --text: #f4f4f5;
  --muted: #a0a0a8;
  --soft: #777780;
  --line: #303036;
  --line-strong: #4a4a52;
  --black: #f4f4f5;
  --black-hover: #d7d7dc;
  --button-bg: #f4f4f5;
  --button-text: #111113;
  --button-hover: #d7d7dc;
  --control-bg: #202024;
  --hover-bg: #29292e;
  --soft-bg: #18181b;
  --chip-bg: #2a2a30;
  --table-alt: #202024;
  --danger-bg: #351d20;
  --danger-hover: #432327;
  --success: #4bd27f;
  --warning: #e5b85c;
  --danger: #ff8585;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  font-size: calc(16px * var(--ui-font-scale));
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: var(--weight-regular);
  font-synthesis-weight: none;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
.project-title,
.topbar-title h1 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  letter-spacing: 0;
}

strong {
  font-weight: var(--weight-semibold);
}

button,
input,
select,
textarea {
  font-family: var(--font-sans);
  font-size: inherit;
  font-weight: var(--weight-regular);
  letter-spacing: 0;
}

button {
  border: 0;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.file-mode-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.file-mode-card {
  width: min(520px, 100%);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  box-shadow: var(--shadow);
}

.file-mode-card h1 {
  margin-bottom: 12px;
  font-size: calc(28px * var(--ui-font-scale));
  line-height: 1.2;
}

.file-mode-card p {
  color: var(--muted);
  line-height: 1.7;
}

.login-shell {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 22px;
  align-items: stretch;
}

.login-intro,
.login-panel,
.surface,
.pane,
.mini-panel,
.metric,
.list-row,
.feature-button,
.history-item,
.prompt-editor,
.admin-table,
.model-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
}

.login-intro {
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 34px;
  box-shadow: var(--shadow);
}

.login-panel {
  padding: 26px;
  box-shadow: var(--shadow);
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--soft-bg);
}

.auth-mode-tab {
  min-height: 38px;
  border-radius: calc(var(--radius-ui) - 2px);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.auth-mode-tab.active {
  background: var(--button-bg);
  color: var(--button-text);
  font-weight: var(--weight-semibold);
}

.auth-mode-tab:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.auth-form {
  display: grid;
  gap: 15px;
}

.auth-form h2 {
  margin-bottom: 4px;
}

.auth-password-grid,
.account-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.auth-submit {
  width: 100%;
  min-height: 42px;
  margin-top: 2px;
}

.auth-development-delivery {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--soft-bg);
  color: var(--text);
}

.auth-development-delivery strong {
  font-size: calc(13px * var(--ui-font-scale));
}

.auth-development-delivery p {
  margin: 0;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.55;
}

.auth-development-delivery .button-muted {
  justify-self: start;
}

.auth-switch-link {
  justify-self: center;
  color: var(--muted);
}

.auth-consent {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.55;
}

.auth-consent input {
  margin-top: 3px;
  accent-color: var(--black);
}

.auth-consent a {
  color: var(--text);
  font-weight: var(--weight-semibold);
}

.auth-closed-note,
.dev-login-block {
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.55;
}

.auth-status-note {
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-bg);
  color: var(--text);
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.55;
}

.auth-status-note.is-success {
  border-color: var(--line-strong);
  color: var(--success);
}

.auth-status-note.is-warn {
  border-color: var(--line-strong);
  color: var(--danger);
}

.dev-login-block {
  display: grid;
  gap: 8px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.dev-login-block > span {
  color: var(--text);
  font-weight: var(--weight-semibold);
}

.dev-login-block p {
  margin: 0;
}

.dev-login-actions {
  display: flex;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(calc(36px * var(--ui-font-scale)), 6vw, calc(64px * var(--ui-font-scale)));
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: calc(24px * var(--ui-font-scale));
  line-height: 1.2;
}

h3 {
  margin-bottom: 8px;
  font-size: calc(16px * var(--ui-font-scale));
  line-height: 1.3;
}

.lead {
  max-width: 620px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: calc(17px * var(--ui-font-scale));
  line-height: 1.75;
}

.login-points {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.login-points li {
  display: flex;
  gap: 10px;
  align-items: center;
}

.dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--black);
}

.role-options {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.role-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 82px;
  padding: 16px;
  color: var(--text);
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  cursor: pointer;
}

.role-button:hover {
  border-color: var(--black);
  background: var(--control-bg);
}

.role-button strong {
  display: block;
  margin-bottom: 4px;
  font-size: calc(15px * var(--ui-font-scale));
}

.role-button span {
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.5;
}

.arrow {
  color: var(--soft);
  font-size: calc(22px * var(--ui-font-scale));
}

.app-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 164px minmax(0, 1fr);
}

html[data-reading-size="large"] .app-layout:not(.user-layout) {
  grid-template-columns: 190px minmax(0, 1fr);
}

html[data-reading-size="extra-large"] .app-layout:not(.user-layout) {
  grid-template-columns: 210px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  /* Keep tooltips and account menus above workspace panels, below modals (30). */
  z-index: 20;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 0;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: 18px 0 44px rgba(0, 0, 0, 0.035);
}

.brand {
  padding: 24px 16px 18px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 10px;
  background: var(--button-bg);
  color: var(--button-text);
  font-weight: var(--weight-bold);
}

.brand-title {
  margin: 0;
  font-size: calc(14px * var(--ui-font-scale));
  font-weight: var(--weight-bold);
  line-height: 1.18;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: calc(10.5px * var(--ui-font-scale));
}

.sidebar-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  padding: 0;
}

.sidebar-tool-button {
  width: 33px;
  height: 33px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--control-bg);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar-tool-button:hover,
.sidebar-tool-button:focus-visible {
  border-color: var(--line-strong);
  background: var(--hover-bg);
  color: var(--text);
  outline: none;
  transform: translateY(-1px);
}

.sidebar-tool-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.nav {
  flex: 1;
  overflow: auto;
  padding: 12px 10px;
}

.nav-section {
  margin: 18px 8px 8px;
  color: var(--soft);
  font-size: calc(11px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
  letter-spacing: 0;
  text-transform: none;
}

.nav-button {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border-radius: 11px;
  cursor: pointer;
  text-align: left;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
  color: currentColor;
}

.nav-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-button:hover {
  background: color-mix(in srgb, var(--text) 4%, var(--control-bg));
  color: var(--text);
}

.nav-button.active {
  background: color-mix(in srgb, var(--text) 8%, var(--control-bg));
  color: var(--text);
}

.sidebar-footer {
  padding: 10px 8px 12px;
  border-top: 0;
}

/* Compact account utilities. Feather 4.29.2 icons are served locally. */
.sidebar-utilities { display: grid; gap: 8px; padding: 10px 0 0; border-top: 1px solid var(--line); }
.sidebar-utility-row { display: grid; grid-template-columns: minmax(0, 1fr) 36px; gap: 7px; }
.utility-button {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 0; height: 36px; padding: 0 9px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--control-bg); color: var(--text);
  font: inherit; font-size: calc(12px * var(--ui-font-scale)); cursor: pointer; position: relative;
}
.utility-button:hover { background: var(--panel-2); border-color: var(--muted); }
.utility-button:focus-visible, .account-dropdown button:focus-visible, .notification-item-heading:focus-visible {
  outline: 2px solid var(--text); outline-offset: 3px;
}
.utility-icon { display: inline-block; width: 16px; height: 16px; flex: 0 0 16px; background: currentColor; mask: var(--utility-icon) center / contain no-repeat; }
.utility-icon-zap { --utility-icon: url("vendor/feather/zap.svg"); }
.utility-icon-bell { --utility-icon: url("vendor/feather/bell.svg"); }
.utility-icon-settings { --utility-icon: url("vendor/feather/settings.svg"); }
.utility-icon-chevron-down { --utility-icon: url("vendor/feather/chevron-down.svg"); }
.utility-icon-log-out { --utility-icon: url("vendor/feather/log-out.svg"); }
.utility-icon-user { --utility-icon: url("vendor/feather/user.svg"); }
.points-trigger { justify-content: flex-start; font-weight: 600; font-variant-numeric: tabular-nums; }
.points-trigger [data-points-value] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.points-trigger:has(.points-unlimited) { justify-content: center; gap: 8px; }
.points-trigger .points-unlimited {
  display: inline-flex; align-items: center; justify-content: center;
  width: calc(26px * var(--ui-font-scale)); height: calc(26px * var(--ui-font-scale)); flex: 0 0 calc(26px * var(--ui-font-scale));
  font-family: Arial, sans-serif; font-size: calc(26px * var(--ui-font-scale)); font-weight: 400;
  line-height: 1; color: currentColor;
}
.notification-trigger, .settings-trigger { padding: 0; }
.notification-badge { position: absolute; top: -5px; right: -4px; min-width: 16px; padding: 0 4px; height: 16px; line-height: 16px; border-radius: 9px; background: #c62840; color: #fff; font-size: calc(10px * var(--ui-font-scale)); font-weight: 600; box-shadow: 0 0 0 2px var(--panel); }
.notification-badge[hidden] { display: none; }
.account-menu-anchor { min-width: 0; position: relative; }
.account-trigger { width: 100%; justify-content: flex-start; padding: 0 6px; gap: 5px; }
.account-trigger .utility-avatar { width: 22px; height: 22px; font-size: calc(10px * var(--ui-font-scale)); flex: 0 0 22px; }
.account-display-name { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.account-trigger .utility-icon { width: 12px; height: 12px; flex-basis: 12px; color: var(--muted); }
.account-dropdown {
  position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 80; width: 200px; max-width: calc(100vw - 24px);
  padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  box-shadow: 0 8px 28px rgba(0,0,0,.12);
}
.account-dropdown-name { margin: 0 0 3px; font-weight: 600; overflow-wrap: anywhere; font-size: calc(13px * var(--ui-font-scale)); }
.account-dropdown > .muted-note { margin: 0 0 8px; }
.account-dropdown button { display: flex; gap: 8px; align-items: center; width: 100%; padding: 9px 6px; border: 0; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; text-align: left; font-size: calc(13px * var(--ui-font-scale)); }
.account-dropdown button:hover { background: var(--panel-2); }
.has-tooltip::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 0;
  width: max-content; max-width: min(240px, calc(100vw - 28px)); padding: 7px 10px; border-radius: 6px;
  background: var(--text); color: var(--panel); font-size: calc(12px * var(--ui-font-scale)); font-weight: 400; line-height: 1.5;
  white-space: normal; pointer-events: none; opacity: 0; visibility: hidden; z-index: 100;
}
.has-tooltip:hover::after, .has-tooltip:focus-visible::after { opacity: 1; visibility: visible; }
.tooltips-dismissed .has-tooltip::after { visibility: hidden; }
.settings-language-options { display: flex; flex-wrap: wrap; gap: 6px; }
.settings-language-options [aria-pressed="true"] { border-color: var(--text); font-weight: 600; }
.notification-panel { width: min(620px, calc(100vw - 24px)); }
.notification-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.notification-toolbar > span { margin-right: auto; }
.notification-list { display: grid; gap: 10px; }
.notification-item { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.notification-item.unread { border-left: 3px solid var(--text); }
.notification-item-heading { width: 100%; display: grid; gap: 8px; padding: 14px; text-align: left; color: var(--text); background: var(--control-bg); border: 0; cursor: pointer; }
.notification-item-heading:hover { background: var(--panel-2); }
.notification-item-heading strong { font-size: calc(14px * var(--ui-font-scale)); overflow-wrap: anywhere; }
.notification-item-meta { display: flex; align-items: center; gap: 10px; font-size: calc(11px * var(--ui-font-scale)); color: var(--muted); flex-wrap: wrap; }
.notification-unread-label { color: #be2940; margin-left: auto; }
.notification-content { padding: 0 14px 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: calc(14px * var(--ui-font-scale)); line-height: 1.8; }
.notification-empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.notification-empty > .utility-icon { width: 28px; height: 28px; }
.notification-empty h3 { color: var(--text); font-size: calc(15px * var(--ui-font-scale)); margin: 14px 0 8px; }
.notification-empty p { font-size: calc(13px * var(--ui-font-scale)); }
.notification-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.notification-publish-error { color: #be2940; font-size: calc(13px * var(--ui-font-scale)); }
@media (max-width: 520px) {
  .notification-form-grid { grid-template-columns: 1fr; gap: 0; }
  .sidebar-utility-row { grid-template-columns: minmax(0, 1fr) 40px; }
  .utility-button { height: 40px; }
  .notification-trigger.has-tooltip::after, .settings-trigger.has-tooltip::after { left: auto; right: 0; }
}

.sidebar-footer-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
  margin-bottom: 10px;
}

.user-card {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.sidebar-account-card {
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px 10px;
  padding: 11px;
  border: 1px solid color-mix(in srgb, var(--line) 62%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--control-bg) 96%, transparent);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.05);
}

.sidebar-account-card .avatar {
  width: 32px;
  height: 32px;
}

.sidebar-account-card .sidebar-tools {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  justify-content: stretch;
  margin-top: 3px;
}

.sidebar-account-card .sidebar-tool-button {
  width: 100%;
  height: 32px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--control-bg) 92%, var(--panel-2));
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.035);
}

.sidebar-account-card .sidebar-tool-button svg {
  width: 15px;
  height: 15px;
}

.sidebar-tool-wrap {
  position: relative;
  min-width: 0;
}

.sidebar-tool-wrap .sidebar-tool-button.active {
  background: color-mix(in srgb, var(--text) 8%, var(--control-bg));
  color: var(--text);
}

.language-menu {
  position: absolute;
  right: -4px;
  bottom: calc(100% + 8px);
  z-index: 60;
  width: 142px;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 98%, transparent);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.13);
}

.language-option {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.language-option:hover {
  background: color-mix(in srgb, var(--text) 5%, var(--control-bg));
  color: var(--text);
}

.language-option.active {
  background: color-mix(in srgb, var(--text) 9%, var(--control-bg));
  color: var(--text);
}

.language-option span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--chip-bg);
  font-size: calc(10px * var(--ui-font-scale));
  font-weight: var(--weight-semibold);
}

.language-option strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: var(--weight-semibold);
}

.avatar {
  width: 30px;
  height: 30px;
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--chip-bg);
  color: var(--text);
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: var(--weight-semibold);
  line-height: 1;
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  object-fit: cover;
}

.avatar-button {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.avatar-button:hover,
.avatar-button:focus-visible {
  border-color: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 10%, transparent);
  outline: none;
}

.avatar-button:active {
  transform: scale(0.96);
}

.avatar-edit-indicator {
  width: 13px;
  height: 13px;
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: grid;
  place-items: center;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--text);
  color: var(--panel);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.avatar-edit-indicator svg {
  width: 7px;
  height: 7px;
}

.avatar-button:hover .avatar-edit-indicator,
.avatar-button:focus-visible .avatar-edit-indicator {
  opacity: 1;
}

.user-name {
  margin: 0;
  font-size: calc(13px * var(--ui-font-scale));
  font-weight: var(--weight-semibold);
}

.user-role {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
}

.logout-button {
  width: fit-content;
  min-height: 34px;
  margin-top: 10px;
  gap: 8px;
  padding: 0 12px;
}

.logout-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main {
  min-width: 0;
  padding: 22px;
}

.main-workbench {
  padding-top: 14px;
  padding-bottom: 10px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar-title h1 {
  margin: 0 0 6px;
  font-size: calc(28px * var(--ui-font-scale));
  line-height: 1.15;
}

.topbar-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-avatar {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--chip-bg);
  color: var(--text);
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: var(--weight-semibold);
  border: 1px solid var(--line);
  cursor: pointer;
}

.button,
.button-muted,
.button-plain {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: var(--radius-ui);
  cursor: pointer;
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.button {
  background: var(--button-bg);
  color: var(--button-text);
}

.button:hover {
  background: var(--button-hover);
}

.button-muted {
  background: var(--control-bg);
  color: var(--text);
  border: 1px solid var(--line);
}

.button-muted:hover {
  border-color: var(--line-strong);
  background: var(--hover-bg);
}

.source-sidebar-toggle {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 12px;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.source-sidebar-toggle svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  stroke: none;
}

.source-sidebar-toggle:hover {
  transform: translateY(-1px);
}

.source-sidebar-toggle:not(:disabled):active {
  transform: translateY(0) scale(0.965);
}

.project-group-toggle[aria-pressed="true"] {
  border-color: var(--button-bg);
  background: var(--button-bg);
  color: var(--button-text);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--button-bg) 14%, transparent);
}

.project-context-toggle[aria-pressed="true"] {
  border-color: var(--button-bg);
  background: var(--button-bg);
  color: var(--button-text);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--button-bg) 14%, transparent);
}

.project-context-toggle[aria-pressed="true"]:hover {
  border-color: var(--button-hover);
  background: var(--button-hover);
  color: var(--button-text);
}

.project-group-toggle[aria-pressed="true"]:hover {
  border-color: var(--button-hover);
  background: var(--button-hover);
  color: var(--button-text);
}

.button-danger {
  color: var(--danger);
  border-color: #e5b5b5;
  background: var(--danger-bg);
}

.button-danger:hover {
  border-color: #c77a7a;
  background: var(--danger-hover);
}

.button-plain {
  background: transparent;
  color: var(--muted);
}

.button-plain:hover {
  background: var(--hover-bg);
  color: var(--text);
}

.button:disabled,
.button-muted:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.workbench-grid {
  --workbench-card-height: calc(100vh - 38px);
  --source-panel-width: clamp(360px, 30vw, 520px);
  display: flex;
  gap: 14px;
  align-items: stretch;
  transition: gap 480ms cubic-bezier(0.4, 0, 0.2, 1);
}

.workbench-grid.source-collapsed {
  gap: 7px;
}

.surface {
  min-width: 0;
  overflow: hidden;
}

.workbench-grid > .workbench-nav-panel {
  flex: 0 0 var(--workbench-nav-width, 280px);
}

.workbench-grid > .source-panel {
  flex: 0 1 var(--source-panel-width);
  max-width: var(--source-panel-width);
  contain: paint;
}

.workbench-grid > .surface:not(.workbench-nav-panel):not(.source-panel) {
  flex: 1 1 0;
  min-width: 420px;
  contain: paint;
}

.surface-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.surface-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.5;
}

.project-title {
  display: inline-block;
  margin: 0;
  border-radius: var(--radius-small);
  cursor: text;
}

.project-title:hover {
  box-shadow: inset 0 -2px 0 var(--black);
}

.project-title-input {
  width: min(460px, 100%);
  min-height: 36px;
  padding: 0 8px;
  border-radius: var(--radius-small);
  font-size: calc(24px * var(--ui-font-scale));
  font-weight: var(--weight-bold);
  line-height: 1.15;
}

.surface-body {
  padding: 18px;
}

.feature-list {
  display: grid;
  gap: 5px;
  align-content: start;
  align-items: start;
}

.workbench-nav-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: max(620px, calc(100vh - 118px));
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.045);
}

.workbench-nav-resize-handle {
  position: absolute;
  top: 0;
  right: -8px;
  z-index: 12;
  width: 16px;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: ew-resize;
}

.workbench-nav-resize-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 48px;
  border-radius: var(--radius-pill);
  background: rgba(142, 142, 147, 0.42);
  transform: translate(-50%, -50%);
  transition: background 0.16s ease, height 0.16s ease;
}

.workbench-nav-resize-handle:hover::before,
body.is-resizing-workbench-nav .workbench-nav-resize-handle::before {
  height: 72px;
  background: rgba(18, 18, 20, 0.42);
}

.compact-header {
  padding: 22px 18px 14px;
  border-bottom: 0;
}

.compact-header h2 {
  font-size: calc(22px * var(--ui-font-scale));
  letter-spacing: 0;
}

.compact-header p {
  font-size: calc(12px * var(--ui-font-scale));
}

.workbench-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0 14px 14px;
  padding: 3px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 13px;
  background: color-mix(in srgb, var(--text) 3%, var(--control-bg));
  overflow: hidden;
  isolation: isolate;
}

.workbench-switch::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  border-radius: 10px;
  background: var(--button-bg);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
  transform: translate3d(0, 0, 0);
  transition:
    transform 360ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 240ms ease,
    background 180ms ease;
  will-change: transform;
  pointer-events: none;
}

.workbench-switch.is-projects::before {
  transform: translate3d(100%, 0, 0);
}

.workbench-switch button {
  position: relative;
  z-index: 1;
  min-height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: var(--weight-medium);
  transition: color 220ms ease, background 180ms ease, transform 220ms ease;
}

.workbench-switch button:hover {
  background: color-mix(in srgb, var(--text) 4%, transparent);
  color: var(--text);
}

.workbench-switch button.active {
  color: var(--button-text);
  background: transparent;
  box-shadow: none;
}

.workbench-switch button.active:hover {
  background: transparent;
  color: var(--button-text);
}

.workbench-switch button:active {
  transform: scale(0.985);
}

.workbench-switch button:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--button-text) 34%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .workbench-switch::before {
    transition: none;
  }

  .feature-button,
  .feature-button::before,
  .project-rail-item,
  .project-rail-item::before,
  .project-delete-button,
  .project-time-pill {
    transition: none;
  }

  .workbench-nav-body.nav-body-enter {
    animation: none;
  }
}

.workbench-nav-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 252px);
  overflow: auto;
  padding: 0 14px 14px;
}

.workbench-nav-body.nav-body-enter {
  animation: workbenchNavBodyEnter 180ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes workbenchNavBodyEnter {
  from {
    opacity: 0.72;
    transform: translate3d(0, 5px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.main-workbench .workbench-nav-panel {
  height: var(--workbench-card-height);
  min-height: 620px;
}

.main-workbench .workbench-nav-body {
  max-height: none;
}

.feature-button {
  width: 100%;
  position: relative;
  display: block;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  box-shadow: none;
  overflow: hidden;
  transform: translate3d(0, 0, 0);
  transition:
    color 220ms ease,
    border-color 220ms ease,
    transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.feature-button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: color-mix(in srgb, var(--text) 4%, var(--control-bg));
  opacity: 0;
  transform: scale(0.985);
  transition:
    opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    background 260ms ease;
  pointer-events: none;
}

.feature-button > * {
  position: relative;
  z-index: 1;
}

.feature-button:hover,
.feature-button:focus-visible {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.feature-button:hover::before,
.feature-button:focus-visible::before {
  opacity: 1;
  transform: scale(1);
}

.feature-button.active {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.feature-button.active::before {
  background: color-mix(in srgb, var(--text) 9%, var(--control-bg));
  opacity: 1;
  transform: scale(1);
}

.feature-button strong {
  display: block;
  margin-bottom: 4px;
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.25;
}

.feature-button span {
  display: block;
  color: var(--muted);
  font-size: calc(11px * var(--ui-font-scale));
  line-height: 1.35;
}

.feature-button em {
  display: inline-flex;
  margin-top: 6px;
  color: var(--soft);
  font-size: calc(10px * var(--ui-font-scale));
  font-style: normal;
  font-weight: var(--weight-medium);
}

.project-nav-head {
  margin-bottom: 10px;
}

.project-nav-head .button {
  width: 100%;
}

.status-line {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 0 9px;
  color: var(--muted);
  background: var(--control-bg);
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
}

.badge.dark {
  background: var(--button-bg);
  color: var(--button-text);
  border-color: var(--button-bg);
}

.badge.success {
  color: var(--success);
  border-color: rgba(31, 122, 63, 0.25);
  background: rgba(31, 122, 63, 0.06);
}

.badge.warn {
  color: var(--warning);
  border-color: rgba(138, 90, 0, 0.25);
  background: rgba(138, 90, 0, 0.06);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span,
.field label {
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--control-bg);
  color: var(--text);
  outline: none;
}

input,
select {
  min-height: 40px;
  padding: 0 12px;
}

textarea {
  min-height: 260px;
  padding: 12px;
  line-height: 1.65;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.result-control-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  padding: 12px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 58%, transparent);
  background: color-mix(in srgb, var(--panel) 92%, var(--soft-bg));
}

.result-control-bar .field {
  margin-bottom: 0;
  flex: 1 1 160px;
  min-width: 0;
  max-width: 100%;
}

.result-control-bar .model-picker-field {
  flex-basis: 260px;
}

.result-control-bar .field > span {
  white-space: nowrap;
}

.result-control-bar .compact-select {
  min-width: 0;
}

.native-model-select {
  display: none;
}

.model-picker-field {
  position: relative;
  min-width: 0;
}

.model-picker {
  position: relative;
  min-width: 0;
}

.model-picker-trigger,
.model-picker-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  background: var(--control-bg);
  color: var(--text);
}

.model-picker-trigger {
  min-height: 40px;
  padding: 0 36px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  position: relative;
}

.model-picker-trigger:hover,
.model-picker-trigger:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
  outline: none;
}

.model-picker-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.model-picker-trigger i {
  position: absolute;
  right: 12px;
  width: 8px;
  height: 8px;
  border-right: 1.8px solid #5f5f66;
  border-bottom: 1.8px solid #5f5f66;
  transform: rotate(45deg) translateY(-2px);
}

.model-picker-trigger > span:not(.model-choice-icon) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-picker-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(460px, 52vh);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-ui);
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.16);
}

.model-picker-group + .model-picker-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.model-picker-group-title {
  position: sticky;
  top: -8px;
  z-index: 1;
  margin: -8px -8px 4px;
  padding: 8px 10px 5px;
  background: var(--panel);
  color: var(--muted);
  font-size: calc(11px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
}

.model-picker-option {
  min-height: 34px;
  padding: 6px 8px;
  border-radius: var(--radius-small);
  font-size: calc(14px * var(--ui-font-scale));
  line-height: 1.35;
}

.model-picker-option:hover,
.model-picker-option.selected {
  background: var(--hover-bg);
}

.model-picker-option.selected {
  font-weight: var(--weight-semibold);
}

.model-picker-option > span:not(.model-choice-icon) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-choice-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: var(--radius-small);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px #ececf0;
}

.model-choice-icon img {
  width: 15px;
  height: 15px;
  display: block;
  object-fit: contain;
}

.model-choice-icon span {
  color: inherit;
  font-size: calc(9px * var(--ui-font-scale));
  font-weight: var(--weight-semibold);
  line-height: 1;
}

.model-picker-empty {
  margin: 0;
  padding: 10px;
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
}

.muted-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.55;
}

.field-help {
  margin-top: 6px;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.45;
}

.result-output,
.result-output-wrap,
.storyboard-output,
.storyboard-workspace,
.project-group-workspace,
.result-session {
  --result-panel-height: max(500px, calc(100vh - 350px));
}

.main-workbench .workbench-grid > .surface {
  height: var(--workbench-card-height);
  min-height: 620px;
}

.main-workbench .workbench-grid > .surface:not(.workbench-nav-panel) {
  display: flex;
  flex-direction: column;
  border-color: color-mix(in srgb, var(--line) 64%, transparent);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.055);
  overflow: hidden;
}

.main-workbench .source-panel .surface-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.main-workbench .source-panel {
  transform-origin: left center;
  transition:
    flex-basis 480ms cubic-bezier(0.4, 0, 0.2, 1),
    max-width 480ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 320ms ease,
    transform 480ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: flex-basis, max-width, opacity, transform;
}

.main-workbench .workbench-grid.source-collapsed .source-panel,
.main-workbench .source-panel.source-panel-hidden {
  flex-basis: 0;
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px) scaleX(0.992);
  pointer-events: none;
}

.main-workbench .workbench-grid.source-panel-transitioning .source-panel {
  overflow: hidden;
}

.main-workbench .source-panel .surface-header,
.main-workbench .source-panel .surface-body {
  transition: opacity 260ms ease;
}

.main-workbench .workbench-grid.source-collapsed .source-panel .surface-header,
.main-workbench .workbench-grid.source-collapsed .source-panel .surface-body,
.main-workbench .source-panel.source-panel-hidden .surface-header,
.main-workbench .source-panel.source-panel-hidden .surface-body {
  opacity: 0;
}

.main-workbench .result-output,
.main-workbench .result-output-wrap,
.main-workbench .storyboard-output,
.main-workbench .storyboard-workspace,
.main-workbench .project-group-workspace,
.main-workbench .result-session {
  --result-panel-height: max(540px, calc(100vh - 228px));
}

.result-session {
  height: var(--result-panel-height);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border-top: 1px solid color-mix(in srgb, var(--line) 58%, transparent);
  background: color-mix(in srgb, var(--panel) 96%, var(--panel-2));
}

.main-workbench .result-session {
  flex: 1;
  height: auto;
  min-height: 0;
}

.result-session > .result-output,
.result-session > .result-output-wrap,
.result-session > .storyboard-output,
.result-session > .storyboard-workspace,
.result-session > .project-group-workspace {
  min-height: 0;
  height: 100%;
  max-height: none;
  border-top: 0;
}

.result-output {
  height: var(--result-panel-height);
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 98%, var(--panel-2));
  padding: 18px;
  border-top: 1px solid color-mix(in srgb, var(--line) 54%, transparent);
  line-height: 1.48;
  font-family: var(--font-sans);
  font-size: calc(13px * var(--ui-font-scale));
}

.result-output-wrap {
  position: relative;
  height: var(--result-panel-height);
  overflow: hidden;
  border-top: 1px solid color-mix(in srgb, var(--line) 54%, transparent);
  background: color-mix(in srgb, var(--panel) 98%, var(--panel-2));
}

.result-output-wrap.streaming-result {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.result-output-wrap .result-output {
  height: 100%;
  border-top: 0;
}

.plain-result-output {
  padding-top: 18px;
}

.streaming-result .plain-result-output {
  padding-top: 18px;
}

.generation-status {
  align-items: center;
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
}

.generation-status-background {
  max-width: min(760px, 62vw);
  justify-content: flex-end;
}

.generation-background-hint {
  max-width: min(360px, 34vw);
  line-height: 1.4;
}

.generation-status-background .button-muted {
  flex: 0 0 auto;
}

.generation-inline-status {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--panel) 96%, var(--panel-2));
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
}

.generation-inline-status strong {
  color: var(--text);
}

.generation-inline-hint {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-inline-status .generation-pause-button {
  margin-left: auto;
  flex: 0 0 auto;
}

.result-chat-composer {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 18px 18px 18px;
  border-top: 1px solid color-mix(in srgb, var(--line) 58%, transparent);
  background: color-mix(in srgb, var(--panel) 94%, var(--panel-2));
}

.composer-resize-handle {
  position: absolute;
  top: 4px;
  left: 50%;
  width: 42px;
  height: 12px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  cursor: ns-resize;
  transform: translateX(-50%);
}

.composer-resize-handle::before {
  content: "";
  display: block;
  width: 24px;
  height: 3px;
  margin: 4px auto 0;
  border-radius: var(--radius-pill);
  background: #b9b9c0;
}

.composer-resize-handle:hover::before,
body.is-resizing-chat-composer .composer-resize-handle::before {
  background: #8e8e93;
}

.result-chat-composer textarea {
  width: 100%;
  min-height: 52px;
  max-height: min(48vh, 520px);
  flex: unset;
  resize: none;
  overflow: auto;
  line-height: 1.5;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 12px 14px 6px;
}

.result-chat-composer textarea:disabled {
  resize: none;
}

.result-chat-composer button:not(.composer-resize-handle):not(.composer-tool-button):not(.quick-phrase-close):not(.quick-phrase-add-button):not(.quick-phrase-send):not(.quick-phrase-icon):not(.translation-target-button) {
  align-self: flex-end;
  min-width: 52px;
  min-height: 52px;
}

.composer-action-button,
.icon-only-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--line) 58%, transparent);
  border-radius: var(--radius-control);
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.composer-action-button {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
}

.icon-only-button {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
}

.composer-action-send {
  color: var(--button-text);
  border-color: var(--button-bg);
  background: var(--button-bg);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--button-bg) 18%, transparent);
}

.source-generate-button {
  color: var(--button-text);
  border-color: var(--button-bg);
  background: var(--button-bg);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--button-bg) 14%, transparent);
}

.composer-action-pause,
.icon-only-button.button-danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger-bg) 76%, var(--panel));
}

.composer-action-button:hover,
.icon-only-button:hover {
  transform: translateY(-1px);
}

.composer-action-send:hover {
  background: var(--button-hover);
  border-color: var(--button-hover);
}

.source-generate-button:hover {
  background: var(--button-hover);
  border-color: var(--button-hover);
}

.composer-action-pause:hover,
.icon-only-button.button-danger:hover {
  background: var(--danger-hover);
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
}

.composer-action-button:active,
.icon-only-button:active {
  transform: translateY(0) scale(0.98);
}

.composer-action-button svg,
.icon-only-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-action-pause svg,
.icon-only-button.button-danger svg {
  fill: currentColor;
  stroke: none;
}

.composer-input-shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 14px;
  background: var(--control-bg);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 65%, transparent);
}

.composer-input-shell:focus-within {
  border-color: color-mix(in srgb, var(--line-strong) 82%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 7%, transparent);
}

.composer-toolbar {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 8px;
}

.composer-tool-button {
  width: 28px;
  height: 28px;
  min-width: 0 !important;
  min-height: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.composer-tool-button:hover {
  color: var(--text);
  background: var(--hover-bg);
}

.composer-tool-button.active {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, var(--hover-bg));
}

.composer-tool-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.composer-tool-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick-phrase-popover,
.translation-popover {
  position: absolute;
  left: 18px;
  bottom: calc(100% - 10px);
  z-index: 30;
  width: min(390px, calc(100% - 128px));
  max-height: min(360px, 54vh);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 66%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 94%, var(--panel-2));
  box-shadow:
    0 22px 50px color-mix(in srgb, #000 14%, transparent),
    inset 0 1px 0 color-mix(in srgb, #fff 72%, transparent);
}

.translation-popover {
  left: 96px;
  width: min(280px, calc(100% - 160px));
  gap: 12px;
}

.quick-phrase-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.quick-phrase-head strong {
  display: block;
  color: var(--text);
  font-size: calc(14px * var(--ui-font-scale));
  font-weight: 650;
  line-height: 1.25;
}

.quick-phrase-head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.35;
}

.quick-phrase-close,
.quick-phrase-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.quick-phrase-close {
  width: 28px;
  height: 28px;
  border-radius: 9px;
}

.quick-phrase-close:hover,
.quick-phrase-icon:hover {
  color: var(--text);
  background: var(--hover-bg);
}

.quick-phrase-close svg,
.quick-phrase-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick-phrase-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.quick-phrase-add input {
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 11px;
  color: var(--text);
  background: var(--control-bg);
  outline: none;
}

.quick-phrase-add input:focus {
  border-color: color-mix(in srgb, var(--line-strong) 80%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 7%, transparent);
}

.quick-phrase-add-button {
  height: 36px;
  min-width: 58px !important;
  min-height: 36px !important;
  align-self: stretch !important;
  padding: 0 14px;
  border-radius: 11px;
}

.quick-phrase-list {
  min-height: 0;
  max-height: 230px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quick-phrase-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border-radius: 12px;
}

.quick-phrase-item:hover {
  background: var(--hover-bg);
}

.quick-phrase-send {
  min-width: 0 !important;
  min-height: 0 !important;
  align-self: center !important;
  padding: 7px 8px;
  border: 0;
  border-radius: 9px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.45;
}

.quick-phrase-send:hover {
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.quick-phrase-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.quick-phrase-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
}

.quick-phrase-empty {
  margin: 4px 2px 2px;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.5;
}

.translation-target-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.translation-target-button {
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--line) 62%, transparent);
  border-radius: 11px;
  color: var(--text);
  background: color-mix(in srgb, var(--control-bg) 90%, var(--panel));
  cursor: pointer;
  transition:
    transform 140ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.translation-target-button span {
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: 450;
}

.translation-target-button strong {
  font-size: calc(13px * var(--ui-font-scale));
  font-weight: 650;
}

.translation-target-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--line-strong) 68%, transparent);
  background: var(--hover-bg);
}

.translation-target-button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
  transform: none;
}

.composer-attachments,
.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.composer-attachments {
  padding: 0 10px 8px;
}

.composer-attachment-chip,
.message-attachment-chip {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  color: var(--muted);
  background: color-mix(in srgb, var(--text) 4%, var(--control-bg));
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  border-radius: var(--radius-pill);
  font-size: calc(11px * var(--ui-font-scale));
  line-height: 1;
}

.composer-attachment-chip {
  padding: 5px 5px 5px 8px;
}

.message-attachments {
  margin-top: 8px;
}

.message-attachment-chip {
  padding: 5px 8px;
}

.composer-attachment-chip strong,
.message-attachment-chip strong {
  color: var(--text);
  font-weight: 600;
}

.composer-attachment-chip span,
.message-attachment-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-attachment-chip small {
  color: var(--muted);
  font-size: calc(10px * var(--ui-font-scale));
  white-space: nowrap;
}

.composer-attachment-chip button {
  width: 18px;
  height: 18px;
  min-width: 0 !important;
  min-height: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.composer-attachment-chip button:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.composer-attachment-chip button svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.is-resizing-chat-composer {
  cursor: ns-resize;
  user-select: none;
}

body.is-resizing-workbench-nav {
  cursor: ew-resize;
  user-select: none;
}

body.is-resizing-prompt-admin {
  cursor: ew-resize;
  user-select: none;
}

.generation-status strong {
  color: var(--text);
}

.icon-action.danger {
  color: var(--danger);
  border-color: #e5b5b5;
  background: var(--danger-bg);
}

.conversation-log {
  height: 100%;
  overflow: auto;
  padding: 16px 18px;
  color: var(--text);
  background: var(--panel);
}

.streaming-result .conversation-log {
  min-height: 0;
  height: auto;
  padding-top: 18px;
}

.conversation-empty {
  margin: 0;
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
}

.generation-error-inline {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 32%, var(--border));
  border-left: 3px solid var(--danger);
  border-radius: 6px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger-bg) 72%, var(--panel));
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.chat-message {
  margin: 0 0 14px;
}

.chat-message:last-child {
  margin-bottom: 0;
}

.user-message {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.chat-message-meta {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: calc(11px * var(--ui-font-scale));
}

.chat-bubble {
  word-break: break-word;
  color: var(--text);
  line-height: 1.45;
  font-size: calc(13px * var(--ui-font-scale));
}

.generation-status-message {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius-ui);
  background: var(--control-bg);
  color: var(--text);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.45;
}

.generation-status-message.is-failed {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 5%, var(--panel));
}

.generation-status-badge,
.generation-history-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: calc(11px * var(--ui-font-scale));
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.generation-status-message.is-failed .generation-status-badge,
.generation-history-status.is-failed {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  color: var(--danger);
}

.generation-status-detail {
  min-width: 0;
  flex: 1;
}

.generation-status-message time {
  color: var(--muted);
  white-space: nowrap;
}

.user-message-stack {
  max-width: min(72%, 560px);
  width: fit-content;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.user-message .chat-bubble {
  width: fit-content;
  max-width: min(100%, 560px);
  min-width: 0;
  min-height: 0;
  height: auto;
  display: inline-block;
  padding: 7px 12px;
  color: var(--text);
  background: var(--table-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  line-height: 1.42;
  white-space: normal;
}

.user-message-line {
  display: inline;
}

.user-message-line-empty {
  display: inline-block;
  height: 0.45em;
}

.user-message .message-tools {
  width: 100%;
  margin: 0;
  padding-right: 4px;
  justify-content: flex-end;
}

.assistant-message-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.assistant-message .message-tools {
  width: 100%;
  margin: 0;
  padding-left: 8px;
}

.message-frame {
  position: relative;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--control-bg);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.message-frame:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
}

.message-tools {
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  margin: 10px 0 0;
  opacity: 1;
  pointer-events: auto;
}

.message-tools:empty {
  display: none;
}

.message-tool {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  cursor: pointer;
}

.message-tool:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--hover-bg);
}

.message-tool:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}

.message-tool.active,
.message-tool[aria-pressed="true"] {
  color: var(--text);
  border-color: var(--line);
  background: var(--hover-bg);
}

.message-tool svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.message-tool svg.is-filled {
  fill: currentColor;
  stroke: currentColor;
}

.message-editor {
  display: grid;
  gap: 10px;
}

.message-edit-textarea {
  width: 100%;
  min-height: 140px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--control-bg);
  color: var(--text);
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.65;
  resize: vertical;
}

.assistant-message .message-edit-textarea {
  min-height: 260px;
}

.message-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.assistant-heading {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.model-mark {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #fff;
  background: #111113;
  border-radius: var(--radius-ui);
  font-size: calc(14px * var(--ui-font-scale));
  font-weight: var(--weight-semibold);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.model-mark svg {
  width: 23px;
  height: 23px;
  display: block;
}

.model-mark img {
  width: 24px;
  height: 24px;
  display: block;
  object-fit: contain;
}

.model-mark span {
  line-height: 1;
}

.model-openai {
  color: #111113;
  background: #fff;
  box-shadow: inset 0 0 0 1px #ececf0;
}

.model-claude {
  color: #111113;
  background: #fff;
  box-shadow: inset 0 0 0 1px #ececf0;
}

.model-gemini {
  color: #111113;
  background: #fff;
  box-shadow: inset 0 0 0 1px #ececf0;
}

.model-deepseek {
  color: #111113;
  background: #fff;
  box-shadow: inset 0 0 0 1px #ececf0;
}

.model-qwen {
  color: #111113;
  background: #fff;
  box-shadow: inset 0 0 0 1px #ececf0;
}

.model-doubao {
  color: #111113;
  background: #fff;
  box-shadow: inset 0 0 0 1px #ececf0;
}

.model-kimi {
  color: #fff;
  background: #111113;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16);
}

.model-grok {
  color: #111113;
  background: #fff;
  box-shadow: inset 0 0 0 1px #ececf0;
}

.model-generic {
  color: #111113;
  background: #fff;
  box-shadow: inset 0 0 0 1px #d8d8dc;
}

.model-choice-icon.model-generic span {
  color: #111113;
  font-size: calc(11px * var(--ui-font-scale));
  font-weight: var(--weight-semibold);
}

.assistant-model {
  color: var(--text);
  font-size: calc(14px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
  line-height: 1.3;
}

.assistant-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: calc(11px * var(--ui-font-scale));
  line-height: 1.35;
}

.assistant-inline-elapsed {
  margin-left: 6px;
  color: #7a7a82;
  font-size: calc(11px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
}

.assistant-inline-elapsed strong {
  color: #111113;
  font-weight: var(--weight-semibold);
}

.assistant-content {
  margin: 0;
  white-space: normal;
  word-break: break-word;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: inherit;
  font-weight: var(--weight-regular);
  line-height: 1.48;
}

.streaming-assistant-content {
  white-space: normal;
  overflow-wrap: anywhere;
}

.assistant-waiting-row {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
}

.assistant-waiting-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.assistant-waiting-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.32;
  animation: assistant-waiting-pulse 1.2s ease-in-out infinite;
}

.assistant-waiting-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.assistant-waiting-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes assistant-waiting-pulse {
  0%, 70%, 100% { opacity: 0.28; transform: translateY(0); }
  35% { opacity: 0.9; transform: translateY(-1px); }
}

.thinking-panel {
  width: 100%;
  overflow: hidden;
  color: var(--text);
  background: color-mix(in srgb, var(--control-bg) 88%, var(--page-bg));
  border: 1px solid var(--line);
  border-radius: 8px;
}

.thinking-panel summary {
  min-height: 44px;
  padding: 8px 12px;
  display: grid;
  grid-template-columns: 28px minmax(0, auto) minmax(0, 1fr) 12px;
  align-items: center;
  gap: 9px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.thinking-panel summary::-webkit-details-marker {
  display: none;
}

.thinking-panel summary:hover {
  background: var(--hover-bg);
}

.thinking-panel-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--page-bg);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.thinking-panel-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.thinking-panel-heading {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
}

.thinking-panel-heading strong {
  font-size: calc(13px * var(--ui-font-scale));
  font-weight: var(--weight-semibold);
}

.thinking-panel-heading small,
.thinking-panel-title {
  color: var(--muted);
  font-size: calc(11px * var(--ui-font-scale));
  font-weight: var(--weight-regular);
}

.thinking-panel-title {
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thinking-panel-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.thinking-panel[open] .thinking-panel-chevron {
  transform: rotate(225deg);
}

.thinking-panel-body {
  max-height: 220px;
  padding: 0 12px 12px 49px;
  overflow: auto;
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.55;
  scrollbar-gutter: stable;
}

.thinking-panel-body .formatted-text,
.thinking-panel-body .formatted-line {
  line-height: inherit;
}

.thinking-panel-empty {
  min-height: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.assistant-content-shell {
  position: relative;
}

.assistant-content-shell.is-collapsed {
  max-height: 260px;
  overflow: hidden;
}

.assistant-content-shell.is-collapsed::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 44px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--control-bg) 82%);
  pointer-events: none;
}

.content-collapse-toggle {
  width: fit-content;
  min-height: 28px;
  margin: 10px 0 0;
  padding: 5px 10px 5px 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  background: var(--hover-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.content-collapse-toggle:hover {
  color: var(--text);
  background: var(--control-bg);
  border-color: var(--line-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.content-collapse-toggle:focus-visible {
  outline: 2px solid rgba(17, 17, 19, 0.18);
  outline-offset: 2px;
}

.content-collapse-icon {
  width: 0;
  height: 0;
  display: inline-block;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}

.assistant-content-shell:not(.is-collapsed) + .content-collapse-toggle .content-collapse-icon {
  transform: rotate(180deg);
}

.formatted-text {
  line-height: 1.58;
  white-space: normal;
}

.formatted-line {
  min-height: 1.48em;
  margin: 0 0 0.42em;
}

.formatted-line-empty {
  min-height: 0.55em;
}

.formatted-text strong {
  font-weight: var(--weight-semibold);
}

.formatted-text em {
  font-style: italic;
}

.formatted-text del {
  color: var(--muted);
  text-decoration-thickness: 1px;
}

.formatted-text > :last-child {
  margin-bottom: 0;
}

.formatted-heading {
  margin: 0.85em 0 0.45em;
  font-weight: var(--weight-semibold);
  line-height: 1.28;
  letter-spacing: 0;
  color: var(--text);
}

.formatted-heading:first-child {
  margin-top: 0;
}

.formatted-heading-1 {
  font-size: calc(1.42rem * var(--ui-font-scale));
}

.formatted-heading-2 {
  font-size: calc(1.18rem * var(--ui-font-scale));
}

.formatted-heading-3 {
  font-size: calc(1.04rem * var(--ui-font-scale));
}

.formatted-heading-4 {
  margin-top: 0.7em;
  margin-bottom: 0.35em;
  font-size: calc(0.98rem * var(--ui-font-scale));
}

.formatted-heading-5 {
  margin-top: 0.62em;
  margin-bottom: 0.3em;
  font-size: calc(0.93rem * var(--ui-font-scale));
}

.formatted-heading-6 {
  margin-top: 0.58em;
  margin-bottom: 0.28em;
  color: var(--muted);
  font-size: calc(0.88rem * var(--ui-font-scale));
}

.formatted-list {
  margin: 0.35em 0 0.7em 1.35em;
  padding: 0;
}

.formatted-list li {
  margin: 0.22em 0;
  padding-left: 0.15em;
}

.formatted-list .formatted-list {
  margin-top: 0.28em;
  margin-bottom: 0.34em;
}

.formatted-task-list {
  list-style: none;
  margin-left: 0.2em;
}

.formatted-task-item {
  padding-left: 0;
}

.formatted-task-checkbox {
  width: 14px;
  height: 14px;
  margin: 0 7px 0 0;
  accent-color: var(--text);
  vertical-align: -2px;
  pointer-events: none;
}

.formatted-blockquote {
  margin: 0.65em 0 0.8em;
  padding: 0.12em 0 0.12em 14px;
  color: var(--muted);
  border-left: 3px solid var(--line-strong);
}

.formatted-blockquote > :last-child {
  margin-bottom: 0;
}

.formatted-divider {
  height: 1px;
  margin: 1em 0;
  border: 0;
  background: var(--line);
}

.formatted-inline-code {
  padding: 0.12em 0.36em;
  color: var(--text);
  background: var(--hover-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

.formatted-code-block {
  position: relative;
  max-width: 100%;
  margin: 0.72em 0 0.9em;
  padding: 14px 16px;
  overflow: auto;
  color: var(--text);
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  white-space: pre;
  tab-size: 2;
}

.formatted-code-block[data-language] {
  padding-top: 28px;
}

.formatted-code-block[data-language]::before {
  content: attr(data-language);
  position: absolute;
  top: 7px;
  right: 10px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: calc(10px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
  text-transform: uppercase;
}

.formatted-code {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.62;
}

.formatted-link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.formatted-link:hover {
  text-decoration-color: currentColor;
}

.formatted-link.is-disabled {
  color: inherit;
  text-decoration: none;
  cursor: text;
}

.formatted-image-reference::before {
  content: "[Image] ";
  color: var(--muted);
  font-size: 0.88em;
}

.formatted-table-wrap {
  width: 100%;
  max-width: 100%;
  margin: 0.65em 0 1em;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--panel);
}

.formatted-table {
  min-width: 760px;
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.formatted-table th,
.formatted-table td {
  padding: 9px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.52;
  text-align: left;
  vertical-align: top;
  white-space: pre-wrap;
  word-break: break-word;
}

.formatted-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--chip-bg);
  font-weight: var(--weight-semibold);
}

.formatted-table th:last-child,
.formatted-table td:last-child {
  border-right: 0;
}

.formatted-table tbody tr:last-child td {
  border-bottom: 0;
}

.formatted-table tbody tr:nth-child(odd) td {
  background: var(--control-bg);
}

.formatted-table tbody tr:nth-child(even) td {
  background: var(--table-alt);
}

.formatted-table [align="center"] {
  text-align: center;
}

.formatted-table [align="right"] {
  text-align: right;
}

.formatted-text.is-compact {
  line-height: 1.42;
}

.formatted-text.is-compact .formatted-line {
  min-height: 0;
  margin-bottom: 0.28em;
}

.formatted-text.is-compact .formatted-heading {
  margin-top: 0.52em;
  margin-bottom: 0.28em;
  font-size: 1em;
}

.formatted-text.is-compact .formatted-list {
  margin-top: 0.2em;
  margin-bottom: 0.35em;
}

.formatted-text.is-compact .formatted-code-block,
.formatted-text.is-compact .formatted-blockquote,
.formatted-text.is-compact .formatted-table-wrap {
  margin-top: 0.4em;
  margin-bottom: 0.45em;
}

.formatted-text.is-compact .formatted-table {
  min-width: 520px;
}

.storyboard-output {
  height: var(--result-panel-height);
  overflow: auto;
  padding: 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.storyboard-workspace,
.project-group-workspace {
  height: var(--result-panel-height);
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.storyboard-workspace .storyboard-output,
.project-group-workspace .storyboard-output,
.project-group-workspace .result-output-wrap,
.project-group-workspace .result-output {
  min-height: 100%;
  height: auto;
  max-height: none;
  overflow: visible;
  padding: 18px;
  border-top: 0;
}

.storyboard-main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
}

.project-group-main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: auto;
}

.storyboard-workspace .project-group-main {
  overflow: hidden;
}

.project-group-workspace .storyboard-conversation-output {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0;
}

.storyboard-conversation-output .conversation-log {
  height: 100%;
}

.episode-rail,
.project-group-rail {
  z-index: 3;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: auto;
  padding: 16px 10px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.project-group-rail {
  padding: 12px 8px;
}

.project-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.episode-bar-title {
  margin: 0 0 3px;
  font-size: calc(13px * var(--ui-font-scale));
  font-weight: var(--weight-semibold);
}

.episode-bar-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: calc(11px * var(--ui-font-scale));
  line-height: 1.4;
}

.episode-tabs,
.project-group-tabs {
  display: grid;
  gap: 6px;
  overflow: visible;
  padding: 2px 0;
}

.episode-tab,
.project-group-tab {
  min-height: 40px;
  width: 100%;
  padding: 0 34px 0 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: calc(13px * var(--ui-font-scale));
  font-weight: var(--weight-bold);
  line-height: 1.25;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    background 220ms ease,
    color 220ms ease,
    border-color 220ms ease;
}

.episode-tab:hover,
.episode-tab.active {
  border-color: var(--button-bg);
  background: var(--button-bg);
  color: var(--button-text);
}

.project-group-tab:hover,
.project-group-tab.active {
  border-color: transparent;
  background: color-mix(in srgb, var(--text) 9%, var(--control-bg));
  color: var(--text);
}

.episode-edit,
.project-group-edit {
  min-height: 34px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--black);
  border-radius: var(--radius-pill);
  background: var(--control-bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: calc(13px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
  text-align: center;
  outline: none;
}

.project-group-tab-row {
  position: relative;
  min-height: 40px;
  border-radius: 12px;
}

@property --project-group-flow-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.project-group-tab-row.is-generating::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 1px;
  border-radius: inherit;
  background: conic-gradient(
    from var(--project-group-flow-angle),
    transparent 0deg 248deg,
    color-mix(in srgb, var(--muted) 54%, transparent) 274deg,
    var(--text) 314deg,
    transparent 352deg
  );
  pointer-events: none;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: project-group-border-flow 1.45s linear infinite;
}

@keyframes project-group-border-flow {
  to {
    --project-group-flow-angle: 360deg;
  }
}

.project-group-delete,
.project-group-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.project-group-delete {
  position: absolute;
  right: 4px;
  top: 50%;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-control);
  opacity: 0.88;
  transform: translateY(-50%);
  transition:
    background 220ms ease,
    border-color 220ms ease,
    color 220ms ease,
    opacity 220ms ease,
    transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.project-group-delete:hover,
.project-group-delete:focus-visible {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.2);
  background: var(--danger-bg);
  opacity: 1;
  transform: translateY(-50%) scale(1.04);
}

.project-group-delete svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-group-add {
  width: 26px;
  height: 26px;
  font-size: calc(16px * var(--ui-font-scale));
  font-weight: var(--weight-semibold);
}

.project-group-context-menu {
  position: fixed;
  z-index: 180;
  min-width: 164px;
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 10px;
  background: var(--control-bg);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.project-group-context-menu-item {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: calc(13px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
  text-align: left;
}

.project-group-context-menu-item:hover,
.project-group-context-menu-item:focus-visible {
  background: var(--hover-bg);
  outline: none;
}

.project-group-context-menu-item.danger {
  color: var(--danger);
}

.project-group-context-menu-item svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-group-context-menu-item[data-project-group-menu-action="create"] svg {
  fill: currentColor;
  stroke: none;
}

.project-group-empty {
  margin: 4px 0 0;
  padding: 10px 8px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  text-align: center;
}

.storyboard-section {
  position: relative;
  padding-bottom: 24px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.storyboard-section:last-child {
  margin-bottom: 0;
  border-bottom: 0;
}

.storyboard-section-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.storyboard-section-header h3 {
  margin: 0;
  font-size: calc(16px * var(--ui-font-scale));
  line-height: 1.35;
}

.storyboard-actions {
  position: sticky;
  right: 0;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.storyboard-section:hover .storyboard-actions,
.storyboard-actions:focus-within {
  opacity: 1;
  transform: translateY(0);
}

.icon-action {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  padding: 0 9px;
  background: color-mix(in srgb, var(--control-bg) 92%, transparent);
  color: var(--muted);
  cursor: pointer;
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
  backdrop-filter: blur(8px);
}

.icon-action:hover,
.icon-action:focus-visible {
  border-color: var(--black);
  color: var(--text);
  outline: none;
}

.storyboard-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
}

.storyboard-table {
  min-width: 1320px;
  table-layout: fixed;
  border-collapse: collapse;
}

.storyboard-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--chip-bg);
  color: var(--text);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.35;
}

.storyboard-table th,
.storyboard-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  vertical-align: top;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.5;
}

.storyboard-table th:last-child,
.storyboard-table td:last-child {
  border-right: 0;
}

.storyboard-table tr:last-child td {
  border-bottom: 0;
}

.storyboard-table tbody tr:nth-child(odd) td {
  background: var(--control-bg);
}

.storyboard-table tbody tr:nth-child(even) td {
  background: var(--table-alt);
}

.storyboard-table th:nth-child(1),
.storyboard-table td:nth-child(1) {
  width: 88px;
}

.storyboard-table th:nth-child(2),
.storyboard-table td:nth-child(2) {
  width: 72px;
}

.storyboard-table th:nth-child(3),
.storyboard-table td:nth-child(3) {
  width: 86px;
}

.storyboard-table th:nth-child(4),
.storyboard-table td:nth-child(4) {
  width: 92px;
}

.storyboard-table th:nth-child(5),
.storyboard-table td:nth-child(5) {
  width: 520px;
}

.storyboard-table th:nth-child(6),
.storyboard-table td:nth-child(6) {
  width: 260px;
}

.storyboard-table th:nth-child(7),
.storyboard-table td:nth-child(7) {
  width: 130px;
}

.storyboard-table th:nth-child(8),
.storyboard-table td:nth-child(8) {
  width: 150px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
}

.metric strong {
  display: block;
  font-size: calc(28px * var(--ui-font-scale));
  line-height: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 0.8fr);
  gap: 14px;
}

.model-settings-layout {
  display: grid;
  grid-template-columns: 300px minmax(420px, 1fr) minmax(360px, 0.86fr);
  gap: 14px;
  align-items: stretch;
}

.model-library {
  min-height: 620px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
}

.model-library-head h2,
.model-form-title h2 {
  margin: 0 0 6px;
}

.model-library-head p,
.model-form-title p {
  margin: 0;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.55;
  font-weight: var(--weight-regular);
}

.model-profile-search {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--control-bg);
  color: #818188;
}

.model-profile-search input {
  width: 100%;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: calc(13px * var(--ui-font-scale));
}

.model-profile-search input:focus {
  box-shadow: none;
}

.model-profile-list {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.model-profile-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-ui);
  background: color-mix(in srgb, var(--control-bg) 84%, transparent);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.model-profile-card:hover,
.model-profile-card.active {
  border-color: var(--line-strong);
  background: var(--hover-bg);
}

.model-profile-card.active {
  box-shadow: inset 0 0 0 1px rgba(18, 18, 20, 0.04);
}

.model-profile-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  font-size: inherit;
  font-weight: var(--weight-regular);
  pointer-events: none;
}

.model-profile-avatar {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--control-bg);
  color: var(--text);
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: var(--weight-semibold);
}

.model-profile-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.model-profile-copy strong,
.model-profile-copy em,
.model-profile-copy small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-profile-copy strong {
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.25;
  font-weight: var(--weight-semibold);
}

.model-profile-copy em,
.model-profile-copy small {
  color: var(--muted);
  font-size: calc(11px * var(--ui-font-scale));
  font-style: normal;
  font-weight: var(--weight-regular);
  line-height: 1.25;
}

.model-profile-toggle {
  position: relative;
  z-index: 2;
  min-width: 62px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #8b8b92;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: calc(10px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
}

.model-profile-toggle-track {
  width: 34px;
  height: 20px;
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  border: 1px solid rgba(120, 120, 128, 0.18);
  border-radius: var(--radius-pill);
  background: #d1d1d6;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.model-profile-toggle-thumb {
  position: absolute;
  top: 50%;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transform: translateY(-50%);
  transition: transform 160ms ease;
}

.model-profile-toggle-label {
  min-width: 20px;
  text-align: left;
}

.model-profile-toggle:hover .model-profile-toggle-track {
  box-shadow: 0 0 0 3px rgba(120, 120, 128, 0.12);
}

.model-profile-toggle.on {
  color: var(--text);
}

.model-profile-toggle.on .model-profile-toggle-track {
  border-color: var(--text);
  background: var(--text);
}

.model-profile-toggle.on .model-profile-toggle-thumb {
  transform: translate(14px, -50%);
}

.model-profile-add {
  width: 100%;
  border-radius: var(--radius-pill);
}

.model-form-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.model-form .field-grid {
  align-items: start;
}

.model-form .field {
  min-width: 0;
  align-content: start;
}

.model-form .field > input,
.model-form .field > select,
.model-form .secret-input-wrap > input {
  height: 40px;
  min-height: 40px;
  box-sizing: border-box;
  line-height: 40px;
}

.model-form .field > input:-webkit-autofill,
.model-form .field > input:-webkit-autofill:hover,
.model-form .field > input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px var(--control-bg) inset, 0 0 0 3px rgba(0, 0, 0, 0.08);
  transition: background-color 9999s ease-out 0s;
}

.model-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #128a35;
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.model-switch input {
  width: 34px;
  height: 20px;
  position: relative;
  margin: 0;
  appearance: none;
  border: 1px solid rgba(120, 120, 128, 0.18);
  border-radius: var(--radius-pill);
  background: #d1d1d6;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.model-switch input::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transform: translateY(-50%);
  transition: transform 160ms ease;
}

.model-switch input:checked {
  border-color: #34c759;
  background: #34c759;
}

.model-switch input:checked::before {
  transform: translate(14px, -50%);
}

.model-switch input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.16);
}

.model-switch:has(input:not(:checked)) {
  color: #8b8b92;
}

.secret-input-wrap {
  position: relative;
  display: block;
}

.secret-input-wrap input {
  width: 100%;
  padding-right: 44px;
}

.secret-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-ui);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.secret-toggle:hover {
  background: var(--hover-bg);
  color: var(--text);
}

.secret-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button-muted.danger {
  color: #a31b1b;
  border-color: rgba(180, 35, 24, 0.2);
}

.button-muted.danger:hover {
  background: var(--danger-bg);
  border-color: rgba(180, 35, 24, 0.35);
}

.list {
  display: grid;
  gap: 8px;
}

.model-catalog {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding-right: 2px;
}

.model-catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.model-catalog-search {
  position: relative;
  flex: 1 1 100%;
  max-width: none;
}

.model-catalog-search > span {
  position: absolute;
  left: 12px;
  top: 50%;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.model-catalog-search input {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--control-bg);
  color: var(--text);
}

.model-catalog-search input:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.model-catalog-actions,
.model-catalog-filters {
  display: flex;
  align-items: center;
  gap: 6px;
}

.model-catalog-actions {
  flex: 1 1 auto;
  justify-content: space-between;
  flex-wrap: wrap;
}

.model-catalog-filters {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--soft-bg);
}

.model-catalog-filters button {
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
}

.model-catalog-filters button.active {
  background: var(--button-bg);
  color: var(--button-text);
}

.model-catalog-close-all {
  min-height: 38px;
  white-space: nowrap;
}

.model-catalog-empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
}

.model-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto 62px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--control-bg);
}

.model-row.is-closed {
  background: var(--soft-bg);
}

.model-row.is-closed .model-row-copy,
.model-row.is-closed > .badge,
.model-row.is-closed > .model-choice-icon {
  opacity: 0.68;
}

.model-catalog-toggle {
  justify-self: end;
}

.model-row .model-choice-icon {
  width: 24px;
  height: 24px;
}

.model-row-copy {
  min-width: 0;
}

.list-row,
.history-item {
  padding: 14px;
}

.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.list-title {
  margin: 0 0 5px;
  font-weight: var(--weight-semibold);
}

.list-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.5;
}

.history-item {
  display: grid;
  gap: 10px;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
}

.generation-history-status {
  min-height: 20px;
  padding: 1px 7px;
}

.generation-history-status.is-completed,
.generation-history-status.is-auto_continued {
  border-color: color-mix(in srgb, var(--success) 38%, var(--line));
  color: var(--success);
}

.generation-history-status.is-interrupted,
.generation-history-status.is-paused {
  background: var(--chip-bg);
}

.history-preview {
  margin: 0;
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.55;
}

.model-form,
.prompt-editor {
  padding: 18px;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.prompt-actions {
  justify-content: flex-end;
}

.input-actions {
  justify-content: space-between;
}

.source-generate-actions {
  margin-left: auto;
}

.source-generate-actions .button,
.source-generate-actions .button-muted {
  min-width: 82px;
}

.source-generate-actions .icon-only-button {
  min-width: 38px;
}

.secondary-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-table {
  width: 100%;
  overflow: auto;
}

.account-admin-surface .surface-header {
  align-items: center;
}

.account-policy-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--soft-bg);
}

.account-policy-item {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--panel);
}

.account-policy-item span {
  min-width: 0;
}

.account-policy-item strong,
.account-policy-item small,
.table-subtext {
  display: block;
}

.account-policy-item small,
.table-subtext {
  margin-top: 3px;
  color: var(--muted);
  font-size: calc(11px * var(--ui-font-scale));
  line-height: 1.4;
}

.account-policy-toggle {
  flex: 0 0 auto;
}

.account-user-cell {
  min-width: 160px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-user-cell > span:last-child {
  min-width: 0;
}

.account-table-avatar {
  width: 34px;
  height: 34px;
}

.account-row-actions {
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.account-row-actions button {
  white-space: nowrap;
}

.account-audit-section {
  border-top: 1px solid var(--line);
}

.account-audit-heading {
  padding: 15px 16px 10px;
}

.account-audit-heading h3,
.account-audit-heading p {
  margin: 0;
}

.account-audit-heading h3 {
  font-size: calc(15px * var(--ui-font-scale));
}

.account-audit-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
}

.account-audit-table {
  max-height: 250px;
  border-top: 1px solid var(--line);
}

.account-audit-table td,
.account-audit-table th {
  white-space: nowrap;
}

.account-audit-empty {
  padding: 22px 16px;
}

.account-admin-footnote {
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
}

.badge.muted {
  border-color: var(--line);
  background: var(--soft-bg);
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: var(--soft-bg);
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

td {
  font-size: calc(13px * var(--ui-font-scale));
}

.prompt-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
}

.prompt-admin-layout {
  grid-template-columns: var(--prompt-admin-sidebar-width, 272px) minmax(0, 1fr);
  align-items: start;
}

.prompt-admin-sidebar {
  position: relative;
  min-height: min(760px, calc(100vh - 104px));
}

.prompt-admin-resize-handle {
  position: absolute;
  top: 0;
  right: -8px;
  z-index: 12;
  width: 16px;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: ew-resize;
}

.prompt-admin-resize-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 48px;
  border-radius: var(--radius-pill);
  background: rgba(142, 142, 147, 0.42);
  transform: translate(-50%, -50%);
  transition: background 0.16s ease, height 0.16s ease;
}

.prompt-admin-resize-handle:hover::before,
body.is-resizing-prompt-admin .prompt-admin-resize-handle::before {
  height: 72px;
  background: rgba(18, 18, 20, 0.42);
}

.prompt-sidebar-header {
  align-items: center;
  padding: 16px 18px;
}

.prompt-sidebar-header .button {
  min-height: 34px;
  padding: 0 12px;
  font-size: calc(13px * var(--ui-font-scale));
}

.prompt-admin-sidebar .surface-body {
  max-height: calc(100vh - 198px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px;
}

.prompt-admin-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
  container: prompt-admin-main / inline-size;
}

.prompt-admin-main > * {
  min-width: 0;
}

.prompt-admin-head {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line);
}

.prompt-feature-stack {
  display: grid;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.prompt-version-eyebrow {
  margin: 0;
  font-size: calc(12px * var(--ui-font-scale));
}

.prompt-version-eyebrow span {
  margin-left: 18px;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
}

.prompt-status-badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--control-bg);
  color: var(--text);
  font-size: calc(11px * var(--ui-font-scale));
  font-weight: var(--weight-bold);
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.prompt-status-badge.is-enabled {
  border-color: #151515;
  background: #151515;
  color: #ffffff;
}

.prompt-status-badge.is-disabled {
  border-color: #74777d;
  background: #74777d;
  color: #ffffff;
}

.prompt-status-badge.is-archived {
  border-color: #c7c9ce;
  border-style: dashed;
  background: #f5f5f6;
  color: #6b6d72;
}

.prompt-status-badge.is-draft,
.prompt-status-badge.is-unknown {
  border-color: #8f9298;
  background: #ffffff;
  color: #303238;
}

.prompt-version-eyebrow .prompt-status-badge {
  margin-left: 8px;
  color: #ffffff;
}

.prompt-version-eyebrow .prompt-status-badge.is-disabled,
.prompt-version-eyebrow .prompt-status-badge.is-archived,
.prompt-version-eyebrow .prompt-status-badge.is-draft,
.prompt-version-eyebrow .prompt-status-badge.is-unknown {
  color: #3d3f43;
}

.prompt-version-eyebrow .prompt-status-badge.is-disabled {
  color: #ffffff;
}

.prompt-feature-fields {
  width: 100%;
  min-width: 0;
  padding: 0;
  border-bottom: 0;
}

.prompt-admin-main .prompt-feature-fields .prompt-meta-field,
.prompt-admin-main .prompt-feature-fields input,
.prompt-admin-main .prompt-feature-fields select {
  min-width: 0;
  max-width: 100%;
}

.prompt-feature-config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  min-width: 0;
}

.prompt-save-publish {
  align-self: end;
  min-width: 126px;
  min-height: 40px;
}

@container prompt-admin-main (max-width: 1050px) {
  .prompt-admin-main .prompt-feature-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .prompt-admin-main .prompt-edit-grid {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 20px;
  }
}

@container prompt-admin-main (max-width: 720px) {
  .prompt-admin-main .prompt-feature-config-row {
    grid-template-columns: 1fr;
  }

  .prompt-admin-main .prompt-feature-fields {
    grid-template-columns: 1fr;
  }

  .prompt-admin-main .prompt-edit-grid {
    grid-template-columns: 1fr;
  }

  .prompt-admin-main .prompt-save-publish {
    justify-self: end;
  }
}

.prompt-version-section {
  border-bottom: 1px solid var(--line);
}

.prompt-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 24px 10px;
}

.prompt-section-header h2 {
  margin-bottom: 6px;
  font-size: calc(18px * var(--ui-font-scale));
}

.prompt-section-header p {
  margin: 0;
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.5;
}

.prompt-version-body {
  padding: 0 24px 14px;
}

.prompt-version-list {
  max-height: 250px;
  overflow: auto;
  padding-right: 4px;
  gap: 12px;
}

.prompt-history-toggle {
  width: max-content;
  margin: 10px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  cursor: pointer;
}

.prompt-history-toggle:hover {
  color: var(--text);
}

.prompt-version-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 14px 18px;
  min-height: 76px;
  border-left-width: 4px;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.prompt-version-row.is-enabled {
  border-left-color: #151515;
  background: #ffffff;
}

.prompt-version-row.is-disabled {
  border-left-color: #74777d;
  background: #f1f1f2;
}

.prompt-version-row.is-archived {
  border-left-color: #b9bbc0;
  border-left-style: dashed;
  background: #f7f7f8;
}

.prompt-version-row.is-draft,
.prompt-version-row.is-unknown {
  border-left-color: #a2a4a9;
}

.prompt-version-row.active {
  border-color: var(--line-strong);
  background: var(--hover-bg);
  box-shadow: inset 4px 0 0 #151515;
}

.prompt-version-row.active.is-disabled {
  box-shadow: inset 4px 0 0 #74777d;
}

.prompt-version-row.active.is-archived {
  box-shadow: inset 4px 0 0 #b9bbc0;
}

.prompt-version-row .list-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: calc(14px * var(--ui-font-scale));
  flex-wrap: wrap;
}

.prompt-version-row .badge {
  min-height: 22px;
  padding: 0 8px;
  font-size: calc(11px * var(--ui-font-scale));
}

.prompt-version-actions .button-muted {
  min-height: 32px;
  padding: 0 10px;
  font-size: calc(12px * var(--ui-font-scale));
}

.prompt-edit-grid {
  display: grid;
  grid-template-columns: minmax(430px, 0.42fr) minmax(520px, 1fr);
  gap: 34px;
  padding: 14px 24px 12px;
  align-items: start;
}

.prompt-edit-side {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.prompt-edit-side > * {
  min-width: 0;
}

.prompt-version-fields {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.prompt-version-fields .prompt-meta-field,
.prompt-version-fields input {
  min-width: 0;
}

.prompt-edit-side .prompt-import-box {
  grid-template-columns: 1fr;
  justify-items: center;
  align-items: center;
  min-width: 0;
  margin-bottom: 0;
  min-height: 258px;
  padding: 34px 20px;
  text-align: center;
}

.prompt-edit-side .prompt-import-box strong,
.prompt-edit-side .prompt-import-box p {
  overflow-wrap: anywhere;
}

.prompt-edit-side .prompt-import-box .button-muted {
  width: max-content;
}

.prompt-import-visual {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-ui);
  color: var(--muted);
  background: var(--control-bg);
  border: 1px solid var(--line);
}

.prompt-import-visual svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prompt-sample-field,
.prompt-text-field {
  margin-bottom: 0;
}

.prompt-sample-field {
  display: grid;
  min-height: 0;
}

.prompt-sample-field .sample-textarea {
  overflow: auto;
}

.prompt-text-panel {
  min-width: 0;
  display: grid;
  min-height: 0;
  padding-left: 2px;
}

.prompt-text-field textarea {
  min-height: 382px;
  max-height: 382px;
  overflow: auto;
}

.prompt-edit-side .sample-textarea {
  min-height: 78px;
  max-height: 78px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  opacity: 1;
  pointer-events: auto;
}

.prompt-admin-main .prompt-actions {
  padding: 0 24px 16px;
  justify-content: flex-end;
}

.prompt-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.prompt-list-item {
  position: relative;
  min-width: 0;
}

.prompt-list-main {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 112px 0 14px;
  border-radius: var(--radius-ui);
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  font-weight: var(--weight-medium);
}

.prompt-list-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-small);
  color: inherit;
}

.prompt-list-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prompt-list-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-list-item.is-offline .prompt-list-main:not(.active) {
  opacity: 0.72;
}

.prompt-list-main.active,
.prompt-list-main:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--hover-bg);
}

.prompt-list-availability {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.feature-empty-state {
  margin: 0;
  padding: 18px 12px;
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.6;
  text-align: center;
}

.prompt-delete-button {
  position: absolute;
  right: 78px;
  top: 50%;
  width: 28px;
  height: 28px;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.prompt-list-item:hover .prompt-delete-button,
.prompt-list-item:focus-within .prompt-delete-button {
  opacity: 1;
  pointer-events: auto;
}

.prompt-delete-button:hover {
  color: var(--danger);
  border-color: #e5b5b5;
  background: var(--danger-bg);
}

.prompt-version-main {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.list-row.active .prompt-version-main .list-title {
  color: var(--black);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.prompt-delete-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prompt-meta-fields {
  display: grid;
  grid-template-columns: minmax(170px, 0.55fr) minmax(280px, 1fr) minmax(150px, 0.45fr) minmax(140px, 0.4fr);
  gap: 12px;
  align-items: end;
  width: min(1160px, 100%);
}

.prompt-meta-field {
  display: grid;
  gap: 7px;
}

.prompt-meta-field span {
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
}

.prompt-meta-field input,
.prompt-meta-field select {
  min-height: 40px;
  font-size: calc(14px * var(--ui-font-scale));
  font-weight: var(--weight-semibold);
}

.prompt-edit-side .prompt-version-fields {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.prompt-edit-side .prompt-version-fields .prompt-meta-field,
.prompt-edit-side .prompt-version-fields input {
  min-width: 0;
  max-width: 100%;
}

.source-import-box,
.prompt-import-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px dashed #b8b8be;
  border-radius: var(--radius-ui);
  background: var(--soft-bg);
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.source-import-box.dragging,
.source-import-box:focus-visible,
.prompt-import-box.dragging,
.prompt-import-box:focus-visible {
  border-color: var(--black);
  background: var(--control-bg);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
  outline: none;
}

.source-import-box strong,
.prompt-import-box strong {
  display: block;
  margin-bottom: 4px;
  font-size: calc(14px * var(--ui-font-scale));
}

.source-import-box p,
.prompt-import-box p {
  margin: 0;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.55;
}

.source-drop-input {
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.source-drop-input.dragging {
  border-color: var(--black);
  background: var(--control-bg);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08), inset 0 0 0 2px var(--black);
}

.source-panel-collapsed {
  background: transparent;
  min-height: max(620px, calc(100vh - 118px));
}

.source-collapsed-drop {
  min-height: max(620px, calc(100vh - 118px));
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 14px;
  padding: 16px;
  border: 1px dashed #b8b8be;
  border-radius: var(--radius-ui);
  background: var(--control-bg);
  outline: none;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.source-collapsed-drop.dragging,
.source-collapsed-drop:focus-visible {
  border-color: var(--black);
  background: var(--hover-bg);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.source-collapsed-drop h2 {
  margin: 0;
  font-size: calc(18px * var(--ui-font-scale));
  line-height: 1.25;
}

.source-collapsed-drop p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.55;
}

.source-collapsed-actions {
  display: grid;
  gap: 8px;
}

.source-collapsed-actions .button,
.source-collapsed-actions .button-muted {
  width: 100%;
}

.source-hidden-input {
  display: none;
}

.project-nav-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-search-field {
  min-height: 42px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--control-bg) 90%, var(--text) 4%);
  color: var(--muted);
}

.project-search-field svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.project-search-field input {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: calc(15px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
}

.project-search-field input::-webkit-search-decoration,
.project-search-field input::-webkit-search-cancel-button,
.project-search-field input::-webkit-search-results-button,
.project-search-field input::-webkit-search-results-decoration {
  display: none;
  -webkit-appearance: none;
}

.project-search-field input::placeholder {
  color: var(--muted);
}

.project-search-field:focus-within {
  border-color: var(--line-strong);
  background: var(--control-bg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 6%, transparent);
}

.project-search-summary {
  min-height: 16px;
  margin: -3px 2px 0;
  color: var(--muted);
  font-size: calc(11px * var(--ui-font-scale));
  line-height: 16px;
}

.project-search-hit {
  display: inline;
  padding: 0 2px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--warning) 16%, #ffffff 84%);
  color: var(--text);
}

.project-list-rail {
  display: grid;
  grid-auto-rows: minmax(40px, max-content);
  align-content: start;
  align-items: start;
  gap: 6px;
  max-height: calc(100vh - 360px);
  overflow: auto;
  margin: 0 -2px;
  padding: 1px 2px 8px;
}

.main-workbench .project-list-rail {
  flex: 1;
  min-height: 0;
  max-height: none;
}

.project-nav-footer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.project-nav-footer .button,
.project-nav-footer .button-muted {
  width: 100%;
  min-height: 42px;
}

.project-rail-item {
  width: 100%;
  position: relative;
  display: grid;
  min-height: 42px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  text-align: left;
  transform: translate3d(0, 0, 0);
  transition:
    color 220ms ease,
    border-color 220ms ease,
    transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
}

.project-rail-item::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: color-mix(in srgb, var(--text) 4%, var(--control-bg));
  opacity: 0;
  transform: scale(0.985);
  transition:
    opacity 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    background 260ms ease;
  pointer-events: none;
}

.project-rail-main {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 92px 0 11px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  font-size: inherit;
  font-weight: var(--weight-regular);
}

.project-rail-item:hover {
  transform: none;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.project-rail-item:hover::before,
.project-rail-item:focus-within::before {
  opacity: 1;
  transform: scale(1);
}

.project-rail-item.active {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.project-rail-item.active::before,
.project-rail-item.is-editing::before {
  background: color-mix(in srgb, var(--text) 9%, var(--control-bg));
  opacity: 1;
  transform: scale(1);
}

.project-rail-item.is-editing {
  background: transparent;
}

.project-rail-item:focus-within:not(.active) {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.project-rail-main strong {
  max-width: 100%;
  color: var(--text);
  font-size: calc(13px * var(--ui-font-scale));
  font-weight: var(--weight-bold);
  line-height: 1.25;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-rail-title-input {
  position: relative;
  z-index: 1;
  width: calc(100% - 104px);
  min-width: 0;
  height: 30px;
  min-height: 30px;
  margin: 6px 92px 6px 8px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--line-strong) 82%, transparent);
  border-radius: 9px;
  color: var(--text);
  background: var(--control-bg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 7%, transparent);
  font-family: var(--font-sans);
  font-size: calc(13px * var(--ui-font-scale));
  font-weight: var(--weight-bold);
  line-height: 30px;
  letter-spacing: 0;
  outline: none;
}

.project-rail-title-input:focus {
  border-color: var(--black);
}

.project-delete-button {
  position: absolute;
  right: 6px;
  top: 50%;
  z-index: 2;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  opacity: 0.92;
  transform: translateY(-50%);
  transition:
    background 220ms ease,
    border-color 220ms ease,
    color 220ms ease,
    opacity 220ms ease,
    transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.project-delete-button:hover {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.2);
  background: var(--danger-bg);
  opacity: 1;
  transform: translateY(-50%) scale(1.04);
}

.project-delete-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-empty {
  color: var(--muted);
  font-size: calc(11px * var(--ui-font-scale));
  line-height: 1.35;
  font-style: normal;
}

.project-time-pill {
  position: absolute;
  top: 50%;
  right: 38px;
  z-index: 2;
  max-width: 72px;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: var(--radius-ui);
  color: var(--muted);
  background: var(--chip-bg);
  font-size: calc(9px * var(--ui-font-scale));
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
  transform: translateY(-50%);
  transition:
    background 220ms ease,
    color 220ms ease,
    transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 220ms ease;
}

.active-source-mini {
  display: grid;
  gap: 10px;
  margin-top: 2px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.active-source-mini h3 {
  margin: 0;
  font-size: calc(16px * var(--ui-font-scale));
  line-height: 1.3;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.18);
}

.modal-card {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--panel);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.18);
}

.project-recycle-modal-card {
  width: min(620px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  overflow: hidden;
}

.project-recycle-modal-body {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 210px);
  overflow: auto;
}

.project-recycle-list {
  display: grid;
  gap: 8px;
}

.project-recycle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--soft-bg);
}

.project-recycle-item > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.project-recycle-item strong,
.project-recycle-item span,
.project-recycle-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-recycle-item span,
.project-recycle-item small,
.project-recycle-empty {
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
}

.project-recycle-empty {
  margin: 20px 0;
  text-align: center;
}

.project-context-modal-card {
  width: min(680px, 100%);
  max-height: min(820px, calc(100vh - 48px));
  overflow: hidden;
}

.project-context-modal-body {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 210px);
  overflow: auto;
}

.project-context-hint {
  margin: 0;
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.65;
}

.project-context-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--soft-bg);
}

.project-context-switch-row > div {
  min-width: 0;
}

.project-context-switch-row strong,
.project-context-switch-row p {
  margin: 0;
}

.project-context-switch-row strong {
  font-size: calc(13px * var(--ui-font-scale));
}

.project-context-switch-row p {
  margin-top: 4px;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.45;
}

.project-context-field {
  margin: 0;
}

.project-context-field textarea {
  min-height: 290px;
  max-height: 46vh;
  resize: vertical;
  font-family: var(--font-sans);
  line-height: 1.65;
}

.project-context-footer-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.project-context-footer-row > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.project-context-footer-row .button-muted {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.project-context-footer-row .button-muted svg {
  width: 16px;
  height: 16px;
}

.project-context-footer-row small,
.project-context-counter {
  color: var(--muted);
  font-size: calc(11px * var(--ui-font-scale));
  line-height: 1.5;
}

.project-context-counter {
  flex: 0 0 auto;
  padding-top: 8px;
  white-space: nowrap;
}

.project-context-counter.is-over-limit {
  color: var(--danger);
}

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

.regenerate-modal-card {
  width: min(310px, 100%);
  padding: 12px;
  border-radius: 8px;
}

.regenerate-modal-message {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.regenerate-modal-message p {
  margin: 0;
  color: var(--text);
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.4;
}

.regenerate-modal-warning {
  display: inline-grid;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: var(--text);
  color: var(--panel);
  font-size: calc(11px * var(--ui-font-scale));
  font-weight: 700;
}

.regenerate-modal-card .regenerate-modal-actions {
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
  padding: 0;
  border-top: 0;
  background: transparent;
}

.regenerate-modal-actions .button,
.regenerate-modal-actions .button-muted {
  min-height: 30px;
  padding: 5px 14px;
  border-radius: 6px;
  font-size: calc(12px * var(--ui-font-scale));
}

.account-modal-card {
  width: min(560px, 100%);
}

.account-modal-body {
  display: grid;
  gap: 15px;
}

.sidebar-settings-button {
  grid-column: 1 / -1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sidebar-settings-button svg { width: 16px; height: 16px; }
.personal-settings-body { display: grid; gap: 24px; }
.personal-settings-card { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); overflow: hidden; }
.personal-settings-card .personal-settings-body { min-height: 0; overflow-y: auto; }
.personal-settings-section h3 { margin: 0 0 10px; font-size: calc(14px * var(--ui-font-scale)); }
.personal-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.personal-settings-row strong { font-size: calc(14px * var(--ui-font-scale)); }
.personal-settings-row p { margin: 5px 0 0; font-size: calc(12px * var(--ui-font-scale)); color: var(--muted); }
.personal-settings-pending { font-size: calc(12px * var(--ui-font-scale)); color: var(--muted); }
.settings-font-size-row { align-items: center; }
.settings-font-size-control { display: flex; align-items: center; gap: 11px; width: min(220px, 100%); }
.settings-font-size-track { flex: 1; min-width: 90px; display: grid; grid-template-rows: 20px 8px; row-gap: 3px; }
.settings-font-size-track input[type="range"] { width: 100%; height: 20px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; accent-color: var(--text); cursor: pointer; }
.settings-font-size-ticks { display: flex; justify-content: space-between; align-items: start; padding: 0 8px; }
.settings-font-size-ticks span { width: 1px; height: 6px; background: var(--soft); }
.settings-font-size-small { font-size: calc(13px * var(--ui-font-scale)); line-height: 1; }
.settings-font-size-large { font-size: calc(22px * var(--ui-font-scale)); line-height: 1; }

.avatar-editor {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.avatar-editor-preview {
  width: 96px;
  height: 96px;
  font-size: calc(32px * var(--ui-font-scale));
  cursor: pointer;
}

.avatar-editor-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.avatar-editor-copy strong,
.avatar-editor-copy p,
.avatar-editor-hint {
  margin: 0;
}

.avatar-editor-copy p,
.avatar-editor-hint {
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.55;
}

.avatar-editor-copy .row-actions {
  justify-content: flex-start;
}

.avatar-editor-hint {
  padding-top: 13px;
  border-top: 1px dashed var(--line);
}

.account-target-note {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--soft-bg);
  color: var(--muted);
  line-height: 1.6;
}

.account-security-alert {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-ui);
  background: var(--soft-bg);
}

.account-security-alert span {
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.5;
}

.modal-header,
.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
}

.modal-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: calc(22px * var(--ui-font-scale));
}

.modal-body {
  padding: 18px;
}

.modal-actions {
  align-items: center;
  border-top: 1px solid var(--line);
  background: var(--soft-bg);
}

.icon-text-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  background: var(--control-bg);
  color: var(--muted);
  cursor: pointer;
}

.icon-text-button:hover {
  color: var(--text);
  border-color: var(--black);
}

.prompt-editor textarea {
  min-height: 520px;
  font-family: var(--font-mono);
  font-size: calc(13px * var(--ui-font-scale));
}

.prompt-editor .sample-textarea {
  min-height: 190px;
}

.empty-state {
  padding: 34px 20px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  max-width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%) translateY(10px);
  opacity: 0;
  pointer-events: none;
  border-radius: var(--radius-ui);
  background: var(--button-bg);
  color: var(--button-text);
  padding: 10px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  font-size: calc(13px * var(--ui-font-scale));
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast[data-kind="success"]::before,
.toast[data-kind="error"]::before,
.toast[data-kind="info"]::before {
  display: grid;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: calc(11px * var(--ui-font-scale));
  font-weight: 800;
  line-height: 1;
}

.toast[data-kind="success"]::before {
  content: "✓";
}

.toast[data-kind="error"]::before {
  content: "!";
}

.toast[data-kind="info"]::before {
  content: "i";
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

.admin-record-summary-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.admin-record-summary-row .list-subtitle {
  margin-top: 8px;
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 16px;
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
}

.admin-record-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.admin-record-detail-grid section {
  min-width: 0;
}

.admin-record-detail-grid h3 {
  margin: 0 0 8px;
  font-size: calc(14px * var(--ui-font-scale));
}

.admin-record-detail-grid pre {
  max-height: 420px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft-bg);
  color: var(--text);
  font: inherit;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.admin-usage-table td:first-child {
  min-width: 130px;
}

@media (max-width: 1180px) {
  .workbench-grid,
  .workbench-grid.source-collapsed,
  .dashboard-grid,
  .model-settings-layout,
  .prompt-layout {
    grid-template-columns: 1fr;
  }

  .workbench-grid {
    flex-direction: column;
  }

  .workbench-grid > .workbench-nav-panel,
  .workbench-grid > .source-panel,
  .workbench-grid > .surface:not(.workbench-nav-panel):not(.source-panel) {
    flex: 0 0 auto;
    max-width: none;
    min-width: 0;
  }

  .main-workbench .workbench-grid.source-collapsed .source-panel {
    display: none;
  }

  .prompt-admin-sidebar {
    min-height: auto;
  }

  .prompt-admin-sidebar .surface-body {
    max-height: none;
  }

  .prompt-admin-resize-handle {
    display: none;
  }

  .prompt-edit-grid {
    grid-template-columns: 1fr;
  }

  .workbench-nav-resize-handle {
    display: none;
  }

  .result-control-bar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .workbench-grid,
  .main-workbench .source-panel,
  .source-sidebar-toggle,
  .prompt-version-row {
    transition: none;
    animation: none;
  }

  .assistant-waiting-dots i {
    animation: none;
  }

  .thinking-panel-chevron {
    transition: none;
  }

  .model-profile-toggle-track,
  .model-profile-toggle-thumb,
  .avatar-button,
  .avatar-edit-indicator {
    transition: none;
  }

  .project-group-tab-row.is-generating::after {
    background: color-mix(in srgb, var(--text) 48%, transparent);
    animation: none;
  }
}

@media (max-width: 860px) {
  .login-shell,
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-section {
    grid-column: 1 / -1;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .prompt-section-header {
    flex-direction: column;
  }

  .prompt-section-header .button-muted {
    width: 100%;
  }

  .prompt-feature-config-row {
    grid-template-columns: 1fr;
  }

  .prompt-save-publish {
    width: 100%;
  }

  .account-policy-bar {
    grid-template-columns: 1fr;
  }

  .admin-record-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .login-page,
  .main {
    padding: 14px;
  }

  .login-intro,
  .login-panel {
    padding: 20px;
  }

  .field-grid,
  .metrics-grid,
  .prompt-meta-fields,
  .auth-password-grid,
  .account-form-grid {
    grid-template-columns: 1fr;
  }

  .nav {
    grid-template-columns: 1fr;
  }

  .surface-header,
  .list-row {
    grid-template-columns: 1fr;
  }

  .prompt-feature-fields,
  .prompt-version-fields {
    grid-template-columns: 1fr;
  }

  .prompt-version-actions {
    justify-content: flex-start;
  }
}


/* Account allowances reuse the shared account modal and table surfaces. */
.quota-backdrop { display: flex; justify-content: center; align-items: center; padding: 12px; overflow: hidden; }
.quota-modal-card { width: min(760px, 100%); min-width: 0; max-height: calc(100dvh - 24px); overflow-y: auto; }
.quota-modal-card h2 { font-size: calc(20px * var(--ui-font-scale)); }
.quota-summary { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; margin: 12px 0; }
.quota-summary strong { font-size: calc(20px * var(--ui-font-scale)); }
.quota-summary span { font-size: calc(13px * var(--ui-font-scale)); color: #60646c; }
.quota-form { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; margin: 20px 0; }
.quota-checkbox { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
.quota-checkbox input { width: 16px; height: 16px; }
.quota-form .field { min-width: 0; }
.quota-form button { justify-self: start; }
.quota-ledger { overflow-x: auto; margin: 16px 0; }
.quota-ledger td:last-child { min-width: 160px; white-space: normal; overflow-wrap: anywhere; }
.quota-review-form { display: grid; gap: 8px; margin-top: 12px; min-width: 220px; }
@media (max-width: 600px) { .quota-form { grid-template-columns: 1fr; } .quota-modal-card .modal-body { padding: 16px; } }

/* Both roles share the compact workbench header; management lives in a menu. */
.app-layout.user-layout {
  display: block;
}

.sidebar.sidebar-user {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  height: auto;
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(300px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.035);
}

.sidebar-user .brand {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
  padding: 0;
}

.sidebar-user .brand-mark {
  grid-row: 1 / 3;
  margin: 0;
}

.sidebar-user .brand-title,
.sidebar-user .brand-subtitle {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sidebar-user .brand-subtitle { margin-top: 2px; }
.sidebar-user .nav { flex: initial; display: flex; align-items: center; gap: 8px; overflow: visible; padding: 0; }
.sidebar-user .nav-button {
  width: auto;
  min-width: 130px;
  height: 38px;
  justify-content: center;
  padding: 0 14px;
  color: var(--text);
}
.sidebar-user .nav-button.active {
  font-weight: var(--weight-semibold);
}
.admin-menu-anchor { position: relative; min-width: 0; }
.admin-menu-trigger { list-style: none; user-select: none; }
.admin-menu-trigger::-webkit-details-marker { display: none; }
.admin-menu-trigger .utility-icon { width: 12px; height: 12px; flex: 0 0 12px; color: var(--muted); }
.admin-menu-anchor[open] .admin-menu-trigger { background: color-mix(in srgb, var(--text) 8%, var(--control-bg)); color: var(--text); }
.admin-menu-anchor[open] .admin-menu-trigger .utility-icon { transform: rotate(180deg); }
.admin-menu-trigger:focus-visible, .admin-menu-dropdown .nav-button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.admin-menu-dropdown {
  position: absolute; z-index: 80; top: calc(100% + 9px); left: 0;
  width: 230px; max-width: calc(100vw - 24px); padding: 8px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  box-shadow: 0 8px 28px rgba(0,0,0,.12);
}
.admin-menu-heading { margin: 4px 10px 7px; color: var(--muted); font-size: calc(11px * var(--ui-font-scale)); }
.admin-menu-dropdown .nav-button { width: 100%; min-width: 0; height: 36px; justify-content: flex-start; padding: 0 10px; }
.admin-menu-divider { height: 1px; margin: 6px 3px; background: var(--line); }
.admin-menu-dropdown .nav-icon .utility-icon { width: 16px; height: 16px; }
.sidebar-user .account-dropdown .nav-icon { width: 16px; height: 16px; }
.sidebar-user .sidebar-footer {
  min-width: 0;
  padding: 0;
  justify-self: end;
}
.sidebar-user .sidebar-utilities {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
}
.sidebar-user .sidebar-utility-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-user .points-trigger { min-width: 100px; }
.sidebar-user .account-trigger { width: 128px; }
.sidebar-user .notification-trigger,
.sidebar-user .settings-trigger { width: 36px; flex: 0 0 36px; }
.sidebar-user .account-dropdown { top: calc(100% + 8px); bottom: auto; left: auto; right: 0; }
.sidebar-user .has-tooltip::after { top: calc(100% + 8px); bottom: auto; left: auto; right: 0; }
.sidebar-user .account-trigger[aria-expanded="true"]::after { display: none; }
.user-layout .main-workbench { padding-top: 18px; }
.user-layout .workbench-grid { --workbench-card-height: max(620px, calc(100dvh - 108px)); }

@media (max-width: 920px) {
  .sidebar.sidebar-user {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
    padding: 10px 16px;
  }
  .sidebar-user .nav { grid-column: 1 / -1; grid-row: 2; }
  .sidebar-user .nav-button { justify-content: flex-start; }
  .sidebar-user .sidebar-footer { grid-column: 2; grid-row: 1; }
}

@media (max-width: 600px) {
  .sidebar.sidebar-user { gap: 8px; padding: 9px 14px; }
  .sidebar-user .brand-title { font-size: calc(12px * var(--ui-font-scale)); }
  .sidebar-user .brand-subtitle { font-size: calc(9px * var(--ui-font-scale)); }
  .sidebar-user .sidebar-utilities { gap: 5px; }
  .sidebar-user .sidebar-utility-row { gap: 5px; }
  .sidebar-user .utility-button { height: 32px; }
  .sidebar-user .points-trigger { min-width: 68px; padding: 0 6px; }
  .sidebar-user .account-trigger { width: 35px; justify-content: center; padding: 0; }
  .sidebar-user .account-display-name,
  .sidebar-user .account-trigger > .utility-icon { display: none; }
  .sidebar-user .notification-trigger,
  .sidebar-user .settings-trigger { width: 32px; flex-basis: 32px; }
  .sidebar-user .nav-button { min-width: 0; }
}
