: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;
}

/* Cross-episode read-only preparation; shared theme tokens. */
.ce-dialog { width: min(1220px, calc(100vw - 40px)); max-width: none; height: min(880px, calc(100dvh - 40px)); max-height: none; padding: 0; border: 1px solid var(--line); border-radius: 16px; color: var(--text); background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.ce-dialog[open] { display: flex; flex-direction: column; }
.ce-dialog::backdrop { background: rgb(0 0 0 / 35%); }
.ce-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 24px 12px; gap: 16px; }
.ce-header h2 { margin: 0; font-size: 21px; }
.ce-header h2 small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 8px; }
.ce-header p, .ce-meta { font-size: 12px; color: var(--muted); line-height: 1.65; }
.ce-dialog button, .ce-dialog select, .ce-dialog textarea { font: inherit; color: var(--text); background: var(--control-bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; }
.ce-dialog button { cursor: pointer; }
.ce-dialog button:hover:not(:disabled) { background: var(--hover-bg); }
.ce-dialog button:disabled { opacity: .5; cursor: not-allowed; }
.ce-dialog :focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.ce-notice { background: var(--panel-2); padding: 10px 24px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.ce-tabs { display: flex; gap: 8px; padding: 12px 24px; border-bottom: 1px solid var(--line); }
.ce-tabs button[aria-pressed="true"] { background: var(--button-bg); color: var(--button-text); }
.ce-body { flex: 1; min-height: 0; overflow: auto; }
.ce-sources { display: grid; grid-template-columns: minmax(350px, .9fr) minmax(0, 1.1fr); min-height: 100%; }
.ce-source-list, .ce-source-preview { padding: 20px 24px; min-width: 0; }
.ce-source-preview { border-left: 1px solid var(--line); background: var(--panel-2); }
.ce-source-preview h3 { margin: 0 0 16px; }
.ce-source-preview label { display: grid; gap: 8px; }
.ce-source-preview select { width: 100%; }
.ce-range { display: flex; align-items: end; gap: 12px; margin-bottom: 16px; }
.ce-range label { display: grid; gap: 6px; flex: 1; font-size: 12px; color: var(--muted); }
.ce-range span { padding-bottom: 10px; }
.ce-table { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.ce-dialog .ce-row { display: grid; grid-template-columns: 70px 1fr 72px; gap: 10px; width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; text-align: left; font-size: 12px; padding: 11px; }
.ce-dialog .ce-row:last-child { border-bottom: 0; }
.ce-dialog .ce-row.is-active { background: var(--hover-bg); box-shadow: inset 3px 0 var(--text); }
.ce-table-head { color: var(--muted); background: var(--panel-2); }
.ce-warning { color: var(--warning); }
.ce-goal { display: grid; gap: 9px; margin-top: 20px; font-size: 13px; }
.ce-goal textarea { width: 100%; min-height: 100px; resize: vertical; line-height: 1.6; }
.ce-original { font: 13px/1.9 var(--font-sans); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 370px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: var(--panel); }
.ce-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; border-top: 1px solid var(--line); font-size: 12px; }
.ce-dialog .ce-primary { background: var(--button-bg); color: var(--button-text); white-space: nowrap; }
.ce-dialog .ce-primary:hover:not(:disabled) { background: var(--button-hover); }
.ce-empty { padding: 32px; color: var(--muted); line-height: 1.8; }
.ce-error { color: var(--danger); padding: 8px 24px; margin: 0; }
.ce-report { padding: 16px 24px; }
.ce-report article { border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin: 16px 0; line-height: 1.7; }
.ce-report blockquote { margin: 12px 0; padding: 12px; border-left: 3px solid var(--line-strong); background: var(--panel-2); white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .ce-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); }
  .ce-header, .ce-source-list, .ce-source-preview, .ce-report { padding: 16px; }
  .ce-header p { font-size: 11px; }
  .ce-sources { grid-template-columns: minmax(0, 1fr); }
  .ce-source-preview { border-left: 0; border-top: 1px solid var(--line); }
  .ce-footer { padding: 12px; }
  .ce-tabs { padding: 10px 16px; }
}

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;
}

.auth-bootstrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--bg);
}

.auth-bootstrap-card {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: min(300px, 100%);
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  box-shadow: var(--shadow);
  color: var(--text);
}

.auth-bootstrap-card strong {
  display: block;
  margin-bottom: 4px;
}

.auth-bootstrap-card p {
  margin: 0;
  color: var(--muted);
  font-size: calc(13px * var(--ui-font-scale));
}

.file-mode-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth-bootstrap-status {
  width: min(100%, 420px);
  text-align: center;
  overflow-wrap: anywhere;
}
.auth-bootstrap-status h1 { font-size: 18px; margin: 0 0 14px; }
.auth-bootstrap-status p { font-size: 14px; color: var(--muted); line-height: 1.6; }
.auth-bootstrap-progress {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: bootstrap-spin 1s linear infinite;
}
@keyframes bootstrap-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .auth-bootstrap-progress { animation: none; } }

.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: center;
  color: var(--muted);
  font-size: calc(12px * var(--ui-font-scale));
  line-height: 1.55;
}

.auth-consent input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 18px;
  accent-color: var(--black);
}

.auth-consent span {
  min-width: 0;
}

.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-mark:has(img) { background: transparent; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }

.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; }
/* Notifications: a compact, bell-anchored surface; the workbench stays intact. */
.modal-backdrop.notification-backdrop { display: block; padding: 0; background: rgba(0,0,0,.08); }
.modal-card.notification-panel {
  position: fixed; left: var(--notice-left, calc(100vw - 424px)); top: var(--notice-top, 72px);
  width: min(400px, calc(100vw - 24px)); height: var(--notice-height, 480px);
  max-height: calc(100dvh - 24px); max-width: none; min-width: 0;
  display: flex; flex-direction: column; overflow: visible; border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.12); color: var(--text);
}
.notification-panel::before { content: ""; position: absolute; top: -7px; left: var(--notice-tip, 326px); width: 12px; height: 12px; transform: rotate(45deg); background: var(--panel); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.notification-panel > .modal-header { flex: 0 0 auto; padding: 16px 18px 10px; gap: 8px; align-items: center; border: 0; }
.notification-panel .modal-header h2 { display: flex; align-items: center; gap: 8px; font-size: calc(16px * var(--ui-font-scale)); font-weight: 600; line-height: 1.4; outline: none; }
.notification-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 10px; background: var(--chip-bg); color: var(--muted); font-size: calc(10px * var(--ui-font-scale)); line-height: 18px; text-align: center; font-weight: 500; }
.notification-count[hidden] { display: none; }
.notification-actions { display: flex; align-items: center; gap: 3px; }
.notification-panel button { font-family: inherit; cursor: pointer; }
.notification-panel button:disabled { cursor: default; opacity: .45; }
.notification-panel button:focus-visible { outline: 2px solid var(--line-strong); outline-offset: 2px; }
.notification-read-all, .notification-icon-button { border: 0; background: transparent; color: var(--muted); border-radius: 7px; }
.notification-read-all { min-height: 30px; padding: 4px 7px; font-size: calc(11.5px * var(--ui-font-scale)); white-space: nowrap; }
.notification-icon-button { position: relative; width: 30px; height: 30px; padding: 7px; display: grid; place-items: center; }
.notification-icon-button svg { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.notification-read-all:hover:not(:disabled), .notification-icon-button:hover:not(:disabled) { color: var(--text); background: var(--hover-bg); }
.notification-icon-button.has-update::after { content: ""; position: absolute; right: 4px; top: 4px; width: 4px; height: 4px; background: var(--text); border-radius: 50%; }
.notification-views { position: relative; flex: 0 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 18px 10px; padding: 3px; border-radius: 10px; background: var(--chip-bg); isolation: isolate; }
.notification-views::before { content: ""; position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 8px; background: var(--button-bg); transform: translateX(0); transition: transform 180ms cubic-bezier(.22,.7,.22,1); }
.notification-views[data-view="history"]::before { transform: translateX(100%); }
.notification-views button { min-width: 0; min-height: 32px; padding: 6px 8px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: calc(12px * var(--ui-font-scale)); font-weight: 500; line-height: 1.4; transition: color 140ms ease; }
.notification-views button[aria-selected="true"] { background: transparent; color: var(--button-text); }
.notification-panel > .modal-body { flex: 1 1 auto; min-height: 0; padding: 0 18px 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-gutter: stable; }
.notification-list { display: block; }
.notification-item { position: relative; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; overflow: hidden; }
.notification-item-heading { width: 100%; display: grid; gap: 6px; padding: 16px 4px 16px 18px; text-align: left; color: var(--text); background: transparent; border: 0; border-radius: 5px; }
.notification-item.unread::before { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--soft); left: 1px; top: 23px; pointer-events: none; }
.notification-item-heading:hover:not(:disabled) { background: var(--panel-2); }
.notification-item-heading strong { font-size: calc(13px * var(--ui-font-scale)); font-weight: 550; line-height: 1.55; overflow-wrap: anywhere; }
.notification-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; color: var(--muted); font-size: calc(12px * var(--ui-font-scale)); line-height: 1.65; white-space: pre-line; }
.notification-item-meta { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; color: var(--muted); font-size: calc(10px * var(--ui-font-scale)); line-height: 1.5; }
.notification-content { padding: 0 4px 16px 18px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: calc(12.5px * var(--ui-font-scale)); line-height: 1.8; }
.notification-content .muted-note { font-size: calc(11px * var(--ui-font-scale)); }
.notification-footer { flex: 0 0 auto; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: calc(10.5px * var(--ui-font-scale)); line-height: 1.5; }
.notification-load-status { min-height: 0; color: var(--muted); font-size: calc(11px * var(--ui-font-scale)); line-height: 1.6; }
.notification-load-status:not(:empty) { padding: 8px 0; }
.notification-error { margin: 8px 0; color: var(--danger); font-size: calc(12px * var(--ui-font-scale)); line-height: 1.6; }
.notification-empty { padding: 76px 4px 30px; text-align: center; color: var(--muted); }
.notification-empty > .utility-icon { width: 23px; height: 23px; opacity: .65; }
.notification-empty h3 { color: var(--text); font-size: calc(13px * var(--ui-font-scale)); font-weight: 500; margin: 12px 0 6px; }
.notification-empty p { font-size: calc(11.5px * var(--ui-font-scale)); line-height: 1.6; margin: 0; }
.notification-more { display: block; min-height: 36px; width: 100%; margin-top: 8px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: calc(11.5px * var(--ui-font-scale)); }
.notification-more:hover:not(:disabled) { background: var(--hover-bg); }
.notification-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.notification-publish-error { color: var(--danger); font-size: calc(13px * var(--ui-font-scale)); }
@media (max-width: 520px) {
  .notification-panel > .modal-header { padding: 10px 12px 6px; gap: 4px; }
  .notification-panel .modal-header h2 { font-size: calc(15px * var(--ui-font-scale)); gap: 5px; }
  .notification-views { margin-left: 12px; margin-right: 12px; }
  .notification-views button, .notification-read-all, .notification-icon-button, .notification-more { min-height: 44px; }
  .notification-icon-button { width: 36px; }
  .notification-panel > .modal-body { padding-left: 12px; padding-right: 12px; }
  .notification-footer { padding-left: 12px; padding-right: 12px; }
  .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; }
}
@media (prefers-reduced-motion: reduce) { .notification-views::before, .notification-views button { transition: none; } }

.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;
}

.main-admin-window { padding: 16px; }
.admin-window {
  min-width: 0;
  min-height: calc(100dvh - 102px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
  box-shadow: var(--shadow);
}
.admin-window > .topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.admin-window-content { min-width: 0; }
.admin-window-close {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  color: var(--text);
}
.admin-window-close svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.admin-window-exit:not([hidden]) {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.38);
}
.admin-window-exit-card {
  width: min(100%, 460px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.admin-window-exit-card h2 { margin: 0 0 10px; font-size: calc(20px * var(--ui-font-scale)); }
.admin-window-exit-card p { margin: 0 0 22px; color: var(--muted); font-size: calc(13px * var(--ui-font-scale)); line-height: 1.6; }
.admin-window-exit-card .form-actions { justify-content: flex-end; flex-wrap: wrap; }

.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;
}

.result-chat-composer {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 18px var(--composer-inset-right, 18px) 12px var(--composer-inset-left, 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(.composer-action-button):not(.quick-phrase-close):not(.quick-phrase-add-button):not(.quick-phrase-send):not(.quick-phrase-icon):not(.translation-target-button):not(.continuation-basis):not(.model-picker-trigger) {
  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: none;
}

.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);
}

.icon-only-button.button-danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger-bg) 76%, var(--panel));
}

