:root {
  color-scheme: light;
  --navy: #0f172a;
  --teal: #0ea5a4;
  --white: #ffffff;
  --light-gray: #f1f5f9;
  --gold: #d4a017;
  --bg: #f1f5f9;
  --sidebar: #ffffff;
  --sidebar-ink: #0f172a;
  --sidebar-muted: #64748b;
  --sidebar-border: #d8e1eb;
  --sidebar-hover: #e6fffd;
  --sidebar-active: #0f172a;
  --sidebar-count-bg: #0ea5a4;
  --sidebar-count-ink: #ffffff;
  --brand-mark-bg: #0ea5a4;
  --brand-mark-ink: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #d8e1eb;
  --text: #172033;
  --muted: #64748b;
  --heading: #0f172a;
  --green: #0ea5a4;
  --green-soft: #dffbf8;
  --amber: #a66f00;
  --amber-soft: #fff4d6;
  --red: #c93a3a;
  --red-soft: #ffe8e8;
  --blue: #0f172a;
  --blue-soft: #e7edf7;
  --action-primary: #0f172a;
  --action-primary-hover: #18233f;
  --action-secondary-bg: #ffffff;
  --action-secondary-ink: #0f172a;
  --action-secondary-border: #0ea5a4;
  --accent: #d4a017;
  --accent-soft: #fff4d6;
  --focus-ring: rgba(14, 165, 164, 0.22);
  --shadow: 0 16px 38px rgba(15, 23, 42, 0.1);
  --shadow-strong: 0 20px 45px rgba(15, 23, 42, 0.16);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --sidebar: #0f172a;
  --sidebar-ink: #ffffff;
  --sidebar-muted: #a7b3c7;
  --sidebar-border: rgba(255, 255, 255, 0.12);
  --sidebar-hover: rgba(14, 165, 164, 0.14);
  --sidebar-active: #0ea5a4;
  --sidebar-count-bg: #d4a017;
  --sidebar-count-ink: #0f172a;
  --brand-mark-bg: #0ea5a4;
  --brand-mark-ink: #ffffff;
  --surface: #111827;
  --surface-alt: #1e293b;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #a7b3c7;
  --heading: #ffffff;
  --green: #2dd4bf;
  --green-soft: rgba(45, 212, 191, 0.16);
  --amber: #d4a017;
  --amber-soft: rgba(212, 160, 23, 0.18);
  --red: #ff6969;
  --red-soft: rgba(255, 105, 105, 0.14);
  --blue: #93c5fd;
  --blue-soft: rgba(147, 197, 253, 0.16);
  --action-primary: #0ea5a4;
  --action-primary-hover: #14b8b6;
  --action-secondary-bg: rgba(255, 255, 255, 0.05);
  --action-secondary-ink: #ffffff;
  --action-secondary-border: #2dd4bf;
  --accent: #d4a017;
  --accent-soft: rgba(212, 160, 23, 0.18);
  --focus-ring: rgba(45, 212, 191, 0.24);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
  --shadow-strong: 0 24px 58px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
}

body[data-auth="checking"],
body[data-auth="signed-out"] {
  background: #f1f5f9;
  color: #0f172a;
}

body[data-auth="checking"] .sidebar,
body[data-auth="checking"] .app-shell,
body[data-auth="signed-out"] .sidebar,
body[data-auth="signed-out"] .app-shell {
  display: none;
}

body[data-auth="signed-in"] .auth-screen {
  display: none;
}

.auth-screen {
  color-scheme: light;
  --navy: #0f172a;
  --teal: #0ea5a4;
  --white: #ffffff;
  --light-gray: #f1f5f9;
  --gold: #d4a017;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #e7edf7;
  --border: #d8e1eb;
  --text: #172033;
  --muted: #64748b;
  --heading: #0f172a;
  --green: #0ea5a4;
  --green-soft: #dffbf8;
  --amber: #d4a017;
  --amber-soft: #fff4d6;
  --red: #c94a44;
  --red-soft: #ffebea;
  --blue: #0f172a;
  --blue-soft: #e7edf7;
  --brand-mark-bg: #0ea5a4;
  --brand-mark-ink: #ffffff;
  --action-primary: #0f172a;
  --action-primary-hover: #18233f;
  --action-secondary-bg: #ffffff;
  --action-secondary-ink: #0f172a;
  --action-secondary-border: #0ea5a4;
  --accent: #d4a017;
  --accent-soft: #fff4d6;
  --focus-ring: rgba(14, 165, 164, 0.22);
  --shadow: 0 18px 46px rgba(15, 23, 42, 0.12);
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  overflow-y: auto;
}

.auth-screen[data-mode="form"] {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-screen[data-mode="welcome"] {
  display: block;
  padding: 0;
}

.auth-screen[data-mode="welcome"] .auth-card,
.auth-screen[data-mode="form"] .welcome-page {
  display: none;
}

.auth-card {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-card:has(#register-form.active) {
  width: min(880px, 100%);
}

.welcome-page {
  min-height: 100vh;
  background: var(--bg);
}

.welcome-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.welcome-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--heading);
  text-decoration: none;
  font-weight: 900;
  font-size: 1.04rem;
}

.welcome-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.welcome-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 9px 11px;
  border-radius: 8px;
}

.welcome-nav a:hover {
  background: var(--surface-alt);
  color: var(--heading);
}

.welcome-signin {
  justify-self: end;
}

.welcome-main {
  display: grid;
  gap: 0;
}

.welcome-hero,
.welcome-section {
  width: 100%;
  padding: clamp(42px, 7vw, 88px) clamp(18px, 5vw, 72px);
}

.welcome-hero {
  position: relative;
  min-height: min(780px, calc(100vh - 132px));
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr);
  align-items: center;
  overflow: hidden;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--bg) 92%, var(--surface)) 0%, color-mix(in srgb, var(--bg) 68%, transparent) 54%, transparent 100%),
    var(--bg);
}

.welcome-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: var(--border);
}

.welcome-copy {
  position: relative;
  z-index: 2;
  max-width: 720px;
  animation: welcomeLift 0.56s ease both;
}

.welcome-copy h1 {
  margin: 0;
  max-width: 780px;
  color: var(--heading);
  font-size: clamp(2.55rem, 6vw, 5.2rem);
  line-height: 0.98;
}

