:root {
  --ink: #16202a;
  --muted: #617080;
  --line: #d7e0e8;
  --panel: #ffffff;
  --bg: #eef2f5;
  --blue: #1f5d8c;
  --blue-2: #dcecf7;
  --green: #22735f;
  --green-2: #ddf1eb;
  --amber: #a55d10;
  --amber-2: #f8e8d7;
  --ptc: #6e4fa3;
  --ptc-2: #ece5f7;
  --red: #8a2d2a;
  --red-2: #f3dedb;
  --shadow: 0 8px 24px rgba(33, 47, 62, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
  background:
    linear-gradient(180deg, rgba(31, 93, 140, 0.1), transparent 260px),
    var(--bg);
}

html {
  scroll-padding-top: 84px;
}

body.login-active {
  min-height: 100vh;
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.app-shell.is-hidden,
.login-screen.is-hidden {
  display: none;
}

.login-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 480px);
  gap: 32px;
  align-items: center;
  padding: 48px;
  overflow: hidden;
  background: linear-gradient(135deg, #0b5f5b 0%, #267f78 42%, #aebbc2 74%, #eef2f5 100%);
  isolation: isolate;
}

.login-screen::before {
  content: "";
  position: absolute;
  left: -160px;
  top: -180px;
  width: 680px;
  height: 680px;
  border-radius: 50%;
  z-index: 0;
  background:
    radial-gradient(
      circle,
      rgba(255, 255, 255, 0) 0 74px,
      rgba(255, 255, 255, 0.26) 75px 77px,
      rgba(255, 255, 255, 0) 78px 158px,
      rgba(255, 255, 255, 0.2) 159px 161px,
      rgba(255, 255, 255, 0) 162px 248px,
      rgba(255, 255, 255, 0.16) 249px 251px,
      rgba(255, 255, 255, 0) 252px 340px
    );
  opacity: 0.9;
  pointer-events: none;
}

.login-screen::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -150px;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  z-index: 0;
  background:
    radial-gradient(
      circle,
      rgba(10, 57, 66, 0) 0 68px,
      rgba(10, 57, 66, 0.2) 69px 71px,
      rgba(10, 57, 66, 0) 72px 146px,
      rgba(10, 57, 66, 0.16) 147px 149px,
      rgba(10, 57, 66, 0) 150px 228px,
      rgba(10, 57, 66, 0.12) 229px 231px,
      rgba(10, 57, 66, 0) 232px 310px
    );
  opacity: 0.76;
  pointer-events: none;
}

.login-screen > * {
  position: relative;
  z-index: 1;
}

