:root {
  --bg: #0c141f;
  --card: rgba(13, 25, 38, 0.72);
  --card-border: rgba(142, 181, 221, 0.22);
  --text: #e7f1fd;
  --muted: #a8bfd8;
  --brand: #2cc7aa;
  --brand-hover: #1db397;
  --danger: #e16068;
  --danger-hover: #c94c53;
  --border: rgba(165, 197, 230, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  background: radial-gradient(circle at 15% 20%, #163252 0%, #0c141f 45%, #070c14 100%);
  color: var(--text);
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.25;
  pointer-events: none;
  z-index: -1;
}
.bg-orb-a {
  width: 400px;
  height: 400px;
  background: #2cc7aa;
  top: -150px;
  right: -100px;
}
.bg-orb-b {
  width: 500px;
  height: 500px;
  background: #1d79d1;
  left: -200px;
  bottom: -200px;
}

.shell {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  padding: 24px;
}

.header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}
h1 {
  margin: 0;
  font-size: 28px;
}
h2 {
  margin: 0 0 16px;
  font-size: 18px;
}
.muted {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.tab-btn {
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: rgba(44, 199, 170, 0.15);
  color: var(--brand);
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 24px;
}

.tab-pane.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Forms */
.add-form, .config-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.config-category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.config-cat-btn {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  color: #cce0f5;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}

.config-cat-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.config-cat-btn.active {
  background: rgba(44, 199, 170, 0.16);
  color: #6ff2d7;
  border-color: rgba(77, 226, 196, 0.4);
}

.config-cat-pane {
  display: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
  gap: 12px;
  flex-direction: column;
}

.config-cat-pane.active {
  display: flex;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.config-inline-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.config-inline-row .inline-item {
  min-width: 0;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #cce0f5;
}

.help {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.input-text {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.input-text:focus {
  outline: none;
  border-color: var(--brand);
}

textarea#tokenInput {
  width: 100%;
  height: 80px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  resize: vertical;
}

textarea#refreshBundleInput {
  width: 100%;
  min-height: 140px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  resize: vertical;
}

#refreshBundleFile {
  color: var(--muted);
}

.refresh-status {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: #a8bfd8;
  font-size: 12px;
  line-height: 1.5;
}

.refresh-status .table-wrapper {
  margin-top: 6px;
}

.refresh-profiles-table {
  font-size: 12px;
}

.refresh-profiles-table th,
.refresh-profiles-table td {
  padding: 8px;
}

.dialog-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 16, 0.82);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 950;
  padding: 20px;
}

.dialog-modal.open {
  display: flex;
}

.dialog-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #0d1926;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* Actions */
.actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

button {
  background: var(--brand);
  color: #051410;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
button:hover {
  background: var(--brand-hover);
}

button.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}
button.secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 6px 12px;
  font-size: 12px;
}
button.danger:hover {
  background: var(--danger);
  color: #fff;
}

button.small {
  padding: 6px 12px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}
button.small:hover {
  background: rgba(255, 255, 255, 0.2);
}

.msg {
  font-size: 14px;
}

/* Table */
.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.list-head h2 {
  margin: 0;
}

.token-list-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.token-credits-summary {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.token-credits-summary strong {
  color: #e7f1fd;
  font-size: 15px;
}

.input-select {
  min-width: 120px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.input-select:focus {
  outline: none;
  border-color: var(--brand);
}

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

.stat-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.stat-value {
  color: #e7f1fd;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 700;
}

.table-wrapper {
  overflow-x: auto;
}

.token-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: -6px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.token-summary strong {
  color: #e7f1fd;
  font-size: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

#logsTable,
#runningLogsTable {
  table-layout: auto;
}

#logsTable th:nth-child(1),
#logsTable td:nth-child(1),
#runningLogsTable th:nth-child(1),
#runningLogsTable td:nth-child(1) {
  width: 70px;
}

#logsTable th:nth-child(2),
#logsTable td:nth-child(2),
#runningLogsTable th:nth-child(2),
#runningLogsTable td:nth-child(2),
#logsTable th:nth-child(4),
#logsTable td:nth-child(4),
#runningLogsTable th:nth-child(4),
#runningLogsTable td:nth-child(4),
#logsTable th:nth-child(8),
#logsTable td:nth-child(8),
#runningLogsTable th:nth-child(8),
#runningLogsTable td:nth-child(8) {
  width: auto;
  white-space: nowrap;
}

#logsTable th:nth-child(3),
#logsTable td:nth-child(3),
#runningLogsTable th:nth-child(3),
#runningLogsTable td:nth-child(3) {
  width: 62px;
  white-space: nowrap;
}

#logsTable th:nth-child(5),
#logsTable td:nth-child(5),
#runningLogsTable th:nth-child(5),
#runningLogsTable td:nth-child(5) {
  width: 500px;
}

#logsTable th:nth-child(6),
#logsTable td:nth-child(6),
#runningLogsTable th:nth-child(6),
#runningLogsTable td:nth-child(6) {
  width: 190px;
}

#logsTable th:nth-child(8),
#logsTable td:nth-child(8),
#runningLogsTable th:nth-child(7),
#runningLogsTable td:nth-child(7) {
  min-width: 220px;
  width: 35%;
}

#logsTable td,
#runningLogsTable td {
  padding: 10px 8px;
  vertical-align: top;
}

