:root {
	--ink: #12302d;
	--ink-soft: #405551;
	--muted: #6b7772;
	--paper: #f4f1e8;
	--card: #fffdf7;
	--line: #d9d9cf;
	--teal: #197567;
	--teal-soft: #e1f0eb;
	--coral: #be4839;
	--coral-soft: #f8e4de;
	--lime: #cae75c;
	--shadow: 0 12px 35px rgba(18, 48, 45, .06);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--ink);
	background: var(--paper);
	font-synthesis: none;
}

* {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	min-width: 320px;
	background:
		radial-gradient(circle at 90% 8%, rgba(202, 231, 92, .12), transparent 22rem),
		var(--paper);
}

button,
input,
select {
	font: inherit;
}

button {
	cursor: pointer;
}

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

h1,
h2 {
	font-family: Georgia, "Times New Roman", serif;
	font-weight: 400;
}

.app-shell {
	min-height: 100vh;
}

.topbar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	height: 72px;
	padding: 0 max(4vw, 22px);
	border-bottom: 1px solid var(--line);
	background: rgba(244, 241, 232, .94);
	backdrop-filter: blur(12px);
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	width: max-content;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--ink);
	text-align: left;
}

.brand > span:last-child {
	display: grid;
	line-height: 1;
}

.brand strong {
	font-family: Georgia, serif;
	font-size: 19px;
	font-weight: 400;
}

.brand small {
	margin-top: 4px;
	color: var(--muted);
	font-size: 8px;
	font-weight: 800;
	letter-spacing: .12em;
	text-transform: uppercase;
}

.brand-mark {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--ink);
	color: var(--lime);
	font-family: Georgia, serif;
	font-size: 18px;
}

.brand-mark.large {
	width: 52px;
	height: 52px;
	margin: 0 auto 18px;
	font-size: 28px;
}

nav {
	display: flex;
	gap: 4px;
	padding: 4px;
	border: 1px solid var(--line);
	border-radius: 9px;
	background: #ebe8de;
}

nav button {
	padding: 8px 16px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--muted);
	font-size: 11px;
	font-weight: 700;
}

nav button.active {
	background: var(--card);
	color: var(--ink);
	box-shadow: 0 2px 8px rgba(18, 48, 45, .08);
}

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

.saved {
	color: var(--teal);
	font-size: 9px;
	font-weight: 800;
	text-transform: uppercase;
}

.saved::before {
	display: inline-block;
	width: 6px;
	height: 6px;
	margin-right: 6px;
	border-radius: 50%;
	background: currentColor;
	content: "";
}

.saved.saving {
	color: #ad7b27;
}

.saved.error {
	color: var(--coral);
}

.ghost-button,
.primary-button,
.lock-button,
.add-button,
.priority-alert button,
.sticky-summary button {
	min-height: 38px;
	padding: 9px 13px;
	border: 1px solid var(--line);
	border-radius: 7px;
	background: transparent;
	color: var(--ink);
	font-size: 10px;
	font-weight: 800;
}

.primary-button,
.add-button {
	border-color: var(--teal);
	background: var(--teal);
	color: white;
}

.lock-button {
	border: 0;
	color: var(--coral);
}

.page-wrap {
	width: min(1420px, 92vw);
	margin: 0 auto;
	padding: 52px 0 32px;
}

.intro-row,
.inputs-intro {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: end;
	gap: 48px;
	margin-bottom: 30px;
}

.eyebrow,
.kicker {
	margin-bottom: 9px;
	color: var(--teal);
	font-size: 9px;
	font-weight: 900;
	letter-spacing: .14em;
	text-transform: uppercase;
}

.intro-row h1,
.inputs-intro h1 {
	max-width: 960px;
	margin-bottom: 14px;
	font-size: clamp(38px, 5vw, 72px);
	line-height: .98;
	letter-spacing: -.045em;
}

.lede,
.inputs-intro p {
	max-width: 780px;
	margin-bottom: 0;
	color: var(--ink-soft);
	font-size: 14px;
	line-height: 1.65;
}