.welcome-copy p:not(.eyebrow) {
  max-width: 690px;
  margin: 22px 0 0;
  color: var(--text);
  font-size: clamp(1.02rem, 1.5vw, 1.2rem);
  line-height: 1.62;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.welcome-preview {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(120deg, transparent 0 44%, color-mix(in srgb, var(--blue-soft) 58%, transparent) 44% 100%),
    repeating-linear-gradient(90deg, transparent 0 72px, color-mix(in srgb, var(--border) 42%, transparent) 72px 73px);
}

.preview-board {
  position: absolute;
  z-index: 2;
  top: clamp(58px, 11vh, 126px);
  right: clamp(18px, 5vw, 76px);
  width: min(520px, 42vw);
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--text) 14%, transparent);
  padding: clamp(16px, 2vw, 24px);
  display: grid;
  gap: 16px;
  animation: previewFloat 7s ease-in-out infinite;
  backdrop-filter: blur(12px);
}

.preview-header,
.preview-metrics,
.preview-flow,
.preview-note {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
}

.preview-header {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.preview-header span,
.preview-note p {
  color: var(--muted);
}

.preview-header strong {
  color: var(--green);
  font-size: 0.85rem;
}

.preview-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
}

.preview-metrics span {
  display: grid;
  gap: 4px;
  min-height: 84px;
  padding: 14px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
}

.preview-metrics b {
  color: var(--heading);
  font-size: 1.35rem;
}

.preview-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.preview-flow span {
  min-height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  text-align: center;
  font-weight: 850;
  font-size: 0.82rem;
  animation: stagePulse 4.8s ease-in-out infinite;
}

.preview-flow span:nth-child(2) {
  animation-delay: 0.35s;
}

.preview-flow span:nth-child(3) {
  animation-delay: 0.7s;
}

.preview-flow span:nth-child(4) {
  animation-delay: 1.05s;
}

.preview-note {
  padding: 14px;
}

.preview-note strong {
  display: block;
  color: var(--heading);
  margin-bottom: 6px;
}

.preview-note p {
  margin: 0;
  line-height: 1.5;
}

.preview-signal-map {
  position: absolute;
  z-index: 1;
  right: clamp(28px, 7vw, 110px);
  bottom: clamp(70px, 13vh, 150px);
  width: min(520px, 42vw);
  height: 230px;
  opacity: 0.82;
  animation: mapDrift 9s ease-in-out infinite;
}

.signal-node,
.signal-line {
  position: absolute;
  display: block;
}

.signal-node {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  background: var(--green);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--green) 16%, transparent);
}

.node-a {
  left: 8%;
  top: 44%;
}

.node-b {
  left: 34%;
  top: 18%;
  background: var(--blue);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--blue) 16%, transparent);
}

.node-c {
  left: 62%;
  top: 52%;
  background: var(--amber);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--amber) 16%, transparent);
}

.node-d {
  left: 86%;
  top: 28%;
}

.signal-line {
  height: 2px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 70%, var(--blue));
  transform-origin: left center;
}

.line-a {
  left: 11%;
  top: 45%;
  width: 30%;
  transform: rotate(-28deg);
}

.line-b {
  left: 37%;
  top: 24%;
  width: 33%;
  transform: rotate(31deg);
}

.line-c {
  left: 65%;
  top: 50%;
  width: 27%;
  transform: rotate(-25deg);
}

.welcome-section {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.welcome-section:nth-of-type(3) {
  background: var(--bg);
}

.welcome-section-copy {
  max-width: 760px;
  margin-bottom: 24px;
}

.welcome-section-copy h2 {
  margin: 0;
  color: var(--heading);
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  line-height: 1.08;
}

.welcome-grid,
.welcome-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.welcome-grid article,
.welcome-steps div,
.faq-list details {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  padding: 16px;
  animation: welcomeLift 0.46s ease both;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.welcome-grid article:hover,
.welcome-steps div:hover,
.faq-list details:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--green) 34%, var(--border));
  box-shadow: 0 16px 34px color-mix(in srgb, var(--text) 8%, transparent);
}

.welcome-grid strong,
.welcome-steps strong {
  display: block;
  color: var(--heading);
  margin-bottom: 8px;
}

.welcome-grid p,
.welcome-steps p,
.faq-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.welcome-steps {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.welcome-steps span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
  margin-bottom: 12px;
}

.faq-section {
  padding-bottom: clamp(56px, 8vw, 96px);
}

.faq-list {
  display: grid;
  gap: 10px;
  max-width: 980px;
}

.faq-list details {
  background: var(--surface);
  overflow: hidden;
}

.faq-list summary {
  cursor: pointer;
  color: var(--heading);
  font-weight: 850;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary::after {
  content: "+";
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  transition: transform 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.faq-list details[open] summary::after {
  transform: rotate(45deg);
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 38%, var(--border));
}

.faq-list p {
  margin-top: 10px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.22s ease, opacity 0.18s ease;
}

.faq-list details[open] p {
  max-height: 180px;
  opacity: 1;
  animation: faqReveal 0.22s ease both;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.auth-brand h1 {
  margin-bottom: 2px;
}

.auth-brand p,
.auth-form p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-form {
  display: none;
  gap: 14px;
}

.auth-form.active {
  display: grid;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

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

.auth-section-title {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.auth-section-title strong {
  color: var(--heading);
  font-size: 0.95rem;
}

.auth-section-title span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.auth-form input,
.auth-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  min-height: 42px;
  padding: 10px 11px;
  outline: 0;
}

.auth-form input:focus,
.auth-form select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}

.auth-back {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 32px;
  padding: 0;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-weight: 850;
  text-decoration: none;
}

.auth-back:hover {
  color: var(--heading);
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  justify-self: start;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.auth-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

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

@keyframes previewFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes stagePulse {
  0%, 100% {
    box-shadow: inset 0 0 0 0 color-mix(in srgb, var(--blue) 0%, transparent);
  }
  50% {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--blue) 18%, transparent);
  }
}

@keyframes mapDrift {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(8px);
  }
}

@keyframes faqReveal {
  from {
    transform: translateY(-4px);
  }
  to {
    transform: translateY(0);
  }
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

svg path,
svg circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sidebar {
  width: 244px;
  min-height: 100vh;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 10px 0 32px color-mix(in srgb, var(--text) 6%, transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sidebar-ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.08rem;
  padding: 0 8px 22px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-mark-bg);
  color: var(--brand-mark-ink);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  appearance: none;
  border: 0;
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-muted);
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  font-weight: 650;
  text-decoration: none;
  border-left: 4px solid transparent;
}

.nav-item:hover,
.nav-item.active {
  background: var(--sidebar-hover);
  color: var(--sidebar-ink);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #ffffff;
  border-left-color: var(--accent);
  box-shadow: 0 12px 24px color-mix(in srgb, var(--sidebar-active) 20%, transparent);
}

.nav-item.active svg,
.nav-item.active .nav-count {
  color: #ffffff;
}

