/* 素材工坊: a quiet chat canvas with cobalt controls. */
:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --sidebar: #edf1f7;
  --text: #18273d;
  --muted: #65738a;
  --line: #dce3ed;
  --accent: #2855d9;
  --accent-soft: #e8eeff;
  --danger: #b63848;
  --success: #18705a;
  --display: "Hiragino Sans GB", "PingFang SC", sans-serif;
  --body: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m2 4 4 4 4-4' fill='none' stroke='%2365738a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111a29;
  --surface: #192539;
  --sidebar: #142034;
  --text: #e7edf8;
  --muted: #a2b0c7;
  --line: #354159;
  --accent: #91adff;
  --accent-soft: #243760;
  --danger: #ff94a1;
  --success: #79d4b6;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m2 4 4 4 4-4' fill='none' stroke='%23a2b0c7' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 var(--body);
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
a {
  color: var(--accent);
  text-decoration: none;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 12px;
}
button:hover:not(:disabled) {
  border-color: var(--accent);
}
input,
textarea,
select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  min-width: 0;
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}
textarea {
  resize: vertical;
  line-height: 1.8;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 650;
  line-height: 1.35;
}
h1 {
  font-size: 18px;
}
h2 {
  font-size: 24px;
}
h3 {
  font-size: 17px;
}
.hidden {
  display: none !important;
}
.primary {
  background: var(--accent);
  color: var(--surface);
  border-color: var(--accent);
  font-weight: 600;
}
.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.ghost:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--text);
}
.wide {
  width: 100%;
}
.muted,
.small,
.ratio-reason {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.error,
.turn-error {
  color: var(--danger);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.studio-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 28px 16px 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.studio-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 19px;
  font-weight: 650;
  padding: 0 12px;
  margin-bottom: 30px;
}
.studio-brand small {
  display: block;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.18em;
  margin-top: 2px;
  color: var(--muted);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 42px;
  background: var(--accent);
  color: var(--surface);
  font-family: var(--display);
  font-weight: 700;
  font-size: 23px;
  border-radius: 4px 13px 4px 4px;
}
.new-conversation {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-color: var(--line);
  font-weight: 600;
  padding: 11px 16px;
  text-align: left;
  box-shadow: 0 3px 10px #18273d06;
}
.new-conversation span {
  color: var(--accent);
  font-size: 23px;
  line-height: 1;
}
.nav-library {
  display: flex;
  gap: 12px;
  background: transparent;
  border: 0;
  text-align: left;
  padding: 13px 16px;
  margin-top: 8px;
  color: var(--muted);
}
.sidebar-label {
  font-size: 11px;
  color: var(--muted);
  padding: 22px 12px 10px;
}
.conversation-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.conversation-row {
  display: flex;
  align-items: center;
  border-radius: 8px;
  margin-bottom: 4px;
}
.conversation-row.active {
  background: var(--surface);
}
.conversation-link {
  border: 0;
  background: transparent;
  text-align: left;
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.conversation-link span {
  max-width: 155px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.conversation-link small {
  color: var(--muted);
  font-size: 10px;
}
.conversation-delete {
  padding: 4px 9px;
  background: transparent;
  border: 0;
  color: var(--muted);
}
.history-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 12px;
}
.sidebar-footer {
  padding: 18px 4px 0;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  margin-top: 14px;
}
.sidebar-footer > span {
  padding-left: 9px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer > div {
  display: flex;
  flex-wrap: wrap;
  margin-top: 8px;
}
.sidebar-footer button {
  padding: 6px 8px;
  font-size: 11px;
}
.studio-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 20px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  min-height: 84px;
}
.workspace-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.workspace-heading h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 55vw;
  margin-top: 3px;
}
.mobile-menu {
  display: none;
}
.workspace-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}
.conversation-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.studio-thread {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 32px max(24px, calc((100% - 840px) / 2));
  min-height: 0;
}
.studio-welcome {
  max-width: 690px;
  margin: 6vh auto 0;
}
.studio-welcome h2 {
  font-size: clamp(27px, 3.1vw, 42px);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.5;
  margin: 16px 0;
}
.studio-welcome > p {
  color: var(--muted);
  max-width: 520px;
  line-height: 1.9;
}
.starter-list {
  display: grid;
  gap: 10px;
  margin-top: 32px;
}
.starter-list button {
  text-align: left;
  position: relative;
  padding: 16px 20px;
  background: var(--surface);
  border-radius: 10px;
}
.starter-list span {
  display: block;
  font-weight: 600;
}
.starter-list small {
  color: var(--muted);
  font-size: 12px;
}
.starter-list b {
  position: absolute;
  right: 20px;
  top: 22px;
  color: var(--accent);
  font-weight: 400;
}
.composer-wrap {
  padding: 18px max(24px, calc((100% - 840px) / 2)) 16px;
  background: var(--bg);
}
.studio-composer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 6px 22px #18273d07;
  padding: 12px 16px;
}
.studio-composer:focus-within {
  border-color: var(--accent);
}
.studio-composer > textarea {
  width: 100%;
  padding: 8px 0;
  background: transparent;
  border: 0;
  resize: none;
  min-height: 74px;
  max-height: 180px;
  outline: none;
}
.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
}
.composer-toolbar select {
  font-size: 12px;
  padding: 7px 36px 7px 10px;
  border-color: transparent;
  background-color: var(--bg);
  max-width: 170px;
}
.composer-toolbar > .primary {
  margin-left: auto;
  padding: 9px 14px;
  font-size: 12px;
}
.upload-button {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.upload-button svg {
  width: 17px;
  height: 17px;
}
.composer-note {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}
.workspace-status {
  font-size: 12px;
  margin-top: 5px;
  min-height: 18px;
  color: var(--muted);
}
.workspace-status.error {
  color: var(--danger);
}
.attachment-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 8px;
}
.attachment-card {
  width: 88px;
  flex: 0 0 88px;
}
.attachment-preview {
  position: relative;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.attachment-preview img {
  display: block;
  width: 100%;
  height: 86px;
  object-fit: contain;
}
.attachment-card.pending img {
  opacity: 0.42;
  filter: grayscale(0.55);
}
.attachment-name {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.attachment-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: color-mix(in srgb, var(--surface) 35%, transparent);
  font-size: 11px;
  font-weight: 600;
}
.attachment-overlay progress {
  appearance: none;
  -webkit-appearance: none;
  width: 58px;
  height: 4px;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  color: var(--accent);
  background: var(--line);
}
.attachment-overlay progress::-webkit-progress-bar {
  background: var(--line);
}
.attachment-overlay progress::-webkit-progress-value {
  background: var(--accent);
}
.attachment-overlay progress::-moz-progress-bar {
  background: var(--accent);
}
.attachment-overlay button {
  font-size: 11px;
  padding: 2px 7px;
}
.attachment-card.failed .attachment-preview {
  border-color: var(--danger);
}
.attachment-card.failed .attachment-overlay > span {
  color: var(--danger);
}
.attachment-card .attachment-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  padding: 0;
  font-size: 16px;
  line-height: 18px;
  color: var(--text);
}
.creative-turn {
  margin-bottom: 36px;
}
.user-turn,
.assistant-turn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.user-turn {
  flex-direction: row-reverse;
  margin-bottom: 20px;
}
.user-turn > div {
  max-width: min(90%, 640px);
  min-width: 0;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-radius: 14px 4px 14px 14px;
  overflow-wrap: anywhere;
}
.avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  font-size: 11px;
  border-radius: 7px;
}
.user-avatar {
  background: var(--line);
  color: var(--muted);
}
.studio-avatar {
  background: var(--accent);
  color: var(--surface);
}
.user-turn p {
  white-space: pre-wrap;
  line-height: 1.9;
  padding-top: 3px;
}
.turn-body {
  flex: 1;
  min-width: 0;
}
.turn-references {
  display: flex;
  gap: 7px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.turn-references img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.creative-plan {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 22px;
}
.plan-questions {
  background: var(--accent-soft);
  padding: 13px 15px;
  border-radius: 8px;
  font-size: 12px;
  margin: 10px 0 16px;
}
.plan-questions p {
  margin-top: 6px;
}
.prompt-label {
  font-size: 11px;
  color: var(--muted);
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
.prompt-label textarea {
  color: var(--text);
  font-size: 12px;
  line-height: 1.9;
  background: var(--bg);
  margin-top: 3px;
  width: 100%;
  border-radius: 6px;
}
.prompt-label textarea[readonly] {
  border-color: transparent;
}
.plan-controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.plan-controls label {
  font-size: 10px;
  color: var(--muted);
}
.plan-controls select {
  font-size: 12px;
  color: var(--text);
  padding: 7px 36px 7px 10px;
}
.generate-button {
  margin-left: auto;
  font-size: 12px;
  padding: 9px 14px;
}
.ratio-reason {
  font-size: 10px;
  margin-top: 10px;
}
.task-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  padding: 16px 0;
}
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.turn-error {
  font-size: 12px;
  line-height: 1.8;
  margin: 12px 0;
}
.result-text {
  font-size: 14px;
  line-height: 1.8;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.result-grid.single {
  grid-template-columns: minmax(0, 460px);
}
.result-grid figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.result-grid img {
  display: block;
  width: 100%;
  max-height: 540px;
  object-fit: contain;
  background: var(--bg);
}
.result-grid figcaption {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  font-size: 11px;
}
.result-grid figcaption button {
  font-size: 11px;
  padding: 3px 7px;
  background: transparent;
  border-color: transparent;
  color: var(--accent);
}
.library-view {
  padding: 30px 32px;
  overflow-y: auto;
  flex: 1;
}
.library-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.library-heading h2 {
  margin-top: 6px;
  font-size: 26px;
}
.library-filters {
  display: flex;
  gap: 8px;
  margin: 22px 0;
}
.library-filters button {
  font-size: 12px;
  background: transparent;
  border-color: transparent;
}
.library-filters .active {
  background: var(--accent-soft);
  color: var(--accent);
}
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 20px;
}
.asset-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.asset-card > img {
  display: block;
  width: 100%;
  height: 215px;
  object-fit: contain;
  background: var(--bg);
}
.asset-meta {
  padding: 12px 14px;
}
.asset-kind {
  display: block;
  font-size: 10px;
  color: var(--accent);
}
.asset-meta strong {
  display: block;
  font-size: 12px;
  margin: 5px 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.asset-meta small {
  font-size: 10px;
  color: var(--muted);
}
.asset-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 14px 14px;
  font-size: 11px;
}
.asset-actions button {
  font-size: 11px;
  border: 0;
  background: transparent;
  padding: 3px 0;
  color: var(--muted);
}
.asset-actions button:first-child {
  color: var(--accent);
  margin-right: auto;
}
.library-empty {
  color: var(--muted);
  padding: 40px 0;
  font-size: 13px;
}
/* Existing account and supplier administration uses the same light tokens. */
.auth-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
}
.auth-card {
  width: min(440px, 100%);
  padding: 38px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 45px #18273d06;
}
.auth-brand {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 26px;
}
.auth-brand h1 {
  font-size: 27px;
  margin-bottom: 9px;
}
.auth-brand p {
  font-size: 12px;
  line-height: 1.9;
}
.logo-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 3px;
  margin-top: 9px;
  flex-shrink: 0;
}
.tabs {
  display: flex;
  gap: 8px;
  margin: 20px 0;
}
.tab {
  border-color: transparent;
  background: var(--bg);
  font-size: 13px;
}
.tab.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.auth-form {
  display: grid;
  gap: 16px;
}
.auth-form input {
  width: 100%;
}
.auth-form .primary {
  margin-top: 8px;
}
.auth-theme-corner {
  position: absolute;
  right: 25px;
  top: 25px;
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
.theme-toggle .icon-dark,
.theme-toggle .icon-auto {
  display: none;
}
[data-theme="dark"] .theme-toggle .icon-light {
  display: none;
}
[data-theme="dark"] .theme-toggle .icon-dark {
  display: inline-block;
}
.auth-card #authHint {
  margin-top: 20px;
}
.admin-view {
  min-height: 100dvh;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 13px;
}
.brand .logo-dot {
  margin: 0;
}
.admin-layout {
  max-width: 1260px;
  margin: 28px auto;
  padding: 0 25px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  font-weight: 650;
  margin-bottom: 18px;
}
.sys-panel {
  grid-column: 1/-1;
}
.sys-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.sys-card {
  background: var(--bg);
  padding: 18px;
  border-radius: 8px;
}
.sys-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}
.sys-value {
  font-size: 25px;
  font-weight: 600;
  margin: 8px 0;
}
.storage-bar {
  height: 5px;
  background: var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin: 9px 0;
}
.storage-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
}
.storage-bar.warn i {
  background: var(--danger);
}
.storage-stats {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
}
.stack,
.upstream-list,
.user-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.upstream-row,
.user-row {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 15px;
  font-size: 12px;
}
.upstream-main,
.user-main,
.upstream-title,
.user-title,
.form-actions,
.row-actions,
.model-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.upstream-detail,
.user-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  margin-top: 8px;
  overflow-wrap: anywhere;
}
.row-actions {
  margin-top: 10px;
}
.tiny-btn {
  font-size: 11px;
  padding: 4px 8px;
}
.badge {
  font-size: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
}
.admin-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}
.two-cols,
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}
.check-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.model-browser {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin: 12px 0;
}
.model-list {
  max-height: 250px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.model-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.model-name {
  overflow-wrap: anywhere;
}
.model-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.model-search {
  width: 100%;
}
.empty {
  color: var(--muted);
  padding: 18px 0;
  font-size: 12px;
}
.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}
.app-settings {
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.hint {
  font-size: 11px;
  color: var(--muted);
}
@media (min-width: 1650px) {
  .studio-welcome {
    margin-top: 10vh;
  }
}
@media (max-width: 1150px) {
  .studio-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }
  .studio-thread {
    padding: 25px 20px;
  }
  .composer-wrap {
    padding: 14px 20px;
  }
  .studio-header {
    padding: 18px 24px;
  }
  .composer-toolbar select {
    max-width: 160px;
  }
  .studio-welcome h2 {
    font-size: 30px;
  }
}
@media (max-width: 950px) {
  .workspace-view {
    display: flex;
  }
  .conversation-column {
    flex: 1;
  }
  .studio-shell {
    grid-template-columns: 205px minmax(0, 1fr);
  }
  .studio-welcome {
    margin-top: 3vh;
  }
  .sys-stats {
    grid-template-columns: 1fr 1fr;
  }
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .studio-thread {
    padding: 24px;
  }
  .composer-wrap {
    padding: 14px 24px;
  }
  .topbar {
    flex-wrap: wrap;
  }
  .topbar-right {
    flex-wrap: wrap;
  }
}
@media (max-width: 650px) {
  .studio-shell {
    display: flex;
  }
  .studio-main {
    flex: 1;
  }
  .sidebar {
    display: none;
    position: fixed;
    z-index: 20;
    left: 0;
    top: 74px;
    bottom: 0;
    width: 260px;
    box-shadow: 16px 0 60px #18273d30;
  }
  .sidebar.mobile-open {
    display: flex;
  }
  .mobile-menu {
    display: inline-block;
  }
  .studio-header {
    padding: 14px 15px;
    min-height: 74px;
  }
  .studio-header .ghost {
    font-size: 12px;
  }
  .studio-thread {
    padding: 22px 14px;
  }
  .studio-welcome {
    margin-top: 12px;
  }
  .studio-welcome h2 {
    font-size: 29px;
  }
  .studio-welcome > p {
    font-size: 12px;
  }
  .starter-list {
    margin-top: 22px;
  }
  .starter-list button {
    padding: 13px 15px;
  }
  .composer-wrap {
    padding: 10px 10px 12px;
  }
  .studio-composer {
    padding: 9px 12px;
  }
  .composer-toolbar {
    gap: 6px;
  }
  .composer-toolbar select {
    font-size: 11px;
    max-width: 150px;
  }
  .composer-toolbar > .primary {
    width: 100%;
    margin-top: 5px;
  }
  .composer-note {
    font-size: 9px;
  }
  .user-turn,
  .assistant-turn {
    gap: 7px;
  }
  .avatar {
    width: 23px;
    height: 23px;
    font-size: 10px;
  }
  .creative-plan {
    padding: 15px 13px;
  }
  .plan-controls {
    gap: 8px;
  }
  .generate-button {
    width: 100%;
    margin-top: 4px;
  }
  .result-grid {
    gap: 8px;
  }
  .result-grid figcaption {
    flex-wrap: wrap;
    font-size: 10px;
    padding: 8px;
  }
  .library-view {
    padding: 22px 16px;
  }
  .asset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .asset-card > img {
    height: 150px;
  }
  .asset-meta {
    padding: 10px;
  }
  .asset-actions {
    padding: 0 10px 10px;
    gap: 9px;
    font-size: 10px;
  }
  .asset-actions button {
    font-size: 10px;
  }
  .auth-card {
    padding: 28px;
  }
  .admin-layout {
    padding: 0 14px;
    margin: 18px auto;
  }
  .panel {
    padding: 17px;
  }
  .two-cols,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .sys-stats {
    gap: 10px;
  }
  .sys-card {
    padding: 13px;
  }
  .model-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
.admin-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.upstream-form {
  display: grid;
  gap: 14px;
  margin-top: 10px;
}
.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.form-row > label {
  flex: 1;
}
.form-row input {
  width: 100%;
}
.align-end {
  align-self: flex-end;
}
.row-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 7px;
}
.reg-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.inline-field {
  flex-direction: row;
  align-items: center;
  font-size: 12px;
}
.inline-field input[type="number"] {
  width: 75px;
}
.row-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.test-result {
  font-size: 12px;
  color: var(--success);
}
details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}
.model-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.model-picker-list {
  max-height: 280px;
  overflow: auto;
}
.model-picker-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.model-picker-tools {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
}
.danger {
  color: var(--danger);
}
@media (max-width: 650px) {
  .form-row {
    flex-direction: column;
    align-items: stretch;
  }
  .row-top {
    align-items: flex-start;
    flex-direction: column;
  }
  .model-picker-row {
    flex-direction: column;
    gap: 7px;
  }
}