.log-account-cell {
  display: block;
  color: #a8bfd8;
  line-height: 1.35;
}

.log-time-cell {
  color: #a8bfd8;
  line-height: 1.2;
  white-space: normal;
}

.log-time-cell .date {
  display: block;
}

.log-time-cell .time {
  display: block;
  color: #7f96ad;
}

.log-account-email {
  color: #7f96ad;
  word-break: break-all;
}

.log-model-cell {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: #8fb0d3;
  word-break: break-word;
}

.log-prompt-cell {
  color: #a8bfd8;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

th {
  text-align: left;
  padding: 12px;
  border-bottom: 2px solid var(--border);
  color: var(--muted);
  font-weight: 600;
}

td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.token-val {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: #a0c3e8;
  word-break: break-all;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-active { background: rgba(44, 199, 170, 0.2); color: #4de2c4; }
.status-exhausted { background: rgba(225, 163, 44, 0.2); color: #ffca58; }
.status-invalid { background: rgba(225, 96, 104, 0.2); color: #ffb4bc; }
.status-error { background: rgba(225, 96, 104, 0.2); color: #ffb4bc; }
.status-disabled { background: rgba(255, 255, 255, 0.1); color: #aaa; }

.log-status-2xx { background: rgba(44, 199, 170, 0.2); color: #4de2c4; }
.log-status-4xx { background: rgba(225, 163, 44, 0.2); color: #ffca58; }
.log-status-5xx { background: rgba(225, 96, 104, 0.2); color: #ffb4bc; }

.log-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.log-state.running {
  color: #63d4ff;
  background: rgba(48, 170, 255, 0.16);
}

.log-state.success {
  color: #4de2c4;
  background: rgba(44, 199, 170, 0.16);
}

.log-state.failed {
  color: #ffb4bc;
  background: rgba(225, 96, 104, 0.16);
}

.log-state-btn {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.log-state-btn.failed {
  border: 1px solid rgba(255, 180, 188, 0.55);
  background: rgba(255, 180, 188, 0.12);
}

.log-state-btn.failed:hover {
  background: rgba(255, 180, 188, 0.22);
}

.icon-spinner {
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.icon-check,
.icon-error {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  font-size: 11px;
  line-height: 1;
}

.log-row-running {
  background: rgba(48, 170, 255, 0.06);
}

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

.action-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  min-width: 120px;
}

th input[type="checkbox"],
td input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.action-btns button {
  width: 100%;
  padding: 3px 5px;
  font-size: 10px;
  border-radius: 4px;
}

.switch-btn {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  background: #2b3948;
  vertical-align: middle;
}

.switch-btn.on {
  background: rgba(44, 199, 170, 0.35);
  border-color: rgba(77, 226, 196, 0.55);
}

.switch-btn.off {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}

.switch-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.switch-knob {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transform: translateX(0);
  transition: transform 0.15s ease;
}

.switch-btn.on .switch-knob {
  transform: translateX(18px);
}

.switch-text {
  margin-left: 8px;
  font-size: 12px;
  color: #a8bfd8;
}

.empty-state {
  text-align: center;
  padding: 40px !important;
  color: var(--muted);
}


.model-list-toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.model-search-input {
  width: min(340px, 100%);
  min-width: 240px;
}

.model-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: -6px 0 12px;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}

.model-summary strong {
  color: #e7f1fd;
  font-size: 16px;
}

.models-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.model-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111111;
  overflow: hidden;
}

.model-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
  background: #151515;
}

.model-panel-head h3 {
  margin: 0;
  color: #f5f5f4;
  font-size: 15px;
  line-height: 1.2;
}

.model-panel-count {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  color: #a1a1aa;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.model-panel .table-wrapper {
  border: 0;
  border-radius: 0;
}

.models-table {
  min-width: 700px;
  table-layout: fixed;
}

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

.models-table th:nth-child(2),
.models-table td:nth-child(2) {
  width: 74px;
  white-space: nowrap;
}

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

.models-table th:nth-child(4),
.models-table td:nth-child(4) {
  width: auto;
}

.models-table th:nth-child(5),
.models-table td:nth-child(5) {
  width: 125px;
  min-width: 125px;
}

.provider-model-switch-cell {
  vertical-align: middle;
}

.provider-model-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.provider-model-switch .switch-btn {
  flex: 0 0 auto;
}

.provider-switch-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
  line-height: 1.15;
}

.provider-switch-copy strong {
  color: #e4e4e7;
  font-size: 12px;
  font-weight: 650;
}

.provider-switch-copy small {
  color: #7dd3b0;
  font-size: 11px;
}

.provider-model-switch .switch-btn.off + .provider-switch-copy small {
  color: #a1a1aa;
}

#modelsTable th:nth-child(1),
#modelsTable td:nth-child(1) {
  min-width: 300px;
}

#modelsTable th:nth-child(2),
#modelsTable td:nth-child(2) {
  width: 90px;
  white-space: nowrap;
}

#modelsTable th:nth-child(3),
#modelsTable td:nth-child(3) {
  width: 170px;
  white-space: nowrap;
}

.model-id-cell code {
  color: #a0c3e8;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  word-break: break-all;
}

.model-meta-cell,
.model-desc-cell {
  color: #a8bfd8;
  line-height: 1.35;
}

.leonardo-model-list {
  display: grid;
  gap: 12px;
  padding: 12px;
  max-height: 720px;
  overflow: auto;
}

.leonardo-image-model-section {
  border-top: 1px solid var(--border);
  background: #111111;
}

.leonardo-image-model-section .model-panel-head.compact {
  padding: 12px 14px;
  background: #131313;
}

.leonardo-image-model-list {
  max-height: 560px;
}

.leonardo-image-model-list .leonardo-model-card {
  background: #101010;
}

.leonardo-image-model-list .leonardo-dimensions table {
  min-width: 820px;
}

.leonardo-model-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: #0d0d0d;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.leonardo-model-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.leonardo-badges {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.leonardo-provider-controls {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.leonardo-alias-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #f8d57e;
  background: rgba(248, 213, 126, 0.14);
  font-size: 12px;
  font-weight: 700;
}

.leonardo-route-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #9ca3af;
  font-size: 12px;
  flex-wrap: wrap;
}

.leonardo-route-line code {
  color: #a0c3e8;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

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

.leonardo-detail-grid > div {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
}

.leonardo-detail-grid span {
  display: block;
  color: #8b949e;
  font-size: 12px;
  line-height: 1.2;
}

.leonardo-detail-grid strong {
  display: block;
  margin-top: 4px;
  color: #e5e7eb;
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.leonardo-capability-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.leonardo-capability-list em {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #d6dde7;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.leonardo-dimensions {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
}

.leonardo-dimensions table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 12px;
}

.leonardo-dimensions table {
  table-layout: auto;
}

.leonardo-dimensions th,
.leonardo-dimensions td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  text-align: left;
  white-space: nowrap;
}

.leonardo-dimensions thead th {
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.04);
  font-weight: 700;
}

.leonardo-dimensions tbody tr:last-child th,
.leonardo-dimensions tbody tr:last-child td {
  border-bottom: 0;
}

.leonardo-dimensions tbody th {
  color: #e5e7eb;
  font-weight: 700;
}

.leonardo-dimensions tbody th span {
  margin-left: 6px;
  padding: 2px 5px;
  border-radius: 999px;
  color: #4de2c4;
  background: rgba(44, 199, 170, 0.14);
  font-size: 11px;
}

.leonardo-unknown {
  color: #f8d57e;
  font-size: 13px;
}

.leonardo-parameter-note {
  border: 1px solid rgba(248, 213, 126, 0.22);
  border-radius: 8px;
  background: rgba(248, 213, 126, 0.08);
  color: #f8d57e;
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.35;
}

.model-kind-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.model-kind-badge.image {
  color: #4de2c4;
  background: rgba(44, 199, 170, 0.16);
}

.model-kind-badge.video {
  color: #63d4ff;
  background: rgba(48, 170, 255, 0.16);
}

.logs-pagination {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 16, 0.86);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.preview-modal.open {
  display: flex;
}

.preview-modal-dialog {
  width: min(1100px, 100%);
  max-height: calc(100vh - 40px);
  background: #0d1926;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-close {
  align-self: flex-end;
  padding: 6px 12px;
  font-size: 12px;
}

.preview-content {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  max-height: calc(100vh - 130px);
}

.preview-content img,
.preview-content video {
  max-width: 100%;
  max-height: calc(100vh - 150px);
  border-radius: 8px;
  background: #08111c;
}

.preview-actions {
  display: flex;
  justify-content: flex-end;
}

.preview-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

.preview-download:hover {
  background: rgba(255, 255, 255, 0.2);
}

.error-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.error-detail-head h3 {
  margin: 0;
  font-size: 16px;
  color: #e9f4ff;
}

.error-detail-content {
  border: 1px solid rgba(142, 181, 221, 0.25);
  border-radius: 8px;
  background: #091321;
  padding: 12px;
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.error-detail-content pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #cfe3f8;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(12, 20, 31, 0.92);
  color: #dbe9f8;
  border: 1px solid rgba(142, 181, 221, 0.28);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  line-height: 1.4;
  z-index: 1200;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-color: rgba(77, 226, 196, 0.45);
}

.toast.error {
  border-color: rgba(255, 180, 188, 0.45);
}

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .list-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .list-head .actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }

  .token-list-actions {
    width: 100%;
    align-items: flex-start;
  }

  .token-credits-summary {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .config-category-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .config-inline-row {
    grid-template-columns: 1fr;
  }

  .input-select {
    width: 100%;
  }
}