.today-card {
	display: grid;
	gap: 7px;
	min-width: 220px;
	padding-left: 26px;
	border-left: 1px solid var(--line);
}

.today-card span,
.runway span,
.sticky-summary span {
	color: var(--muted);
	font-size: 9px;
	font-weight: 800;
	letter-spacing: .1em;
	text-transform: uppercase;
}

.today-card strong {
	font-family: Georgia, serif;
	font-size: 24px;
	font-weight: 400;
}

.today-card button {
	width: max-content;
	padding: 0 0 2px;
	border: 0;
	border-bottom: 1px solid var(--teal);
	background: transparent;
	color: var(--teal);
	font-size: 10px;
	font-weight: 800;
}

.priority-alert {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 18px;
	margin-bottom: 18px;
	padding: 19px 21px;
	border: 1px solid rgba(190, 72, 57, .35);
	border-radius: 12px;
	background: var(--coral-soft);
}

.alert-icon {
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--coral);
	color: white;
	font-family: Georgia, serif;
	font-size: 23px;
}

.priority-alert p {
	margin-bottom: 3px;
	color: var(--coral);
	font-size: 9px;
	font-weight: 900;
	letter-spacing: .12em;
	text-transform: uppercase;
}

.priority-alert h2 {
	margin-bottom: 4px;
	font-family: inherit;
	font-size: 17px;
	font-weight: 800;
}

.priority-alert span {
	color: #71483f;
	font-size: 11px;
}

.priority-alert button {
	border-color: var(--coral);
	background: var(--coral);
	color: white;
}

.metric-grid {
	display: grid;
	grid-template-columns: 1.08fr repeat(3, 1fr);
	margin-bottom: 18px;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: var(--card);
	box-shadow: var(--shadow);
}

.metric {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	min-height: 140px;
	padding: 23px;
	border-right: 1px solid var(--line);
}

.metric:last-child {
	border-right: 0;
}

.metric.featured {
	background: var(--ink);
	color: white;
}

.metric span {
	color: var(--muted);
	font-size: 9px;
	font-weight: 800;
	letter-spacing: .1em;
	text-transform: uppercase;
}

.metric.featured span,
.metric.featured small {
	color: #b9cac6;
}

.metric strong {
	font-family: Georgia, serif;
	font-size: clamp(27px, 3vw, 40px);
	font-weight: 400;
	letter-spacing: -.03em;
}

.metric small {
	color: var(--muted);
	font-size: 9px;
	line-height: 1.4;
}

.dashboard-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.6fr) minmax(330px, .8fr);
	gap: 18px;
	margin-bottom: 18px;
}

.panel,
.settings-card {
	padding: 24px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: var(--card);
	box-shadow: var(--shadow);
}

.panel-heading {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
}

.panel h2,
.source-note h2 {
	margin-bottom: 0;
	font-size: 23px;
}

.runway {
	display: grid;
	text-align: right;
}

.runway strong {
	font-size: 12px;
}

.runway.safe strong {
	color: var(--teal);
}

.runway.danger strong,
.table-warning {
	color: var(--coral);
}

.projection-canvas {
	display: block;
	width: 100%;
	height: 320px;
	margin: 14px 0 0;
}

.chart-legend {
	display: flex;
	align-items: center;
	gap: 18px;
	padding-top: 13px;
	border-top: 1px solid var(--line);
	color: var(--muted);
	font-size: 9px;
}

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

.chart-legend span:last-child {
	margin-left: auto;
}

.chart-legend strong {
	color: var(--ink);
}

.line-key,
.zero-key {
	display: inline-block;
	width: 20px;
	height: 3px;
	border-radius: 4px;
	background: var(--teal);
}

.zero-key {
	height: 1px;
	background: repeating-linear-gradient(90deg, var(--coral) 0 4px, transparent 4px 7px);
}

.milestone-list {
	display: grid;
	gap: 10px;
	margin-top: 19px;
}

