:root {
	--canvas: #f5f4f0;
	--surface: #ffffff;
	--surface-muted: #eeece6;
	--ink: #252523;
	--muted: #6c6b66;
	--border: #d9d7d0;
	--border-strong: #bdbbb3;
	--accent: #2f5d50;
	--accent-dark: #24483e;
	--danger: #a44a42;
	--shadow: 0 1px 2px rgba(37, 37, 35, 0.06);
	--radius: 8px;
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--ink);
	background: var(--canvas);
}

* {
	box-sizing: border-box;
}

html {
	background: var(--canvas);
}

body {
	margin: 0;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	background: var(--canvas);
	color: var(--ink);
}

.app-shell {
	width: min(100% - 40px, 1120px);
	margin: 0 auto;
	padding: 22px 0 42px;
}

.app-shell--wide {
	width: min(100% - 48px, 1480px);
}

.app-header {
	border-bottom: 1px solid var(--border);
	background: rgba(255, 255, 255, 0.88);
}

.app-header-inner {
	width: min(100% - 40px, 1120px);
	min-height: 64px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
}

.app-header-inner--wide {
	width: min(100% - 48px, 1480px);
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	color: var(--ink);
	text-decoration: none;
}

.brand-mark {
	width: 30px;
	height: 30px;
	object-fit: contain;
	filter: grayscale(1) contrast(1.15);
}

.brand-mark[hidden] {
	display: none;
}

.brand-copy {
	display: flex;
	flex-direction: column;
	line-height: 1.05;
}

.brand-name {
	font-size: 14px;
	font-weight: 800;
	letter-spacing: 0.12em;
}

.brand-product {
	margin-top: 2px;
	font-size: 11px;
	color: var(--muted);
}

.primary-nav {
	display: flex;
	align-items: center;
	gap: 6px;
}

.primary-nav a,
.primary-nav strong {
	padding: 6px 9px;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
}

.primary-nav a {
	color: var(--muted);
}

.primary-nav a:hover {
	color: var(--ink);
	background: var(--surface-muted);
}

.primary-nav strong {
	color: var(--ink);
	background: var(--surface-muted);
}

.page-kicker {
	margin: 0 0 4px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted);
}

h1,
h2,
h3,
p {
	margin-top: 0;
}

.page-title {
	margin-bottom: 4px;
	font-size: clamp(24px, 3.2vw, 32px);
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.page-question {
	margin-bottom: 20px;
	font-size: 15px;
	color: var(--muted);
}

.section-title {
	margin: 30px 0 12px;
	font-size: 13px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.surface {
	padding: 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: var(--shadow);
}

.error-message {
	padding: 10px 12px;
	border-left: 3px solid var(--danger);
	background: #f8ecea;
	color: #74372f;
}

form {
	margin: 0;
}

input,
select,
button {
	min-height: 34px;
	font: inherit;
}

input,
select {
	padding: 5px 8px;
	border: 1px solid var(--border-strong);
	border-radius: 6px;
	background: var(--surface);
	color: var(--ink);
}

input:focus,
select:focus,
button {
    padding: 5px 11px;
    border: 1px solid #2f2f2f;
    border-radius: 6px;
    background: #2f2f2f;
    color: #e8e6df;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    background: #444444;
    border-color: #444444;

}

button.secondary,
.remove-action {
	border-color: var(--border-strong);
	background: transparent;
	color: var(--danger);
}

.remove-action:hover {
	border-color: var(--danger);
	background: #f8ecea;
}

.data-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--surface);
	font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
	padding: 9px 11px;
	border-bottom: 1px solid var(--border);
	text-align: left;
}

.data-table th {
	background: var(--surface-muted);
	font-size: 12px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.data-table td:nth-child(n+2),
.data-table th:nth-child(n+2) {
	text-align: right;
}

.data-table tbody tr:last-child td {
	border-bottom: 0;
}

.position-form {
	width: 100%;
}

.position-table-wrap {
	width: 100%;
}

.position-shell {
	width: min(100% - 40px, 1320px);
}

.position-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.7fr) minmax(360px, 1fr);
	gap: 28px;
	align-items: start;
}

.position-chart h2 {
	margin: 0 0 10px;
	font-size: 20px;
}

.position-table-section {
	padding-top: 30px;
}

.position-table {
	width: 100%;
	min-width: 0;
}