.theme-picker {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
}
.theme-select {
  font-size: 12px;
  padding: 7px 36px 7px 10px;
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--line);
}
.sidebar-footer .theme-select {
  font-size: 11px;
  padding: 6px 36px 6px 10px;
}
@media (forced-colors: active) {
  select {
    appearance: auto;
    background-image: none;
  }
}

/* Creative settings appear only when a ready plan requires confirmation. */
.creative-plan {
  padding: 0;
  background: var(--surface);
}
.creative-plan summary {
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
}
.creative-plan summary span,
.creative-plan summary small {
  color: var(--muted);
  font-size: 12px;
}
.creative-plan summary small {
  margin-left: auto;
}
.plan-content {
  padding: 4px 18px 18px;
  border-top: 1px solid var(--line);
}
.review-option {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-top: 10px;
  gap: 8px;
  color: var(--muted);
}
.review-option input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}
.control-label {
  display: inline;
  color: var(--muted);
  font-size: 12px;
}
.recovery-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
@media (max-width: 650px) {
  .control-label {
    display: none;
  }
  .creative-plan summary small {
    margin-left: 0;
    width: 100%;
  }
}

.creative-options { display:flex; align-items:center; flex-wrap:wrap; gap:8px; padding:8px 14px 12px; border-top:1px solid var(--line); }
.creative-options > label { font-size:12px; color:var(--muted); }
.creative-options select { min-height:32px; width:auto; font-size:12px; padding:5px 32px 5px 10px; }
.creative-options .review-option { margin:0 0 0 auto; padding:0; }
