/* NAS-Monitor — mobile-first, light + dark. Chart colours follow the dataviz palette. */
:root {
	color-scheme: light dark;
	--bg: #f3f5f6;
	--surface: #ffffff;
	--surface-2: #f6f8f9;
	--fg: #191919;
	--muted: #666666;
	--line: #e3e7ea;
	--accent: #0e7490;
	--accent-2: #155e75;
	--accent-soft: rgba(14, 116, 144, 0.1);
	--danger: #dc3c3d;
	/* dataviz */
	--series-1: #257de0;
	--series-2: #f47230;
	--grid: #e7e7e7;
	--axis: #c2c2c2;
	--good: #0aac23;
	--warning: #fbb315;
	--serious: #f18a59;
	--critical: #dc3c3d;
	--info: #257de0;
	--track: #eceff1;
	--shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
	--radius: 20px;
	--radius-sm: 13px;
	--font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--nav-h: 4.25rem;
}
@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0f1112;
		--surface: #191919;
		--surface-2: #121414;
		--fg: #efefef;
		--muted: #9c9c9c;
		--line: #2a2d2f;
		--accent: #22b8d6;
		--accent-2: #0e7490;
		--accent-soft: rgba(34, 184, 214, 0.15);
		--danger: #f06a6b;
		--series-1: #338ced;
		--series-2: #e76624;
		--grid: #303030;
		--axis: #474747;
		--info: #338ced;
		--track: #2a2d2f;
		--shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
	}
}
* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--fg); font-family: var(--font); line-height: 1.5;
	-webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
button, input { font: inherit; }

.shell { max-width: 44rem; margin: 0 auto; padding: max(1.1rem, env(safe-area-inset-top)) 1rem calc(var(--nav-h) + 2rem + env(safe-area-inset-bottom)); }
.shell.auth { padding-bottom: 2rem; padding-top: max(3rem, env(safe-area-inset-top)); }
main { display: flex; flex-direction: column; gap: 0.9rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }

