@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/fraunces-600.ttf") format("truetype");
}

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/fraunces-700.ttf") format("truetype");
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/space-grotesk-400.ttf") format("truetype");
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/space-grotesk-500.ttf") format("truetype");
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/space-grotesk-600.ttf") format("truetype");
}

:root {
  --ink: #101317;
  --muted: #596272;
  --cream: #f5efe6;
  --stone: #ece6dc;
  --navy: #102a43;
  --teal: #1b998b;
  --coral: #f25f4c;
  --sun: #f4d35e;
  --primary: #2563eb;
  --accent: #8b5cf6;
  --info: #0891b2;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --critical: #be123c;
  --neutral: #64748b;
  --primary-bg: rgba(37, 99, 235, 0.13);
  --primary-border: rgba(37, 99, 235, 0.38);
  --primary-text: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.28);
  --accent-bg: rgba(139, 92, 246, 0.13);
  --accent-border: rgba(139, 92, 246, 0.38);
  --accent-text: #6d28d9;
  --info-bg: rgba(8, 145, 178, 0.14);
  --info-border: rgba(8, 145, 178, 0.38);
  --info-text: #0e7490;
  --success-bg: rgba(22, 163, 74, 0.14);
  --success-border: rgba(22, 163, 74, 0.4);
  --success-text: #15803d;
  --warning-bg: rgba(217, 119, 6, 0.16);
  --warning-border: rgba(217, 119, 6, 0.42);
  --warning-text: #92400e;
  --danger-bg: rgba(220, 38, 38, 0.14);
  --danger-border: rgba(220, 38, 38, 0.4);
  --danger-text: #b91c1c;
  --critical-bg: rgba(190, 18, 60, 0.16);
  --critical-border: rgba(190, 18, 60, 0.44);
  --critical-text: #9f1239;
  --neutral-bg: rgba(100, 116, 139, 0.14);
  --neutral-border: rgba(100, 116, 139, 0.32);
  --neutral-text: #475569;
  --panel: rgba(255, 255, 255, 0.86);
  --shadow: 0 20px 60px rgba(16, 19, 23, 0.16);
  --surface: #f7f1e7;
  --card: #ffffff;
  --line-soft: rgba(16, 19, 23, 0.12);
  --text-muted: #596272;
  --switch-pill-toggle-gap: 0.35rem;
  --sticky-chrome-height: 10.5rem;
  --app-gutter: clamp(0.9rem, 2vw, 2rem);
  --workbench-gap: clamp(0.9rem, 1.2vw, 1.25rem);
  --tenant-workbench-scroll-height: calc(100vh - var(--sticky-chrome-height) - 3rem);
}

* {
  box-sizing: border-box;
}

/*
 * Paint the root element with the theme's base surface so the browser's
 * overscroll "rubber-band" at the top/bottom shows the app color, not the
 * default white canvas. --surface flips per theme (light/dark), and
 * overscroll-behavior stops the bounce entirely on supporting browsers.
 */
html {
  background-color: var(--surface);
  color-scheme: light;
  overscroll-behavior-y: none;
}

/* Global request progress bar (driven by shared.js while any request is in flight). */
.sg-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.sg-progress.is-active {
  opacity: 1;
}

.sg-progress__bar {
  height: 100%;
  width: 0;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 0 10px color-mix(in srgb, var(--primary) 55%, transparent);
  transition: width 0.25s ease;
}

.sg-progress.is-done .sg-progress__bar {
  transition: width 0.16s ease;
}

/* Inline spinner for panel-level loading (e.g. job log while fetching). */
.sg-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
  vertical-align: -0.15rem;
  border: 2px solid color-mix(in srgb, var(--primary) 40%, transparent);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: sg-spin 0.7s linear infinite;
}

.sg-loading-row {
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

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

@media (prefers-reduced-motion: reduce) {
  .sg-progress__bar {
    transition: none;
  }

  .sg-spinner {
    animation-duration: 1.4s;
  }
}

body {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 18%, transparent), transparent 55%),
    radial-gradient(circle at 80% 10%, color-mix(in srgb, var(--info) 18%, transparent), transparent 50%),
    radial-gradient(circle at 20% 85%, color-mix(in srgb, var(--warning) 14%, transparent), transparent 45%),
    linear-gradient(120deg, #f7f1e7, #e8f0f6);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body:not(.chrome-pinned) {
  --tenant-workbench-scroll-height: calc(100vh - 3rem);
}

body.chrome-unpinned {
  --tenant-workbench-scroll-height: calc(100vh - 3rem);
}

h1,
h2,
h3,
.hero-badge {
  font-family: "Fraunces", "Times New Roman", serif;
}

.bg-glow,
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  background: radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--critical) 13%, transparent), transparent 45%),
    radial-gradient(circle at 70% 40%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 50%);
}

.bg-grid {
  background-image: linear-gradient(rgba(16, 19, 23, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 19, 23, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.6;
}

.hero {
  padding: 4.5rem 0 3rem;
  position: relative;
  z-index: 1;
}

.app-shell {
  width: calc(100vw - (var(--app-gutter) * 2));
  max-width: none;
  margin-inline: auto;
}

.app-main {
  position: relative;
  z-index: 1;
}

.hero.hero-compact {
  padding: 0.72rem 0.85rem 0.68rem;
  position: relative;
  z-index: 40;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  box-shadow: 0 16px 34px rgba(16, 19, 23, 0.12);
  backdrop-filter: blur(18px);
}

body.chrome-pinned .hero.hero-compact {
  position: sticky;
  top: 0;
  border-top: 0;
  border-radius: 0 0 16px 16px;
}

body.chrome-unpinned .hero.hero-compact {
  position: static !important;
  top: auto !important;
  border-top: 1px solid var(--line-soft);
  border-radius: 16px;
}

.hero.hero-compact + main {
  margin-top: 1.1rem;
}

.hero-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.hero-auth {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.6rem;
  position: relative;
  flex-wrap: wrap;
}

.chrome-pin-toggle {
  width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  border-radius: 999px;
  font-weight: 700;
  padding: 0;
  white-space: nowrap;
  order: 100;
}

.chrome-pin-toggle i {
  font-size: 1.08rem;
  line-height: 1;
}

.chrome-pin-toggle[aria-pressed="true"] {
  color: var(--primary-text);
  border-color: var(--primary-border);
  background: var(--primary-bg);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary-border) 60%, transparent);
}

.workspace-org-switcher {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.34rem 0.56rem;
  border: 1px solid rgba(16, 19, 23, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  min-height: 40px;
}

.workspace-org-switcher-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin: 0;
  white-space: nowrap;
}

.workspace-org-switcher .form-select {
  min-width: 160px;
  border-radius: 999px;
  font-size: 0.88rem;
  line-height: 1.2;
}

.job-alert-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.job-alert-bell {
  position: relative;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.job-alert-bell i {
  font-size: 1.15rem;
  line-height: 1;
}

.job-alert-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--danger), var(--critical));
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 19px;
  box-shadow: 0 6px 16px rgba(16, 19, 23, 0.22);
}

.job-alert-panel {
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 0;
  z-index: 20;
  width: min(390px, calc(100vw - 2rem));
  max-height: min(620px, calc(100vh - 7rem));
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.job-alert-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem 0.65rem;
  border-bottom: 1px solid var(--line-soft);
}

.job-alert-header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}

.job-alert-mark-viewed {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--success-text);
  font-size: 0.76rem;
  font-weight: 800;
  padding: 0.18rem 0.5rem;
  white-space: nowrap;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.job-alert-mark-viewed:hover,
.job-alert-mark-viewed:focus {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--ink);
  outline: none;
}

.job-alert-mark-viewed:disabled,
.job-alert-mark-viewed.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.job-alert-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
}

.job-alert-tab {
  min-height: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.job-alert-tab.active {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
  color: var(--ink);
}

.job-alert-list {
  max-height: min(480px, calc(100vh - 14rem));
  overflow: auto;
  padding: 0.5rem;
}

.job-alert-empty {
  padding: 1rem;
  font-size: 0.9rem;
}

.job-alert-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.job-alert-item:hover,
.job-alert-item:focus {
  border-color: var(--line-soft);
  background: rgba(255, 255, 255, 0.58);
  outline: none;
}

.job-alert-item.is-unviewed {
  border-color: var(--danger-border);
  background: color-mix(in srgb, var(--danger-bg) 76%, transparent);
}

.job-alert-item-main {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.job-alert-item-title {
  font-weight: 800;
  line-height: 1.2;
}

.job-alert-item-meta,
.job-alert-item-message {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.job-alert-item-message {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.job-alert-item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.job-alert-resolve {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--success-text);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.job-alert-resolve:hover,
.job-alert-resolve:focus {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--ink);
  outline: none;
}

.form-check.form-switch .form-check-input {
  width: 2.8rem;
  height: 1.45rem;
  margin: 0 !important;
  margin-left: 0 !important;
  cursor: pointer;
  float: none !important;
  position: relative;
  top: 0;
  align-self: center;
  flex: 0 0 auto;
}

.form-check.form-switch {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 1.45rem;
  padding-left: 0;
  margin-bottom: 0;
}

.form-check.form-switch .form-check-label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  line-height: 1.15;
  min-height: 1.45rem;
}

.theme-switch {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.72rem 0.42rem 0.9rem;
  border: 1px solid rgba(16, 19, 23, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  min-height: 40px;
  white-space: nowrap;
}

.theme-switch .form-check-input {
  margin: 0;
}

.theme-switch.form-check.form-switch .form-check-input {
  margin-left: var(--switch-pill-toggle-gap) !important;
}

.theme-switch-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1;
  user-select: none;
}

.hero-badge {
  display: inline-flex;
  padding: 0.35rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--warning-border) 58%, var(--accent-border) 42%);
  background: linear-gradient(135deg, color-mix(in srgb, var(--warning) 88%, #ffffff 12%), color-mix(in srgb, var(--accent) 78%, #ffffff 22%));
  color: #0f172a;
  border-radius: 999px;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--warning) 18%, transparent);
}

.hero h1 {
  font-size: clamp(2.5rem, 4vw, 3.6rem);
  margin-top: 1rem;
  max-width: 750px;
}

.hero.hero-compact h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin-top: 0.75rem;
  max-width: 640px;
}

.hero-lede {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 640px;
  margin-top: 1rem;
}

.hero.hero-compact .hero-lede {
  font-size: 1rem;
  margin-top: 0.6rem;
}

.hero-actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero.hero-compact .hero-actions {
  margin-top: 0;
}

.ops-header {
  margin-top: 0.7rem;
  padding: 0.58rem 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1.8fr);
  align-items: center;
  gap: 0.7rem;
}

.ops-context-line {
  color: var(--muted);
  font-size: 0.85rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-stats {
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-width: 0;
}

.ops-stat {
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface) 76%, white 24%);
  padding: 0.35rem 0.62rem;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  min-width: max-content;
}

.ops-stat-label {
  color: var(--muted);
  font-size: 0.72rem;
}

.ops-stat-value {
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
}

.ops-header .hero-actions {
  margin-top: 0;
  flex-wrap: nowrap;
  gap: 0.45rem;
}

.ops-header .hero-actions .btn {
  padding: 0.38rem 0.68rem;
  font-size: 0.84rem;
  white-space: nowrap;
}

.section-card {
  background: var(--panel);
  backdrop-filter: blur(6px);
  border-radius: 20px;
  padding: clamp(1.25rem, 1.6vw, 2rem);
  margin-bottom: 1.75rem;
  box-shadow: 0 14px 42px rgba(16, 19, 23, 0.12);
  border: 1px solid rgba(16, 19, 23, 0.08);
  position: relative;
  z-index: 1;
}

.section-card.is-hidden {
  display: none;
}

.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.62rem 0 0;
  padding: 0;
  position: relative;
  z-index: 1;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.scope-guardrail {
  margin: 0 0 1.5rem;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(16, 19, 23, 0.12);
  background: rgba(255, 255, 255, 0.56);
}

[data-section] {
  scroll-margin-top: 1.25rem;
}

body.chrome-pinned [data-section] {
  scroll-margin-top: var(--sticky-chrome-height);
}

.tab-button {
  border: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--card) 80%, transparent);
  color: var(--navy);
  border-radius: 999px;
  padding: 0.42rem 0.9rem;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tab-button.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: color-mix(in srgb, var(--primary) 40%, var(--accent) 60%);
  color: #ffffff;
  box-shadow: 0 12px 26px var(--primary-glow);
}

.tab-button:hover {
  transform: translateY(-1px);
}

/* Sub-tab rows share one look; .org-subtab-button is the shared pill style.
   (Consolidating the three sub-tab implementations is a later pass - this at
   least keeps them visually identical.) */
.organization-subtabs,
.history-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.org-subtab-button {
  border: 1px solid rgba(16, 19, 23, 0.2);
  background: rgba(255, 255, 255, 0.8);
  color: var(--navy);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.org-subtab-button.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: color-mix(in srgb, var(--primary) 40%, var(--accent) 60%);
  color: #ffffff;
  box-shadow: 0 10px 22px var(--primary-glow);
}

.org-subtab-button:hover {
  transform: translateY(-1px);
}

.organization-tab-panel.is-hidden {
  display: none;
}

.settings-provider-logo {
  height: 18px;
  max-width: 90px;
  margin-right: 0.45rem;
}

.provider-advanced {
  border: 1px solid rgba(16, 19, 23, 0.16);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  background: rgba(16, 42, 67, 0.05);
}

.provider-advanced > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
}

.provider-advanced > summary::-webkit-details-marker {
  display: none;
}

