: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 {
  width: 100%;
  min-width: 0;
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  min-width: 0;
  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;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.duration-matrix {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 13px;
}

.duration-matrix th,
.duration-matrix td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 8px;
  text-align: center;
  white-space: nowrap;
}

.duration-matrix th:first-child,
.duration-matrix td:first-child {
  text-align: left;
  padding-left: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.duration-matrix thead th {
  color: #9fc4e8;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.03);
}

.duration-matrix tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.duration-matrix input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #2cc7aa;
}

/* Actions */
.actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.quick-actions-card .actions {
  flex-wrap: wrap;
}

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-list-card .list-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

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

.token-list-card .actions {
  flex-wrap: wrap;
  gap: 10px;
}

.product-line-select-all,
.product-line-select-token {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.product-line-select-all input,
.product-line-select-token input {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
}

.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-card-monitor {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-card-monitor-timeline {
  grid-column: 1 / -1;
}

.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;
}

.monitor-indicator-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.monitor-timeline {
  display: grid;
  grid-template-columns: repeat(60, minmax(0, 1fr));
  gap: 4px;
  align-items: end;
  width: 100%;
  min-height: 48px;
}

.monitor-indicator {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  flex: 0 0 auto;
}

.monitor-indicator-good {
  background: #39d98a;
}

.monitor-indicator-warn {
  background: #f3c64d;
}

.monitor-indicator-bad {
  background: #ff6b6b;
}

.monitor-indicator-idle {
  background: #6e7f93;
}

.monitor-timeline-block {
  width: 100%;
  min-width: 0;
  height: 14px;
  border-radius: 4px;
  cursor: help;
}

@media (max-width: 900px) {
  .stat-card-monitor-timeline {
    overflow-x: auto;
  }
}

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

.monitor-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

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

.product-line-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  padding: 14px;
  margin: 0 0 16px;
}

.product-line-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.product-line-panel-head h3 {
  margin: 0;
  font-size: 15px;
  color: #e7f1fd;
}

.product-line-accounts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-line-empty {
  padding: 18px !important;
}

.product-line-account {
  display: grid;
  grid-template-columns: minmax(190px, 240px) 1fr;
  gap: 12px;
  align-items: stretch;
  padding: 12px;
  border: 1px solid rgba(165, 197, 230, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.product-line-account.disabled {
  opacity: 0.72;
}

.product-line-account-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.product-line-account-name {
  color: #e7f1fd;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-line-account-email,
.product-line-account-stats {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.product-line-account-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.product-line-account-actions {
  margin-top: auto;
  padding-top: 8px;
}

button.product-line-refresh-credits-btn {
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
}

.product-line-chip-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(118px, 1fr));
  gap: 8px;
  min-width: 0;
}

.product-line-chip {
  min-width: 0;
  min-height: 150px;
  border: 1px solid rgba(165, 197, 230, 0.14);
  border-radius: 8px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
}

.product-line-chip.available {
  border-color: rgba(77, 226, 196, 0.4);
  background: rgba(44, 199, 170, 0.12);
}

.product-line-chip.unavailable {
  border-color: rgba(255, 180, 188, 0.42);
  background: rgba(225, 96, 104, 0.12);
}

.product-line-chip.missing {
  border-color: rgba(168, 191, 216, 0.2);
  background: rgba(255, 255, 255, 0.035);
}

.product-line-chip-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.product-line-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #7f96ad;
}

.product-line-chip.available .product-line-dot {
  background: #4de2c4;
}

.product-line-chip.unavailable .product-line-dot {
  background: #ff7f8a;
}

.product-line-name {
  color: #e7f1fd;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-line-credit {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 202, 88, 0.16);
  color: #ffca58;
  font-size: 10px;
  font-weight: 700;
  flex: 0 0 auto;
}

.product-line-chip-state {
  margin-top: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #a8bfd8;
}

.product-line-chip.available .product-line-chip-state {
  color: #4de2c4;
}

.product-line-chip.unavailable .product-line-chip-state {
  color: #ffb4bc;
}

.product-line-chip-count,
.product-line-chip-note {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.product-line-chip-actions {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
}

button.product-line-delete-btn {
  width: 100%;
  min-width: 68px;
  padding: 5px 8px;
  font-size: 11px;
  line-height: 1.2;
}

button.product-line-delete-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: transparent;
  color: var(--muted);
  border-color: rgba(168, 191, 216, 0.3);
}

.product-line-no-token {
  color: #7f96ad;
  font-size: 11px;
}

@media (max-width: 980px) {
  .product-line-account {
    grid-template-columns: 1fr;
  }
  .product-line-chip-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

#logsTable,
#runningLogsTable {
  table-layout: auto;
}

#logsTable th:nth-child(1),
#logsTable td:nth-child(1) {
  width: 78px;
}