.position-table th,
.position-table td {
	min-width: 118px;
	padding-top: 5px;
	padding-bottom: 5px;
}
.position-table th {
    background: #2f2f2f;
    color: #e8e6df;
    font-weight: 700;
}
.position-table td:first-child {
	min-width: 142px;
	text-align: left;
	background: var(--surface-muted);
}

.position-table input[type="number"] {
	width: 90px;
	min-height: 28px;
	padding-top: 2px;
	padding-bottom: 2px;
	font-size: 14px;
}

.position-table th,
.position-table td {
	padding-top: 4px;
	padding-bottom: 4px;
}

.position-table td:nth-child(2),
.position-table td:nth-child(3) {
	font-size: 14px;
}

.position-actions {
	display: flex;
	justify-content: flex-end;
	width: 100%;
	padding-top: 6px;
}

.position-actions button {
	margin-left: auto;
	border-color: var(--border-strong);
	background: var(--surface-muted);
	color: var(--ink);
}

.position-actions button:hover {
	border-color: var(--ink);
	background: #e5e3dc;
}

.chart-note {
	margin: 10px 0 0;
	font-size: 13px;
	line-height: 1.4;
	color: var(--muted);
}

.chart-wrap {
	width: 100%;
	height: 460px;
}

.setup-item {
	margin-bottom: 7px;
	padding: 9px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
}
.commitment-row {
    border-bottom: 1px solid var(--border);
    background: rgba(47, 47, 47, 0.10);
}
.commitment-summary {
	display: grid;
	grid-template-columns: minmax(180px, 1.7fr) 110px 120px 140px auto;
	align-items: center;
	gap: 12px;
	min-height: 42px;
	padding: 5px 0;
	font-variant-numeric: tabular-nums;
}
.commitment-description {
	font-weight: 400;
	padding-left: 12px;
}
.commitment-amount {
	text-align: right;
}
.edit-action,
.commitment-summary .edit-action {
    min-height: 28px;
    padding: 3px 10px;
    border: 1px solid #2f2f2f;
    border-radius: 5px;
    background: #2f2f2f;
    color: #e8e6df;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.edit-action:hover,
.commitment-summary .edit-action:hover {
    background: #444444;
    border-color: #444444;
}.commitment-edit {
	display: none;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	padding: 7px 0;
}

.setup-group-heading {
	margin: 22px 0 8px;
	font-size: 13px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}
.setup-group-in,
.setup-group-out {
    background: #2f2f2f;
    color: #e8e6df;
    padding: 10px 12px;
    font-weight: 700;
}

.setup-group-in {
    border-right: 420px solid #8ecae6;
}

.setup-group-out {
    border-right: 420px solid #f4a6b5;
}
.commitment-row.is-editing .commitment-summary {
	display: none;
}

.commitment-row.is-editing {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 6px;
	padding: 7px 0;
}

.commitment-row.is-editing .commitment-edit {
	display: contents;
}

.commitment-edit input[name="description"] {
	min-width: 220px;
	flex: 1 1 320px;
}

.commitment-edit input[name="amount"] {
	width: 120px;
}

.commitment-edit input[name="next_date"] {
	width: 150px;
}

.commitment-row.is-editing .remove-action {
	margin-left: 0;
	border-color: var(--danger);
	background: transparent;
	color: var(--danger);
}

.commitment-row.is-editing .remove-action:hover {
	background: #f8ecea;
}

.commitment-form {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.commitment-form input[name="description"] {
	min-width: 190px;
	flex: 1 1 220px;
}

.commitment-form input[name="amount"] {
	width: 120px;
}

.commitment-form input[name="next_date"] {
	width: 150px;
}

.remove-form {
	margin-top: 6px;
}

.add-form {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
}

.add-form input[name="description"] {
	min-width: 190px;
}

.daily-context-wrap {
	margin-bottom: 12px;
}

.month-context {
	border: 1px solid var(--border);
	display: flex;
	align-items: center;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
    color: #ffffff;
    background: #2f2f2f;
}

.month-context strong {
    color: #ffffff;
	font-size: 13px;
	letter-spacing: 0.06em;
}

.context-forward-position {
	display: block;
	margin-left: auto;
	text-align: right;
    font-weight: 600;
    color: var(--ink);
    background: #f4f3ef;
    padding: 4px 8px;
}

.daily-table-scroll {
	overflow: visible;
	border: 1px solid var(--border);
	background: var(--surface);
}

.daily-table {
	min-width: 1120px;
	margin: 0;
	border: 0;
	font-size: 14px;
}

.daily-table th,
.daily-table td {
	padding: 8px 11px;
	border-right: 1px solid var(--border);
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}

.daily-table th:last-child,
.daily-table td:last-child {
	border-right: 0;
}

.daily-table .daily-header-row th {
	position: sticky;
	top: 40px;
	background: var(--surface-muted);
	font-size: 12px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	z-index: 2;
}

.daily-table .daily-header-row--commitments th {
	top: 80px;
}

.daily-table .daily-header-row .date-header {
	left: 0;
	z-index: 7;
    background: #2f2f2f;
    color: #e8e6df;
    font-weight: 700;
}
.daily-table tbody tr:not(.month-heading):not(.month-end-checkpoint) td:first-child {
    background: #2f2f2f;
    color: #e8e6df;
    font-weight: 500;
}

.daily-table tbody tr:not(.month-heading):not(.month-end-checkpoint):nth-child(even) td:first-child {
    background: #797979;
}
.daily-table .month-heading td,
.daily-table .month-end-checkpoint td {
	background: #e1ded5;
	color: var(--ink);
}

.daily-table .month-heading td {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.08em;
	background: #d8d5cc;
}

.daily-table .month-end-checkpoint td {
	font-size: 12px;
	font-weight: 600;
    background: #2f2f2f;
    color: #e8e6df;
}
.daily-table .month-end-checkpoint td:not(.checkpoint-summary) {
	text-align: right;
}

.daily-table .month-end-checkpoint .checkpoint-summary {
	text-align: left;
	white-space: nowrap;
}

.daily-table .month-end-checkpoint .checkpoint-actual {
	text-align: right;
}
.daily-table .month-end-checkpoint button {
    background: #e8e6df;
    color: #2f2f2f;
    border: 1px solid #e8e6df;
    font-weight: 700;
}

.daily-actual-form {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.daily-actual-form label {
	font-weight: 600;
}

.daily-actual-form input {
	width: 100px;
	min-height: 28px;
	padding: 3px 6px;
	font-size: 13px;
}

.daily-actual-form button {
	min-height: 28px;
	padding: 3px 8px;
	font-size: 12px;
}

.daily-table .day-row:nth-child(even) td {
	background: #fcfcfa;
}

.daily-table .day-row .date-cell,
.daily-table .daily-header-row .date-header {
	background: var(--surface-muted);
}

.daily-table .day-row .date-cell,
.daily-table td:last-child {
	font-variant-numeric: tabular-nums;
}

.daily-table .day-row td:not(.date-cell) {
	padding-right: 14px;
	text-align: right;
}

.daily-table .daily-header-row th,
.daily-table .day-row .date-cell {
	font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
	.app-shell,
	.app-shell--wide,
	.position-shell,
	.app-header-inner,
	.app-header-inner--wide {
		width: min(100% - 24px, 1480px);
	}

	.app-header-inner {
		align-items: flex-start;
		flex-direction: column;
		gap: 10px;
		padding: 12px 0;
	}

	.primary-nav {
		width: 100%;
		overflow-x: auto;
	}

	.position-layout {
		display: block;
	}

	.position-table-section {
		padding-top: 24px;
	}

	.surface {
		padding: 14px;
	}
}
.daily-table .daily-header-row th {
    background: #2f2f2f;
    color: #e8e6df;
}.daily-table .daily-header-row th.date-header {
    background: #2f2f2f;
    color: #e8e6df;
}
/* Cashflow direction colours */
.daily-table .daily-header-row--groups th:nth-child(2),
.daily-table .daily-header-row--groups th:nth-child(3),
.daily-table .daily-header-row--groups th:nth-child(4) {
    background: #f4a6b5;
    color: #2f2f2f;
}

.daily-table .daily-header-row--groups th:nth-child(5) {
    background: #8ecae6;
    color: #2f2f2f;
}
/* Month-end IN / OUT direction colours */
.daily-table .month-end-checkpoint .checkpoint-out {
    background: #f4a6b5;
    color: #2f2f2f;
    font-weight: 700;
}

.daily-table .month-end-checkpoint .checkpoint-in {
    background: #8ecae6;
    color: #2f2f2f;
    font-weight: 700;
}

/* Shared pinned navigation */
.app-header {
 position:sticky;
 top:0;
 z-index:100;
 background:#fff;
}