.provider-advanced > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.45rem;
  transition: transform 0.16s ease;
}

.provider-advanced[open] > summary::before {
  transform: rotate(90deg);
}

.provider-advanced-body {
  margin-top: 0.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.divider-line {
  height: 1px;
  background: rgba(16, 19, 23, 0.1);
  margin: 1rem 0 0.75rem;
}

.section-subtitle {
  font-size: 1rem;
  margin: 0 0 0.35rem;
  color: var(--navy);
}

.section-header p {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.75rem;
  gap: 0.35rem;
  border: 1px solid var(--neutral-border);
  background: var(--neutral-bg);
  color: var(--neutral-text);
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #ffffff 35%, transparent);
}

.pill-success,
.pill-warning,
.pill-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.75rem;
  gap: 0.35rem;
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--neutral-border);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #ffffff 35%, transparent);
}

.pill.primary,
.pill.active,
.pill.info,
.pill.queued {
  border-color: var(--info-border);
  background: var(--info-bg);
  color: var(--info-text);
}

.pill.accent,
.pill.running {
  border-color: var(--accent-border);
  background: var(--accent-bg);
  color: var(--accent-text);
}

.pill.success,
.pill.completed,
.pill.healthy,
.pill.connected,
.pill-success {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.pill.warning,
.pill.pending,
.pill.update,
.pill-warning {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.pill.danger,
.pill.failed,
.pill.error,
.pill-danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.pill.critical,
.pill.vulnerable {
  border-color: var(--critical-border);
  background: var(--critical-bg);
  color: var(--critical-text);
}

.pill.muted,
.pill.neutral,
.pill.resolved,
.pill.skipped,
.pill.cancelled,
.pill.unknown,
.pill.disabled {
  border-color: var(--neutral-border);
  background: var(--neutral-bg);
  color: var(--neutral-text);
}

.session-menu {
  position: relative;
}

.session-menu-trigger {
  border: 1px solid rgba(16, 19, 23, 0.14);
  cursor: pointer;
}

.session-menu-trigger::after {
  content: "▾";
  margin-left: 0.45rem;
  font-size: 0.78rem;
  opacity: 0.75;
}

.session-menu.open .session-menu-trigger::after {
  content: "▴";
}

.session-menu-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 180px;
  z-index: 20;
  border-radius: 12px;
  border: 1px solid rgba(16, 19, 23, 0.14);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 28px rgba(16, 19, 23, 0.16);
  padding: 0.3rem;
}

.session-menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--navy);
  font-size: 0.9rem;
  padding: 0.45rem 0.6rem;
}

.session-menu-item:hover,
.session-menu-item:focus-visible {
  background: rgba(16, 42, 67, 0.08);
  outline: none;
}

.account-modal-body .section-subtitle {
  margin-top: 0;
}

.diff-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.diff-raw {
  margin-top: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(16, 19, 23, 0.12);
  background: rgba(16, 19, 23, 0.04);
  max-height: 280px;
  overflow: auto;
}

.diff-raw pre {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--navy);
  white-space: pre-wrap;
  word-break: break-word;
}

.stacked {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.button-row {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
  margin-top: 0.65rem;
}

.button-row .btn {
  flex: 1 1 0;
}

.button-row .btn-xs {
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
  line-height: 1.1;
}

.totp-qr-wrap {
  border: 1px dashed rgba(16, 19, 23, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.66);
  min-height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

.totp-qr {
  width: 220px;
  height: 220px;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(16, 19, 23, 0.14);
  background: #fff;
}

.inline-field-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: end;
}

.inline-field-actions-top {
  align-items: start;
}

.totp-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.26rem 0.7rem;
  border: 1px solid rgba(16, 19, 23, 0.15);
  color: var(--muted);
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.7);
}

.step-pill.active {
  border-color: transparent;
  background: rgba(242, 95, 76, 0.16);
  color: var(--navy);
  font-weight: 600;
}

.recovery-code-list {
  border: 1px solid rgba(16, 19, 23, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  padding: 0.55rem;
  max-height: 220px;
  overflow: auto;
}

.recovery-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.4rem 0.45rem;
  border-radius: 8px;
}

.recovery-code-row + .recovery-code-row {
  margin-top: 0.25rem;
}

.recovery-code-row.is-used {
  background: rgba(16, 19, 23, 0.04);
}

.recovery-code-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.89rem;
  letter-spacing: 0.03em;
}

.recovery-code-row.is-used .recovery-code-value {
  text-decoration: line-through;
  opacity: 0.75;
}

.recovery-code-status {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.list-header-actions .btn-xs {
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
  line-height: 1.1;
}

.list-surface {
  border-radius: 20px;
  border: 1px solid rgba(16, 19, 23, 0.08);
  overflow: hidden;
  background: white;
}

.tenant-workbench,
.sync-workbench,
.history-workbench {
  display: grid;
  gap: var(--workbench-gap);
  align-items: start;
}

.tenant-workbench {
  grid-template-columns: minmax(300px, 0.72fr) minmax(540px, 1.3fr) minmax(320px, 0.78fr);
}

.sync-workbench {
  grid-template-columns: minmax(320px, 0.55fr) minmax(620px, 1.45fr);
}

.history-workbench {
  grid-template-columns: minmax(380px, 0.72fr) minmax(680px, 1.28fr);
}

.history-trend-workbench {
  display: block;
}

.tenant-rail,
.sync-rail,
.history-rail {
  min-width: 0;
}

.tenant-rail-form,
.tenant-rail-detail,
.sync-rail-controls,
.history-rail-detail {
  position: sticky;
  top: 1rem;
}

body.chrome-pinned .tenant-rail-form,
body.chrome-pinned .tenant-rail-detail,
body.chrome-pinned .sync-rail-controls,
body.chrome-pinned .history-rail-detail {
  top: calc(var(--sticky-chrome-height) + 1rem);
}

.tenant-rail-registry .list-surface {
  display: flex;
  flex-direction: column;
  max-height: var(--tenant-workbench-scroll-height);
  min-height: min(32rem, var(--tenant-workbench-scroll-height));
}

#tenantList {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tenant-detail-panel {
  border-radius: 20px;
  border: 1px solid rgba(16, 19, 23, 0.08);
  overflow: hidden;
  background: var(--card);
  display: flex;
  flex-direction: column;
  max-height: var(--tenant-workbench-scroll-height);
  min-height: min(24rem, var(--tenant-workbench-scroll-height));
}

.tenant-detail-panel-body {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.tenant-detail-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.tenant-health-card.is-selected {
  border-color: color-mix(in srgb, var(--primary) 65%, var(--line-soft) 35%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 26%, transparent);
}

.tenant-health-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1.2rem 0 1.5rem;
}

.tenant-health-tile {
  border: 1px solid rgba(16, 19, 23, 0.1);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  background: color-mix(in srgb, var(--card) 86%, white 14%);
}

.tenant-health-tile-label,
.tenant-health-meta-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

/* Sync volume ---------------------------------------------------------- */
.sync-volume-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
  margin: 1.2rem 0 0.4rem;
}

.sync-volume-tile {
  border: 1px solid rgba(16, 19, 23, 0.1);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  background: color-mix(in srgb, var(--card) 86%, white 14%);
}

.sync-volume-tile-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.sync-volume-tile strong {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.sync-volume-tile .sync-volume-tile-sub {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

/* The headline number is unique inventory; throughput is deliberately
   de-emphasised so the two are never read as the same thing. */
.sync-volume-tile.is-secondary {
  background: transparent;
}

.sync-volume-table td.num,
.sync-volume-table th.text-end {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

html[data-theme="dark"] .sync-volume-tile {
  border-color: rgba(219, 230, 238, 0.12);
}

.tenant-card-list {
  display: grid;
  gap: 0.85rem;
  padding: 0.9rem;
}

.tenant-health-card {
  border: 1px solid rgba(16, 19, 23, 0.1);
  border-left-width: 4px;
  border-radius: 16px;
  padding: 1rem;
  background: color-mix(in srgb, var(--card) 94%, white 6%);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.tenant-health-card:hover,
.tenant-health-card:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 62%, var(--line-soft) 38%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 22%, transparent);
  transform: translateY(-1px);
  outline: none;
}

.tenant-health-card.is-healthy {
  border-left-color: var(--success);
}

.tenant-health-card.is-update {
  border-left-color: var(--warning);
}

.tenant-health-card.is-vulnerable,
.tenant-health-card.is-error {
  border-left-color: var(--danger);
}

.tenant-health-card.is-unknown {
  border-left-color: var(--muted);
}

.tenant-health-card-main {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr);
  gap: 1rem;
}

.tenant-health-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.tenant-health-meta-grid,
.tenant-health-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.tenant-health-error {
  margin-top: 0.8rem;
  color: var(--danger);
  font-size: 0.92rem;
}

.tenant-health-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.pill-success {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.pill-warning {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.pill-danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.tenant-security-panel {
  border: 1px solid rgba(16, 19, 23, 0.08);
  border-radius: 20px;
  overflow: hidden;
  margin-top: 1.5rem;
  background: var(--card);
}

.tenant-security-list {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
}

.tenant-security-row,
.tenant-security-advisory {
  border: 1px solid rgba(16, 19, 23, 0.08);
  border-radius: 14px;
  padding: 0.9rem;
  background: color-mix(in srgb, var(--card) 94%, white 6%);
}

.tenant-security-advisories {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.tenant-security-advisory {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.tenant-security-advisory-detail {
  margin-top: 0.7rem;
}

.tenant-update-checklist {
  display: grid;
  gap: 0.7rem;
  margin: 1rem 0 1.2rem;
  padding-left: 1.2rem;
}

.maintenance-panel {
  display: grid;
  gap: 0.85rem;
}

.maintenance-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0.9rem;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 92%, var(--primary) 8%);
}

.maintenance-warnings {
  display: grid;
  gap: 0.45rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--warning-border);
  border-radius: 14px;
  background: var(--warning-bg);
  color: var(--warning-text);
}

.maintenance-grid {
  display: grid;
  gap: 0.85rem;
}

.maintenance-command-card {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 94%, #0b1220 6%);
}

.maintenance-command-card-optional {
  border-style: dashed;
}

.maintenance-command-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line-soft);
}

.maintenance-command-card pre {
  margin: 0;
  padding: 0.9rem;
  overflow-x: auto;
  color: var(--text);
  background: color-mix(in srgb, var(--bg) 78%, #000 22%);
}

.maintenance-command-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre;
}

.list-surface.help-tooltip-container {
  overflow: visible;
}

.list-surface.help-tooltip-container > .list-header {
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}

.list-surface.help-tooltip-container > .p-4:last-child {
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
}

.sync-job-item {
  cursor: pointer;
}

.dataset-item {
  cursor: pointer;
}

.dataset-item.active {
  background: #0b4fbf;
  color: #fff;
}

.list-group-item.active {
  background: #0b4fbf;
  color: #fff;
}

.dataset-item.active strong,
.dataset-item.active .muted,
.dataset-item.active .small,
.list-group-item.active strong,
.list-group-item.active .muted,
.list-group-item.active .small {
  color: rgba(255, 255, 255, 0.95);
}

.dataset-item.active .pill,
.list-group-item.active .pill {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--stone);
  font-weight: 600;
}

.list-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.list-header-actions .form-select.form-select-sm {
  min-width: 130px;
  width: auto;
}

.integration-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.integration-tab {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border-radius: 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.integration-tab.active,
.integration-tab[aria-pressed="true"] {
  border-color: var(--primary-border);
  background: linear-gradient(135deg, var(--primary-bg), var(--accent-bg));
  box-shadow: 0 0 0 1px var(--primary-glow);
}

.integration-tab:not(.active):not([aria-pressed="true"]) .integration-icon {
  opacity: 0.86;
}

.integration-tab i {
  font-size: 0.95rem;
  margin-right: 0;
}

.integration-icon {
  height: 24px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  vertical-align: middle;
}

.integration-panel .list-header i,
.integration-panel h3 i {
  font-size: 1rem;
  margin-right: 8px;
}

.integration-panel {
  display: none !important;
}

.integration-panel.active {
  display: block !important;
}

.integration-panel .row.g-4 {
  --bs-gutter-y: 1rem;
}

.integration-placeholder {
  border: 1px dashed rgba(16, 19, 23, 0.15);
  background: rgba(255, 255, 255, 0.7);
}

.integration-block {
  margin-top: 1.2rem;
}

.subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.subsection-header h3 {
  margin: 0;
}

.list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid rgba(16, 19, 23, 0.08);
  background: white;
}

.history-facets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.history-facet-chip {
  border: 1px solid rgba(16, 19, 23, 0.16);
  background: rgba(16, 42, 67, 0.04);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.25;
}

.history-facet-chip.active {
  background: var(--primary-bg);
  border-color: var(--primary-border);
  color: var(--primary-text);
}

.history-job-item {
  padding: 0.8rem 1rem;
}

#historySection .list-surface {
  display: flex;
  flex-direction: column;
}

#fullSyncHistory {
  max-height: clamp(380px, 58vh, 900px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.history-job-row {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) minmax(220px, auto);
  gap: 0.85rem;
  align-items: center;
}

