: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%;
  max-width: none;
  margin: 24px auto;
  padding: 0 clamp(12px, 2vw, 32px);
  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;
  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: flex-start;
  gap: 16px;
  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);
}

.input-text:disabled {
  color: rgba(231, 241, 253, 0.58);
  cursor: not-allowed;
  opacity: 0.72;
}

.runtime-unlimited-note {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid rgba(77, 226, 196, 0.22);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(44, 199, 170, 0.12), rgba(48, 170, 255, 0.07));
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin: -4px 0 16px;
  padding: 12px 14px;
}

.runtime-unlimited-note strong {
  color: #dffdf6;
  font-size: 13px;
}

.availability-panel {
  display: grid;
  grid-template-columns: minmax(170px, 0.85fr) minmax(0, 2.15fr);
  gap: 12px;
  align-items: stretch;
  border: 1px solid rgba(77, 226, 196, 0.25);
  border-radius: 16px;
  background:
    radial-gradient(circle at 10% 0%, rgba(77, 226, 196, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  margin: 2px 0 16px;
  padding: 14px;
}

.availability-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 132px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(7, 12, 20, 0.28);
  padding: 16px;
}

.availability-kicker {
  color: #80f5dd;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.availability-hero strong {
  color: #e7f1fd;
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(34px, 6vw, 52px);
  line-height: 0.95;
}

.availability-hero > span:not(.availability-kicker) {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

.availability-credit {
  color: #7f96ad;
  font-size: 12px;
  margin-top: 10px;
}

.availability-credit b {
  color: #80f5dd;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
}

.price-matrix {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.price-group {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
}

.price-title {
  color: #e7f1fd;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 10px;
}

.price-chip-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.price-chip {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 8px;
  border: 1px solid rgba(165, 197, 230, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  padding: 7px 9px;
  white-space: nowrap;
}

.price-chip strong {
  color: #80f5dd;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.price-chip em {
  color: #63d4ff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-style: normal;
  margin-left: auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 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-hot {
  background: linear-gradient(145deg, rgba(44, 199, 170, 0.18), rgba(48, 170, 255, 0.1));
  border-color: rgba(77, 226, 196, 0.38);
}

.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;
}

.logs-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 10px;
}

.logs-section-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
  color: #e7f1fd;
}

.logs-ended-head {
  margin-top: 22px;
}

.logs-count-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(77, 226, 196, 0.35);
  background: rgba(44, 199, 170, 0.12);
  color: #80f5dd;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.task-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: clamp(260px, 36vh, 420px);
  min-height: 260px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(142, 181, 221, 0.18);
  border-radius: 14px;
  background: rgba(6, 13, 22, 0.32);
}

.task-card {
  border: 1px solid rgba(142, 181, 221, 0.22);
  border-radius: 10px;
  padding: 8px 10px;
  background:
    linear-gradient(150deg, rgba(48, 170, 255, 0.1), rgba(44, 199, 170, 0.07)),
    rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.task-row {
  display: grid;
  grid-template-columns: 104px 150px minmax(120px, 0.9fr) minmax(130px, 1fr) 72px minmax(240px, 2.4fr) minmax(120px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 1100px;
}

.task-card.running {
  border-color: rgba(99, 212, 255, 0.38);
}

.task-card-top,
.task-card-actions,
.detail-actions,
.detail-summary {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-card-top {
  justify-content: space-between;
  margin-bottom: 12px;
}

.task-time {
  color: #7f96ad;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}

.task-title {
  min-height: 38px;
  margin: 10px 0;
  color: #e7f1fd;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-cell {
  min-width: 0;
  color: #b9d1e8;
  font-size: 12px;
  line-height: 1.25;
}

.task-cell .task-cell-label {
  display: block;
  margin-bottom: 2px;
  color: #6f879e;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.task-cell-value,
.task-prompt {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-cell.mono .task-cell-value {
  font-family: "IBM Plex Mono", monospace;
}

.task-meta-grid {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 6px 8px;
  color: #7f96ad;
  font-size: 12px;
}

.task-meta-grid strong {
  min-width: 0;
  color: #b9d1e8;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-card-actions {
  justify-content: flex-end;
  margin-top: 0;
  gap: 6px;
  flex-wrap: nowrap;
}

.task-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
}

.task-progress.compact {
  min-width: 150px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(127, 150, 173, 0.22);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2cc7aa, #63d4ff);
  transition: width 0.35s ease;
}

.task-progress span {
  color: #cfe3f8;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  text-align: right;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border-radius: 12px;
}

.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;
}

.token-tools {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) repeat(3, minmax(150px, 0.7fr)) repeat(4, max-content);
  gap: 10px;
  align-items: center;
  margin: 0 0 14px;
}

.token-tools button {
  white-space: nowrap;
}

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

.token-list-card {
  min-width: 0;
}

.token-list-card .list-head .actions {
  justify-content: flex-end;
  gap: 10px;
  max-width: min(100%, 980px);
}

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

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

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

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

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

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

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

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

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

#tokenTable th:nth-child(9),
#tokenTable td:nth-child(9) {
  width: 190px;
}

#logsTable,
#runningLogsTable {
  table-layout: auto;
}

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

#logsTable th:nth-child(2),
#logsTable td:nth-child(2),
#logsTable th:nth-child(3),
#logsTable td:nth-child(3),
#logsTable th:nth-child(6),
#logsTable td:nth-child(6),
#logsTable th:nth-child(7),
#logsTable td:nth-child(7) {
  width: auto;
  white-space: nowrap;
}

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

#logsTable th:nth-child(5),
#logsTable td:nth-child(5) {
  min-width: 220px;
  width: 42%;
}

