@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@24,400,0,0');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;

  --bg: #0c1218;
  --bg-elevated: #141c26;
  --surface: #1a2430;
  --surface-2: #212d3b;
  --surface-inset: rgba(255, 255, 255, 0.045);

  --text: #f3f7fb;
  --text-secondary: #9eb0c4;
  --text-tertiary: #7b8fa6;
  --label: #b4c4d6;

  --accent: #34ddb2;
  --accent-hover: #4aebc0;
  --accent-muted: rgba(52, 221, 178, 0.16);
  --accent-glow: rgba(52, 221, 178, 0.22);

  --info: #60a5fa;
  --success: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;

  --hairline: rgba(255, 255, 255, 0.06);
  --radius-card: 18px;
  --radius-control: 12px;
  --radius-pill: 999px;
  --container: 1120px;
  --transition: 160ms ease;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font: 15px/1.55 'DM Sans', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(52, 221, 178, 0.1), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(96, 165, 250, 0.08), transparent),
    radial-gradient(ellipse 50% 30% at 0% 20%, rgba(52, 221, 178, 0.05), transparent),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  font-size: 20px;
  line-height: 1;
}

a { color: #7ec8ff; text-decoration: none; transition: color var(--transition); }
a:hover { color: #a8dcff; }

.app-shell { min-height: 100vh; }

.container {
  width: min(100% - 48px, var(--container));
  margin: 0 auto;
}

/* ── Header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px) saturate(1.2);
  background: rgba(12, 18, 24, 0.72);
  border-bottom: 1px solid var(--hairline);
}

.app-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 14px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent-muted);
  color: var(--accent);
  flex-shrink: 0;
}

.brand-mark .material-symbols-rounded { font-size: 19px; }

.brand-copy strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand-page {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.2;
}

.app-nav {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  gap: 2px;
}

.app-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.app-nav a .material-symbols-rounded { font-size: 17px; }

.app-nav a:hover {
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
}

.app-nav a.active {
  color: var(--text);
  background: var(--surface-2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ── Page ── */
main.container {
  padding: var(--space-3) 0 56px;
}

.page-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.page-top h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.page-top p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 520px;
}

.system-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}

.system-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ── Cards ── */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, rgba(26, 36, 48, 0.96) 100%);
  border-radius: var(--radius-card);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 16px 40px rgba(0, 0, 0, 0.2);
}

.card-compact { padding: var(--space-3); }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.card-head-tight { margin-bottom: var(--space-2); }

.card-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-muted);
  color: var(--accent);
  flex-shrink: 0;
}

.card-icon.slate {
  background: rgba(96, 165, 250, 0.1);
  color: #93c5fd;
}

.card-icon .material-symbols-rounded { font-size: 20px; }

.card-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-title p {
  margin: 3px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-secondary);
}

.badge .material-symbols-rounded { font-size: 15px; }

.badge.ok { color: #86efac; background: rgba(74, 222, 128, 0.1); }
.badge.warn { color: #fcd34d; background: rgba(251, 191, 36, 0.1); }
.badge.loading { color: var(--text-secondary); }

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── Forms ── */
.field { margin-bottom: var(--space-2); }

.field label,
.label {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--label);
}

.field-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.45;
}

.action-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

input[type="url"],
input[type="text"],
input[type="number"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: var(--radius-control);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  transition: box-shadow var(--transition), background var(--transition);
}

