:root {
  --ink: #111827;
  --muted: #64748b;
  --line: #cbd5e1;
  --line-soft: #e2e8f0;
  --paper: #ffffff;
  --canvas: #eef3f8;
  --navy: #061a44;
  --blue: #155ee8;
  --blue-2: #2f7df6;
  --cyan: #0ea5e9;
  --green: #0f8f6f;
  --amber: #b45309;
  --red: #b91c1c;
  --revenue-branch: #082a63;
  --revenue-market: #2563eb;
  --aebitda-branch: #0f766e;
  --aebitda-market: #14b8a6;
  --max-hurdle: #f59e0b;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(6, 26, 68, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(6, 26, 68, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 86% 8%, rgba(21, 94, 232, 0.14), transparent 28rem),
    var(--canvas);
  background-size: 36px 36px, 36px 36px, auto, auto;
  font-family: Avenir Next, Avenir, Segoe UI, Helvetica Neue, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(6, 26, 68, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(6, 26, 68, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 82% 12%, rgba(21, 94, 232, 0.18), transparent 28rem),
    var(--canvas);
  background-size: 36px 36px, 36px 36px, auto, auto;
}

.auth-card {
  display: grid;
  width: min(100%, 560px);
  gap: 16px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 8px;
  padding: 34px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.18);
}

.auth-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  font-weight: 950;
}

.auth-card h1 {
  margin: 0;
  font-size: 38px;
  line-height: 42px;
  letter-spacing: 0;
}

.auth-card p {
  margin: 0;
  max-width: 48ch;
  color: #475569;
  font-size: 15px;
  line-height: 23px;
}

.auth-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.primary-auth-action,
.secondary-action {
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

.primary-auth-action {
  width: fit-content;
  margin-top: 4px;
  padding: 13px 18px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--blue), #0f8f6f);
  box-shadow: 0 16px 34px rgba(21, 94, 232, 0.28);
}

.secondary-action {
  padding: 9px 12px;
  color: var(--navy);
  background: #eaf2ff;
}

.auth-error {
  border: 1px solid #fecaca;
  border-left-width: 6px;
  border-radius: 8px;
  padding: 12px 14px;
  color: #991b1b;
  background: #fff1f2;
  font-size: 13px;
  line-height: 19px;
}

.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.auth-topbar span,
.auth-topbar strong {
  display: block;
}

.auth-topbar span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-topbar strong {
  margin-top: 2px;
  color: var(--ink);
  font-size: 14px;
}

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

.people-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 18px;
  color: #dbeafe;
  background:
    linear-gradient(180deg, rgba(7, 31, 87, 0.96), rgba(3, 12, 35, 0.98)),
    var(--navy);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 26px;
}

.brand-lockup > span {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(191, 219, 254, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 900;
}

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

.brand-lockup strong {
  color: #ffffff;
  font-size: 15px;
}

.brand-lockup small {
  margin-top: 3px;
  color: #93c5fd;
  font-size: 12px;
}

.people-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.people-heading small {
  color: #93c5fd;
  font-size: 11px;
  text-transform: none;
}

.person-tree {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.person-branch {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.person-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.person-expander {
  display: grid;
  width: 28px;
  height: 28px;
  align-self: center;
  place-items: center;
  border: 1px solid rgba(147, 197, 253, 0.24);
  border-radius: 999px;
  color: #bfdbfe;
  background: rgba(255, 255, 255, 0.06);
  font-size: 16px;
  font-weight: 950;
  line-height: 1;
}

.person-expander.spacer {
  border-color: transparent;
  background: transparent;
}

.person-node {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 11px;
  border: 1px solid rgba(147, 197, 253, 0.16);
  border-radius: 8px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
}

.person-row.active .person-node {
  border-color: rgba(125, 211, 252, 0.9);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.4), rgba(14, 165, 233, 0.18));
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
}

.person-row.active .person-expander:not(.spacer) {
  border-color: rgba(125, 211, 252, 0.9);
  color: #ffffff;
  background: rgba(14, 165, 233, 0.22);
}

.person-children {
  display: grid;
  gap: 6px;
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid rgba(147, 197, 253, 0.18);
}

.person-initials {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(147, 197, 253, 0.2);
  font-size: 12px;
  font-weight: 900;
}

.person-node strong,
.person-node small,
.person-node em {
  display: block;
}

.person-node strong {
  color: #ffffff;
  font-size: 13px;
}

.person-node small {
  margin-top: 2px;
  color: #bfdbfe;
  font-size: 11px;
}

.person-node em {
  margin-top: 4px;
  color: #93c5fd;
  font-size: 10px;
  font-style: normal;
}

.tree-empty {
  border: 1px solid rgba(147, 197, 253, 0.16);
  border-radius: 8px;
  padding: 12px;
  color: #bfdbfe;
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
}

.impersonation-box {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
  border: 1px solid rgba(125, 211, 252, 0.26);
  border-radius: 8px;
  padding: 12px;
  background: rgba(14, 165, 233, 0.1);
}

.impersonation-box > span {
  color: #ffffff;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.impersonation-box label {
  display: grid;
  gap: 5px;
}

.impersonation-box small {
  color: #bfdbfe;
  font-size: 11px;
  font-weight: 800;
}

.impersonation-box input,
.search-first input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(147, 197, 253, 0.35);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  background: #ffffff;
}

