/* Agency spend tab. Depends on app.css tokens and only styles inside .spend-page. */

.spend-page { width: var(--page); margin: 0 auto; padding: 34px 0 56px; }
.spend-page .search-workspace { margin-bottom: 20px; }
.spend-page .filter-section > label {
	display: block;
	margin-bottom: 6px;
	color: var(--slate-700);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}
.spend-page .filter-help { margin: 8px 0 0; font-size: 12px; line-height: 1.45; }
.spend-page #naics-search { text-align: left; font-weight: 500; }
.spend-filters.enhanced .spend-apply { display: none; }

/* Native select styled like the site's text inputs. */
.spend-filters select {
	appearance: none;
	width: 100%;
	padding: 9px 32px 9px 11px;
	border: 1px solid var(--slate-300);
	border-radius: var(--radius-sm);
	background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23667085' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E") right 10px center / 12px no-repeat;
	color: var(--ink);
	font-size: 13px;
	box-shadow: var(--shadow-sm);
	cursor: pointer;
}
.spend-filters select:focus {
	outline: 0;
	border-color: var(--amber-500);
	box-shadow: 0 0 0 3px rgba(229, 139, 33, 0.13);
}

/* NAICS picker */
.naics-entry { position: relative; }
.options {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	z-index: 10;
	max-height: 280px;
	margin: 0;
	padding: 4px;
	overflow-y: auto;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--surface);
	box-shadow: var(--shadow);
	list-style: none;
}
.options button {
	display: block;
	width: 100%;
	padding: 7px 9px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	box-shadow: none;
	color: var(--ink);
	font-size: 13px;
	font-weight: 500;
	line-height: 1.35;
	text-align: left;
}
.options button:hover, .options button:focus { background: var(--amber-50); color: var(--ink); outline: 0; }
.options button strong { font-variant-numeric: tabular-nums; }
.options-empty { padding: 8px 9px; color: var(--muted); font-size: 12px; }
.chosen { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.chosen[hidden] { display: none; }
.chosen .chip-match { border-radius: 6px; font-size: 13px; font-weight: 650; line-height: 1.35; }
.chosen button {
	width: auto;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	color: var(--link);
	font-size: 12px;
	font-weight: 650;
}
.chosen button:hover { background: none; color: var(--link); text-decoration: underline; }

/* Results */
.spend-results { display: flex; flex-direction: column; gap: 16px; overflow: visible; }
.context-strip { margin: 0; color: var(--slate-600); font-size: 14px; line-height: 1.5; }
.context-strip strong { color: var(--amber-700); font-weight: 700; }
.tiles {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px;
}
.tile {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 16px 18px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: var(--shadow-sm);
}
.tile-label { color: var(--slate-600); font-size: 12px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
.tile strong { color: var(--ink); font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.15; }
.tile.hero strong { font-size: 24px; }
.tile small { color: var(--muted); font-size: 12px; line-height: 1.4; }

.spend-section { padding: 18px 20px 20px; }
.section-head { margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 16px; letter-spacing: -0.01em; }
.section-head > p:last-child:not(.eyebrow) { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.section-lead { margin: 0 0 12px; color: var(--slate-700); font-size: 13px; line-height: 1.5; }
.spend-quiet { margin: 0; color: var(--muted); font-size: 13px; }

/* Ranked bars: one series, one hue. */
.bar-list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.bar-row {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) minmax(88px, auto);
	align-items: center;
	gap: 12px;
	padding: 7px 8px;
	border-radius: 8px;
	color: var(--ink);
	font-size: 13px;
}
a.bar-row:hover { background: var(--row-hover); text-decoration: none; }
a.bar-row:hover .bar-label > span { color: var(--link); }
.bar-label, .bar-value { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.bar-label > span { overflow-wrap: anywhere; font-weight: 600; }
.bar-label small, .bar-value small { color: var(--muted); font-size: 11px; }
.bar-value { align-items: flex-end; font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; }
.bar-track { display: block; height: 12px; }
.bar { display: block; height: 12px; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--amber-600); }
.bar-row.current { background: var(--amber-50); }
.bar-row.current .bar-label > span { color: var(--amber-700); }
.bar-row.muted .bar { background: var(--slate-300); }
.bar-row.muted .bar-label > span { color: var(--slate-600); font-weight: 500; }

/* Plan section */
.plan-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.plan-grid dl { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.plan-grid dt { color: var(--slate-600); font-size: 12px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
.plan-grid dd { margin: 2px 0 0; color: var(--ink); font-size: 14px; }
.plan-links { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 14px; font-weight: 600; }
.forecast-title { margin: 20px 0 8px; font-size: 14px; }
.forecast-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.forecast-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.forecast-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 14px; }
.forecast-head span { color: var(--amber-700); font-size: 12px; font-weight: 700; }
.forecast-meta, .forecast-source { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

/* Start state */
.start { padding: 18px 20px 20px; }
.shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.shortcuts a {
	display: inline-flex;
	gap: 5px;
	padding: 6px 11px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--slate-50);
	color: var(--slate-800);
	font-size: 13px;
}
.shortcuts a:hover { border-color: var(--amber-500); text-decoration: none; }
.shortcuts strong { font-variant-numeric: tabular-nums; }

/* Loading and errors */
.skeleton { display: flex; flex-direction: column; gap: 10px; }
.skeleton span {
	display: block;
	height: 14px;
	border-radius: 6px;
	background: linear-gradient(90deg, var(--slate-100), var(--slate-50), var(--slate-100));
	background-size: 200% 100%;
	animation: spend-shimmer 1.2s linear infinite;
}
.skeleton span:nth-child(2n) { width: 82%; }
.skeleton span:nth-child(3n) { width: 64%; }
.tiles-slot .skeleton span { height: 88px; border-radius: var(--radius); }
.tiles-slot .skeleton { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tiles-slot .skeleton span:nth-child(n) { width: auto; }
@keyframes spend-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton span { animation: none; } }
.problem {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 14px;
	padding: 12px 14px;
	border: 1px solid var(--warning-line);
	border-radius: var(--radius-sm);
	background: var(--amber-50);
	color: var(--warning-ink);
	font-size: 13px;
}
.problem p { margin: 0; }
.problem button { width: auto; padding: 6px 12px; }

.spend-notes { max-width: 860px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.spend-notes h2 { margin: 0 0 6px; color: var(--slate-700); font-size: 14px; }
.spend-notes p { margin: 0 0 6px; }

@media (max-width: 1040px) {
	.tiles, .tiles-slot .skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 840px) {
	.spend-page { padding-top: 25px; }
	.plan-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
	.tiles, .tiles-slot .skeleton { grid-template-columns: 1fr; }
	.spend-section, .start { padding: 16px; }
	.bar-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
	.bar-track { grid-column: 1 / -1; grid-row: 2; }
}