.publish-panel {
  margin-top: var(--space-2);
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.publish-panel[hidden] { display: none !important; }

.publish-grid {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(180px, 1.2fr) auto auto auto;
  gap: 12px;
  align-items: end;
}

.inline-check {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}

.inline-check input,
.result-choice input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

textarea.code {
  min-height: 148px;
  font: 13px/1.5 'JetBrains Mono', ui-monospace, monospace;
  resize: vertical;
  background: var(--surface-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

input:focus,
textarea:focus {
  outline: none;
  background: #263445;
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 18px;
  border: none;
  border-radius: var(--radius-control);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), opacity var(--transition), background var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn .material-symbols-rounded { font-size: 18px; }

.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  color: #042a1f;
  background: linear-gradient(180deg, #3ee9b8 0%, #2dd4a8 100%);
  box-shadow: 0 4px 14px rgba(45, 212, 168, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #4ef0c0 0%, #34ddb2 100%);
  box-shadow: 0 6px 18px rgba(45, 212, 168, 0.28);
}

.btn-secondary {
  color: var(--text);
  background: var(--surface-2);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--info);
  background: rgba(96, 165, 250, 0.08);
  border: none;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-ghost:hover { background: rgba(96, 165, 250, 0.14); }
.btn-ghost .material-symbols-rounded { font-size: 15px; }

.btn.is-loading .material-symbols-rounded { display: none; }
.btn.is-loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(4, 42, 31, 0.25);
  border-top-color: #042a1f;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

/* ── Toggles ── */
.toggle-list { display: grid; gap: 10px; }

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

.settings-grid .field:first-child {
  grid-column: 1 / -1;
}

.publish-toggles {
  margin: var(--space-2) 0;
}

.settings-grid-tight {
  margin-top: var(--space-2);
}

.settings-savebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: var(--space-2) 0 var(--space-4);
}

.auto-token-settings {
  display: grid;
  gap: 12px;
  margin: var(--space-2) 0;
}

.auto-token-settings-grid .field:first-child {
  grid-column: auto;
}

.auto-token-log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auto-token-history {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.auto-token-history[hidden] {
  display: none;
}

.auto-token-event {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.auto-token-event-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.auto-token-event-copy strong {
  font-size: 13px;
}

.auto-token-event-copy span,
.auto-token-log-evicted {
  color: var(--text-secondary);
  font-size: 12px;
}

.auto-token-event.is-error .auto-token-event-copy > span:first-of-type,
.auto-token-event.is-error .auto-token-event-message {
  color: #fca5a5;
}

.auto-token-log-download,
.auto-token-log-evicted {
  flex-shrink: 0;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
}

.btn-sm .material-symbols-rounded { font-size: 18px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.icon-btn:hover { background: #2a3848; color: var(--text); }
.icon-btn.danger:hover { background: rgba(248, 113, 113, 0.14); color: #fecaca; }
.icon-btn .material-symbols-rounded { font-size: 18px; }

.account-list {
  display: grid;
  gap: 10px;
  margin-bottom: var(--space-2);
}

.account-empty {
  padding: 18px 16px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.account-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.account-card.is-current {
  box-shadow:
    inset 0 0 0 1px rgba(52, 221, 178, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.account-card.is-frozen {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.account-card.is-frozen::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.42);
  pointer-events: none;
  z-index: 1;
}

.account-card.is-frozen .account-actions {
  position: relative;
  z-index: 2;
}

.account-card.is-frozen .account-meta-frozen {
  color: rgba(40, 48, 58, 0.85) !important;
  font-weight: 600;
}

.account-card.is-invalid {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.account-card.is-invalid::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.36);
  pointer-events: none;
  z-index: 1;
}

.account-card.is-invalid .account-actions {
  position: relative;
  z-index: 2;
}

.account-card.is-invalid .account-copy {
  position: relative;
  z-index: 2;
}

.account-card.is-invalid .account-meta-invalid {
  color: #ff3b3b !important;
  font-weight: 700;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.account-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.account-avatar.placeholder {
  display: grid;
  place-items: center;
  background: var(--accent-muted);
  color: var(--accent);
}

.account-copy {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.account-copy strong {
  font-size: 14px;
  font-weight: 600;
}

.account-copy span {
  font-size: 12px;
  color: var(--text-secondary);
}

.account-meta {
  color: var(--accent) !important;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.account-action-icon {
  display: none;
}

.subsection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: var(--space-2) 0 10px;
}

.subsection-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label);
}

.routing-backoff { margin-top: var(--space-2); }

.oauth-steps {
  margin: 0 0 var(--space-2);
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.oauth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--space-2);
}

body.modal-open { overflow: hidden; }

.modal[hidden] { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 12, 0.72);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: linear-gradient(180deg, var(--surface) 0%, rgba(26, 36, 48, 0.98) 100%);
  border-radius: var(--radius-card);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 24px 60px rgba(0, 0, 0, 0.45);
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
}

.modal-head {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-foot {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  justify-content: flex-end;
}

.modal-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 18px;
}

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.toggle-item strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.toggle-item span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-secondary);
}

.toggle-item.toggle-nested {
  margin-left: 18px;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.toggle-item.toggle-nested[hidden] {
  display: none !important;
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.1);
  transition: background var(--transition);
}

.switch-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 4px;
  top: 4px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.switch input:checked + .switch-slider { background: var(--accent); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

/* ── Alerts ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: var(--space-2);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.alert::before {
  font-family: 'Material Symbols Rounded';
  font-size: 18px;
  line-height: 1.2;
  flex-shrink: 0;
}

.alert-info { color: #bfdbfe; background: rgba(96, 165, 250, 0.1); }
.alert-info::before { content: 'info'; }

.alert-success { color: #bbf7d0; background: rgba(74, 222, 128, 0.1); }
.alert-success::before { content: 'check_circle'; }

.alert-error { color: #fecaca; background: rgba(248, 113, 113, 0.1); }
.alert-error::before { content: 'error'; }

.alert[hidden] { display: none !important; }

/* ── Status banner ── */
.status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: var(--space-2);
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.status-banner.ok { background: rgba(74, 222, 128, 0.08); color: #bbf7d0; }
.status-banner.error { background: rgba(248, 113, 113, 0.08); color: #fecaca; }
.status-banner[hidden] { display: none !important; }

.duplicate-prompt {
  margin-top: var(--space-2);
  padding: 14px;
  border-radius: 14px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.18);
  display: grid;
  gap: 12px;
}

.duplicate-prompt[hidden] { display: none !important; }

.duplicate-prompt-copy {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.duplicate-prompt-copy .material-symbols-rounded {
  color: #fecaca;
  margin-top: 2px;
}

.duplicate-prompt-copy strong {
  display: block;
  margin-bottom: 4px;
  color: #fecaca;
}

.duplicate-prompt-copy p {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
}

.duplicate-prompt-copy a {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: #93c5fd;
  word-break: break-all;
}

.duplicate-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.duplicate-prompt-actions .btn {
  flex: 1 1 180px;
}

/* ── Output panels ── */
.outputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: var(--space-3);
}

.output-panel {
  display: flex;
  flex-direction: column;
  min-height: 120px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.output-panel.wide { grid-column: 1 / -1; }

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

.output-panel h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--label);
}

.output-body {
  flex: 1;
  min-height: 0;
}

.result-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.result-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
}

.result-list li.is-current {
  box-shadow: inset 0 0 0 1px rgba(52, 221, 178, 0.28);
}

.result-list li.is-frozen {
  position: relative;
  opacity: 0.72;
}

.result-list li.is-frozen::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.result-list li.is-invalid {
  position: relative;
  opacity: 0.85;
}

.result-list li.is-invalid::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.22);
  pointer-events: none;
}

.result-list li.is-invalid .acc-name {
  position: relative;
  z-index: 1;
  color: #ff3b3b;
  font-weight: 700;
}

.result-list li.is-invalid .acc-invalid-label {
  color: #ff3b3b;
  font-weight: 700;
}

.mode-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 0 0 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mode-switch-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.mode-switch-btn.is-active {
  background: rgba(52, 221, 178, 0.16);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(52, 221, 178, 0.28);
}

.batch-queue {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: grid;
  gap: 8px;
}

.batch-queue-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.batch-queue-item.is-running {
  background: rgba(90, 160, 255, 0.1);
  border-color: rgba(90, 160, 255, 0.28);
}

.batch-queue-item.is-done {
  background: rgba(52, 221, 178, 0.12);
  border-color: rgba(52, 221, 178, 0.35);
}

.batch-queue-item.is-done .batch-queue-url {
  color: #7dffd0;
}

.batch-queue-item.is-error {
  background: rgba(255, 110, 110, 0.1);
  border-color: rgba(255, 110, 110, 0.3);
}

.batch-queue-item.is-skipped {
  background: rgba(255, 196, 90, 0.08);
  border-color: rgba(255, 196, 90, 0.25);
}

.batch-queue-url-suffix {
  color: inherit;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

.batch-queue-main {
  min-width: 0;
}

.batch-queue-url {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text);
}

.batch-queue-meta {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.batch-queue-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.batch-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.batch-progress {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.batch-modal-url {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}

.hint-muted {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.publish-grid .status-flags,
.modal-body .status-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 6px;
}

.publish-grid .field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-post-toggles {
  margin-bottom: 12px;
}

.result-list li.is-current strong {
  font-weight: 700;
  color: var(--text);
}

.result-list .acc-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-list .acc-primary-status,
.result-list .acc-auto-refresh-error {
  display: block;
}

.result-list .acc-auto-refresh-error {
  margin-top: 2px;
  color: #fca5a5 !important;
  font-size: 12px;
  font-weight: 700;
}

.result-list .acc-stats {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.result-list .acc-stats .material-symbols-rounded {
  color: var(--muted);
  font-size: 14px;
}

.result-list .acc-stats .material-symbols-rounded:nth-of-type(2) {
  margin-left: 6px;
}

.copyright-prompt {
  border-color: rgba(255, 120, 90, 0.35);
  background: rgba(120, 28, 28, 0.22);
}

.result-choice {
  width: 100%;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.result-choice a {
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-list .material-symbols-rounded {
  color: var(--accent);
  font-size: 17px;
  flex-shrink: 0;
}

.empty-state {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 12px !important;
  text-align: center;
  color: var(--text-tertiary) !important;
  background: transparent !important;
  font-size: 12px;
  line-height: 1.45;
}

.empty-state .material-symbols-rounded {
  color: var(--text-tertiary) !important;
  font-size: 22px !important;
  opacity: 0.55;
}

pre, .log {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font: 12px/1.5 'JetBrains Mono', ui-monospace, monospace;
  color: var(--text-secondary);
}

.outputs-log-only {
  grid-template-columns: 1fr;
}

.log-panel .output-body {
  min-height: 320px;
}

.log-live {
  min-height: 300px;
  max-height: 60vh;
  overflow: auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.text-preview {
  margin-top: 10px;
  max-height: 140px;
  overflow: auto;
}

.text-preview[hidden] { display: none; }

@media (max-width: 800px) {
  .container { width: min(100% - 32px, var(--container)); }
  .page-top { flex-direction: column; }
  .action-bar { grid-template-columns: 1fr; }
  .publish-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .field:first-child { grid-column: auto; }
  .inline-check { min-height: 28px; }
  .outputs { grid-template-columns: 1fr; }
  .output-panel.wide { grid-column: auto; }
  .app-header .container { flex-wrap: wrap; }
  .account-action-label { display: none; }
  .account-action-icon { display: inline-flex; }
  .account-action-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    align-items: center;
    justify-content: center;
  }
  .auto-token-event { align-items: flex-start; }
}
