:root {
  --bg: #09090b;
  --bg-sidebar: #09090b;
  --bg-content: #09090b;
  --bg-hover: #27272a;
  --bg-active: #3f3f46;
  --border: #27272a;
  --border-strong: #3f3f46;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --card-label-bright: #fafafa;
  --accent: #fafafa;
  --accent-dim: rgba(255, 255, 255, 0.4);
  --accent-link: #fafafa;
  --orange: #d98a58;
  --comment: #6a737d;
  --keyword: #ff7b72;
  --string: #a5d6ff;
  --number: #79c0ff;
  --panel-bg-contrast: #09090b;
  --panel-border-contrast: #27272a;
  --field-bg-contrast: #09090b;
  --field-border-contrast: #27272a;

  /* ── Semantic theme tokens ────────────────────── */
  --text-bright: #ffffff;
  --overlay: rgba(0, 0, 0, 0.8);

  /* Status: error */
  --status-error: #ef4444;
  --status-error-muted: #f87171;
  --status-error-bg: rgba(127, 29, 29, 0.2);
  --status-error-border: rgba(220, 38, 38, 0.5);

  /* Status: warning */
  --status-warning: #eab308;
  --status-warning-muted: #facc15;
  --status-warning-bg: rgba(113, 63, 18, 0.2);
  --status-warning-border: rgba(202, 138, 4, 0.5);

  /* Status: success */
  --status-success: #22c55e;
  --status-success-muted: #4ade80;
  --status-success-bg: rgba(20, 83, 45, 0.2);
  --status-success-border: rgba(22, 163, 74, 0.5);

  /* Status: info */
  --status-info: #0ea5e9;
  --status-info-muted: #22d3ee;
  --status-info-bg: rgba(22, 78, 99, 0.2);
  --status-info-border-color: var(--border-strong);}

/* ── Light theme ─────────────────────────────────── */
[data-theme="light"] {
  --bg: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-content: #ffffff;
  --bg-hover: #f4f4f5;
  --bg-active: #e4e4e7;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #09090b;
  --text-muted: #71717a;
  --text-dim: #a1a1aa;
  --text-bright: #000000;
  --card-label-bright: #09090b;
  --accent: #18181b;
  --accent-dim: rgba(0, 0, 0, 0.4);
  --accent-link: #18181b;
  --orange: #c2410c;
  --comment: #9ca3af;
  --keyword: #dc2626;
  --string: #2563eb;
  --number: #0284c7;
  --panel-bg-contrast: #ffffff;
  --panel-border-contrast: #e4e4e7;
  --field-bg-contrast: #ffffff;
  --field-border-contrast: #e4e4e7;
  --overlay: rgba(0, 0, 0, 0.5);

  --status-error: #ef4444;
  --status-error-muted: #f87171;
  --status-error-bg: rgba(254, 226, 226, 0.5);
  --status-error-border: rgba(252, 165, 165, 0.8);
  --status-warning: #eab308;
  --status-warning-muted: #facc15;
  --status-warning-bg: rgba(254, 249, 195, 0.5);
  --status-warning-border: rgba(253, 224, 71, 0.8);
  --status-success: #22c55e;
  --status-success-muted: #4ade80;
  --status-success-bg: rgba(220, 252, 231, 0.5);
  --status-success-border: rgba(134, 239, 172, 0.8);
  --status-info: #0ea5e9;
  --status-info-muted: #22d3ee;
  --status-info-bg: rgba(224, 242, 254, 0.5);
  --status-info-border: rgba(125, 211, 252, 0.8);}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-size: 14px;
  line-height: 1.5;
}

.ac-logo-mark {
  display: inline-block;
  flex: 0 0 auto;
  width: var(--ac-logo-width, 20px);
  height: var(--ac-logo-height, 20px);
  background: var(--text);
  -webkit-mask: url("../img/logo.svg") center / contain no-repeat;
  mask: url("../img/logo.svg") center / contain no-repeat;
}


/* Subtle grid texture overlay removed */
}

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

.card-label-bright {
  color: var(--card-label-bright);
}

.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-list.ac-history-list-tight {
  gap: 0;
}

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

.ac-history-item.ac-history-item-flat {
  border: 0;
  border-bottom: 1px solid var(--panel-border-contrast);
  border-radius: 0;
  background: transparent;
}

.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: 8px;
  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-summary .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 {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--border-strong);
  border-color: var(--border-strong);}