.model-id-cell strong {
  display: block;
  color: #e7f1fd;
  font-size: 13px;
  margin-bottom: 4px;
}

.model-id-cell code {
  display: block;
}

.model-internal-count {
  display: inline-flex;
  margin-left: 8px;
  color: #7f96ad;
  font-size: 12px;
}

.model-doc-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #dcecff;
}

.leonardo-credit-card {
  display: grid;
  gap: 20px;
}

.credit-card-head,
.credit-table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.credit-card-head h2,
.credit-table-head h3 {
  margin: 0 0 6px;
}

.credit-table-head h3 {
  color: #f5f5f4;
  font-size: 15px;
}

.credit-source-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 6px;
  background: rgba(16, 163, 127, 0.1);
  color: #6ee7b7;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.credit-notes {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.credit-notes span {
  border-left: 2px solid rgba(16, 163, 127, 0.55);
  background: rgba(255, 255, 255, 0.035);
  color: #c4c4c9;
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1.4;
}

.credit-table-section {
  display: grid;
  gap: 10px;
}

.credit-table-section + .credit-table-section {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.credit-table-wrapper {
  border-color: rgba(255, 255, 255, 0.1);
}

.credit-table {
  table-layout: fixed;
}

.image-credit-table {
  min-width: 1040px;
}

.video-credit-table {
  min-width: 1380px;
}

.image-credit-table th:nth-child(1),
.image-credit-table td:nth-child(1) {
  width: 190px;
}

.image-credit-table th:nth-child(2),
.image-credit-table td:nth-child(2) {
  width: 210px;
}

.image-credit-table th:nth-child(3),
.image-credit-table td:nth-child(3) {
  width: 360px;
}

.video-credit-table th:nth-child(1),
.video-credit-table td:nth-child(1) {
  width: 250px;
}

.video-credit-table th:nth-child(2),
.video-credit-table td:nth-child(2) {
  width: 215px;
}

.video-credit-table th:nth-child(3),
.video-credit-table td:nth-child(3) {
  width: 145px;
}

.video-credit-table th:nth-child(4),
.video-credit-table td:nth-child(4) {
  width: 430px;
}

.credit-table td {
  vertical-align: top;
  line-height: 1.5;
}

.credit-code code,
.credit-table td > code {
  color: #d8dee9;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  word-break: break-word;
}

.credit-rate-lines {
  display: grid;
  gap: 5px;
  color: #c4c4c9;
}

.credit-rate-lines span {
  display: block;
}

.credit-rate-lines strong {
  color: #f5f5f4;
  font-weight: 700;
}

.credit-rate-lines-wide {
  min-width: 320px;
}

.credit-note {
  color: #a1a1aa;
}

.credit-unavailable {
  color: #fbbf24;
  font-weight: 700;
}

.api-doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0;
}

