/* spend.css — the Spending view.
 *
 * Two calm tracks (Inference, Credits), a small daily bar graph each, a
 * category breakdown and a plain table. All colour comes from the theme
 * variables, so light and dark are handled for free. No hyperbole in the
 * design: quiet reassurance, precise figures. */

.spend-view {
	height: 100%;
	overflow-y: auto;
	overflow-x: hidden;
	/* 10px is the dock's one body inset, so Agents, Email, Workspace and
	   Spending all start on the same edge under a 4px header. Four panels used
	   to start at 6, 10, 14 and 11. */
	padding: 12px 10px 24px;
	font-size: var(--fs-sm);
	color: var(--text-primary);
}

.spend-intro {
	color: var(--text-secondary);
	font-size: var(--fs-xs);
	line-height: 1.45;
	margin: 0 0 14px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--border);
}

.spend-sec {
	margin: 0 0 6px;
}

.spend-sec-head {
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
	margin: 4px 0 10px;
}
.spend-sec-title {
	margin: 0;
	font-size: var(--fs-lg);
	font-weight: 600;
	letter-spacing: 0.01em;
}
.spend-sec-hint {
	font-size: var(--fs-2xs-xs);
	color: var(--text-muted);
}

/* Headline stats row. */
.spend-totals {
	display: flex;
	gap: 18px;
	flex-wrap: wrap;
	margin: 0 0 12px;
}
.spend-stat {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.spend-stat-val {
	font-size: var(--fs-4xl);
	font-weight: 650;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}
.spend-stat-lbl {
	font-size: var(--fs-2xs);
	color: var(--text-muted);
	text-transform: lowercase;
}

/* Week / Month toggle. */
.spend-toggle {
	display: inline-flex;
	gap: 2px;
	padding: 2px;
	background: var(--bg-tertiary);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	margin: 0 0 12px;
}
.spend-toggle-btn {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--text-secondary);
	font: inherit;
	font-size: var(--fs-xs);
	padding: 3px 12px;
	border-radius: var(--radius-sm);
	cursor: pointer;
}
.spend-toggle-btn.on {
	background: var(--bg-secondary);
	color: var(--text-primary);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* The bar chart. */
.spend-chart {
	margin: 0 0 14px;
}
.spend-bars {
	display: block;
	width: 100%;
	height: 88px;
}
.spend-bar-track {
	fill: var(--bg-tertiary);
}
.spend-bar {
	fill: var(--accent);
}
.spend-axis {
	display: flex;
	justify-content: space-between;
	margin-top: 3px;
	font-size: var(--fs-3xs-2xs);
	color: var(--text-muted);
}
.spend-empty {
	color: var(--text-muted);
	font-size: var(--fs-xs);
	padding: 10px 0;
}

/* Category breakdown. */
.spend-sub {
	font-size: var(--fs-xs);
	color: var(--text-secondary);
	font-weight: 600;
	margin: 6px 0 6px;
}
.spend-breakdown {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0 0 14px;
}
.spend-bd-row {
	display: grid;
	grid-template-columns: minmax(84px, 34%) 1fr auto;
	align-items: center;
	gap: 10px;
}
.spend-bd-label {
	color: var(--text-secondary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.spend-bd-bar {
	position: relative;
	height: 8px;
	background: var(--bg-tertiary);
	border-radius: 999px;
	overflow: hidden;
}
.spend-bd-fill {
	position: absolute;
	inset: 0 auto 0 0;
	background: var(--accent);
	border-radius: 999px;
}
.spend-bd-amt {
	font-variant-numeric: tabular-nums;
	color: var(--text-primary);
	white-space: nowrap;
}

/* The plain table. */
.spend-table {
	width: 100%;
	border-collapse: collapse;
	margin: 4px 0 8px;
	font-size: var(--fs-xs);
}
.spend-table th {
	text-align: left;
	font-weight: 600;
	color: var(--text-muted);
	font-size: var(--fs-2xs);
	padding: 4px 8px 4px 0;
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}
.spend-table td {
	padding: 5px 8px 5px 0;
	border-bottom: 1px solid var(--border);
	color: var(--text-secondary);
	vertical-align: top;
}
.spend-table th.num,
.spend-table td.num {
	text-align: right;
	font-variant-numeric: tabular-nums;
	padding-right: 0;
	white-space: nowrap;
}
.spend-table td.spend-model {
	color: var(--text-primary);
	font-family: var(--font-mono);
	font-size: var(--fs-2xs);
	word-break: break-all;
}
.spend-table td.spend-when {
	color: var(--text-muted);
	white-space: nowrap;
}
.spend-table td.debit  { color: var(--text-primary); }
.spend-table td.credit { color: var(--ok); }

.spend-note {
	color: var(--text-secondary);
	font-size: var(--fs-xs-sm);
	line-height: 1.5;
	background: var(--bg-tertiary);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 12px 14px;
}

/* Two provenance lines in a row are two statements, not one paragraph. */
.spend-note + .spend-note {
	margin-top: 8px;
}

.spend-divider {
	height: 1px;
	background: var(--border);
	margin: 16px 0 14px;
}