.nav-count {
  margin-left: auto;
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--sidebar-count-bg);
  color: var(--sidebar-count-ink);
  font-size: 0.82rem;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 8px 0;
}

.profile-chip {
  appearance: none;
  border: 1px solid var(--sidebar-border);
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--sidebar-hover) 72%, transparent);
  color: var(--sidebar-ink);
  cursor: pointer;
  text-align: left;
}

.profile-chip:hover {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--sidebar-hover) 86%, transparent);
}

.profile-chip > span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-mark-bg);
  color: var(--brand-mark-ink);
  font-weight: 800;
  font-size: 0.84rem;
}

.profile-chip strong,
.profile-chip small {
  display: block;
}

.profile-chip strong {
  font-size: 0.9rem;
}

.profile-chip small {
  color: var(--sidebar-muted);
  font-size: 0.82rem;
}

.app-shell {
  width: calc(100% - 244px);
  min-height: 100vh;
  margin-left: 244px;
}

.topbar {
  min-height: 82px;
  padding: 18px 28px;
  background: color-mix(in srgb, var(--bg) 82%, var(--surface));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.title-card {
  min-width: 220px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--teal) 28%, var(--border));
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--heading);
  font-size: 1.42rem;
  line-height: 1.2;
}

h2 {
  margin-bottom: 4px;
  color: var(--heading);
  font-size: 1.08rem;
  line-height: 1.25;
}

h3 {
  color: var(--heading);
  font-size: 1rem;
}

.topbar-actions,
.import-actions,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-switch {
  appearance: none;
  min-height: 42px;
  border: 1px solid color-mix(in srgb, var(--teal) 28%, var(--border));
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 800;
}

.theme-switch:hover {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.theme-switch-track {
  width: 48px;
  height: 26px;
  border-radius: 999px;
  padding: 3px;
  background: color-mix(in srgb, var(--navy) 8%, var(--surface-alt));
  border: 1px solid color-mix(in srgb, var(--teal) 28%, var(--border));
  display: flex;
  align-items: center;
}

.theme-switch-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 2px 8px rgba(10, 14, 16, 0.16);
  transition: transform 0.16s ease;
}

.theme-switch[aria-checked="true"] .theme-switch-thumb {
  transform: translateX(21px);
}

.theme-switch-copy {
  display: grid;
  gap: 1px;
  text-align: left;
  line-height: 1.1;
}

.theme-switch-copy strong {
  font-size: 0.86rem;
}

.theme-switch-copy small {
  color: var(--muted);
  font-size: 0.74rem;
}

.btn,
.icon-btn,
.segment,
.filter {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 750;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease, color 0.12s ease;
}

.btn {
  padding: 0 14px;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover,
.icon-btn:hover,
.segment:hover,
.filter:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--action-primary), color-mix(in srgb, var(--action-primary) 72%, var(--teal)));
  color: #fff;
  border-color: color-mix(in srgb, var(--action-primary) 82%, var(--teal));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--action-primary) 24%, transparent);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--action-primary-hover), var(--teal));
  box-shadow: 0 14px 28px color-mix(in srgb, var(--action-primary) 30%, transparent);
}

.btn-secondary {
  background: var(--action-secondary-bg);
  border-color: color-mix(in srgb, var(--action-secondary-border) 65%, var(--border));
  color: var(--action-secondary-ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--action-secondary-border) 12%, transparent);
}

.btn-secondary:hover {
  background: color-mix(in srgb, var(--teal) 10%, var(--surface));
  border-color: var(--teal);
  color: var(--heading);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 38%, transparent);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--red) 14%, transparent);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

.icon-btn {
  width: 38px;
  padding: 0;
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
}

.icon-btn:hover {
  color: var(--teal);
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal) 10%, var(--surface));
}

.icon-btn.danger {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 35%, var(--border));
  background: var(--red-soft);
}

.view {
  display: none;
  padding: 24px 28px 34px;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-grid-small {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card,
.panel,
.toolbar-panel,
.candidate-command-panel,
.candidate-control-grid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px;
  min-height: 124px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.metric-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-value {
  color: var(--heading);
  font-size: 2rem;
  font-weight: 850;
  line-height: 1.05;
  margin: 8px 0 6px;
}

.metric-detail {
  color: var(--muted);
  font-size: 0.88rem;
}

.metric-accent {
  height: 4px;
  width: var(--accent-width, 60%);
  max-width: 100%;
  border-radius: 4px;
  background: var(--green);
  margin-top: 14px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.side-stack {
  display: grid;
  gap: 16px;
}

.panel {
  overflow: hidden;
}

.panel-header {
  min-height: 66px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-header p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 0;
}

.segmented,
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.segment,
.filter {
  min-height: 36px;
  padding: 0 12px;
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--muted);
  font-size: 0.86rem;
}

.segment.active,
.filter.active {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--teal) 24%, transparent);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

th,
td {
  padding: 13px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--surface-alt);
}

td {
  font-size: 0.94rem;
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--surface-alt) 76%, transparent);
}

.candidate-cell {
  display: grid;
  gap: 2px;
}

.candidate-cell strong {
  color: var(--heading);
}

.candidate-cell span,
.subtle {
  color: var(--muted);
  font-size: 0.84rem;
}

.pill,
.risk-pill,
.status-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.pill {
  color: var(--muted);
  background: var(--surface-alt);
}

.risk-pill.low {
  color: var(--green);
  background: var(--green-soft);
}

.risk-pill.medium {
  color: var(--amber);
  background: var(--amber-soft);
}

.risk-pill.high {
  color: var(--red);
  background: var(--red-soft);
}

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

.score-bar {
  width: 100px;
  height: 7px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}

.score-bar > span {
  display: block;
  height: 100%;
  width: var(--score, 0%);
  border-radius: inherit;
  background: var(--bar-color, var(--green));
}

.table-action {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--teal) 52%, var(--border));
  background: color-mix(in srgb, var(--teal) 10%, var(--surface));
  color: var(--heading);
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--teal) 10%, transparent);
}

.table-action:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
  transform: translateY(-1px);
}

.sort-header {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  letter-spacing: inherit;
  text-transform: inherit;
}

.sort-header:hover,
.sort-header.active {
  color: var(--teal);
}

.sort-header span {
  min-width: 28px;
  color: var(--green);
  font-size: 0.72rem;
  text-transform: lowercase;
}

.select-cell {
  width: 42px;
  text-align: center;
}

.row-check,
#select-visible-candidates {
  width: 17px;
  height: 17px;
  accent-color: var(--green);
  cursor: pointer;
}

.signal-bars {
  display: grid;
  gap: 13px;
  padding: 16px 18px 18px;
}

.signal-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
}