.model-doc-card pre {
  margin: 0;
  min-height: 260px;
  overflow: auto;
  border: 1px solid rgba(142, 181, 221, 0.22);
  border-radius: 10px;
  background: #091321;
  padding: 12px;
}

.model-doc-card code {
  color: #cfe3f8;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .api-doc-grid {
    grid-template-columns: 1fr;
  }

  .credit-card-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Wide console refresh: layout-only polish, no behavior changes. */
:root {
  --bg: #0f0f0f;
  --card: #151515;
  --card-border: rgba(255, 255, 255, 0.12);
  --text: #f5f5f4;
  --muted: #a1a1aa;
  --brand: #10a37f;
  --brand-hover: #0d8f70;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --border: rgba(255, 255, 255, 0.1);
}

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 280px),
    #0f0f0f;
  color: var(--text);
}

.bg-orb {
  display: none;
}

.shell {
  width: min(100% - 56px, 1760px);
  max-width: none;
  margin: 24px auto 40px;
  padding: 0;
  gap: 18px;
}

.card {
  background: var(--card);
  border-color: var(--card-border);
  border-radius: 8px;
  box-shadow: none;
  backdrop-filter: none;
  padding: 22px;
}

.header.card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 18px 22px !important;
  text-align: left !important;
  background: #151515;
}

.header h1 {
  font-size: 22px !important;
  letter-spacing: 0 !important;
  line-height: 1.15;
}

.header .muted {
  margin-top: 4px !important;
  color: #a1a1aa;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15, 15, 15, 0.92);
  backdrop-filter: blur(14px);
}

.tab-btn {
  border-radius: 6px;
  padding: 9px 14px;
  color: #a1a1aa;
  font-size: 14px;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #f5f5f4;
}

.tab-btn.active {
  background: #f5f5f4;
  color: #0f0f0f;
}

.tab-pane {
  gap: 18px;
}

.quick-actions-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 82px;
}

.quick-actions-card h2,
.token-list-card h2,
.config-card h2,
.model-doc-card h2 {
  margin-bottom: 0;
}

.list-head {
  gap: 16px;
  margin-bottom: 18px;
}

.token-list-actions {
  flex-direction: row;
  align-items: center;
  gap: 18px;
}

.token-list-actions .actions,
.actions {
  gap: 8px;
  flex-wrap: wrap;
}

.token-credits-summary {
  min-width: 180px;
  color: #a1a1aa;
}

.token-summary,
.model-summary {
  gap: 10px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}

.token-summary span,
.model-summary span,
.token-credits-summary {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 8px 10px;
}

#tokenSearchBar {
  display: grid !important;
  grid-template-columns: auto minmax(240px, 360px) auto minmax(140px, 1fr);
  gap: 10px !important;
  margin: 12px 0 18px !important;
}

#tokenSearchInput {
  width: 100% !important;
}

.token-provider-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b0b0b;
}

.token-provider-filter-btn {
  border: 0;
  border-radius: 6px;
  padding: 7px 10px;
  background: transparent;
  color: #a1a1aa;
  font-size: 12px;
  white-space: nowrap;
}

.token-provider-filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f5f5f4;
}

.token-provider-filter-btn.active {
  background: #f5f5f4;
  color: #0f0f0f;
}

