:root {
  color-scheme: light;
  --bg: #f6f8f6;
  --surface: #ffffff;
  --surface-soft: #f9fbf9;
  --ink: #101b16;
  --muted: #5f6f62;
  --subtle: #748075;
  --line: #d9e3db;
  --line-strong: #c9d7cd;
  --green: #0d4029;
  --green-dark: #082d1d;
  --green-soft: #eaf5ee;
  --green-tint: #f3faf5;
  --blue: #0f5fb8;
  --blue-soft: #eef5ff;
  --purple: #7652c8;
  --purple-soft: #f5efff;
  --amber: #c3a35b;
  --amber-strong: #b47d00;
  --amber-soft: #fff7e3;
  --red: #b42318;
  --red-soft: #fff0ee;
  --shadow: 0 18px 46px rgba(13, 64, 41, 0.08);
  --shadow-soft: 0 8px 22px rgba(13, 64, 41, 0.06);
  --radius: 8px;
  --sidebar: 232px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

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

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 32px;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(120deg, rgba(195, 163, 91, 0.12), transparent 42%),
    linear-gradient(135deg, var(--green), var(--green-dark));
  background-size: 44px 44px, 44px 44px, auto, auto;
  color: #ffffff;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  align-items: stretch;
  gap: 28px;
  width: min(100%, 1080px);
  min-height: 620px;
  animation: auth-rise 520ms ease both;
}

.auth-splash {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 560px;
  padding: 44px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04)),
    rgba(8, 45, 29, 0.64);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.24);
}

.auth-splash::before {
  content: "";
  position: absolute;
  inset: 18px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

.auth-splash::after {
  content: "";
  position: absolute;
  inset: auto -30% 0 -30%;
  height: 42%;
  pointer-events: none;
  background: linear-gradient(0deg, rgba(195, 163, 91, 0.16), transparent);
}

.splash-logo-card {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: min(100%, 320px);
  min-height: 136px;
  margin-bottom: 30px;
  padding: 18px 26px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.24);
  animation: splash-logo-in 700ms ease 120ms both;
}

.splash-logo-card img {
  display: block;
  width: min(100%, 230px);
  height: auto;
}

.splash-copy {
  position: relative;
  z-index: 1;
  max-width: 590px;
  animation: splash-copy-in 680ms ease 190ms both;
}

.splash-copy h1 {
  margin: 0;
  max-width: 560px;
  color: #ffffff;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

.splash-copy p {
  max-width: 610px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 17px;
  line-height: 1.65;
}

.splash-loader {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 10px minmax(0, 320px);
  align-items: center;
  gap: 12px;
  margin-top: 30px;
  animation: splash-copy-in 680ms ease 260ms both;
}

.portal-loader-track {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.portal-loader-bar {
  position: absolute;
  inset-block: 0;
  left: -42%;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), #8ecf62, #ffffff);
  animation: portal-loader-sweep 1.35s ease-in-out infinite;
}

.portal-loader-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 0 0 rgba(195, 163, 91, 0.42);
  animation: portal-loader-pulse 1.6s ease-in-out infinite;
}

.splash-flow {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  margin-top: 34px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  animation: splash-copy-in 680ms ease 320ms both;
}

.splash-flow i {
  display: block;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.16), rgba(195, 163, 91, 0.7));
}

.splash-status-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 560px;
  margin-top: 18px;
  animation: splash-copy-in 680ms ease 380ms both;
}

.splash-status-grid div {
  min-height: 82px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

.splash-status-grid strong,
.splash-status-grid span {
  display: block;
}

.splash-status-grid strong {
  color: #ffffff;
  font-size: 13px;
}

.splash-status-grid span {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  line-height: 1.35;
}

.auth-card {
  align-self: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  padding: 26px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  animation: auth-card-in 580ms ease 170ms both;
}

.auth-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 16px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px solid #e7eee8;
}

.auth-card h2 {
  margin: 0;
  color: #0c1611;
  font-size: 22px;
  line-height: 1.1;
}

.auth-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.auth-lock {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green);
}

.auth-lock svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.auth-actions,
.email-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.email-form {
  margin-top: 0;
  padding-top: 0;
}

