:root {
  --blue: #5b92e5;
  --navy: #12345a;
  --ink: #142436;
  --muted: #607086;
  --soft: #f4f8fd;
  --white: #ffffff;
  --line: #d9e4f2;
  --green: #2d7d59;
  --amber: #a76618;
  --red: #b94444;
  --shadow: 0 18px 50px rgba(18, 52, 90, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--white);
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 22px;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(217, 228, 242, 0.85);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 780;
  color: var(--navy);
  white-space: nowrap;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--white);
  background: radial-gradient(circle at 35% 35%, #8fc2ff, var(--blue) 55%, #2f6fbe);
  font-size: 13px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
}

.topnav a:hover {
  color: var(--navy);
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--navy);
  cursor: pointer;
}

.menu-button {
  display: none;
}

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

.intro {
  margin-top: 18px;
}

.mvp-steps {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.linkage-card {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  background: var(--white);
}

.linkage-card p:not(.eyebrow) {
  margin-top: 8px;
  color: var(--muted);
}

.linkage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.mvp-steps span,
.status-list span {
  display: block;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.workspace {
  min-height: calc(100vh - 63px);
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 20px;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 253, 0.92)),
    linear-gradient(rgba(91, 146, 229, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 146, 229, 0.12) 1px, transparent 1px);
  background-size: auto, 36px 36px, 36px 36px;
}

.panel,
.metric,
.stage,
.contact-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 12px 34px rgba(18, 52, 90, 0.08);
}

.panel {
  padding: 24px;
}

.panel-head,
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #2f6f8f;
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--navy);
  line-height: 1.12;
}

h1 {
  font-size: clamp(34px, 5vw, 54px);
}

h2 {
  font-size: clamp(28px, 4vw, 42px);
}

h3 {
  font-size: 21px;
}

h4 {
  font-size: 16px;
}

p {
  margin: 0;
}

.status,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e8f2ff;
  color: var(--navy);
  font-size: 12px;
  font-weight: 760;
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

label {
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 6px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--white);
}

textarea {
  min-height: 118px;
  resize: vertical;
}

.hidden {
  display: none !important;
}

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

.metric {
  min-height: 220px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.summary-grid .metric:last-child:nth-child(odd) {
  grid-column: span 2;
  min-height: 150px;
}

.metric span,
.metric small {
  color: var(--muted);
}

.metric strong {
  color: var(--navy);
  font-size: clamp(42px, 7vw, 70px);
  line-height: 1;
}

.section {
  padding: 78px 24px;
}

.section > * {
  width: min(100%, 1240px);
  margin-left: auto;
  margin-right: auto;
}

.section.soft {
  background: var(--soft);
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 11px 18px;
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  background: var(--navy);
  color: var(--white);
  font-weight: 720;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.button.secondary {
  color: var(--navy);
  background: var(--white);
  border-color: var(--line);
}

.capability-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.template-grid,
.dataset-grid,
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 28px;
}

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

.data-status {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 18px;
  align-items: center;
  margin-top: 24px;
}

.data-status h3 + p {
  margin-top: 8px;
}

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

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  padding: 24px;
  box-shadow: 0 12px 34px rgba(18, 52, 90, 0.08);
}

.card p {
  margin-top: 12px;
  color: var(--muted);
}

.access-strip {
  display: grid;
  grid-template-columns: 1fr auto 320px;
  gap: 18px;
  align-items: center;
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.access-strip p:not(.eyebrow) {
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}

.segmented button {
  min-height: 40px;
  padding: 10px 12px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  color: var(--white);
  background: var(--navy);
}

.login-box {
  display: grid;
  gap: 10px;
}

.method-note {
  margin-top: 18px;
}

.method-note p {
  margin-top: 10px;
  color: var(--muted);
}

.capability-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  padding: 22px;
}

.capability-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.capability-card p {
  margin-top: 10px;
  color: var(--muted);
}

.slider-row {
  display: grid;
  grid-template-columns: 1fr 54px;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--blue);
}