.input-text,
.input-select,
textarea#tokenInput,
textarea#refreshBundleInput,
#cookieInput {
  border-radius: 6px;
  border-color: rgba(255, 255, 255, 0.14);
  background: #0b0b0b;
  color: #f5f5f4;
}

.input-text:focus,
.input-select:focus,
textarea#tokenInput:focus,
textarea#refreshBundleInput:focus,
#cookieInput:focus {
  border-color: rgba(16, 163, 127, 0.8);
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.14);
}

button {
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--brand);
  color: #ffffff;
}

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

button.secondary {
  border: 1px solid var(--border);
  background: #242424;
  color: #f5f5f4;
}

button.secondary:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: #303030;
}

button.danger {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
}

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

.table-wrapper {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111111;
  overflow: auto;
}

table {
  min-width: 1320px;
  font-size: 13px;
}

#tokenTable {
  min-width: 1520px;
  table-layout: fixed;
}

#tokenTable th:nth-child(1),
#tokenTable td:nth-child(1) {
  width: 44px;
  text-align: center;
}

#tokenTable th:nth-child(2),
#tokenTable td:nth-child(2) {
  width: 300px;
}

#tokenTable th:nth-child(3),
#tokenTable td:nth-child(3) {
  width: 210px;
}

#tokenTable th:nth-child(4),
#tokenTable td:nth-child(4) {
  width: 90px;
}

#tokenTable th:nth-child(5),
#tokenTable td:nth-child(5) {
  width: 130px;
}

#tokenTable th:nth-child(6),
#tokenTable td:nth-child(6) {
  width: 190px;
}

#tokenTable th:nth-child(7),
#tokenTable td:nth-child(7) {
  width: 88px;
}

#tokenTable th:nth-child(8),
#tokenTable td:nth-child(8) {
  width: 180px;
}

#tokenTable th:nth-child(9),
#tokenTable td:nth-child(9) {
  width: 210px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--border);
  background: #151515;
  color: #a1a1aa;
  padding: 11px 12px;
  font-size: 12px;
}

td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
  padding: 13px 12px;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

.token-val,
.model-id-cell code,
.log-model-cell {
  color: #b4c6d8;
}

.status-badge {
  border-radius: 6px;
}

.status-active,
.log-status-2xx,
.model-kind-badge.image {
  background: rgba(16, 163, 127, 0.14);
  color: #34d399;
}

.status-exhausted,
.log-status-4xx {
  background: rgba(245, 158, 11, 0.13);
  color: #fbbf24;
}

.status-invalid,
.status-error,
.log-status-5xx {
  background: rgba(239, 68, 68, 0.13);
  color: #f87171;
}

.status-disabled {
  background: rgba(255, 255, 255, 0.08);
  color: #a1a1aa;
}

.action-btns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}

.action-btns button {
  min-height: 30px;
  padding: 5px 6px;
  font-size: 11px;
}

.switch-btn {
  background: #333333;
}

.switch-btn.on {
  background: rgba(16, 163, 127, 0.45);
  border-color: rgba(52, 211, 153, 0.6);
}

.stats-grid {
  grid-template-columns: repeat(5, minmax(160px, 1fr));
}

#logsStatsGrid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

#monthlyStatsSummary {
  grid-template-columns: minmax(220px, 360px);
}

.log-task-filter {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 4px;
  margin: 18px 0 12px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b0b0b;
}

.log-task-filter-btn {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 7px 12px;
  background: transparent;
  color: #a1a1aa;
  font-size: 12px;
  white-space: nowrap;
}

.log-task-filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f5f5f4;
}

.log-task-filter-btn.active {
  background: #f5f5f4;
  color: #0f0f0f;
}

.stat-card,
.config-category-tabs,
.config-cat-pane {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.stat-value {
  color: #f5f5f4;
}

.dialog-card,
.preview-modal-dialog {
  border-radius: 8px;
  background: #151515;
}

@media (max-width: 1280px) {
  .shell {
    width: min(100% - 32px, 1180px);
  }

  .models-split-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #logsStatsGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .token-list-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .token-credits-summary {
    text-align: left;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 100%);
    margin-top: 10px;
  }

  .leonardo-model-topline,
  .leonardo-detail-grid {
    grid-template-columns: 1fr;
  }

  .leonardo-model-topline {
    display: grid;
  }

  .leonardo-badges {
    justify-content: flex-start;
  }

  .leonardo-provider-controls {
    justify-content: flex-start;
  }

  .header.card,
  .quick-actions-card,
  #tokenSearchBar {
    grid-template-columns: 1fr;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .tab-btn {
    min-width: 0;
    padding-inline: 8px;
    white-space: normal;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  #logsStatsGrid,
  #monthlyStatsSummary {
    grid-template-columns: 1fr;
  }

  .log-task-filter {
    width: 100%;
  }
}

.log-source-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
  color: #8da3bb;
  line-height: 1.25;
}

.provider-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.provider-badge.leonardo {
  color: #c4f1ff;
  background: rgba(0, 156, 255, 0.18);
  border-color: rgba(73, 190, 255, 0.28);
}

.provider-badge.adobe {
  color: #ffd2d7;
  background: rgba(225, 75, 92, 0.15);
  border-color: rgba(255, 112, 125, 0.24);
}

.provider-badge.other {
  color: #d5dce8;
  background: rgba(255, 255, 255, 0.08);
}