.impersonation-box button,
.search-first button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--blue), var(--green));
  font-weight: 950;
}

.impersonation-box .quiet-action {
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(147, 197, 253, 0.24);
}

.impersonation-box em {
  color: #fecaca;
  font-size: 11px;
  line-height: 16px;
  font-style: normal;
}

.workspace {
  display: grid;
  gap: 18px;
  max-width: 1420px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 34px 110px;
}

.impersonation-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #93c5fd;
  border-left-width: 8px;
  border-radius: 8px;
  padding: 13px 15px;
  background: linear-gradient(180deg, #eff6ff, #ffffff);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.08);
}

.impersonation-banner span,
.impersonation-banner strong {
  display: block;
}

.impersonation-banner span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.impersonation-banner strong {
  margin-top: 3px;
  color: var(--navy);
  font-size: 15px;
}

.search-first {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 420px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 54px rgba(15, 23, 42, 0.11);
}

.search-first h1 {
  margin: 0;
  max-width: 620px;
  color: var(--navy);
  font-size: 34px;
  line-height: 40px;
}

.search-first p {
  margin: 0;
  max-width: 70ch;
  color: #475569;
  font-size: 14px;
  line-height: 22px;
}

.search-first-actions {
  display: grid;
  grid-template-columns: minmax(260px, 440px) 150px;
  gap: 10px;
  align-items: center;
}

.disclaimer {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  border: 1px solid #f59e0b;
  border-left-width: 8px;
  border-radius: 8px;
  padding: 15px 18px;
  background: linear-gradient(180deg, #fffbeb, #ffffff);
  box-shadow: 0 14px 34px rgba(180, 83, 9, 0.1);
}

.disclaimer-badge {
  display: grid;
  min-height: 34px;
  place-items: center;
  border-radius: 6px;
  color: #78350f;
  background: #fde68a;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.disclaimer p {
  margin: 0;
  color: #5f3b08;
  font-size: 13px;
  line-height: 20px;
  font-weight: 650;
}

.error-banner {
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 13px 15px;
  color: #7f1d1d;
  background: #fff7f7;
}

.error-banner strong,
.error-banner span {
  display: block;
}

.error-banner span {
  margin-top: 4px;
  font-size: 13px;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 360px);
  gap: 24px;
  align-items: stretch;
  min-height: 185px;
  overflow: hidden;
  border-radius: 8px;
  padding: 26px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.2), transparent 44%),
    linear-gradient(135deg, #061a44, #155ee8);
  box-shadow: 0 24px 56px rgba(21, 94, 232, 0.26);
}

.eyebrow {
  color: #bfdbfe;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-card h1 {
  margin: 9px 0 8px;
  font-size: 34px;
  line-height: 39px;
  letter-spacing: 0;
}

.hero-plan {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  margin: 0 0 12px;
  color: #eff6ff;
}

.hero-plan span {
  color: #bfdbfe;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-plan strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 20px;
  font-weight: 850;
}

.hero-card p {
  max-width: 780px;
  margin: 0;
  color: #dbeafe;
  line-height: 22px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.hero-meta span {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 6px 10px;
  color: #e0f2fe;
  background: rgba(255, 255, 255, 0.09);
  font-size: 12px;
  font-weight: 800;
}

.hero-result {
  display: grid;
  align-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.12);
}

.hero-result span,
.hero-result small {
  color: #dbeafe;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.hero-result strong {
  margin: 7px 0;
  color: #ffffff;
  font-size: 40px;
  line-height: 44px;
}

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

.kpi-card,
.panel,
.composition-parent,
.composition-child {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.08);
}

.kpi-card {
  min-height: 136px;
  padding: 16px;
}

.kpi-card span,
.composition-parent span,
.kpi-card small,
.composition-parent small {
  display: block;
}

.kpi-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 15px;
  text-transform: uppercase;
}

