:root {
  --bg: #0d121b;
  --bg-sidebar: #0f141f;
  --bg-content: #0f1521;
  --bg-hover: rgba(99, 235, 255, 0.05);
  --bg-active: rgba(99, 235, 255, 0.08);
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.11);
  --text: #c9d1d9;
  --text-muted: #6e7681;
  --text-dim: #424854;
  --accent: #63ebff;
  --accent-dim: rgba(99, 235, 255, 0.4);
  --accent-link: rgba(99, 235, 255, 0.6);
  --orange: #d98a58;
  --comment: #6a737d;
  --keyword: #ff7b72;
  --string: #a5d6ff;
  --number: #79c0ff;
  --panel-bg-contrast: rgba(255, 255, 255, 0.028);
  --panel-border-contrast: rgba(255, 255, 255, 0.11);
  --field-bg-contrast: rgba(0, 0, 0, 0.3);
  --field-border-contrast: rgba(255, 255, 255, 0.13);
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
}

/* Subtle grid texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.024) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* Standardised card / section label. */
.card-label {
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.ac-small-heading {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Shared collapsible history rows (incidents, webhook requests). */
.ac-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ac-history-item {
  border: 1px solid var(--panel-border-contrast);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.snippet-collapse-fade {
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.75) 70%);
}

/* Shared inset panel for "surface on surface" layouts. */
.ac-surface-inset {
  border: 1px solid var(--panel-border-contrast);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.ac-history-summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 10px;
  color: #d1d5db;
}

.ac-history-summary::-webkit-details-marker {
  display: none;
}

.ac-history-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ac-history-toggle {
  color: var(--text-muted);
  transition: transform 0.15s ease, color 0.15s ease;
}

.ac-history-item[open] .ac-history-toggle {
  transform: rotate(90deg);
  color: #d1d5db;
}

.ac-history-body {
  margin: 4px 10px 10px;
  padding-top: 8px;
  border-top: 1px solid var(--panel-border-contrast);
}

/* Unified panel treatment across tabs/pages. */
.bg-surface {
  background: var(--panel-bg-contrast) !important;
  border-color: var(--panel-border-contrast) !important;
}

/* Solid background for modals so page content doesn't bleed through. */
.bg-modal {
  background: var(--bg) !important;
  border-color: var(--panel-border-contrast) !important;
}

.border-border {
  border-color: var(--panel-border-contrast) !important;
}

.ac-tip-link {
  color: var(--accent-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ac-tip-link:hover {
  color: var(--accent);
}

/* Universal field contrast treatment (all tabs/pages). */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea {
  background: var(--field-bg-contrast);
  border-color: var(--field-border-contrast);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 255, 255, 0.28);
}

::placeholder { color: var(--text-dim) !important; opacity: 1 !important; }
::-webkit-input-placeholder { color: var(--text-dim) !important; }
::-moz-placeholder { color: var(--text-dim) !important; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 3px; }

.scrollbar-hidden {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hidden::-webkit-scrollbar {
  display: none;
}

/* Google scope picker toggle buttons */
.scope-btn { background: rgba(255,255,255,0.03); color: var(--text-muted); border: 1px solid var(--border); transition: all 0.15s; }
.scope-btn:hover { border-color: var(--text-dim); color: var(--text); }
.scope-btn-read.active {
  background: rgba(255, 255, 255, 0.03);
  color: #f3f4f6;
  border-color: rgba(255, 255, 255, 0.35);
}
.scope-btn-write.active {
  background: rgba(255, 255, 255, 0.03);
  color: #f3f4f6;
  border-color: rgba(255, 255, 255, 0.35);
}

/* Reusable cyan action buttons */
.ac-btn-cyan {
  border: 1px solid var(--accent-dim);
  background: linear-gradient(
    180deg,
    rgba(99, 235, 255, 0.14) 0%,
    rgba(99, 235, 255, 0.08) 100%
  );
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(99, 235, 255, 0.12);
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.ac-btn-cyan:hover:not(:disabled) {
  border-color: rgba(99, 235, 255, 0.7);
  background: linear-gradient(
    180deg,
    rgba(99, 235, 255, 0.24) 0%,
    rgba(99, 235, 255, 0.12) 100%
  );
  color: #b9f8ff;
  box-shadow:
    inset 0 0 0 1px rgba(99, 235, 255, 0.2),
    0 0 12px rgba(99, 235, 255, 0.14);
}

.ac-btn-cyan:active:not(:disabled) {
  transform: translateY(1px);
}

.ac-btn-cyan:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ac-btn-cyan-ghost {
  border: 1px solid var(--accent-dim);
  color: rgba(99, 235, 255, 0.75);
  background: rgba(99, 235, 255, 0.04);
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background 0.15s ease;
}

.ac-btn-cyan-ghost:hover {
  border-color: rgba(99, 235, 255, 0.5);
  color: #a4f3ff;
  background: rgba(99, 235, 255, 0.08);
}

.ac-path-card {
  border: 1px solid var(--panel-border-contrast);
  background: rgba(0, 0, 0, 0.2);
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.ac-path-card:hover {
  border-color: rgba(99, 235, 255, 0.5);
  background: rgba(99, 235, 255, 0.04);
  box-shadow:
    inset 0 0 0 1px rgba(99, 235, 255, 0.1),
    0 0 12px rgba(99, 235, 255, 0.08);
}

.ac-path-card:hover .ac-path-icon {
  color: var(--accent);
  border-color: rgba(99, 235, 255, 0.3);
  background: rgba(99, 235, 255, 0.1);
}

.ac-path-card:hover .ac-path-title {
  color: #b9f8ff;
}

.ac-path-card:hover .ac-path-desc {
  color: #94a3b8;
}

.ac-path-icon {
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.ac-btn-secondary {
  border: 1px solid var(--panel-border-contrast);
  color: #d1d5db;
  background: rgba(255, 255, 255, 0.03);
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.ac-btn-secondary:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.35);
  color: #f3f4f6;
  background: rgba(255, 255, 255, 0.06);
}

.ac-btn-secondary:active:not(:disabled) {
  transform: translateY(1px);
}

.ac-btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ac-btn-ghost {
  border: none;
  color: var(--text-muted);
  background: transparent;
  transition: color 0.15s ease;
}

.ac-btn-ghost:hover:not(:disabled) {
  color: #f3f4f6;
}

.ac-btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ac-btn-danger {
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.ac-btn-danger:hover:not(:disabled) {
  border-color: rgba(239, 68, 68, 0.7);
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
}

.ac-btn-danger:active:not(:disabled) {
  transform: translateY(1px);
}

.ac-btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ac-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.ac-toggle-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ac-toggle-track {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid var(--panel-border-contrast);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.ac-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #94a3b8;
  box-shadow: 0 0 0 1px rgba(15, 21, 33, 0.3);
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.ac-toggle-label {
  font-size: 12px;
  color: #d1d5db;
}

.ac-toggle-input:checked + .ac-toggle-track {
  border-color: rgba(99, 235, 255, 0.8);
  background: rgba(99, 235, 255, 0.16);
  box-shadow:
    inset 0 0 0 1px rgba(99, 235, 255, 0.2),
    0 0 10px rgba(99, 235, 255, 0.2);
}

.ac-toggle-input:checked + .ac-toggle-track .ac-toggle-thumb {
  transform: translateX(14px);
  background: #b6f6ff;
  box-shadow:
    0 0 0 1px rgba(15, 21, 33, 0.25),
    0 0 10px rgba(99, 235, 255, 0.45);
}

.ac-toggle-input:focus-visible + .ac-toggle-track {
  outline: 2px solid rgba(99, 235, 255, 0.55);
  outline-offset: 2px;
}

.ac-toggle-input:disabled + .ac-toggle-track {
  opacity: 0.55;
  box-shadow: none;
}

.ac-toggle-input:disabled + .ac-toggle-track + .ac-toggle-label {
  opacity: 0.6;
}

@keyframes acStatusDotPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      0 0 0 0 rgba(34, 197, 94, 0.14),
      0 0 5px rgba(34, 197, 94, 0.18);
  }
  50% {
    transform: scale(1.08);
    box-shadow:
      0 0 0 3px rgba(34, 197, 94, 0.08),
      0 0 9px rgba(34, 197, 94, 0.32);
  }
}

@keyframes acStatusDotPulseInfo {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      0 0 0 0 rgba(34, 211, 238, 0.16),
      0 0 5px rgba(34, 211, 238, 0.22);
  }
  50% {
    transform: scale(1.08);
    box-shadow:
      0 0 0 3px rgba(34, 211, 238, 0.1),
      0 0 9px rgba(34, 211, 238, 0.34);
  }
}

@keyframes acStepPillPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 0 rgba(99, 235, 255, 0.14),
      0 0 5px rgba(99, 235, 255, 0.18);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(99, 235, 255, 0.08),
      0 0 9px rgba(99, 235, 255, 0.32);
  }
}

.ac-step-pill-pulse {
  animation: acStepPillPulse 2.6s ease-in-out infinite;
}

.ac-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.ac-status-dot--healthy {
  background: #22c55e;
  animation: acStatusDotPulse 2.6s ease-in-out infinite;
}

.ac-status-dot--info {
  background: #22d3ee;
  animation: acStatusDotPulseInfo 2.6s ease-in-out infinite;
}

.ac-status-dot--healthy-offset {
  animation-delay: 0.95s;
}

.ac-btn-green {
  border: 1px solid rgba(34, 197, 94, 0.45);
  background: linear-gradient(
    180deg,
    rgba(34, 197, 94, 0.2) 0%,
    rgba(34, 197, 94, 0.12) 100%
  );
  color: #86efac;
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.12);
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.ac-btn-green:hover:not(:disabled) {
  border-color: rgba(34, 197, 94, 0.7);
  background: linear-gradient(
    180deg,
    rgba(34, 197, 94, 0.28) 0%,
    rgba(34, 197, 94, 0.16) 100%
  );
  color: #bbf7d0;
  box-shadow:
    inset 0 0 0 1px rgba(34, 197, 94, 0.2),
    0 0 12px rgba(34, 197, 94, 0.12);
}

.ac-btn-green:active:not(:disabled) {
  transform: translateY(1px);
}

@keyframes acSpinnerOrbit {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.ac-spinner {
  animation: acSpinnerOrbit 1s cubic-bezier(0.3, 0.2, 0.7, 0.8) infinite;
  transform-origin: center;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .ac-spinner {
    animation-duration: 1.8s;
    animation-timing-function: linear;
  }
}

/* Reusable segmented control (pill toggle). */
.ac-segmented-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--panel-border-contrast);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  height: 28px;
}

.ac-segmented-control-full {
  display: flex;
  width: 100%;
}

.ac-segmented-control-button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.03em;
  height: 100%;
  line-height: 1;
  padding: 0 10px;
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}

.ac-segmented-control-full .ac-segmented-control-button {
  flex: 1 1 0%;
}

.ac-segmented-control-lg {
  height: 36px;
  border-radius: 12px;
}

.ac-segmented-control-lg .ac-segmented-control-button {
  font-size: 14px;
  padding: 0 16px;
}

.ac-segmented-control-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.ac-segmented-control-button.active {
  color: var(--accent);
  background: var(--bg-active);
}