.composer-action-pause {
  color: var(--button-text);
  border-color: var(--button-bg);
  background: var(--button-bg);
  box-shadow: none;
}

.composer-action-button:hover,
.icon-only-button:hover {
  transform: translateY(-1px);
}

.composer-action-send:hover,
.composer-action-pause:hover {
  background: var(--button-hover);
  border-color: var(--button-hover);
}

.source-generate-button:hover {
  background: var(--button-hover);
  border-color: var(--button-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 {
  display: block;
  flex-shrink: 0;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The source-panel plane keeps its optical correction; the composer arrow is symmetric. */
.source-generate-button svg {
  transform: translate(-1px, 1px);
}

.composer-action-send svg {
  width: 21px;
  height: 21px;
  stroke-width: 2.1;
  transform: none;
}

.generation-pause-button,
.source-generate-actions .icon-only-button {
  border-radius: 50%;
}

.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: 6px;
  padding: 0 10px 8px;
}

.composer-toolbar .composer-action-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 44px;
  margin-left: 0;
  border-radius: 50%;
}

.composer-tools { display:flex; align-items:center; gap:6px; flex:0 0 auto; }
.composer-send-controls { display:flex; align-items:center; gap:12px; margin-left:auto; min-width:0; flex:0 1 390px; }
.composer-model-field { flex:1 1 auto; min-width:0; margin:0; }
.composer-model-field .model-picker-trigger { height:36px; min-height:36px; padding-left:8px; border-radius:var(--radius-control); font-size:calc(12px * var(--ui-font-scale)); box-shadow:none; border-color:transparent; background:transparent; }
.composer-model-field .model-choice-icon { width:24px; height:24px; flex:0 0 24px; }
.composer-model-field .model-picker-trigger:hover { background:var(--hover-bg); border-color:transparent; }
.composer-model-field .model-picker-trigger:focus-visible { outline:2px solid var(--muted); outline-offset:2px; }
.composer-model-field .composer-model-label { display:flex; align-items:baseline; min-width:0; gap:0; }
.composer-model-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
.composer-model-provider { color:var(--muted); flex-shrink:0; }
.composer-model-field .model-picker-trigger i { border-color:var(--soft); }
.composer-model-field .model-picker-trigger[aria-expanded="true"] { background:var(--hover-bg); border-color:transparent; }
.composer-model-field .model-picker-trigger[aria-expanded="true"] i { transform:rotate(225deg) translate(-1px,-1px); }
.composer-model-menu { position:fixed; inset:auto; z-index:125; margin:0; max-width:calc(100vw - 24px); overscroll-behavior:contain; }
.composer-model-menu .model-picker-option { min-height:40px; }
.composer-model-menu .model-picker-option:focus-visible { outline:2px solid var(--muted); outline-offset:-2px; background:var(--hover-bg); }
@container workbench-result (max-width:620px) {
  .composer-model-provider { display:none; }
  .composer-send-controls { gap:8px; }
}
@container workbench-result (max-width:420px) {
  .composer-toolbar { flex-wrap:wrap; }
  .composer-tools { gap:4px; }
  .composer-send-controls { flex:1 1 220px; }
  .composer-model-field .model-picker-trigger { min-height:44px; height:44px; }
}

.composer-action-send.is-preparing {
  opacity: 0.55;
  cursor: progress;
}

.composer-tool-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  min-width: 0 !important;
  min-height: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  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: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  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;
  width: 100%;
  min-width: 0;
}

.user-message-stack.is-editing { width: min(72%, 560px); min-width: min(100%, 200px); }
.user-message-stack.is-editing .message-edit-textarea { height: clamp(140px, 35dvh, 320px); }

.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: 20px 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-order-status { min-height:30px; margin-top:7px !important; font-size:11px !important; }
.model-profile-order-status button { padding:0 3px; border:0; background:none; color:var(--text); font:inherit; text-decoration:underline; cursor:pointer; }
.model-profile-drag { display:grid; place-items:center; width:20px; height:44px; padding:0; border:0; background:none; color:var(--muted); cursor:grab; touch-action:none; }
.model-profile-drag svg { width:16px; height:22px; stroke:currentColor; fill:none; stroke-width:1.6; }
.model-profile-side { display:grid; justify-items:end; gap:4px; }
.model-profile-order-buttons { display:flex; gap:2px; }
.model-profile-order-buttons button { display:grid; place-items:center; width:24px; height:22px; padding:0; border:0; border-radius:5px; background:transparent; color:var(--muted); cursor:pointer; }
.model-profile-order-buttons button[data-direction="-1"] .utility-icon { transform:rotate(180deg); }
.model-profile-order-buttons button:hover:not(:disabled), .model-profile-drag:hover:not(:disabled) { background:var(--hover-bg); color:var(--text); }
.model-profile-order-buttons button:disabled, .model-profile-drag:disabled { opacity:.3; cursor:default; }
.model-profile-drag:focus-visible, .model-profile-order-buttons button:focus-visible { outline:2px solid var(--text); outline-offset:1px; }
.model-profile-card.is-dragging { opacity:.35; }
.model-profile-card.drop-before::after, .model-profile-card.drop-after::after { content:""; position:absolute; left:0; right:0; top:-5px; height:2px; background:var(--text); border-radius:2px; pointer-events:none; }
.model-profile-card.drop-after::after { top:auto; bottom:-5px; }
.model-profile-drag-ghost { position:fixed; z-index:2000; pointer-events:none; box-shadow:0 12px 30px #0002; border-color:var(--line-strong); background:var(--panel); opacity:.95; transition:none; will-change:transform; }
body.is-sorting-model-profiles, body.is-sorting-model-profiles * { cursor:grabbing !important; user-select:none !important; }
@media (pointer:coarse) { .model-profile-order-buttons button { min-width:28px; min-height:28px; } }

.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-order-handle { position:absolute; z-index:3; left:3px; top:50%; transform:translateY(-50%); display:grid; place-items:center; width:20px; height:34px; padding:0; border:0; border-radius:5px; background:transparent; color:var(--muted); cursor:grab; touch-action:none; }
.project-order-handle svg { width:13px; height:20px; stroke:currentColor; fill:none; stroke-width:1.6; }
.project-order-handle:disabled { opacity:.25; cursor:default; }
.project-order-handle:focus-visible { outline:2px solid var(--text); outline-offset:-1px; }
.project-rail-item:has(.project-order-handle) .project-rail-main { padding-left:28px; }
.project-order-status { margin:2px 0; color:var(--muted); font-size:11px; }
.project-order-status:empty { display:none; }
.project-order-status button { border:0; background:none; color:var(--text); font:inherit; text-decoration:underline; cursor:pointer; }
.project-rail-item.is-dragging { opacity:.35; }
.project-rail-item.drop-before { border-top-color:var(--text); }
.project-rail-item.drop-after { border-bottom-color:var(--text); }
.project-rail-item.project-order-ghost { position:fixed; z-index:2000; background:var(--panel); box-shadow:0 12px 30px #0002; pointer-events:none; opacity:.95; transition:none; will-change:transform; }
body.is-sorting-projects, body.is-sorting-projects * { cursor:grabbing !important; user-select:none !important; }

.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;
}

.release-management-layout { display:grid; gap:14px; }
.release-publish-form { display:grid; gap:14px; padding:16px; }
.release-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.release-publish-form .field { display:grid; gap:6px; color:var(--muted); font-size:calc(12px * var(--ui-font-scale)); }
.release-publish-form input,.release-publish-form select,.release-publish-form textarea { width:100%; min-width:0; }
.release-form-actions { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.release-form-actions .muted-note { flex:1 1 320px; }
.release-form-error { margin:0; color:#be2940; font-size:calc(13px * var(--ui-font-scale)); }
.release-history-list { display:grid; gap:0; }
.release-history-item { padding:16px; border-top:1px solid var(--line); }
.release-history-item:first-child { border-top:0; }
.release-history-head { display:flex; align-items:center; justify-content:space-between; gap:12px; color:var(--muted); font-size:calc(12px * var(--ui-font-scale)); }
.release-history-head > div { display:flex; align-items:center; gap:8px; min-width:0; }
.release-history-head strong { color:var(--text); font-size:calc(16px * var(--ui-font-scale)); }
.release-history-item h3 { margin:10px 0 6px; font-size:calc(15px * var(--ui-font-scale)); }
.release-history-item p { margin:0; color:var(--muted); line-height:1.6; }
.release-history-item ul { display:grid; gap:4px; margin:12px 0; padding-left:20px; color:var(--text); line-height:1.6; }
.release-history-meta { display:flex; flex-wrap:wrap; gap:6px 14px; color:var(--muted); font-size:calc(11px * var(--ui-font-scale)); overflow-wrap:anywhere; }
@media (max-width:600px) { .release-form-grid { grid-template-columns:1fr; } .release-history-head { align-items:flex-start; flex-direction:column; gap:4px; } }

.admin-record-filters { display:flex; flex-wrap:wrap; align-items:end; gap:10px; }
.admin-record-filters label { display:grid; gap:5px; flex:1 1 130px; min-width:0; color:var(--muted); font-size:calc(12px * var(--ui-font-scale)); }
.admin-record-filters input,.admin-record-filters select { width:100%; min-width:0; }
.admin-record-filters .admin-record-search { flex:2 1 210px; }
.admin-record-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.admin-record-note { margin:0; padding:8px 12px; font-size:calc(12px * var(--ui-font-scale)); color:var(--muted); line-height:1.6; }
.admin-record-error { color:var(--text); padding:12px; border:1px solid var(--line); }
.admin-record-browser { display:grid; grid-template-columns:minmax(300px, 0.85fr) minmax(0,1.15fr); gap:14px; align-items:start; }
.admin-record-list-panel,.admin-record-detail { min-width:0; overflow:hidden; }
.admin-record-tabs { display:flex; flex-wrap:wrap; gap:6px; padding:12px; border-bottom:1px solid var(--line); }
.admin-record-tabs .active { background:var(--text); color:var(--panel); }
.admin-record-list-scroll,.admin-record-detail-scroll { max-height:58vh; overflow:auto; overscroll-behavior:contain; }
.admin-record-row { display:grid; grid-template-columns:minmax(0,1.1fr) minmax(0,1fr) minmax(90px,.8fr); gap:10px; width:100%; padding:18px 14px; text-align:left; border:0; border-bottom:1px solid var(--line); border-radius:0; background:transparent; color:var(--text); font:inherit; cursor:pointer; }
.admin-record-row span { min-width:0; overflow-wrap:anywhere; }
.admin-record-column-head { display:grid; grid-template-columns:minmax(0,1.1fr) minmax(0,1fr) minmax(90px,.8fr); gap:10px; padding:10px 14px; background:var(--panel-2); color:var(--muted); font-size:calc(12px * var(--ui-font-scale)); }
.admin-record-row small,.admin-record-table small { display:block; margin-top:6px; color:var(--muted); font-size:calc(12px * var(--ui-font-scale)); }
.admin-record-row.is-selected,.admin-record-row:hover { background:var(--panel-2); }
.admin-record-detail .surface-header { align-items:start; }
.admin-record-detail h2 { font-size:calc(18px * var(--ui-font-scale)); overflow-wrap:anywhere; }
.admin-record-detail-scroll { padding:16px; }
.admin-conversation-message { width:88%; min-width:0; margin:0 auto 20px 0; text-align:left; }
.admin-conversation-message.is-user { margin-left:auto; margin-right:0; }
.admin-conversation-message.is-user header { justify-content:flex-end; }
.admin-conversation-message header { display:flex; flex-wrap:wrap; gap:4px 12px; align-items:center; margin-bottom:8px; }
.admin-conversation-message small { color:var(--muted); }
.admin-content-block { position:relative; background:var(--panel-2); padding:12px; border-radius:8px; margin:8px 0; }
.admin-content-copy { position:absolute; top:6px; right:8px; padding:3px 8px; min-height:28px; font-size:calc(12px * var(--ui-font-scale)); }
.admin-content-block summary { padding-right:60px; }
.admin-content-block summary { cursor:pointer; font-size:calc(12px * var(--ui-font-scale)); color:var(--muted); }
.admin-content-block pre { white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; line-height:1.75; margin:10px 0 0; }
.admin-record-table { width:100%; border-collapse:collapse; }
.admin-record-table th,.admin-record-table td { padding:12px; text-align:left; border-bottom:1px solid var(--line); }
.admin-record-list-panel .admin-pagination { padding:12px; flex-wrap:wrap; }
.admin-record-audit { margin-top:8px; }
.admin-record-audit summary { cursor:pointer; color:var(--muted); padding:10px; }
@media(max-width:1000px) { .admin-record-browser { grid-template-columns:minmax(0,1fr); } .admin-record-list-scroll { max-height:35vh; } }
@media(max-width:600px) { .admin-record-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); } .admin-record-row { font-size:calc(12px * var(--ui-font-scale)); gap:6px; padding:12px 8px; grid-template-columns:1fr 1fr 80px; } .admin-record-tabs button { min-height:40px; } }

.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: auto minmax(0, 1fr) auto;
  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;
  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; justify-self: center; }
