:root {
	--bg: #0b111b;
	--bg-2: #0f1724;
	--panel: #121b2a;
	--panel-2: #162233;
	--line: rgba(148, 163, 184, 0.18);
	--line-strong: rgba(148, 163, 184, 0.32);
	--ink: #edf4ff;
	--muted: #a8b3c2;
	--soft: #6f7d91;
	--blue: #5cc8ff;
	--green: #7bd88f;
	--gold: #ffd166;
	--red: #ef767a;
	--violet: #b39ddb;
	--shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	background:
		radial-gradient(circle at top left, rgba(92, 200, 255, 0.14), transparent 34rem),
		radial-gradient(circle at top right, rgba(123, 216, 143, 0.09), transparent 28rem),
		linear-gradient(180deg, #0b111b 0%, #0f1521 55%, #0b111b 100%);
	color: var(--ink);
	font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.app-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	padding: 22px clamp(16px, 3vw, 34px);
	background: rgba(11, 17, 27, 0.86);
	backdrop-filter: blur(18px);
	border-bottom: 1px solid var(--line);
	position: sticky;
	top: 0;
	z-index: 20;
}

.eyebrow {
	margin: 0 0 3px;
	color: var(--blue);
	font-size: 11px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0;
}

h1,
h2 {
	margin: 0;
	line-height: 1.15;
	letter-spacing: 0;
}

h1 {
	font-size: clamp(22px, 3vw, 30px);
}

h2 {
	font-size: 16px;
}

main {
	padding: 18px clamp(16px, 3vw, 34px) 42px;
}

.header-actions,
.toolbar,
.date-card {
	display: flex;
	align-items: center;
	gap: 10px;
}

.toolbar {
	justify-content: space-between;
	margin-bottom: 12px;
}

.date-card {
	flex-wrap: wrap;
	padding: 10px;
	background: rgba(18, 27, 42, 0.78);
	border: 1px solid var(--line);
	border-radius: 8px;
	box-shadow: var(--shadow);
}

.icon-button,
.text-button,
.tab-buttons button {
	border: 1px solid var(--line-strong);
	background: rgba(22, 34, 51, 0.92);
	color: var(--ink);
	cursor: pointer;
	min-height: 38px;
	border-radius: 7px;
	font-weight: 800;
	transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.icon-button:hover,
.text-button:hover,
.tab-buttons button:hover {
	background: rgba(35, 51, 75, 0.98);
	border-color: rgba(92, 200, 255, 0.45);
}

.icon-button:active,
.text-button:active,
.tab-buttons button:active {
	transform: translateY(1px);
}

.icon-button {
	width: 40px;
	font-size: 13px;
	line-height: 1;
}

.text-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 14px;
	text-decoration: none;
	white-space: nowrap;
}

.text-button.subtle {
	color: var(--muted);
}

.filter-grid {
	display: grid;
	grid-template-columns: repeat(5, minmax(190px, 1fr));
	gap: 12px;
	margin-bottom: 14px;
}

.filter-card {
	display: grid;
	gap: 10px;
	padding: 13px;
	background: rgba(18, 27, 42, 0.84);
	border: 1px solid var(--line);
	border-radius: 8px;
	box-shadow: var(--shadow);
	min-width: 0;
}

.filter-heading {
	display: grid;
	gap: 2px;
	min-height: 42px;
}

.filter-heading strong {
	font-size: 13px;
}

.filter-heading span,
.date-card span,
.filter-card label > span,
.kpi-grid span,
.panel-heading span {
	color: var(--muted);
	font-size: 11px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0;
}

.filter-card label,
.date-card label {
	display: grid;
	gap: 5px;
	min-width: 0;
}

.date-card label {
	width: 170px;
}

input,
select {
	width: 100%;
	border: 1px solid var(--line-strong);
	border-radius: 7px;
	background: #0b1220;
	color: var(--ink);
	outline: none;
}

input {
	min-height: 38px;
	padding: 0 10px;
	color-scheme: dark;
}

select {
	padding: 7px;
	min-height: 138px;
	scrollbar-color: var(--soft) #0b1220;
}

select option {
	padding: 5px 6px;
	border-radius: 4px;
}

select option:checked {
	background: linear-gradient(90deg, rgba(92, 200, 255, .95), rgba(123, 216, 143, .86));
	color: #07101b;
}

.status-line {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	color: var(--muted);
	min-height: 24px;
	margin-bottom: 12px;
}

.kpi-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
	margin-bottom: 12px;
}