.auth-divider {
  height: 1px;
  margin: 18px 0;
  background: #e3ebe5;
}

.email-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.email-form input {
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  outline: 0;
}

.email-form input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(13, 64, 41, 0.12);
}

.auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.auth-button.primary {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.auth-button.google svg {
  width: 20px;
  height: 20px;
}

.auth-button:hover:not(:disabled),
.auth-button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--green);
  outline: none;
}

.auth-button.primary:hover:not(:disabled),
.auth-button.primary:focus-visible {
  background: var(--green-dark);
}

.auth-button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.auth-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: #8b352d;
  font-weight: 700;
}

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

@keyframes splash-logo-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes splash-copy-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes auth-card-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes portal-loader-sweep {
  0% {
    transform: translateX(0);
  }
  55%,
  100% {
    transform: translateX(338%);
  }
}

@keyframes portal-loader-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(195, 163, 91, 0.42);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 8px transparent;
    transform: scale(0.9);
  }
}

.label {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 18px 12px 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--green);
  color: #ffffff;
}

.brand {
  display: block;
  color: inherit;
  text-decoration: none;
  padding: 0 6px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 94px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.brand-mark img {
  display: block;
  width: min(100%, 190px);
  height: auto;
  object-fit: contain;
}

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

.nav-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  outline: none;
}

.nav-item.is-active {
  background: #ffffff;
  color: var(--green);
  box-shadow: inset 3px 0 0 var(--amber), 0 8px 22px rgba(0, 0, 0, 0.12);
}

.nav-item svg,
.search svg,
.top-icon svg,
.status-chip svg,
.icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.sidebar-note {
  margin-top: auto;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  background: var(--green-dark);
}

.sidebar-note strong,
.sidebar-note span {
  display: block;
}

.sidebar-note strong {
  color: #ffffff;
  font-size: 13px;
}

.sidebar-note span {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.4;
}

