/* ── Reset & base ── */
*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

:root {
	--bg: #0d0f14;
	--surface: #161a22;
	--border: #252b38;
	--text: #e8eaf0;
	--muted: #6b7280;
	--green: #22c55e;
	--green-bg: #14532d22;
	--orange: #d57359;
	--orange-bg: #7c2d1222;
	--red: #ef4444;
	--red-bg: #7f1d1d22;
	--accent: #6366f1;
	--radius: 14px;
	--font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	min-height: 100vh;
	display: flex;
	justify-content: center;
	padding: 32px 16px 48px;
}

.app {
	width: 100%;
	max-width: 760px;
	display: flex;
	flex-direction: column;
	gap: 24px;
}

/* ── Header ── */
header {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.header-left {
	display: flex;
	align-items: center;
	gap: 10px;
}

.logo {
	color: var(--orange);
	font-size: 22px;
}

h1 {
	font-size: 20px;
	font-weight: 600;
	letter-spacing: -0.3px;
}

.header-right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
}

.updated {
	font-size: 11px;
	color: var(--muted);
	opacity: 0.6;
}

.clock {
	font-size: 13px;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

/* ── Error banner ── */
.banner {
	border-radius: 10px;
	padding: 10px 16px;
	font-size: 13px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.banner[hidden] {
	display: none;
}

.banner.error {
	background: var(--red-bg);
	border: 1px solid var(--red);
	color: var(--red);
}

.banner-link {
	color: var(--red);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.banner-link:hover {
	text-decoration: underline;
}

/* ── Cards ── */
main {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 22px 24px;
	display: flex;
	flex-direction: column;
	gap: 18px;
	transition: border-color 0.3s;
}

.card.green {
	border-color: var(--green);
	background: color-mix(in srgb, var(--surface) 85%, var(--green));
}
.card.orange {
	border-color: var(--orange);
	background: color-mix(in srgb, var(--surface) 85%, var(--orange));
}
.card.red {
	border-color: var(--red);
	background: color-mix(in srgb, var(--surface) 85%, var(--red));
}

/* card header */
.card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.card-title {
	display: flex;
	align-items: center;
	gap: 8px;
}

.card-icon {
	font-size: 18px;
}

h2 {
	font-size: 15px;
	font-weight: 600;
	letter-spacing: -0.2px;
}

/* status badge */
.status-badge {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	padding: 3px 10px;
	border-radius: 99px;
	background: var(--border);
	color: var(--muted);
	transition: all 0.3s;
}

.status-badge.green {
	background: var(--green-bg);
	color: var(--green);
}
.status-badge.orange {
	background: var(--orange-bg);
	color: var(--orange);
}
.status-badge.red {
	background: var(--red-bg);
	color: var(--red);
}

/* ── Inputs ── */
.usage-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.usage-input-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--muted);
}

input[type="number"],
input[type="datetime-local"] {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 8px;
	color: var(--text);
	font-family: var(--font);
	font-size: 14px;
	padding: 8px 12px;
	width: 100%;
	outline: none;
	transition: border-color 0.2s;
	color-scheme: dark;
}

input:focus {
	border-color: var(--accent);
}

.input-with-unit {
	display: flex;
	align-items: center;
	gap: 0;
	position: relative;
}

.input-with-unit input {
	padding-right: 32px;
}

.input-with-unit span {
	position: absolute;
	right: 12px;
	color: var(--muted);
	font-size: 13px;
	pointer-events: none;
}

/* ── Progress bar ── */
.bar-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
}

.bar-track {
	flex: 1;
	height: 10px;
	background: var(--bg);
	border-radius: 99px;
	overflow: visible;
	position: relative;
}

.bar-fill {
	height: 100%;
	border-radius: 99px;
	width: 0%;
	transition:
		width 0.5s ease,
		background-color 0.3s;
	background: var(--accent);
	max-width: 100%;
}

.bar-fill.green {
	background: var(--green);
}
.bar-fill.orange {
	background: var(--orange);
}
.bar-fill.red {
	background: var(--red);
}

/* expected usage marker */
.bar-expected {
	position: absolute;
	top: -4px;
	width: 2px;
	height: 18px;
	background: var(--muted);
	border-radius: 2px;
	opacity: 0.6;
	transform: translateX(-50%);
	transition: left 0.5s ease;
}

.bar-pct {
	font-size: 13px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	width: 38px;
	text-align: right;
	color: var(--muted);
}

/* ── Pace info row ── */
.pace-info {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
}

.pace-item {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 10px 14px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.pace-label {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--muted);
}

.pace-value {
	font-size: 15px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.pace-value.green {
	color: var(--green);
}
.pace-value.orange {
	color: var(--orange);
}
.pace-value.red {
	color: var(--red);
}

/* ── Footer text ── */
.card-footer {
	font-size: 12px;
	color: var(--muted);
	line-height: 1.5;
	padding-top: 2px;
	border-top: 1px solid var(--border);
}

/* ── App footer ── */
.app-footer {
	font-size: 12px;
	color: var(--muted);
	text-align: center;
}

.link-btn {
	background: none;
	border: none;
	color: var(--muted);
	cursor: pointer;
	font-size: 12px;
	text-decoration: underline;
	padding: 0;
	transition: color 0.2s;
}

.link-btn:hover {
	color: var(--text);
}

/* ── Session help ── */
.session-help {
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 10px 16px;
	font-size: 12px;
	color: var(--muted);
}

.session-help summary {
	cursor: pointer;
	user-select: none;
	color: var(--muted);
	list-style: none;
}

.session-help ol {
	margin-top: 12px;
	padding-left: 18px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	line-height: 1.5;
}

.session-help a {
	color: var(--accent);
	text-decoration: none;
}

.session-help a:hover {
	text-decoration: underline;
}

.session-help code,
.session-help kbd {
	background: var(--border);
	border-radius: 4px;
	padding: 1px 5px;
	font-size: 11px;
	font-family: monospace;
}

/* ── Responsive ── */
@media (max-width: 480px) {
	.usage-row {
		grid-template-columns: 1fr;
	}
	.pace-info {
		grid-template-columns: 1fr;
	}
	body {
		padding: 20px 12px 40px;
	}
	.card {
		padding: 18px 16px;
	}
}