.signal-row span:first-child {
  color: var(--muted);
  font-weight: 750;
}

.signal-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}

.signal-track > span {
  display: block;
  height: 100%;
  width: var(--width, 0%);
  border-radius: inherit;
  background: var(--color, var(--blue));
}

.flag-list,
.activity-list,
.weight-list,
.guardrail-list {
  display: grid;
}

.flag-card,
.activity-card,
.weight-row,
.guardrail {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.flag-card:last-child,
.activity-card:last-child,
.weight-row:last-child,
.guardrail:last-child {
  border-bottom: 0;
}

.flag-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
}

.flag-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-weight: 850;
}

.flag-icon.high {
  color: var(--red);
  background: var(--red-soft);
}

.flag-icon.medium {
  color: var(--amber);
  background: var(--amber-soft);
}

.flag-icon.low {
  color: var(--green);
  background: var(--green-soft);
}

.flag-card strong,
.activity-card strong,
.guardrail strong {
  display: block;
  color: var(--heading);
  margin-bottom: 3px;
}

.flag-card span,
.activity-card span,
.guardrail span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.flag-evidence {
  display: block;
  margin-top: 7px;
  color: var(--heading);
  font-size: 0.8rem;
  font-weight: 800;
}

.flag-evidence.muted {
  color: var(--muted);
  font-weight: 700;
}

.flag-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
}

.flag-stat-grid span {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.flag-stat-grid b {
  color: var(--heading);
  font-size: 0.92rem;
}

.flag-stat-grid small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.flag-stat-grid.empty {
  grid-template-columns: 1fr;
}

.candidate-command-panel {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: minmax(240px, 0.55fr) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.candidate-command-panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.candidate-insight-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.candidate-insight {
  min-height: 86px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  padding: 10px;
  display: grid;
  align-content: space-between;
  gap: 4px;
}

.candidate-insight span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.candidate-insight strong {
  color: var(--heading);
  font-size: 1.38rem;
  line-height: 1;
}

.candidate-insight small {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.25;
}

.toolbar-panel {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.search-field {
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--muted);
}

.search-field input {
  width: 100%;
  min-height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.candidate-control-grid {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.candidate-primary-controls {
  grid-template-columns: minmax(260px, 1.4fr) repeat(2, minmax(180px, 0.65fr));
  margin-bottom: 10px;
}

.candidate-control-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.candidate-control-grid input,
.candidate-control-grid select {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 11px;
  outline: 0;
}

.candidate-control-grid input:focus,
.candidate-control-grid select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.selection-toolbar,
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--teal) 18%, var(--border));
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.candidate-lifecycle-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.candidate-lifecycle-tabs button {
  min-height: 62px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--navy) 18%, var(--border));
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--teal) 7%, transparent), transparent 44%),
    var(--surface);
  color: var(--text);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.candidate-lifecycle-tabs button::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--teal);
}

.candidate-lifecycle-tabs button:hover {
  transform: translateY(-2px);
  border-color: var(--teal);
  box-shadow: var(--shadow-strong);
}

.candidate-lifecycle-tabs button.active {
  background:
    linear-gradient(135deg, var(--navy), color-mix(in srgb, var(--navy) 76%, var(--teal)));
  color: #ffffff;
  border-color: var(--teal);
  box-shadow: 0 16px 34px color-mix(in srgb, var(--navy) 24%, transparent);
}

.candidate-lifecycle-tabs button.active::before {
  background: var(--accent);
}

.candidate-lifecycle-tabs span {
  color: var(--heading);
  font-weight: 850;
}

.candidate-lifecycle-tabs button.active span {
  color: #ffffff;
}

.candidate-lifecycle-tabs strong {
  min-width: 38px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--teal) 12%, var(--surface-alt));
  color: var(--heading);
  padding: 6px 10px;
  text-align: center;
}

.candidate-lifecycle-tabs button.active strong {
  background: var(--accent);
  color: var(--navy);
}

.outcome-cell {
  display: grid;
  gap: 2px;
}

.outcome-cell strong {
  font-size: 0.9rem;
  color: var(--heading);
}

.outcome-cell small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.selection-toolbar {
  margin-bottom: 14px;
  padding: 12px 14px;
}

.selection-toolbar[hidden] {
  display: none;
}

.selection-toolbar span,
.pagination-bar span,
.pagination-bar label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.pagination-bar {
  border-width: 1px 0 0;
  border-radius: 0 0 8px 8px;
  box-shadow: none;
  padding: 12px 14px;
}

.pagination-bar label {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pagination-bar select {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 8px;
}

.import-grid,
.model-grid,
.outcome-analytics-grid,
.data-audit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.outcome-analytics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.ingestion-panel {
  grid-column: 1 / -1;
}

.model-grid .rules-panel {
  grid-column: 2;
}

.audit-wide {
  grid-column: 1 / -1;
}

.source-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px 0;
}

.source-stat,
.source-card,
.connector-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
}

.source-stat {
  display: grid;
  gap: 5px;
  padding: 12px;
}

.source-stat span,
.source-stat small,
.source-card span,
.source-card small,
.connector-card span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.source-stat strong {
  color: var(--heading);
  font-size: 1.35rem;
}

.source-list,
.connector-list {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
}

.connector-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.connector-admin-tools {
  border-top: 1px solid var(--border);
  padding: 16px;
}

.audit-finding-list,
.audit-feature-list,
.taxonomy-list,
.audit-date-list,
.audit-source-type-list,
.audit-mini-list,
.completion-list {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
}

.audit-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px 0;
}

.audit-finding,
.audit-feature,
.taxonomy-card,
.audit-date-row,
.completion-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  padding: 12px;
}

.audit-finding {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 0.8fr);
  gap: 12px;
  align-items: start;
}

.audit-finding.high {
  border-color: color-mix(in srgb, var(--red) 42%, var(--border));
}

.audit-finding.medium {
  border-color: color-mix(in srgb, var(--amber) 42%, var(--border));
}

.audit-finding.info {
  border-color: color-mix(in srgb, var(--blue) 30%, var(--border));
}

.audit-finding strong,
.audit-feature strong,
.taxonomy-card strong,
.completion-summary strong,
.completion-row span,
.audit-date-row strong {
  display: block;
  color: var(--heading);
}

.audit-finding span,
.audit-finding small,
.audit-feature span,
.audit-feature small,
.taxonomy-card span,
.taxonomy-card small,
.audit-date-row span,
.audit-date-row small,
.completion-summary span,
.completion-summary small,
.completion-row small,
.audit-matrix-table td span,
.audit-matrix-table td small {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.42;
}

.audit-finding b {
  display: inline-block;
  width: fit-content;
  margin-bottom: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface);
  color: var(--heading);
  font-size: 0.78rem;
}

