:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --ink: #142119;
  --muted: #5c6961;
  --canvas: #f4f5ef;
  --surface: #ffffff;
  --surface-soft: #edf0e9;
  --line: #d8ded5;
  --line-strong: #b7c2b9;
  --green: #0c6f4f;
  --green-dark: #07573d;
  --green-soft: #dff3e9;
  --lime: #cae47e;
  --amber: #96630b;
  --amber-soft: #fff2d4;
  --red: #a52c2c;
  --red-soft: #ffebea;
  --blue: #315a8c;
  --shadow-sm: 0 1px 2px rgb(20 33 25 / 7%);
  --shadow-lg: 0 22px 60px rgb(20 33 25 / 12%);
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgb(216 222 213 / 80%);
  background: rgb(244 245 239 / 88%);
  backdrop-filter: blur(18px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 40px, 1240px);
  min-height: 74px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark,
.login-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--lime);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 0.94rem;
  line-height: 1.2;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
}

.header-link,
.report-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green-dark);
  font-weight: 750;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.header-link {
  font-size: 0.87rem;
}

main {
  width: min(100% - 40px, 1240px);
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  gap: clamp(32px, 6vw, 84px);
  align-items: center;
  padding: clamp(64px, 9vw, 112px) 0 54px;
}

.eyebrow,
.section-step,
.role-label {
  margin: 0;
  color: var(--green);
  font-size: 0.73rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 800px;
  margin: 13px 0 20px;
  font-size: clamp(2.65rem, 5.7vw, 5.25rem);
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.hero-summary {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.18rem);
  line-height: 1.7;
}

.assurance-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 28px;
}

.assurance-list span {
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgb(255 255 255 / 55%);
  color: #39463e;
  font-size: 0.78rem;
  font-weight: 700;
}

.workflow-card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.workflow-list {
  display: grid;
  gap: 18px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.workflow-list li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 13px;
  align-items: start;
}

.workflow-list li > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 850;
}

.workflow-list strong,
.workflow-list small {
  display: block;
}

.workflow-list strong {
  margin-top: 2px;
  font-size: 0.92rem;
}

.workflow-list small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.builder-section {
  margin: 28px 0;
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 30px;
}

