:root {
  --bg: #101311;
  --card: #191d1a;
  --card-border: rgba(227, 235, 226, 0.14);
  --text: #eef3ec;
  --muted: #a9b2a8;
  --brand: #68d8ae;
  --brand-hover: #82e2bc;
  --danger: #ef7378;
  --danger-hover: #ff8a8f;
  --warning: #efb45f;
  --info: #74bad4;
  --border: rgba(227, 235, 226, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text);
  overflow-x: hidden;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  padding: 24px;
}

.header.card {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.quick-actions-card {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.quick-actions-card h2 {
  margin-bottom: 10px;
}

.authority-management-banner {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-block: 1px solid rgba(77, 226, 196, 0.22);
  background: rgba(44, 199, 170, 0.055);
}

.authority-management-banner[hidden] {
  display: none;
}

.authority-management-mark {
  align-self: stretch;
  border-radius: 2px;
  background: var(--brand);
}

.authority-management-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.authority-management-copy strong {
  color: #bfe8dc;
  font-size: 12px;
}

.authority-management-copy > span {
  color: #82958f;
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

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

.capacity-scope-contract {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-block: 1px solid rgba(77, 226, 196, 0.2);
  background: rgba(44, 199, 170, 0.035);
}

.capacity-scope-contract > div {
  min-width: 0;
  padding: 10px 12px;
}

.capacity-scope-contract > div + div {
  border-left: 1px solid rgba(77, 226, 196, 0.16);
}

.capacity-scope-contract dt {
  color: #bfe8dc;
  font-size: 11px;
  font-weight: 800;
}

.capacity-scope-contract dd {
  margin: 3px 0 0;
  color: #82958f;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

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

.rpm-scope-controls {
  align-items: start;
}

.account-rpm-bulk-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.account-rpm-bulk-control button {
  min-height: 40px;
  padding-inline: 14px;
  white-space: nowrap;
}

.account-rpm-bulk-summary.is-working {
  color: #bfe8dc;
}

.account-rpm-bulk-summary.is-error {
  color: #ffb4bc;
}

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

.action-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-group[hidden] {
  display: none;
}

.account-control-actions {
  flex-wrap: wrap;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(104, 216, 174, 0.9);
  outline-offset: 2px;
}

body.has-open-modal {
  overflow: hidden;
}

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

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

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

.msg {
  font-size: 14px;
}

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

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

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

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

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

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

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

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

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

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

.table-wrapper {
  overflow-x: auto;
  border: 1px solid rgba(165, 197, 230, 0.12);
  border-radius: 10px;
  background: rgba(7, 13, 22, 0.22);
}

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

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

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

#tokenTable th {
  white-space: nowrap;
  font-size: 12px;
}

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

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

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

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

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

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

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

#tokenTable tbody tr {
  background: rgba(255, 255, 255, 0.01);
}

#tokenTable tbody tr:hover {
  background: rgba(104, 216, 174, 0.045);
}

#tokenTable .token-main-row td {
  vertical-align: top;
}

#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(10),
#logsTable td:nth-child(10),
#runningLogsTable th:nth-child(10),
#runningLogsTable td:nth-child(10) {
  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: 260px;
}

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

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

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

#logsTable th:nth-child(9),
#logsTable td:nth-child(9),
#runningLogsTable th:nth-child(9),
#runningLogsTable td:nth-child(9) {
  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;
}

.log-action-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

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