.kpi-card strong {
  display: block;
  margin-top: 14px;
  color: var(--ink);
  font-size: 25px;
  line-height: 30px;
}

.kpi-card small {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 17px;
}

.base-pay-card {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #eff6ff, #ffffff);
}

.kpi-card.required-missing {
  border-color: rgba(180, 83, 9, 0.55);
  background:
    linear-gradient(180deg, rgba(255, 251, 235, 0.95), #ffffff);
  box-shadow:
    0 16px 42px rgba(15, 23, 42, 0.08),
    0 0 0 3px rgba(245, 158, 11, 0.12);
}

.kpi-card.required-missing > span {
  color: #92400e;
}

.kpi-card.required-missing small {
  color: #92400e;
  font-weight: 850;
}

.kpi-card.required-missing .money-input,
.kpi-card.required-missing .percent-input {
  border-color: rgba(180, 83, 9, 0.65);
}

.location-card strong {
  font-size: 21px;
}

.bonus-composition {
  display: grid;
  gap: 14px;
}

.composition-parent {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: center;
  padding: 20px;
  border-color: #93c5fd;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.composition-parent span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.composition-parent strong {
  display: block;
  margin-top: 6px;
  font-size: 31px;
}

.composition-parent small {
  margin-top: 4px;
  color: var(--muted);
}

.composition-scale {
  display: flex;
  height: 26px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.composition-scale i,
.composition-scale b {
  display: block;
  min-width: 1%;
}

.composition-scale i {
  background: linear-gradient(90deg, var(--revenue-branch), var(--revenue-market));
}

.composition-scale b {
  background: linear-gradient(90deg, var(--aebitda-branch), var(--aebitda-market));
}

.composition-child {
  overflow: hidden;
}

.max-hurdle-child {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(180deg, #fffdf5, #ffffff);
}

.section-toggle {
  display: grid;
  grid-template-columns: 34px 92px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 0;
  padding: 18px;
  background: #ffffff;
  text-align: left;
}

.weight-number {
  display: grid;
  min-height: 64px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--blue);
  font-size: 26px;
  font-weight: 950;
}

.max-hurdle-child .weight-number {
  background: linear-gradient(135deg, #d97706, var(--max-hurdle));
  color: #1f1300;
  font-size: 22px;
}

.max-hurdle-child .section-toggle em {
  border-color: rgba(245, 158, 11, 0.38);
  color: #92400e;
  background: rgba(245, 158, 11, 0.14);
}

.section-toggle strong {
  display: block;
}

.section-toggle strong {
  font-size: 21px;
}

.section-heading-copy {
  min-width: 0;
}

.section-title-line {
  display: flex;
  gap: 14px;
  align-items: baseline;
  justify-content: space-between;
  min-width: 0;
}

.section-title-line strong {
  min-width: 0;
}

.section-amount {
  flex: 0 0 auto;
  color: var(--ink);
  text-align: right;
}

.section-toggle em {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 999px;
  color: var(--blue);
  background: rgba(37, 99, 235, 0.08);
  font-size: 18px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.child-body {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line-soft);
  padding: 16px;
}

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

.split-strip span {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 8px 11px;
  color: #475569;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 850;
}

.split-strip b {
  color: var(--ink);
}

.max-hurdle-body {
  background:
    linear-gradient(90deg, rgba(245, 158, 11, 0.08), transparent 36%),
    #ffffff;
}

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

.max-hurdle-grid article {
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 251, 235, 0.72);
}

.max-hurdle-grid span {
  color: #92400e;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.max-hurdle-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.max-hurdle-grid small {
  display: block;
  margin-top: 5px;
  color: #64748b;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

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

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 12px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #475569;
  background: #f1f6fd;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

td {
  color: #334155;
  font-size: 13px;
}

tr.quarter-row td {
  background: #ffffff;
}

tr.quarter-1 td,
tr.quarter-3 td {
  background: #fbfdff;
}

tr.quarter-start td {
  border-top: 2px solid rgba(37, 99, 235, 0.16);
}

tr.quarter-end td {
  border-bottom-color: rgba(37, 99, 235, 0.22);
}

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

.month-cell {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.month-cell em,
.month-cell i {
  display: inline-grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
}

.month-cell em {
  border-radius: 999px;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.1);
  font-size: 10px;
  font-style: normal;
  font-weight: 950;
  letter-spacing: 0.04em;
}

.actual-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 5px 9px;
  color: #334155;
  background: #f8fafc;
  border: 1px solid var(--line-soft);
  font-size: 12px;
  font-weight: 850;
}

.actual-chip i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.1);
}

.actual-chip strong {
  color: var(--ink);
  font-weight: 900;
}