.main {
  min-width: 0;
  padding: 0 16px 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(340px, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 78px;
  margin: 0 -16px 20px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  max-width: 620px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
  box-shadow: var(--shadow-soft);
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.status-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 10px;
}

.status-chip,
.top-icon,
.user-badge,
.sign-out {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.status-chip {
  gap: 8px;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-chip.healthy {
  border-color: #cfe7d6;
  background: var(--green-tint);
  color: var(--green);
}

.status-chip.fresh {
  border-color: #cfe0ff;
  background: var(--blue-soft);
  color: var(--blue);
}

.status-chip.review {
  border-color: #ead9a8;
  background: var(--amber-soft);
  color: #8a6100;
}

.top-icon {
  width: 38px;
  color: var(--muted);
  cursor: pointer;
}

.top-icon:hover,
.top-icon:focus-visible,
.sign-out:hover,
.sign-out:focus-visible {
  border-color: var(--green);
  color: var(--green);
  outline: 3px solid rgba(13, 64, 41, 0.12);
}

.user-badge {
  width: 38px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.sign-out {
  min-height: 34px;
  padding: 7px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

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

h2 {
  margin-bottom: 4px;
  font-size: 22px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.2;
}

.view-root {
  display: grid;
  gap: 16px;
  max-width: 1518px;
  margin: 0 auto;
}

.view-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding-top: 2px;
}

.view-header p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.actions,
.segmented,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button,
.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary,
.segmented button.is-active {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.button:hover,
.button:focus-visible,
.segmented button:hover,
.segmented button:focus-visible {
  border-color: var(--green);
  outline: 3px solid rgba(13, 64, 41, 0.14);
}

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

.metric-card,
.panel,
.card,
.gap-card,
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.metric-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 100px;
  padding: 16px 18px;
  box-shadow: 0 10px 26px rgba(13, 64, 41, 0.055);
}

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

.metric-card strong {
  color: var(--green);
  font-size: 31px;
  font-weight: 900;
  line-height: 1;
}

.metric-card span {
  margin-top: 5px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.metric-card small,
.metric-delta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.metric-delta.up {
  color: var(--green);
}

.metric-delta.down {
  color: #9b6900;
}

.metric-delta b {
  font-size: 13px;
  line-height: 1;
}

.metric-icon,
.tool-logo {
  display: grid;
  place-items: center;
  font-weight: 900;
}

.metric-icon {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
}

.metric-card.blue .metric-icon {
  background: var(--blue-soft);
  color: var(--blue);
}

.metric-card.amber .metric-icon {
  background: var(--amber-soft);
  color: #9b6900;
}

.metric-card.amber strong {
  color: #9b6900;
}

.metric-icon svg,
.tool-logo svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.tool-logo svg {
  width: 42px;
  height: 42px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.95fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.workflow-panel-header {
  align-items: center;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 8px;
}

.map-select,
.map-control,
.map-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: #344139;
  box-shadow: 0 4px 12px rgba(13, 64, 41, 0.04);
}

.map-select {
  position: relative;
  min-width: 130px;
  padding: 0 34px 0 12px;
}

.map-select select {
  width: 100%;
  border: 0;
  outline: 0;
  appearance: none;
  background: transparent;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.map-select svg {
  position: absolute;
  right: 10px;
  width: 16px;
  height: 16px;
  fill: currentColor;
  pointer-events: none;
}

.map-control {
  gap: 7px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.map-control svg,
.map-icon-button svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.map-icon-button {
  width: 34px;
  cursor: pointer;
}

.map-control:hover,
.map-control:focus-visible,
.map-icon-button:hover,
.map-icon-button:focus-visible,
.map-select:focus-within {
  border-color: var(--green);
  color: var(--green);
  outline: 3px solid rgba(13, 64, 41, 0.12);
}

.workflow-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(98px, 1fr));
  grid-template-rows: auto 40px;
  gap: 0 24px;
  align-items: start;
  min-height: 188px;
  padding: 14px 8px 0;
}

.map-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 132px;
  padding: 18px 10px 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  text-align: center;
}

.map-node:not(.evidence)::after {
  content: "";
  position: absolute;
  top: 62px;
  right: -24px;
  width: 24px;
  height: 2px;
  background: #82908a;
}

.map-node:not(.evidence)::before {
  content: "";
  position: absolute;
  top: 57px;
  right: -25px;
  z-index: 1;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 7px solid #82908a;
}

.map-node.drive {
  border-color: #b9ddc6;
  background: linear-gradient(180deg, #ffffff, #f6fbf8);
}

.map-node.ai {
  border-color: #82a8f5;
  box-shadow: 0 0 0 1px rgba(31, 102, 209, 0.08);
}

.map-node.clickup {
  border-color: #d9c88b;
  box-shadow: 0 0 0 1px rgba(195, 163, 91, 0.08);
}

.map-node.human {
  border-color: #cfd9d3;
}

.map-node.evidence {
  border-color: #b9d9c5;
}

.map-node strong {
  margin-top: 9px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
}

.map-node em {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.2;
}

.map-node i {
  position: absolute;
  bottom: -10px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--green);
  border-radius: 50%;
  background: #ffffff;
}

.map-node i::after {
  content: "";
  width: 7px;
  height: 4px;
  border-left: 2px solid var(--green);
  border-bottom: 2px solid var(--green);
  transform: rotate(-45deg) translateY(-1px);
}

.map-loop {
  grid-column: 2 / 6;
  grid-row: 2;
  position: relative;
  height: 40px;
}

.map-loop::before {
  content: "";
  position: absolute;
  top: 21px;
  left: 12.5%;
  right: 12.5%;
  border-top: 1px dashed #9ba7a0;
}

.map-loop::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 12.5%;
  height: 20px;
  border-left: 1px dashed #9ba7a0;
}

.map-loop span {
  position: absolute;
  top: -2px;
  left: calc(12.5% - 5px);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 7px solid #9ba7a0;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  width: fit-content;
  max-width: 100%;
  margin-top: 26px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.legend-dot,
.legend-ring {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-dot.source,
.legend-dot.human {
  background: var(--green);
}

.legend-dot.ai {
  background: var(--blue);
}

.legend-dot.system {
  background: var(--purple);
}

.legend-ring {
  border: 1px solid var(--green);
  background: #ffffff;
}

.tool-logo {
  width: 44px;
  height: 44px;
  margin-bottom: 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.map-node.drive .tool-logo,
.map-node.human .tool-logo,
.map-node.evidence .tool-logo {
  color: var(--green);
}

.map-node.clickup .tool-logo {
  color: #8a6100;
}

.explain-card {
  display: grid;
  gap: 14px;
  align-content: start;
}

.explain-output {
  min-height: 184px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff, var(--green-tint));
  color: #263d30;
  font-size: 14px;
  line-height: 1.55;
}

.explain-output strong {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
}

.explain-output p {
  margin-bottom: 0;
}

.explain-output footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.confidence-dot {
  width: 16px;
  height: 16px;
  border: 1px solid var(--green);
  border-radius: 50%;
  background: radial-gradient(circle at center, var(--green) 0 3px, #ffffff 4px);
}

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

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

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
  overflow: hidden;
  padding: 16px;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--green), var(--amber));
}

.card-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.record-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--green);
}

.record-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.card-title h3 {
  margin-bottom: 7px;
}

.card-title .badge-list {
  margin-bottom: 0;
}

.card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.card dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.card-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.card-row dt {
  color: var(--subtle);
}

.card-row dd {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  text-align: right;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 6px;
}

.gap-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 214px;
  padding: 15px;
  border-top: 3px solid var(--green);
}