.history-job-select {
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-job-main {
  min-width: 0;
}

.history-job-title {
  font-weight: 700;
  line-height: 1.25;
}

.history-job-subtitle {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-job-metrics {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.history-metric {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: rgba(16, 42, 67, 0.06);
  font-size: 0.76rem;
}

.history-empty-state {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.35rem 0;
}

.history-trend-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.history-trend-controls .form-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.history-trend-controls .form-select {
  width: min(260px, 100%);
}

.history-trend-presets {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.history-trend-presets .btn.active {
  background: rgba(11, 79, 191, 0.16);
  border-color: rgba(11, 79, 191, 0.5);
  color: var(--ink);
}

#historyTrendCompareMode.active {
  background: rgba(11, 79, 191, 0.16);
  border-color: rgba(11, 79, 191, 0.5);
  color: var(--ink);
}

.history-trend-zoom {
  margin: 0.25rem 0 0.8rem;
  border: 1px solid rgba(16, 19, 23, 0.1);
  border-radius: 12px;
  padding: 0.55rem 0.75rem 0.45rem;
  background: rgba(16, 42, 67, 0.03);
}

.history-trend-zoom-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.3rem;
}

.history-trend-zoom-head .btn-xs {
  margin-left: auto;
}

.history-trend-zoom-track {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem;
}

.history-trend-zoom-track .form-range {
  margin: 0;
}

.history-trend-panel .history-trend-chart {
  min-height: 430px;
}

.history-trend-canvas {
  border: 1px solid rgba(16, 19, 23, 0.1);
  border-radius: 12px;
  padding: 0.45rem 0.5rem 0.35rem;
  background: rgba(16, 42, 67, 0.03);
}

.history-trend-svg {
  display: block;
  width: 100%;
  height: auto;
}

.history-trend-grid line {
  stroke: rgba(16, 19, 23, 0.11);
  stroke-width: 1;
}

.history-trend-axis {
  stroke: rgba(16, 19, 23, 0.32);
  stroke-width: 1.2;
}

.history-trend-y-tick,
.history-trend-x-tick,
.history-trend-axis-title {
  fill: color-mix(in srgb, var(--muted) 90%, var(--ink) 10%);
  font-size: 12px;
}

.history-trend-y2-tick {
  fill: color-mix(in srgb, var(--muted) 88%, var(--ink) 12%);
  font-size: 12px;
}

.history-trend-axis-title {
  font-weight: 600;
}

.history-trend-axis-title-right {
  fill: color-mix(in srgb, #4ea2ff 78%, var(--ink) 22%);
}

.history-trend-area {
  fill: rgba(11, 79, 191, 0.18);
}

.history-trend-line {
  fill: none;
  stroke: rgba(11, 79, 191, 0.94);
  stroke-width: 2.4;
}

.history-trend-line-secondary {
  fill: none;
  stroke: rgba(16, 185, 129, 0.95);
  stroke-width: 2;
  stroke-dasharray: 5 3;
}

.history-trend-point {
  fill: #fff;
  stroke: rgba(11, 79, 191, 0.98);
  stroke-width: 1.8;
}

.history-trend-point-secondary {
  fill: #ffffff;
  stroke: rgba(16, 185, 129, 0.98);
  stroke-width: 1.6;
}

.history-trend-hover-guide {
  stroke: rgba(59, 130, 246, 0.55);
  stroke-width: 1.4;
  stroke-dasharray: 5 4;
  pointer-events: none;
}

.history-trend-now-anchor {
  fill: #0f172a;
  stroke: rgba(121, 179, 255, 0.98);
  stroke-width: 1.6;
}

.history-trend-now-connector {
  stroke: rgba(121, 179, 255, 0.78);
  stroke-width: 1.1;
}

.history-trend-now-tag {
  fill: rgba(11, 79, 191, 0.16);
  stroke: rgba(11, 79, 191, 0.72);
  stroke-width: 1;
}

.history-trend-now-text {
  fill: #0b4fbf;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.history-trend-events {
  margin: 0.2rem 0.15rem 0.15rem;
}

.history-trend-events-title {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.history-trend-events-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.65rem;
  margin-bottom: 0.45rem;
  align-items: center;
}

.history-trend-events-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  color: var(--muted);
}

.history-trend-events-legend-dot {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 999px;
  display: inline-block;
  border: 1px solid rgba(16, 19, 23, 0.14);
  background: rgba(148, 163, 184, 0.4);
}

.history-trend-events-legend-dot.is-status-completed {
  background: var(--success);
}

.history-trend-events-legend-dot.is-status-failed {
  background: var(--danger);
}

.history-trend-events-legend-dot.is-status-running {
  background: var(--warning);
}

.history-trend-events-legend-dot.is-status-queued {
  background: var(--info);
}

.history-trend-events-legend-dot.is-status-cancelled {
  background: rgba(107, 114, 128, 0.92);
}

.history-trend-events-legend-dot.is-status-other {
  background: rgba(148, 163, 184, 0.9);
}

.history-trend-events-legend-badge {
  width: 0.88rem;
  height: 0.88rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  font-weight: 800;
  color: #fff;
  background: rgba(220, 38, 38, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.9);
  line-height: 1;
}

.history-trend-events-plot {
  position: relative;
  height: 72px;
}

.history-trend-events-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 30px;
  border-top: 1px solid rgba(16, 19, 23, 0.24);
}

.history-trend-job-marker {
  --trend-marker-bg: rgba(16, 42, 67, 0.9);
  --trend-marker-border: rgba(11, 79, 191, 0.94);
  --trend-marker-glow: rgba(11, 79, 191, 0.38);
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 2px solid var(--trend-marker-border);
  background: var(--trend-marker-bg);
  transform: translate(-50%, 0);
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  z-index: 1;
}

.history-trend-job-marker.is-status-completed {
  --trend-marker-bg: var(--success-bg);
  --trend-marker-border: var(--success);
  --trend-marker-glow: color-mix(in srgb, var(--success) 36%, transparent);
}

.history-trend-job-marker.is-status-failed {
  --trend-marker-bg: var(--danger-bg);
  --trend-marker-border: var(--danger);
  --trend-marker-glow: color-mix(in srgb, var(--danger) 40%, transparent);
}

.history-trend-job-marker.is-status-running {
  --trend-marker-bg: var(--warning-bg);
  --trend-marker-border: var(--warning);
  --trend-marker-glow: color-mix(in srgb, var(--warning) 38%, transparent);
}

.history-trend-job-marker.is-status-queued {
  --trend-marker-bg: var(--info-bg);
  --trend-marker-border: var(--info);
  --trend-marker-glow: color-mix(in srgb, var(--info) 36%, transparent);
}

.history-trend-job-marker.is-status-cancelled {
  --trend-marker-bg: rgba(107, 114, 128, 0.3);
  --trend-marker-border: rgba(107, 114, 128, 0.92);
  --trend-marker-glow: rgba(107, 114, 128, 0.35);
}

.history-trend-job-marker.is-status-other {
  --trend-marker-bg: rgba(148, 163, 184, 0.28);
  --trend-marker-border: rgba(148, 163, 184, 0.94);
  --trend-marker-glow: rgba(148, 163, 184, 0.35);
}

.history-trend-job-marker.is-child {
  width: 9px;
  height: 9px;
  border-width: 1.8px;
}

.history-trend-job-marker.is-cluster {
  width: 24px;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  border: 0;
  background: var(--cluster-ring, rgba(11, 79, 191, 0.24));
  color: #10243f;
  position: absolute;
}

.history-trend-job-marker.is-cluster.is-cluster-xs {
  width: 20px;
  min-width: 20px;
  height: 20px;
  font-size: 0.56rem;
}

.history-trend-job-marker.is-cluster.is-cluster-sm {
  width: 23px;
  min-width: 23px;
  height: 23px;
}

.history-trend-job-marker.is-cluster.is-cluster-md {
  width: 26px;
  min-width: 26px;
  height: 26px;
  font-size: 0.64rem;
}

.history-trend-job-marker.is-cluster.is-cluster-lg {
  width: 30px;
  min-width: 30px;
  height: 30px;
  font-size: 0.68rem;
}

.history-trend-job-marker.is-cluster::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 999px;
  background: rgba(245, 248, 252, 0.92);
  border: 1px solid rgba(16, 19, 23, 0.18);
  z-index: 1;
}

.history-trend-job-marker.is-cluster span {
  position: relative;
  z-index: 2;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.history-trend-job-marker.is-cluster.has-failed::after {
  content: "!";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.98);
  color: #fff;
  font-size: 0.52rem;
  font-weight: 800;
  line-height: 11px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(16, 19, 23, 0.12);
  z-index: 3;
  pointer-events: none;
}

.history-trend-job-marker.is-compare {
  border-color: rgba(245, 158, 11, 0.95);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.32), 0 0 0 4px rgba(245, 158, 11, 0.16);
}

.history-trend-job-marker:hover,
.history-trend-job-marker:focus {
  background: color-mix(in srgb, var(--trend-marker-bg) 78%, #ffffff 22%);
  border-color: color-mix(in srgb, var(--trend-marker-border) 84%, #ffffff 16%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--trend-marker-glow) 72%, transparent 28%);
  transform: translate(-50%, -1px) scale(1.2);
  outline: none;
  z-index: 3;
}

.history-trend-job-marker.is-cluster:hover,
.history-trend-job-marker.is-cluster:focus {
  background: var(--cluster-ring, rgba(11, 79, 191, 0.24));
  border-color: transparent;
  box-shadow: 0 0 0 2px rgba(11, 79, 191, 0.24), 0 0 0 4px rgba(11, 79, 191, 0.14);
  transform: translate(-50%, -1px) scale(1.12);
}

.history-trend-job-marker.is-active {
  background: rgba(11, 79, 191, 1);
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(11, 79, 191, 0.26);
  transform: translate(-50%, -1px) scale(1.26);
  z-index: 4;
}

.history-trend-events-hover {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  min-height: 3.2rem;
}

.history-trend-hover-card {
  border: 1px solid rgba(16, 19, 23, 0.14);
  border-radius: 10px;
  background: rgba(16, 42, 67, 0.05);
  padding: 0.4rem 0.55rem;
}

.history-trend-hover-empty {
  opacity: 0.9;
}

.history-trend-hover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.history-trend-hover-status {
  text-transform: capitalize;
  border-radius: 999px;
  padding: 0.06rem 0.4rem;
  border: 1px solid rgba(16, 19, 23, 0.15);
  font-size: 0.68rem;
  background: rgba(16, 42, 67, 0.08);
}

.history-trend-hover-status.is-completed {
  color: #1f5139;
  border-color: rgba(22, 163, 74, 0.4);
  background: rgba(22, 163, 74, 0.12);
}

.history-trend-hover-status.is-failed {
  color: #7f1d1d;
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
}

.history-trend-hover-meta {
  margin-top: 0.18rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.history-trend-hover-metrics {
  margin-top: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  font-size: 0.7rem;
}

.history-trend-hover-metrics span {
  border-radius: 999px;
  border: 1px solid rgba(16, 19, 23, 0.15);
  padding: 0.02rem 0.35rem;
  background: rgba(16, 42, 67, 0.06);
}

.history-trend-hover-breakdown {
  margin-top: 0.32rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.2rem 0.45rem;
}

.history-trend-hover-breakdown-item {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.7rem;
  color: var(--ink);
}

.history-trend-hover-breakdown-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  display: inline-block;
}

.history-trend-hover-breakdown-dot.is-status-completed {
  background: rgba(22, 163, 74, 0.95);
}

.history-trend-hover-breakdown-dot.is-status-failed {
  background: rgba(239, 68, 68, 0.95);
}

.history-trend-hover-breakdown-dot.is-status-running {
  background: rgba(245, 158, 11, 0.95);
}

.history-trend-hover-breakdown-dot.is-status-queued {
  background: rgba(99, 102, 241, 0.95);
}

.history-trend-hover-breakdown-dot.is-status-cancelled {
  background: rgba(107, 114, 128, 0.95);
}

.history-trend-hover-breakdown-dot.is-status-other {
  background: rgba(148, 163, 184, 0.95);
}

.history-trend-legend {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.history-job-item.is-compare-selected:not(.active) {
  border-left: 3px solid rgba(245, 158, 11, 0.8);
}

@media (max-width: 900px) {
  .history-trend-controls {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .history-trend-controls .form-select {
    max-width: 100%;
  }

  .history-trend-panel .history-trend-chart {
    min-height: 320px;
  }
}

.history-compare-card {
  border: 1px solid rgba(16, 19, 23, 0.1);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  background: rgba(16, 42, 67, 0.04);
}

.history-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.history-compare-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.history-compare-section h4 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
}

.history-compare-table {
  border: 1px solid rgba(16, 19, 23, 0.1);
  border-radius: 12px;
  padding: 0.4rem 0.5rem;
  background: rgba(16, 42, 67, 0.03);
}

.history-compare-values {
  font-size: 0.92rem;
  font-weight: 600;
}

.history-compare-delta {
  font-size: 0.82rem;
  color: var(--muted);
}

.history-compare-delta.is-up {
  color: #0f8a42;
}

.history-compare-delta.is-down {
  color: #c23f52;
}

.history-delta-table td {
  vertical-align: middle;
  font-size: 0.82rem;
}

@media (max-width: 992px) {
  .history-job-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .history-job-metrics {
    grid-column: 1 / -1;
    justify-content: flex-start;
    margin-left: 1.9rem;
  }
}

.list-action-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.15rem 0.25rem;
  padding-left: 0.45rem;
  border: 1px solid rgba(16, 19, 23, 0.12);
  border-radius: 999px;
  background: rgba(16, 42, 67, 0.04);
}

.list-action-switch .form-check-input {
  float: none;
  margin: 0;
  flex: 0 0 auto;
}

.list-action-switch.form-check.form-switch .form-check-input {
  margin-left: var(--switch-pill-toggle-gap) !important;
}

.list-action-switch .form-check-label {
  font-size: 0.82rem;
  white-space: nowrap;
  margin: 0;
}

.config-panel {
  background: rgba(16, 42, 67, 0.08);
  border-radius: 20px;
  padding: 1.5rem;
}

.template-panel {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 20px;
  padding: 1.5rem;
  border: 1px solid rgba(16, 19, 23, 0.08);
  box-shadow: var(--shadow);
}

.dataset-panel {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 20px;
  padding: 1.5rem;
  border: 1px solid rgba(16, 19, 23, 0.08);
  box-shadow: var(--shadow);
}

.dataset-item-disabled {
  opacity: 0.6;
}

.dataset-usage {
  margin-top: 0.75rem;
}

.dataset-mode-hint {
  margin-bottom: 0.85rem;
}

#datasetString[readonly] {
  background: rgba(16, 42, 67, 0.06);
}

.template-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
}