.actual-chip em {
  color: #64748b;
  font-style: normal;
  font-weight: 800;
}

.actual-chip.variance-green i {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}

.actual-chip.variance-amber i {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}

.actual-chip.variance-red i {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.actual-chip.variance-neutral i {
  background: #94a3b8;
}

.projection-control {
  display: inline-grid;
  grid-template-columns: 28px minmax(138px, 1fr) 28px;
  gap: 5px;
  align-items: center;
  max-width: 230px;
}

.projection-control.wide-control {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  max-width: none;
  margin-top: 8px;
}

.projection-control .money-input {
  width: 100%;
  min-width: 0;
}

.projection-control .money-input.wide {
  margin-top: 0;
}

.projection-bump {
  display: grid;
  width: 28px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 8px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 15px;
  font-weight: 950;
  line-height: 1;
}

.projection-control.wide-control .projection-bump {
  width: 32px;
  height: 42px;
}

.projection-bump:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background: #dbeafe;
}

.money-input,
.percent-input {
  display: inline-flex;
  align-items: center;
  min-width: 144px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.kpi-card .money-input,
.kpi-card .percent-input {
  width: 100%;
  height: 42px;
  margin-top: 8px;
}

.money-input.wide {
  display: flex;
  width: 100%;
  margin-top: 8px;
}

.money-input > span,
.percent-input > span {
  display: grid;
  align-self: stretch;
  min-width: 34px;
  place-items: center;
  border-right: 1px solid var(--line-soft);
  color: #475569;
  background: #f1f5f9;
  font-weight: 900;
}

.percent-input > span {
  border-right: 0;
  border-left: 1px solid var(--line-soft);
}

.percent-input.percent-prefix > span {
  flex: 0 0 34px;
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  height: 100%;
  border-right: 1px solid var(--line-soft);
  border-left: 0;
}

.percent-input.percent-prefix {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
}

.percent-input.percent-prefix input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.money-input input,
.percent-input input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  padding: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 20px;
  outline: none;
}

.money-input.budget-default {
  border-color: #d8e0ea;
  background: #f8fafc;
}

.money-input.budget-default > span {
  color: #94a3b8;
  background: #eef2f7;
}

.money-input.budget-default input {
  color: #7c8797;
  font-weight: 650;
}

.money-input:focus-within,
.percent-input:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(21, 94, 232, 0.12);
}

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

.aebitda-grid article {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdff;
}

.aebitda-grid span,
.aebitda-grid strong,
.aebitda-grid label {
  display: block;
}

.aebitda-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.aebitda-grid strong {
  margin-top: 6px;
  font-size: 24px;
}

.aebitda-grid label {
  margin-top: 14px;
  color: #475569;
  font-size: 12px;
  font-weight: 850;
}

.aebitda-grid .money-input > span {
  display: grid;
  min-width: 34px;
  place-items: center;
  color: #475569;
  background: #f1f5f9;
  font-size: 16px;
  font-weight: 900;
  text-transform: none;
}

.aebitda-grid .money-input.budget-default > span {
  color: #94a3b8;
  background: #eef2f7;
}

.charts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 14px;
}

.panel {
  padding: 18px;
}

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

.panel-title h2 {
  margin: 0;
  font-size: 20px;
}

.panel-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 19px;
}

.panel-title select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #475569;
  font-size: 12px;
  font-weight: 850;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i,
.legend-table i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.branch-dot {
  background: var(--revenue-branch);
}

.market-dot {
  background: var(--revenue-market);
}

.chart-shell {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  min-height: 320px;
  padding-bottom: 2px;
}

.scale-note {
  display: inline-flex;
  width: fit-content;
  margin: 4px 0 10px 54px;
  padding: 5px 8px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: #1e40af;
  font-size: 11px;
  font-weight: 800;
}

.y-axis,
.gridlines {
  display: grid;
  grid-template-rows: repeat(5, 1fr);
}

.y-axis span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.gridlines {
  position: absolute;
  inset: 0 0 26px 54px;
  pointer-events: none;
}

.gridlines i {
  border-top: 1px solid var(--line-soft);
}

.bar-chart {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(12, minmax(34px, 1fr));
  gap: 9px;
  align-items: stretch;
  min-height: 292px;
  padding: 0 6px 28px 0;
}

.stack-wrap {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 18px;
  align-items: stretch;
  height: 100%;
  min-width: 0;
}

.quarter-band {
  z-index: 1;
  display: grid;
  align-self: end;
  align-items: end;
  height: 24px;
  margin: 0 -2px;
  border: 1px solid rgba(100, 116, 139, 0.24);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  color: #475569;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
}