.kpi-grid article,
.panel,
.table-tabs {
	background: rgba(18, 27, 42, 0.88);
	border: 1px solid var(--line);
	border-radius: 8px;
	box-shadow: var(--shadow);
}

.kpi-grid article {
	position: relative;
	padding: 16px;
	display: grid;
	gap: 5px;
	min-height: 112px;
	overflow: hidden;
}

.kpi-grid article::before {
	content: "";
	position: absolute;
	inset: 0;
	border-top: 2px solid rgba(92, 200, 255, 0.52);
	pointer-events: none;
}

.kpi-grid article:nth-child(2)::before {
	border-top-color: rgba(123, 216, 143, 0.62);
}

.kpi-grid article:nth-child(3)::before {
	border-top-color: rgba(255, 209, 102, 0.72);
}

.kpi-grid article:nth-child(4)::before {
	border-top-color: rgba(239, 118, 122, 0.72);
}

.kpi-grid strong {
	font-size: 31px;
	line-height: 1.1;
}

.kpi-grid small {
	color: var(--muted);
}

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

.panel {
	min-height: 360px;
	padding: 14px;
	display: grid;
	grid-template-rows: auto minmax(260px, 1fr);
}

.panel.wide {
	grid-column: span 2;
}

.panel-heading {
	display: flex;
	align-items: start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
}

.segmented-control {
	display: inline-flex;
	padding: 3px;
	background: rgba(9, 15, 25, .78);
	border: 1px solid var(--line);
	border-radius: 8px;
	gap: 2px;
	flex-shrink: 0;
}

.segmented-control button {
	height: 28px;
	padding: 0 9px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--muted);
	font-size: 11px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0;
	cursor: pointer;
}

.segmented-control button.active {
	background: rgba(92, 200, 255, .18);
	color: var(--blue);
}

.chart-wrap {
	position: relative;
	min-height: 260px;
}

.table-tabs {
	margin-top: 12px;
	overflow: hidden;
}

.tab-buttons {
	display: flex;
	gap: 8px;
	padding: 10px;
	border-bottom: 1px solid var(--line);
	overflow-x: auto;
}

.tab-buttons button {
	padding: 0 14px;
}

.tab-buttons button.active {
	background: linear-gradient(135deg, rgba(92, 200, 255, .92), rgba(123, 216, 143, .78));
	border-color: transparent;
	color: #07101b;
}

.table-panel {
	display: none;
	overflow: auto;
	max-height: 620px;
	scrollbar-color: var(--soft) #0b1220;
}

.table-panel.active {
	display: block;
}

table {
	width: 100%;
	border-collapse: collapse;
	min-width: 1080px;
}

th,
td {
	padding: 11px 12px;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: top;
}

th {
	position: sticky;
	top: 0;
	background: #101a29;
	z-index: 2;
	color: var(--muted);
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0;
}

th button {
	display: inline-flex;
	align-items: center;
	justify-content: flex-start;
	gap: 6px;
	width: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: inherit;
	text-transform: inherit;
	letter-spacing: inherit;
	cursor: pointer;
}

th.number button {
	justify-content: flex-end;
}

.sort-indicator {
	color: var(--soft);
	font-size: 12px;
	line-height: 1;
}

th[aria-sort="ascending"] .sort-indicator,
th[aria-sort="descending"] .sort-indicator {
	color: var(--blue);
}

td {
	color: #dce7f5;
}

td.number,
th.number {
	text-align: right;
}

a {
	color: var(--blue);
}

.pill {
	display: inline-flex;
	align-items: center;
	border-radius: 999px;
	padding: 3px 8px;
	background: rgba(92, 200, 255, .13);
	color: var(--blue);
	font-size: 12px;
	font-weight: 800;
	white-space: nowrap;
}

.negative {
	color: var(--red);
}

.positive {
	color: var(--green);
}

.empty-state,
.error-state {
	padding: 24px;
	color: var(--muted);
}

.error-state {
	margin-bottom: 12px;
	background: rgba(239, 118, 122, 0.12);
	border: 1px solid rgba(239, 118, 122, 0.36);
	border-radius: 8px;
	color: #ffc2c4;
}

@media (max-width: 1420px) {
	.filter-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 1200px) {
	.dashboard-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 820px) {
	.app-header,
	.toolbar {
		align-items: flex-start;
		position: static;
	}

	.app-header,
	.toolbar,
	.date-card {
		flex-wrap: wrap;
	}

	.date-card label {
		width: min(100%, 180px);
	}

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

	.panel.wide {
		grid-column: span 1;
	}

	.status-line,
	.panel-heading {
		display: grid;
	}
}