.template-subhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.template-queries {
  margin-top: 1.2rem;
}

.template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  align-items: center;
}

.template-sync {
  margin-top: 1.3rem;
  padding-top: 1.2rem;
  border-top: 1px dashed rgba(16, 19, 23, 0.18);
}

.config-steps {
  margin-bottom: 1.5rem;
}

.config-steps-title {
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.6rem;
}

.stepper {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.step {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  border: 1px dashed rgba(16, 19, 23, 0.2);
  background: rgba(255, 255, 255, 0.7);
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  background: var(--stone);
  color: var(--navy);
}

.step-title {
  font-weight: 600;
}

.step-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.step-status {
  font-size: 0.72rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(16, 42, 67, 0.08);
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.step.active {
  border-color: rgba(242, 95, 76, 0.35);
  background: rgba(242, 95, 76, 0.12);
}

.step.active .step-status {
  background: rgba(242, 95, 76, 0.18);
  color: var(--coral);
}

.step.done {
  border-color: rgba(27, 153, 139, 0.4);
}

.step.done .step-number {
  background: var(--teal);
  color: white;
}

.step.done .step-status {
  background: rgba(27, 153, 139, 0.18);
  color: var(--teal);
}

.step.locked {
  opacity: 0.55;
}

.next-action {
  box-shadow: 0 0 0 3px rgba(244, 211, 94, 0.5);
  animation: pulseGlow 1.8s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(244, 211, 94, 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(244, 211, 94, 0.2);
  }
}

.config-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.config-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
}

.status-panel {
  background: white;
  border-radius: 20px;
  padding: 1.5rem;
  border: 1px solid rgba(16, 19, 23, 0.08);
  box-shadow: var(--shadow);
}

.section-card .status-panel,
.section-card .list-surface {
  box-shadow: none;
}

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.status-header h3 {
  margin-bottom: 0.25rem;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.status-grid > div {
  min-width: 0;
}

.auto-sync-quick-view {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(16, 19, 23, 0.12);
}

.auto-sync-quick-list {
  margin-top: 0.5rem;
  max-height: 220px;
  overflow: auto;
  display: grid;
  gap: 0.45rem;
}

.auto-sync-quick-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid rgba(16, 19, 23, 0.12);
  border-radius: 12px;
  padding: 0.45rem 0.55rem;
  background: rgba(16, 19, 23, 0.02);
}

.auto-sync-quick-item .pill {
  white-space: nowrap;
}

.diff-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.diff-filters {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.diff-filters .form-control {
  flex: 1 1 auto;
}

.diff-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  margin: -0.35rem 0 0.9rem;
}

.diff-pagination .small {
  min-width: 11rem;
  text-align: center;
}

.diff-page-size {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.diff-page-size .form-select {
  width: 5.25rem;
}

.diff-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--neutral-border);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--neutral-bg);
  color: var(--neutral-text);
}

.diff-pill[role="button"] {
  cursor: pointer;
}