::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 {
  background-color: var(--text);
  color: var(--bg);
  font-weight: 500;
  border: 1px solid transparent;
  transition: opacity 0.2s ease, transform 0.1s ease;
}
.ac-btn-cyan:hover:not(:disabled) {
  opacity: 0.9;
}
.ac-btn-cyan:active:not(:disabled) {
  transform: scale(0.98);
}
.ac-btn-cyan:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ac-btn-cyan-ghost {
  background-color: transparent;
  color: var(--text);
  border: 1px solid transparent;
  font-weight: 500;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.ac-btn-cyan-ghost:hover:not(:disabled) {
  background-color: var(--bg-hover);
}

.ac-path-card {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.ac-path-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}
.ac-path-card:hover .ac-path-title {
  color: var(--text);
}
.ac-path-card:hover .ac-path-desc {
  color: var(--text-muted);
}
.ac-path-icon {
  color: var(--text-muted);
  transition: color 0.2s ease;
}
.ac-path-card:hover .ac-path-icon {
  color: var(--text);
}

.ac-btn-secondary {
  background-color: var(--bg-hover);
  color: var(--text);
  font-weight: 500;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.ac-btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-active);
}
.ac-btn-secondary:active:not(:disabled) {
  transform: scale(0.98);
}
.ac-btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ac-btn-ghost {
  background-color: transparent;
  color: var(--text);
  border: 1px solid transparent;
  font-weight: 500;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.ac-btn-ghost:hover:not(:disabled) {
  background-color: var(--bg-hover);
}
.ac-btn-ghost:active:not(:disabled) {
  transform: scale(0.98);
}
.ac-btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ac-btn-danger {
  background-color: var(--status-error);
  color: var(--text-bright);
  font-weight: 500;
  border: 1px solid transparent;
  transition: opacity 0.2s ease, transform 0.1s ease;
}
.ac-btn-danger:hover:not(:disabled) {
  opacity: 0.9;
}
.ac-btn-danger:active:not(:disabled) {
  transform: scale(0.98);
}
.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: 36px;
  height: 20px;
  border-radius: 9999px;
  background-color: var(--border-strong);
  transition: background-color 0.2s ease;
  border: none;
}

.ac-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  background-color: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.ac-toggle-label {
  font-size: 12px;
  color: var(--text-muted);
}

.ac-toggle-input:checked + .ac-toggle-track {
  background-color: var(--text);
}

.ac-toggle-input:checked + .ac-toggle-track .ac-toggle-thumb {
  transform: translateX(16px);
  background-color: var(--bg);
}

.ac-toggle-input:focus-visible + .ac-toggle-track {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--border-strong);
}

.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(161, 161, 170, 0.14), 0 0 5px rgba(161, 161, 170, 0.18); }
  50% { box-shadow: 0 0 0 3px rgba(161, 161, 170, 0.08), 0 0 9px rgba(161, 161, 170, 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 {
  background-color: var(--status-success);
  color: var(--text-bright);
  font-weight: 500;
  border: 1px solid transparent;
  transition: opacity 0.2s ease, transform 0.1s ease;
}
.ac-btn-green:hover:not(:disabled) {
  opacity: 0.9;
}
.ac-btn-green:active:not(:disabled) {
  transform: scale(0.98);
}

@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 > .inline-flex {
  align-self: stretch;
  display: flex;
}

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

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

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

.ac-segmented-control-dark {
  background: rgba(0, 0, 0, 0.25);
}

/* ── PopActions: animated action group ───────── */

.ac-pop-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-shrink: 0;
}

.ac-pop-actions-hidden {
  visibility: hidden;
  pointer-events: none;
}

.ac-pop-actions-in > * {
  animation: acPopIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.ac-pop-actions-in > *:nth-child(2) {
  animation-delay: 0.06s;
}

.ac-pop-actions-in .ac-btn-cyan {
  animation: acPopIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) 0.06s both;
}

.ac-pop-actions-out > * {
  animation: acPopOut 0.18s ease-in both;
}

.ac-pop-actions-out > *:first-child {
  animation-delay: 0.03s;
}

.ac-pop-actions > button:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

@keyframes acPopIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes acPopOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.85); }
}

.watchdog-logs-panel {
  min-height: 160px;
  max-height: 80vh;
  resize: vertical;
}

.watchdog-terminal-host {
  position: relative;
}

.watchdog-terminal-host .xterm {
  height: 100%;
  letter-spacing: 0;
  font-kerning: none;
}

.watchdog-terminal-host .xterm-viewport {
  overflow-y: auto !important;
}