.login-visual {
  min-height: 620px;
  display: grid;
  align-content: space-between;
  padding: 42px;
  color: #fff;
  background: rgba(4, 61, 60, 0.64);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(10, 38, 45, 0.22);
  backdrop-filter: blur(10px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.login-visual .eyebrow,
.login-visual p {
  color: rgba(255, 255, 255, 0.74);
}

.login-visual h1 {
  color: #fff;
  font-size: 34px;
}

.brand-copy {
  min-width: 0;
}

.login-hero-copy {
  max-width: 720px;
}

.login-hero-copy h2 {
  max-width: 720px;
  color: #fff;
  font-size: 46px;
  line-height: 1.04;
}

.login-hero-copy p {
  max-width: 560px;
  margin: 18px 0 0;
  font-size: 17px;
  line-height: 1.55;
}

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

.login-metrics article {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}

.login-metrics span,
.home-grid span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.login-metrics span {
  color: rgba(255, 255, 255, 0.7);
}

.login-metrics strong {
  color: #fff;
}

.login-card {
  display: grid;
  gap: 18px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(199, 214, 226, 0.9);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(26, 47, 67, 0.2);
  backdrop-filter: blur(12px);
}

.login-card h2 {
  font-size: 24px;
}

.login-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.login-error {
  margin: -4px 0 0;
  padding: 10px 12px;
  border: 1px solid #e5bfba;
  border-radius: 8px;
  background: #fbebea;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.login-error.is-hidden {
  display: none;
}

.brand-logo {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  color: #fff;
  background: #1f5d8c;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(31, 93, 140, 0.22);
}

.brand-logo.large {
  width: 56px;
  height: 56px;
  flex-basis: 56px;
  background: rgba(255, 255, 255, 0.14);
}

.brand-logo svg {
  width: 30px;
  height: 30px;
}

.brand-logo.large svg {
  width: 38px;
  height: 38px;
}

.brand-logo-image {
  display: block;
  object-fit: contain;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.brand-mark {
  display: block;
  object-fit: contain;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.login-brand-mark {
  width: 92px;
  height: 92px;
  border-radius: 18px;
}

.login-logo-image {
  width: min(360px, 100%);
  height: auto;
  border-radius: 14px;
}

.form-logo-image {
  width: min(230px, 100%);
  height: auto;
  border-radius: 8px;
}

.header-brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

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

.primary-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--green);
  border-radius: 7px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.primary-button:hover {
  background: #1b604f;
}

.primary-button.compact {
  min-height: 34px;
  padding: 0 14px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: rgba(238, 242, 245, 0.94);
  border-bottom: 1px solid rgba(215, 224, 232, 0.86);
  backdrop-filter: blur(10px);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.1;
}

h2 {
  font-size: 15px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--blue);
  box-shadow: var(--shadow);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.icon-button,
.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-decoration: none;
}

.icon-button {
  width: 34px;
}

.download-link {
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.header-button {
  border: 1px solid var(--line);
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  grid-template-areas:
    "inputs dashboard"
    "inputs workspace";
  align-items: start;
  gap: 18px;
  max-width: 1580px;
  margin: 0 auto;
  padding: 16px 18px 28px;
}

.inputs-panel,
.dashboard-panel,
.workspace-panel,
.chart-panel,
.kpi,
.assumption-grid > section,
.masters-grid > section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow:
    0 12px 28px rgba(21, 40, 56, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.58),
    0 0 18px rgba(90, 133, 168, 0.08);
}

.inputs-panel {
  grid-area: inputs;
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 84px);
  min-height: calc(100vh - 84px);
  overflow: auto;
  padding: 12px;
}

.dashboard-panel {
  grid-area: dashboard;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  scroll-margin-top: 84px;
}

.workspace-panel {
  grid-area: workspace;
  min-width: 0;
  overflow: hidden;
  scroll-margin-top: 84px;
}

.panel-title,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.component-toolbar {
  min-height: 40px;
}

.title-action {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.title-action div {
  min-width: 0;
}

.title-action span {
  display: block;
  margin-top: 2px;
}

.collapse-button,
.secondary-button,
.info-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.info-button {
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  color: var(--blue);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  font-size: 13px;
}

.info-button span {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.collapse-button {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  color: var(--blue);
  font-size: 20px;
  line-height: 1;
}

.secondary-button {
  min-height: 32px;
  padding: 0 12px;
  color: var(--blue);
  font-size: 12px;
}

.collapse-button:hover,
.secondary-button:hover,
.info-button:hover {
  border-color: var(--blue);
  background: var(--blue-2);
}

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

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.collapsible-body.is-collapsed {
  display: none;
}

.panel-title span,
.section-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.input-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-content: start;
  flex: 1;
}

.input-grid > .field:first-child,
.input-grid > .field:nth-child(8),
.input-grid > .field:nth-child(9),
.input-grid > .toggle-row,
.input-grid > .input-impact-card {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 5px;
}

.field span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 93, 140, 0.14);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
}

.input-impact-card {
  margin-top: 6px;
  padding: 12px;
  border: 1px solid #c9d9e7;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(236, 245, 252, 0.96), rgba(228, 240, 249, 0.9));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.46),
    0 0 14px rgba(79, 132, 182, 0.08);
}

