/* Budget Planner — front-end styles */

.bp-app {
	--bp-primary: #1a6b4a;
	--bp-primary-light: #e8f5ef;
	--bp-danger: #c0392b;
	--bp-danger-light: #fdecea;
	--bp-warning: #d68910;
	--bp-warning-light: #fef9e7;
	--bp-success: #1a6b4a;
	--bp-success-light: #e8f5ef;
	--bp-border: #dde3ea;
	--bp-bg: #f7f9fb;
	--bp-card: #ffffff;
	--bp-text: #1e293b;
	--bp-muted: #64748b;
	--bp-radius: 10px;
	--bp-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	color: var(--bp-text);
	max-width: 1100px;
	margin: 0 auto;
	padding: 1.5rem;
	line-height: 1.5;
}

/* Header */
.bp-header {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: flex-start;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.bp-title {
	margin: 0 0 0.25rem;
	font-size: 1.75rem;
	font-weight: 700;
	color: var(--bp-primary);
}

.bp-subtitle {
	margin: 0;
	color: var(--bp-muted);
	font-size: 0.95rem;
	max-width: 600px;
}

.bp-header__actions {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.bp-save-status {
	font-size: 0.85rem;
	color: var(--bp-muted);
	min-width: 140px;
	text-align: right;
}

.bp-toggle {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.85rem;
	cursor: pointer;
}

/* Meta panel */
.bp-meta-panel {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	padding: 1rem 1.25rem;
	background: var(--bp-card);
	border: 1px solid var(--bp-border);
	border-radius: var(--bp-radius);
	margin-bottom: 1.25rem;
}

.bp-field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	min-width: 140px;
}

.bp-field--grow {
	flex: 1;
	min-width: 200px;
}

.bp-field label {
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--bp-muted);
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.bp-field input,
.bp-field select,
.bp-input,
.bp-select {
	padding: 0.5rem 0.65rem;
	border: 1px solid var(--bp-border);
	border-radius: 6px;
	font-size: 0.95rem;
	background: #fff;
	color: var(--bp-text);
}

.bp-input--short {
	width: 60px;
}

.bp-input:focus,
.bp-select:focus,
.bp-field input:focus,
.bp-field select:focus {
	outline: none;
	border-color: var(--bp-primary);
	box-shadow: 0 0 0 3px rgba(26, 107, 74, 0.12);
}

/* Summary cards */
.bp-summary {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 1rem;
	margin-bottom: 1.25rem;
}

.bp-summary__card {
	background: var(--bp-card);
	border: 1px solid var(--bp-border);
	border-radius: var(--bp-radius);
	padding: 1rem 1.25rem;
	box-shadow: var(--bp-shadow);
}

.bp-summary__label {
	display: block;
	font-size: 0.8rem;
	color: var(--bp-muted);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	margin-bottom: 0.35rem;
}

.bp-summary__value {
	font-size: 1.5rem;
	font-weight: 700;
}

.bp-summary__status {
	display: block;
	font-size: 0.8rem;
	margin-top: 0.25rem;
}

.bp-summary__card--income .bp-summary__value { color: var(--bp-primary); }
.bp-summary__card--expenses .bp-summary__value { color: var(--bp-danger); }
.bp-summary__card--surplus { border-color: var(--bp-success); background: var(--bp-success-light); }
.bp-summary__card--surplus .bp-summary__value { color: var(--bp-success); }
.bp-summary__card--deficit { border-color: var(--bp-danger); background: var(--bp-danger-light); }
.bp-summary__card--deficit .bp-summary__value { color: var(--bp-danger); }
.bp-summary__card--balanced { border-color: var(--bp-warning); background: var(--bp-warning-light); }

/* Progress bar */
.bp-progress-wrap {
	margin-bottom: 1.5rem;
}

.bp-progress-label {
	display: flex;
	justify-content: space-between;
	font-size: 0.85rem;
	color: var(--bp-muted);
	margin-bottom: 0.4rem;
}

.bp-progress-bar {
	height: 10px;
	background: var(--bp-border);
	border-radius: 99px;
	overflow: hidden;
}

.bp-progress-bar__fill {
	height: 100%;
	background: linear-gradient(90deg, var(--bp-primary), #2d9f6f);
	border-radius: 99px;
	transition: width 0.3s ease;
	max-width: 100%;
}

/* Tabs */
.bp-tabs {
	display: flex;
	gap: 0.25rem;
	border-bottom: 2px solid var(--bp-border);
	margin-bottom: 1.25rem;
}

.bp-tab {
	background: none;
	border: none;
	padding: 0.75rem 1.25rem;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--bp-muted);
	cursor: pointer;
	border-bottom: 2px solid transparent;
	margin-bottom: -2px;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	transition: color 0.15s, border-color 0.15s;
}

.bp-tab:hover { color: var(--bp-text); }

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

.bp-tab__total {
	font-size: 0.8rem;
	font-weight: 500;
	color: var(--bp-muted);
	background: var(--bp-bg);
	padding: 0.15rem 0.5rem;
	border-radius: 99px;
}

/* Sections & table */
.bp-section {
	background: var(--bp-card);
	border: 1px solid var(--bp-border);
	border-radius: var(--bp-radius);
	margin-bottom: 1rem;
	overflow: hidden;
}

.bp-section__header {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.85rem 1.25rem;
	background: var(--bp-bg);
	border-bottom: 1px solid var(--bp-border);
}

.bp-section__title {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	flex: 1;
}

.bp-section__total {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--bp-primary);
}