.gap-card.gap-card--red,
.gap-card:has(.badge.red) {
  border-top-color: var(--red);
}

.gap-card.gap-card--amber,
.gap-card:has(.badge.amber) {
  border-top-color: var(--amber);
}

.gap-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.gap-card-head h3 {
  margin-bottom: 5px;
  font-size: 15px;
}

.gap-card-head span:not(.badge) {
  display: block;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.3;
  text-transform: uppercase;
}

.gap-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.gap-meta {
  display: grid;
  gap: 7px;
  margin: 0;
}

.gap-meta .card-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
}

.gap-meta .card-row dd {
  text-align: left;
}

.workstream-grid,
.packet-grid {
  display: grid;
  gap: 10px;
}

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

.workstream-card,
.packet-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.workstream-card {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.workstream-card strong,
.workstream-card span,
.workstream-card b {
  display: block;
}

.workstream-card strong {
  color: var(--ink);
  font-size: 13px;
}

.workstream-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.workstream-card footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.workstream-card footer span,
.workstream-card footer b {
  margin: 0;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.workstream-card footer b {
  color: var(--amber-strong);
  text-align: right;
}

.packet-grid div {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
}

.packet-grid strong {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.packet-grid span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.badge.blue {
  background: var(--blue-soft);
  color: #3e5877;
}

.badge.amber {
  background: var(--amber-soft);
  color: #81620f;
}

.badge.red {
  background: var(--red-soft);
  color: #8b352d;
}

.data-status-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(240px, 0.7fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(13, 64, 41, 0.08), rgba(195, 163, 91, 0.08)),
    var(--surface);
  box-shadow: var(--shadow);
}

.data-status-copy {
  display: grid;
  gap: 7px;
}

.data-status-copy h3,
.data-status-copy p,
.data-status-meta span,
.data-status-meta strong,
.data-action-message {
  margin: 0;
}

.data-status-copy h3 {
  color: var(--green);
  font-size: 18px;
  line-height: 1.15;
}

.data-status-copy p,
.data-action-message {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.data-status-meta {
  display: grid;
  gap: 8px;
}

.data-status-meta span {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
}

.data-status-meta strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.data-status-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.data-action-message {
  grid-column: 1 / -1;
  padding-top: 2px;
}

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

.integration-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.integration-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.integration-card-head h3,
.integration-card-head span,
.integration-card dl {
  margin: 0;
}

.integration-card-head h3 {
  color: var(--green);
  font-size: 16px;
  line-height: 1.18;
}

.integration-card-head span:not(.badge) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.integration-card dl {
  display: grid;
  gap: 7px;
}

.integration-card .card-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: start;
}

.integration-card .card-row dd {
  text-align: left;
  line-height: 1.35;
}

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

.risk-medium {
  color: var(--amber-strong);
}

.risk-high,
.risk-review {
  color: var(--red);
}

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

.table-wrap {
  min-width: 0;
  overflow: hidden;
}

.table-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.table-title h3 {
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 12px;
  line-height: 1.35;
}

th {
  color: var(--subtle);
  font-weight: 900;
}

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

td strong {
  color: var(--ink);
}

tr:last-child td {
  border-bottom: 0;
}

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

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

.stack-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.stack-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
}

.stack-item strong,
.stack-item span {
  display: block;
}

.stack-item strong {
  font-size: 13px;
}

.stack-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.system-diagram {
  display: grid;
  gap: 10px;
}

.system-lane {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.system-lane strong {
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--green);
  color: #ffffff;
  font-size: 13px;
}

.system-lane span {
  display: block;
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.ai-system-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 18px;
  align-items: stretch;
}

.ai-system-hero h3 {
  max-width: 840px;
  margin-bottom: 10px;
  color: var(--green);
  font-size: 24px;
  line-height: 1.18;
}

.ai-system-hero p:not(.label) {
  max-width: 880px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.ai-boundary-card {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 148px;
  padding: 18px;
  border: 1px solid #eadfbf;
  border-radius: var(--radius);
  background: var(--amber-soft);
}

.ai-boundary-card strong,
.ai-boundary-card span {
  display: block;
}

.ai-boundary-card strong {
  color: #76590f;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.ai-boundary-card span {
  color: #3e3824;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}

.ai-engine-map {
  display: grid;
  grid-template-columns: repeat(6, minmax(126px, 1fr));
  gap: 12px;
}

.patent-chain {
  display: grid;
  grid-template-columns: repeat(6, minmax(132px, 1fr));
  gap: 12px;
}

.engine-node {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 190px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.engine-node:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -13px;
  width: 13px;
  height: 2px;
  background: #82908a;
}

.engine-node:not(:last-child)::before {
  content: "";
  position: absolute;
  top: calc(50% - 5px);
  right: -14px;
  z-index: 1;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 7px solid #82908a;
}

.engine-node.green {
  border-color: #cfe7d6;
  background: linear-gradient(180deg, #ffffff, var(--green-tint));
}

.engine-node.blue {
  border-color: #cfe0ff;
  background: linear-gradient(180deg, #ffffff, var(--blue-soft));
}

.engine-node.amber {
  border-color: #ead9a8;
  background: linear-gradient(180deg, #ffffff, var(--amber-soft));
}

.engine-node strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.engine-node p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.engine-node span {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.35;
}

.boundary-list,
.model-card-grid,
.factor-grid,
.action-gates {
  display: grid;
  gap: 10px;
}

.boundary-list div,
.model-card-grid div,
.factor-grid div,
.action-gates div {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.boundary-list strong,
.model-card-grid strong,
.factor-grid strong,
.action-gates strong {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.boundary-list span,
.model-card-grid span,
.factor-grid span,
.action-gates span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.factor-grid div,
.action-gates div {
  grid-template-columns: 96px minmax(0, 1fr);
}

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

.alert-card {
  display: grid;
  gap: 12px;
  min-height: 242px;
  padding: 14px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--amber);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.alert-card.high {
  border-top-color: #b87a00;
}

.alert-card.critical {
  border-top-color: var(--red);
}

.alert-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.alert-card-head strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.alert-card-head span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #7a5b08;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.alert-card.critical .alert-card-head span {
  background: var(--red-soft);
  color: var(--red);
}

.alert-card dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.alert-card dl div {
  display: grid;
  gap: 3px;
}

.alert-card dt {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.alert-card dd {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.timeline-item time {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 900;
}

.timeline-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

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

  .status-actions {
    justify-content: start;
    overflow-x: auto;
    padding-bottom: 2px;
  }
}

@media (max-width: 1120px) {
  .auth-layout {
    grid-template-columns: 1fr;
    max-width: 680px;
    min-height: 0;
  }

  .auth-splash {
    min-height: 0;
    padding: 32px;
  }

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

@media (max-width: 1260px) {
  .dashboard-grid,
  .architecture-grid,
  .table-grid,
  .data-status-panel {
    grid-template-columns: 1fr;
  }

  .data-status-actions {
    justify-content: flex-start;
  }

  .ai-engine-map,
  .patent-chain {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .alert-matrix,
  .readiness-grid,
  .integration-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .engine-node:nth-child(3)::after,
  .engine-node:nth-child(3)::before {
    display: none;
  }
}

@media (max-width: 1080px) {
  .metrics-grid,
  .record-grid,
  .readiness-grid,
  .integration-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workflow-map {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    gap: 18px;
  }

  .map-node {
    align-items: start;
    min-height: 104px;
    text-align: left;
  }

  .map-node:not(.evidence)::after {
    top: auto;
    right: auto;
    bottom: -15px;
    left: 36px;
    width: 1px;
    height: 15px;
  }

  .map-node:not(.evidence)::before {
    top: auto;
    right: auto;
    bottom: -15px;
    left: 31px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--line-strong);
    border-bottom: 0;
  }

  .map-node i {
    left: 26px;
  }

  .map-loop {
    display: none;
  }

  .ai-system-hero,
  .ai-engine-map,
  .patent-chain,
  .factor-grid,
  .alert-matrix,
  .workstream-grid {
    grid-template-columns: 1fr;
  }

  .engine-node:not(:last-child)::after {
    top: auto;
    right: auto;
    bottom: -13px;
    left: 28px;
    width: 2px;
    height: 13px;
  }

  .engine-node:not(:last-child)::before {
    top: auto;
    right: auto;
    bottom: -14px;
    left: 23px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 7px solid #82908a;
    border-bottom: 0;
  }

  .engine-node:nth-child(3)::after,
  .engine-node:nth-child(3)::before {
    display: block;
  }
}

@media (max-width: 840px) {
  .auth-gate {
    padding: 18px;
  }

  .auth-layout {
    gap: 16px;
  }

  .auth-splash {
    padding: 26px;
  }

  .splash-logo-card {
    min-height: 110px;
    margin-bottom: 22px;
  }

  .splash-copy h1 {
    font-size: 34px;
  }

  .splash-copy p {
    font-size: 15px;
  }

  .splash-status-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

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

  .sidebar-note {
    margin-top: 0;
  }

  .main {
    padding: 0 10px 24px;
  }

  .topbar {
    margin: 0 -10px 16px;
    padding: 12px;
  }

  .search {
    max-width: none;
  }

  .workflow-panel-header,
  .map-toolbar {
    align-items: start;
  }

  .workflow-panel-header {
    display: grid;
  }

  .map-toolbar {
    justify-content: start;
    overflow-x: auto;
    padding-bottom: 2px;
  }
}

@media (max-width: 560px) {
  .auth-gate {
    place-items: start center;
    padding: 12px;
  }

  .auth-card,
  .auth-splash {
    padding: 20px;
  }

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

  .auth-lock {
    display: none;
  }

  .splash-logo-card {
    width: 100%;
    min-height: 92px;
    padding: 14px 18px;
  }

  .splash-flow {
    grid-template-columns: auto 1fr auto 1fr auto;
    gap: 8px;
    margin-top: 22px;
  }

  .splash-flow i {
    width: 100%;
  }

  .splash-status-grid {
    display: none;
  }

  .nav-list,
  .metrics-grid,
  .record-grid,
  .readiness-grid,
  .integration-grid {
    grid-template-columns: 1fr;
  }

  .view-header {
    display: grid;
  }

  .metric-card {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .metric-icon {
    width: 54px;
    height: 54px;
  }

  .system-lane,
  .timeline-item,
  .boundary-list div,
  .model-card-grid div,
  .factor-grid div,
  .action-gates div,
  .packet-grid div {
    grid-template-columns: 1fr;
  }

  .alert-card-head {
    display: grid;
  }

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

  table {
    min-width: 560px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-layout,
  .auth-card,
  .splash-logo-card,
  .splash-copy,
  .splash-loader,
  .splash-flow,
  .splash-status-grid,
  .portal-loader-bar,
  .portal-loader-dot {
    animation: none;
  }

  .portal-loader-bar {
    left: 0;
    width: 100%;
  }
}