.input-impact-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 12px;
}

.input-impact-card ul {
  margin: 0;
  padding-left: 16px;
  color: #526273;
  font-size: 11px;
  line-height: 1.45;
}

.input-impact-card li + li {
  margin-top: 6px;
}

.switch {
  position: relative;
  width: 50px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #c9d3dc;
  border-radius: 999px;
  transition: 0.18s ease;
}

.slider::before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.18s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .slider {
  background: var(--green);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    "total total fixed fixed"
    "a b c d"
    "e f g h";
  gap: 14px;
  align-items: stretch;
  grid-auto-rows: minmax(108px, auto);
}

.kpi {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 108px;
  min-width: 0;
  padding: 16px 18px;
  background: #fdfefe;
}

.kpi-top {
  min-height: 116px;
}

.kpi-total { grid-area: total; }
.kpi-fixed { grid-area: fixed; }
.kpi-a { grid-area: a; }
.kpi-b { grid-area: b; }
.kpi-c { grid-area: c; }
.kpi-d { grid-area: d; }
.kpi-e { grid-area: e; }
.kpi-f { grid-area: f; }
.kpi-g { grid-area: g; }
.kpi-h { grid-area: h; }

.kpi-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 10px;
}

.kpi-title span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 0;
}

.kpi-code {
  display: inline-flex;
  min-width: 28px;
  height: 22px;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 999px;
  background: #edf3f8;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.kpi strong {
  display: block;
  margin-top: auto;
  font-size: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-logic {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.kpi.grand {
  background: #dff4eb;
  border-color: #b4d9cd;
  box-shadow:
    0 14px 32px rgba(34, 115, 95, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.56),
    0 0 20px rgba(34, 115, 95, 0.14);
}

.kpi.grand strong {
  font-size: 28px;
  color: var(--green);
}

.kpi.grand .kpi-code {
  background: rgba(34, 115, 95, 0.12);
  color: var(--green);
}

.kpi.grand-alt {
  background: #e8f1ff;
  border-color: #cdddee;
  box-shadow:
    0 14px 32px rgba(31, 93, 140, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.56),
    0 0 18px rgba(31, 93, 140, 0.12);
}

.kpi.grand-alt strong {
  font-size: 28px;
  color: var(--blue);
}

.kpi.grand-alt .kpi-code {
  background: rgba(31, 93, 140, 0.12);
}

.kpi.ptc-kpi {
  background: #eee6fb;
  border-color: #d6c9ed;
  box-shadow:
    0 14px 32px rgba(110, 79, 163, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.52),
    0 0 18px rgba(110, 79, 163, 0.12);
}

.kpi.ptc-kpi strong {
  color: var(--ptc);
}

.kpi.ptc-kpi .kpi-code {
  background: rgba(110, 79, 163, 0.12);
  color: var(--ptc);
}

.kpi.data-kpi {
  background: #dff2f7;
  border-color: #c3dfe7;
  box-shadow:
    0 14px 32px rgba(18, 96, 116, 0.11),
    inset 0 0 0 1px rgba(255, 255, 255, 0.52),
    0 0 18px rgba(18, 96, 116, 0.11);
}

.kpi.kpi-a {
  background: #edf7f3;
  border-color: #c8dfd4;
}

.kpi.kpi-b {
  background: #f9efe1;
  border-color: #ecd3b3;
}

.kpi.kpi-d {
  background: #eaf3fb;
  border-color: #c8daed;
}

.kpi.kpi-e {
  background: #edf1fb;
  border-color: #d1d9ef;
}

.kpi.kpi-g {
  background: #e7f5ef;
  border-color: #c6dfd4;
}

.kpi.kpi-h {
  background: #fbf1e6;
  border-color: #eed6b8;
}

.kpi.data-kpi strong {
  color: #126074;
}

.kpi.data-kpi .kpi-code {
  background: rgba(18, 96, 116, 0.12);
  color: #126074;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 18px;
}

.chart-panel {
  min-height: 172px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 253, 0.96));
  box-shadow:
    0 14px 30px rgba(16, 37, 52, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.72),
    0 0 16px rgba(98, 137, 171, 0.08);
}