.audit-date-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.7fr) minmax(180px, 1fr) minmax(120px, 0.6fr);
  gap: 10px;
  align-items: center;
}

.compact-source-summary,
.audit-summary-strip {
  padding-bottom: 0;
}

.audit-mini-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: 0;
}

.audit-mini-list span {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--muted);
  padding: 9px 10px;
  font-size: 0.84rem;
}

.audit-mini-list b {
  color: var(--heading);
  font-weight: 800;
}

.audit-matrix-table td:first-child strong,
.audit-matrix-table td:first-child span {
  display: block;
}

.audit-status {
  display: inline-flex;
  min-width: 74px;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--heading);
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.audit-status.yes {
  background: var(--green-soft);
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 35%, var(--border));
}

.audit-status.partial,
.audit-status.derivable {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 35%, var(--border));
}

.audit-status.no,
.audit-status.no-records {
  background: var(--red-soft);
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 35%, var(--border));
}

.audit-feature {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(120px, 0.7fr) 56px;
  gap: 10px;
  align-items: center;
}

.audit-feature small {
  grid-column: 1 / -1;
}

.audit-feature.available {
  border-color: color-mix(in srgb, var(--green) 36%, var(--border));
}

.audit-feature.partial {
  border-color: color-mix(in srgb, var(--amber) 36%, var(--border));
}

.taxonomy-card {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 64px;
  gap: 10px;
  align-items: start;
}

.taxonomy-card b {
  color: var(--heading);
  text-align: right;
}

.taxonomy-card small {
  grid-column: 1 / -1;
}

.completion-summary {
  border-bottom: 1px solid var(--border);
  padding: 16px;
}

.completion-summary strong {
  font-size: 1.12rem;
  margin-bottom: 4px;
}

.completion-row {
  display: grid;
  grid-template-columns: 72px minmax(180px, 0.7fr) minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
}

.completion-row b {
  border-radius: 999px;
  padding: 4px 8px;
  text-align: center;
  font-size: 0.78rem;
}

.completion-row.met b {
  background: var(--green-soft);
  color: var(--green);
}

.completion-row.open b {
  background: var(--amber-soft);
  color: var(--amber);
}

.connector-admin-tools h3 {
  margin-bottom: 5px;
}

.connector-admin-tools p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.source-card,
.connector-card {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, auto);
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.connector-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

.source-card strong,
.source-card span,
.source-card small,
.connector-card strong,
.connector-card span {
  display: block;
}

.source-card strong,
.connector-card strong {
  color: var(--heading);
}

.source-card b,
.connector-card b {
  justify-self: end;
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.76rem;
  text-transform: capitalize;
}

.source-card.active b,
.connector-card.active b {
  background: var(--green-soft);
  color: var(--green);
}

.source-card.planned b,
.connector-card.planned b {
  background: var(--amber-soft);
  color: var(--amber);
}

.panel-header.compact {
  min-height: 0;
  padding: 14px 16px;
}

.analytics-list {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
}

.analytics-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(120px, 0.7fr) 64px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
}

.analytics-row strong,
.analytics-row span {
  display: block;
}

.analytics-row strong {
  color: var(--heading);
}

.analytics-row span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.analytics-row b {
  color: var(--heading);
  text-align: right;
  font-size: 0.92rem;
}

.rule-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px 0;
}

.rule-list,
.matched-rule-list {
  display: grid;
  gap: 10px;
}

.rule-list {
  padding: 14px 16px 16px;
}

.rule-card,
.matched-rule {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  padding: 12px;
}

.rule-card {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 0.75fr) 52px;
  gap: 12px;
  align-items: start;
}

.rule-card.high {
  border-color: color-mix(in srgb, var(--green) 42%, var(--border));
}

.rule-card.medium {
  border-color: color-mix(in srgb, var(--amber) 42%, var(--border));
}

.rule-card.low {
  border-color: color-mix(in srgb, var(--blue) 30%, var(--border));
}

.rule-card strong,
.matched-rule strong {
  display: block;
  color: var(--heading);
  margin-bottom: 4px;
}

.rule-card span,
.rule-card p,
.matched-rule span,
.matched-rule small {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.42;
}

.rule-card p {
  grid-column: 1 / -1;
  margin: 0;
}

.rule-card b {
  color: var(--heading);
  text-align: right;
}

.rule-metrics {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.rule-metrics span {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  padding: 4px 8px;
}

.matched-rule {
  display: grid;
  gap: 4px;
}

.drop-zone {
  margin: 18px;
  min-height: 290px;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-alt) 48%, transparent);
}

.drop-zone.dragging {
  border-color: var(--green);
  background: var(--green-soft);
}

.drop-zone svg {
  width: 40px;
  height: 40px;
  color: var(--green);
}

.drop-zone strong {
  color: var(--heading);
  font-size: 1.05rem;
}

.drop-zone span {
  max-width: 460px;
  font-size: 0.85rem;
  padding: 0 12px;
}

.import-actions {
  padding: 0 18px 18px;
  justify-content: flex-start;
}

.quality-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
  padding: 0 18px 18px;
}

.quality-grid h3 {
  margin: 0 0 10px;
}

.compact-activity-list {
  max-height: 260px;
  overflow: auto;
}

.import-preview-panel {
  overflow: visible;
}

.preview-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.preview-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 18px 0;
}

.preview-stat {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  padding: 12px;
  display: grid;
  gap: 5px;
  min-width: 0;
}

.preview-stat span,
.preview-stat small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.preview-stat strong {
  color: var(--heading);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.preview-guidance {
  margin: 14px 18px 0;
  border: 1px solid color-mix(in srgb, var(--blue) 32%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
  padding: 12px 14px;
  display: grid;
  gap: 4px;
}

.preview-guidance strong {
  color: var(--heading);
}

.preview-guidance span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.preview-table-wrap {
  margin-top: 16px;
}

.preview-table {
  min-width: 1180px;
}

.preview-table th,
.preview-table td {
  padding: 10px;
  vertical-align: top;
}

.preview-table input[type="text"],
.preview-table input:not([type]) {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  font-size: 0.88rem;
}

.preview-table input:focus {
  outline: 2px solid color-mix(in srgb, var(--green) 35%, transparent);
  border-color: var(--green);
}

.preview-warnings {
  min-width: 260px;
}

.preview-source {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  min-width: 130px;
  overflow-wrap: anywhere;
}

.preview-warnings span {
  display: block;
  border: 1px solid color-mix(in srgb, var(--amber) 42%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--amber) 10%, var(--surface));
  color: var(--text);
  padding: 7px 9px;
  font-size: 0.8rem;
  line-height: 1.35;
  margin-bottom: 6px;
}

.preview-warnings .ok {
  border-color: color-mix(in srgb, var(--green) 36%, var(--border));
  background: var(--green-soft);
  color: var(--green);
  font-weight: 800;
}

.preview-document-text {
  margin: 16px 18px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  padding: 14px;
}

.preview-document-text strong {
  color: var(--heading);
}

.preview-document-text p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 18px;
}