.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: 0.25rem 0 1rem; }
h1 { margin: 0; font-size: clamp(1.7rem, 6vw, 2.1rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.15; }
h2 { margin: 0 0 0.6rem; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
h3 { margin: 0.9rem 0 0.2rem; font-size: 0.8rem; font-weight: 650; color: var(--muted); }
.eyebrow { margin: 0 0 0.1rem; font-weight: 700; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.hint { margin: 0; color: var(--muted); font-size: 0.88rem; }
.hint.foot { text-align: center; font-size: 0.78rem; margin-top: 0.4rem; }
.muted { color: var(--muted); font-weight: 500; }
.ok { margin: 0; color: var(--good); font-weight: 600; }
small { font-size: 0.8rem; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.05rem; box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.2rem; }
.card-head h2 { margin: 0; }

/* buttons + forms (auth screen) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 2.9rem; padding: 0.6rem 1.15rem;
	border: 1px solid transparent; border-radius: var(--radius-sm); background: linear-gradient(135deg, var(--accent), var(--accent-2));
	color: #fff; font-weight: 650; cursor: pointer; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-secondary { background: var(--surface-2); color: var(--fg); border-color: var(--line); }
.btn-small { min-height: 2.3rem; padding: 0.35rem 0.85rem; font-size: 0.85rem; }
.btn:focus-visible, .tab:focus-visible, .input:focus-visible, .segmented button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.input { width: 100%; min-height: 2.9rem; padding: 0.6rem 0.85rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
	background: var(--surface-2); color: var(--fg); font-weight: 500; }
.input:focus { border-color: var(--accent); outline: none; }
.link-btn { align-self: center; border: 0; background: none; padding: 0.25rem; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.confirm-box { padding: 0.9rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.auth-logo { display: grid; place-items: center; width: 4rem; height: 4rem; margin-bottom: 1rem; border-radius: 20px; color: #fff;
	background: linear-gradient(145deg, #0891b2, #155e75); box-shadow: 0 18px 40px -12px rgba(14, 116, 144, 0.5); }

/* states */
.loading { display: flex; align-items: center; gap: 0.6rem; padding: 1.5rem 0; color: var(--muted); }
.spinner { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 2rem 0; }
.empty-title { margin: 0; font-weight: 650; color: var(--muted); }
.alert { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.7rem 0.9rem; border-radius: var(--radius-sm);
	background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); font-weight: 500; font-size: 0.9rem; }
.alert .btn { min-height: 2.25rem; }

/* status (always icon + label) */
.status-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.6rem; }
.status-row, .summary { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.6rem 0.8rem; border-radius: var(--radius-sm);
	background: var(--surface-2); border: 1px solid var(--line); font-size: 0.9rem; }
.summary { background: var(--surface); box-shadow: var(--shadow); padding: 0.8rem 0.95rem; }
.status-row svg, .summary svg { flex: none; margin-top: 0.12rem; }
.status-icon circle { fill: var(--muted); }
.status-icon.ok circle { fill: var(--good); }
.status-icon.warning circle { fill: var(--warning); }
.status-icon.critical circle { fill: var(--critical); }
.status-icon.info circle { fill: var(--info); }
.status-icon.warning path { stroke: #191919; }
.summary.critical, .status-row.critical { border-color: color-mix(in srgb, var(--critical) 45%, var(--line)); }
.summary.warning, .status-row.warning { border-color: color-mix(in srgb, var(--warning) 55%, var(--line)); }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
@media (min-width: 40rem) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 0.9rem 0.6rem; box-shadow: var(--shadow); min-width: 0; }
.tile-label { font-size: 0.75rem; font-weight: 650; color: var(--muted); }
.tile-value { font-size: 1.45rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.25; white-space: nowrap; }
.tile-sub { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spark { display: block; width: 100%; height: 28px; margin-top: 0.35rem; }

/* segmented range picker */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.segmented button { border: 0; background: none; color: var(--muted); font-size: 0.78rem; font-weight: 650; padding: 0.3rem 0.6rem; border-radius: 8px; cursor: pointer; min-height: 2rem; }
.segmented button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

/* charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 10.5px; }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.legend { display: flex; flex-wrap: wrap; gap: 0.9rem; font-size: 0.78rem; color: var(--muted); margin: 0.1rem 0 0.2rem; }
.legend span, .tooltip span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend i, .tooltip i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.tooltip { position: absolute; top: 1.4rem; width: 150px; pointer-events: none; display: flex; flex-direction: column; gap: 0.1rem;
	padding: 0.45rem 0.6rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 0.75rem; }
.chart-empty { padding: 1rem 0; }

/* meters */
.meter { margin: 0.6rem 0 0.9rem; }
.meter-head { display: flex; justify-content: space-between; gap: 0.75rem; font-size: 0.9rem; }
.meter-name { font-weight: 650; }
.meter-fig { font-weight: 600; }
.meter-track { height: 10px; border-radius: 5px; background: var(--track); overflow: hidden; margin: 0.35rem 0 0.25rem; }
.meter-fill { height: 100%; border-radius: 5px; background: var(--series-1); transition: width 0.4s ease; }
.meter-fill.warning { background: var(--warning); }
.meter-fill.critical { background: var(--critical); }
.meter-sub { font-size: 0.78rem; color: var(--muted); }

/* list rows */
.rows { display: flex; flex-direction: column; }
.rows .row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.6rem 0; border-top: 1px solid var(--line); font-size: 0.9rem; line-height: 1.35; }
.rows .row:first-child { border-top: 0; }
.row-right { display: inline-flex; gap: 0.35rem; flex: none; }
.pill { flex: none; display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 650;
	background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.ok::before { background: var(--good); }
.pill.warning::before { background: var(--warning); }
.pill.critical::before { background: var(--critical); }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem; margin: 0; font-size: 0.9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 550; }

/* bottom tabs */
.tabs { position: fixed; left: 50%; bottom: calc(0.75rem + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(28rem, calc(100% - 1.5rem));
	height: var(--nav-h); z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.25rem; padding: 0.4rem; border-radius: 24px;
	background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
	border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,0.15); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem; border: 0; border-radius: 18px;
	background: transparent; color: var(--muted); font-size: 0.72rem; font-weight: 650; cursor: pointer; }
.tab.active { background: var(--accent-soft); color: var(--accent); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.status-row.ok, .summary.ok { color: var(--fg); }