.bars,
.component-bars {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(140px, 190px) 1fr 112px;
  align-items: center;
  gap: 10px;
}

.bar-label,
.bar-value {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  min-width: 0;
}

.bar-value {
  color: var(--ink);
  text-align: right;
}

.bar-track {
  height: 14px;
  background: #e6edf3;
  border-radius: 999px;
  overflow: hidden;
  box-shadow:
    inset 0 1px 2px rgba(18, 41, 58, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.bar-row {
  --bar-color: #2a6796;
}

.bars .bar-row:nth-child(4n + 2),
.component-bars .bar-row:nth-child(4n + 2) {
  --bar-color: #1f7a74;
}

.bars .bar-row:nth-child(4n + 3),
.component-bars .bar-row:nth-child(4n + 3) {
  --bar-color: #7a5bb2;
}

.bars .bar-row:nth-child(4n + 4),
.component-bars .bar-row:nth-child(4n + 4) {
  --bar-color: #b16b1f;
}

.bar-fill {
  height: 100%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 70%),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.2) 0 8px,
      rgba(255, 255, 255, 0.05) 8px 16px
    ),
    var(--bar-color);
  border-radius: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 12px color-mix(in srgb, var(--bar-color) 28%, transparent);
}

.split-chart {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  gap: 20px;
}

.split-panel {
  display: grid;
  grid-template-columns: minmax(340px, 0.78fr) minmax(360px, 1.22fr);
  grid-template-areas:
    "head head"
    "chart breakdown";
  gap: 18px;
  align-items: start;
}

.split-panel .section-head {
  grid-area: head;
  margin-bottom: 0;
}

.split-panel .split-chart {
  grid-area: chart;
}

.split-panel .split-breakdown {
  grid-area: breakdown;
}

.donut {
  width: 228px;
  height: 228px;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0deg, var(--blue) 0deg);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 52px;
  border-radius: 50%;
  background: var(--panel);
  z-index: 0;
}

.donut span,
.donut strong {
  position: relative;
  z-index: 1;
  display: block;
}

.donut span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.donut strong {
  max-width: 124px;
  margin-top: 6px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.1;
  white-space: nowrap;
}

.legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

.legend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.legend-row strong {
  color: #526273;
}

.legend-row i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
}

.split-breakdown {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.split-breakdown-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.split-breakdown-card.internal {
  border-color: #c6dfd4;
  box-shadow: inset 0 0 0 1px rgba(35, 116, 96, 0.05);
}

.split-breakdown-card.external {
  border-color: #eed6b8;
  box-shadow: inset 0 0 0 1px rgba(165, 93, 16, 0.05);
}

.split-breakdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.split-breakdown-head strong {
  font-size: 12px;
  color: var(--ink);
}

.split-breakdown-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.split-breakdown-rows {
  display: grid;
  gap: 6px;
}

.split-breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.split-breakdown-row span {
  color: var(--muted);
  font-weight: 700;
}

.split-breakdown-row b {
  color: var(--ink);
  font-size: 12px;
}

.split-breakdown-note {
  margin: 10px 0 0;
  color: #617080;
  font-size: 11px;
  line-height: 1.4;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.bucket-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.bucket-filter {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid #ccd9e4;
  border-radius: 999px;
  background: #fff;
  color: #536273;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.bucket-filter b {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #edf3f8;
  color: var(--blue);
  font-size: 11px;
}

.bucket-filter.active {
  border-color: var(--blue);
  background: #e7f0f8;
  color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 93, 140, 0.08);
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
  border-bottom: 3px solid transparent;
}

.tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.tab-panel {
  display: none;
  padding: 20px;
}

.tab-panel.active {
  display: grid;
  gap: 18px;
  align-content: start;
}

#tab-home.tab-panel.active {
  display: block;
}