@media (min-width: 921px) {
  .sidebar.sidebar-user { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
}
.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: var(--panel-2); color: var(--text); }
.admin-menu-anchor[open] .admin-menu-trigger .utility-icon { transform: rotate(180deg); }
.personal-admin-trigger {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--control-bg); color: var(--text); cursor: pointer;
}
.personal-admin-trigger:hover { border-color: var(--muted); }
.personal-admin-trigger .nav-icon { color: var(--text); }
.personal-admin-copy { display: grid; flex: 1; min-width: 0; gap: 4px; }
.personal-admin-copy span { color: var(--muted); font-size: calc(12px * var(--ui-font-scale)); }
.personal-admin-trigger:focus-visible, .personal-admin-dropdown .nav-button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.admin-menu-dropdown {
  padding: 4px 0 0;
}
.personal-admin-dropdown {
  margin-top: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
}
.personal-admin-dropdown .nav-button { width: 100%; min-width: 0; height: 36px; justify-content: flex-start; padding: 0 10px; color: var(--text); font-size: calc(13px * var(--ui-font-scale)); }
.admin-menu-divider { height: 1px; margin: 6px 3px; background: var(--line); }
.admin-menu-dropdown .nav-icon .utility-icon { width: 16px; height: 16px; }
.topbar-admin-menu > summary { display:flex; align-items:center; gap:8px; cursor:pointer; }
.topbar-admin-menu > summary:focus-visible { outline:2px solid var(--muted); outline-offset:3px; }
.topbar-admin-menu[open] > summary { background:var(--hover-bg); }
.topbar-admin-dropdown {
  position:absolute; z-index:100; top:calc(100% + 8px); left:50%; transform:translateX(-50%);
  width:220px; max-width:calc(100vw - 32px); padding:6px;
  background:var(--panel); border:1px solid var(--line); border-radius:var(--radius-ui); box-shadow:var(--shadow);
  animation:admin-navigation-open 160ms cubic-bezier(.2,.8,.2,1) both;
}
.sidebar-user .topbar-admin-dropdown .nav-button { width:100%; height:40px; min-width:0; justify-content:flex-start; padding:0 10px; font-size:calc(13px * var(--ui-font-scale)); }
@keyframes admin-navigation-open { from { opacity:0; translate:0 -4px; } to { opacity:1; translate:0 0; } }
@media (prefers-reduced-motion:reduce) { .topbar-admin-dropdown { animation:none; } }
.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; }
}