#logsTable th:nth-child(2),
#logsTable td:nth-child(2) {
  width: 96px;
  white-space: nowrap;
}

#logsTable th:nth-child(3),
#logsTable td:nth-child(3) {
  width: 64px;
  white-space: nowrap;
}

#logsTable th:nth-child(4),
#logsTable td:nth-child(4) {
  width: 110px;
  white-space: nowrap;
}

#logsTable th:nth-child(5),
#logsTable td:nth-child(5) {
  width: 160px;
  max-width: 180px;
}

#logsTable th:nth-child(6),
#logsTable td:nth-child(6) {
  width: 160px;
  max-width: 200px;
}

#logsTable th:nth-child(7),
#logsTable td:nth-child(7) {
  width: 150px;
  min-width: 140px;
}

#logsTable th:nth-child(8),
#logsTable td:nth-child(8) {
  width: 120px;
  min-width: 120px;
  white-space: nowrap;
  text-align: right;
  position: sticky;
  right: 0;
  background: rgba(10, 18, 30, 0.96);
  z-index: 1;
}

.task-progress-cell {
  display: flex;
  min-width: 130px;
  align-items: center;
  gap: 8px;
}

.task-progress-cell .progress {
  flex: 1;
  width: 110px;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  appearance: none;
  background: rgba(142, 181, 221, 0.16);
}

.task-progress-cell .progress::-webkit-progress-bar {
  border-radius: 5px;
  background: rgba(142, 181, 221, 0.16);
}

.task-progress-cell .progress::-webkit-progress-value {
  border-radius: 5px;
  background: #3db8ff;
}

.task-progress-cell .progress::-moz-progress-bar {
  border-radius: 5px;
  background: #3db8ff;
}

.task-progress-cell span {
  min-width: 38px;
  color: #7f96ad;
  font-size: 12px;
  text-align: right;
}

.log-progress-cell {
  vertical-align: middle;
}

.log-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.log-id-btn {
  border: 0;
  background: transparent;
  color: #7ed0ff;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.log-id-btn:hover {
  text-decoration: underline;
}

#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;
}

.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;
}

.log-detail-modal .log-detail-dialog {
  width: min(980px, 100%);
  max-height: calc(100vh - 40px);
}

.log-detail-content {
  max-height: calc(100vh - 140px);
}

.log-detail-section {
  border: 1px solid rgba(142, 181, 221, 0.18);
  border-radius: 10px;
  background: rgba(8, 17, 28, 0.72);
  margin-bottom: 12px;
  overflow: hidden;
}

.log-detail-section h4 {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  color: #e9f4ff;
  border-bottom: 1px solid rgba(142, 181, 221, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.log-detail-section .detail-body {
  padding: 12px;
}

.log-detail-list {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 12px;
  margin: 0;
}

.log-detail-list dt {
  color: #7f96ad;
  font-size: 12px;
}

.log-detail-list dd {
  margin: 0;
  color: #e9f4ff;
  font-size: 12px;
  word-break: break-word;
}

.log-detail-json {
  margin: 0;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #cfe3f8;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.detail-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.detail-media-card {
  margin: 0;
  border: 1px solid rgba(142, 181, 221, 0.18);
  border-radius: 8px;
  overflow: hidden;
  background: #08111c;
}

.detail-media-card img,
.detail-media-card video,
.detail-media-card audio {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: #050b12;
}

.detail-media-card figcaption {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  font-size: 11px;
  color: #a8bfd8;
}

.detail-media-card a {
  color: #7ed0ff;
  text-decoration: none;
}

/* 操作列 sticky 样式已在上方定义 */

.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) {
  .shell {
    margin: 20px auto;
    padding: 0 12px;
    gap: 16px;
  }

  .card {
    padding: 16px;
  }

  .product-line-panel,
  .product-line-account {
    padding: 10px;
  }

  .product-line-chip-grid {
    grid-template-columns: 1fr;
  }

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