.log-source-sub {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: #7f96ad;
  word-break: normal;
}

/* Request log layout: keep operational columns readable on wide screens. */
#logsTable {
  min-width: 1680px;
  table-layout: fixed;
}

#logsTable th,
#logsTable td {
  vertical-align: middle;
}

#logsTable th:nth-child(1),
#logsTable td:nth-child(1) {
  width: 120px;
}

#logsTable th:nth-child(2),
#logsTable td:nth-child(2) {
  width: 112px;
}

#logsTable th:nth-child(3),
#logsTable td:nth-child(3) {
  width: 220px;
}

#logsTable th:nth-child(4),
#logsTable td:nth-child(4),
#logsTable th:nth-child(5),
#logsTable td:nth-child(5) {
  width: 86px;
}

#logsTable th:nth-child(6),
#logsTable td:nth-child(6) {
  width: 300px;
}

#logsTable th:nth-child(7),
#logsTable td:nth-child(7) {
  width: 230px;
}

#logsTable th:nth-child(9),
#logsTable td:nth-child(9) {
  width: 76px;
  text-align: center;
}

#logsTable td:nth-child(2),
#logsTable td:nth-child(4),
#logsTable td:nth-child(5),
#logsTable td:nth-child(9) {
  white-space: nowrap;
}

#logsTable .log-account-cell,
#logsTable .log-account-email,
#logsTable .log-model-cell,
#logsTable .log-source-cell,
#logsTable .log-source-sub,
#logsTable .log-source-ip,
#logsTable .log-source-path {
  min-width: 0;
  max-width: 100%;
}

#logsTable .log-account-cell,
#logsTable .log-account-email,
#logsTable .log-model-cell,
#logsTable .log-source-ip,
#logsTable .log-source-path {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

#logsTable .log-account-email {
  color: #b6c5d5;
}

#logsTable .log-model-cell {
  color: #c2d1df;
  line-height: 1.45;
}

#logsTable .log-prompt-cell {
  display: -webkit-box;
  max-height: 38px;
  overflow: hidden;
  color: #aebdcb;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  word-break: break-word;
  overflow-wrap: anywhere;
}

#logsTable .log-source-cell {
  gap: 6px;
  min-width: 0;
}

#logsTable .log-source-sub {
  display: grid;
  gap: 2px;
  line-height: 1.25;
}

#logsTable .provider-badge {
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  letter-spacing: 0;
}

#logsTable .provider-badge.adobe {
  color: #d9e1ea;
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.28);
}

#logsTable .provider-badge.leonardo {
  color: #bce8ff;
  background: rgba(14, 165, 233, 0.14);
  border-color: rgba(56, 189, 248, 0.24);
}

#logsTable .provider-badge.other {
  color: #d5dce8;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 1280px) {
  #logsTable {
    min-width: 1540px;
  }
}

/* Model test workbench */
.model-test-workbench {
  min-height: 720px;
}

.model-test-heading,
.model-test-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.model-test-heading {
  margin-bottom: 20px;
}

.model-test-heading h2,
.model-test-result-head h3 {
  margin: 0;
}

.model-test-heading .help {
  margin: 5px 0 0;
}

.model-test-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: #a1a1aa;
  font-size: 12px;
  font-weight: 800;
}

.model-test-status.running {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
}

.model-test-status.success {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
}

.model-test-status.error {
  border-color: rgba(239, 68, 68, 0.38);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.model-test-status.stopped {
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(245, 158, 11, 0.1);
  color: #fcd34d;
}

.model-test-layout {
  display: grid;
  grid-template-columns: minmax(420px, 520px) minmax(0, 1fr);
  gap: 0;
  min-height: 620px;
  border-top: 1px solid var(--border);
}

.model-test-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 22px 24px 0 0;
  border-right: 1px solid var(--border);
}

.model-test-form .input-select,
.model-test-form .input-text,
.model-test-prompt,
.model-test-reference-urls,
.model-test-file-input {
  width: 100%;
}

.model-test-form {
  color-scheme: dark;
}

.model-test-select-shell {
  position: relative;
  width: 100%;
  min-width: 0;
}

.model-test-native-select {
  position: absolute !important;
  width: 1px !important;
  min-width: 0 !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(50%);
}

.model-test-select-trigger,
.model-test-select-option {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f4f4f5;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0;
  text-align: left;
  box-shadow: none;
}

.model-test-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #0b0b0b;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.model-test-select-trigger:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: #101010;
}

.model-test-select-trigger:focus-visible,
.model-test-select-shell.is-open .model-test-select-trigger {
  outline: none;
  border-color: rgba(16, 163, 127, 0.92);
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.15);
}

.model-test-select-trigger:disabled {
  color: #71717a;
  cursor: not-allowed;
  opacity: 0.68;
}

.model-test-select-copy {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 1px;
}