.table-heading-scope {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.table-heading-scope small,
.token-detail-grid h3 small {
  color: #71867f;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0;
}

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

.select-cell {
  text-align: center;
}

.account-cell {
  min-width: 0;
}

.account-pill {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.account-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #061611;
  background: linear-gradient(135deg, #4de2c4, #84b9ff);
  font-size: 12px;
  font-weight: 800;
}

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

.account-name,
.account-email {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-name {
  color: #d9ecff;
  font-size: 12px;
  font-weight: 700;
}

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

.token-val {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: #a0c3e8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.log-spec-cell {
  display: grid;
  grid-template-columns: repeat(2, minmax(44px, max-content));
  gap: 4px 5px;
  align-items: center;
  color: #a8bfd8;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  line-height: 1.25;
  min-width: 0;
}

.spec-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(77, 226, 196, 0.28);
  background: rgba(44, 199, 170, 0.12);
  color: #6ff2d7;
  font-weight: 700;
  white-space: nowrap;
}

.spec-resolution {
  border-color: rgba(99, 212, 255, 0.28);
  background: rgba(48, 170, 255, 0.12);
  color: #8bdcff;
}

.spec-detail {
  grid-column: 1 / -1;
  color: #7f96ad;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}

.muted-spec .spec-chip {
  border-color: rgba(168, 191, 216, 0.2);
  background: rgba(168, 191, 216, 0.08);
  color: #a8bfd8;
}

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

.action-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
  max-width: 106px;
}

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

.action-mini,
.action-btns button {
  width: 100%;
  min-height: 26px;
  padding: 4px 6px;
  font-size: 11px;
  border-radius: 4px;
  line-height: 1;
}

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

.auto-refresh-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.auto-refresh-cell .switch-text {
  margin-left: 0;
  white-space: nowrap;
}

.muted-text {
  color: #7f96ad !important;
}

.proxy-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.proxy-cell .status-badge {
  min-width: 0;
  justify-content: flex-start;
}

.status-refresh-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.status-refresh-cell .status-badge {
  max-width: 100%;
}

.credits-cell,
.stats-cell,
.expiry-cell {
  font-size: 12px;
  line-height: 1.35;
  color: #a8bfd8;
}

.credits-cell,
.expiry-cell {
  overflow: hidden;
}

.credits-cell span,
.expiry-cell span,
.stats-cell span {
  max-width: 100%;
}

.token-fail-count {
  display: block;
  margin-top: 3px;
  color: #7f96ad;
  font-size: 11px;
}

.token-fail-count.has-fails {
  color: #ffb4bc;
}

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

.request-detail-dialog {
  width: min(1280px, 100%);
}

.request-detail-content {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding-right: 2px;
}

.request-detail-section {
  border: 1px solid rgba(142, 181, 221, 0.25);
  border-radius: 8px;
  background: #091321;
  overflow: hidden;
}

.request-detail-section-title {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(142, 181, 221, 0.18);
  color: #e9f4ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

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

.request-detail-section.compact pre {
  max-height: 180px;
}

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

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

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

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

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

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

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

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

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

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

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

  .config-category-tabs .config-cat-btn:last-child {
    grid-column: 1 / -1;
  }

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

  .account-rpm-bulk-control {
    grid-template-columns: 1fr;
  }

  .capacity-scope-contract {
    grid-template-columns: 1fr;
  }

  .capacity-scope-contract > div + div {
    border-top: 1px solid rgba(77, 226, 196, 0.16);
    border-left: 0;
  }

  .input-select {
    width: 100%;
  }
}
.log-state-stack {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.log-failure-code {
  display: block;
  max-width: 150px;
  overflow: hidden;
  color: #ffb4bc;
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Token observability */
.token-list-card {
  padding: 20px;
}

.token-overview-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  border-block: 1px solid var(--border);
  margin: 0;
}

.overview-metric {
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--border);
}

.overview-metric:last-child {
  border-right: 0;
}

.overview-metric small,
.overview-metric strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-metric small {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.overview-metric strong {
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 18px;
  line-height: 1.2;
}

.overview-metric .overview-detail {
  display: block;
  min-width: 0;
  margin-top: 4px;
  overflow: hidden;
  color: #7f897f;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-rpm-metric.is-error strong,
.global-rpm-metric.is-error .overview-detail {
  color: #ef8b90;
}

.global-rpm-metric.is-limited strong,
.global-rpm-metric.is-limited .overview-detail {
  color: var(--warning);
}

.overview-metric.is-available strong { color: var(--brand); }
.overview-metric.is-running strong { color: var(--info); }
.overview-metric.is-cooling strong { color: var(--warning); }
.overview-metric.is-problem strong { color: #f18b8f; }

.token-pool-strip {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  margin: -1px 0 14px;
  border-block: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.008);
}

.pool-metric {
  min-width: 0;
  min-height: 48px;
  padding: 8px 10px;
  border-right: 1px solid var(--border);
}

.pool-metric:last-child {
  border-right: 0;
}

.pool-metric small,
.pool-metric strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pool-metric small {
  color: #6f796f;
  font-size: 9px;
  font-weight: 700;
}

.pool-metric strong {
  margin-top: 3px;
  color: #cdd5cc;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.pool-metric.is-warning strong { color: var(--warning); }
.pool-metric.is-error strong { color: #ef8b90; }

.token-pool-strip.is-stale {
  border-color: rgba(239, 180, 95, 0.42);
  opacity: 0.66;
}

.token-operations-details {
  margin: -1px 0 14px;
  border-block: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.01);
}

.token-operations-details.is-stale {
  border-color: rgba(239, 180, 95, 0.42);
}

.token-operations-details > summary {
  display: grid;
  grid-template-columns: minmax(180px, 0.6fr) minmax(260px, 1fr) 28px;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
}

.token-operations-details > summary::-webkit-details-marker {
  display: none;
}

.token-operations-details > summary:hover {
  background: rgba(104, 216, 174, 0.035);
}

.token-operations-details > summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.operations-summary-copy,
.operations-summary-status {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.operations-summary-copy strong {
  color: #c9d4cc;
  font-size: 11px;
}

.operations-summary-copy small,
.operations-summary-status small {
  overflow: hidden;
  color: #768078;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operations-summary-status {
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
}

.operations-summary-status strong {
  color: #9ea89f;
  font-size: 11px;
}

.operations-summary-status strong.is-good { color: var(--brand); }
.operations-summary-status strong.is-warning { color: var(--warning); }
.operations-summary-status strong.is-bad { color: #ef8b90; }

.operations-summary-chevron {
  color: #839087;
  font-size: 18px;
  line-height: 1;
  text-align: center;
  transform: rotate(-90deg);
  transition: transform 0.16s ease;
}

.token-operations-details[open] .operations-summary-chevron {
  transform: rotate(0deg);
}

.token-operations-body {
  border-top: 1px solid var(--border);
}

.token-operations-body .token-pool-strip {
  margin: 0;
  border-top: 0;
}

.token-operations-body .token-control-plane {
  margin-bottom: 0;
}

.recent-failure-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.012);
}

.recent-failure-panel.is-stale {
  opacity: 0.66;
}

.recent-failure-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.recent-failure-head > div {
  display: grid;
  gap: 2px;
}

.recent-failure-head small,
.recent-failure-metrics small,
.failure-scope-chip small {
  color: #758078;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
}

.recent-failure-head strong {
  color: #c9d4cc;
  font-size: 11px;
}

#tokenFailureSummaryState {
  color: #8f9991;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
}

#tokenFailureSummaryState.is-good { color: var(--brand); }
#tokenFailureSummaryState.is-warning { color: var(--warning); }
#tokenFailureSummaryState.is-bad { color: #ef8b90; }

.recent-failure-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: 1px solid var(--border);
}

.recent-failure-metrics > span {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border-right: 1px solid var(--border);
}

.recent-failure-metrics > span:last-child {
  border-right: 0;
}

.recent-failure-metrics strong,
.failure-scope-chip strong {
  color: #d5ddd7;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.recent-failure-scopes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.failure-scope-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  min-width: 66px;
  padding: 5px 7px;
  border: 1px solid rgba(239, 180, 95, 0.2);
  border-radius: 4px;
  background: rgba(239, 180, 95, 0.045);
}

.failure-scope-chip strong {
  color: var(--warning);
  font-size: 11px;
}

.failure-scope-chip.is-account,
.failure-scope-chip.is-request {
  border-color: rgba(239, 115, 120, 0.24);
  background: rgba(239, 115, 120, 0.05);
}

.failure-scope-chip.is-account strong,
.failure-scope-chip.is-request strong {
  color: #ef8b90;
}

.failure-scope-empty,
.recent-failure-latest {
  margin: 0;
  overflow: hidden;
  color: #7d8780;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-failure-latest {
  color: #a9b3ab;
}

.token-control-plane {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin: 0 0 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.012);
}

.control-plane-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  min-width: 0;
  min-height: 58px;
  padding: 9px 12px;
  border-right: 1px solid var(--border);
  align-content: center;
  column-gap: 8px;
}

.control-plane-item:last-child {
  border-right: 0;
}

.control-plane-item small,
.control-plane-item strong,
.control-plane-item > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-plane-item small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.control-plane-item strong {
  color: var(--text);
  font-size: 12px;
  text-align: right;
}

.control-plane-item > span {
  grid-column: 1 / -1;
  margin-top: 3px;
  color: #7f897f;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
}

.control-plane-item.is-good strong { color: var(--brand); }
.control-plane-item.is-warning strong { color: var(--warning); }
.control-plane-item.is-bad strong { color: #ef8b90; }
.control-plane-item.is-neutral strong { color: #aab1aa; }

.scheduler-gate-panel {
  margin: -1px 0 14px;
  padding: 12px;
  border-block: 1px solid var(--border);
  background: rgba(7, 15, 24, 0.42);
}

.scheduler-gate-head {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.scheduler-gate-head > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.scheduler-gate-head small {
  color: #7f96ad;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.scheduler-gate-head strong {
  color: var(--text);
  font-size: 13px;
}

.scheduler-gate-state {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: #aab1aa;
  font-size: 11px;
  font-weight: 800;
}

.scheduler-gate-state.is-good {
  border-color: rgba(77, 226, 196, 0.38);
  color: var(--brand);
}

.scheduler-gate-state.is-warning {
  border-color: rgba(244, 196, 94, 0.42);
  color: var(--warning);
}

.scheduler-gate-state.is-bad {
  border-color: rgba(239, 139, 144, 0.42);
  color: #ef8b90;
}

.scheduler-gate-checks {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.scheduler-gate-check {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 66px;
  align-content: center;
  gap: 3px;
  padding: 9px 10px 9px 15px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.scheduler-gate-check::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 6px;
  width: 2px;
  background: #7f897f;
  content: "";
}

.scheduler-gate-check.is-good::before { background: var(--brand); }
.scheduler-gate-check.is-bad::before { background: #ef8b90; }

.scheduler-gate-check small,
.scheduler-gate-check strong,
.scheduler-gate-check span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scheduler-gate-check small {
  color: #7f96ad;
  font-size: 9px;
  font-weight: 700;
}

.scheduler-gate-check strong {
  color: #dbe9f8;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}

.scheduler-gate-check.is-good strong { color: var(--brand); }
.scheduler-gate-check.is-bad strong { color: #ef8b90; }

.scheduler-gate-check span {
  color: #73869a;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
}

.scheduler-gate-failures {
  margin: 9px 0 0;
  color: #efb1b5;
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.scheduler-gate-panel.is-stale {
  opacity: 0.58;
}

.chat-classification-gate-panel {
  background: rgba(10, 19, 16, 0.46);
}

.chat-classification-gate-checks {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.token-overview-warnings {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  min-width: 0;
  margin: -1px 0 12px;
  border-block: 1px solid rgba(239, 180, 95, 0.36);
  background: rgba(239, 180, 95, 0.045);
}

.token-overview-warnings[hidden] {
  display: none;
}

.token-overview-warnings.is-stale {
  border-color: rgba(239, 139, 144, 0.42);
  background: rgba(239, 139, 144, 0.045);
}

.overview-warning-head {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid rgba(239, 180, 95, 0.22);
}

.overview-warning-head strong {
  color: var(--warning);
  font-size: 11px;
}

.token-overview-warnings.is-stale .overview-warning-head strong {
  color: #ef8b90;
}

.overview-warning-head span {
  margin-top: 2px;
  color: #7f897f;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
}

.overview-warning-items {
  display: grid;
  min-width: 0;
}

.overview-warning-item {
  display: grid;
  grid-template-columns: 112px minmax(150px, 0.55fr) minmax(220px, 1fr);
  align-items: center;
  min-width: 0;
  min-height: 34px;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(239, 180, 95, 0.12);
  gap: 10px;
}

.overview-warning-item:last-child {
  border-bottom: 0;
}

.overview-warning-item strong,
.overview-warning-item code,
.overview-warning-item > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-warning-item strong {
  color: #d7c49f;
  font-size: 10px;
}

.overview-warning-item code {
  color: #a89778;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
}

.overview-warning-item > span {
  color: #9da49d;
  font-size: 10px;
}

.overview-warning-repeat {
  margin-left: 5px;
  color: var(--warning);
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
}

.token-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 120px 142px 116px 126px 162px max-content;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.token-search-input {
  min-width: 0;
  height: 38px;
}

.token-toolbar .input-select {
  min-width: 0;
  width: 100%;
  height: 38px;
}

.token-overview-state {
  min-width: 128px;
  color: #7f897f;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  text-align: right;
  white-space: nowrap;
}

.token-overview-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 8px;
}

.token-overview-status button {
  min-height: 30px;
}

.attention-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 84px;
  padding: 5px 8px;
  border: 1px solid rgba(239, 180, 95, 0.24);
  border-radius: 4px;
  background: rgba(239, 180, 95, 0.045);
  color: #b9a77f;
  font-size: 10px;
}

.attention-filter-btn strong {
  min-width: 16px;
  color: var(--warning);
  font-family: "IBM Plex Mono", monospace;
  text-align: right;
}

.attention-filter-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.attention-filter-btn.is-active {
  border-color: rgba(239, 180, 95, 0.6);
  background: rgba(239, 180, 95, 0.14);
  color: #f0bd72;
}

.token-overview-state.is-degraded {
  color: var(--warning);
}

.token-overview-strip.is-stale,
.token-control-plane.is-stale {
  border-color: rgba(239, 180, 95, 0.52);
  background: rgba(239, 180, 95, 0.035);
}

#tokenTable[data-stale="true"] {
  border-color: rgba(239, 180, 95, 0.36);
}

.token-table-wrapper {
  border-radius: 8px;
  background: #141715;
}

#tokenTable th {
  background: #171b18;
  color: #8f9990;
  letter-spacing: 0;
}

#tokenTable td {
  padding: 12px 10px;
}

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

.account-avatar {
  color: #0b1510;
  background: #78cfae;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.26);
}

.account-name {
  color: #eef3ec;
  font-size: 13px;
}

.account-email {
  color: #8f9990;
}

.account-identity-warning {
  margin-top: 6px;
  color: var(--warning);
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.authority-summary {
  display: grid;
  grid-template-columns: 7px minmax(0, max-content) minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-top: 7px;
  color: #aeb7ae;
  font-size: 9px;
  line-height: 1.35;
}

.authority-summary strong,
.authority-summary span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.authority-summary strong {
  color: #c8d1c8;
  font-size: 10px;
}

.authority-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.authority-summary.is-active { color: #78cfae; }
.authority-summary.is-updating,
.authority-summary.is-staged,
.authority-summary.is-promoting { color: #8dcee5; }
.authority-summary.is-retiring,
.authority-summary.is-disabled,
.authority-summary.is-legacy { color: var(--warning); }
.authority-summary.is-retired { color: #8f9990; }
.authority-summary.is-identity_conflict { color: #ef8b90; }

.authority-verification {
  display: grid;
  grid-template-columns: 7px minmax(0, max-content) minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-top: 4px;
  color: #8dcee5;
  font-size: 9px;
  line-height: 1.35;
}

.authority-verification strong,
.authority-verification span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.authority-verification strong {
  color: currentColor;
  font-size: 10px;
}

.authority-verification-dot {
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.authority-verification.is-running .authority-verification-dot {
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(141, 206, 229, 0.12);
}

.authority-verification.is-warning { color: var(--warning); }
.authority-verification.is-verified { color: #78cfae; }
.authority-verification.is-error { color: #ef8b90; }

.automation-inline-status {
  display: grid;
  grid-template-columns: 7px max-content minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-top: 5px;
  color: var(--warning);
  font-size: 9px;
}

.automation-inline-status strong,
.automation-inline-status span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-inline-dot {
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: currentColor;
}

.automation-inline-status.is-good { color: #78cfae; }
.automation-inline-status.is-running { color: #8dcee5; }
.automation-inline-status.is-bad { color: #ef8b90; }
.automation-inline-status.is-neutral { color: #8f9990; }

.account-facts {
  display: flex;
  min-width: 0;
  gap: 5px;
  margin-top: 8px;
}

.account-facts span {
  min-width: 0;
  max-width: 50%;
  overflow: hidden;
  padding: 2px 5px;
  border: 1px solid rgba(227, 235, 226, 0.11);
  border-radius: 4px;
  color: #8f9990;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-facts span.is-warning,
.account-proxy-line.is-mixed span {
  color: var(--warning);
}

.account-proxy-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.account-proxy-line span {
  overflow: hidden;
  color: #aeb7ae;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-proxy-line button,
.rpm-save-btn {
  min-height: 24px;
  padding: 3px 6px;
  border: 1px solid rgba(104, 216, 174, 0.28);
  border-radius: 4px;
  background: rgba(104, 216, 174, 0.08);
  color: #9fe6ca;
  font-size: 10px;
}

.account-proxy-line button:disabled,
.token-actions-cell button:disabled {
  border-color: rgba(169, 178, 168, 0.12);
  background: rgba(169, 178, 168, 0.04);
  color: #6f786f;
  cursor: not-allowed;
  opacity: 0.75;
}

.availability-cell,
.activity-cell,
.health-cell,
.quota-cell {
  color: #b7c0b7;
  font-size: 11px;
  line-height: 1.35;
}

.account-state-stack {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.account-state-row {
  display: grid;
  grid-template-columns: 46px max-content minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.account-state-row > small {
  color: #6f786f;
  font-size: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.account-mode-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 3px;
}

.account-mode-state {
  display: grid;
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid rgba(142, 153, 144, 0.18);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.018);
}

.account-mode-state small,
.account-mode-state strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-mode-state small {
  color: #7f897f;
  font-size: 8px;
  font-weight: 700;
}

.account-mode-state strong {
  margin-top: 2px;
  color: #aeb7ae;
  font-size: 10px;
}

.account-mode-state.is-on {
  border-color: rgba(104, 216, 174, 0.24);
}

.account-mode-state.is-on strong { color: var(--brand); }
.account-mode-state.is-off strong { color: var(--warning); }
.account-mode-state.is-error strong { color: #ef8b90; }
.account-mode-state.is-unknown strong { color: #8f9990; }

.account-operation-summary {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.account-summary-availability {
  min-width: 0;
}

.account-summary-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.account-summary-heading strong {
  color: #a8ddc8;
  font-size: 9px;
}

.account-summary-heading span {
  overflow: hidden;
  color: #6f786f;
  font-family: "IBM Plex Mono", monospace;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-policy-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.account-policy-state {
  display: grid;
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid rgba(142, 153, 144, 0.16);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.014);
}

.account-policy-state small,
.account-policy-state strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-policy-state small {
  color: #7f897f;
  font-size: 8px;
  font-weight: 700;
}

.account-policy-state strong {
  margin-top: 2px;
  color: #aeb7ae;
  font-size: 10px;
}

.account-policy-state.is-on strong { color: var(--brand); }
.account-policy-state.is-off strong { color: var(--warning); }
.account-policy-state.is-error strong { color: #ef8b90; }
.account-policy-state.is-unknown strong { color: #8f9990; }

.account-rpm-summary {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-top: 7px;
  border-top: 1px solid rgba(142, 153, 144, 0.14);
}

.account-rpm-summary > span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.account-rpm-summary small {
  color: #7f897f;
  font-size: 8px;
  font-weight: 700;
}

.account-rpm-summary strong {
  color: #d8c98e;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}

.account-rpm-summary em {
  min-width: 0;
  overflow: hidden;
  color: #768078;
  font-family: "IBM Plex Mono", monospace;
  font-size: 8px;
  font-style: normal;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-rpm-summary.is-error strong,
.account-rpm-summary.is-error em {
  color: #ef8b90;
}

.account-rpm-summary.is-warning strong,
.account-rpm-summary.is-warning em {
  color: var(--warning);
}

.account-operation-heading {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.account-operation-heading strong,
.account-operation-heading span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-operation-heading strong {
  color: #c8d1c8;
  font-size: 9px;
  letter-spacing: 0;
}

.account-operation-heading span {
  color: #6f786f;
  font-family: "IBM Plex Mono", monospace;
  font-size: 8px;
  text-align: right;
}

.account-control-panel.is-serving .account-operation-heading strong {
  color: #a8ddc8;
}

.account-control-panel.is-refresh .account-operation-heading strong {
  color: #9fc9dc;
}

.account-control-panel.is-rpm .account-operation-heading strong {
  color: #d8c98e;
}

.availability-badge,
.lifecycle-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  gap: 6px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.availability-dot,
.lifecycle-dot,
.refresh-health-dot,
.activity-idle-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.availability-badge.is-available {
  border-color: rgba(104, 216, 174, 0.3);
  background: rgba(104, 216, 174, 0.1);
  color: #85dfbc;
}

.availability-badge.is-cooldown {
  border-color: rgba(239, 180, 95, 0.3);
  background: rgba(239, 180, 95, 0.1);
  color: #f0bd72;
}

.availability-badge.is-unavailable {
  border-color: rgba(116, 186, 212, 0.38);
  border-style: dashed;
  background: rgba(116, 186, 212, 0.09);
  color: #8dcee5;
}

.lifecycle-badge.is-lifecycle-active {
  border-color: rgba(104, 216, 174, 0.3);
  background: rgba(104, 216, 174, 0.08);
  color: #85dfbc;
}

.lifecycle-badge.is-lifecycle-updating,
.lifecycle-badge.is-lifecycle-staged,
.lifecycle-badge.is-lifecycle-promoting {
  border-color: rgba(116, 186, 212, 0.38);
  background: rgba(116, 186, 212, 0.1);
  color: #8dcee5;
}

.lifecycle-badge.is-lifecycle-retiring,
.lifecycle-badge.is-lifecycle-legacy,
.lifecycle-badge.is-lifecycle-disabled {
  border-color: rgba(239, 180, 95, 0.38);
  background: rgba(239, 180, 95, 0.1);
  color: #f0bd72;
}

.lifecycle-badge.is-lifecycle-retired {
  border-color: rgba(169, 178, 168, 0.22);
  background: rgba(169, 178, 168, 0.07);
  color: #9ca59c;
}

.lifecycle-badge.is-lifecycle-identity-conflict,
.lifecycle-badge.is-lifecycle-unknown {
  border-color: rgba(239, 115, 120, 0.4);
  background: rgba(239, 115, 120, 0.11);
  color: #f49397;
}

#tokenTable .token-main-row.is-unavailable td:first-child {
  box-shadow: inset 3px 0 0 rgba(116, 186, 212, 0.72);
}

#tokenTable .token-main-row.is-lifecycle-updating td:first-child,
#tokenTable .token-main-row.is-lifecycle-staged td:first-child,
#tokenTable .token-main-row.is-lifecycle-promoting td:first-child {
  box-shadow: inset 3px 0 0 rgba(116, 186, 212, 0.72);
}

#tokenTable .token-main-row.is-lifecycle-retiring td:first-child {
  box-shadow: inset 3px 0 0 rgba(239, 180, 95, 0.8);
}

#tokenTable .token-main-row.is-lifecycle-retired td:first-child {
  box-shadow: inset 3px 0 0 rgba(169, 178, 168, 0.55);
}

#tokenTable .token-main-row.is-lifecycle-identity-conflict td:first-child {
  box-shadow: inset 3px 0 0 rgba(239, 115, 120, 0.88);
}

.availability-badge.is-invalid,
.availability-badge.is-exhausted {
  border-color: rgba(239, 115, 120, 0.3);
  background: rgba(239, 115, 120, 0.1);
  color: #f49397;
}

.availability-badge.is-disabled {
  border-color: rgba(169, 178, 168, 0.2);
  background: rgba(169, 178, 168, 0.07);
  color: #9ca59c;
}

.account-state-reason {
  min-width: 0;
  overflow: hidden;
  color: #aeb7ae;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lifecycle-reason {
  color: #8f9990;
}

.token-subline {
  display: block;
  min-width: 0;
  margin-top: 4px;
  overflow: hidden;
  color: #7f897f;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-subline.is-error,
.rpm-usage.is-error,
.token-detail-loading.is-error {
  color: #ef8b90;
}

.token-subline.is-warning {
  color: var(--warning);
}

.token-subline.is-wrap {
  overflow: visible;
  line-height: 1.4;
  text-overflow: clip;
  white-space: normal;
}

.availability-member-summary {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
}

.refresh-control-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
}

.refresh-control-row .switch-btn {
  width: 34px;
  height: 20px;
  flex: 0 0 auto;
}

.refresh-control-row .switch-knob {
  width: 14px;
  height: 14px;
}

.refresh-control-row .switch-btn.on .switch-knob {
  transform: translateX(14px);
}

.refresh-control-row .switch-btn.mixed {
  border-color: rgba(239, 180, 95, 0.35);
  background: rgba(239, 180, 95, 0.12);
}

.refresh-control-row .switch-btn.mixed .switch-knob {
  transform: translateX(7px);
  background: var(--warning);
}

.refresh-scope-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid rgba(239, 180, 95, 0.25);
  border-radius: 4px;
  color: var(--warning);
  font-size: 9px;
  white-space: nowrap;
}

.refresh-health {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #8f9990;
  font-size: 10px;
  white-space: nowrap;
}

.refresh-health.is-healthy { color: #85dfbc; }
.refresh-health.is-degraded,
.refresh-health.is-missing { color: #ef8b90; }
.refresh-health.is-mixed { color: var(--warning); }
.refresh-health.is-pending { color: var(--info); }
.refresh-health.is-disabled { color: #8f9990; }
.refresh-health-dot.is-manual { color: #777f78; }

.rpm-editor {
  display: grid;
  grid-template-columns: 50px 70px 52px;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
}

.rpm-editor label {
  color: #7f897f;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  white-space: nowrap;
}

.rpm-save-btn {
  width: 52px;
}

.rpm-save-btn.is-saving {
  border-color: rgba(116, 186, 212, 0.4);
  background: rgba(116, 186, 212, 0.1);
  color: #9ad7eb;
}

.rpm-editor.is-unverified {
  padding: 5px;
  border: 1px dashed rgba(239, 180, 95, 0.28);
  border-radius: 4px;
  background: rgba(239, 180, 95, 0.04);
}

.rpm-editor.is-unavailable {
  opacity: 0.78;
}

.token-rpm-input {
  width: 70px;
  height: 26px;
  border: 1px solid rgba(227, 235, 226, 0.15);
  border-radius: 4px;
  background: #101311;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  text-align: right;
}

.token-rpm-input:focus {
  outline: 1px solid rgba(104, 216, 174, 0.65);
  border-color: rgba(104, 216, 174, 0.65);
}

.token-rpm-input.is-unverified,
.token-rpm-input.is-unverified:focus {
  border-color: rgba(239, 180, 95, 0.42);
  outline-color: rgba(239, 180, 95, 0.42);
}

.token-rpm-input:disabled,
.rpm-save-btn:disabled {
  border-color: rgba(169, 178, 168, 0.12);
  background: rgba(169, 178, 168, 0.04);
  color: #6f786f;
  cursor: not-allowed;
  opacity: 0.78;
}

.rpm-identity-warning {
  display: block;
  margin-top: 5px;
  color: var(--warning);
  font-size: 9px;
  line-height: 1.35;
}

.rpm-scope-note {
  display: block;
  margin-top: 5px;
  color: #8f9990;
  font-size: 9px;
  line-height: 1.35;
}

.rpm-usage {
  display: block;
  margin-top: 4px;
  color: #7f897f;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
}

.rpm-usage.is-unverified {
  color: #a8906d;
}

.rpm-conflict {
  display: grid;
  gap: 5px;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid rgba(239, 180, 95, 0.3);
  border-radius: 4px;
  background: rgba(239, 180, 95, 0.05);
  color: var(--warning);
  font-size: 9px;
  line-height: 1.4;
}

.rpm-conflict-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.rpm-conflict-actions button {
  min-height: 24px;
  padding: 3px 6px;
  font-size: 9px;
}

.config-conflict-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: 8px;
}

.config-conflict-actions button {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 10px;
}

.config-conflict-values {
  display: grid;
  gap: 3px;
  margin-top: 6px;
  color: #f0d4aa;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  line-height: 1.45;
}

.config-conflict-values span,
.config-conflict-values strong {
  overflow-wrap: anywhere;
}

.activity-idle,
.activity-running {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.activity-latest-model {
  display: block;
  margin-top: 6px;
  color: #dce3dc;
  font-size: 10px;
  line-height: 1.35;
}

.activity-idle {
  color: #7f897f;
}

.activity-running {
  color: #7cc4df;
  font-weight: 800;
}

.activity-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #74bad4;
  box-shadow: 0 0 0 0 rgba(116, 186, 212, 0.45);
  animation: activityPulse 1.6s ease-out infinite;
}

@keyframes activityPulse {
  70% { box-shadow: 0 0 0 6px rgba(116, 186, 212, 0); }
  100% { box-shadow: 0 0 0 0 rgba(116, 186, 212, 0); }
}

.activity-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.activity-head strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: #dce3dc;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-progress {
  width: 100%;
  height: 4px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(116, 186, 212, 0.14);
}

.activity-progress span {
  display: block;
  height: 100%;
  background: #74bad4;
  transition: width 0.2s ease;
}

.activity-progress.is-unknown {
  border: 1px dashed rgba(116, 186, 212, 0.34);
  background: rgba(116, 186, 212, 0.045);
}

.activity-meta,
.health-head,
.quota-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.activity-meta {
  margin-top: 4px;
  color: #7f897f;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
}

.health-head strong,
.quota-line strong {
  color: #e2e8e1;
  font-family: "IBM Plex Mono", monospace;
}

.health-rate {
  font-size: 18px;
}

.health-rate.is-low {
  color: var(--warning);
}

.health-head span,
.quota-line span {
  color: #7f897f;
  font-size: 10px;
}

.health-error-link {
  display: block;
  max-width: 100%;
  margin-top: 5px;
  overflow: hidden;
  border: 0;
  border-bottom: 1px dotted rgba(239, 115, 120, 0.5);
  border-radius: 0;
  padding: 0 0 1px;
  background: transparent;
  color: #ef8b90;
  font-size: 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-error-link:hover {
  background: transparent;
  color: #ff9ba0;
}

.quota-line + .token-subline {
  margin-top: 3px;
}

.token-expiry {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(227, 235, 226, 0.09);
}

.token-expiry.is-warning strong { color: var(--warning); }
.token-expiry.is-error strong { color: #ef8b90; }
.quota-line.is-warning strong { color: var(--warning); }
.quota-line.is-error strong { color: #ef8b90; }
.unknown-state { color: #8f9990; }

.token-actions-cell .action-btns {
  grid-template-columns: repeat(2, 48px);
  max-width: 102px;
}

.token-actions-cell .action-btns.is-grouped {
  grid-template-columns: 32px repeat(2, minmax(0, 1fr));
  align-items: center;
  max-width: 138px;
}

.group-action-label {
  color: #aeb7ae;
  font-size: 10px;
  line-height: 1.25;
}

.token-actions-cell .action-mini,
.token-actions-cell .icon-action {
  min-width: 0;
  min-height: 28px;
}

.token-select-hitbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(227, 235, 226, 0.14);
  border-radius: 4px;
  padding: 0;
  background: rgba(255, 255, 255, 0.045);
  color: #b9c2b9;
}

.icon-action:hover {
  background: rgba(255, 255, 255, 0.09);
}

.expand-action span {
  display: block;
  font-size: 17px;
  line-height: 1;
  transform: rotate(-90deg);
  transition: transform 0.16s ease;
}

.expand-action.is-open span {
  transform: rotate(0deg);
}

.token-detail-row,
.token-detail-row:hover {
  background: #111412 !important;
}

.token-detail-row td {
  padding: 0 !important;
  border-bottom: 1px solid rgba(104, 216, 174, 0.2);
}

.token-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 0;
}

.token-detail-grid section {
  min-width: 0;
  padding: 14px 16px;
}

.token-detail-grid section + section {
  border-left: 1px solid var(--border);
}

.token-detail-grid .account-control-detail-section,
.token-detail-grid .token-inventory-section,
.token-detail-grid .automation-progress-section {
  grid-column: 1 / -1;
  border-bottom: 1px solid var(--border);
}

.token-detail-grid .account-control-detail-section + section,
.token-detail-grid .token-inventory-section + section,
.token-detail-grid .automation-progress-section + section {
  border-left: 0;
}

.automation-progress-section {
  background: rgba(255, 255, 255, 0.012);
}

.automation-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.automation-progress-head > strong {
  color: #b9c2b9;
  font-size: 10px;
  text-align: right;
}

.automation-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--warning);
  font-size: 10px;
  font-weight: 800;
}

.automation-state > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.automation-state.is-good { color: #78cfae; }
.automation-state.is-running { color: #8dcee5; }
.automation-state.is-bad { color: #ef8b90; }
.automation-state.is-neutral { color: #8f9990; }

.automation-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-width: 0;
}

.automation-step {
  position: relative;
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 5px;
  color: #6f786f;
  font-size: 9px;
  text-align: center;
}

.automation-step::before,
.automation-step::after {
  position: absolute;
  top: 4px;
  width: 50%;
  height: 1px;
  background: rgba(169, 178, 168, 0.16);
  content: "";
}

.automation-step::before { left: 0; }
.automation-step::after { right: 0; }
.automation-step:first-child::before,
.automation-step:last-child::after { display: none; }

.automation-step i {
  z-index: 1;
  width: 9px;
  height: 9px;
  border: 2px solid #6f786f;
  border-radius: 50%;
  background: #151915;
}

.automation-step.is-complete { color: #78cfae; }
.automation-step.is-complete i {
  border-color: #78cfae;
  background: #78cfae;
}
.automation-step.is-complete::before,
.automation-step.is-complete::after { background: rgba(120, 207, 174, 0.42); }
.automation-step.is-current { color: var(--warning); }
.automation-step.is-current i { border-color: currentColor; box-shadow: 0 0 0 3px rgba(239, 180, 95, 0.1); }
.automation-step.is-current.is-running { color: #8dcee5; }
.automation-step.is-current.is-good { color: #78cfae; }
.automation-step.is-current.is-bad { color: #ef8b90; }

.automation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}

.automation-meta span,
.automation-operation {
  padding: 2px 5px;
  border: 1px solid rgba(227, 235, 226, 0.1);
  border-radius: 4px;
  color: #7f897f;
  font-size: 9px;
}

.automation-operation {
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-diagnostic {
  margin-top: 7px;
  color: #9ca59c;
  font-size: 9px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.automation-diagnostic.is-warning { color: #c3a36d; }
.automation-diagnostic.is-bad { color: #c98d91; }

.account-control-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 -16px -14px;
  border-top: 1px solid rgba(227, 235, 226, 0.08);
}

.account-control-panel {
  min-width: 0;
  padding: 13px 16px 15px;
}

.account-control-panel + .account-control-panel {
  border-left: 1px solid var(--border);
}

.token-detail-grid h3 {
  margin: 0 0 9px;
  color: #98a298;
  font-size: 10px;
  text-transform: uppercase;
}

.token-inventory-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 6px;
}

.token-member-list {
  display: block;
}

.credential-projection-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
  margin-bottom: 10px;
  border: 1px solid rgba(227, 235, 226, 0.1);
  background: rgba(255, 255, 255, 0.012);
}

.credential-projection-item {
  display: grid;
  min-width: 0;
  min-height: 62px;
  align-content: center;
  gap: 3px;
  padding: 8px 10px;
  border-left: 2px solid #6f786f;
}

.credential-projection-item + .credential-projection-item {
  border-top: 0;
}

.credential-projection-item small,
.credential-projection-item strong,
.credential-projection-item em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credential-projection-item small {
  color: #7f897f;
  font-size: 8px;
  font-weight: 800;
}

.credential-projection-item strong {
  color: #d7dfd6;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
}

.credential-projection-item em {
  color: #7f897f;
  font-size: 9px;
  font-style: normal;
}

.credential-projection-item.is-good { border-left-color: #78cfae; }
.credential-projection-item.is-warning { border-left-color: var(--warning); }
.credential-projection-item.is-bad { border-left-color: #ef8b90; }
.credential-projection-item.is-neutral { border-left-color: #6f786f; }

.token-member-row {
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(420px, 1.55fr) minmax(230px, 0.75fr);
  align-items: start;
  gap: 16px;
  min-width: 0;
  padding: 12px 0;
  border-top: 1px solid rgba(227, 235, 226, 0.09);
}

.token-member-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.token-member-row:last-child {
  padding-bottom: 0;
}

.token-member-identity,
.token-member-facts,
.token-member-actions {
  min-width: 0;
}

.token-member-heading {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: 7px;
}

.token-member-heading strong {
  min-width: 0;
  overflow: hidden;
  color: #d7dfd6;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-member-role,
.token-member-source,
.token-member-id {
  color: #7f897f;
  font-size: 9px;
}

.token-member-role {
  padding: 2px 5px;
  border: 1px solid rgba(169, 178, 168, 0.18);
  border-radius: 4px;
  white-space: nowrap;
}

.token-member-role.is-current {
  border-color: rgba(104, 216, 174, 0.3);
  color: #85dfbc;
}

.token-member-role.is-pending-legacy,
.token-member-role.is-legacy {
  border-color: rgba(239, 180, 95, 0.3);
  color: var(--warning);
}

.token-member-role.is-migration-residue,
.token-member-role.is-unclassified-residue,
.token-member-role.is-current-conflict {
  border-color: rgba(239, 115, 120, 0.32);
  color: #ef8b90;
}

.token-member-id,
.token-member-source {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.token-member-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin: 0;
}

.token-member-facts > div {
  min-width: 0;
}

.token-member-facts dt {
  margin-bottom: 2px;
  color: #6f796f;
  font-size: 9px;
  font-weight: 700;
}

.token-member-facts dd {
  min-width: 0;
  margin: 0;
  overflow: visible;
  color: #b9c2b9;
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.token-member-facts dd.is-available { color: #85dfbc; }
.token-member-facts dd.is-cooldown,
.token-member-facts dd.is-warning { color: var(--warning); }
.token-member-facts dd.is-invalid,
.token-member-facts dd.is-exhausted,
.token-member-facts dd.is-error { color: #ef8b90; }

.token-member-detail {
  display: block;
  margin-top: 2px;
  color: #7f897f;
  font-size: 9px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.token-member-detail.is-error {
  color: #ef8b90;
}

.token-member-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.token-member-actions .action-mini {
  min-width: 0;
  min-height: 32px;
  padding-inline: 7px;
  line-height: 1.2;
  white-space: normal;
}

.token-member-actions.is-diagnostic {
  display: flex;
  min-height: 100%;
  align-items: center;
  padding: 10px;
  border-left: 2px solid rgba(239, 115, 120, 0.42);
  background: rgba(239, 115, 120, 0.045);
}

.token-member-action-note {
  color: #b58f91;
  font-size: 9px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.token-inventory-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(227, 235, 226, 0.08);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
  color: #7f897f;
  font-size: 9px;
}

.token-inventory-row strong {
  min-width: 0;
  overflow: hidden;
  color: #cbd4ca;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-inventory-status {
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(169, 178, 168, 0.08);
  color: #9ca59c;
}

.token-inventory-status.is-active { color: #85dfbc; }
.token-inventory-status.is-error { color: var(--warning); }
.token-inventory-status.is-invalid,
.token-inventory-status.is-exhausted { color: #f49397; }

.detail-task-row {
  display: grid;
  grid-template-columns: 62px minmax(100px, 1fr) max-content max-content minmax(80px, 0.8fr);
  align-items: center;
  gap: 10px;
  min-height: 30px;
  border-top: 1px solid rgba(227, 235, 226, 0.07);
  color: #8f9990;
  font-size: 10px;
}

.detail-task-row strong,
.detail-task-row .mono {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-task-row strong {
  color: #dce3dc;
}

.detail-task-state {
  justify-self: start;
  padding: 2px 5px;
  border-radius: 3px;
  font-family: "IBM Plex Mono", monospace;
}

.detail-task-state.is-running {
  background: rgba(116, 186, 212, 0.1);
  color: #7cc4df;
}

.detail-task-state.is-success {
  background: rgba(104, 216, 174, 0.1);
  color: #85dfbc;
}

.detail-task-state.is-failed {
  background: rgba(239, 115, 120, 0.1);
  color: #ef8b90;
}

.token-detail-empty,
.token-detail-loading {
  padding: 8px 0;
  color: #7f897f;
  font-size: 11px;
}

.empty-state.is-error {
  color: #ef8b90;
}

@media (max-width: 1100px) {
  .token-overview-strip {
    grid-template-columns: repeat(4, minmax(110px, 1fr));
  }

  .overview-metric:nth-child(4) {
    border-right: 0;
  }

  .overview-metric:nth-child(n + 5) {
    border-top: 1px solid var(--border);
  }

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

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

  .recent-failure-head {
    align-items: start;
  }

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

  .recent-failure-metrics > span:nth-child(2) {
    border-right: 0;
  }

  .recent-failure-metrics > span:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }

  .failure-scope-chip {
    flex: 1 1 calc(25% - 6px);
    min-width: 68px;
    justify-content: space-between;
  }

  .recent-failure-latest {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .pool-metric:nth-child(3n) {
    border-right: 0;
  }

  .pool-metric:nth-child(n + 4) {
    border-top: 1px solid var(--border);
  }

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

  .control-plane-item:nth-child(even) {
    border-right: 0;
  }

  .control-plane-item:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }

  .token-toolbar {
    grid-template-columns: minmax(200px, 1fr) repeat(5, minmax(116px, 0.45fr));
  }

  .token-overview-state {
    text-align: left;
  }

  .token-overview-status {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .scheduler-gate-head {
    align-items: flex-start;
  }

  .scheduler-gate-checks {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .automation-progress-head {
    display: grid;
  }

  .automation-progress-head > strong {
    text-align: left;
  }

  .automation-steps {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .automation-step {
    grid-template-columns: 14px minmax(0, 1fr);
    justify-items: start;
    text-align: left;
  }

  .automation-step::before,
  .automation-step::after {
    display: none;
  }

  .credential-projection-strip {
    grid-template-columns: 1fr;
  }

  .credential-projection-item + .credential-projection-item {
    border-top: 1px solid rgba(227, 235, 226, 0.08);
  }

  .shell {
    margin-top: 12px;
    padding-inline: 12px;
  }

  .token-list-card {
    padding: 14px;
  }

  .tabs .tab-btn,
  .config-cat-btn,
  .quick-actions-card .actions button,
  .token-list-actions .actions button {
    min-height: 44px;
  }

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

  .quick-actions-card .actions button {
    min-width: 0;
    width: 100%;
  }

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

  .overview-metric,
  .overview-metric:nth-child(4) {
    border-right: 1px solid var(--border);
    border-top: 1px solid var(--border);
  }

  .overview-metric:nth-child(-n + 2) {
    border-top: 0;
  }

  .overview-metric:nth-child(even) {
    border-right: 0;
  }

  .global-rpm-metric {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .token-operations-details > summary {
    grid-template-columns: minmax(0, 1fr) 28px;
  }

  .operations-summary-status {
    grid-column: 1;
    grid-template-columns: max-content minmax(0, 1fr);
  }

  .operations-summary-chevron {
    grid-row: 1 / span 2;
    grid-column: 2;
  }

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

  .pool-metric:nth-child(3n) {
    border-right: 1px solid var(--border);
  }

  .pool-metric:nth-child(even) {
    border-right: 0;
  }

  .pool-metric:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }

  .pool-metric:last-child {
    grid-column: 1 / -1;
    border-right: 0;
  }

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

  .token-search-input,
  .token-overview-status {
    grid-column: 1 / -1;
  }

  .token-overview-warnings {
    grid-template-columns: minmax(0, 1fr);
  }

  .overview-warning-head {
    flex-direction: row;
    justify-content: space-between;
    border-right: 0;
    border-bottom: 1px solid rgba(239, 180, 95, 0.18);
  }

  .overview-warning-head span {
    margin-top: 0;
  }

  .overview-warning-item {
    grid-template-columns: minmax(94px, 0.45fr) minmax(0, 1fr);
  }

  .overview-warning-item > span {
    grid-column: 1 / -1;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .token-search-input,
  .token-toolbar .input-select {
    height: 44px;
  }

  .token-overview-status {
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap;
  }

  .token-toolbar .input-select {
    min-width: 0;
  }

  .token-list-actions .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .token-list-actions .actions button {
    min-width: 0;
    width: 100%;
    padding-inline: 8px;
  }

  .token-list-actions #refreshBtn {
    grid-column: 1 / -1;
  }

  .token-table-wrapper {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  #tokenTable,
  #tokenTable tbody {
    display: block;
    min-width: 0;
    width: 100%;
  }

  #tokenTable thead {
    display: none;
  }

  #tokenTable .token-main-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    width: 100%;
    margin-bottom: 10px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: #171b18;
  }

  #tokenTable .token-main-row.is-lifecycle-updating,
  #tokenTable .token-main-row.is-lifecycle-staged,
  #tokenTable .token-main-row.is-lifecycle-promoting {
    border-left-color: rgba(116, 186, 212, 0.72);
  }

  #tokenTable .token-main-row.is-lifecycle-retiring {
    border-left-color: rgba(239, 180, 95, 0.8);
  }

  #tokenTable .token-main-row.is-lifecycle-retired {
    border-left-color: rgba(169, 178, 168, 0.55);
  }

  #tokenTable .token-main-row.is-lifecycle-identity-conflict {
    border-left-color: rgba(239, 115, 120, 0.88);
  }

  #tokenTable .token-main-row td {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
  }

  #tokenTable .token-main-row td > * {
    grid-column: 2;
    min-width: 0;
  }

  #tokenTable .token-main-row td::before {
    content: attr(data-label);
    align-self: start;
    color: #7f897f;
    font-size: 11px;
    font-weight: 800;
  }

  #tokenTable .token-main-row .select-cell {
    display: flex;
    grid-column: 1;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-right: 1px solid var(--border);
  }

  .token-select-hitbox {
    width: 44px;
    height: 44px;
  }

  .token-select-hitbox input[type="checkbox"] {
    width: 22px;
    height: 22px;
  }

  #tokenTable .token-main-row .select-cell::before,
  #tokenTable .token-main-row .account-cell::before {
    content: none;
  }

  #tokenTable .token-main-row .account-cell {
    display: block;
    grid-column: 2;
    min-width: 0;
    padding: 12px;
  }

  #tokenTable .token-main-row .token-actions-cell {
    border-bottom: 0;
  }

  .token-actions-cell .action-btns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: none;
  }

  .token-actions-cell .action-btns.is-grouped {
    grid-template-columns: 44px repeat(2, minmax(0, 1fr));
  }

  .token-actions-cell .action-mini,
  .token-actions-cell .icon-action,
  .token-member-actions .action-mini,
  .account-proxy-line button,
  .rpm-save-btn,
  .health-error-link,
  .token-overview-status button {
    min-height: 44px;
  }

  .account-proxy-line {
    grid-template-columns: minmax(0, 1fr) 52px;
  }

  .account-name,
  .availability-cell,
  .activity-cell,
  .health-cell,
  .quota-cell,
  .availability-badge,
  .refresh-health,
  .health-error-link,
  .account-proxy-line button,
  .rpm-save-btn,
  .token-actions-cell .action-mini,
  .token-member-actions .action-mini {
    font-size: 12px;
  }

  .account-email,
  .authority-summary,
  .account-facts span,
  .account-proxy-line span,
  .account-summary-heading span,
  .account-rpm-summary em,
  .token-subline,
  .refresh-scope-label,
  .rpm-editor label,
  .token-rpm-input,
  .rpm-identity-warning,
  .rpm-usage,
  .activity-head strong,
  .activity-meta,
  .health-head span,
  .quota-line span,
  .group-action-label,
  .token-detail-grid h3,
  .token-member-role,
  .token-member-source,
  .token-member-id,
  .token-member-facts dt,
  .token-member-detail,
  .detail-task-row {
    font-size: 11px;
  }

  .token-member-heading strong,
  .token-member-facts dd {
    font-size: 12px;
  }

  .token-rpm-input {
    height: 44px;
  }

  .refresh-control-row .switch-btn {
    width: 52px;
    height: 44px;
    padding: 4px;
  }

  .refresh-control-row .switch-knob {
    width: 20px;
    height: 20px;
  }

  .refresh-control-row .switch-btn.on .switch-knob {
    transform: translateX(22px);
  }

  .refresh-control-row .switch-btn.mixed .switch-knob {
    transform: translateX(11px);
  }

  .rpm-editor {
    grid-template-columns: minmax(0, 1fr) 52px;
    width: 100%;
  }

  .account-control-detail-grid {
    grid-template-columns: 1fr;
  }

  .account-control-panel + .account-control-panel {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .rpm-editor label {
    grid-column: 1 / -1;
  }

  .token-rpm-input {
    min-width: 0;
    width: 100%;
  }

  #tokenTable .token-detail-row {
    display: block;
    width: 100%;
    margin: -10px 0 10px;
    border: 1px solid rgba(104, 216, 174, 0.2);
    border-top: 0;
    border-radius: 0 0 8px 8px;
  }

  #tokenTable .token-detail-row td {
    display: block;
    width: 100%;
  }

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

  .token-detail-grid section + section {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .token-detail-grid .token-inventory-section + section {
    border-top: 0;
  }

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

  .token-member-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

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

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

  .detail-task-row {
    grid-template-columns: 58px minmax(0, 1fr) max-content;
    gap: 7px;
    padding-block: 5px;
  }

  .detail-task-row > :nth-child(4) {
    grid-column: 2;
  }

  .detail-task-row > :nth-child(5) {
    grid-column: 2 / -1;
  }
}

@media (max-width: 360px) {
  .token-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .tabs {
    gap: 4px;
  }

  .tab-btn {
    flex: 1;
    min-width: 0;
    padding-inline: 6px;
    font-size: 13px;
    white-space: nowrap;
  }

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

  .quick-actions-card .actions button {
    min-width: 0;
    width: 100%;
  }

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

  .token-member-facts,
  .token-member-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .activity-pulse {
    animation: none;
  }
}