.milestone {
	display: grid;
	grid-template-columns: 40px minmax(0, 1fr) auto;
	align-items: start;
	gap: 11px;
	padding: 10px;
	border-radius: 8px;
}

.milestone.at-risk {
	background: var(--coral-soft);
}

.milestone.muted {
	opacity: .45;
}

.milestone time {
	display: grid;
	place-items: center;
	width: 40px;
	height: 44px;
	border: 1px solid var(--line);
	border-radius: 7px;
	background: var(--paper);
	line-height: 1;
}

.milestone time span {
	color: var(--teal);
	font-size: 8px;
	font-weight: 900;
	text-transform: uppercase;
}

.milestone time strong {
	font-family: Georgia, serif;
	font-size: 18px;
	font-weight: 400;
}

.milestone h3 {
	margin: 2px 0 3px;
	font-size: 11px;
}

.milestone p {
	margin-bottom: 3px;
	color: var(--muted);
	font-size: 8px;
	line-height: 1.4;
}

.milestone b {
	color: var(--coral);
	font-size: 8px;
}

.milestone > strong {
	font-family: ui-monospace, monospace;
	font-size: 10px;
}

.monthly-panel {
	margin-bottom: 18px;
	padding-bottom: 10px;
}

.table-warning {
	margin: 0;
	font-size: 10px;
	font-weight: 800;
}

.table-wrap {
	overflow-x: auto;
	margin-top: 16px;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 10px;
}

th,
td {
	padding: 12px;
	border-bottom: 1px solid #e8e5dc;
	text-align: right;
}

th {
	color: var(--muted);
	font-size: 8px;
	letter-spacing: .08em;
	text-transform: uppercase;
}

th:first-child,
td:first-child {
	text-align: left;
}

td:not(:first-child) {
	font-family: ui-monospace, "SFMono-Regular", monospace;
}

.income-cell,
.status-on-track {
	color: var(--teal);
}

.negative,
.status-shortfall,
.status-below-buffer {
	color: var(--coral);
}

.status {
	font-family: inherit;
	font-size: 8px;
	font-weight: 900;
	text-transform: uppercase;
}

.source-note {
	display: grid;
	grid-template-columns: .7fr 1.4fr;
	gap: 20px 40px;
	padding: 24px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: #ebe8de;
}

.source-note > p {
	margin: 0;
	color: var(--ink-soft);
	font-size: 11px;
	line-height: 1.6;
}

.source-links {
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	gap: 10px 20px;
	padding-top: 14px;
	border-top: 1px solid #d5d1c5;
}

.source-links a {
	color: var(--teal);
	font-size: 9px;
	font-weight: 800;
	text-decoration: none;
}

.inputs-page {
	max-width: 1260px;
}

.inputs-intro h1 {
	max-width: 850px;
	font-size: clamp(36px, 4.5vw, 62px);
}

.input-actions {
	display: flex;
	gap: 9px;
}

.settings-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	align-items: start;
	gap: 16px;
}

.settings-card.wide {
	grid-column: 1 / -1;
}

.settings-heading {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 18px;
	padding-bottom: 17px;
	border-bottom: 1px solid var(--line);
}

.settings-heading > span {
	display: grid;
	flex: 0 0 27px;
	place-items: center;
	width: 27px;
	height: 27px;
	border-radius: 50%;
	background: var(--teal-soft);
	font-family: ui-monospace, monospace;
	font-size: 8px;
}

.settings-heading h2 {
	margin: 0 0 3px;
	font-size: 21px;
}

.settings-heading p {
	margin: 0;
	color: var(--muted);
	font-size: 9px;
}

.settings-heading.with-action .add-button {
	margin-left: auto;
}

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

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

.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.field > span {
	color: var(--ink-soft);
	font-size: 8px;
	font-weight: 900;
	letter-spacing: .07em;
	text-transform: uppercase;
}