.model-test-select-primary,
.model-test-select-secondary {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-test-select-primary {
  color: #f4f4f5;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

.model-test-select-secondary {
  color: #85858e;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.25;
}

.model-test-select-chevron,
.model-test-select-check {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.model-test-select-chevron {
  color: #a1a1aa;
  transition: transform 0.16s ease;
}

.model-test-select-shell.is-open .model-test-select-chevron {
  transform: rotate(180deg);
}

.model-test-select-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  max-height: 320px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #171717;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.48);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.model-test-select-menu[hidden] {
  display: none;
}

.model-test-select-menu::-webkit-scrollbar {
  width: 8px;
}

.model-test-select-menu::-webkit-scrollbar-thumb {
  border: 2px solid #171717;
  border-radius: 8px;
  background: #4a4a4f;
}

.model-test-select-group {
  padding: 8px 9px 5px;
  color: #71717a;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.2;
  text-transform: uppercase;
}

.model-test-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 7px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.model-test-select-option:hover,
.model-test-select-option:focus-visible {
  outline: none;
  background: #262626;
}

.model-test-select-option.is-selected {
  background: #222a27;
}

.model-test-select-option .model-test-select-check {
  color: transparent;
}

.model-test-select-option.is-selected .model-test-select-check {
  color: #5eead4;
}

.model-test-select-option:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.model-test-select-option .model-test-select-primary {
  font-size: 12px;
}

.model-test-form select option,
.model-test-form select optgroup {
  background: #171717;
  color: #f4f4f5;
}

.model-test-prompt,
.model-test-reference-urls {
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: #0b0b0b;
  color: #f5f5f4;
  padding: 10px 12px;
  font: inherit;
  letter-spacing: 0;
  outline: none;
}

.model-test-prompt:focus,
.model-test-reference-urls:focus {
  border-color: rgba(16, 163, 127, 0.8);
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.14);
}

.model-test-model-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  flex-wrap: wrap;
  color: #a1a1aa;
  font-size: 12px;
}

.model-test-model-meta code {
  max-width: 100%;
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  color: #c7d2df;
  background: #111111;
  overflow-wrap: anywhere;
}

.model-test-model-meta .provider-badge.adobe {
  color: #d9e1ea;
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.28);
}

.model-test-meta-text {
  flex: 1 1 100%;
  line-height: 1.5;
}

.model-test-meta-error {
  color: #fca5a5;
}

.model-test-parameter-grid,
.model-test-reference-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.model-test-toggle-group {
  justify-content: flex-end;
  min-height: 64px;
}

.model-test-toggle-group .checkbox-label {
  min-height: 40px;
  margin-top: auto;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
}

.model-test-reference-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.model-test-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.model-test-section-title strong {
  font-size: 13px;
}

.model-test-section-title span {
  color: #8c8c94;
  font-size: 11px;
}

.model-test-reference-grid .form-group {
  min-width: 0;
}

.model-test-field-label {
  color: #cce0f5;
  font-size: 13px;
  font-weight: 600;
}

.model-test-reference-wide {
  grid-column: 1 / -1;
}

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

.model-test-file-input {
  position: absolute;
  width: 1px !important;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(50%);
}

.model-test-upload-surface {
  display: grid;
  width: 100%;
  min-height: 92px;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: #0b0b0b;
  color: #f4f4f5;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.model-test-upload-surface:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: #101010;
}

.model-test-upload-surface:focus-visible,
.model-test-upload.is-dragging .model-test-upload-surface {
  outline: none;
  border-color: rgba(16, 163, 127, 0.92);
  background: #0d1513;
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.15);
}

.model-test-upload.has-files .model-test-upload-surface {
  border-color: rgba(94, 234, 212, 0.32);
}

.model-test-upload.is-over-limit .model-test-upload-surface {
  border-color: rgba(248, 113, 113, 0.72);
}

.model-test-upload-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: #181818;
  color: #d4d4d8;
}

.model-test-upload-icon svg {
  width: 18px;
  height: 18px;
}

.model-test-upload-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.model-test-upload-copy strong,
.model-test-upload-copy small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-test-upload-copy strong {
  color: #f4f4f5;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.model-test-upload-copy small {
  color: #85858e;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.35;
}

.model-test-upload-files {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 7px;
}

.model-test-upload-files[hidden] {
  display: none;
}

.model-test-upload-limit {
  padding: 7px 9px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 6px;
  background: rgba(127, 29, 29, 0.16);
  color: #fca5a5;
  font-size: 10px;
  line-height: 1.4;
}

.model-test-upload-file {
  display: grid;
  min-width: 0;
  min-height: 48px;
  grid-template-columns: auto 38px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: #121212;
}

.model-test-upload-file.is-single {
  grid-template-columns: 38px minmax(0, 1fr) 28px;
}

.model-test-upload-order {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #a1a1aa;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
}

.model-test-upload-file img {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: #090909;
  object-fit: cover;
}

.model-test-upload-file-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.model-test-upload-file-copy strong,
.model-test-upload-file-copy small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-test-upload-file-copy strong {
  color: #e4e4e7;
  font-size: 11px;
  font-weight: 650;
}

.model-test-upload-file-copy small {
  color: #71717a;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
}

.model-test-upload-remove {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #85858e;
}

.model-test-upload-remove:hover,
.model-test-upload-remove:focus-visible {
  outline: none;
  background: #262626;
  color: #f4f4f5;
}

.model-test-upload-remove svg {
  width: 15px;
  height: 15px;
}

.model-test-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.model-test-form.is-running .model-test-parameter-grid,
.model-test-form.is-running .model-test-reference-fields {
  opacity: 0.72;
}

.model-test-live-note {
  margin: -6px 0 0;
  color: #77777f;
  font-size: 11px;
}

