: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);
}

.input-area {
  width: 100%;
  min-height: 120px;
  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;
  line-height: 1.5;
  resize: vertical;
}

.input-area: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;
}

.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;
  flex-wrap: wrap;
  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(7),
#logsTable td:nth-child(7),
#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: pre-wrap;
  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);
}

.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);
}

.element-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.elements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.element-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.element-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: rgba(0, 0, 0, 0.2);
}

.element-meta {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.element-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.element-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.element-kind {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(44, 199, 170, 0.14);
  color: #7af3dd;
}

.element-kind.scene {
  background: rgba(29, 121, 209, 0.14);
  color: #8fc5ff;
}

.element-detail {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.test-composer-card {
  background: linear-gradient(145deg, rgba(18, 28, 42, 0.88), rgba(10, 18, 29, 0.76));
}

.test-composer-head {
  align-items: flex-start;
}

.test-composer-title p {
  margin-top: 4px;
}

.test-composer {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 18px;
  padding: 20px;
  border: 1px solid rgba(175, 190, 214, 0.12);
  border-radius: 28px;
  background:
    radial-gradient(circle at 88% 80%, rgba(83, 103, 132, 0.22), transparent 28%),
    #171b23;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 20px 36px rgba(0, 0, 0, 0.26);
}

.test-upload-drop {
  position: relative;
  min-height: 116px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #808b9c;
  cursor: pointer;
  user-select: none;
}

.test-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.test-upload-tilt {
  width: 58px;
  height: 70px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: #2a2f3a;
  color: #9aa5b8;
  font-size: 11px;
  font-weight: 800;
  transform: rotate(-8deg);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.24);
}

.test-upload-plus {
  position: absolute;
  top: 20px;
  color: #aeb8c8;
  font-size: 26px;
  line-height: 1;
}

.test-upload-copy {
  font-size: 12px;
  font-weight: 700;
}

.test-upload-drop:hover .test-upload-tilt {
  background: #303747;
  color: #d4deef;
}

.test-composer-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.test-prompt-input {
  width: 100%;
  min-height: 112px;
  border: 0;
  outline: none;
  background: transparent;
  color: #eef5ff;
  font-family: "Manrope", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
  caret-color: #38e4ff;
}

.test-prompt-input::placeholder {
  color: rgba(152, 164, 184, 0.72);
}

.test-project-input {
  width: 100%;
  min-height: 76px;
  border: 1px solid rgba(164, 181, 207, 0.12);
  border-radius: 14px;
  outline: none;
  background: rgba(5, 9, 15, 0.34);
  color: #d9e8fa;
  padding: 10px 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  resize: vertical;
}

.test-project-input:focus {
  border-color: rgba(56, 228, 255, 0.56);
}

.test-project-input::placeholder {
  color: rgba(152, 164, 184, 0.68);
}

.test-control-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.test-chip-select {
  min-width: 0;
  max-width: 240px;
  border: 1px solid rgba(164, 181, 207, 0.12);
  border-radius: 10px;
  background: rgba(15, 19, 27, 0.86);
  color: #f0f5ff;
  padding: 9px 10px;
  font-family: "Manrope", sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.test-chip-select:focus {
  outline: none;
  border-color: rgba(56, 228, 255, 0.56);
}

.test-chip-select:disabled {
  opacity: 0.48;
}

.test-model-select {
  min-width: 230px;
  max-width: 360px;
}

.test-concurrency-select {
  max-width: 118px;
}

.test-mention-wrap {
  position: relative;
  display: inline-flex;
}

.test-mention-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(164, 181, 207, 0.16);
  border-radius: 10px;
  background: rgba(15, 19, 27, 0.86);
  color: #f0f5ff;
  font-size: 17px;
  font-weight: 900;
}

.test-mention-btn:hover:not(:disabled),
.test-mention-btn.active {
  border-color: rgba(56, 228, 255, 0.5);
  background: rgba(24, 34, 48, 0.94);
  color: #38e4ff;
}

.test-mention-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.test-mention-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 30;
  width: 264px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid rgba(164, 181, 207, 0.16);
  border-radius: 14px;
  background: rgba(20, 25, 34, 0.98);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.42);
  padding: 8px;
}

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

.test-mention-menu-title {
  padding: 6px 8px 8px;
  color: #8794a7;
  font-size: 12px;
  font-weight: 800;
}

.test-mention-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  background: transparent;
  color: #eef5ff;
  text-align: left;
}

.test-mention-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.test-mention-thumb {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 9px;
  object-fit: cover;
  background: #091321;
}