.field input,
.field select,
.auth-card input {
	width: 100%;
	min-height: 41px;
	padding: 8px 10px;
	border: 1px solid #c9ccc3;
	border-radius: 6px;
	outline: none;
	background: #fbfaf4;
	color: var(--ink);
	font-size: 11px;
}

.field input:focus,
.field select:focus,
.auth-card input:focus {
	border-color: var(--teal);
	box-shadow: 0 0 0 3px rgba(25, 117, 103, .12);
}

.field small {
	color: var(--muted);
	font-size: 8px;
	line-height: 1.4;
}

.input-shell {
	position: relative;
}

.input-shell b {
	position: absolute;
	top: 50%;
	left: 10px;
	transform: translateY(-50%);
	color: var(--muted);
	font-family: ui-monospace, monospace;
	font-size: 10px;
}

.input-shell b + input {
	padding-left: 25px;
}

.check-row {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-top: 16px;
	padding: 12px;
	border: 1px solid var(--line);
	border-radius: 7px;
}

.check-row input {
	margin-top: 2px;
	accent-color: var(--teal);
}

.check-row span {
	display: grid;
	gap: 3px;
}

.check-row strong {
	font-size: 10px;
}

.check-row small {
	color: var(--muted);
	font-size: 8px;
}

.calculation-strip {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 3px 14px;
	margin-top: 18px;
	padding: 13px 15px;
	border-radius: 7px;
	background: var(--teal-soft);
}

.calculation-strip.warning {
	background: var(--coral-soft);
}

.calculation-strip span {
	font-size: 8px;
	font-weight: 900;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.calculation-strip strong {
	grid-row: 1 / 3;
	grid-column: 2;
	font-family: Georgia, serif;
	font-size: 23px;
	font-weight: 400;
}

.calculation-strip small {
	color: var(--muted);
	font-size: 8px;
}

.salary-schedule {
	margin-top: 20px;
	padding-top: 18px;
	border-top: 1px solid var(--line);
}

.salary-schedule-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.salary-schedule-heading h3 {
	margin: 0 0 3px;
	font-size: 11px;
}

.salary-schedule-heading p,
.empty-schedule {
	margin: 0;
	color: var(--muted);
	font-size: 8px;
	line-height: 1.4;
}

.empty-schedule {
	margin-top: 12px;
}

.salary-change-stack {
	margin-top: 12px;
}

.source-row.salary-change-row {
	grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) 30px;
	max-width: 620px;
}

.source-stack {
	display: grid;
	gap: 9px;
}

.source-row {
	display: grid;
	grid-template-columns: minmax(150px, 1.3fr) repeat(4, minmax(110px, 1fr)) 30px;
	align-items: end;
	gap: 9px;
	padding: 12px;
	border: 1px solid #e0ded5;
	border-radius: 8px;
	background: #f7f5ee;
}

.remove-button {
	width: 30px;
	height: 41px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--coral);
	font-size: 20px;
}

.remove-button:hover {
	background: var(--coral-soft);
}

.sticky-summary {
	position: sticky;
	bottom: 12px;
	z-index: 10;
	display: grid;
	grid-template-columns: repeat(3, 1fr) auto;
	align-items: center;
	gap: 20px;
	width: min(800px, 96%);
	margin: 22px auto 0;
	padding: 13px 14px 13px 20px;
	border-radius: 10px;
	background: rgba(18, 48, 45, .97);
	box-shadow: 0 18px 45px rgba(18, 48, 45, .24);
	color: white;
}

.sticky-summary div {
	display: grid;
	gap: 3px;
}

.sticky-summary span {
	color: #afc0bc;
}

.sticky-summary strong {
	font-family: Georgia, serif;
	font-size: 17px;
	font-weight: 400;
}

.sticky-summary button {
	border: 0;
	background: var(--lime);
}

footer {
	display: flex;
	justify-content: space-between;
	gap: 24px;
	width: min(1420px, 92vw);
	margin: 0 auto;
	padding: 20px 0 30px;
	border-top: 1px solid var(--line);
	color: var(--muted);
	font-size: 8px;
}