#tab-home {
  position: relative;
  min-height: 410px;
  overflow: hidden;
  background:
    linear-gradient(118deg, rgba(6, 54, 67, 0.92) 0%, rgba(14, 111, 107, 0.94) 34%, rgba(58, 142, 149, 0.88) 62%, rgba(182, 199, 208, 0.82) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0));
  isolation: isolate;
}

#tab-home::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 34%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size:
    100% 100%,
    54px 54px,
    54px 54px;
  opacity: 0.28;
  pointer-events: none;
}

#tab-home::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 14% 22%, rgba(255, 255, 255, 0) 0 76px, rgba(255, 255, 255, 0.22) 77px 79px, rgba(255, 255, 255, 0) 80px 170px, rgba(255, 255, 255, 0.16) 171px 173px, rgba(255, 255, 255, 0) 174px 268px, rgba(255, 255, 255, 0.1) 269px 271px, rgba(255, 255, 255, 0) 272px 100%),
    radial-gradient(circle at 76% 82%, rgba(8, 53, 62, 0) 0 74px, rgba(8, 53, 62, 0.22) 75px 77px, rgba(8, 53, 62, 0) 78px 162px, rgba(8, 53, 62, 0.18) 163px 165px, rgba(8, 53, 62, 0) 166px 252px, rgba(8, 53, 62, 0.12) 253px 255px, rgba(8, 53, 62, 0) 256px 100%),
    linear-gradient(135deg, rgba(7, 37, 46, 0.36) 0%, rgba(7, 37, 46, 0) 46%);
  opacity: 0.84;
  pointer-events: none;
}

#tab-home > * {
  position: relative;
  z-index: 1;
}

.home-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 30px 26px 22px;
  color: #fff;
  position: relative;
}

.home-hero::after {
  content: "";
  position: absolute;
  top: 22px;
  right: 28px;
  width: 260px;
  height: 120px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size:
    100% 100%,
    26px 26px,
    26px 26px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  opacity: 0.88;
  pointer-events: none;
}

.home-hero h2 {
  max-width: 820px;
  font-size: 27px;
  line-height: 1.14;
  color: #fff;
  text-shadow: 0 6px 24px rgba(7, 30, 41, 0.28);
}

.home-hero .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

.home-hero .secondary-button {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.home-hero .secondary-button:hover {
  border-color: rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.2);
}

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

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.home-grid article {
  padding: 20px;
  min-height: 150px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 10px;
  background: #f1f7fa;
  backdrop-filter: blur(10px);
  box-shadow:
    0 18px 38px rgba(12, 44, 54, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.58),
    0 0 18px rgba(130, 176, 201, 0.12);
}

.home-grid article:nth-child(1) {
  background: #dff2ec;
  border-color: rgba(112, 182, 160, 0.46);
}

.home-grid article:nth-child(2) {
  background: #e2eefb;
  border-color: rgba(122, 163, 214, 0.46);
}

.home-grid article:nth-child(3) {
  background: #f3e8fb;
  border-color: rgba(166, 133, 214, 0.42);
}

.home-grid strong {
  display: block;
  font-size: 17px;
  margin-bottom: 10px;
}

.home-grid p {
  margin: 0;
  color: #5b6a78;
  line-height: 1.5;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  max-height: min(520px, calc(100vh - 386px));
}

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #244966;
  color: #fff;
  font-size: 12px;
}

th:first-child,
td:first-child {
  width: 66px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 142px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 116px;
}

th:nth-child(5),
td:nth-child(5) {
  width: 96px;
}

th:nth-child(6),
td:nth-child(6),
th:nth-child(8),
td:nth-child(8) {
  width: 108px;
}

th:nth-child(7),
td:nth-child(7) {
  width: 86px;
}

th:nth-child(9),
td:nth-child(9) {
  width: 92px;
}