.portfolio-shell {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 20px;
  margin-top: 28px;
}

.xai-shell {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  margin-top: 28px;
}

.xai-main {
  min-height: 420px;
}

.xai-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.xai-narrative {
  margin-top: 18px;
  color: var(--muted);
  font-size: 17px;
}

.xai-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.xai-grid p {
  margin-top: 8px;
}

.household-select {
  display: block;
  margin-top: 18px;
}

.lime-bars {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.lime-label {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.lime-label strong {
  color: var(--navy);
}

.lime-track {
  height: 12px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.lime-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #2d7d59);
}

.xai-note {
  width: min(100%, 1240px);
  margin: 20px auto 0;
  padding: 16px 18px;
  border-left: 4px solid var(--blue);
  background: var(--soft);
  color: var(--muted);
}

.warning-text {
  margin-top: 8px;
  color: var(--amber);
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--navy);
  font-weight: 760;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.dataset-table {
  width: min(100%, 1240px);
  margin: 22px auto 0;
}

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

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: var(--navy);
  background: var(--soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td input,
td select {
  min-width: 116px;
  margin: 0;
}

td input:disabled,
td select:disabled,
.restricted-control input:disabled {
  color: var(--muted);
  background: #f7f9fc;
  cursor: not-allowed;
}

.priority {
  font-weight: 800;
}

.priority.high {
  color: var(--green);
}

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

.priority.low {
  color: var(--red);
}

.recommendation {
  position: sticky;
  top: 88px;
}

.recommendation p {
  margin-top: 12px;
  color: var(--muted);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 22px 0;
}

.bars {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

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

.mini-stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.mini-stat strong {
  display: block;
  color: var(--navy);
  font-size: 24px;
}

.mini-stat span,
.mini-stat small {
  display: block;
  color: var(--muted);
}

.repository-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.repository-list span {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--muted);
}

body[data-mode="public"] .restricted {
  opacity: 0.72;
}

body[data-mode="public"] .restricted::after {
  content: "Login required for household-level management.";
  display: block;
  margin-top: 14px;
  color: var(--amber);
  font-weight: 760;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.stage {
  min-height: 310px;
  padding: 22px;
}

.stage span {
  color: var(--blue);
  font-weight: 820;
}

.stage-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.stage-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--muted);
  font-size: 14px;
}

.contact-band {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 28px;
  align-items: start;
  background: linear-gradient(180deg, #ffffff, #eef6ff);
}

.contact-band > div {
  margin: 0;
}

.contact-band p:not(.eyebrow) {
  max-width: 680px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 18px;
}

.contact-form {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 24px;
}

.form-note {
  min-height: 22px;
  color: var(--green);
  font-size: 14px;
}

.chat-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
}

.chat-toggle {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  box-shadow: var(--shadow);
  font-weight: 800;
  cursor: pointer;
}

.chat-panel {
  position: absolute;
  right: 0;
  bottom: 68px;
  width: min(320px, calc(100vw - 44px));
  display: none;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.chat-panel.open {
  display: block;
}

.chat-panel p {
  margin-top: 8px;
  color: var(--muted);
}

@media (max-width: 1050px) {
  .workspace,
  .portfolio-shell,
  .xai-shell,
  .contact-band,
  .data-status,
  .access-strip {
    grid-template-columns: 1fr;
  }

  .recommendation {
    position: static;
  }
}

@media (max-width: 780px) {
  .topnav {
    position: absolute;
    top: 66px;
    left: 16px;
    right: 16px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow);
  }

  .topnav.open {
    display: flex;
  }

  .menu-button {
    display: block;
  }

  .workspace,
  .section {
    padding: 18px;
  }

  .summary-grid,
  .capability-list,
  .pipeline-grid,
  .template-grid,
  .dataset-grid,
  .report-grid,
  .xai-grid,
  .mini-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid .metric:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .segmented {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .segmented button {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .segmented button:last-child {
    border-bottom: 0;
  }

  .metric {
    min-height: 170px;
  }
}