.connector-admin-tools .admin-actions {
  padding: 14px 0 0;
  justify-content: flex-start;
}

.activity-card {
  display: grid;
  gap: 4px;
}

.weight-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 54px;
  gap: 12px;
  align-items: center;
}

.weight-row strong {
  color: var(--heading);
  font-size: 0.9rem;
}

.weight-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}

.weight-track > span {
  display: block;
  height: 100%;
  width: var(--weight, 0%);
  background: var(--blue);
}

.candidate-page-form {
  overflow: visible;
}

.form-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.form-section:last-child {
  border-bottom: 0;
}

.form-section h3 {
  margin-bottom: 14px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 20px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, var(--surface-alt));
}

.candidate-form-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.form-grid.wide {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.candidate-page-form label,
.workflow-actions label,
.model-copy label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.candidate-page-form label > span {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.required-chip {
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 13%, transparent);
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
  padding: 2px 7px;
  font-size: 0.68rem;
  line-height: 1.25;
  text-transform: uppercase;
}

.candidate-page-form input,
.candidate-page-form select,
.candidate-page-form textarea,
.workflow-actions textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  min-height: 40px;
  padding: 10px 11px;
  outline: 0;
}

.candidate-page-form textarea,
.workflow-actions textarea {
  min-height: 92px;
  resize: vertical;
}

.candidate-page-form input:focus,
.candidate-page-form select:focus,
.candidate-page-form textarea:focus,
.workflow-actions textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}

.healthcare-only[hidden] {
  display: none !important;
}

.work-history-editor {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.work-history-editor h4 {
  margin: 0 0 4px;
  color: var(--heading);
  font-size: 1rem;
}

#add-candidate-work-row,
[data-drawer-action="add-history-row"] {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--teal)));
  border-color: color-mix(in srgb, var(--accent) 78%, var(--teal));
  color: var(--navy);
  font-weight: 900;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 26%, transparent);
}

#add-candidate-work-row:hover,
[data-drawer-action="add-history-row"]:hover {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 88%, #ffffff), var(--teal));
  border-color: var(--accent);
  color: var(--navy);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--accent) 32%, transparent);
}

.work-history-table-wrap {
  overflow-x: auto;
  border: 1px solid color-mix(in srgb, var(--teal) 24%, var(--border));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.work-history-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.work-history-table th,
.work-history-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.work-history-table th {
  color: var(--heading);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--navy) 7%, var(--surface-alt));
  border-bottom: 2px solid color-mix(in srgb, var(--teal) 34%, var(--border));
}

.work-history-table tr:last-child td {
  border-bottom: 0;
}

.work-history-table input,
.work-history-table select {
  min-width: 128px;
  min-height: 36px;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.work-history-table input:focus,
.work-history-table select:focus {
  outline: 0;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.work-history-table td:nth-child(1),
.work-history-table td:nth-child(2) {
  min-width: 170px;
}

.work-history-table td:nth-child(4) {
  min-width: 140px;
}

.work-history-table td:nth-child(5) {
  min-width: 100px;
}

.work-history-table td:nth-child(8) {
  min-width: 190px;
}

.work-history-empty td {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 16px;
}

.workflow-mini {
  display: grid;
  min-width: 150px;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.workflow-timeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.workflow-step {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  min-width: 0;
}

.workflow-step span {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: var(--surface-alt);
}

.workflow-step.complete span,
.workflow-step.current span {
  background: var(--green);
}

.workflow-step.current strong {
  color: var(--green);
}

.workflow-step.locked span {
  background: var(--red-soft);
}

.workflow-terminal {
  margin-bottom: 14px;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid color-mix(in srgb, var(--red) 24%, transparent);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 850;
}

.workflow-actions {
  display: grid;
  gap: 12px;
}

.stage-history {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 12px;
}

.stage-history div {
  display: grid;
  gap: 2px;
}

.stage-history strong {
  color: var(--heading);
  font-size: 0.9rem;
}

.stage-history span {
  color: var(--muted);
  font-size: 0.84rem;
}

.model-copy {
  display: grid;
}

.model-list-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 18px;
}

.model-list-grid h3 {
  margin-bottom: 10px;
}

.model-list-grid ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.drawer-overlay,
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 16, 0.48);
  z-index: 50;
}

.drawer-overlay[hidden],
.modal-overlay[hidden] {
  display: none;
}

.drawer {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(var(--drawer-width, 1280px), calc(100vw - 24px));
  min-width: min(860px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(10, 14, 16, 0.28);
  transform: translate(-50%, -47%) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 60;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.drawer-header,
.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.drawer-header h2,
.modal-header h2 {
  margin-bottom: 5px;
}

.drawer-header p:last-child {
  color: var(--muted);
  margin-bottom: 0;
  font-size: 0.92rem;
}

.modal-header-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.drawer-body {
  padding: 18px 20px 22px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 14px;
  align-items: start;
}

.drawer-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 100%;
  cursor: ew-resize;
  z-index: 2;
}

.drawer-resize-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 4px;
  width: 3px;
  height: 54px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 34%, transparent);
  transform: translateY(-50%);
}

.drawer.resizing {
  user-select: none;
}

.drawer.resizing .drawer-resize-handle::after,
.drawer-resize-handle:hover::after {
  background: var(--green);
}

.detail-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-alt) 38%, transparent);
  padding: 14px;
}

.detail-section h3,
.danger-zone h3 {
  margin-bottom: 10px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-title-row h3 {
  margin-bottom: 0;
}

.btn-compact {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 0.84rem;
}

.detail-score {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.score-orb {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 8px solid currentColor;
  color: var(--green);
  font-size: 1.65rem;
  font-weight: 900;
}

.score-orb.medium {
  color: var(--amber);
}

.score-orb.high {
  color: var(--red);
}

.detail-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-cell {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-alt);
}

.detail-cell span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.detail-cell strong {
  color: var(--heading);
}

.subscore-list {
  display: grid;
  gap: 10px;
}

.subscore-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.drawer-form {
  display: grid;
  gap: 12px;
}

.drawer-form label,
.modal label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.drawer-form .checkbox-line {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--text);
  width: fit-content;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.checkbox-line input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--green);
}

.checkbox-line span {
  line-height: 1.25;
}