.quarter-band span {
  display: inline-grid;
  justify-self: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ffffff;
  transform: translateY(9px);
}

.quarter-q1 {
  grid-column: 1 / span 3;
  grid-row: 1;
}

.quarter-q2 {
  grid-column: 4 / span 3;
  grid-row: 1;
}

.quarter-q3 {
  grid-column: 7 / span 3;
  grid-row: 1;
}

.quarter-q4 {
  grid-column: 10 / span 3;
  grid-row: 1;
}

.stack {
  display: flex;
  flex-direction: column;
  justify-content: end;
  align-self: end;
  overflow: hidden;
  min-height: 6px;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.14);
}

.stack b {
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 0 2px;
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.stack b.tiny-segment {
  min-height: 4px;
  padding: 0;
}

.branch-callout {
  position: absolute;
  left: 50%;
  bottom: 23px;
  z-index: 3;
  padding: 2px 4px;
  border: 1px solid rgba(2, 18, 63, 0.18);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.9);
  color: #02123f;
  font-size: 8px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  transform: translateX(-50%);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
  pointer-events: none;
}

.actual .branch-segment {
  background: #0f172a;
}

.actual .market-segment {
  background: #64748b;
}

.projected .branch-segment {
  background: var(--revenue-branch);
}

.projected .market-segment {
  background: var(--revenue-market);
}

.stack-wrap > span {
  grid-row: 2;
  align-self: end;
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}

.payout-shell,
.pie-shell {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  min-height: 320px;
}

.payout-stack {
  display: flex;
  flex-direction: column;
  justify-content: end;
  justify-self: center;
  width: 86px;
  height: 260px;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
  background: #e2e8f0;
}

.payout-stack span {
  display: grid;
  place-items: center;
  min-height: 22px;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
}

.pie {
  position: relative;
  display: grid;
  width: 190px;
  height: 190px;
  place-items: center;
  border-radius: 50%;
}

.pie-center {
  position: absolute;
  inset: 49px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background: #ffffff;
  box-shadow:
    inset 0 0 0 1px rgba(15, 23, 42, 0.06),
    0 10px 22px rgba(15, 23, 42, 0.08);
  text-align: center;
}

.pie-center span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.pie-center strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
  line-height: 22px;
}

.legend-table {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.legend-table td:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 850;
}

.legend-table td:last-child {
  text-align: right;
  font-weight: 900;
}

.revenue-branch {
  background: var(--revenue-branch);
}

.revenue-market {
  background: var(--revenue-market);
}

.aebitda-branch {
  background: var(--aebitda-branch);
}

.aebitda-market {
  background: var(--aebitda-market);
}

.max-hurdle {
  background: var(--max-hurdle);
}

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

.explanation summary {
  color: var(--blue);
  font-weight: 900;
  cursor: pointer;
}

.explanation p {
  color: #475569;
  font-size: 13px;
  line-height: 20px;
}

.floating-calc {
  position: fixed;
  right: 28px;
  bottom: 24px;
  z-index: 20;
  display: grid;
  min-width: 190px;
  border: 0;
  border-radius: 8px;
  padding: 14px 18px;
  color: #ffffff;
  background: linear-gradient(135deg, #0f8f6f, #155ee8);
  box-shadow: 0 20px 45px rgba(21, 94, 232, 0.35);
  text-align: left;
}

.floating-calc span {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.floating-calc strong {
  margin-top: 3px;
  font-size: 18px;
}

.floating-calc.disabled,
.floating-calc:disabled {
  cursor: not-allowed;
  color: #cbd5e1;
  background: linear-gradient(135deg, #64748b, #334155);
  box-shadow: 0 16px 34px rgba(51, 65, 85, 0.24);
}

.floating-calc.disabled strong,
.floating-calc:disabled strong {
  font-size: 15px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .people-panel {
    position: relative;
    height: auto;
  }

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

@media (max-width: 760px) {
  .workspace {
    padding: 18px 14px 110px;
  }

  .disclaimer,
  .hero-card,
  .composition-parent,
  .aebitda-grid,
  .max-hurdle-grid,
  .kpi-grid,
  .charts-grid,
  .payout-shell,
  .pie-shell {
    grid-template-columns: 1fr;
  }

  .hero-card h1 {
    font-size: 26px;
    line-height: 31px;
  }

  .hero-result strong {
    font-size: 32px;
  }

  .section-toggle {
    grid-template-columns: 32px 74px minmax(0, 1fr);
  }

  .floating-calc {
    right: 14px;
    left: 14px;
    bottom: 14px;
  }
}