td.money,
td.number {
  text-align: right;
  white-space: nowrap;
  font-weight: 700;
}

tbody tr:nth-child(even) {
  background: #f8fbfd;
}

.include-cell {
  text-align: center;
}

.include-cell input {
  width: 18px;
  height: 18px;
  min-height: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  background: var(--blue-2);
  color: var(--blue);
}

.pill.external {
  background: var(--amber-2);
  color: var(--amber);
}

.pill.pass-through {
  background: var(--ptc-2);
  color: var(--ptc);
}

.component-chart-title {
  margin-top: 0;
}

#componentBars {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcff;
}

.component-bars .bar-row {
  grid-template-columns: minmax(220px, 380px) 1fr 120px;
}

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

.fte-kpi-grid .kpi {
  min-height: 102px;
  padding: 14px 16px;
}

.fte-kpi-grid .kpi span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.fte-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.fte-workspace > * {
  min-width: 0;
}

.fte-table-wrap {
  max-height: min(560px, calc(100vh - 330px));
}

.fte-table {
  min-width: 640px;
}

.fte-table th:first-child,
.fte-table td:first-child {
  width: auto;
}

.fte-table th:nth-child(2),
.fte-table td:nth-child(2),
.fte-table th:nth-child(3),
.fte-table td:nth-child(3),
.fte-table th:nth-child(4),
.fte-table td:nth-child(4) {
  width: 128px;
}

.fte-table th:nth-child(5),
.fte-table td:nth-child(5) {
  width: 54px;
}

.fte-workspace .component-bars .bar-row {
  grid-template-columns: minmax(118px, 1fr) minmax(48px, 0.6fr) 92px;
}

.fte-workspace .bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fte-workspace .bar-value {
  font-size: 11px;
}

.role-input,
.money-input {
  min-height: 32px;
}

.money-input {
  text-align: right;
}

.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--red);
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.row-action:hover {
  border-color: var(--red);
  background: var(--red-2);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(12, 28, 38, 0.42);
  backdrop-filter: blur(5px);
}

.modal-backdrop.is-hidden {
  display: none;
}

.info-modal {
  width: min(980px, 100%);
  max-height: min(760px, calc(100vh - 56px));
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(215, 224, 232, 0.96);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(15, 35, 52, 0.28);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  font-size: 20px;
}

.modal-close {
  flex: 0 0 38px;
  box-shadow: none;
}

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

.definition-grid article {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

.definition-grid h3 {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 13px;
}

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

.assumption-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    "complexity follow follow"
    "training review risk"
    "scope scope scope"
    "ptc ptc ptc";
  gap: 16px;
  align-items: start;
}

.assumption-grid > section {
  min-width: 0;
  min-height: 214px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.assumption-grid > section h2 {
  margin-bottom: 14px;
}

.assumption-grid > section:nth-child(1) { grid-area: complexity; }
.assumption-grid > section:nth-child(2) { grid-area: follow; }
.assumption-grid > section:nth-child(3) { grid-area: training; }
.assumption-grid > section:nth-child(4) { grid-area: review; }
.assumption-grid > section:nth-child(5) { grid-area: risk; }
.assumption-grid > section:nth-child(6) { grid-area: scope; }
.assumption-grid > section:nth-child(7) {
  grid-area: ptc;
  min-height: 0;
}

.assumption-table {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.assumption-row {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) minmax(88px, 104px);
  align-items: center;
  gap: 8px;
}

.follow-row {
  grid-template-columns: minmax(96px, 1fr) minmax(86px, 110px) minmax(86px, 110px);
}

#passThroughRows .assumption-row {
  grid-template-columns: minmax(170px, 1fr) minmax(88px, 110px);
}

.ptc-controls {
  display: grid;
  gap: 8px;
}