.model-test-result {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px 0 0 24px;
}

.model-test-result-head {
  align-items: center;
  margin-bottom: 16px;
}

.model-test-result-head h3 {
  font-size: 15px;
}

.model-test-result-head span {
  max-width: 70%;
  color: #a1a1aa;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  text-align: right;
  overflow-wrap: anywhere;
}

.model-test-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.model-test-metrics > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 11px 12px;
  border-right: 1px solid var(--border);
}

.model-test-metrics > div:first-child {
  padding-left: 0;
}

.model-test-metrics > div:last-child {
  border-right: 0;
}

.model-test-metrics span {
  color: #77777f;
  font-size: 11px;
}

.model-test-metrics strong {
  color: #e4e4e7;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-test-preview {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  min-height: 460px;
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #090909;
  overflow: hidden;
}

.model-test-preview.empty {
  align-items: center;
  color: #6f6f78;
  font-size: 13px;
}

.model-test-preview.activity {
  justify-content: flex-start;
  background: #0b0b0b;
}

.model-test-activity-shell {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 458px;
}

.model-test-activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: #111111;
}

.model-test-activity-head > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.model-test-activity-head strong {
  color: #f4f4f5;
  font-size: 14px;
}

.model-test-activity-head span {
  color: #7f7f88;
  font-size: 11px;
}

.model-test-activity-live {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 5px;
  background: rgba(37, 99, 235, 0.1);
  color: #93c5fd !important;
  font-size: 10px !important;
  font-weight: 700;
}

.model-test-activity-list {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 18px 18px;
  overflow: auto;
}

.model-test-activity-item {
  display: grid;
  grid-template-columns: 66px 12px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.model-test-activity-item:last-child {
  border-bottom: 0;
}

.model-test-activity-item time {
  padding-top: 1px;
  color: #686871;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  line-height: 1.55;
  white-space: nowrap;
}

.model-test-activity-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: #71717a;
  box-shadow: 0 0 0 3px rgba(113, 113, 122, 0.12);
}

.model-test-activity-item p {
  min-width: 0;
  margin: 0;
  color: #d4d4d8;
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.model-test-activity-item.waiting .model-test-activity-dot {
  background: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.13);
}

.model-test-activity-item.waiting p {
  color: #bfdbfe;
}

.model-test-activity-item.success .model-test-activity-dot {
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.13);
}

.model-test-activity-item.success p {
  color: #bbf7d0;
}

.model-test-activity-item.error .model-test-activity-dot {
  background: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.13);
}

.model-test-activity-item.error p {
  color: #fecaca;
}

.model-test-activity-item.muted p {
  color: #8a8a93;
}

.model-test-media-stage {
  display: grid;
  flex: 1 1 auto;
  place-items: center;
  min-height: 410px;
  padding: 16px;
  overflow: hidden;
}

.model-test-media-stage img,
.model-test-media-stage video {
  display: block;
  max-width: 100%;
  max-height: 620px;
  object-fit: contain;
}

.model-test-media-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: #111111;
}

.model-test-media-actions a {
  color: #a7f3d0;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.model-test-media-actions a:hover {
  color: #d1fae5;
}

.model-test-activity-history {
  border-top: 1px solid var(--border);
  background: #0d0d0d;
}

.model-test-activity-history summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  color: #a1a1aa;
  font-size: 12px;
  cursor: pointer;
  list-style: none;
}

.model-test-activity-history summary::-webkit-details-marker {
  display: none;
}

.model-test-activity-history summary span {
  color: #686871;
  font-size: 10px;
}

.model-test-activity-history[open] summary {
  border-bottom: 1px solid var(--border);
}

.model-test-activity-list.compact {
  max-height: 240px;
  padding-top: 8px;
}

.model-test-error {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.08);
  color: #fecaca;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.model-test-raw {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.model-test-raw summary {
  width: fit-content;
  color: #a1a1aa;
  font-size: 12px;
  cursor: pointer;
}

.model-test-raw pre {
  max-height: 260px;
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #090909;
  color: #b7c3d0;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow: auto;
}

@media (max-width: 1180px) {
  .model-test-layout {
    grid-template-columns: 1fr;
  }

  .model-test-form {
    padding-right: 0;
    padding-bottom: 22px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .model-test-result {
    padding-left: 0;
  }
}

@media (max-width: 760px) {
  .model-test-heading,
  .model-test-result-head {
    align-items: flex-start;
  }

  .model-test-parameter-grid,
  .model-test-reference-grid {
    grid-template-columns: 1fr;
  }

  .model-test-reference-wide {
    grid-column: auto;
  }

  .model-test-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .model-test-metrics > div:nth-child(2) {
    border-right: 0;
  }

  .model-test-metrics > div:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }

  .model-test-metrics > div:nth-child(3) {
    padding-left: 0;
  }

  .model-test-preview,
  .model-test-media-stage {
    min-height: 320px;
  }

  .model-test-activity-shell {
    min-height: 318px;
  }

  .model-test-activity-head {
    align-items: flex-start;
    padding: 14px;
  }

  .model-test-activity-list {
    padding: 10px 14px 14px;
  }

  .model-test-activity-item {
    grid-template-columns: 56px 10px minmax(0, 1fr);
    gap: 7px;
  }
}