.diff-pill.is-selected {
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.diff-pill.create {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.diff-pill.update {
  border-color: var(--info-border);
  background: var(--info-bg);
  color: var(--info-text);
}

.diff-pill.archive {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.diff-pill.unarchive {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.diff-pill.delete {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.diff-pill.blocked {
  border-color: var(--neutral-border);
  background: var(--neutral-bg);
  color: var(--neutral-text);
}

.diff-pill.error,
.diff-pill.errors {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.diff-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 520px;
  max-height: 520px;
  overflow: auto;
}

.diff-item {
  border-radius: 14px;
  border: 1px solid rgba(16, 19, 23, 0.12);
  background: rgba(255, 255, 255, 0.95);
  padding: 0.75rem 0.9rem;
  box-shadow: var(--shadow);
}

.diff-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.diff-item-title {
  font-weight: 600;
}

.diff-item-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.diff-lines {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
}

.diff-section-title {
  margin-top: 0.65rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.diff-line {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.diff-line code {
  background: transparent;
  padding: 0;
  font-size: 0.82rem;
  color: inherit;
}

.diff-line .diff-key {
  font-weight: 600;
  min-width: 120px;
}

.diff-line.add {
  color: #1b7f73;
}

.diff-line.remove {
  color: #c24a3b;
}

.diff-line.unsyncable {
  color: #b45309;
}

.diff-warning {
  margin-top: 0.6rem;
  border: 1px solid rgba(180, 83, 9, 0.35);
  background: rgba(180, 83, 9, 0.08);
  color: #8a4b08;
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  font-size: 0.78rem;
}

.diff-warning-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

#lastRunDataset,
#lastRunMessage {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mapping-tools {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid rgba(16, 19, 23, 0.1);
  background: rgba(16, 42, 67, 0.06);
}

.mapping-explainer {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.explainer-card {
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(16, 19, 23, 0.12);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.explainer-title {
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.mapping-table {
  max-height: none;
  overflow: visible;
}

.mapping-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.5rem;
  align-items: start;
}

.mapping-preview-panel {
  position: relative;
}

.preview-panel {
  border-radius: 18px;
  border: 1px solid rgba(16, 19, 23, 0.12);
  background: #fff;
  padding: 1rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 1rem;
}

.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.preview-header h3 {
  margin-bottom: 0.2rem;
}

.preview-record .code-block {
  height: 220px;
  min-height: 140px;
  max-height: none;
  overflow: auto;
  resize: vertical;
}

.preview-fields {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.preview-fields-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

.preview-field-list {
  border-radius: 12px;
  border: 1px solid rgba(16, 19, 23, 0.12);
  background: rgba(16, 42, 67, 0.04);
  max-height: 260px;
  overflow: auto;
  padding: 0.35rem;
}

.preview-field-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  cursor: pointer;
}

.preview-field-item:hover {
  background: rgba(16, 42, 67, 0.08);
}

.preview-field-key {
  font-weight: 600;
  font-size: 0.85rem;
}

.preview-field-meta {
  font-size: 0.75rem;
  color: var(--muted);
  word-break: break-word;
}

.preview-field-empty {
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.is-hidden {
  display: none !important;
}

body.auth-locked {
  overflow: hidden;
}

body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-block: 1.5rem;
  padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
}

.login-shell {
  width: min(
    640px,
    calc(
      100vw
      - max(1rem, env(safe-area-inset-left))
      - max(1rem, env(safe-area-inset-right))
      - 0.25rem
    )
  );
  position: relative;
  z-index: 2;
}

.login-card {
  width: 100%;
  max-width: 100%;
}

.login-brand {
  margin-bottom: 0.75rem;
}

.login-brand .hero-badge {
  margin-bottom: 0.5rem;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(8, 12, 18, 0.56);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.auth-card {
  width: min(560px, 96vw);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(16, 19, 23, 0.14);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(16, 19, 23, 0.28);
  padding: 1.2rem;
}

.auth-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.login-theme-toggle-inline {
  flex-shrink: 0;
}

.auth-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.auth-header p {
  margin: 0.35rem 0 0.85rem;
}

@media (max-width: 640px) {
  .auth-header-top {
    flex-direction: column;
    align-items: flex-start;
  }
}

.auth-alert {
  border-radius: 12px;
  border: 1px solid rgba(16, 19, 23, 0.16);
  background: rgba(16, 19, 23, 0.06);
  color: var(--navy);
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
  margin-bottom: 0.85rem;
}

.auth-alert.error {
  border-color: rgba(242, 95, 76, 0.34);
  background: rgba(242, 95, 76, 0.16);
  color: #7c2019;
}

.auth-alert.success {
  border-color: rgba(27, 153, 139, 0.32);
  background: rgba(27, 153, 139, 0.15);
  color: #0e584f;
}

.auth-divider {
  margin: 0.95rem 0;
  display: flex;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.72rem;
  color: var(--muted);
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(16, 19, 23, 0.14);
}

.auth-divider span {
  padding: 0 0.65rem;
}

.auth-sso-hint {
  margin: 0.15rem 0 0.2rem;
}

.auth-sso-section {
  margin-top: 0.2rem;
}

.auth-sso-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.auth-sso-grid.single-provider {
  grid-template-columns: minmax(0, 1fr);
}

.auth-sso-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
}

.auth-sso-logo {
  width: min(11rem, 80%);
  height: 1.6rem;
  object-fit: contain;
  flex: 0 0 auto;
}

.auth-actions {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.6rem;
}

.scope-banner {
  margin: 0.75rem 0 1rem;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(16, 19, 23, 0.12);
  background: rgba(16, 19, 23, 0.04);
  color: var(--navy);
  font-size: 0.9rem;
}

.scope-banner strong {
  font-weight: 600;
}

.scope-banner .badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: rgba(16, 19, 23, 0.08);
  font-size: 0.78rem;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 15, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  z-index: 300;
  transition: opacity 0.2s ease;
  padding: 1rem;
}

.confirm-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.confirm-modal {
  width: min(520px, 92vw);
  max-height: min(760px, calc(100vh - 2rem));
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(16, 19, 23, 0.12);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.confirm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  flex-shrink: 0;
}

.confirm-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.confirm-checks {
  margin-top: 0.7rem;
  display: grid;
  gap: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.3rem;
}

.confirm-choices {
  display: grid;
  gap: 0.5rem;
  overflow-y: auto;
}

.confirm-choice {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  border: 1px solid color-mix(in srgb, var(--line-soft) 80%, transparent 20%);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  background: color-mix(in srgb, #ffffff 95%, transparent 5%);
}

.confirm-choice.is-danger {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line-soft) 55%);
}

.confirm-choice label {
  font-size: 0.9rem;
  margin-top: 0.05rem;
}

.confirm-choice input:checked + label {
  font-weight: 600;
}

.confirm-choice small {
  display: block;
  color: var(--muted);
  margin-top: 0.2rem;
}

.confirm-bulk {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 1;
  margin-bottom: 0.5rem;
  padding: 0 0 0.55rem;
  background: #fff;
  border-bottom: 1px solid color-mix(in srgb, var(--line-soft) 70%, transparent 30%);
}

.confirm-check {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.25rem 0;
}

.confirm-check label {
  font-size: 0.9rem;
  margin-top: 0.05rem;
}

.confirm-check small {
  display: block;
  color: var(--muted);
  margin-top: 0.2rem;
}

.confirm-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 15, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  z-index: 210;
  transition: opacity 0.2s ease;
  padding: 1.5rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(680px, 96vw);
  max-height: 90vh;
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(16, 19, 23, 0.12);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card.modal-wide {
  width: min(980px, 96vw);
}


.modal-header {
  padding: 0.9rem 1.1rem 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-body {
  padding: 0.4rem 1.1rem 1rem;
  overflow: auto;
  display: grid;
  gap: 0.6rem;
  min-height: 0;
}

.credential-profile-modal .list-surface {
  border: 1px solid rgba(16, 19, 23, 0.12);
}

.credential-profile-modal .row,
.credential-profile-modal .col-lg-7 {
  min-height: 0;
}

.credential-profile-modal .col-lg-7 {
  display: flex;
}

.credential-profile-modal .col-lg-7 .list-surface {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.credential-profile-modal .table-responsive {
  max-height: clamp(16rem, 52vh, 34rem);
  overflow: auto;
  overscroll-behavior: contain;
}

.credential-profile-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--stone);
}

.credential-profile-table tbody tr {
  cursor: pointer;
}

.credential-profile-table tbody tr.is-selected td {
  background: rgba(16, 42, 67, 0.12);
}

.mapping-modal-body {
  display: block;
}

.mapping-modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.25rem;
  align-items: start;
}

.mapping-modal-preview .preview-panel {
  position: static;
}

.preview-panel-compact .preview-record .code-block {
  height: 180px;
  max-height: none;
}


.modal-actions {
  padding: 0.8rem 1.1rem 1rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-top: 1px solid rgba(16, 19, 23, 0.08);
  background: #fafafa;
}

.modal-actions .btn {
  min-height: 2.35rem;
  min-width: 8.5rem;
}

.modal-actions .btn.btn-sm {
  min-height: 2.15rem;
  min-width: 7.25rem;
}

@media (max-width: 640px) {
  .modal-actions {
    justify-content: stretch;
  }

  .modal-actions .btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
  }
}

.code-block {
  background: rgba(16, 19, 23, 0.06);
  border: 1px solid rgba(16, 19, 23, 0.12);
  border-radius: 12px;
  padding: 0.75rem;
  font-size: 0.82rem;
  color: var(--navy);
  white-space: pre-wrap;
  max-height: 320px;
  overflow: auto;
}

.mapping-callout {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(16, 19, 23, 0.12);
  background: rgba(242, 95, 76, 0.08);
}

.mapping-callout.ready {
  background: rgba(27, 153, 139, 0.12);
  border-color: rgba(27, 153, 139, 0.3);
}

.mapping-callout .callout-title {
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.mapping-callout ol {
  padding-left: 1.1rem;
  margin: 0 0 0.45rem;
  color: var(--navy);
  font-size: 0.92rem;
}

.mapping-callout li {
  opacity: 0.55;
}

.mapping-callout li.done {
  opacity: 1;
  text-decoration: line-through;
}

.mapping-callout li.active {
  opacity: 1;
  font-weight: 600;
}

.mapping-callout .callout-note {
  font-size: 0.8rem;
  color: var(--muted);
}

.suggestions {
  position: relative;
}

.suggestions-panel {
  position: absolute;
  z-index: 30;
  top: 0.25rem;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(16, 19, 23, 0.12);
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow: auto;
  padding: 0.35rem 0;
}

.suggestion-item {
  padding: 0.45rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  cursor: pointer;
}

.suggestion-item:hover {
  background: rgba(16, 42, 67, 0.08);
}

.suggestion-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.suggestion-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.group-picker .input-group .btn {
  white-space: nowrap;
}

.group-options-panel {
  top: calc(100% + 0.35rem);
  max-height: 260px;
  z-index: 45;
}

.group-option {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
}

.group-option:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--teal) 60%, white 40%);
  outline-offset: -2px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
}

.settings-scope {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 180px;
}

.settings-scope-summary {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0.55rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(15, 28, 47, 0.04);
  color: var(--ink);
  font-weight: 600;
}

.settings-actions .muted.small {
  align-self: flex-end;
  padding-bottom: 0.35rem;
}

.settings-actions .btn-group .btn {
  border-radius: 999px;
  min-width: 118px;
  font-weight: 600;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.settings-actions .btn-group {
  border-radius: 999px;
  overflow: hidden;
}

.settings-actions .btn-group .btn.active,
.settings-actions .btn-group .btn:active,
.settings-actions .btn-group .btn-check:checked + .btn {
  background: linear-gradient(135deg, var(--primary-bg), var(--accent-bg));
  border-color: var(--primary-border);
  color: var(--primary-text);
  box-shadow: inset 0 0 0 1px var(--primary-glow);
}

.settings-actions .btn-group .btn.active:hover,
.settings-actions .btn-group .btn-check:checked + .btn:hover {
  background: color-mix(in srgb, var(--primary-bg) 62%, var(--accent-bg) 38%);
}

.settings-actions .btn-group .btn:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.settings-actions .btn-group .btn:last-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.settings-source-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: -0.4rem 0 1.4rem;
  padding: 0.8rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
}

.settings-source-label {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.settings-source-states {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.settings-source-pill,
.settings-effect-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0.24rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(16, 19, 23, 0.12);
  background: rgba(16, 42, 67, 0.08);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.settings-source-pill[data-state="override"] {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.settings-source-pill[data-state="dirty"] {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.settings-effect-badge {
  margin-left: 0.45rem;
  color: var(--ink);
}

.settings-effect-badge.publishes {
  border-color: var(--primary-border);
  background: var(--primary-bg);
  color: var(--primary-text);
}

.settings-effect-badge.next-sync {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.settings-effect-badge.fieldset-push {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.settings-effect-badge.ui-only {
  border-color: var(--neutral-border);
  background: var(--neutral-bg);
  color: var(--neutral-text);
}

.settings-grid {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.settings-groups {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.settings-group {
  background: color-mix(in srgb, var(--card) 72%, transparent);
  border-radius: 16px;
  padding: clamp(1rem, 1.2vw, 1.35rem);
  border: 1px solid rgba(16, 19, 23, 0.08);
  box-shadow: none;
}

.settings-group-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.settings-section-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.55rem;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.settings-group-header .btn {
  align-self: flex-start;
  white-space: nowrap;
}

.settings-group-header h3 {
  margin-bottom: 0.2rem;
}

.settings-group-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
}

.plugin-grid {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.plugin-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  padding: 1.1rem;
  border: 1px solid rgba(16, 19, 23, 0.08);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.plugin-header {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: flex-start;
}

.plugin-title {
  font-weight: 600;
}

.plugin-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.plugin-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.plugin-tag {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(16, 42, 67, 0.1);
  font-size: 0.75rem;
  color: var(--navy);
}

.plugin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.plugin-actions .btn {
  flex: 1 1 140px;
}

.plugin-scope-note {
  font-size: 0.82rem;
  color: var(--muted);
}

.plugin-file-upload {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.plugin-file-input {
  display: none;
}

.plugin-file-dropzone {
  border: 1px dashed rgba(16, 19, 23, 0.28);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  background: rgba(16, 19, 23, 0.02);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.plugin-file-dropzone:hover,
.plugin-file-dropzone.is-dragover {
  border-color: rgba(45, 127, 249, 0.65);
  background: rgba(45, 127, 249, 0.08);
}

.plugin-file-dropzone:focus-visible {
  outline: 2px solid rgba(45, 127, 249, 0.55);
  outline-offset: 1px;
}

.plugin-file-dropzone[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.6;
}

.plugin-file-status.is-success {
  color: #0d8a52;
}

.plugin-file-status.is-error {
  color: #b42318;
}

.settings-card {
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border-radius: 14px;
  padding: 1rem;
  border: 1px solid rgba(16, 19, 23, 0.08);
  box-shadow: none;
}

.settings-card.wide {
  grid-column: 1 / -1;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.6rem;
}

.settings-header .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.settings-subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0.5rem;
}

.settings-subheader h4 {
  margin: 0;
  font-size: 1rem;
}

.settings-warning {
  margin: 0 0 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(196, 120, 0, 0.25);
  background: rgba(255, 193, 7, 0.12);
  color: #6b4a00;
  font-size: 0.85rem;
}

.settings-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.settings-table td {
  vertical-align: middle;
}

.settings-table {
  width: 100%;
  table-layout: fixed;
}

.settings-table th,
.settings-table td {
  word-break: break-word;
  white-space: normal;
}

.settings-table input[type="text"],
.settings-table select {
  min-width: 0;
  width: 100%;
}

.settings-table input[type="color"] {
  width: 42px;
  padding: 0;
}

.settings-table .form-check-input {
  margin-left: 0;
}

.settings-table.membership-table {
  table-layout: auto;
  min-width: 780px;
}

.settings-table.membership-table th,
.settings-table.membership-table td {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.settings-table.membership-table .membership-role {
  min-width: 170px;
}

.settings-table.membership-table .membership-role .form-select {
  min-width: 170px;
}

.settings-table.membership-table .membership-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.settings-table.membership-table .membership-actions .btn + .btn {
  margin-left: 0.45rem;
}

.mapping-table th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.mapping-table .table {
  margin: 0;
}

.mapping-table .table > :not(caption) > * > * {
  padding: 0.75rem 1rem;
}

.mapping-table thead th {
  vertical-align: middle;
}

.mapping-table thead th:nth-child(3),
.mapping-table tbody td:nth-child(3) {
  width: 140px;
  text-align: center;
}

.mapping-table thead th:nth-child(4),
.mapping-table tbody td:nth-child(4) {
  width: 190px;
}

.mapping-table tbody td:nth-child(3),
.mapping-table tbody td:nth-child(4) {
  vertical-align: middle;
}

.mapping-table tbody td:nth-child(3) .form-check {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mapping-table tbody td:nth-child(3) .form-check.form-switch .form-check-input {
  margin: 0;
}

.mapping-empty-state {
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  padding: 1.1rem 0.9rem;
}

.form-label {
  font-weight: 600;
  display: block;
  margin-top: 0.6rem;
  margin-bottom: 0.35rem;
  line-height: 1.2;
}

.form-label.with-help {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.help-tooltip-container {
  position: relative;
}

.info-hover {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 6;
}

.info-hover-trigger {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(16, 19, 23, 0.28);
  background: rgba(16, 19, 23, 0.08);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: help;
}

.info-hover-trigger:hover {
  background: rgba(16, 19, 23, 0.14);
  color: var(--navy);
}

.info-hover-trigger:focus-visible {
  outline: 2px solid rgba(45, 126, 247, 0.55);
  outline-offset: 2px;
}

.info-hover-panel {
  position: absolute;
  left: calc(100% + 0.55rem);
  top: 50%;
  transform: translateY(-50%) scale(0.98);
  transform-origin: left center;
  width: min(320px, calc(100vw - 3rem));
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(16, 19, 23, 0.18);
  background: #ffffff;
  color: #1a2535;
  font-size: 0.78rem;
  line-height: 1.4;
  box-shadow: 0 10px 26px rgba(16, 19, 23, 0.2);
  opacity: 0;
  z-index: 40;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.info-hover-panel code {
  font-size: 0.74rem;
  padding: 0.06rem 0.28rem;
  border-radius: 6px;
  background: rgba(16, 19, 23, 0.09);
  color: inherit;
}

.info-hover-panel::after {
  content: "";
  position: absolute;
  top: calc(50% - 6px);
  right: 100%;
  border-width: 6px;
  border-style: solid;
  border-color: transparent #ffffff transparent transparent;
}

.info-hover:hover .info-hover-panel,
.info-hover:focus-within .info-hover-panel {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.info-hover.info-hover-align-left .info-hover-panel {
  left: auto;
  right: calc(100% + 0.55rem);
  transform: translateY(-50%) scale(0.98);
  transform-origin: right center;
}

.info-hover.info-hover-align-left .info-hover-panel::after {
  right: auto;
  left: 100%;
  border-color: transparent transparent transparent #ffffff;
}

.info-hover.info-hover-align-left:hover .info-hover-panel,
.info-hover.info-hover-align-left:focus-within .info-hover-panel {
  transform: translateY(-50%) scale(1);
}

.info-hover.info-hover-align-above .info-hover-panel {
  left: calc(50% + var(--info-hover-above-shift, 0px));
  right: auto;
  top: auto;
  bottom: calc(100% + 0.5rem);
  transform: translate(-50%, 0.15rem) scale(0.98);
  transform-origin: center bottom;
}

.info-hover.info-hover-align-above .info-hover-panel::after {
  top: 100%;
  left: calc(50% - var(--info-hover-above-shift, 0px));
  right: auto;
  border-color: #ffffff transparent transparent transparent;
}

.info-hover.info-hover-align-above:hover .info-hover-panel,
.info-hover.info-hover-align-above:focus-within .info-hover-panel {
  transform: translate(-50%, 0) scale(1);
}

.core-field-label,
.core-field-label-edit {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  max-width: 100%;
}

.core-field-label-edit {
  width: 100%;
}

.core-field-label-edit .form-control {
  min-width: 0;
}

.auto-lookup-info {
  flex: 0 0 auto;
}

.auto-lookup-info .info-hover-trigger {
  width: 0.95rem;
  height: 0.95rem;
  font-size: 0.62rem;
}

.integration-help-callout {
  margin-top: -0.15rem;
  margin-bottom: 0.2rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  background: color-mix(in srgb, #f3f8ff 86%, white);
  border-radius: 12px;
  color: #1a2535;
  font-size: 0.86rem;
}

.integration-help-callout > strong {
  display: block;
  margin-bottom: 0.25rem;
}

.stacked > .form-label {
  margin-bottom: -0.65rem;
}

.form-control,
.form-select {
  border-radius: 12px;
  border: 1px solid rgba(16, 19, 23, 0.2);
}

.form-control:disabled,
.form-select:disabled,
textarea.form-control:disabled {
  background-color: rgba(16, 19, 23, 0.14);
  background-image: repeating-linear-gradient(
    135deg,
    rgba(16, 19, 23, 0.05) 0,
    rgba(16, 19, 23, 0.05) 10px,
    rgba(16, 19, 23, 0.13) 10px,
    rgba(16, 19, 23, 0.13) 20px
  );
  border-color: rgba(16, 19, 23, 0.3);
  color: rgba(16, 19, 23, 0.66);
  cursor: not-allowed;
  opacity: 0.92;
}

.credential-field-disabled .form-label {
  color: color-mix(in srgb, var(--muted) 86%, #7a8799 14%);
}

.credential-field-disabled .hint {
  opacity: 0.78;
}

.form-check-input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.45);
}

.form-check-input:disabled + .form-check-label {
  opacity: 0.68;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.52;
  filter: grayscale(0.4);
  border-style: dashed;
  cursor: not-allowed;
}

input::placeholder,
textarea::placeholder,
.form-control::placeholder {
  color: rgba(89, 98, 114, 0.55);
  opacity: 1;
  font-style: italic;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: color-mix(in srgb, var(--primary) 58%, var(--accent) 42%);
  color: #ffffff;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary-glow) 70%, transparent);
}

.btn-primary:hover {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 82%, #ffffff 18%), color-mix(in srgb, var(--accent) 84%, #ffffff 16%));
  border-color: color-mix(in srgb, var(--primary) 50%, var(--accent) 50%);
  color: #ffffff;
}

.btn-outline-light {
  border-color: rgba(16, 19, 23, 0.25);
  color: var(--navy);
}

.btn-outline-light:hover {
  background: var(--primary-bg);
  border-color: var(--primary-border);
  color: var(--navy);
}

.btn-outline-primary {
  border-color: var(--primary-border);
  color: var(--primary-text);
}

.btn-outline-primary:hover {
  background: var(--primary-bg);
  color: var(--primary-text);
}

.btn-outline-warning {
  border-color: var(--warning-border);
  color: var(--warning-text);
}

.btn-outline-warning:hover {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.btn-sm {
  padding: 0.34rem 0.68rem;
  font-size: 0.84rem;
  line-height: 1.2;
  border-radius: 10px;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.muted {
  color: var(--muted);
}

.footer-card {
  border-radius: 26px;
  padding: 2rem;
  background: linear-gradient(120deg, #102a43, #1b998b);
  color: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  box-shadow: var(--shadow);
}

.footer-card .pill {
  background: rgba(248, 250, 252, 0.15);
  color: #f8fafc;
}

.footer-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.toast-area {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 5;
}

.toast-message {
  background: white;
  border-radius: 14px;
  padding: 0.8rem 1rem;
  box-shadow: 0 12px 30px rgba(16, 19, 23, 0.16);
  min-width: 240px;
  border-left: 4px solid var(--success);
  animation: rise 0.4s ease;
}

.toast-message.error {
  border-left-color: var(--danger);
}

[data-reveal] {
  animation: fadeUp 0.6s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6edf7;
  --muted: #99a7bd;
  --cream: #1f2937;
  --stone: #263142;
  --navy: #d9e7ff;
  --teal: #56cfbe;
  --coral: #ff7f6f;
  --sun: #f3c86a;
  --primary: #60a5fa;
  --accent: #a78bfa;
  --info: #22d3ee;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #fb7185;
  --critical: #f43f5e;
  --neutral: #94a3b8;
  --primary-bg: rgba(96, 165, 250, 0.18);
  --primary-border: rgba(147, 197, 253, 0.56);
  --primary-text: #bfdbfe;
  --primary-glow: rgba(96, 165, 250, 0.34);
  --accent-bg: rgba(167, 139, 250, 0.18);
  --accent-border: rgba(196, 181, 253, 0.56);
  --accent-text: #ddd6fe;
  --info-bg: rgba(34, 211, 238, 0.16);
  --info-border: rgba(103, 232, 249, 0.48);
  --info-text: #a5f3fc;
  --success-bg: rgba(52, 211, 153, 0.16);
  --success-border: rgba(110, 231, 183, 0.5);
  --success-text: #bbf7d0;
  --warning-bg: rgba(251, 191, 36, 0.17);
  --warning-border: rgba(252, 211, 77, 0.5);
  --warning-text: #fde68a;
  --danger-bg: rgba(251, 113, 133, 0.17);
  --danger-border: rgba(253, 164, 175, 0.52);
  --danger-text: #fecdd3;
  --critical-bg: rgba(244, 63, 94, 0.2);
  --critical-border: rgba(251, 113, 133, 0.62);
  --critical-text: #ffe4e6;
  --neutral-bg: rgba(148, 163, 184, 0.18);
  --neutral-border: rgba(203, 213, 225, 0.28);
  --neutral-text: #cbd5e1;
  --panel: rgba(15, 22, 33, 0.9);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --surface: #0d1520;
  --card: #172131;
  --line-soft: rgba(148, 163, 184, 0.3);
  --text-muted: #99a7bd;
  --row-bg: color-mix(in srgb, var(--card) 82%, #0b1220 18%);
  --row-hover-bg: color-mix(in srgb, var(--card) 66%, #0b1220 34%);
  --row-border: color-mix(in srgb, var(--line-soft) 84%, #0b1220 16%);
}

html[data-theme="dark"] body {
  background: radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 18%, transparent), transparent 55%),
    radial-gradient(circle at 80% 10%, color-mix(in srgb, var(--info) 15%, transparent), transparent 50%),
    radial-gradient(circle at 22% 82%, color-mix(in srgb, var(--warning) 9%, transparent), transparent 45%),
    linear-gradient(120deg, #0d1520, #132033);
}

html[data-theme="dark"] .bg-glow {
  background: radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--critical) 12%, transparent), transparent 45%),
    radial-gradient(circle at 70% 40%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 50%);
}

html[data-theme="dark"] .bg-grid {
  background-image: linear-gradient(rgba(148, 163, 184, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.12) 1px, transparent 1px);
  opacity: 0.32;
}

html[data-theme="dark"] .hero.hero-compact {
  background: color-mix(in srgb, var(--card) 88%, transparent);
  border-color: var(--line-soft);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.26);
}

html[data-theme="dark"] .scope-guardrail,
html[data-theme="dark"] .section-card,
html[data-theme="dark"] .list-surface,
html[data-theme="dark"] .list-actions,
html[data-theme="dark"] .config-panel,
html[data-theme="dark"] .template-panel,
html[data-theme="dark"] .dataset-panel,
html[data-theme="dark"] .status-panel,
html[data-theme="dark"] .diff-item,
html[data-theme="dark"] .mapping-tools,
html[data-theme="dark"] .explainer-card,
html[data-theme="dark"] .preview-panel,
html[data-theme="dark"] .preview-field-list,
html[data-theme="dark"] .settings-group,
html[data-theme="dark"] .settings-card,
html[data-theme="dark"] .plugin-card,
html[data-theme="dark"] .tenant-detail-panel,
html[data-theme="dark"] .job-alert-panel,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .confirm-modal,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .totp-qr-wrap,
html[data-theme="dark"] .recovery-code-list,
html[data-theme="dark"] .step,
html[data-theme="dark"] .suggestions-panel {
  background: var(--card);
  border-color: var(--line-soft);
}

html[data-theme="dark"] .settings-source-strip {
  background: rgba(15, 28, 47, 0.78);
  border-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .tenant-health-tile,
html[data-theme="dark"] .tenant-health-card,
html[data-theme="dark"] .tenant-security-panel,
html[data-theme="dark"] .tenant-security-row,
html[data-theme="dark"] .tenant-security-advisory {
  background: color-mix(in srgb, var(--card) 86%, #0b1220 14%);
  border-color: var(--line-soft);
}

html[data-theme="dark"] .pill-success {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

html[data-theme="dark"] .pill-warning {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

html[data-theme="dark"] .pill-danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

html[data-theme="dark"] .settings-source-pill,
html[data-theme="dark"] .settings-effect-badge {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.62);
  color: var(--muted);
}

html[data-theme="dark"] .settings-source-pill[data-state="override"] {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

html[data-theme="dark"] .settings-source-pill[data-state="dirty"] {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

html[data-theme="dark"] .settings-effect-badge {
  color: var(--ink);
}

html[data-theme="dark"] .ops-stat {
  background: color-mix(in srgb, var(--card) 72%, #0b1220 28%);
  border-color: var(--line-soft);
}

html[data-theme="dark"] .ops-header {
  border-color: var(--line-soft);
}

html[data-theme="dark"] .step-number,
html[data-theme="dark"] .list-header,
html[data-theme="dark"] .platform-panel-header,
html[data-theme="dark"] .platform-section .table thead th {
  background: color-mix(in srgb, var(--stone) 78%, #111827 22%);
}

html[data-theme="dark"] .list-header,
html[data-theme="dark"] .list-actions,
html[data-theme="dark"] .modal-actions {
  border-color: var(--line-soft);
}

html[data-theme="dark"] .list-group {
  --bs-list-group-bg: var(--row-bg);
  --bs-list-group-color: var(--ink);
  --bs-list-group-border-color: var(--row-border);
}

html[data-theme="dark"] .list-group-item:not(.active) {
  background: var(--row-bg);
  border-color: var(--row-border);
  color: var(--ink);
}

html[data-theme="dark"] .list-group-item:not(.active):hover,
html[data-theme="dark"] .list-group-item:not(.active):focus {
  background: var(--row-hover-bg);
}

html[data-theme="dark"] .section-tabs {
  background: transparent;
  border-color: transparent;
}

html[data-theme="dark"] .job-alert-tab,
html[data-theme="dark"] .job-alert-item:hover,
html[data-theme="dark"] .job-alert-item:focus {
  background: var(--row-hover-bg);
}

html[data-theme="dark"] .table {
  --bs-table-bg: var(--row-bg);
  --bs-table-color: var(--ink);
  --bs-table-border-color: var(--row-border);
  --bs-table-striped-bg: color-mix(in srgb, var(--row-bg) 90%, #0b1220 10%);
  --bs-table-hover-bg: var(--row-hover-bg);
  --bs-table-hover-color: var(--ink);
}

html[data-theme="dark"] .table > :not(caption) > * > * {
  border-color: var(--row-border);
}

html[data-theme="dark"] .table thead th {
  background: color-mix(in srgb, var(--stone) 74%, #0b1220 26%);
  border-color: var(--row-border);
  color: var(--ink);
}

html[data-theme="dark"] .list-action-switch {
  border-color: var(--line-soft);
  background: color-mix(in srgb, var(--card) 82%, #0b1220 18%);
}

html[data-theme="dark"] .modal-actions {
  background: color-mix(in srgb, var(--card) 88%, #0b1220 12%);
}

html[data-theme="dark"] .credential-profile-table tbody tr.is-selected td {
  background: color-mix(in srgb, var(--accent) 26%, transparent 74%);
}

html[data-theme="dark"] .auto-sync-quick-view {
  border-top-color: rgba(255, 255, 255, 0.15);
}

html[data-theme="dark"] .auto-sync-quick-item {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .settings-actions .btn-group .btn.active,
html[data-theme="dark"] .settings-actions .btn-group .btn:active,
html[data-theme="dark"] .settings-actions .btn-group .btn-check:checked + .btn {
  background: linear-gradient(135deg, var(--primary-bg), var(--accent-bg));
  border-color: var(--primary-border);
  color: var(--primary-text);
  box-shadow: inset 0 0 0 1px var(--primary-glow);
}

html[data-theme="dark"] .settings-actions .btn-group .btn.active:hover,
html[data-theme="dark"] .settings-actions .btn-group .btn-check:checked + .btn:hover {
  background: color-mix(in srgb, var(--primary-bg) 62%, var(--accent-bg) 38%);
}

html[data-theme="dark"] .diff-warning {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
}

html[data-theme="dark"] .history-facet-chip {
  border-color: var(--line-soft);
  background: color-mix(in srgb, var(--card) 86%, #0b1220 14%);
}

html[data-theme="dark"] .history-facet-chip.active {
  background: var(--primary-bg);
  border-color: var(--primary-border);
  color: var(--primary-text);
}

html[data-theme="dark"] .history-metric,
html[data-theme="dark"] .history-compare-card,
html[data-theme="dark"] .history-trend-canvas,
html[data-theme="dark"] .history-compare-table {
  border-color: var(--line-soft);
  background: color-mix(in srgb, var(--card) 84%, #0b1220 16%);
}

html[data-theme="dark"] .history-trend-grid line {
  stroke: rgba(148, 163, 184, 0.28);
}

html[data-theme="dark"] .history-trend-axis {
  stroke: rgba(148, 163, 184, 0.52);
}

html[data-theme="dark"] .history-trend-y-tick,
html[data-theme="dark"] .history-trend-x-tick,
html[data-theme="dark"] .history-trend-axis-title {
  fill: color-mix(in srgb, var(--muted) 88%, #e6edf7 12%);
}

html[data-theme="dark"] .history-trend-y2-tick {
  fill: color-mix(in srgb, #a7d0ff 82%, #dce9ff 18%);
}

html[data-theme="dark"] .history-trend-area {
  fill: rgba(121, 179, 255, 0.19);
}

html[data-theme="dark"] .history-trend-line {
  stroke: rgba(121, 179, 255, 0.94);
}

html[data-theme="dark"] .history-trend-line-secondary {
  stroke: rgba(110, 231, 183, 0.94);
}

html[data-theme="dark"] .history-trend-point {
  fill: #0f1b2a;
  stroke: rgba(121, 179, 255, 0.96);
}

html[data-theme="dark"] .history-trend-point-secondary {
  fill: #0f1b2a;
  stroke: rgba(110, 231, 183, 0.95);
}

html[data-theme="dark"] .history-trend-hover-guide {
  stroke: rgba(121, 179, 255, 0.62);
}

html[data-theme="dark"] .history-trend-now-anchor {
  fill: #0f1b2a;
  stroke: rgba(121, 179, 255, 1);
}

html[data-theme="dark"] .history-trend-now-connector {
  stroke: rgba(121, 179, 255, 0.86);
}

html[data-theme="dark"] .history-trend-now-tag {
  fill: rgba(79, 147, 255, 0.22);
  stroke: rgba(121, 179, 255, 0.78);
}

html[data-theme="dark"] .history-trend-now-text {
  fill: #d8eaff;
}

html[data-theme="dark"] .history-trend-zoom {
  border-color: var(--line-soft);
  background: color-mix(in srgb, var(--card) 84%, #0b1220 16%);
}

html[data-theme="dark"] .history-trend-events-line {
  border-top-color: rgba(148, 163, 184, 0.45);
}

html[data-theme="dark"] .history-trend-job-marker {
  --trend-marker-bg: rgba(122, 145, 176, 0.92);
  --trend-marker-border: rgba(121, 179, 255, 0.9);
  background: var(--trend-marker-bg);
  border-color: var(--trend-marker-border);
}

html[data-theme="dark"] .history-trend-job-marker:hover,
html[data-theme="dark"] .history-trend-job-marker:focus {
  background: color-mix(in srgb, var(--trend-marker-bg) 80%, #ffffff 20%);
  border-color: color-mix(in srgb, var(--trend-marker-border) 84%, #ffffff 16%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--trend-marker-glow) 76%, transparent 24%);
}

html[data-theme="dark"] .history-trend-job-marker.is-cluster:hover,
html[data-theme="dark"] .history-trend-job-marker.is-cluster:focus {
  background: var(--cluster-ring, rgba(121, 179, 255, 0.3));
  border-color: transparent;
  box-shadow: 0 0 0 2px rgba(121, 179, 255, 0.3), 0 0 0 4px rgba(121, 179, 255, 0.16);
}

html[data-theme="dark"] .history-trend-job-marker.is-active {
  background: rgba(121, 179, 255, 1);
  border-color: #0f1b2a;
}

html[data-theme="dark"] .history-trend-job-marker.is-status-completed {
  --trend-marker-bg: rgba(34, 197, 94, 0.34);
  --trend-marker-border: rgba(74, 222, 128, 0.95);
}

html[data-theme="dark"] .history-trend-job-marker.is-status-failed {
  --trend-marker-bg: rgba(239, 68, 68, 0.36);
  --trend-marker-border: rgba(252, 165, 165, 0.94);
}

html[data-theme="dark"] .history-trend-job-marker.is-status-running {
  --trend-marker-bg: rgba(245, 158, 11, 0.34);
  --trend-marker-border: rgba(251, 191, 36, 0.95);
}

html[data-theme="dark"] .history-trend-job-marker.is-status-queued {
  --trend-marker-bg: rgba(99, 102, 241, 0.36);
  --trend-marker-border: rgba(165, 180, 252, 0.95);
}

html[data-theme="dark"] .history-trend-job-marker.is-status-cancelled {
  --trend-marker-bg: rgba(107, 114, 128, 0.36);
  --trend-marker-border: rgba(156, 163, 175, 0.94);
}

html[data-theme="dark"] .history-trend-job-marker.is-status-other {
  --trend-marker-bg: rgba(148, 163, 184, 0.34);
  --trend-marker-border: rgba(203, 213, 225, 0.92);
}

html[data-theme="dark"] .history-trend-job-marker.is-cluster {
  color: #dbeafe;
}

html[data-theme="dark"] .history-trend-job-marker.is-cluster.has-failed::after {
  background: rgba(239, 68, 68, 0.98);
  border-color: #0f1b2a;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.28);
}

html[data-theme="dark"] .history-trend-job-marker.is-cluster::before {
  background: color-mix(in srgb, var(--card) 86%, #0b1220 14%);
  border-color: var(--line-soft);
}

html[data-theme="dark"] .history-trend-job-marker.is-compare {
  border-color: rgba(251, 191, 36, 0.95);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.28), 0 0 0 4px rgba(251, 191, 36, 0.16);
}

html[data-theme="dark"] .history-trend-events-legend-item {
  color: var(--muted);
}

html[data-theme="dark"] .history-trend-events-legend-dot {
  border-color: rgba(148, 163, 184, 0.35);
}

html[data-theme="dark"] .history-trend-events-legend-badge {
  border-color: #0f1b2a;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.28);
}

html[data-theme="dark"] .history-trend-events-hover {
  color: var(--muted);
}

html[data-theme="dark"] .history-trend-hover-card {
  border-color: var(--line-soft);
  background: color-mix(in srgb, var(--card) 84%, #0b1220 16%);
}

html[data-theme="dark"] .history-trend-hover-status {
  border-color: var(--line-soft);
  background: rgba(148, 163, 184, 0.16);
  color: var(--ink);
}

html[data-theme="dark"] .history-trend-hover-status.is-completed {
  color: #6ee7a8;
  border-color: rgba(110, 231, 168, 0.45);
  background: rgba(110, 231, 168, 0.12);
}

html[data-theme="dark"] .history-trend-hover-status.is-failed {
  color: #fda4af;
  border-color: rgba(253, 164, 175, 0.45);
  background: rgba(253, 164, 175, 0.12);
}

html[data-theme="dark"] .history-trend-hover-metrics span {
  border-color: var(--line-soft);
  background: rgba(148, 163, 184, 0.14);
}

html[data-theme="dark"] .history-trend-hover-breakdown-item {
  color: var(--ink);
}

html[data-theme="dark"] #historyTrendCompareMode.active,
html[data-theme="dark"] .history-trend-presets .btn.active {
  background: rgba(79, 147, 255, 0.28);
  border-color: rgba(121, 179, 255, 0.8);
  color: #e8f2ff;
}

html[data-theme="dark"] .history-job-item.is-compare-selected:not(.active) {
  border-left-color: rgba(251, 191, 36, 0.9);
}

html[data-theme="dark"] .history-compare-delta.is-up {
  color: #6ee7a8;
}

html[data-theme="dark"] .history-compare-delta.is-down {
  color: #fda4af;
}

html[data-theme="dark"] .confirm-choice {
  background: color-mix(in srgb, var(--card) 84%, #0b1220 16%);
}

html[data-theme="dark"] .confirm-bulk {
  background: var(--card);
  border-bottom-color: color-mix(in srgb, var(--line-soft) 78%, transparent 22%);
}

html[data-theme="dark"] .confirm-choice.is-danger {
  border-color: color-mix(in srgb, var(--danger) 52%, var(--line-soft) 48%);
}

html[data-theme="dark"] .pill:not(.success):not(.completed):not(.healthy):not(.connected):not(.warning):not(.pending):not(.update):not(.danger):not(.failed):not(.error):not(.critical):not(.vulnerable):not(.primary):not(.active):not(.info):not(.queued):not(.accent):not(.running):not(.muted):not(.neutral):not(.resolved):not(.skipped):not(.cancelled):not(.unknown):not(.disabled):not(.pill-success):not(.pill-warning):not(.pill-danger),
html[data-theme="dark"] .step-status,
html[data-theme="dark"] .scope-banner .badge,
html[data-theme="dark"] .plugin-tag {
  border-color: var(--neutral-border);
  background: var(--neutral-bg);
  color: var(--neutral-text);
}

html[data-theme="dark"] .footer-card .pill {
  background: rgba(15, 23, 42, 0.36);
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .platform-policy-organization-label {
  background-color: #0f1826;
  border-color: var(--line-soft);
  color: var(--ink);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
  border-color: color-mix(in srgb, var(--primary) 70%, transparent);
  box-shadow: 0 0 0 0.2rem rgba(79, 147, 255, 0.22);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder,
html[data-theme="dark"] .form-control::placeholder {
  color: rgba(153, 167, 189, 0.62);
}

html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-select:disabled,
html[data-theme="dark"] textarea.form-control:disabled {
  background-color: #0d1627;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(148, 163, 184, 0.06) 0,
    rgba(148, 163, 184, 0.06) 10px,
    rgba(148, 163, 184, 0.14) 10px,
    rgba(148, 163, 184, 0.14) 20px
  );
  border-color: rgba(153, 167, 189, 0.52);
  color: rgba(153, 167, 189, 0.78);
}

html[data-theme="dark"] .form-check-input:disabled {
  opacity: 0.5;
  filter: grayscale(0.55);
}

html[data-theme="dark"] .form-check-input:disabled + .form-check-label {
  opacity: 0.62;
}

html[data-theme="dark"] .btn:disabled,
html[data-theme="dark"] .btn.disabled {
  opacity: 0.46;
  filter: grayscale(0.55);
  border-style: dashed;
}

html[data-theme="dark"] .tab-button,
html[data-theme="dark"] .org-subtab-button,
html[data-theme="dark"] .btn-outline-light {
  background: rgba(15, 24, 38, 0.65);
  border-color: var(--line-soft);
  color: var(--ink);
}

html[data-theme="dark"] .theme-switch {
  background: rgba(15, 24, 38, 0.72);
  border-color: var(--line-soft);
}

html[data-theme="dark"] .theme-switch-label {
  color: var(--ink);
}

html[data-theme="dark"] .workspace-org-switcher {
  background: rgba(15, 24, 38, 0.72);
  border-color: var(--line-soft);
}

html[data-theme="dark"] .workspace-org-switcher-label {
  color: #8da2c2;
}

html[data-theme="dark"] .workspace-org-switcher .form-select {
  border-color: var(--line-soft);
  background-color: rgba(8, 16, 30, 0.92);
  color: var(--ink);
}

html[data-theme="dark"] .settings-scope-summary {
  border-color: var(--line-soft);
  background: rgba(15, 24, 38, 0.72);
  color: var(--ink);
}

html[data-theme="dark"] .tab-button:hover,
html[data-theme="dark"] .org-subtab-button:hover,
html[data-theme="dark"] .btn-outline-light:hover {
  background: rgba(79, 147, 255, 0.16);
  border-color: color-mix(in srgb, var(--primary) 58%, transparent);
  color: var(--ink);
}

html[data-theme="dark"] .integration-tab.active,
html[data-theme="dark"] .integration-tab[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--primary-bg), var(--accent-bg));
  border-color: var(--primary-border);
  box-shadow: 0 0 0 1px var(--primary-glow), 0 8px 18px rgba(6, 18, 38, 0.35);
}

html[data-theme="dark"] .btn-outline-primary {
  border-color: rgba(79, 147, 255, 0.55);
  color: #a8c8ff;
}

html[data-theme="dark"] .btn-outline-primary:hover {
  background: rgba(79, 147, 255, 0.18);
  color: #d8e8ff;
}

html[data-theme="dark"] .btn-outline-warning {
  border-color: rgba(243, 200, 106, 0.55);
  color: #f5d690;
}

html[data-theme="dark"] .provider-advanced {
  border-color: rgba(153, 167, 189, 0.36);
  background: rgba(15, 24, 38, 0.72);
}

html[data-theme="dark"] .btn-outline-warning:hover {
  background: rgba(243, 200, 106, 0.16);
  color: #ffe6b2;
}

html[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: color-mix(in srgb, var(--primary) 55%, var(--accent) 45%);
  color: #07111f;
}

html[data-theme="dark"] .btn-primary:hover {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 88%, #ffffff 12%), color-mix(in srgb, var(--accent) 88%, #ffffff 12%));
  border-color: color-mix(in srgb, var(--primary) 48%, var(--accent) 52%);
  color: #07111f;
}

html[data-theme="dark"] .info-hover-trigger {
  border-color: rgba(153, 167, 189, 0.45);
  background: rgba(153, 167, 189, 0.12);
  color: #c8d6eb;
}

html[data-theme="dark"] .info-hover-trigger:hover {
  background: rgba(79, 147, 255, 0.24);
  color: #e5f0ff;
}

html[data-theme="dark"] .info-hover-panel {
  background: #0f1826;
  border-color: rgba(153, 167, 189, 0.45);
  color: #dce7f7;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .info-hover-panel code {
  background: rgba(148, 163, 184, 0.2);
}

html[data-theme="dark"] .info-hover-panel::after {
  border-color: transparent #0f1826 transparent transparent;
}

html[data-theme="dark"] .info-hover.info-hover-align-left .info-hover-panel::after {
  border-color: transparent transparent transparent #0f1826;
}

html[data-theme="dark"] .info-hover.info-hover-align-above .info-hover-panel::after {
  border-color: #0f1826 transparent transparent transparent;
}

html[data-theme="dark"] .integration-help-callout {
  background: rgba(79, 147, 255, 0.12);
  border-color: rgba(79, 147, 255, 0.35);
  color: #dce7f7;
}

html[data-theme="dark"] .divider-line,
html[data-theme="dark"] .auth-divider::before,
html[data-theme="dark"] .auth-divider::after {
  background: var(--line-soft);
}

html[data-theme="dark"] .diff-raw,
html[data-theme="dark"] .code-block,
html[data-theme="dark"] .preview-field-list {
  background: rgba(15, 24, 38, 0.9);
}

html[data-theme="dark"] .diff-raw pre,
html[data-theme="dark"] .code-block,
html[data-theme="dark"] .preview-field-key {
  color: #c8daff;
}

html[data-theme="dark"] .preview-field-item:hover,
html[data-theme="dark"] .suggestion-item:hover {
  background: rgba(79, 147, 255, 0.2);
}

html[data-theme="dark"] .session-menu-panel {
  border-color: var(--line-soft);
  background: #172131;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .session-menu-item {
  color: var(--ink);
}

html[data-theme="dark"] .session-menu-item:hover,
html[data-theme="dark"] .session-menu-item:focus-visible {
  background: rgba(79, 147, 255, 0.18);
}

html[data-theme="dark"] .settings-warning,
html[data-theme="dark"] .mapping-callout {
  border-color: rgba(243, 200, 106, 0.45);
  background: rgba(243, 200, 106, 0.14);
  color: #f7d998;
}

html[data-theme="dark"] .mapping-callout.ready {
  background: rgba(86, 207, 190, 0.16);
  border-color: rgba(86, 207, 190, 0.4);
  color: #a6efe3;
}

html[data-theme="dark"] .toast-message {
  background: #172131;
  color: var(--ink);
}

html[data-theme="dark"] .muted,
html[data-theme="dark"] .hint,
html[data-theme="dark"] .section-header p,
html[data-theme="dark"] .section-subtitle,
html[data-theme="dark"] .hero-lede,
html[data-theme="dark"] .ops-context-line,
html[data-theme="dark"] .ops-stat-label,
html[data-theme="dark"] .preview-field-meta,
html[data-theme="dark"] .preview-field-empty,
html[data-theme="dark"] .plugin-meta,
html[data-theme="dark"] .plugin-scope-note,
html[data-theme="dark"] .platform-list-item-sub,
html[data-theme="dark"] .platform-section-head p,
html[data-theme="dark"] .platform-support-note,
html[data-theme="dark"] .platform-inline-status,
html[data-theme="dark"] .platform-section .form-label {
  color: var(--text-muted) !important;
}

html[data-theme="dark"] .platform-support-note,
html[data-theme="dark"] .platform-empty {
  border-color: var(--line-soft);
  background: rgba(15, 24, 38, 0.65);
}

html[data-theme="dark"] .plugin-file-dropzone {
  border-color: var(--line-soft);
  background: rgba(15, 24, 38, 0.55);
  color: var(--text-muted);
}

html[data-theme="dark"] .plugin-file-dropzone:hover,
html[data-theme="dark"] .plugin-file-dropzone.is-dragover {
  border-color: color-mix(in srgb, var(--primary) 72%, #ffffff 28%);
  background: rgba(79, 147, 255, 0.16);
}

html[data-theme="dark"] .plugin-file-status.is-success {
  color: #7ce5b0;
}

html[data-theme="dark"] .plugin-file-status.is-error {
  color: #ff9f9f;
}

html[data-theme="dark"] .platform-list,
html[data-theme="dark"] .platform-section .table-wrap,
html[data-theme="dark"] .platform-toolbar,
html[data-theme="dark"] .platform-header,
html[data-theme="dark"] .platform-panel {
  border-color: var(--line-soft);
  background: var(--card);
}

html[data-theme="dark"] .platform-list-item:hover,
html[data-theme="dark"] #platformOrgList tr:hover td,
html[data-theme="dark"] .platform-section .table tbody tr.platform-table-row-selected td,
html[data-theme="dark"] .platform-list-item.active {
  background: rgba(79, 147, 255, 0.14);
}

html[data-theme="dark"] .platform-toolbar,
html[data-theme="dark"] .platform-section-head {
  background: rgba(15, 24, 38, 0.7);
}

@media (max-width: 1280px) {
  .tenant-workbench {
    grid-template-columns: minmax(300px, 0.82fr) minmax(520px, 1.18fr);
  }

  .tenant-rail-detail {
    grid-column: 1 / -1;
    position: static;
  }

  .sync-workbench,
  .history-workbench {
    grid-template-columns: minmax(320px, 0.75fr) minmax(520px, 1.25fr);
  }
}

@media (max-width: 900px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 992px) {
  .hero {
    padding: 3.5rem 0 2.5rem;
  }

  .hero.hero-compact {
    padding: 0.75rem;
  }

  .tenant-workbench,
  .sync-workbench,
  .history-workbench {
    grid-template-columns: 1fr;
  }

  .tenant-rail-form,
  .tenant-rail-detail,
  .sync-rail-controls,
  .history-rail-detail {
    position: static;
  }

  .tenant-rail-registry .list-surface,
  .tenant-detail-panel {
    max-height: none;
    min-height: 0;
  }

  #tenantList,
  .tenant-detail-panel-body {
    overflow: visible;
  }

  .hero-topline {
    flex-wrap: wrap;
  }

  .ops-header {
    grid-template-columns: 1fr;
  }

  .ops-header {
    align-items: stretch;
  }

  .ops-stats {
    width: 100%;
    justify-content: flex-start;
  }

  .section-card {
    padding: 2rem;
  }

  .config-panel,
  .status-panel,
  .template-panel,
  .dataset-panel {
    padding: 1.25rem;
  }

  .section-tabs {
    gap: 0.5rem;
  }

  .tab-button {
    padding: 0.45rem 1rem;
  }

  .template-header,
  .template-subhead,
  .config-header,
  .status-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .config-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .mapping-workbench {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }

  .mapping-modal-grid {
    grid-template-columns: 1fr;
  }

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

  .tenant-health-card-main,
  .tenant-health-detail-grid {
    grid-template-columns: 1fr;
  }

  .maintenance-summary {
    grid-template-columns: 1fr;
  }

  .tenant-security-advisory {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .tenant-health-summary {
    grid-template-columns: 1fr;
  }

  .tenant-health-actions .btn {
    width: 100%;
  }

  .hero-topline {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-auth {
    justify-content: flex-start;
    flex-wrap: wrap;
    width: 100%;
  }

  .workspace-org-switcher {
    width: 100%;
  }

  .workspace-org-switcher .form-select {
    min-width: 0;
    width: 100%;
  }

  .session-menu-panel {
    left: 0;
    right: auto;
  }

  .job-alert-wrap {
    position: static;
  }

  .job-alert-panel {
    left: 1rem;
    right: 1rem;
    width: auto;
  }

  .hero-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .hero-actions .btn {
    width: auto;
  }

  .ops-header .hero-actions {
    flex-wrap: wrap;
  }

  .section-card {
    padding: 1.5rem;
  }

  .section-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.4rem;
    -webkit-overflow-scrolling: touch;
  }

  body.chrome-pinned [data-section] {
    scroll-margin-top: 16.5rem;
  }

  .tab-button {
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .settings-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-actions .btn-group,
  .settings-actions .btn {
    width: 100%;
  }

  .settings-source-strip,
  .settings-source-states,
  .settings-section-actions {
    width: 100%;
  }

  .settings-source-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-source-states,
  .settings-section-actions {
    justify-content: flex-start;
  }

  .settings-section-actions .btn {
    width: 100%;
  }

  .settings-scope {
    min-width: 0;
  }

  .settings-group {
    padding: 1.1rem;
  }

  .settings-group-grid {
    grid-template-columns: 1fr;
  }

  .settings-group-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .button-row {
    flex-direction: column;
  }

  .list-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .template-actions,
  .footer-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .mapping-table {
    overflow-x: auto;
  }

  .mapping-table table {
    min-width: 540px;
  }

  .toast-area {
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
  }

  .toast-message {
    min-width: 0;
  }

  .auth-sso-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  body.login-page {
    padding-inline: max(0.75rem, env(safe-area-inset-left)) max(0.75rem, env(safe-area-inset-right));
  }

  .hero h1 {
    font-size: clamp(2rem, 7vw, 2.6rem);
  }

  .hero-lede {
    font-size: 1rem;
  }

  .ops-header {
    padding: 0.58rem 0;
  }

  body.chrome-pinned [data-section] {
    scroll-margin-top: 18rem;
  }

  .section-card {
    padding: 1.2rem;
  }

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

  .step {
    grid-template-columns: 24px 1fr;
    grid-template-rows: auto auto;
  }

  .step-status {
    grid-column: 1 / -1;
    margin-left: calc(24px + 0.75rem);
  }

  .settings-card {
    padding: 0.85rem;
  }
}

/* Platform admin console */
:root {
  --platform-border: color-mix(in srgb, var(--line-soft) 85%, #d3d8df 15%);
  --platform-muted-bg: color-mix(in srgb, var(--surface) 90%, #edf2f7 10%);
  --platform-accent-bg: color-mix(in srgb, var(--primary) 8%, #f8fbff 92%);
  --platform-shadow: 0 10px 28px rgba(14, 24, 38, 0.06);
  --platform-radius: 14px;
}

.platform-shell {
  max-width: min(96vw, 1680px);
  margin: 0 auto;
  padding: 1.2rem 0.95rem 2.2rem;
}

.platform-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 0.85rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--platform-border);
  border-radius: var(--platform-radius);
  background: color-mix(in srgb, var(--card) 92%, white 8%);
  box-shadow: var(--platform-shadow);
}

.platform-header-left h1 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.platform-header-left p {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.platform-toolbar {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 0.95rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--platform-border);
  border-radius: var(--platform-radius);
  background: var(--platform-muted-bg);
}

.platform-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.platform-toolbar-context {
  width: min(100%, 480px);
}

.platform-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0.95rem;
  align-items: start;
}

.platform-nav {
  display: grid;
  gap: 0.42rem;
}

.platform-nav button {
  text-align: left;
  justify-content: flex-start;
  border-radius: 11px;
  min-height: 38px;
  padding-inline: 0.72rem;
  font-weight: 600;
}

.platform-panel {
  border: 1px solid var(--platform-border);
  border-radius: var(--platform-radius);
  background: var(--card);
  overflow: hidden;
  box-shadow: var(--platform-shadow);
}

.platform-grid > .platform-panel:first-child {
  position: sticky;
  top: 0.9rem;
}

.platform-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.82rem 1rem;
  background: color-mix(in srgb, var(--cream) 60%, white 40%);
  border-bottom: 1px solid var(--platform-border);
}

.platform-panel-header h2 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: -0.01em;
}

.platform-panel-body {
  padding: 0.92rem 0.98rem;
}

.platform-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.72rem;
}

.platform-form-actions {
  margin-top: 0.62rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.platform-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--platform-border);
  border-radius: 11px;
  max-height: 440px;
  overflow: auto;
  background: var(--card);
}

.platform-list-item {
  padding: 0.66rem 0.78rem;
  border-bottom: 1px solid color-mix(in srgb, var(--platform-border) 88%, transparent);
  cursor: pointer;
  transition: background 0.14s ease;
}

.platform-list-item:hover {
  background: color-mix(in srgb, var(--platform-accent-bg) 65%, transparent);
}

.platform-list-item:last-child {
  border-bottom: 0;
}

.platform-list-item.active {
  background: color-mix(in srgb, var(--primary) 12%, #f7faff 88%);
  outline: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
}

.platform-list-item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 600;
}

.platform-list-item-sub {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.platform-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.72rem;
  margin-top: 0.78rem;
}

.platform-split > div {
  border: 1px solid var(--platform-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 95%, white 5%);
  padding: 0.72rem;
}

.platform-empty {
  border: 1px dashed var(--platform-border);
  border-radius: 0.8rem;
  padding: 0.78rem;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--surface) 94%, var(--card) 6%);
  line-height: 1.35;
}

.platform-section {
  display: none;
}

.platform-section.active {
  display: block;
}

.platform-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid var(--platform-border);
  border-radius: 12px;
  padding: 0.62rem 0.72rem;
  margin-bottom: 0.72rem;
  background: color-mix(in srgb, var(--platform-muted-bg) 65%, white 35%);
}

.platform-section-head h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.platform-section-head p {
  margin: 0.1rem 0 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.platform-inline-status {
  max-width: 420px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.81rem;
}

.platform-stack {
  display: grid;
  gap: 0.72rem;
}

.platform-header-right {
  display: grid;
  gap: 0.5rem;
  min-width: min(100%, 840px);
}

.platform-header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.platform-header-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.platform-header-switch {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.44rem 0.72rem 0.44rem 0.9rem;
  border: 1px solid var(--platform-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 90%, white 10%);
  min-height: 40px;
  white-space: nowrap;
}

.platform-header-switch .form-check-input {
  margin: 0;
}

.platform-header-switch.form-check.form-switch .form-check-input {
  margin-left: var(--switch-pill-toggle-gap, 0.35rem) !important;
}

.platform-switch-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
  user-select: none;
}

.platform-status-pill {
  max-width: 360px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.platform-panel-note {
  margin: 0.78rem 0 0;
  line-height: 1.45;
}

.platform-support-note {
  margin: 0 0 0.72rem;
  padding: 0.62rem 0.72rem;
  border: 1px solid color-mix(in srgb, var(--platform-border) 88%, #d2d9e3 12%);
  border-radius: 11px;
  background: color-mix(in srgb, var(--surface) 92%, #eef3f9 8%);
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.platform-support-note strong {
  color: var(--ink);
}

.platform-section h3 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.platform-section .table-wrap {
  border: 1px solid var(--platform-border);
  border-radius: 11px;
  overflow: auto;
  background: var(--card);
}

.platform-section .table th,
.platform-section .table td {
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: anywhere;
}

.platform-section .table {
  width: 100%;
  table-layout: fixed;
  margin-bottom: 0;
}

.platform-section .table thead th {
  background: color-mix(in srgb, var(--cream) 55%, white 45%);
  border-bottom-color: var(--platform-border);
  font-size: 0.79rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.platform-section .table tbody tr td {
  border-bottom-color: color-mix(in srgb, var(--platform-border) 88%, transparent);
  transition: background-color 0.14s ease;
}

.platform-section .table tbody tr:last-child td {
  border-bottom: 0;
}

.platform-section .table tbody tr.platform-table-row-selected td {
  background: color-mix(in srgb, var(--primary) 11%, #f8fbff 89%);
}

.platform-section .table tbody tr.platform-table-row-selected td:first-child {
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--primary) 55%, transparent);
}

#platformOrgList tr {
  cursor: pointer;
}

#platformOrgList tr:hover td {
  background: color-mix(in srgb, var(--platform-accent-bg) 65%, transparent);
}

.platform-section .form-label {
  margin-bottom: 0.3rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.platform-panel .btn.btn-sm {
  min-height: 34px;
  padding-inline: 0.68rem;
}

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

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

  .platform-toolbar-actions {
    justify-content: flex-start;
  }

  .platform-form-grid,
  .platform-split {
    grid-template-columns: 1fr;
  }

  .platform-grid > .platform-panel:first-child {
    position: static;
  }

  .platform-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .platform-section-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  .platform-shell {
    padding: 0.95rem 0.6rem 1.5rem;
  }

  .platform-header,
  .platform-toolbar,
  .platform-panel-header,
  .platform-panel-body {
    padding-inline: 0.75rem;
  }

  .platform-header-right {
    width: 100%;
    min-width: 0;
  }

  .platform-status-pill,
  .platform-inline-status {
    max-width: 100%;
    white-space: normal;
  }

  .platform-header-controls,
  .platform-header-meta {
    justify-content: flex-start;
  }

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

  .platform-toolbar-actions .btn {
    width: 100%;
  }

  .platform-form-actions {
    gap: 0.45rem;
  }

  .platform-form-actions .btn {
    flex: 1 1 100%;
  }

  .platform-section .table-wrap {
    overflow-x: auto;
  }
}

@media (max-width: 576px) {
  .platform-toolbar-actions {
    grid-template-columns: 1fr;
  }

  .platform-panel .btn.btn-sm {
    min-height: 38px;
  }

  .platform-header-controls {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* OAuth callback status page */
.oauth-callback-page {
  font-family: Arial, sans-serif;
  padding: 32px;
  background: #f4f6f8;
  color: #1f2a37;
}

.oauth-callback-card {
  max-width: 560px;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.oauth-callback-card h1 {
  font-size: 20px;
  margin: 0 0 8px;
}

.oauth-callback-card p {
  margin: 0;
}