.test-mention-item-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.test-mention-name {
  color: #f4f8ff;
  font-size: 13px;
  font-weight: 900;
}

.test-mention-file {
  max-width: 178px;
  overflow: hidden;
  color: #8fa7c2;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.test-generate-msg {
  min-width: 110px;
  color: var(--muted);
  font-size: 12px;
}

.test-run-btn {
  width: 42px;
  height: 42px;
  margin-left: auto;
  padding: 0;
  border-radius: 50%;
  background: #3e4655;
  color: #aeb8c8;
  font-size: 25px;
  line-height: 1;
  box-shadow: none;
}

.test-run-btn:hover {
  background: #566174;
  color: #ffffff;
  transform: translateY(-1px);
}

.test-run-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.test-result {
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
}

.test-result-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  align-self: stretch;
}

.test-result-card {
  min-width: 0;
  border: 1px solid rgba(164, 181, 207, 0.14);
  border-radius: 12px;
  background: rgba(8, 17, 28, 0.72);
  padding: 10px;
}

.test-result-card.done {
  border-color: rgba(77, 226, 196, 0.28);
}

.test-result-card.error {
  border-color: rgba(255, 111, 124, 0.42);
}

.test-result-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: #a8bfd8;
  font-size: 11px;
  font-weight: 900;
}

.test-result-card-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.test-result-prompt {
  width: 100%;
  max-height: 44px;
  overflow: hidden;
  color: #8fa7c2;
  font-size: 11px;
  line-height: 1.35;
  word-break: break-word;
}

.test-result-card-body {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.test-result-card-body img,
.test-result-card-body video {
  width: 100%;
  height: 220px;
  object-fit: contain;
}

.test-result-link {
  color: #38e4ff;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.test-result-link:hover {
  text-decoration: underline;
}

.test-result img,
.test-result video {
  max-width: 100%;
  max-height: 560px;
  border-radius: 10px;
  background: #08111c;
}

.test-result .test-link-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

.test-result .test-link-result.error {
  color: #ffb4bc;
}

.test-file-preview {
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.test-file-preview-card {
  width: 112px;
  min-width: 0;
  position: relative;
  border: 1px solid rgba(164, 181, 207, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  padding: 6px;
}

.test-file-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  z-index: 2;
  width: 22px;
  height: 22px;
  min-width: 0;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 7px;
  background: #ff4c6a;
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  line-height: 16px;
  box-shadow: 0 8px 18px rgba(255, 76, 106, 0.28);
}

.test-file-remove:hover {
  background: #ff244d;
  transform: translateY(-1px);
}

.test-file-ref-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  max-width: 74px;
  padding: 3px 6px;
  border: 1px solid rgba(77, 226, 196, 0.42);
  border-radius: 999px;
  background: rgba(4, 15, 24, 0.78);
  color: #4de2c4;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.test-file-ref-badge {
  cursor: pointer;
}

button.test-file-ref-badge:hover {
  border-color: rgba(56, 228, 255, 0.58);
  color: #38e4ff;
}

.test-file-element-badge {
  position: absolute;
  left: 8px;
  top: 30px;
  z-index: 2;
  max-width: 74px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 197, 92, 0.46);
  border-radius: 999px;
  background: rgba(24, 16, 4, 0.78);
  color: #ffc55c;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.test-file-preview-card img,
.test-file-preview-card video {
  width: 100%;
  height: 70px;
  object-fit: cover;
  border-radius: 10px;
  background: #08111c;
}

.test-file-preview-card audio {
  width: 100%;
  height: 32px;
  margin-top: 20px;
}

.test-file-preview-icon {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(44, 199, 170, 0.18), rgba(29, 121, 209, 0.18));
  color: #d9f5ff;
  font-size: 13px;
  font-weight: 900;
}

.test-file-preview-card.video {
  border-color: rgba(89, 164, 255, 0.28);
}

.test-file-preview-card.audio {
  border-color: rgba(77, 226, 196, 0.28);
}

.test-file-preview-card .name {
  margin-top: 6px;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.test-file-preview-card .meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.test-file-preview-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  min-height: 106px;
  border: 1px dashed rgba(164, 181, 207, 0.2);
  border-radius: 14px;
  color: #a8bfd8;
  font-size: 12px;
  font-weight: 800;
}

.test-raw-wrap {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.test-raw-wrap summary {
  cursor: pointer;
  user-select: none;
}

.test-raw-wrap pre {
  max-height: 300px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.34);
  color: #cfe3f8;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.word-plugin-hero {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 188, 93, 0.34), transparent 28%),
    radial-gradient(circle at 16% 80%, rgba(50, 208, 182, 0.24), transparent 34%),
    linear-gradient(135deg, rgba(21, 28, 35, 0.96), rgba(9, 13, 19, 0.9));
}