footer p {
	max-width: 630px;
	margin: 0;
	text-align: right;
}

.auth-screen {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: grid;
	place-items: center;
	padding: 20px;
	background: rgba(18, 48, 45, .94);
}

.auth-card {
	width: min(420px, 100%);
	padding: 34px;
	border: 1px solid rgba(255, 255, 255, .12);
	border-radius: 14px;
	background: var(--card);
	box-shadow: 0 25px 80px rgba(0, 0, 0, .28);
	text-align: center;
}

.auth-card h1 {
	margin-bottom: 24px;
	font-size: 34px;
	line-height: 1.05;
}

.auth-card form {
	display: grid;
	gap: 9px;
	text-align: left;
}

.auth-card form > label {
	font-size: 9px;
	font-weight: 900;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.auth-card form button {
	min-height: 43px;
	border: 0;
	border-radius: 7px;
	background: var(--teal);
	color: white;
	font-size: 11px;
	font-weight: 800;
}

.auth-card form button:disabled {
	opacity: .45;
}

.auth-card > small,
.loading {
	display: block;
	margin-top: 17px;
	color: var(--muted);
	font-size: 9px;
	line-height: 1.5;
}

.auth-error {
	margin: 0;
	color: var(--coral);
	font-size: 10px;
}

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

	.topbar nav {
		position: absolute;
		top: 66px;
		left: 50%;
		transform: translateX(-50%);
	}

	.saved {
		display: none;
	}

	.page-wrap {
		padding-top: 72px;
	}

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

	.metric:nth-child(2) {
		border-right: 0;
	}

	.metric:nth-child(-n + 2) {
		border-bottom: 1px solid var(--line);
	}

	.dashboard-grid,
	.settings-grid {
		grid-template-columns: 1fr;
	}

	.settings-card.wide {
		grid-column: auto;
	}

	.source-row {
		grid-template-columns: repeat(2, 1fr);
	}

	.source-name {
		grid-column: 1 / -1;
	}
}

@media (max-width: 680px) {
	.topbar {
		height: 64px;
		padding: 0 4vw;
	}

	.topbar nav {
		top: 58px;
		width: 92vw;
	}

	.topbar nav button {
		flex: 1;
	}

	.top-actions .ghost-button {
		display: none;
	}

	.page-wrap {
		width: 92vw;
		padding-top: 68px;
	}

	.intro-row,
	.inputs-intro {
		grid-template-columns: 1fr;
		gap: 22px;
	}

	.today-card {
		padding: 16px 0 0;
		border-top: 1px solid var(--line);
		border-left: 0;
	}

	.priority-alert {
		grid-template-columns: auto 1fr;
	}

	.priority-alert button {
		grid-column: 1 / -1;
	}

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

	.metric {
		min-height: 120px;
		border-right: 0;
		border-bottom: 1px solid var(--line);
	}

	.panel,
	.settings-card {
		padding: 18px;
	}

	.projection-canvas {
		height: 260px;
	}

	.chart-legend {
		flex-wrap: wrap;
	}

	.chart-legend span:last-child {
		width: 100%;
		margin-left: 0;
	}

	.source-note,
	.field-grid,
	.field-grid.three,
	.source-row,
	.source-row.salary-change-row {
		grid-template-columns: 1fr;
	}

	.salary-schedule-heading {
		align-items: flex-start;
	}

	.source-links,
	.source-name {
		grid-column: auto;
	}

	.settings-heading.with-action {
		flex-wrap: wrap;
	}

	.settings-heading.with-action .add-button {
		margin-left: 39px;
	}

	.remove-button {
		width: 100%;
		height: 32px;
	}

	.sticky-summary {
		grid-template-columns: 1fr 1fr;
	}

	.sticky-summary div:nth-child(3) {
		display: none;
	}

	.sticky-summary button {
		grid-column: 1 / -1;
	}

	footer {
		flex-direction: column;
	}

	footer p {
		text-align: left;
	}

	.auth-card {
		padding: 28px 22px;
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
}