.ptc-options {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.ptc-options-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.ptc-options-head h3 {
  margin: 0;
  font-size: 13px;
}

.ptc-options-head span,
.ptc-option span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.ptc-option-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ptc-scope-note {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid #d6c9ed;
  border-radius: 7px;
  background: var(--ptc-2);
  color: var(--ptc);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.ptc-scope-note.is-hidden {
  display: none;
}

.ptc-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px minmax(96px, 116px) minmax(98px, 112px);
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fafcff;
  min-height: 78px;
}

.ptc-option.is-muted {
  background: #f4f7fa;
}

.ptc-option.is-muted b,
.ptc-option.is-muted strong {
  color: var(--muted);
}

.ptc-option strong,
.ptc-option span {
  display: block;
}

.ptc-option strong {
  margin-bottom: 3px;
  font-size: 12px;
  line-height: 1.18;
}

.ptc-option input[type="number"] {
  width: 100%;
}

.ptc-switch {
  justify-self: center;
  transform: scale(0.86);
  transform-origin: center;
}

.ptc-option b {
  text-align: right;
  font-size: 12px;
  white-space: nowrap;
}

.assumption-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.22;
}

.assumption-row input {
  width: 100%;
}

.scope-row {
  grid-template-columns: minmax(180px, 1fr) minmax(88px, 110px);
}

.masters-grid {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 16px;
}

.masters-grid > section {
  padding: 16px;
}

.mapping-list {
  display: grid;
  gap: 14px;
}

.mapping-group h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.mapping-group ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.compact table {
  min-width: 720px;
}

@media (max-width: 1180px) {
  .login-screen {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  body.login-active {
    overflow: auto;
  }

  .login-visual {
    min-height: 460px;
  }

  .home-hero::after {
    width: 188px;
    height: 96px;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "inputs"
      "dashboard"
      "workspace";
  }

  .inputs-panel {
    position: static;
    max-height: none;
  }

  .chart-grid,
  .masters-grid,
  .home-grid,
  .definition-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "total fixed"
      "a b"
      "c d"
      "e f"
      "g h";
  }

  .fte-kpi-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .fte-workspace {
    grid-template-columns: 1fr;
  }

  .assumption-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    grid-template-areas:
      "complexity follow"
      "training review"
      "risk risk"
      "scope scope"
      "ptc ptc";
  }
}

@media (max-width: 720px) {
  .login-screen {
    padding: 18px;
  }

  .login-visual {
    min-height: 0;
    padding: 24px;
  }

  .login-hero-copy h2 {
    font-size: 30px;
  }

  .login-metrics {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 16px 12px;
  }

  .login-brand {
    align-items: flex-start;
  }

  .login-brand-mark {
    width: 78px;
    height: 78px;
    flex: 0 0 78px;
  }

  .header-brand-mark {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .form-logo-image {
    width: min(300px, 100%);
  }

  .layout {
    padding: 0 16px 18px;
  }

  .modal-backdrop {
    padding: 14px;
  }

  .info-modal {
    padding: 18px;
  }

  .header-actions,
  .home-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-hero::after {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "total"
      "fixed"
      "a"
      "b"
      "c"
      "d"
      "e"
      "f"
      "g"
      "h";
  }

  .split-panel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "chart"
      "breakdown";
  }

  .split-breakdown {
    grid-template-columns: 1fr;
  }

  .donut {
    width: 156px;
    height: 156px;
  }

  .donut::after {
    inset: 34px;
  }

  .legend {
    flex-wrap: wrap;
  }

  .fte-kpi-grid {
    grid-template-columns: 1fr;
  }

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

  .assumption-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "complexity"
      "follow"
      "training"
      "review"
      "risk"
      "scope"
      "ptc";
  }

  .bar-row,
  .component-bars .bar-row {
    grid-template-columns: 1fr;
  }

  .ptc-option-list {
    grid-template-columns: 1fr;
  }

  .ptc-option {
    grid-template-columns: 1fr;
  }

  .ptc-option b {
    text-align: left;
  }

  .bar-value {
    text-align: left;
  }
}