.bp-table__head,
.bp-row {
	display: grid;
	grid-template-columns: 2fr 1.2fr 1.1fr 1fr 1.5fr 40px;
	gap: 0.5rem;
	align-items: center;
	padding: 0.6rem 1.25rem;
}

.bp-table__head {
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--bp-muted);
	text-transform: uppercase;
	letter-spacing: 0.03em;
	border-bottom: 1px solid var(--bp-border);
}

.bp-row {
	border-bottom: 1px solid #f0f3f7;
	transition: background 0.1s;
}

.bp-row:hover { background: #fafbfc; }
.bp-row--disabled { opacity: 0.45; }

.bp-row__label {
	font-size: 0.9rem;
}

.bp-input-group {
	display: flex;
	align-items: center;
}

.bp-input-group__prefix {
	padding: 0.5rem 0.5rem 0.5rem 0.65rem;
	background: var(--bp-bg);
	border: 1px solid var(--bp-border);
	border-right: none;
	border-radius: 6px 0 0 6px;
	font-size: 0.9rem;
	color: var(--bp-muted);
}

.bp-input-group .bp-input {
	border-radius: 0 6px 6px 0;
	width: 100%;
}

.bp-input--label {
	font-weight: 500;
}

.bp-monthly-equiv {
	font-size: 0.85rem;
	color: var(--bp-muted);
	font-weight: 500;
}

/* Toggle switch */
.bp-switch {
	position: relative;
	display: inline-block;
	width: 36px;
	height: 20px;
	cursor: pointer;
}

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

.bp-switch__slider {
	position: absolute;
	inset: 0;
	background: #cbd5e1;
	border-radius: 99px;
	transition: 0.2s;
}

.bp-switch__slider::before {
	content: "";
	position: absolute;
	width: 16px;
	height: 16px;
	left: 2px;
	bottom: 2px;
	background: white;
	border-radius: 50%;
	transition: 0.2s;
}

.bp-switch input:checked + .bp-switch__slider { background: var(--bp-primary); }
.bp-switch input:checked + .bp-switch__slider::before { transform: translateX(16px); }

/* Buttons */
.bp-btn {
	padding: 0.55rem 1.1rem;
	border-radius: 6px;
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	border: 1px solid transparent;
	transition: background 0.15s, border-color 0.15s;
}

.bp-btn--secondary {
	background: var(--bp-card);
	border-color: var(--bp-border);
	color: var(--bp-text);
}

.bp-btn--secondary:hover { background: var(--bp-bg); }

.bp-btn--danger {
	background: var(--bp-danger-light);
	border-color: #f5c6c0;
	color: var(--bp-danger);
}

.bp-btn--danger:hover { background: #fad4d0; }

.bp-btn--link {
	background: none;
	border: none;
	color: var(--bp-primary);
	padding: 0;
	font-size: 0.85rem;
	cursor: pointer;
}

.bp-btn--link:hover { text-decoration: underline; }

/* Overview */
.bp-overview__section {
	background: var(--bp-card);
	border: 1px solid var(--bp-border);
	border-radius: var(--bp-radius);
	padding: 1.25rem;
	margin-bottom: 1rem;
}

.bp-overview__section h3 {
	margin: 0 0 1rem;
	font-size: 1rem;
}

.bp-hint {
	font-size: 0.85rem;
	color: var(--bp-muted);
	margin: 0 0 1rem;
}

.bp-breakdown__row {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.25rem 1rem;
	margin-bottom: 0.75rem;
	align-items: center;
}

.bp-breakdown__label {
	display: flex;
	justify-content: space-between;
	font-size: 0.9rem;
	grid-column: 1;
}

.bp-breakdown__pct {
	color: var(--bp-muted);
	font-size: 0.8rem;
}

.bp-breakdown__bar {
	grid-column: 1;
	height: 6px;
	background: var(--bp-border);
	border-radius: 99px;
	overflow: hidden;
}

.bp-breakdown__fill {
	height: 100%;
	background: var(--bp-primary);
	border-radius: 99px;
}

.bp-breakdown__amount {
	font-size: 0.9rem;
	font-weight: 600;
	grid-column: 2;
	grid-row: 1 / 3;
	align-self: center;
}

.bp-rule-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 0.75rem;
}

.bp-rule-card {
	padding: 1rem;
	border-radius: 8px;
	border: 1px solid var(--bp-border);
	text-align: center;
}

.bp-rule-card--on-track { background: var(--bp-success-light); border-color: #b8dfc9; }
.bp-rule-card--over { background: var(--bp-danger-light); border-color: #f5c6c0; }
.bp-rule-card--under { background: var(--bp-warning-light); border-color: #f9e4b0; }

.bp-rule-card__label {
	display: block;
	font-size: 0.8rem;
	color: var(--bp-muted);
	margin-bottom: 0.25rem;
}

.bp-rule-card__value {
	font-size: 1.4rem;
}

.bp-rule-card__target {
	display: block;
	font-size: 0.75rem;
	color: var(--bp-muted);
	margin-top: 0.2rem;
}

.bp-tips {
	margin: 0;
	padding-left: 1.25rem;
	font-size: 0.9rem;
	color: var(--bp-muted);
}

.bp-tips li { margin-bottom: 0.4rem; }

.bp-empty {
	color: var(--bp-muted);
	font-size: 0.9rem;
	margin: 0;
}

/* Footer */
.bp-footer {
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 1.5rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--bp-border);
}

.bp-footer__left,
.bp-footer__right {
	display: flex;
	gap: 0.5rem;
}

/* Notice */
.bp-notice {
	padding: 0.85rem 1.25rem;
	border-radius: var(--bp-radius);
	font-size: 0.9rem;
	margin-top: 1rem;
}

.bp-notice--info {
	background: #eff6ff;
	border: 1px solid #bfdbfe;
	color: #1e40af;
}

.bp-notice a { color: inherit; font-weight: 600; }

.bp-summary-message {
	margin: 0 0 1.25rem;
	padding: 0.85rem 1.25rem;
	border-radius: var(--bp-radius);
	font-size: 0.95rem;
	font-weight: 600;
}

.bp-summary-message--surplus {
	background: var(--bp-success-light);
	border: 1px solid #b8dfc9;
	color: var(--bp-success);
}

.bp-summary-message--deficit {
	background: var(--bp-danger-light);
	border: 1px solid #f5c6c0;
	color: var(--bp-danger);
}

.bp-summary-message--balanced {
	background: var(--bp-warning-light);
	border: 1px solid #f9e4b0;
	color: #9a6700;
}

.bp-attribution {
	margin-top: 1rem;
	font-size: 0.8rem;
	color: var(--bp-muted);
	text-align: center;
}

.bp-attribution a {
	color: var(--bp-primary);
}

/* Responsive */
@media (max-width: 768px) {
	.bp-table__head { display: none; }

	.bp-row {
		grid-template-columns: 1fr 1fr;
		gap: 0.5rem;
		padding: 1rem;
	}

	.bp-col--item { grid-column: 1 / -1; }
	.bp-col--monthly { display: none; }
	.bp-col--toggle { justify-self: end; }

	.bp-summary__value { font-size: 1.25rem; }
}

/* Print */
@media print {
	.bp-tabs,
	.bp-footer,
	.bp-notice,
	.bp-header__actions,
	.bp-btn--link,
	.bp-switch,
	.bp-col--toggle {
		display: none !important;
	}

	.bp-panel[hidden] { display: block !important; }

	.bp-app {
		max-width: 100%;
		padding: 0;
	}
}