.section-heading h2,
.principles h2 {
  margin: 6px 0 5px;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.section-heading p:not(.section-step) {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

.section-heading .privacy-note {
  max-width: 820px;
  margin-top: 10px;
  padding: 9px 11px;
  border-left: 3px solid var(--green);
  background: var(--green-soft);
  color: #29483a;
  font-size: 0.76rem;
}

.compact-heading {
  align-items: center;
}

.upload-count {
  flex: none;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

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

.upload-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 390px;
  flex-direction: column;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fbfcf9;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.upload-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 12px 28px rgb(20 33 25 / 8%);
  transform: translateY(-2px);
}

.upload-card.is-ready {
  border-color: #67a98d;
  background: #f8fdf9;
}

.upload-card.is-reading {
  border-color: #8fa5ba;
  background: #f8fbff;
}

.upload-card.has-error,
.upload-card.is-error {
  border-color: #d98c87;
  background: #fffafa;
}

.card-heading {
  display: flex;
  gap: 15px;
  align-items: center;
}

.slot-number {
  display: grid;
  flex: none;
  place-items: center;
  width: 45px;
  height: 45px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 850;
}

.upload-card h3 {
  margin: 3px 0 0;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.role-label {
  font-size: 0.65rem;
}

.card-purpose {
  min-height: 48px;
  margin: 20px 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.report-link {
  align-self: flex-start;
  font-size: 0.78rem;
}

.report-path {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.file-picker {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 13px;
  min-height: 112px;
  margin-top: 20px;
  padding: 20px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 150ms ease,
    background 150ms ease;
}

.file-picker:hover,
.file-picker:focus-within {
  border-color: var(--green);
  background: var(--green-soft);
}

.file-picker-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
}

.file-picker strong,
.file-picker small {
  display: block;
}

.file-picker strong {
  font-size: 0.86rem;
}

.file-picker small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.report-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.report-file-input:focus-visible + .file-status {
  outline: 3px solid rgb(12 111 79 / 22%);
  outline-offset: 3px;
}

.file-status {
  margin: 13px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.is-ready .file-status {
  color: var(--green-dark);
}

.build-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-top: 22px;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: #fff;
}

.build-bar strong {
  font-size: 0.9rem;
}

.build-bar p {
  margin: 3px 0 0;
  color: #bdc8c0;
  font-size: 0.76rem;
}

.build-actions,
.preview-actions {
  display: flex;
  flex: none;
  gap: 10px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

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

.button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgb(49 90 140 / 32%);
  outline-offset: 3px;
}

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

.button-primary:hover:not(:disabled) {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.build-bar .button-secondary {
  border-color: #57645b;
  background: transparent;
  color: #fff;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.button-full {
  width: 100%;
}

.validation-summary:empty,
.review-grid:empty,
.employee-review:empty,
.dashboard-output:empty {
  display: none;
}

.validation-summary {
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.validation-summary.is-valid {
  border-color: #80b69d;
  background: var(--green-soft);
  color: var(--green-dark);
}

.validation-summary.has-warnings {
  border-color: #e4bd68;
  background: var(--amber-soft);
  color: #76500d;
}

.validation-summary.has-errors {
  border-color: #db9792;
  background: var(--red-soft);
  color: #812020;
}

.validation-heading {
  margin: 0;
  font-size: 0.95rem;
}

.validation-list {
  display: grid;
  gap: 5px;
  margin: 10px 0 0;
  padding-left: 20px;
  font-size: 0.8rem;
}

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

.review-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fbfcf9;
}

.review-card.is-valid {
  border-left-color: var(--green);
}

.review-card.has-warning {
  border-left-color: #d59a2e;
}

.review-card.has-error {
  border-left-color: var(--red);
}

.review-card-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.review-card-heading h3 {
  margin: 3px 0 0;
  font-size: 1rem;
}

.review-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.review-detail-list {
  display: grid;
  grid-template-columns: minmax(100px, 0.65fr) minmax(0, 1.35fr);
  gap: 8px 14px;
  margin: 16px 0 0;
  font-size: 0.76rem;
}

.review-detail-list dt {
  color: var(--muted);
}

.review-detail-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.review-value {
  font-weight: 750;
}

.employee-review {
  margin-top: 18px;
  overflow-x: auto;
}

.employee-review-table {
  width: 100%;
  min-width: 660px;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.employee-review-table th,
.employee-review-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.employee-review-table th {
  background: var(--surface-soft);
  color: #344139;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.match-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
}

.match-status.is-match {
  background: var(--green-soft);
  color: var(--green-dark);
}

.match-status.is-missing,
.match-status.is-ambiguous {
  background: var(--red-soft);
  color: #812020;
}

.match-status.is-ignored {
  background: #e8eaec;
  color: #596169;
}

.preview-heading {
  align-items: end;
}

.dashboard-frame {
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #d7d7d4;
}

.dashboard-output {
  min-width: 980px;
  min-height: 420px;
  background: #fff;
}

.mpi-dashboard {
  width: 100%;
  min-height: 620px;
  padding: 12px;
  background: #fff;
}

.mpi-table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
  line-height: 1.05;
}

.mpi-table th,
.mpi-table td {
  padding: 4px 3px;
  border: 1.2px solid #1f2522;
  text-align: center;
  vertical-align: middle;
}

.mpi-table th:first-child,
.mpi-table td:first-child {
  width: 18%;
}

.mpi-table .title-cell {
  padding: 7px 6px;
  background: #1d2921;
  color: #fff;
  font-size: 1.45em;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-align: center;
}

.mpi-table .column-head th {
  background: #e9eee8;
  font-size: 0.9em;
  font-weight: 800;
}

.mpi-table .column-head th:first-child,
.mpi-table .name-cell {
  text-align: left;
}

.mpi-table .target-row th,
.mpi-table .target-row td {
  background: #f3f1ef;
  font-weight: 800;
  text-align: center;
}

.mpi-table .section-row th {
  padding-block: 4px;
  background: #344239;
  color: #fff;
  font-size: 0.86em;
  letter-spacing: 0.08em;
  text-align: center;
}

.mpi-table .role-average-row th,
.mpi-table .role-average-row td {
  background: #dde6df;
  font-weight: 800;
}

.mpi-table .data-row:nth-of-type(even) th:not(.ok, .warn, .bad),
.mpi-table .data-row:nth-of-type(even) td:not(.ok, .warn, .bad) {
  background: #fbfbfa;
}

.mpi-table .ok {
  background: #dcead4;
}

.mpi-table .warn {
  background: #f3edb6;
}

.mpi-table .bad {
  background: #e7c1bb;
}

.mpi-table .neutral {
  background: #f3f1ef;
}

.calc-flag {
  margin-left: 3px;
  color: #c00000;
  font-size: 1.2em;
  font-weight: 900;
}

.average-total {
  display: block;
  margin-top: 2px;
  font-size: 0.78em;
  font-weight: 400;
  line-height: 1;
}

.principles {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  gap: clamp(28px, 6vw, 70px);
  align-items: start;
  padding: clamp(54px, 8vw, 92px) 0;
}

.principles h2 {
  margin-top: 9px;
}

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

.principle-grid article {
  min-height: 160px;
  padding: 20px;
  border-top: 2px solid var(--green);
  background: rgb(255 255 255 / 58%);
}

.principle-grid strong {
  font-size: 0.86rem;
}

.principle-grid p {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.65;
}

.site-footer {
  padding: 22px 20px 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgb(202 228 126 / 35%), transparent 32%),
    radial-gradient(circle at 85% 80%, rgb(12 111 79 / 13%), transparent 34%),
    var(--canvas);
}

.login-shell {
  width: min(100%, 430px);
  padding: clamp(28px, 6vw, 44px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.login-mark {
  margin-bottom: 26px;
}

.login-shell h1 {
  margin: 7px 0 8px;
  font-size: clamp(2rem, 8vw, 2.7rem);
  letter-spacing: -0.045em;
  line-height: 1;
}

.login-copy {
  margin: 0 0 24px;
  color: var(--muted);
}

.login-form label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.8rem;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.login-form .button {
  margin-top: 14px;
}

.alert {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 750;
}

.alert-error {
  border-color: #d98c87;
  background: var(--red-soft);
  color: #812020;
}

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

  .workflow-card {
    max-width: 650px;
  }

  .principles {
    grid-template-columns: 1fr;
  }

  .principle-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  main,
  .site-header-inner {
    width: min(100% - 24px, 1240px);
  }

  .site-header-inner {
    min-height: 66px;
  }

  .brand small {
    display: none;
  }

  .header-link {
    font-size: 0.74rem;
  }

  .hero {
    padding-top: 52px;
  }

  .upload-grid,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .upload-card {
    min-height: 370px;
  }

  .section-heading,
  .build-bar,
  .preview-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .build-actions,
  .preview-actions {
    width: 100%;
  }

  .build-actions .button,
  .preview-actions .button {
    flex: 1;
  }

  .principle-grid {
    grid-template-columns: 1fr;
  }

  .principle-grid article {
    min-height: 0;
  }
}

@media (max-width: 460px) {
  .header-link {
    max-width: 112px;
    text-align: right;
  }

  .builder-section {
    padding: 18px;
    border-radius: 20px;
  }

  .build-actions,
  .preview-actions {
    flex-direction: column-reverse;
  }

  .file-picker {
    padding-inline: 14px;
  }
}

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

@media print {
  @page {
    size: landscape;
    margin: 0.15in;
  }

  body {
    background: #fff;
  }

  body > *:not(main),
  main > *:not(.preview-section),
  .preview-section > *:not(.dashboard-frame) {
    display: none !important;
  }

  main,
  .preview-section,
  .dashboard-frame,
  .dashboard-output {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .mpi-dashboard {
    width: 100% !important;
    height: 7.9in !important;
    min-height: 7.9in !important;
    padding: 0 !important;
    break-inside: avoid;
  }

  .mpi-table {
    width: 100% !important;
    height: 100% !important;
    table-layout: fixed !important;
    font-size: 7.5pt !important;
    break-inside: avoid;
  }

  .mpi-table tr,
  .mpi-table th,
  .mpi-table td {
    break-inside: avoid;
  }

  .mpi-table th,
  .mpi-table td {
    padding: 1px 2px;
  }
}