.word-plugin-hero::before {
  content: "字 字 动 画";
  position: absolute;
  top: 18px;
  right: 28px;
  color: rgba(255, 255, 255, 0.07);
  font-size: clamp(48px, 9vw, 112px);
  font-weight: 900;
  letter-spacing: 0.16em;
  white-space: nowrap;
  pointer-events: none;
}

.word-plugin-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 660px;
}

.word-plugin-kicker {
  margin-bottom: 10px;
  color: #ffd494;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.word-plugin-hero h2 {
  margin: 0;
  color: #fff8e9;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1;
  letter-spacing: -0.06em;
}

.word-plugin-hero p {
  max-width: 620px;
  margin: 14px 0 0;
  color: rgba(232, 242, 250, 0.72);
  font-size: 15px;
  line-height: 1.7;
}

.word-plugin-model-pill {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  max-width: 360px;
  padding: 10px 13px;
  border: 1px solid rgba(255, 212, 148, 0.35);
  border-radius: 999px;
  background: rgba(7, 10, 16, 0.52);
  color: #ffe2ac;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  word-break: break-all;
}

.word-plugin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.25fr);
  gap: 18px;
  margin-top: 18px;
}

.word-plugin-control,
.word-plugin-compose,
.word-plugin-output-card {
  border-radius: 22px;
}

.word-plugin-control {
  background:
    linear-gradient(180deg, rgba(18, 31, 39, 0.9), rgba(9, 16, 25, 0.84)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 36px);
}

.word-plugin-compose {
  background:
    radial-gradient(circle at 95% 10%, rgba(255, 117, 78, 0.16), transparent 32%),
    linear-gradient(145deg, rgba(20, 23, 31, 0.92), rgba(8, 12, 19, 0.86));
}

.word-plugin-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.word-plugin-section-title span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffd494;
  color: #111820;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 900;
}

.word-plugin-section-title h3 {
  margin: 0;
  color: #eff7ff;
  font-size: 18px;
}

.word-plugin-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.word-plugin-field label {
  color: #aebdd0;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.word-plugin-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.word-plugin-text,
.word-plugin-prompt {
  border-radius: 16px;
  background: rgba(3, 7, 13, 0.42);
  color: #eef6ff;
  font-size: 14px;
  line-height: 1.65;
}

.word-plugin-prompt {
  min-height: 170px;
}

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

.word-plugin-generate {
  min-width: 140px;
  background: linear-gradient(135deg, #ffd494, #ff795f);
  color: #131820;
  box-shadow: 0 16px 34px rgba(255, 121, 95, 0.24);
}

.word-plugin-generate:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 42px rgba(255, 121, 95, 0.32);
}

.word-plugin-result {
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border: 1px solid rgba(164, 181, 207, 0.14);
  border-radius: 18px;
  background:
    linear-gradient(45deg, rgba(255,255,255,0.035) 25%, transparent 25% 50%, rgba(255,255,255,0.035) 50% 75%, transparent 75%),
    rgba(0, 0, 0, 0.2);
  background-size: 22px 22px;
}

.word-plugin-empty {
  color: #93a6ba;
  font-size: 14px;
  font-weight: 800;
}

.word-plugin-empty.error {
  color: #ffb4bc;
}

.word-plugin-preview-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.word-plugin-preview-shell img {
  max-width: 100%;
  max-height: 680px;
  object-fit: contain;
  border-radius: 16px;
  background: #07101b;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.34);
}

.word-plugin-result-link {
  color: #ffd494;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.word-plugin-result-link:hover {
  text-decoration: underline;
}

@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;
  }

  .element-upload-grid {
    grid-template-columns: 1fr;
  }

  .test-composer {
    grid-template-columns: 1fr;
  }

  .test-upload-drop {
    min-height: 72px;
    flex-direction: row;
  }

  .test-upload-tilt {
    width: 52px;
    height: 58px;
  }

  .test-upload-plus {
    position: static;
  }

  .word-plugin-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .word-plugin-grid,
  .word-plugin-two-col {
    grid-template-columns: 1fr;
  }
}

@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%;
  }

  .test-control-bar {
    align-items: stretch;
  }

  .test-chip-select,
  .test-model-select,
  .test-control-bar button.secondary {
    width: 100%;
    max-width: none;
  }

  .test-run-btn {
    width: 100%;
    border-radius: 14px;
    margin-left: 0;
  }
}