/* Layout follows available space, not device names. Desktop rules stay intact. */
.reply-version-area { margin: 10px 0 14px; color: var(--text); }
.reply-version-area:not(:has(> *)) { display: none; }
.message-frame { container-type: inline-size; }
.reply-action-bar { display: grid; grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr); align-items: center; gap: 8px; padding-top: 10px; }
.reply-action-bar .reply-footer-tools { padding: 0; align-self: center; }
.reply-action-bar .reply-version-pager { padding: 0; gap: 8px; }
.reply-action-bar .content-collapse-toggle { justify-self: end; margin: 0; min-height: 32px; white-space: nowrap; }
.content-collapse-toggle.is-expanded .content-collapse-icon { transform: rotate(180deg); }
@container (max-width: 740px) {
  .reply-action-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; }
  .reply-action-bar .reply-footer-tools { flex: 1 1 100%; }
  .reply-action-bar .reply-version-pager { justify-content: flex-start; }
  .reply-action-bar .content-collapse-toggle { margin-left: auto; }
}
.reply-version-area:empty { display: none; }
.assistant-heading { flex-wrap: wrap; }
.assistant-heading > div { min-width: 0; }
.reply-footer-tools { display: flex; justify-content: flex-start; align-items: center; align-self: flex-start; gap: 4px; flex-wrap: wrap; max-width: 100%; padding: 6px 0 2px; }
.reply-footer-tools .reply-history-trigger { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 5px 10px; margin-right: 4px; font-size: calc(12px * var(--ui-font-scale)); }
.reply-footer-tools .message-tool { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; }
.reply-footer-tools svg, .reply-version-pager svg, .reply-history-drawer svg, .continuation-basis svg { width: 16px; height: 16px; flex-shrink: 0; }
.reply-footer-tools button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
@media (max-width: 380px) {
  .reply-footer-tools { display: grid; grid-template-columns: repeat(4, 44px); }
  .reply-footer-tools .reply-history-trigger { grid-column: 1 / -1; justify-self: start; margin-right: 0; }
}
.reply-history-trigger svg, .continuation-basis svg { fill: currentColor; stroke: none; }
.reply-version-pager { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; padding: 16px 8px 10px; }
.version-page-arrow { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 32px; padding: 0; border-radius: 20px; }
.version-page-arrow.previous .utility-icon { transform: rotate(90deg); }
.version-page-arrow.next .utility-icon { transform: rotate(-90deg); }
.version-page-arrow:disabled { opacity: .35; cursor: default; }
.version-page-count { font-size: calc(12px * var(--ui-font-scale)); min-width: 38px; text-align: center; font-variant-numeric: tabular-nums; }
.version-adopt-control { flex: 0 0 calc(104px * var(--ui-font-scale)); width: calc(104px * var(--ui-font-scale)); min-height: 32px; padding: 5px 8px; font-size: calc(12px * var(--ui-font-scale)); white-space: nowrap; text-align: center; }
.version-adopt-control.is-adopted:disabled { opacity: 1; color: var(--muted); background: var(--panel-2); border-color: var(--line); cursor: default; }
.reply-adopted-badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 12px; color: var(--muted); background: var(--panel-2); font-size: calc(11px * var(--ui-font-scale)); white-space: nowrap; }
.reply-adopted-badge.is-adopted { color: var(--text); background: color-mix(in srgb, var(--text) 9%, var(--panel)); }
.reply-history-drawer { position: fixed; z-index: 220; top: 88px; right: 16px; bottom: 16px; width: min(360px, calc(100vw - 24px)); display: flex; flex-direction: column; min-height: 0; padding: 20px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); box-shadow: 0 12px 40px #0002; }
.reply-history-drawer header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 0 0 auto; }
.reply-history-drawer h3 { margin: 0; font-size: calc(18px * var(--ui-font-scale)); }
.reply-history-drawer .message-tool { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; }
.reply-history-drawer .message-tool svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
.reply-drawer-hint { font-size: calc(12px * var(--ui-font-scale)); color: var(--muted); line-height: 1.6; }
.reply-drawer-list { display: grid; align-content: start; gap: 12px; overflow: auto; min-height: 0; flex: 1; padding: 3px; }
.reply-history-card { width: 100%; min-width: 0; padding: 14px; display: grid; gap: 8px; text-align: left; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; overflow-wrap: anywhere; }
.reply-history-card:hover { background: var(--panel-2); }
.reply-history-card.is-selected { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.reply-history-card-title { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.reply-history-summary { font-size: calc(13px * var(--ui-font-scale)); line-height: 1.5; }
.reply-history-card small, .reply-history-excerpt { color: var(--muted); font-size: calc(12px * var(--ui-font-scale)); line-height: 1.65; }
.reply-history-excerpt { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.reply-history-drawer footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 14px; }
@media (max-height: 500px) and (max-width: 1399px) {
  .reply-history-drawer { top: 12px; bottom: 12px; height: calc(100dvh - 24px); }
}
.continuation-basis { display: flex; width: fit-content; max-width: calc(100% - 24px); min-height: 24px; align-items: center; gap: 6px; margin: 4px 12px 0; padding: 2px 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font: inherit; font-size: calc(12px * var(--ui-font-scale)); line-height: 1.5; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.continuation-basis:hover { color: var(--text); background: transparent; }
.continuation-basis:focus-visible { outline: 2px solid var(--muted); outline-offset: 2px; }
.continuation-basis svg { width: 14px; height: 14px; }
.continuation-basis-chevron { display: flex; flex-shrink: 0; }
.continuation-basis-chevron .utility-icon { transform: rotate(-90deg); width: 12px; height: 12px; flex-basis: 12px; }
.assistant-message:focus { outline: 1px solid var(--muted); outline-offset: -1px; border-radius: 8px; }
@media (min-width: 1400px) {
  .workbench-grid.source-collapsed > .reply-history-drawer { position: static; flex: 0 0 clamp(290px, 23vw, 350px); height: var(--workbench-card-height); width: auto; box-shadow: none; }
  .has-reply-drawer.source-collapsed .result-control-bar { display: flex; flex-wrap: wrap; gap: 8px; }
  .has-reply-drawer.source-collapsed .result-control-bar .field { flex: 1 1 120px; min-width: 0; }
  .has-reply-drawer.source-collapsed .result-control-bar .model-picker-field { flex-basis: 180px; }
}
@media (max-width: 760px) {
  .reply-action-bar .content-collapse-toggle { min-height: 44px; }
  .reply-history-drawer { top: max(12px, var(--responsive-top, 0px)); bottom: auto; right: 12px; max-height: calc(var(--responsive-height, 100dvh) - 24px); height: calc(var(--responsive-height, 100dvh) - 24px); }
  .reply-footer-tools { gap: 2px; }
  .reply-footer-tools .message-tool, .reply-footer-tools .reply-history-trigger, .reply-history-drawer button, .reply-version-pager button { min-height: 44px; min-width: 44px; }
  .continuation-basis { min-height: 32px; margin: 2px 12px 0; }
}
.reply-version-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.reply-version-toolbar button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; }
.reply-version-toolbar svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; }
.reply-version-caption { font-size: calc(12px * var(--ui-font-scale)); color: var(--muted); }
.reply-revision-dialog { width:min(760px,calc(100vw - 32px)); max-width:none; max-height:calc(100dvh - 32px); padding:0; border:1px solid var(--line); border-radius:14px; background:var(--panel); color:var(--text); box-shadow:0 22px 70px rgba(0,0,0,.16); overflow:hidden; }
.reply-revision-dialog::backdrop { background:rgba(0,0,0,.24); }
.reply-revision-dialog-card { display:flex; flex-direction:column; max-height:calc(100dvh - 34px); }
.reply-revision-progress:not([hidden]) { display:grid; grid-template-columns:1fr auto; gap:6px 12px; flex:0 0 auto; margin:12px 24px; padding:12px; border:1px solid var(--line); border-radius:10px; font-size:13px; }
.reply-revision-progress p { grid-column:1 / -1; margin:0; color:var(--muted); line-height:1.5; }
.reply-revision-progress span { color:var(--muted); }
.reply-revision-raw { margin:12px 0; font-size:13px; }
.reply-revision-raw summary { cursor:pointer; }
.reply-revision-raw p { color:var(--muted); line-height:1.5; }
.reply-revision-raw pre { white-space:pre-wrap; overflow-wrap:anywhere; max-height:200px; overflow:auto; padding:12px; border:1px solid var(--line); border-radius:8px; font:inherit; }
.reply-revision-dialog-header { display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-rows:auto auto; gap:10px 18px; align-items:start; flex:0 0 auto; padding:22px 24px 16px; }
.reply-revision-dialog-header > div { grid-column:1; grid-row:1 / 3; }
.reply-revision-dialog-header h2 { margin:0; font-size:calc(20px * var(--ui-font-scale)); line-height:1.3; }
.reply-revision-dialog-header p { margin:9px 0 0; color:var(--muted); font-size:calc(13px * var(--ui-font-scale)); line-height:1.4; }
.reply-revision-dialog-close { grid-column:2; grid-row:1; justify-self:end; display:grid; place-items:center; width:28px; height:28px; padding:5px; border-radius:7px; color:var(--muted); cursor:pointer; }
.reply-revision-dialog-close svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.6; }
.reply-revision-dialog-manual { grid-column:2; grid-row:2; padding:7px 14px; min-height:36px; font-size:calc(14px * var(--ui-font-scale)); }
.reply-revision-dialog-body { display:grid; grid-template-columns:minmax(0,1fr); gap:8px; padding:0 24px 18px; min-height:0; overflow:auto; overscroll-behavior:contain; }
.reply-revision-dialog-body label { font-size:calc(14px * var(--ui-font-scale)); font-weight:var(--weight-semibold); line-height:1.5; }
.reply-revision-dialog-body label:not(:first-child) { margin-top:10px; }
.reply-revision-dialog-body label span { color:var(--muted); font-size:calc(12px * var(--ui-font-scale)); font-weight:var(--weight-regular); }
.reply-revision-dialog-body textarea { width:100%; min-height:84px; height:84px; max-height:240px; padding:11px 12px; border:1px solid var(--line); border-radius:10px; color:var(--text); background:var(--control-bg); resize:vertical; font-size:calc(14px * var(--ui-font-scale)); line-height:1.6; }
.reply-revision-dialog-body #replyRevisionOriginal { min-height:96px; height:96px; font-size:calc(13px * var(--ui-font-scale)); }
.reply-revision-dialog-body textarea:focus { outline:2px solid var(--line-strong); outline-offset:1px; }
.reply-revision-dialog-feedback { margin:0; color:var(--danger); font-size:calc(12px * var(--ui-font-scale)); line-height:1.5; }
.reply-revision-dialog-footer { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; flex:0 0 auto; margin:0 24px; padding:16px 0 22px; border-top:1px solid var(--line); }
.reply-revision-dialog-footer small { color:var(--muted); font-size:calc(12px * var(--ui-font-scale)); line-height:1.5; }
.reply-revision-dialog-footer > div { display:flex; gap:8px; margin-left:auto; }
.reply-revision-dialog-footer button { min-height:38px; padding:8px 16px; font-size:calc(14px * var(--ui-font-scale)); }
@media (max-width:600px),(max-height:500px) {
  .reply-revision-dialog { width:calc(100vw - 24px); max-height:calc(100dvh - 24px); }
  .reply-revision-dialog-card { max-height:calc(100dvh - 26px); }
  .reply-revision-dialog-header { padding:16px 16px 12px; gap:6px 12px; }
  .reply-revision-dialog-header h2 { font-size:calc(18px * var(--ui-font-scale)); }
  .reply-revision-dialog-header p { font-size:calc(12px * var(--ui-font-scale)); }
  .reply-revision-dialog-body { padding:0 16px 14px; }
  .reply-revision-dialog-footer { margin:0 16px; padding:12px 0 16px; }
  .reply-revision-dialog-footer button { min-height:44px; }
  .reply-revision-dialog-close { width:36px; height:36px; }
}
.reply-revision-footer { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.reply-revision-footer > div { display: flex; gap: 8px; margin-left: auto; }
.reply-revision-footer small, .reply-version-history p { color: var(--muted); }
.reply-version-history { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; max-height: 290px; overflow: auto; }
.reply-version-history p { font-size: calc(12px * var(--ui-font-scale)); margin: 0 0 10px; }
.reply-version-save-error { border: 1px solid #b42318; border-radius: 8px; padding: 10px; margin-bottom: 10px; color: #b42318; }
.reply-version-item { width: 100%; display: grid; gap: 4px; text-align: left; padding: 10px; background: var(--panel); color: var(--text); border: 1px solid transparent; border-bottom-color: var(--line); border-radius: 6px; }
.reply-version-item span { overflow-wrap: anywhere; }
.reply-version-item small { color: var(--muted); }
.reply-version-item.is-selected { border-color: var(--text); background: var(--bg); }
@media (max-width:760px) { .reply-version-toolbar button, .reply-revision-footer button { min-height:44px; } }
.responsive-toolbar, .responsive-panel-header, .responsive-extra-panel,
.responsive-source-save, .responsive-control-label, [data-responsive="config"] { display: none; }
.responsive-source-settings { display: none !important; }
.responsive-touch-action { display: none; }
@media (max-width: 1180px) {
  .responsive-touch-action { display: inline-flex; min-height: 36px; align-items: center; padding: 6px; }
  .project-rail-item { flex-wrap: wrap; }
  .project-group-tab-row .responsive-touch-action { flex-shrink: 0; }
  .app-layout.user-layout:has(.main-workbench) { height: var(--responsive-height, 100dvh); display: flex; flex-direction: column; overflow: hidden; }
  .user-layout .main-workbench { flex: 1; min-height: 0; padding: 12px; overflow: hidden; }
  .user-layout .workbench-grid { height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(180px, 23%) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 12px; }
  .main-workbench .workbench-grid > .surface { height: 100%; min-height: 0; min-width: 0; max-width: none; }
  .main-workbench .workbench-nav-panel { grid-column: 1; grid-row: 1; }
  .main-workbench .responsive-result { grid-column: 2; grid-row: 1; contain: none !important; }
  .main-workbench .workbench-nav-body { min-height: 0; overflow: auto; }
  .main-workbench .workbench-grid > .source-panel { display: none; }
  .main-workbench .result-control-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; padding: 12px; }
  .main-workbench .result-control-bar .field { flex: 1 1 130px; min-width: 0; }
  .main-workbench .result-control-bar .model-picker-field { flex: 1 1 100%; }
  .result-control-bar .source-sidebar-toggle { width: auto; min-width: 44px; min-height: 44px; padding: 8px 10px; display: inline-flex; align-items: center; gap: 6px; }
  .responsive-control-label { display: inline; white-space: nowrap; }
  .main-workbench .responsive-result > .surface-header { padding: 12px; gap: 8px; }
  .responsive-result > .surface-header p { display: none; }
  .responsive-result .status-line { flex-wrap: wrap; min-width: 0; }
  .main-workbench .result-chat-composer { padding-top: 10px; padding-bottom: 10px; gap: 8px; }
  .main-workbench #resultChatInput { height: clamp(48px, 10dvh, 100px) !important; min-height: 44px; }
  .composer-resize-handle { display: none; }
  .composer-tool-button { min-width: 40px; min-height: 40px; }
  .main-workbench .project-group-workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .project-group-rail { width: 100%; max-height: 92px; min-height: 0; display: flex; align-items: center; overflow: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .project-group-head { flex: 0 0 auto; padding: 8px; }
  .project-group-tabs { display: flex; flex: 1; overflow-x: auto; gap: 6px; padding: 8px; }
  .project-group-tabs > * { flex: 0 0 auto; max-width: 180px; }
  .main-workbench [data-responsive-panel].responsive-open {
    display: flex !important; flex-direction: column; position: fixed;
    inset: var(--responsive-top, 0px) 0 auto; height: var(--responsive-height, 100dvh) !important;
    min-height: 0 !important; max-height: none; width: min(100%, 600px); margin-left: auto;
    max-width: none !important; opacity: 1; transform: none; pointer-events: auto !important;
    z-index: 45; border: 1px solid var(--line); border-radius: 0; background: var(--panel); contain: none;
    box-shadow: -12px 0 60px rgba(0,0,0,.16); overflow: auto;
  }
  .main-workbench .source-panel.responsive-open .surface-header,
  .main-workbench .source-panel.responsive-open .surface-body { opacity: 1 !important; }
  .responsive-open .responsive-panel-header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; position: sticky; top: 0; z-index: 2; border-bottom: 1px solid var(--line); background: var(--panel); }
  .responsive-panel-header button { min-height: 44px; }
  .responsive-open .responsive-source-save { display: inline-flex; }
  .responsive-open .responsive-source-settings { display: inline-flex !important; align-self: start; min-height: 44px; }
  .main-workbench .source-panel.responsive-open > .surface-header { display: none; }
  .main-workbench .source-panel.responsive-open .surface-body { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
  .source-panel.responsive-open .surface-body > .field { display: flex; flex-direction: column; flex: 1; min-height: 180px; margin: 0; }
  .source-panel.responsive-open .surface-body .source-drop-input { flex: 1; height: auto; min-height: 120px; }
  .source-panel.responsive-open .muted-note { display: none; }
  .source-panel.responsive-open .input-actions { flex-shrink: 0; margin: 0; }
  .source-panel.responsive-open .input-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .source-panel.responsive-open .input-actions .secondary-actions { grid-column: 1 / -1; grid-row: 1; display: flex; justify-content: space-between; }
  .source-panel.responsive-open .responsive-source-save { grid-column: 1; grid-row: 2; justify-content: center; min-height: 44px; }
  .source-panel.responsive-open .source-generate-actions { grid-column: 2; grid-row: 2; }
  .source-panel.responsive-open .source-generate-actions > button { width: 100%; justify-content: center; }
  .workbench-nav-panel.responsive-open > .compact-header { display: none; }
  .source-panel.responsive-open .source-generate-button { width: auto; display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; }
  .responsive-open .input-actions { flex-wrap: wrap; gap: 12px; }
  .responsive-open .source-generate-button { min-width: 56px; min-height: 44px; }
  .responsive-open .source-drop-input { min-height: 220px; height: 40dvh; }
  .responsive-open .surface-header { padding: 16px; }
  .responsive-extra-panel > .field, .responsive-extra-panel > button { margin: 14px; }
  .responsive-extra-panel > button { min-height: 44px; }
  .chat-message-actions, .chat-message-tools { opacity: 1; visibility: visible; }
  .modal-card { max-width: 100%; min-width: 0; max-height: calc(var(--responsive-height, 100dvh) - 24px); }
  .main-admin-window { min-width: 0; }
  .admin-window-content { overflow: auto; }
}
@media (max-width: 760px), (max-width: 1180px) and (max-height: 500px) {
  .sidebar.sidebar-user { min-height: 56px; padding: 6px max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left)); display: flex; flex-direction: row; flex-shrink: 0; justify-content: space-between; gap: 6px; }
  .sidebar-user .nav { display: none; }
  .sidebar-user .brand-subtitle { display: none; }
  .sidebar-user .brand-title { font-size: calc(12px * var(--ui-font-scale)); }
  .sidebar-user .brand { grid-template-columns: 30px minmax(0,1fr); gap: 6px; }
  .sidebar-user .brand-mark { width: 30px; height: 30px; }
  .sidebar-user .account-trigger { width: 36px; padding: 0; justify-content: center; }
  .sidebar-user .account-display-name, .sidebar-user .account-trigger > .utility-icon { display: none; }
  .sidebar-user .points-trigger { min-width: 60px; padding: 0 6px; }
  .sidebar-user .sidebar-utilities, .sidebar-user .sidebar-utility-row { gap: 4px; }
  .sidebar-user .utility-button { min-height: 40px; }
  .sidebar-user .has-tooltip::after { display: none; }
  .user-layout .main-workbench { padding: 6px max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); }
  .user-layout .workbench-grid { display: flex; flex-direction: column; gap: 6px; }
  .main-workbench .workbench-grid > .workbench-nav-panel { display: none; }
  .main-workbench .workbench-grid > .surface.responsive-result:not(.workbench-nav-panel):not(.source-panel) { flex: 1 1 0; min-height: 0; height: 0; }
  .responsive-toolbar { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
  .responsive-toolbar button { min-height: 44px; flex-shrink: 0; }
  .responsive-project-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .responsive-result > .surface-header { display: none; }
  .main-workbench .result-control-bar { padding: 6px 8px; gap: 6px; }
  .main-workbench .result-control-bar .model-picker-field { flex: 1 1 50%; }
  .result-control-bar .field > span { display: none; }
  [data-responsive="config"] { display: inline-flex; align-items: center; min-height: 44px; }
  .result-control-bar .source-sidebar-toggle { padding: 6px 8px; font-size: calc(12px * var(--ui-font-scale)); }
  .main-workbench [data-responsive-panel].responsive-open { width: 100%; }
  .project-group-head .episode-bar-title { display: none; }
  .project-group-rail { max-height: 60px; }
  .main-workbench .result-chat-composer { padding-top: 6px; padding-bottom: 8px; }
  .composer-toolbar { gap: 4px; padding-inline: 8px; }
  .composer-tool-button { width: 34px; height: 44px; flex-basis: 34px; }
  .main-workbench #resultChatInput { height: 48px !important; font-size: calc(14px * var(--ui-font-scale)); }
  .composer-input-shell { min-width: 0; }
  .user-message-stack { max-width: 100%; }
  .chat-bubble { font-size: calc(14px * var(--ui-font-scale)); }
  .message-tools { opacity: 1 !important; visibility: visible !important; }
  .main-workbench .result-chat-composer .composer-action-button { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .modal-backdrop { padding: 0; }
  .modal-card { border-radius: 0; width: 100%; max-height: var(--responsive-height,100dvh); }
  .personal-settings-card { height: var(--responsive-height,100dvh); display: flex; flex-direction: column; }
  .personal-settings-body { flex: 1; min-height: 0; overflow: auto; }
  .personal-settings-card .personal-settings-body { background: var(--bg); gap: 16px; }
  .personal-settings-card .personal-settings-section { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
  .personal-settings-card .modal-header .eyebrow { display: none; }
  .personal-settings-card .modal-header h2 { font-size: calc(18px * var(--ui-font-scale)); }
  .personal-settings-card .personal-settings-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .personal-settings-actions > button { min-height: 44px; }
  .personal-settings-row { flex-wrap: wrap; gap: 10px; }
  .settings-language-options { flex-wrap: wrap; }
  .personal-settings-card .modal-header { flex: 0 0 auto; }
  .personal-settings-actions { flex: 0 0 auto; flex-wrap: wrap; gap: 8px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .quick-phrase-popover, .translation-popover { max-width: calc(100vw - 24px); max-height: 55dvh; overflow: auto; }
}
@media (max-width: 380px) {
  .sidebar-user .brand-title { display: none; }
}
@media (max-width: 1180px) and (max-height: 500px) {
  .sidebar.sidebar-user { min-height: 44px; padding-top: 2px; padding-bottom: 2px; }
  .responsive-toolbar { gap: 6px; }
  .responsive-toolbar button { min-height: 36px; }
  .main-workbench .result-control-bar .model-picker-field { flex: 1 1 160px; }
  .main-workbench .result-control-bar { flex-wrap: nowrap; overflow-x: auto; flex-shrink: 0; }
  .main-workbench .result-control-bar > * { flex-shrink: 0; }
  .main-workbench #resultChatInput { height: 36px !important; min-height: 32px; }
  .composer-toolbar { min-height: 44px; height: auto; }
  .composer-tool-button { min-height: 32px; }
  .main-workbench .project-group-rail { max-height: 44px; }
}
.context-book-icon { display:block; width:20px; height:20px; background:currentColor; mask:url("vendor/feather/book-open.svg") center/contain no-repeat; }
.compact-action-icon { display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; width:38px; min-width:38px; height:38px; padding:8px; }
.bulk-favorite-button { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:38px; padding:7px 10px; white-space:nowrap; font-size:calc(12px * var(--ui-font-scale)); transition:background-color 180ms ease,border-color 180ms ease; }
.bulk-favorite-button svg { width:16px; height:16px; flex-shrink:0; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linejoin:round; }
.bulk-favorite-button svg.is-filled { fill:currentColor; stroke:none; }
.bulk-favorite-count { color:var(--muted); font-variant-numeric:tabular-nums; }
.bulk-favorite-button[aria-pressed="true"] { border-color:var(--line-strong); background:var(--control-bg); }
.bulk-favorite-button:focus-visible { outline:2px solid var(--muted); outline-offset:2px; }
.compact-action-icon svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.action-download-symbol,.action-recycle-symbol { display:block; width:20px; height:20px; background:currentColor; mask:center/contain no-repeat; }
.action-download-symbol { mask-image:url("vendor/feather/download.svg"); }

/* Compact project toolbar: one header, shared original controls and actions. */
.workbench-result-surface { container-type:inline-size; container-name:workbench-result; }
.main-workbench .result-control-bar.compact-workbench-toolbar {
  display:grid; grid-template-columns:minmax(0,1fr) minmax(120px,200px) minmax(0,1fr);
  gap:16px; align-items:center; padding:8px 18px; flex:0 0 auto;
  background:var(--panel);
}
.workbench-toolbar-start,.workbench-toolbar-end,.workbench-toolbar-tools { display:flex; align-items:center; min-width:0; gap:10px; }
.workbench-toolbar-tools { flex:0 0 auto; align-items:center; gap:8px; }
.compact-workbench-toolbar .workbench-toolbar-start .model-picker-field { flex:1 1 200px; max-width:340px; min-width:100px; }
.workbench-toolbar-end { justify-content:flex-end; }
.compact-workbench-toolbar .workbench-toolbar-end > .field { display:flex; align-items:center; gap:8px; flex:0 1 210px; min-width:140px; }
.compact-workbench-toolbar .workbench-toolbar-end > .field > span { flex:0 0 auto; margin:0; }
.compact-workbench-toolbar .workbench-toolbar-end > .field select { min-width:0; flex:1 1 auto; padding-block:4px; }
.workbench-toolbar-actions { position:relative; display:flex; align-items:center; justify-content:flex-end; flex:0 0 auto; gap:8px; flex-wrap:nowrap; padding-left:12px; border-left:1px solid var(--line); }
.workbench-toolbar-actions > * { flex-shrink:0; }
.workbench-toolbar-title { min-width:0; text-align:center; align-self:center; }
.workbench-toolbar-title .project-title { display:block; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:calc(20px * var(--ui-font-scale)); line-height:1.3; }
.workbench-toolbar-title .project-title-input { width:100%; min-width:0; font-size:calc(18px * var(--ui-font-scale)); text-align:center; }
/* Keep the background-task explanation accessible without contributing a
   zero-width, many-line flex item to the toolbar's intrinsic height. */
.workbench-toolbar-actions .generation-background-hint { position:absolute; width:1px; height:1px; padding:0; margin:-1px; border:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.compact-workbench-toolbar .field > span { font-size:calc(12px * var(--ui-font-scale)); }
.compact-workbench-toolbar .field select,.compact-workbench-toolbar .model-picker-trigger { min-height:34px; height:34px; }
.compact-workbench-toolbar .source-sidebar-toggle { width:36px; height:36px; min-width:36px; min-height:36px; padding:7px; }
.workbench-toolbar-actions .bulk-favorite-button { white-space:nowrap; }
.workbench-toolbar-actions [data-action="download-output"][aria-expanded="true"] { border-color:var(--text); background:var(--hover-bg); }
.workbench-download-menu {
  position:fixed; inset:auto; margin:0; padding:8px; width:min(260px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); overflow:auto;
  border:1px solid var(--line); border-radius:14px; color:var(--text); background:var(--panel);
  box-shadow:0 16px 44px rgba(0,0,0,.12); z-index:150; font-family:var(--font-sans);
}
.download-menu-heading { display:grid; gap:4px; padding:8px 10px 10px; }
.download-menu-heading strong { font-size:calc(14px * var(--ui-font-scale)); font-weight:var(--weight-semibold); }
.download-menu-heading small { color:var(--muted); font-size:calc(12px * var(--ui-font-scale)); }
.workbench-download-menu [role="menuitem"] { display:flex; align-items:center; gap:10px; width:100%; min-height:44px; padding:9px 10px; border:0; border-radius:9px; color:var(--text); background:transparent; text-align:left; font-size:calc(14px * var(--ui-font-scale)); cursor:pointer; }
.workbench-download-menu [role="menuitem"] svg { width:18px; height:18px; flex-shrink:0; fill:none; stroke:currentColor; stroke-width:1.6; }
.workbench-download-menu [role="menuitem"] small { margin-left:auto; color:var(--muted); font-size:calc(12px * var(--ui-font-scale)); }
.workbench-download-menu [role="menuitem"]:hover,.workbench-download-menu [role="menuitem"]:focus-visible { background:var(--hover-bg); outline:2px solid transparent; }
@container workbench-result (max-width:1250px) {
  .workbench-toolbar-actions .document-preview-trigger > span,.workbench-toolbar-actions .bulk-favorite-button > span:not(.bulk-favorite-count) { display:none; }
  .workbench-toolbar-actions .document-preview-trigger { padding:7px; width:36px; }
  .main-workbench .result-control-bar.compact-workbench-toolbar { gap:10px; grid-template-columns:minmax(0,1fr) minmax(100px,160px) minmax(0,1fr); padding-inline:12px; }
  .workbench-toolbar-actions { gap:6px; padding-left:8px; }
  .workbench-toolbar-start,.workbench-toolbar-end { gap:8px; }
}
@container workbench-result (max-width:850px) {
  .main-workbench .result-control-bar.compact-workbench-toolbar { grid-template-columns:minmax(0,1fr) auto; row-gap:8px; }
  .workbench-toolbar-title { grid-column:1 / -1; grid-row:1; }
  .workbench-toolbar-start { grid-column:1; grid-row:2; }
  .workbench-toolbar-end { grid-column:2; grid-row:2; }
  .workbench-toolbar-tools { gap:4px; }
  .workbench-toolbar-actions > .badge { display:none; }
}
@media (max-width:760px),(max-height:500px) {
  .main-workbench .result-control-bar.compact-workbench-toolbar { display:flex; padding:6px 8px; gap:6px; }
  .workbench-toolbar-title { display:none; }
  .compact-workbench-toolbar .workbench-toolbar-start { flex:1 1 auto; align-items:center; }
  .compact-workbench-toolbar .workbench-toolbar-start .model-picker-field { flex:1 1 160px; max-width:none; }
  .workbench-toolbar-end:empty,.workbench-toolbar-end:has(.workbench-toolbar-actions:empty) { display:none; }
  .workbench-toolbar-actions { border:0; padding:0; }
  .workbench-toolbar-actions > .badge { display:none; }
  .compact-workbench-toolbar .source-sidebar-toggle { min-width:36px; min-height:36px; }
  .compact-workbench-toolbar .responsive-control-label { display:none; }
}

/* Workbench controls: motion follows actions; the toolbar geometry stays fixed. */
.result-control-bar :is(.source-sidebar-toggle,.model-picker-trigger,select),
.surface-header [data-action="download-output"] {
  transition: transform 180ms cubic-bezier(.2,.8,.2,1), background-color 180ms ease,
    border-color 180ms ease, color 180ms ease, box-shadow 220ms ease;
}
.result-control-bar :is(.model-picker-trigger,select):not(:disabled):hover,
.surface-header [data-action="download-output"]:not(:disabled):hover {
  border-color: var(--line-strong);
  background-color: var(--control-bg);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--black) 7%, transparent);
}
.result-control-bar :is(.source-sidebar-toggle,.model-picker-trigger,select):not(:disabled):active,
.surface-header [data-action="download-output"]:not(:disabled):active { transform:scale(.965); }
.result-control-bar :is(.source-sidebar-toggle,.model-picker-trigger):focus-visible,
.surface-header [data-action="download-output"]:focus-visible {
  outline:2px solid var(--black); outline-offset:3px;
  box-shadow:0 0 0 4px color-mix(in srgb, var(--black) 8%, transparent);
}
.result-control-bar select:focus {
  outline:none;
  border-color:var(--line-strong);
  box-shadow:0 0 0 3px color-mix(in srgb, var(--muted) 12%, transparent);
}
.result-control-bar .model-picker-trigger i { transition:transform 240ms cubic-bezier(.2,.8,.2,1); }
.result-control-bar .model-picker-trigger[aria-expanded="true"] i { transform:rotate(225deg) translate(-1px,-1px); }
.result-control-bar .model-picker-menu {
  transform-origin:top center;
  animation:workbench-menu-open 180ms cubic-bezier(.2,.8,.2,1) both;
}
.result-control-bar .model-picker-option { transition:background-color 140ms ease,color 140ms ease,transform 160ms ease; }
.result-control-bar .model-picker-option:not(:disabled):hover { transform:translateX(2px); }
.result-control-bar [data-action="toggle-source-panel"] svg { transition:transform 260ms cubic-bezier(.2,.8,.2,1); }
.result-control-bar [data-action="toggle-source-panel"][aria-expanded="true"] svg { transform:translateX(2px); }
[data-action="download-output"].download-busy { cursor:progress; opacity:.7; }
[data-action="download-output"].download-busy .action-download-symbol { animation:workbench-download-wait 900ms ease-in-out infinite; }
@keyframes workbench-menu-open {
  from { opacity:0; transform:translateY(-5px) scale(.985); }
  to { opacity:1; transform:translateY(0) scale(1); }
}
@keyframes workbench-download-wait {
  0%,100% { transform:translateY(-2px); opacity:.55; }
  50% { transform:translateY(2px); opacity:1; }
}
@media (prefers-reduced-motion:reduce) {
  .result-control-bar :is(button,select,svg,i),.result-control-bar .model-picker-menu,
  [data-action="download-output"],[data-action="download-output"] .action-download-symbol { transition:none !important; animation:none !important; }
  .result-control-bar .model-picker-option:hover { transform:none; }
}
.action-recycle-symbol { mask-image:url("vendor/feather/archive-restore.svg"); }
@media (pointer:coarse), (max-width:700px) { .compact-action-icon { min-width:44px; width:44px; height:44px; } }

/* Script square is isolated from the workbench layout. */
.square-entry { width: auto !important; padding-inline: 10px !important; white-space: nowrap; font-size:calc(12px * var(--ui-font-scale)); }
.script-square { box-sizing: border-box; width: min(1100px, 96vw); height: min(900px, 94dvh); max-width: 96vw; max-height: 94dvh; padding: 0; border: 1px solid var(--line, #ddd); border-radius: 16px; color: var(--text, #202124); background: var(--panel, #fff); }
.script-square[open] { display: flex; flex-direction: column; }
.script-square::backdrop { background: #0007; }
.sq-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:18px 24px; border-bottom:1px solid var(--line,#ddd); }
.sq-header h2,.sq-header p { margin:0; }
.sq-header p,.sq-meta,.sq-note { color:var(--muted,#666); font-size:calc(13px * var(--ui-font-scale)); line-height:1.6; }
.sq-content { flex:1; min-height:0; overflow:auto; padding:24px; overflow-wrap:anywhere; }
.sq-status { margin:0; padding:8px 24px; min-height:32px; font-size:calc(13px * var(--ui-font-scale)); }
.script-square button { min-height:40px; border:1px solid var(--line,#ddd); border-radius:9px; padding:8px 12px; background:var(--panel,#fff); color:inherit; cursor:pointer; }
.script-square button:disabled { opacity:.45; cursor:default; }
.script-square button:focus-visible,.script-square input:focus-visible,.script-square textarea:focus-visible,.script-square select:focus-visible { outline:2px solid currentColor; outline-offset:2px; }
.script-square .sq-primary,.sq-tabs button[aria-pressed=true] { background:var(--text,#202124); color:var(--panel,#fff); }
.sq-toolbar,.sq-tabs,.sq-actions,.sq-pagination { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.sq-toolbar { justify-content:space-between; margin-bottom:18px; }
.sq-search { display:flex; gap:8px; margin-bottom:20px; }
.sq-search input { flex:1; min-width:0; }
.script-square input:not([type=checkbox]),.script-square textarea,.script-square select { box-sizing:border-box; width:100%; border:1px solid var(--line,#ddd); border-radius:8px; background:var(--panel,#fff); color:inherit; padding:10px; font:inherit; }
.sq-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.sq-card { border:1px solid var(--line,#ddd); border-radius:12px; padding:18px; }
.script-square .sq-title { border:0; padding:0; font-size:calc(19px * var(--ui-font-scale)); font-weight:650; text-align:left; }
.sq-summary { white-space:pre-wrap; line-height:1.6; }
.sq-pagination { justify-content:center; margin-top:20px; }
.sq-empty { padding:70px 12px; text-align:center; color:var(--muted,#666); }
.sq-editor { display:grid; gap:16px; }
.sq-editor label { display:grid; gap:7px; font-size:calc(14px * var(--ui-font-scale)); }
.sq-source { padding:14px; border:1px solid var(--line,#ddd); border-radius:9px; display:grid; gap:10px; }
.sq-reading { line-height:1.9; font-size:calc(16px * var(--ui-font-scale)); border-block:1px solid var(--line,#ddd); padding-block:20px; margin-block:20px; }
.sq-reading pre { white-space:pre-wrap; }.sq-reading table { display:block; max-width:100%; overflow:auto; }
.sq-confirm { display:flex; gap:8px; align-items:center; margin-bottom:16px; }
.sq-reports { border-top:1px solid var(--line,#ddd); font-size:calc(13px * var(--ui-font-scale)); }
@media(max-width:600px) { .script-square { width:100vw; max-width:100vw; height:100dvh; max-height:100dvh; border-radius:0; }.sq-header {padding:12px;}.sq-content {padding:14px;}.sq-grid {grid-template-columns:1fr;}.script-square button {min-height:44px;}.sq-status {padding:8px 14px;}.square-entry {padding-inline:5px !important;font-size:calc(11px * var(--ui-font-scale));} }
.saved-model-key-dialog {
  width: min(480px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}
.saved-model-key-dialog::backdrop { background: #0006; }
.saved-model-key-dialog h2 { font-size: 18px; }
.saved-model-key-dialog .modal-header { gap: 12px; }
.saved-model-key-dialog .modal-body { display: grid; gap: 16px; }
.saved-model-key-dialog [hidden] { display: none; }
.saved-model-key-dialog textarea { width: 100%; min-width: 0; min-height: 96px; height: 112px; max-height: 240px; resize: vertical; overflow-wrap: anywhere; font-family: var(--font-mono); }
.saved-key-status { min-height: 20px; margin: 0; color: var(--danger); font-size: 13px; }
.sq-confirm-dialog { width:min(420px,90vw); box-sizing:border-box; border:1px solid var(--line); border-radius:12px; padding:20px; background:var(--panel); color:var(--text); }

/* Platform confirmations and text prompts share the workbench's visual tokens. */
.workbench-action-dialog { box-sizing:border-box; width:min(420px,calc(100vw - 32px)); max-height:calc(100dvh - 40px); margin:auto; padding:22px; overflow:auto; border:1px solid var(--line); border-radius:16px; color:var(--text); background:var(--panel); box-shadow:0 20px 70px #0002; font:13px/1.65 var(--font-sans); animation:action-dialog-enter 180ms cubic-bezier(.16,1,.3,1); }
.workbench-action-dialog::backdrop { background:rgb(0 0 0 / .25); animation:action-backdrop-enter 150ms ease-out; }
.workbench-action-dialog.is-closing { opacity:0; transform:translateY(3px) scale(.99); transition:opacity 120ms ease,transform 120ms ease; }
.workbench-action-dialog.is-closing::backdrop { background:transparent; transition:background 120ms ease; }
.action-dialog-header { display:flex; gap:10px; align-items:center; }
.action-dialog-header h2 { margin:0; font-size:16px; font-weight:650; letter-spacing:-.3px; }
.action-dialog-mark { display:grid; place-items:center; flex:0 0 32px; height:32px; border:1px solid var(--line); border-radius:10px; background:var(--panel-2); }
.action-dialog-mark svg { width:16px; height:16px; }
.action-dialog-close { display:grid; place-items:center; margin-left:auto; flex:0 0 28px; height:28px; padding:0; border:0; border-radius:8px; color:var(--muted); background:transparent; font-size:21px; line-height:1; cursor:pointer; }
.action-dialog-close:hover { background:var(--hover-bg);color:var(--text); }
.action-dialog-message { margin:16px 0 0; color:var(--muted); white-space:pre-wrap; overflow-wrap:anywhere; }
.action-dialog-field { display:grid; gap:6px; margin-top:16px; }
.action-dialog-field>span { color:var(--muted);font-size:12px; }
.action-dialog-field input,.action-dialog-field textarea { box-sizing:border-box; width:100%; min-width:0; padding:10px 12px; border:1px solid var(--line); border-radius:9px; font:13px/1.55 var(--font-sans); color:var(--text); background:var(--control-bg); }
.action-dialog-field textarea { resize:vertical; min-height:100px; max-height:220px; }
.action-dialog-validation { margin:6px 0 0; color:var(--danger);font-size:12px; }
.reply-revision-result { padding:12px 14px; margin:10px 0; border:1px solid var(--line); border-left:3px solid var(--warning); border-radius:10px; background:var(--panel-2); font-size:13px; }
.reply-revision-result strong { font-size:13px; font-weight:600; }
.reply-revision-result p { margin:6px 0 10px; color:var(--muted); overflow-wrap:anywhere; }
.reply-revision-result>div { display:flex; align-items:center; flex-wrap:wrap; gap:8px 12px; }
.reply-revision-result small { color:var(--muted); font-size:12px; }
.action-dialog-field input:focus,.action-dialog-field textarea:focus { outline:0;border-color:var(--line-strong);box-shadow:0 0 0 3px color-mix(in srgb,var(--text) 7%,transparent); }
.action-dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:24px; }
.action-dialog-actions button { min-height:36px; min-width:72px; padding:7px 15px; border-radius:9px; font-size:13px; }
.workbench-action-dialog.is-danger .action-dialog-mark { color:var(--danger); background:var(--danger-bg); }
.workbench-action-dialog.is-danger [data-action-dialog="accept"] { color:var(--danger);border-color:color-mix(in srgb,var(--danger) 25%,var(--line));background:var(--danger-bg); }
.workbench-action-dialog.is-danger [data-action-dialog="accept"]:hover { background:var(--danger-hover); }
.workbench-action-dialog button:focus-visible { outline:2px solid var(--text);outline-offset:3px; }
@keyframes action-dialog-enter { from {opacity:0;transform:translateY(5px) scale(.985);} to {opacity:1;transform:none;} }
@keyframes action-backdrop-enter { from {background:transparent;} }
@media (prefers-reduced-motion:reduce) { .workbench-action-dialog,.workbench-action-dialog::backdrop {animation:none;transition:none;} }
@media (max-width:480px) { .workbench-action-dialog {padding:18px;border-radius:14px;} .action-dialog-actions button {min-height:40px;} }
.sq-confirm-dialog::backdrop { background:#0006; }.sq-confirm-dialog div {display:flex;justify-content:flex-end;gap:10px;margin-top:16px;}.sq-confirm-dialog button {min-height:44px;padding:8px 18px;border:1px solid var(--line);border-radius:8px;background:var(--control-bg);color:var(--text);}.sq-confirm-dialog textarea {width:100%;box-sizing:border-box;background:var(--control-bg);color:var(--text);}
@media(max-width:600px) { .square-entry { min-height:44px !important; } }

/* The selected login studio uses the real, existing authentication forms. */
.auth-studio-page {
  --text:#111113;--muted:#6b6b73;--line:#dfdfe4;--black:#111113;--panel:#fff;--control-bg:#fff;
  --button-bg:#111113;--button-text:#fff;--button-hover:#2a2a2d;
  --pointer-x:0px;--pointer-y:0px;--tilt-x:0deg;--tilt-y:0deg;
  position:relative;min-height:100svh;overflow:clip;background:#f5f5f7;color:#111113;color-scheme:light;
  font-family:var(--font-sans);font-size:16px;
}
.studio-relief-parallax {position:absolute;inset:-48px;pointer-events:none;overflow:hidden;transform:translate3d(calc(var(--pointer-x) * -.9),calc(var(--pointer-y) * -.8),0);will-change:transform;}
.studio-relief-layer {position:absolute;inset:-12px;animation:studio-canvas-orbit 10s cubic-bezier(.45,0,.55,1) infinite;will-change:transform;}
.studio-relief-layer img {display:block;width:100%;height:100%;object-fit:cover;object-position:center;user-select:none;}
.studio-header {position:relative;z-index:3;height:84px;padding:0 48px;display:flex;align-items:center;border-bottom:1px solid #dfdfe4;background:#fff;}
.studio-brand {display:flex;align-items:center;gap:14px;font-size:19px;font-weight:650;}
.studio-brand img {display:block;}
.studio-scene {position:relative;z-index:1;height:calc(100svh - 84px);min-height:680px;max-width:1700px;margin:auto;display:grid;grid-template-columns:minmax(0,1fr) minmax(390px,484px);gap:88px;padding:48px 69px 72px 96px;align-items:center;}
.studio-hero {position:relative;min-width:0;align-self:stretch;perspective:1000px;}
.studio-hero-copy {position:relative;margin-top:58px;z-index:1;}
.auth-studio-page h1 {margin:0;font-size:clamp(42px,4.35vw,68px);line-height:1.23;letter-spacing:-.035em;font-weight:700;}
.studio-subtitle {margin:19px 0 12px;color:#6b6b73;font-size:clamp(16px,1.5vw,23px);line-height:1.6;}
.studio-capabilities {display:flex;align-items:center;gap:16px;margin:0;color:#6b6b73;font-size:16px;}
.studio-capabilities span+span::before {content:"/";margin-right:16px;color:#8e8e93;}
.studio-logo-position {position:absolute;top:calc(57% - 12px);left:calc(32% - 12px);width:214px;height:214px;perspective:900px;}
.studio-logo-parallax {width:100%;height:100%;transform:translate3d(calc(var(--pointer-x) * .55),calc(var(--pointer-y) * .45),0) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));will-change:transform;}
.studio-hero-logo {display:block;width:100%;height:100%;user-select:none;animation:studio-logo-orbit 5.4s cubic-bezier(.45,0,.55,1) infinite;will-change:transform;filter:drop-shadow(0 14px 16px #11111316);}
.studio-auth-panel {position:relative;width:100%;height:584px;min-width:0;padding:30px;display:flex;flex-direction:column;border:1px solid #dfdfe4;border-radius:12px;background:rgba(255,255,255,.97);}
.auth-studio-page .studio-mode-tabs {position:relative;flex:none;display:grid;grid-template-columns:1fr 1fr;height:52px;padding:4px;margin:6px 0 24px;border:0;border-radius:10px;background:#f2f2f5;box-shadow:inset 0 0 0 1px #dfdfe4;isolation:isolate;}
.auth-studio-page .studio-mode-tabs button {position:relative;z-index:3;min-width:0;border:0;border-radius:7px;background:transparent;color:transparent;font-size:19px;font-weight:600;}
.auth-studio-page .studio-mode-tabs button:focus-visible {outline:2px solid #8e8e93;outline-offset:-2px;}
.studio-segment-labels {position:absolute;z-index:3;inset:4px;display:grid;grid-template-columns:1fr 1fr;align-items:center;text-align:center;font-size:19px;font-weight:600;pointer-events:none;}
.studio-segment-labels span:first-child {color:var(--login-ink,#fff);}
.studio-segment-labels span:last-child {color:var(--register-ink,#6b6b73);}
.studio-segment-indicator {position:absolute;z-index:2;left:4px;top:4px;bottom:4px;width:calc((100% - 8px)/2);overflow:hidden;border-radius:7px;background:#111113;box-shadow:0 2px 4px #11111318;transform:translate3d(var(--segment-x,0%),0,0);pointer-events:none;will-change:transform;}
.studio-auth-content {position:relative;flex:1;min-height:0;min-width:0;overflow-x:hidden;overflow-y:auto;scrollbar-width:thin;}
.studio-form-view {display:flex;flex-direction:column;min-height:100%;min-width:0;}
.studio-form-incoming {animation:studio-view-enter 200ms cubic-bezier(.2,.7,.2,1) both;}
.studio-form-outgoing {position:absolute;inset:0;z-index:1;height:100%;overflow:hidden;pointer-events:none;animation:studio-view-leave 100ms ease-out both;}
.auth-studio-page .auth-form {display:flex;flex-direction:column;flex:1;gap:0;min-height:0;margin:0;}
.auth-studio-page .auth-form h2 {font-size:36px;line-height:1.2;letter-spacing:-.02em;margin:0 0 8px;font-weight:700;}
.auth-studio-page .auth-form .muted-note {margin:0 0 24px;color:#6b6b73;font-size:19px;line-height:1.6;}
.studio-fields {display:grid;gap:18px;}
.auth-studio-page .field {display:grid;min-width:0;gap:8px;color:#6b6b73;font-size:17px;line-height:1.25;margin:0;}
.auth-studio-page .field>span {font-size:inherit;line-height:inherit;color:inherit;}
.auth-studio-page .field input {width:100%;min-width:0;height:50px;min-height:0;padding:0 14px;border:1px solid #dfdfe4;border-radius:9px;background:#fff;color:#111113;font-size:18px;}
.auth-studio-page .field input::placeholder {color:#9b9ba5;}
/* Keep the focus ring within the rounded input, away from the form's scroll clip. */
.auth-studio-page .field input:focus {border-color:#8e8e93;outline:2px solid #8e8e93;outline-offset:-2px;box-shadow:none;}
.auth-studio-page .auth-submit {flex:none;width:100%;min-height:52px;margin-top:auto;border:0;border-radius:9px;background:#111113;color:#fff;font-size:20px;font-weight:600;}
.auth-studio-page .auth-submit:hover {background:#2a2a2d;}
.studio-links {display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:46px;min-height:24px;}
.auth-studio-page .auth-switch-link {flex:none;align-self:flex-start;justify-content:flex-start;min-height:24px;margin:46px 0 0;padding:0;border:0;text-align:left;background:none;color:#6b6b73;font-size:14px;font-weight:400;}
.studio-links .auth-switch-link {margin:0;}
.auth-studio-page .auth-switch-link:hover {text-decoration:underline;}
.auth-studio-page .auth-closed-note {margin:0;font-size:12px;color:#6b6b73;}
.auth-studio-page[data-auth-view=register] .muted-note,.auth-studio-page[data-auth-view=forgot] .muted-note,.auth-studio-page[data-auth-view=reset] .muted-note,.auth-studio-page[data-auth-view=verify-pending] .muted-note {font-size:15px;margin-bottom:18px;}
.studio-register-fields {grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);gap:14px;}
.studio-register-fields .auth-password-grid {grid-column:1/-1;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);gap:14px;}
.auth-studio-page[data-auth-view=register] .field {font-size:14px;gap:7px;}
.auth-studio-page[data-auth-view=register] .field input {height:46px;padding:0 12px;font-size:15px;}
.studio-consents {display:flex;flex-wrap:wrap;gap:6px 14px;margin:14px 0 0;}
.studio-consents .auth-consent {display:flex;align-items:center;gap:6px;min-height:20px;margin:0;color:#6b6b73;font-size:12px;white-space:nowrap;}
.studio-consents .auth-consent input {width:15px;height:15px;min-height:0;margin:0;accent-color:#111113;}
.studio-consents .auth-consent a {color:#111113;text-underline-offset:2px;}
.auth-studio-page .auth-status-note {flex:none;max-height:100px;overflow:auto;margin:0 0 12px;font-size:13px;}
.auth-studio-page[data-auth-view=reset] .auth-form>.field+.field {margin-top:18px;}
.auth-studio-page .auth-development-delivery {margin:16px 0;}
.auth-studio-page[data-motion=paused] :is(.studio-relief-layer,.studio-hero-logo) {animation-play-state:paused;}
@keyframes studio-canvas-orbit {0%,100% {transform:translate3d(-18px,10px,0) scale(1.04);}50% {transform:translate3d(22px,-18px,0) scale(1.075);}}
@keyframes studio-logo-orbit {0%,100% {transform:translate3d(0,6px,0) rotateZ(-1deg);}50% {transform:translate3d(0,-12px,0) rotateZ(1.1deg);}}
@keyframes studio-view-enter {from {opacity:0;}to {opacity:1;}}
@keyframes studio-view-leave {from {opacity:1;}to {opacity:0;}}
@media (min-width:1701px) {.studio-logo-position {left:35%;width:230px;height:230px;}}
@media (max-width:1100px) {.studio-scene {grid-template-columns:minmax(0,1fr) minmax(340px,420px);gap:40px;padding:44px 40px 68px;}.studio-hero-copy {margin-top:64px;}.studio-logo-position {left:25%;width:175px;height:175px;}.studio-subtitle {font-size:17px;}.studio-capabilities {font-size:13px;gap:10px;}.studio-capabilities span+span::before {margin-right:10px;}.studio-auth-panel {padding:26px;}.auth-studio-page .auth-form h2 {font-size:30px;}.auth-studio-page .auth-form .muted-note {font-size:17px;}.studio-links {gap:8px;}.auth-studio-page .auth-switch-link {font-size:12px;}}
@media (max-width:900px) {
  .studio-header {height:68px;padding:0 22px;}.studio-brand {gap:10px;font-size:15px;}.studio-brand img {width:30px;height:30px;}
  .studio-scene {height:auto;min-height:0;grid-template-columns:1fr;grid-template-rows:230px 584px;align-items:stretch;gap:24px;max-width:520px;padding:26px 22px 58px;}.studio-hero {height:230px;}.studio-hero-copy {margin-top:8px;}.auth-studio-page h1 {font-size:36px;line-height:1.22;letter-spacing:-.025em;}.studio-subtitle {max-width:220px;margin:12px 0 10px;font-size:13px;}.studio-capabilities {font-size:11px;gap:8px;}.studio-capabilities span+span::before {margin-right:8px;}.studio-logo-position {left:auto;right:2px;top:122px;width:104px;height:104px;}
  .studio-auth-panel {height:584px;padding:22px;}.auth-studio-page .studio-mode-tabs {height:48px;margin:0 0 20px;}.auth-studio-page .studio-mode-tabs button,.studio-segment-labels,.studio-segment-light {font-size:17px;}.auth-studio-page .auth-form h2 {font-size:26px;}.auth-studio-page .auth-form .muted-note {font-size:14px;margin-bottom:24px;}.auth-studio-page .field {font-size:13px;}.auth-studio-page .field input {height:48px;font-size:16px;}.auth-studio-page .auth-submit {min-height:48px;font-size:17px;}.auth-studio-page .auth-switch-link {font-size:12px;}.studio-links {margin-top:38px;}
  .studio-register-fields {grid-template-columns:1fr;gap:12px;}.studio-register-fields .auth-password-grid {grid-template-columns:1fr 1fr;gap:12px;}.auth-studio-page[data-auth-view=register] .field {font-size:12px;gap:5px;}.auth-studio-page[data-auth-view=register] .field input {height:42px;font-size:16px;padding:0 10px;}.auth-studio-page[data-auth-view=register] .auth-form .muted-note {font-size:13px;margin-bottom:14px;}.studio-consents {margin-top:12px;gap:4px 12px;}.studio-consents .auth-consent {font-size:11px;}.studio-relief-layer img {object-position:24% top;}
}
@media (max-width:360px) {.studio-header {padding:0 15px;}.studio-brand {font-size:13px;}.studio-scene {padding-left:15px;padding-right:15px;}.studio-auth-panel {padding:20px;}.studio-logo-position {right:0;top:132px;width:90px;height:90px;}.studio-consents {gap:3px 10px;}.studio-consents .auth-consent {font-size:10.5px;}.auth-studio-page .auth-switch-link {font-size:11px;}}
@media (prefers-reduced-motion:reduce) {.studio-relief-layer,.studio-hero-logo,.studio-form-view {animation:none!important;will-change:auto;}.studio-relief-parallax,.studio-logo-parallax {transform:none!important;will-change:auto;}}

/* Presentation only: retain release63 dimensions, colors, typography and layout. */
.main-workbench .workbench-grid,
.main-workbench .source-panel,
.main-workbench .source-panel .surface-header,
.main-workbench .source-panel .surface-body { transition:none; will-change:auto; }
.main-workbench .workbench-grid { overflow:clip; }
.model-picker-menu { animation:none !important; }
.motion-exit-ghost { pointer-events:none !important; user-select:none; }
.motion-exit-ghost::before { display:none; }
.notification-panel { transform-origin:var(--notice-tip, 90%) top; }
/* Match the existing responsive intent: an unopened source drawer occupies no grid row. */
@media(max-width:1180px){
  .main-workbench .workbench-grid > .surface.source-panel:not(.responsive-open) { display:none; }
}
@media(prefers-reduced-motion:reduce){ .motion-exit-ghost{display:none;} }
/* 67: read-only export preview. Closed state leaves the original grid untouched. */
.document-preview-trigger { display:inline-flex; align-items:center; justify-content:center; gap:7px; white-space:nowrap; padding:8px 10px; min-height:36px; font-size:12px; }
.document-preview-trigger svg, .document-preview-panel svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.6; flex:none; }
.document-preview-trigger[aria-expanded="true"] { border-color:var(--text); }
.document-preview-panel { flex:0 0 var(--document-preview-width, clamp(360px, 37vw, 660px)); width:var(--document-preview-width, clamp(360px, 37vw, 660px)); height:var(--workbench-card-height); min-width:0; min-height:0; display:flex; flex-direction:column; overflow:hidden; border:1px solid var(--line); border-radius:14px; background:var(--panel); color:var(--text); }
.has-document-preview { position:relative; }
.document-preview-resize-handle { position:absolute; z-index:15; top:0; height:var(--workbench-card-height); width:12px; cursor:ew-resize; touch-action:none; outline:none; }
.document-preview-resize-handle[hidden] { display:none; }
.document-preview-resize-handle::before { content:""; position:absolute; left:50%; top:50%; width:3px; height:48px; border-radius:99px; transform:translate(-50%,-50%); background:var(--muted); opacity:.4; transition:height 160ms ease,opacity 160ms ease; }
.document-preview-resize-handle:hover::before, .document-preview-resize-handle:focus-visible::before, .is-resizing-document-preview .document-preview-resize-handle::before { height:72px; opacity:.8; }
body.is-resizing-document-preview, body.is-resizing-document-preview * { cursor:ew-resize !important; user-select:none !important; }
@media (prefers-reduced-motion:reduce) { .document-preview-resize-handle::before { transition:none; } }
.document-preview-header { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:16px 18px 12px; }
.document-preview-heading, .document-preview-actions { display:flex; align-items:center; gap:9px; }
.document-preview-heading h2 { margin:0; font-size:17px; font-weight:650; white-space:nowrap; }
.document-preview-readonly { font-size:10px; color:var(--muted); border:1px solid var(--line); padding:1px 5px; border-radius:5px; white-space:nowrap; }
.document-preview-actions .button-muted { font-size:11px; padding:5px 8px; }
.document-preview-actions .message-tool { width:30px; height:30px; }
.document-preview-toolbar { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:0 18px; border-bottom:1px solid var(--line); }
.document-preview-tabs { display:flex; align-self:stretch; gap:20px; }
.document-preview-tabs button { appearance:none; border:0; border-bottom:2px solid transparent; border-radius:0; background:transparent; color:var(--muted); padding:14px 2px 12px; font:inherit; font-size:13px; cursor:pointer; }
.document-preview-tabs button[aria-selected="true"] { color:var(--text); border-bottom-color:var(--text); font-weight:600; }
.document-preview-toolbar > .button { font-size:12px; min-height:32px; padding:7px 12px; }
.document-preview-meta { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:10px 16px; font-size:11px; min-height:48px; }
.document-preview-meta > span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.document-preview-zoom { display:flex; flex:none; align-items:center; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.document-preview-zoom button { border:0; background:transparent; color:var(--text); height:28px; min-width:28px; padding:0 5px; font:inherit; cursor:pointer; }
.document-preview-zoom button:hover { background:var(--hover-bg); }
.document-preview-canvas { flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; background:#f0f1f4; padding:20px; scrollbar-gutter:stable; }
.document-preview-host { min-width:100%; }
.document-preview-status { color:var(--muted); font-size:13px; text-align:center; line-height:1.8; padding:60px 18px; }
.document-preview-status[hidden] { display:none; }
.document-preview-status button { display:block; margin:16px auto 0; font-size:12px; }
.document-preview-footer { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:5px; min-height:36px; padding:9px 16px; font-size:10px; color:var(--muted); border-top:1px solid var(--line); }
.document-preview-panel button:focus-visible { outline:2px solid var(--muted); outline-offset:-2px; }
.document-preview-panel.is-expanded, .workbench-grid:not(.source-collapsed) > .document-preview-panel { position:fixed; z-index:230; top:86px; right:20px; bottom:20px; height:auto; box-shadow:0 16px 60px #0002; }
.document-preview-panel.is-expanded { width:min(1000px, calc(100vw - 40px)) !important; }
[data-theme="dark"] .document-preview-canvas { background:#24262b; }
[data-theme="dark"] .document-preview-status { color:#b8bdc8; }
@media (min-width:1181px) {
  .has-document-preview.source-collapsed { gap:12px; }
  .has-document-preview.source-collapsed > .workbench-nav-panel { flex-basis:min(var(--workbench-nav-width, 280px), 18vw); }
  .has-document-preview.source-collapsed > .surface:not(.workbench-nav-panel):not(.source-panel) { min-width:360px; }
  .has-document-preview > .surface > .surface-header { flex-wrap:wrap; gap:8px; }
  .has-document-preview > .surface .status-line { flex-wrap:wrap; }
  .has-document-preview .result-control-bar { display:flex; flex-wrap:wrap; gap:8px; }
  .has-document-preview .result-control-bar .field { flex:1 1 100px; min-width:0; }
  .has-document-preview .result-control-bar .model-picker-field { flex-basis:160px; }
  .has-document-preview.source-collapsed > .reply-history-drawer { position:fixed; flex:none; width:350px; box-shadow:0 12px 40px #0002; }
}
@media (max-width:1180px) {
  .workbench-grid > .document-preview-panel { position:fixed; z-index:230; top:max(12px,var(--responsive-top, 0px)); right:12px; bottom:auto; width:min(680px,calc(100vw - 24px)); height:calc(var(--responsive-height,100dvh) - 24px); max-height:calc(100dvh - 24px); box-shadow:0 16px 60px #0003; }
  .document-preview-panel.is-expanded { width:calc(100vw - 24px) !important; }
}
@media (max-width:760px) {
  .document-preview-trigger { min-height:36px; padding:7px; }
  .document-preview-header { padding:12px; }
  .document-preview-heading h2 { font-size:16px; }
  .document-preview-actions { gap:4px; }
  .document-preview-actions .message-tool { width:36px; height:36px; }
  .document-preview-actions .button-muted { min-height:36px; }
  .document-preview-toolbar { padding:0 12px; }
  .document-preview-meta { flex-wrap:wrap; padding:8px 12px; }
  .document-preview-meta > span { flex:1 1 150px; }
  .document-preview-canvas { padding:12px; }
  .document-preview-footer { padding:8px 12px; }
}
/* Conversation outline: a narrow rail plus an on-demand panel above the composer. */
.conversation-log.has-conversation-navigation { padding-right: 52px; }
.conversation-navigation { position: fixed; width: 32px; z-index: 24; color: var(--text); font: calc(13px * var(--ui-font-scale))/1.45 var(--font-sans); }
.conversation-navigation[hidden], .conversation-navigation [hidden] { display: none !important; }
.cn-rail { height: 100%; display:flex; flex-direction:column; align-items:center; gap:4px; padding:6px 0; background:var(--panel); border-left:1px solid var(--line); }
.conversation-navigation button { display:inline-flex; align-items:center; justify-content:center; gap:7px; min-width:0; min-height:30px; padding:5px; border:0; border-radius:7px; color:var(--muted); background:transparent; font:inherit; cursor:pointer; }
.conversation-navigation button:hover { background:var(--hover-bg); color:var(--text); }
.conversation-navigation button:focus-visible, .cn-search input:focus-visible { outline:2px solid var(--text); outline-offset:-2px; }
.conversation-navigation button:disabled { opacity:.3; cursor:default; }
.conversation-navigation svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; display:block; }
.cn-arrow-down { transform:rotate(180deg); }
.cn-rail > button { width:30px; flex:0 0 30px; }
.cn-rail .is-open, .cn-panel button[aria-pressed="true"] { background:var(--button-bg); color:var(--button-text); }
.cn-ticks { display:flex; flex-direction:column; align-items:center; justify-content:space-evenly; min-height:0; flex:1; width:100%; overflow:hidden; }
.cn-ticks .cn-tick { width:30px; min-height:18px; flex:0 1 26px; padding:5px; border-radius:5px; }
.cn-tick-line { display:block; height:3px; width:12px; background:var(--line-strong); border-radius:2px; }
.cn-tick.is-current .cn-tick-line { width:18px; background:var(--text); }
.cn-panel { position:absolute; right:40px; top:4px; display:flex; flex-direction:column; max-width:calc(100vw - 60px); overflow:hidden; background:var(--panel); border:1px solid var(--line); border-radius:12px; box-shadow:0 10px 32px rgba(0,0,0,.12); }
.cn-panel header { display:flex; align-items:center; gap:8px; padding:12px 12px 8px; flex:0 0 auto; }
.cn-panel header strong { font-size:calc(14px * var(--ui-font-scale)); white-space:nowrap; }
.cn-count { color:var(--muted); font-size:calc(11px * var(--ui-font-scale)); white-space:nowrap; }
.cn-header-space { flex:1; }
.cn-pin-label { font-size:calc(11px * var(--ui-font-scale)); white-space:nowrap; }
.cn-search { padding:0 12px 10px; flex:0 0 auto; }
.cn-search input { width:100%; min-width:0; height:36px; padding:7px 10px; border:1px solid var(--line); border-radius:8px; color:var(--text); background:var(--control-bg); font:inherit; }
.cn-list { max-height:360px; min-height:0; overflow:auto; overscroll-behavior:contain; padding:0 10px 8px; scrollbar-width:thin; }
.cn-row { border-bottom:1px solid var(--line); border-left:3px solid transparent; }
.cn-row.is-current { border-left-color:var(--text); background:var(--hover-bg); border-radius:7px; }
.cn-row-head { display:flex; align-items:center; min-width:0; }
.cn-row-head .cn-row-jump { justify-content:flex-start; flex:1; padding:11px 5px; text-align:left; overflow:hidden; color:var(--text); }
.cn-number { width:24px; flex:0 0 24px; color:var(--muted); font-variant-numeric:tabular-nums; font-size:12px; }
.cn-title { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cn-current-label { font-size:10px; margin-left:auto; white-space:nowrap; color:var(--muted); }
.cn-expand { flex:0 0 28px; }
.cn-expand .cn-arrow-down { transform:rotate(90deg); }
.cn-expand[aria-expanded="true"] .cn-arrow-down { transform:rotate(180deg); }
.cn-children { padding:0 4px 7px 24px; }
.cn-children button { width:100%; text-align:left; justify-content:flex-start; padding:8px 5px; }
.cn-role { flex:0 0 22px; color:var(--muted); font-size:11px; }
.cn-panel footer { display:flex; border-top:1px solid var(--line); padding:6px 10px; flex:0 0 auto; }
.cn-panel footer button { flex:1; min-height:34px; font-size:12px; }
.cn-empty { text-align:center; color:var(--muted); padding:16px 8px; }
.cn-list .cn-more { display:flex; width:100%; min-height:38px; }
.cn-target { outline:2px solid var(--line-strong); outline-offset:-2px; border-radius:10px; }
.cn-short .cn-ticks { visibility:hidden; }
.cn-panel-short .cn-panel header { padding:5px 8px; }
.cn-panel-short .cn-search { padding-bottom:4px; }
.cn-panel-short .cn-panel footer { display:none; }
@media (max-width:600px) {
  .cn-panel header { padding:8px; gap:5px; }
  .cn-panel header strong { font-size:13px; }
  .cn-panel .cn-count { font-size:10px; }
  .cn-list { max-height:310px; padding:0 5px 5px; }
  .cn-row-head .cn-row-jump { min-height:44px; }
  .cn-children button { min-height:44px; }
  .cn-rail > button { min-height:36px; flex-basis:36px; }
  .cn-search { padding:0 8px 8px; }
}

/* Credits share the account entry; the existing quota dialog remains authoritative. */
.sidebar-user .account-trigger { width: auto; min-width: 155px; max-width: 230px; gap: 7px; }
.account-points-inline { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; color: var(--text); }
.account-points-icon { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.account-points-value { font-size: calc(12px * var(--ui-font-scale)); font-variant-numeric: tabular-nums; white-space: nowrap; }
.account-dropdown { width: 260px; }
.account-summary { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; padding:4px 0 10px; margin-bottom:5px; border-bottom:1px solid var(--line); }
.account-identity { min-width:0; padding:4px 0; }
.account-identity .muted-note { margin:0; }
.account-dropdown .account-points-detail { width:auto; flex:0 0 auto; flex-direction:column; align-items:flex-end; gap:5px; padding:4px 6px; font-size:calc(12px * var(--ui-font-scale)); }
.account-points-detail [data-points-label], .account-points-link { color:var(--muted); }
.account-points-link::after { content:' ›'; }
.account-points-detail:hover { background:var(--hover-bg); }
@media(max-width:600px) { .sidebar-user .account-trigger { min-width:0; max-width:180px; } .account-trigger .account-display-name { max-width:70px; } }

/* Pending messages are presentation only until the existing save gate succeeds. */
.chat-submission-preview .chat-bubble { white-space:pre-wrap; }
.chat-submission-preview .chat-message-meta { color:var(--muted); }
@container workbench-result (max-width:850px) {
  .compact-workbench-toolbar .workbench-toolbar-end > .field { min-width:95px; flex-basis:140px; }
  .compact-workbench-toolbar .workbench-toolbar-end > .field > span { display:none; }
}

/* User-selected outline side; reserve the same reading width on either side. */
.conversation-log.has-conversation-navigation.cn-content-left { padding-left:52px; padding-right:18px; }
.conversation-navigation.cn-left .cn-rail { border-left:0; border-right:1px solid var(--line); }
.conversation-navigation.cn-left .cn-panel { right:auto; left:40px; }
.cn-side-options { display:flex; flex:0 0 auto; gap:2px; padding:2px; border:1px solid var(--line); border-radius:8px; }
.cn-side-options button { min-width:26px; min-height:24px; padding:3px 5px; font-size:11px; }
.cn-panel header { flex-wrap:wrap; }

.reply-selection-popover { position:fixed; z-index:180; display:flex; gap:4px; padding:5px; border:1px solid var(--line); border-radius:9px; background:var(--panel); box-shadow:0 5px 24px #0003; }
.reply-selection-popover button { border:0; background:transparent; color:var(--text); font:inherit; padding:8px 12px; border-radius:6px; cursor:pointer; }
.reply-selection-popover button:hover { background:var(--hover-bg); }
.reply-revision-mode { border:0; margin:4px 0; padding:0; }
.reply-revision-mode label { display:block; border:1px solid var(--line); border-radius:9px; padding:10px; margin-top:8px; cursor:pointer; }
.reply-revision-mode input { width:auto; margin-right:10px; accent-color:var(--text); }
.reply-revision-mode small { display:block; margin-left:26px; color:var(--muted); }
.reply-selection-note { color:var(--muted); font-size:12px; }
#replyRevisionOriginal[readonly] { min-height:65px; max-height:160px; background:var(--hover-bg); }

/* Account-scoped official and personal quick phrases. */
.qp-settings-help { color: var(--muted); font-size: 12px; line-height: 1.6; }
.qp-settings-section summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
.qp-settings-toolbar,.qp-settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.qp-settings-list { display: grid; gap: 10px; max-height: 360px; overflow-y: auto; margin-top: 12px; }
.qp-settings-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-width: 0; }
.qp-settings-item p { font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; margin: 8px 0; }
.qp-settings-kind { color: var(--muted); font-size: 11px; margin-left: 10px; }
.qp-settings-item.is-hidden { opacity: .65; }
.qp-settings-actions .button-muted { padding: 5px 10px; min-height: 30px; }