.drawer-form input,
.drawer-form select,
.drawer-form textarea,
.modal input,
.modal select,
.modal textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 11px;
  outline: 0;
}

.drawer-form input:focus,
.drawer-form select:focus,
.drawer-form textarea:focus,
.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}

.feature-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.feature-meta span {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  padding: 5px 9px;
}

.resume-intel-summary {
  margin-bottom: 14px;
}

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

.resume-intel-grid h4 {
  color: var(--heading);
  font-size: 0.92rem;
  margin-bottom: 8px;
}

.resume-intel-list {
  display: grid;
  gap: 8px;
}

.resume-intel-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  padding: 10px;
}

.resume-intel-card strong,
.resume-intel-card span,
.resume-intel-card small {
  display: block;
}

.resume-intel-card strong {
  color: var(--heading);
  margin-bottom: 4px;
}

.resume-intel-card span,
.resume-intel-card small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.profile-edit-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-grid label {
  min-width: 0;
}

.history-list {
  display: grid;
  gap: 10px;
}

.section-help {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.ahca-scope-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  padding: 12px;
  margin-bottom: 12px;
}

.ahca-scope-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ahca-scope-card strong {
  display: block;
  color: var(--heading);
  margin-top: 3px;
}

.ahca-scope-card p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.ahca-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 0.74rem;
  font-weight: 850;
}

.ahca-pill.applicable {
  color: var(--green);
  background: var(--green-soft);
  border-color: color-mix(in srgb, var(--green) 26%, transparent);
}

.ahca-pill.not_applicable {
  color: var(--muted);
  background: var(--surface-alt);
}

.ahca-pill.unknown {
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 13%, var(--surface));
  border-color: color-mix(in srgb, var(--amber) 30%, transparent);
}

.history-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.history-card strong {
  color: var(--heading);
  font-size: 1rem;
}

.history-card b {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 650;
}

.history-card span,
.history-card small,
.empty-mini {
  color: var(--muted);
}

.history-card small,
.empty-mini {
  font-size: 0.86rem;
  line-height: 1.45;
}

.empty-mini {
  margin: 0;
}

.history-editor {
  margin-top: 12px;
}

.drawer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.workflow-help {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.stage-history h4 {
  margin: 0;
  color: var(--heading);
  font-size: 0.9rem;
}

.history-event {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.history-event p {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.saved-notes {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  padding: 10px;
}

.saved-notes strong {
  display: block;
  color: var(--heading);
  margin-bottom: 6px;
}

.saved-notes p {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  max-height: 180px;
  overflow: auto;
}

.danger-zone {
  grid-column: 1 / -1;
  border: 1px solid color-mix(in srgb, var(--red) 36%, var(--border));
  border-radius: 8px;
  background: var(--red-soft);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.danger-zone p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.modal-overlay {
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal {
  width: min(880px, 100%);
  max-height: min(92vh, 900px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.settings-modal {
  width: min(980px, 100%);
}

.settings-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: 520px;
}

.settings-tabs {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 16px;
  border-right: 1px solid color-mix(in srgb, var(--teal) 18%, var(--border));
  background: linear-gradient(180deg, color-mix(in srgb, var(--navy) 8%, var(--surface-alt)), var(--surface-alt));
}

.settings-tab {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--navy) 10%, transparent);
  border-left: 4px solid transparent;
  border-radius: 8px;
  min-height: 40px;
  background: color-mix(in srgb, var(--surface) 56%, transparent);
  color: var(--heading);
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 850;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.settings-tab:hover,
.settings-tab.active {
  color: var(--heading);
  background: var(--surface);
  border-color: color-mix(in srgb, var(--teal) 42%, var(--border));
  border-left-color: var(--teal);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--teal) 12%, transparent);
}

.settings-tab:hover {
  transform: translateX(2px);
}

.settings-tab.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--navy), color-mix(in srgb, var(--navy) 78%, var(--teal)));
  border-left-color: var(--accent);
}

.settings-panels {
  padding: 18px;
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: grid;
  gap: 16px;
}

.settings-copy h3 {
  margin-bottom: 5px;
}

.settings-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

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

.settings-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.settings-standard,
.settings-account-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  padding: 12px;
}

.settings-standard {
  display: grid;
  gap: 5px;
}

.settings-standard span,
.settings-account-card span,
.settings-account-card small {
  color: var(--muted);
  font-size: 0.82rem;
}

.settings-standard strong,
.settings-account-card strong {
  color: var(--heading);
}

.settings-account-card {
  display: grid;
  gap: 5px;
}

