: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: 1688px;
  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;
  flex-wrap: wrap;
  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); }
}


.async-debug-hero {
  position: relative;
  overflow: hidden;
}

.async-debug-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(44, 199, 170, 0.14), transparent 34%),
    linear-gradient(135deg, rgba(29, 121, 209, 0.14), transparent 55%);
  pointer-events: none;
}

.async-debug-head,
.async-debug-layout {
  position: relative;
  z-index: 1;
}

.async-debug-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.async-debug-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.9fr);
  gap: 20px;
}

.async-debug-form-panel,
.async-debug-status-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(6, 15, 24, 0.42);
  padding: 18px;
}

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

.async-debug-model-preview {
  grid-column: 1 / -1;
}

.async-debug-status-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.async-debug-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.async-debug-status-item {
  border: 1px solid rgba(165, 197, 230, 0.12);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  min-height: 82px;
}

.async-debug-status-item strong,
.async-debug-status-item div {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

.async-debug-status-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.async-debug-error {
  min-height: 18px;
  color: var(--muted);
}


.async-debug-preview {
  min-height: 220px;
  border: 1px dashed rgba(165, 197, 230, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--muted);
  padding: 12px;
}

.async-debug-preview.empty {
  font-size: 13px;
}

.async-debug-preview.has-preview {
  cursor: zoom-in;
}

.async-debug-preview img,
.async-debug-preview video {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
}

.async-debug-error.visible {
  color: #ffb4bc;
}

/* 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;
}

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


.async-tasks-mobile {
  display: none;
}


.tokens-mobile,
.logs-mobile {
  display: none;
}

.mobile-card-list {
  gap: 8px;
}

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

.mobile-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.mobile-card-head.compact {
  margin-bottom: 6px;
}

.mobile-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mobile-card-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.mobile-card-mini {
  color: #7f96ad;
  font-size: 12px;
}

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

.mobile-card-grid.compact {
  gap: 6px;
}

.mobile-card-item {
  border: 1px solid rgba(165, 197, 230, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px;
}

.mobile-card-item.full {
  grid-column: 1 / -1;
}

.mobile-card-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mobile-card-value {
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.mobile-card-value.mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}

.action-btns.compact {
  margin-top: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.action-btns.compact button {
  min-height: 32px;
  padding: 4px 6px;
  font-size: 10px;
}

.async-task-cards {
  gap: 12px;
}

.async-task-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  padding: 14px;
}

.async-task-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.async-task-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.async-task-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.async-task-card-item {
  border: 1px solid rgba(165, 197, 230, 0.12);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.async-task-card-item.full {
  grid-column: 1 / -1;
}

.async-task-card-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.async-task-card-value {
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.async-task-card-value.mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.async-task-card-error {
  color: #ffb4bc;
}

.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(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: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 220px;
}

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-pending { background: rgba(225, 163, 44, 0.2); color: #ffca58; }
.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);
  overflow: hidden;
  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: flex-start;
  justify-content: center;
  min-height: 220px;
  max-height: min(62vh, calc(100vh - 240px));
  overflow: auto;
  padding-right: 4px;
}

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

.preview-meta {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.preview-meta.open {
  display: grid;
}

.preview-meta-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.preview-meta-item.full {
  grid-column: 1 / -1;
}

.preview-meta-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.preview-meta-value {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

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

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

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

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

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


@media (max-width: 980px) {
  .async-debug-layout {
    grid-template-columns: 1fr;
  }

  .async-debug-grid,
  .async-debug-status-grid {
    grid-template-columns: 1fr;
  }
}


@media (max-width: 720px) {
  .preview-meta {
    grid-template-columns: 1fr;
  }
}


@media (max-width: 900px) {
  .shell {
    margin: 24px auto;
    padding: 0 14px;
    gap: 18px;
  }

  .card {
    padding: 18px;
  }

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

  .actions .input-text,
  .actions .input-select {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .tokens-desktop,
  .logs-desktop,
  .async-tasks-desktop {
    display: none;
  }

  .tokens-mobile,
  .logs-mobile,
  .async-tasks-mobile {
    display: grid;
  }

  .async-task-card,
  .mobile-data-card {
    padding: 9px;
    border-radius: 10px;
  }

  .async-task-card-grid,
  .mobile-card-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .async-task-card-item,
  .mobile-card-item {
    padding: 7px;
  }

  .async-task-card-head,
  .mobile-card-head {
    margin-bottom: 6px;
  }

  .shell {
    margin: 14px auto;
    padding: 0 10px;
  }

  .card {
    padding: 14px;
    border-radius: 14px;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 16px;
  }

  .tab-btn {
    flex: 1 1 calc(50% - 8px);
    text-align: center;
    padding: 10px 12px;
    font-size: 14px;
  }

  .actions {
    width: 100%;
  }

  .actions button,
  .actions .preview-download,
  .actions .input-text,
  .actions .input-select {
    width: 100%;
  }

  button,
  .preview-download {
    min-height: 40px;
  }

  .token-summary {
    flex-wrap: wrap;
    gap: 10px;
  }

  table {
    font-size: 13px;
  }

  td,
  th {
    padding: 10px 8px;
  }

  .preview-modal {
    padding: 10px;
  }

  .preview-modal-dialog {
    width: 100%;
    max-height: calc(100vh - 20px);
    padding: 12px;
  }

  .preview-content {
    min-height: 180px;
    max-height: min(52vh, calc(100vh - 250px));
  }

  .preview-content img,
  .preview-content video {
    max-height: min(48vh, calc(100vh - 270px));
  }

  .dialog-card {
    width: 100%;
    max-height: calc(100vh - 20px);
    padding: 12px;
  }
}


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

  .tab-btn {
    flex-basis: 100%;
  }

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