:root {
  color-scheme: dark;
  --bg: #0e1211;
  --surface: #141a18;
  --surface-2: #19211e;
  --surface-3: #202924;
  --line: #303a35;
  --line-strong: #45534c;
  --text: #edf1ee;
  --muted: #a1aba5;
  --muted-2: #737e78;
  --green: #75c6a4;
  --green-strong: #3d9270;
  --green-wash: #173027;
  --gold: #d3ad62;
  --gold-wash: #332a19;
  --danger: #e28b82;
  --danger-wash: #3a211f;
  --focus: rgba(117, 198, 164, .2);
  --shadow: 0 22px 60px rgba(0, 0, 0, .36);
  --topbar-height: 60px;
  --nav-width: 196px;
  --toast-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  --toast-top-clearance: var(--topbar-height);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled, textarea:disabled, select:disabled { cursor: not-allowed; opacity: .46; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  width: 100vw;
  max-width: 100vw;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: #111615;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  border: 1px solid var(--green-strong);
  border-radius: 6px;
  background: var(--green-wash);
  color: var(--green);
  font-size: 13px;
  font-weight: 750;
}
.brand-copy { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand-copy strong { font-size: 15px; }
.brand-copy span { color: var(--muted); font-size: 12px; }
.version { color: var(--muted-2); font-size: 11px; }
.top-actions, .head-actions, .detail-actions, .row-actions, .table-actions, .chat-controls, .dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status { color: var(--muted); font-size: 12px; white-space: nowrap; }
.status[data-state="ok"] { color: var(--green); }
.status[data-state="error"] { color: var(--danger); }
.compact-label { display: none; }

.app-frame {
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
  width: 100%;
  max-width: 100vw;
  min-height: calc(100vh - var(--topbar-height));
}
.navigation {
  position: sticky;
  top: var(--topbar-height);
  display: flex;
  height: calc(100vh - var(--topbar-height));
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 10px;
  border-right: 1px solid var(--line);
  background: #111715;
}
.nav-list { display: grid; gap: 4px; }
.nav-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item[aria-current="page"] {
  border-color: #315245;
  background: var(--green-wash);
  color: var(--text);
}
.nav-symbol {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--green);
  font-size: 10px;
  font-weight: 750;
}
.nav-count {
  min-width: 18px;
  color: var(--muted-2);
  font-size: 11px;
  text-align: right;
}
.navigation-foot {
  display: grid;
  gap: 4px;
  padding: 10px;
  color: var(--muted-2);
  font-size: 10px;
}
.storage-status { color: var(--green); }
.storage-status[data-local="true"] { color: var(--gold); }

.main-workspace { min-width: 0; }
.view {
  width: min(100%, 1480px);
  min-height: calc(100vh - var(--topbar-height));
  margin: 0 auto;
  padding: 28px 30px 40px;
}
.chat-view { width: 100%; padding: 0; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 24px; line-height: 1.25; }
h2 { margin-bottom: 3px; font-size: 18px; line-height: 1.3; }
h3 { margin: 0; font-size: 14px; }
.page-description { max-width: 680px; margin: 0; color: var(--muted); }
.muted { margin-bottom: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.quiet-button, .text-button, .small-button, .primary-button, .send-button, .close-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--text);
}
.quiet-button, .text-button, .primary-button, .send-button { padding: 7px 12px; }
.small-button { min-height: 29px; padding: 4px 8px; font-size: 12px; white-space: nowrap; }
.quiet-button { color: var(--muted); }
.quiet-button:hover, .text-button:hover, .small-button:hover, .close-button:hover {
  border-color: var(--green-strong);
  color: var(--green);
}
.primary-button, .send-button {
  border-color: var(--green-strong);
  background: var(--green-strong);
  color: #08120e;
  font-weight: 750;
}
.primary-button:hover, .send-button:hover { background: var(--green); }
.danger-button { color: var(--danger); }
.danger-button:hover { border-color: #8e4e49; background: var(--danger-wash); color: var(--danger); }
.close-button {
  width: 30px;
  height: 30px;
  min-height: 30px;
  flex: 0 0 auto;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.summary-strip {
  display: flex;
  min-height: 48px;
  align-items: center;
  margin-bottom: 14px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.summary-strip span {
  min-width: 140px;
  padding: 9px 18px;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}
.summary-strip span:first-child { padding-left: 0; }
.summary-strip strong { margin-right: 4px; color: var(--text); font-size: 16px; }

.split-workspace {
  display: grid;
  grid-template-columns: minmax(240px, 292px) minmax(0, 1fr);
  min-height: 640px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.collection-pane {
  min-width: 0;
  padding: 14px 10px;
  border-right: 1px solid var(--line);
  background: #121816;
}
.search-box { display: block; min-width: 0; }
.search-box.grow { flex: 1; }
.search-box input,
.field input,
.field textarea,
.field select,
.composer textarea,
.select-wrap select,
.select-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #0f1513;
  color: var(--text);
  outline: none;
}
.search-box input { height: 36px; padding: 7px 10px; }
.search-box input:focus,
.field input:focus,
.field textarea:focus,
.field select:focus,
.composer textarea:focus,
.select-wrap select:focus,
.select-field select:focus {
  border-color: var(--green-strong);
  box-shadow: 0 0 0 3px var(--focus);
}
.collection-list { display: grid; gap: 4px; margin-top: 12px; }
.collection-item {
  display: grid;
  gap: 3px;
  width: 100%;
  min-width: 0;
  padding: 11px 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.collection-item:hover { background: var(--surface-2); }
.collection-item[data-active="true"] { border-color: #315245; background: var(--green-wash); }
.collection-item-title, .collection-item-summary, .collection-item-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.collection-item-title { font-weight: 700; }
.collection-item-summary { color: var(--muted); font-size: 12px; }
.collection-item-meta { color: var(--muted-2); font-size: 10px; }
.empty-list {
  display: grid;
  gap: 4px;
  padding: 30px 12px;
  color: var(--muted);
  text-align: center;
}
.empty-list strong { color: var(--text); font-size: 13px; }
.empty-list span { font-size: 12px; }

.detail-pane { min-width: 0; background: var(--surface); }
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}
.detail-head > div:first-child { min-width: 0; }
.detail-head h2 { font-size: 20px; overflow-wrap: anywhere; }
.detail-summary {
  display: flex;
  gap: 26px;
  padding: 11px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.detail-summary strong { margin-right: 3px; color: var(--text); }
.detail-section { padding: 20px 24px 24px; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border-bottom: 0; }
.section-head, .pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.section-head { margin-bottom: 12px; }
.list-stack { display: grid; }
.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(100px, auto) auto;
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.list-row:first-child { border-top: 0; }
.compact-row { grid-template-columns: auto minmax(0, 1fr) minmax(100px, auto) auto; }
.row-main { display: grid; min-width: 0; gap: 3px; }
.row-main strong, .row-main p, .row-subline { min-width: 0; overflow-wrap: anywhere; }
.row-main p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.row-subline { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.row-meta { display: grid; gap: 3px; color: var(--muted-2); font-size: 10px; text-align: right; }
.tag {
  display: inline-block;
  max-width: 160px;
  overflow: hidden;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-dot::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--muted-2);
  content: "";
}
.status-dot.is-on { color: var(--green); }
.status-dot.is-on::before { background: var(--green); }
.inline-empty {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.select-field select { min-width: 150px; height: 36px; padding: 6px 28px 6px 9px; }
.file-button {
  display: grid;
  min-height: 34px;
  place-items: center;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
}
.file-button:hover { border-color: var(--green-strong); color: var(--green); }
.file-button input { display: none; }
.data-table {
  min-width: 0;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.table-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(70px, .4fr) minmax(160px, 1fr) minmax(100px, .6fr) minmax(220px, auto);
  align-items: center;
  gap: 16px;
  min-height: 66px;
  padding: 9px 10px;
  border-top: 1px solid var(--line);
}
.table-row:first-child { border-top: 0; }
.table-header {
  min-height: 38px;
  background: var(--surface);
  color: var(--muted-2);
  font-size: 10px;
  text-transform: uppercase;
}
.table-primary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}
.table-primary > span:last-child { display: grid; min-width: 0; }
.table-primary strong, .table-primary small, .table-muted {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-primary small { color: var(--muted); font-size: 11px; }
.table-muted { color: var(--muted); font-size: 12px; }
.table-actions { justify-content: flex-end; }
.level-badge {
  display: inline-block;
  min-width: 42px;
  padding: 2px 7px;
  border: 1px solid #356451;
  border-radius: 4px;
  background: var(--green-wash);
  color: var(--green);
  font-size: 11px;
  text-align: center;
}
.level-badge.mature { border-color: #755f32; background: var(--gold-wash); color: var(--gold); }
.avatar, .scene-marker {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #37614f;
  border-radius: 6px;
  background: var(--green-wash);
  color: var(--green);
  font-weight: 750;
}
.small-avatar { width: 34px; height: 34px; border-radius: 5px; font-size: 11px; }
.tiny-avatar { width: 30px; height: 30px; border-radius: 5px; font-size: 10px; }
.scene-marker { width: 34px; height: 34px; border-color: #69562f; background: var(--gold-wash); color: var(--gold); font-size: 11px; }

.empty-state, .loading-state {
  display: grid;
  min-height: 520px;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}
.empty-state h2, .empty-state p, .loading-state p { margin: 0; }
.empty-state p { max-width: 460px; }
.empty-state .primary-button { margin-top: 8px; }
.compact-empty { min-height: 360px; border: 0; }
.empty-state-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin: 0 auto 5px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
}
.loader {
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chat-workspace {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  height: calc(100vh - var(--topbar-height));
  min-height: 620px;
}
.chat-library {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 18px 12px;
  border-right: 1px solid var(--line);
  background: #121816;
}
.chat-library .pane-head { padding: 0 4px 12px; }
.chat-library .pane-head h2 { margin: 0; font-size: 15px; }
.compact-list {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  overflow-y: auto;
}
#chat-card-list { max-height: 35%; }
.conversation-pane-head { margin-top: 18px; padding-top: 14px !important; border-top: 1px solid var(--line); }
.conversation-list { min-height: 0; flex: 1; }
.compact-list-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.compact-list-item:hover { background: var(--surface-2); }
.compact-list-item[data-active="true"] { border-color: #315245; background: var(--green-wash); }
.compact-list-copy { display: grid; min-width: 0; }
.compact-list-copy strong, .compact-list-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compact-list-copy small { color: var(--muted); font-size: 10px; }
.chat-panel { display: grid; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto; }
.chat-head {
  display: flex;
  min-height: 84px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.character-heading { display: flex; min-width: 0; align-items: center; gap: 12px; }
.character-heading > div:last-child { min-width: 0; }
.character-heading h2, .character-heading p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-controls { flex: 0 0 auto; }
.select-wrap select { width: auto; max-width: 190px; height: 34px; padding: 6px 26px 6px 8px; }
.message-list { min-height: 0; overflow-y: auto; padding: 26px max(22px, calc((100vw - 1050px) / 2)); }
.empty-chat {
  display: grid;
  min-height: 280px;
  height: 100%;
  place-items: center;
  color: var(--muted);
  text-align: center;
}
.empty-chat p { max-width: 620px; margin: 0; white-space: pre-wrap; }
.message { display: flex; margin-bottom: 18px; }
.message[data-role="user"] { justify-content: flex-end; }
.message-bubble {
  max-width: min(760px, 86%);
  padding: 11px 14px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 6px;
  white-space: pre-wrap;
}
.message[data-role="assistant"] .message-bubble { background: var(--surface-2); }
.message[data-role="user"] .message-bubble { border-color: #356451; background: var(--green-wash); }
.message-role { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.generated-image { width: min(560px, 72vw); margin: 0; }
.generated-image img {
  display: block;
  width: 100%;
  max-height: 620px;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  background: #0b0f0e;
  object-fit: contain;
}
.generated-image figcaption { margin-top: 7px; color: var(--muted); font-size: 11px; }
.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.composer textarea { min-height: 48px; max-height: 180px; padding: 11px 12px; resize: vertical; }
.send-button { align-self: end; min-width: 66px; height: 42px; }

.provider-form { padding-bottom: 70px; }
.provider-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.provider-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
  min-width: 0;
  margin: 0;
  padding: 18px 16px 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.provider-section legend { padding: 0 7px; color: var(--green); font-weight: 750; }
.provider-section:last-child:nth-child(odd) { grid-column: 1 / -1; }
.sticky-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: min(90vh, 920px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(0, 0, 0, .7); }
.dialog > form { max-height: min(90vh, 920px); overflow-y: auto; padding: 20px; }
.compact-dialog { width: min(440px, calc(100vw - 28px)); }
.wide-dialog { width: min(760px, calc(100vw - 28px)); }
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.dialog-head h2 { margin-bottom: 0; }
.field { display: grid; min-width: 0; gap: 6px; margin-bottom: 14px; color: var(--muted); font-size: 12px; }
.field input, .field textarea, .field select { min-width: 0; padding: 9px 10px; }
.field textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.span-2 { grid-column: 1 / -1; }
.choice-field {
  min-width: 0;
  margin: 0 0 14px;
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.choice-field legend { padding: 0 5px; color: var(--muted); font-size: 12px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.choice-item, .check-field {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}
.choice-item {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #111715;
}
.choice-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice-item input, .check-field input { flex: 0 0 auto; accent-color: var(--green-strong); }
.check-field { margin-bottom: 14px; }
.dialog-actions { justify-content: flex-end; margin-top: 18px; }
.form-error { min-height: 19px; margin: 3px 0; color: var(--danger); font-size: 12px; }
.toast {
  position: fixed;
  z-index: 50;
  right: 18px;
  bottom: var(--toast-bottom);
  max-width: min(360px, calc(100vw - 36px));
  max-height: calc(100dvh - var(--toast-bottom) - var(--toast-top-clearance) - 12px);
  overflow-y: auto;
  overflow-wrap: anywhere;
  padding: 10px 13px;
  border: 1px solid var(--green-strong);
  border-radius: 5px;
  background: #17251f;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
}
.toast[data-visible="true"] { opacity: 1; transform: translateY(0); }

@media (max-width: 1120px) {
  :root { --nav-width: 166px; }
  .view { padding-right: 22px; padding-left: 22px; }
  .table-row { grid-template-columns: minmax(190px, 1.2fr) 64px minmax(130px, .8fr) 88px minmax(184px, auto); gap: 10px; }
  .provider-grid { grid-template-columns: 1fr; }
  .provider-section:last-child:nth-child(odd) { grid-column: auto; }
}

@media (max-width: 900px) {
  :root { --toast-top-clearance: 113px; }
  .app-frame { display: block; }
  .navigation {
    position: sticky;
    z-index: 15;
    top: var(--topbar-height);
    display: block;
    width: 100%;
    max-width: 100vw;
    height: auto;
    padding: 7px 10px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav-list { display: flex; width: max-content; gap: 4px; }
  .nav-item { grid-template-columns: 22px auto auto; width: auto; min-width: 112px; }
  .navigation-foot { display: none; }
  .view { min-height: calc(100vh - 113px); }
  .split-workspace { grid-template-columns: 230px minmax(0, 1fr); }
  .table-header { display: none; }
  .table-row {
    grid-template-columns: minmax(220px, 1.3fr) 70px minmax(120px, .8fr) auto;
    padding: 12px 8px;
  }
  .table-row > :nth-child(4) { display: none; }
  .table-actions { flex-wrap: wrap; }
  .chat-workspace { height: calc(100vh - 113px); min-height: 580px; }
  .chat-controls { max-width: 50%; overflow-x: auto; }
}

@media (max-width: 700px) {
  .topbar { padding: 0 13px; }
  .top-actions { position: fixed; z-index: 25; top: 13px; right: 13px; }
  .wide-label { display: none; }
  .compact-label { display: inline; }
  .brand-copy span, .version { display: none; }
  .top-actions { gap: 7px; }
  .status { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .view { padding: 18px 14px 30px; }
  .chat-view { padding: 0; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 18px; }
  .page-head > .primary-button, .head-actions { width: 100%; }
  .head-actions > * { flex: 1; }
  .summary-strip span { min-width: 126px; padding-right: 12px; padding-left: 12px; }
  .split-workspace { display: block; min-height: 0; overflow: visible; }
  .collection-pane { max-height: 270px; overflow-y: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .detail-head { align-items: flex-start; flex-direction: column; padding: 18px 15px; }
  .detail-summary { gap: 16px; padding: 10px 15px; overflow-x: auto; white-space: nowrap; }
  .detail-section { padding: 17px 15px; }
  .list-row, .compact-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .compact-row > .avatar { display: none; }
  .row-meta { display: flex; flex-wrap: wrap; text-align: left; }
  .row-actions { flex-wrap: wrap; }
  .inline-empty { align-items: flex-start; flex-direction: column; }
  .toolbar-row { align-items: stretch; flex-direction: column; }
  .select-field select { width: 100%; }
  .table-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 14px 5px;
  }
  .table-header { display: none; }
  .table-row > :nth-child(4) { display: none; }
  .table-muted { white-space: normal; overflow-wrap: anywhere; }
  .table-actions { justify-content: flex-start; }
  .chat-workspace { display: block; height: auto; min-height: 0; }
  .chat-library { min-height: 300px; max-height: 430px; border-right: 0; border-bottom: 1px solid var(--line); }
  #chat-card-list { max-height: 120px; }
  .conversation-list { min-height: 100px; }
  .chat-panel { height: calc(100vh - 113px); min-height: 560px; }
  .chat-head { align-items: flex-start; flex-direction: column; padding: 14px; }
  .chat-controls { width: 100%; max-width: 100%; overflow-x: auto; }
  .select-wrap select { max-width: 170px; }
  .message-list { padding: 20px 14px; }
  .composer { padding: 10px 14px 14px; }
  .provider-section { display: block; }
  .sticky-actions { align-items: flex-start; flex-direction: column; }
  .sticky-actions .primary-button { width: 100%; }
  .form-grid, .choice-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .dialog > form { padding: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