.form-grid {
  padding: 18px 20px 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.full-field {
  padding: 0 20px 16px;
}

.modal-actions {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
}

.empty-state {
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .welcome-hero,
  .welcome-grid,
  .welcome-steps {
    grid-template-columns: 1fr;
  }

  .welcome-hero {
    min-height: auto;
  }

  .welcome-preview {
    opacity: 0.48;
  }

  .preview-board {
    right: -42px;
    width: min(520px, 72vw);
  }

  .preview-signal-map {
    display: none;
  }

  .metric-grid,
  .metric-grid-small {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preview-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .import-grid,
  .model-grid,
  .outcome-analytics-grid,
  .data-audit-grid,
  .candidate-command-panel {
    grid-template-columns: 1fr;
  }

  .model-grid .rules-panel {
    grid-column: auto;
  }

  .candidate-insight-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-grid.wide {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .candidate-primary-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .welcome-topbar {
    position: static;
    grid-template-columns: 1fr auto;
  }

  .auth-card:has(#register-form.active) {
    width: min(680px, 100%);
  }

  .welcome-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .welcome-signin {
    grid-column: 2;
    grid-row: 1;
  }

  body {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    min-height: auto;
    padding: 14px;
  }

  .brand {
    padding-bottom: 14px;
  }

  .nav-list {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    overflow-x: auto;
  }

  .nav-item {
    justify-content: center;
    min-width: 126px;
  }

  .sidebar-footer {
    display: none;
  }

  .app-shell {
    width: 100%;
    margin-left: 0;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .title-card {
    width: 100%;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .preview-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .view {
    padding: 18px;
  }

  .toolbar-panel {
    align-items: stretch;
    flex-direction: column;
  }

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

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .search-field {
    min-width: 0;
  }

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

  .form-grid.wide,
  .model-list-grid,
  .connector-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .drawer {
    width: min(760px, calc(100vw - 24px));
    min-width: 0;
  }

  .drawer-body {
    grid-template-columns: 1fr;
  }

  .drawer-resize-handle {
    display: none;
  }
}

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

  .welcome-signin {
    grid-column: auto;
    grid-row: auto;
    justify-self: stretch;
  }

  .welcome-nav {
    display: none;
  }

  .welcome-copy h1 {
    font-size: 2.35rem;
  }

  .preview-board {
    top: 48%;
    right: -122px;
    width: min(360px, 92vw);
    opacity: 0.5;
  }

  .auth-form-grid {
    grid-template-columns: 1fr;
  }

  .welcome-actions,
  .welcome-actions .btn {
    width: 100%;
  }

  .preview-metrics,
  .preview-flow {
    grid-template-columns: 1fr;
  }

  .preview-summary {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .metric-grid-small,
  .form-grid,
  .form-grid.wide,
  .detail-grid,
  .resume-intel-grid,
  .feature-grid,
  .profile-edit-grid {
    grid-template-columns: 1fr;
  }

  .workflow-timeline,
  .model-list-grid,
  .rule-summary,
  .source-summary,
  .audit-stat-grid,
  .audit-mini-list,
  .connector-list,
  .candidate-insight-grid,
  .candidate-control-grid,
  .settings-grid,
  .settings-standard-grid {
    grid-template-columns: 1fr;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .signal-row,
  .weight-row,
  .analytics-row,
  .rule-card,
  .source-card,
  .connector-card,
  .audit-finding,
  .audit-feature,
  .audit-date-row,
  .completion-row,
  .subscore-row,
  .detail-score {
    grid-template-columns: 1fr;
  }

  .analytics-row b,
  .rule-card b,
  .source-card b,
  .taxonomy-card b,
  .connector-card b {
    justify-self: start;
    text-align: left;
  }

  .score-orb {
    width: 76px;
    height: 76px;
  }

  .btn {
    width: 100%;
  }

  .topbar-actions .icon-btn {
    width: 42px;
  }

  .danger-zone,
  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Billing, pricing tiers, and industry personalization */

.welcome-topbar-actions {
  justify-self: end;
  display: inline-flex;
  gap: 10px;
}

.welcome-trust {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 26px 0 0;
  padding: 0;
}

.welcome-trust li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.welcome-trust li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.welcome-section-subline {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 680px;
}

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

.industry-chip {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  padding: 14px;
  display: grid;
  gap: 6px;
  align-content: start;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.industry-chip:hover {
  transform: translateY(-2px);
  border-color: var(--green);
}

.industry-chip strong {
  color: var(--heading);
  font-size: 0.95rem;
}

.industry-chip span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.pricing-section {
  background: var(--bg);
}

.billing-cycle-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.cycle-option {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 9px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cycle-option span {
  font-size: 0.7rem;
  font-weight: 850;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 999px;
  padding: 2px 8px;
}

.cycle-option.active {
  background: var(--action-primary);
  color: var(--white, #ffffff);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.pricing-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 24px 22px 22px;
  box-shadow: var(--shadow);
}

.pricing-card.highlight {
  border-color: var(--green);
  box-shadow: 0 22px 52px color-mix(in srgb, var(--green) 18%, transparent);
}

.pricing-card.current {
  border-color: var(--accent);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 22px;
  background: var(--accent);
  color: #0f172a;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}

.pricing-card h3 {
  margin: 2px 0 0;
  color: var(--heading);
  font-size: 1.3rem;
}

.pricing-audience {
  margin: 0;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.pricing-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: 42px;
}

.pricing-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.pricing-price strong {
  color: var(--heading);
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
}

.pricing-price span {
  color: var(--muted);
  font-size: 0.82rem;
}

.pricing-savings {
  margin: 0;
  color: var(--amber);
  font-size: 0.8rem;
  font-weight: 800;
}

.pricing-meta {
  list-style: none;
  margin: 6px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  display: grid;
  gap: 4px;
}

.pricing-meta li {
  color: var(--heading);
  font-size: 0.85rem;
  font-weight: 750;
}

.pricing-features {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  align-content: start;
  flex: 1;
}

.pricing-features li {
  position: relative;
  padding-left: 22px;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.45;
}

.pricing-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 12px;
  height: 7px;
  border-left: 2.5px solid var(--green);
  border-bottom: 2.5px solid var(--green);
  transform: rotate(-45deg);
}

.pricing-cta {
  margin-top: 12px;
  justify-content: center;
}

.pricing-cta[disabled] {
  opacity: 0.6;
  cursor: default;
}

.pricing-footnote {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
  max-width: 760px;
}

.pricing-loading {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.selected-plan-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green-soft);
  padding: 12px 14px;
  margin-top: 14px;
}

.selected-plan-banner div {
  display: grid;
  gap: 2px;
}

.selected-plan-banner strong {
  color: var(--heading);
  font-size: 0.92rem;
}

.selected-plan-banner span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.selected-plan-banner .link-button {
  white-space: nowrap;
}

.register-industry-preview {
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: var(--surface-alt);
  padding: 14px;
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.register-industry-preview strong {
  color: var(--heading);
  font-size: 0.92rem;
}

.register-industry-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.industry-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.industry-preview-grid div {
  display: grid;
  gap: 4px;
  align-content: start;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.industry-preview-grid span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.industry-preview-grid b {
  color: var(--heading);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.45;
}

.billing-screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  overflow-y: auto;
}

body[data-auth="signed-in"][data-billing="required"] .billing-screen {
  display: block;
}

body[data-billing="required"] .sidebar,
body[data-billing="required"] .app-shell {
  display: none !important;
}

.billing-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.billing-topbar .welcome-brand {
  cursor: default;
}

.billing-topbar-actions {
  display: inline-flex;
  gap: 10px;
}

.billing-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(36px, 6vw, 64px) clamp(18px, 4vw, 56px) 72px;
}

.billing-main h1 {
  margin: 0 0 10px;
  color: var(--heading);
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1.04;
}

.billing-main > p:not(.eyebrow) {
  margin: 0 0 18px;
  color: var(--muted);
  max-width: 760px;
  line-height: 1.6;
}

.billing-message {
  margin-bottom: 14px;
  color: var(--red);
  font-weight: 700;
}

.billing-message:empty {
  display: none;
}

@media (max-width: 1180px) {
  .industry-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .pricing-tagline {
    min-height: 0;
  }
}

@media (max-width: 840px) {
  .welcome-topbar-actions {
    grid-column: 2;
    grid-row: 1;
  }

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

  .industry-preview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .welcome-topbar-actions {
    grid-column: auto;
    grid-row: auto;
    justify-self: stretch;
    display: grid;
    gap: 8px;
  }

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

  .billing-cycle-toggle {
    width: 100%;
    justify-content: center;
  }

  .selected-plan-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .billing-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .billing-topbar-actions {
    width: 100%;
    display: grid;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