#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 {
  display: block;
  margin-top: 3px;
  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;
  overflow-wrap: anywhere;
}

.token-sora-quota {
  display: inline-flex;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(121, 92, 255, 0.18);
  color: #c8c0ff;
  font-weight: 700;
}

.token-sora-quota.exhausted {
  background: rgba(225, 163, 44, 0.18);
  color: #ffca58;
}

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

.empty-state.compact {
  grid-column: 1 / -1;
  padding: 18px !important;
  border: 1px dashed rgba(142, 181, 221, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.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-dialog {
  width: min(1240px, 100%);
}

.log-detail-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 170px);
  overflow: auto;
}

.detail-summary {
  justify-content: space-between;
  border: 1px solid rgba(142, 181, 221, 0.22);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
}

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

.detail-field,
.detail-block {
  border: 1px solid rgba(142, 181, 221, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  min-width: 0;
}

.detail-field span,
.detail-block span {
  display: block;
  margin-bottom: 5px;
  color: #7f96ad;
  font-size: 12px;
}

.detail-field strong {
  display: block;
  color: #dcecff;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-field.wide {
  grid-column: span 2;
}

.detail-field.full {
  grid-column: 1 / -1;
}

.detail-block pre,
.detail-raw pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #cfe3f8;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.detail-block.error {
  border-color: rgba(255, 180, 188, 0.34);
  background: rgba(225, 96, 104, 0.08);
}

.detail-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.detail-raw {
  border: 1px solid rgba(142, 181, 221, 0.18);
  border-radius: 10px;
  padding: 10px;
  background: #091321;
}

.detail-raw summary {
  cursor: pointer;
  color: #a8bfd8;
  font-size: 12px;
  font-weight: 700;
}

.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) {
  .availability-panel {
    grid-template-columns: 1fr;
  }

  .price-matrix {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .task-board,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-field.wide,
  .detail-field.full {
    grid-column: 1 / -1;
  }

  .list-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .list-head .actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }

  .token-tools {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .availability-panel {
    padding: 12px;
  }

  .price-matrix {
    grid-template-columns: 1fr;
  }

  .availability-hero {
    min-height: 0;
  }

  .token-tools {
    grid-template-columns: 1fr;
  }

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

  .logs-section-head,
  .detail-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .config-category-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .config-inline-row {
    grid-template-columns: 1fr;
  }

  .input-select {
    width: 100%;
  }
}
