/* Life Circle — a calm dashboard, dark by design.
   Chart ink and grid live here; the eight categorical series colours live in
   js/app.mjs (SERIES), because the charts hand them to marks one entity at a
   time. They are the house palette's dark steps, validated against this card
   surface (#171b22) for lightness band, chroma, colour-vision separation and
   contrast, and are assigned in fixed order — never cycled. */

:root {
	--plane: #0f1115;      /* page */
	--surface: #171b22;    /* card / chart surface */
	--surface-2: #1e232b;  /* inputs, wells */
	--line: #2a3038;       /* hairline border */
	--grid: #262c36;       /* chart gridline */
	--axis: #333b46;       /* chart baseline */
	--text: #e6e9ef;       /* primary ink */
	--text-2: #a9b2c4;     /* secondary ink */
	--muted: #7f8798;      /* axis labels, hints */
	--accent: #3987e5;
	--good: #0ca30c;
	--bad: #d03b3b;

	color-scheme: dark;
}

* { box-sizing: border-box; }

/* An author display rule beats the UA's [hidden] { display: none }, so anything
   both flexed and toggled with `hidden` would never hide again. */
[hidden] { display: none !important; }

body {
	margin: 0;
	min-height: 100vh;
	background: var(--plane);
	color: var(--text);
	font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ------------------------------------------------------------- chrome --- */

.topbar {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
	padding: 18px 22px 14px;
	border-bottom: 1px solid var(--line);
	position: sticky;
	top: 0;
	background: color-mix(in srgb, var(--plane) 92%, transparent);
	backdrop-filter: blur(8px);
	z-index: 5;
}

h1 { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
h1 .suite {
	display: inline-block;
	margin-left: 8px;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--muted);
	vertical-align: 2px;
}

.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tabs button {
	background: none;
	border: none;
	color: var(--text-2);
	padding: 6px 12px;
	border-radius: 8px;
}
.tabs button:hover { background: var(--surface-2); color: var(--text); }
.tabs button[aria-current="page"] { background: var(--surface-2); color: var(--text); font-weight: 600; }

#new-snapshot { margin-left: auto; }

main { padding: 20px 22px 56px; max-width: 1180px; margin: 0 auto; }

.account {
	color: var(--muted);
	font-size: 12px;
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 3px 11px;
	margin-left: auto;
}
.account + #new-snapshot { margin-left: 12px; }

.offer {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin: 14px 22px 0;
	padding: 10px 14px;
	border-radius: 10px;
	border: 1px solid #2a3a4a;
	background: #16202b;
	font-size: 14px;
}

.error {
	margin: 14px 22px 0;
	padding: 10px 14px;
	border-radius: 10px;
	border: 1px solid #40302c;
	background: #241a19;
	color: #f0b8ae;
}
/* The same strip, when what it has to say is good news. */
.error.good { border-color: #234a2c; background: #16241a; color: #a9dcb2; }

/* ------------------------------------------------------------ controls --- */

input:not([type="radio"], [type="checkbox"], [type="range"]), select, textarea, button {
	font: inherit;
	color: inherit;
	border-radius: 8px;
	border: 1px solid var(--line);
	background: var(--surface-2);
	padding: 7px 11px;
}
textarea { resize: vertical; width: 100%; }
button { cursor: pointer; }
button:hover { background: #262c36; }
button.primary { background: var(--accent); border-color: var(--accent); color: #08101d; font-weight: 600; }
button.primary:hover { background: #5199ea; }
button.danger { color: #f19a92; border-color: #40302c; background: none; }
button.danger:hover { background: #2a1c1a; }
button.icon { padding: 4px 10px; color: var(--text-2); line-height: 1.2; }
button.link { background: none; border: none; color: var(--muted); text-decoration: underline; padding: 2px 4px; }
button.link:hover { color: var(--text); background: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hint { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.eyebrow {
	display: block;
	font-size: 11px;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--muted);
}

/* --------------------------------------------------------------- cards --- */

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 14px;
	padding: 18px;
}

.split {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
	gap: 18px;
	align-items: start;
}

.card-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	margin-bottom: 10px;
}
.card-head h2 { font-size: 20px; margin: 2px 0 0; font-weight: 600; letter-spacing: -.01em; }
.side-title { font-size: 15px; margin: 0 0 10px; font-weight: 600; }

.picker { display: flex; align-items: center; gap: 6px; }
.picker select { max-width: 190px; }

/* --------------------------------------------------------------- charts --- */

.chart-host { position: relative; }
svg.radar { width: 100%; height: auto; display: block; overflow: visible; }
svg.trend { width: 100%; display: block; }
.chart-host.wide { margin: 4px 0 6px; }

/* A wash, not a block: the bands have to sit behind the shape without competing
   with it. The dots carry the same reading at full strength. */
.radar-zones .zone { fill-opacity: .09; }

.radar-grid .ring { fill: none; stroke: var(--grid); stroke-width: 1; }
.radar-grid .ring-outer { stroke: var(--axis); }
.radar-grid .spoke { stroke: var(--grid); stroke-width: 1; }
.radar-grid .spoke-on { stroke: var(--muted); }
.radar-grid .ring-label { fill: var(--muted); font-size: 9.5px; font-variant-numeric: tabular-nums; }

.radar-series .area { fill-opacity: .07; stroke-width: 2; stroke-linejoin: round; }
.radar-series .area-open { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
/* The 2px ring in the surface colour keeps overlapping dots legible. */
.radar-series .dot { stroke: var(--surface); stroke-width: 2; }

.axis-hit { cursor: pointer; }
.axis-hit .axis-target { stroke: transparent; stroke-width: 26; }
.axis-hit .axis-label { fill: var(--text-2); font-size: 12px; }
.axis-hit:hover .axis-label, .axis-hit:focus .axis-label { fill: var(--text); }
.axis-hit.on .axis-label { fill: var(--text); font-weight: 600; }
.axis-hit:focus { outline: none; }
.axis-hit:focus-visible .axis-label { text-decoration: underline; }

.trend-grid .grid { stroke: var(--grid); stroke-width: 1; }
.trend-grid .axis { stroke: var(--axis); stroke-width: 1; }
.trend-grid .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.trend-series .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-series .dot, .trend-highlight .dot { stroke: var(--surface); stroke-width: 2; }
.trend-series .end-label { fill: var(--text-2); font-size: 12px; }
.crosshair { stroke: var(--axis); stroke-width: 1; }
svg.trend:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tip {
	position: absolute;
	pointer-events: none;
	background: var(--surface-2);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 8px 10px;
	font-size: 13px;
	min-width: 120px;
	box-shadow: 0 8px 24px rgb(0 0 0 / .45);
	z-index: 3;
}
.tip-title { color: var(--muted); font-size: 11.5px; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.tip-row b { font-variant-numeric: tabular-nums; }
.tip-key { width: 12px; height: 2px; border-radius: 2px; flex: none; }
.tip-label { color: var(--text-2); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 0 2px; }
.legend .item { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 13px; }
.legend .key { width: 14px; height: 2px; border-radius: 2px; flex: none; }
.legend .key.area { height: 10px; border-radius: 3px; opacity: .85; }

/* The score bands, spelled out under the entry wheel. */
.legend.bands { justify-content: center; gap: 6px 18px; margin: 2px 0 12px; }
.legend.bands .key { width: 10px; height: 10px; border-radius: 3px; }
.legend.bands b { font-variant-numeric: tabular-nums; font-weight: 600; }
.legend.bands .item { gap: 6px; font-size: 12.5px; }

/* ---------------------------------------------------------------- side --- */

.hero { margin-bottom: 14px; }
.hero-value { font-size: 48px; font-weight: 600; line-height: 1.05; letter-spacing: -.02em; }
.delta { margin-left: 8px; font-size: 14px; color: var(--text-2); }
.delta.up { color: #46c246; }
.delta.down { color: #ef7a7a; }

.scores { list-style: none; margin: 0; padding: 0; }
.scores li + li { border-top: 1px solid var(--line); }
.scores button.score-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 56px 26px 22px;
	align-items: center;
	gap: 10px;
	width: 100%;
	text-align: left;
	background: none;
	border: none;
	border-radius: 0;
	padding: 9px 4px;
}
.scores button.score-row:hover { background: var(--surface-2); }
.scores li.on button.score-row { background: var(--surface-2); }
.scores .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scores .name .archived { color: var(--muted); font-size: 11px; margin-left: 6px; }
.scores .meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.scores .meter span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.scores .value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.scores .value.none { color: var(--muted); }
/* Direction is the glyph, not a colour: the meter beside it is already saying
   something in red, amber and green, and one row cannot carry two colour
   meanings without one of them being read wrong. */
.scores .move { text-align: right; color: var(--text-2); font-size: 12px; }
.scores .move.flat { color: var(--muted); }
.scores .note.trend { padding-top: 0; color: var(--muted); font-size: 12.5px; }
.scores .note {
	padding: 0 4px 10px 4px;
	color: var(--text-2);
	font-size: 13.5px;
	white-space: pre-wrap;
}
.scores .note.empty { color: var(--muted); font-style: italic; }

.general-note {
	margin-top: 14px;
	padding: 12px 14px;
	border-radius: 10px;
	background: var(--surface-2);
	color: var(--text-2);
	font-size: 14px;
	white-space: pre-wrap;
}
.actions { display: flex; gap: 8px; margin-top: 16px; }

/* --------------------------------------------------------------- chips --- */

.filterbar {
	display: flex;
	align-items: center;
	gap: 10px 14px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}
.filter-label { color: var(--muted); font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	border: 1px solid var(--line);
	background: var(--surface);
	color: var(--text-2);
	border-radius: 999px;
	padding: 5px 12px;
	font-size: 13px;
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { color: var(--text); border-color: var(--muted); background: var(--surface-2); }
.chip .key { width: 10px; height: 10px; border-radius: 50%; flex: none; opacity: 0; }
.chip[aria-pressed="true"] .key { opacity: 1; }
.chip[disabled] { opacity: .45; cursor: not-allowed; }

/* -------------------------------------------------------------- tables --- */

.scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); }
table.grid th { color: var(--muted); font-weight: 500; font-size: 12.5px; white-space: nowrap; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tbody tr:hover { background: var(--surface-2); }
/* The direction someone recorded, beside the score it belongs to. Muted, and a
   glyph rather than a colour: the Change column next to it is already coloured,
   and it means something else. */
table.grid .move { color: var(--muted); font-size: 11px; margin-left: 5px; }
table.grid .up { color: #46c246; }
table.grid .down { color: #ef7a7a; }
table.grid .flat, table.grid .none { color: var(--muted); }
table.grid td.date { white-space: nowrap; }

.table-view { margin-top: 8px; }
.table-view summary { color: var(--muted); font-size: 13px; cursor: pointer; padding: 4px 0; }
.table-view[open] summary { margin-bottom: 6px; }

.sparks { display: flex; align-items: flex-end; gap: 3px; height: 26px; }
.sparks span { width: 7px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .8; min-height: 2px; }
.sparks span.none { background: var(--axis); height: 2px !important; }

/* ------------------------------------------------------------- domains --- */

.domains { list-style: none; margin: 12px 0 0; padding: 0; }
.domains li {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 0;
	border-top: 1px solid var(--line);
	flex-wrap: wrap;
}
.domains input[name="name"] { flex: 1 1 180px; min-width: 140px; }
.domains li.archived input[name="name"] { color: var(--muted); }
.domains .usage { color: var(--muted); font-size: 12px; white-space: nowrap; }
.add-domain { display: flex; gap: 8px; margin-top: 16px; }
.add-domain input { flex: 1 1 auto; }

/* -------------------------------------------------------------- editor --- */

dialog {
	border: 1px solid var(--line);
	border-radius: 16px;
	background: var(--surface);
	color: var(--text);
	padding: 20px;
	width: min(600px, calc(100vw - 24px));
	max-height: calc(100vh - 40px);
	overflow-y: auto;
}
dialog::backdrop { background: rgb(0 0 0 / .6); }
.editor-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.editor-head h2 { font-size: 18px; margin: 0; }
.date-field, .note-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.note-field { margin-top: 14px; }
.date-field input { color: var(--text); }

.conflict {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin: 14px 0 0;
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid #4a3f24;
	background: #241f14;
	font-size: 13.5px;
}

/* --- the wheel you fill in --- */

.dial-host { margin: 14px 0 4px; }
svg.dial {
	width: 100%;
	height: auto;
	display: block;
	overflow: visible;
	/* Without this a drag on the wheel scrolls the dialog instead of moving the
	   score, which on a phone makes the whole interaction impossible. */
	touch-action: none;
}

.dial-grid .rim { fill: none; stroke: var(--axis); stroke-width: 1; }
.dial-grid .ring { fill: none; stroke: var(--grid); stroke-width: 1; }
.dial-grid .ring-mark { stroke: var(--muted); }

/* Opaque enough for the hue to be unmistakable, held back from full strength so
   nine saturated wedges stay calm — and capped where they are because the score
   is written on the wedge in white, which needs the fill to stay dark enough to
   clear 3:1 against it. */
.dial-fill .slice { fill-opacity: .58; }
.dial-fill .slice.on { fill-opacity: .7; }
.dial-fill .slice-empty { fill: var(--text); fill-opacity: .05; }
.dial-fill .slice-empty.on { fill-opacity: .09; }
/* The 2px gap between neighbouring slices is the surface showing through, not a
   stroke around the paint. */
.dial-spokes .spoke { stroke: var(--surface); stroke-width: 2; }

.hub { fill: var(--surface-2); stroke: var(--line); stroke-width: 1; }
.hub-label { fill: var(--muted); font-size: 11px; }

.wedge { cursor: pointer; }
.wedge .wedge-target { fill: transparent; }
.wedge .wedge-label { fill: var(--text-2); font-size: 12px; }
.wedge:hover .wedge-label { fill: var(--text); }
.wedge.on .wedge-label { fill: var(--text); font-weight: 600; }
/* A label inside a filled mark is the one place text may leave the ink tokens:
   white clears the fill at every score. */
.wedge .wedge-value { fill: #fff; fill-opacity: .92; font-size: 12px; font-weight: 600; }
.wedge .wedge-value .move { font-size: 9px; }
.wedge:focus { outline: none; }
.wedge:focus-visible .wedge-target { fill: rgb(255 255 255 / .06); stroke: var(--accent); stroke-width: 2; }

.detail { min-height: 46px; }
.detail-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto auto;
	align-items: center;
	gap: 8px 12px;
	padding: 10px 12px;
	border-radius: 10px;
	background: var(--surface-2);
}
.detail-name { font-size: 15px; font-weight: 600; }
.detail-name small { color: var(--muted); font-size: 11px; font-weight: 400; margin-left: 6px; }
.detail-score { font-size: 22px; font-variant-numeric: tabular-nums; }
.detail-row .note-input { grid-column: 1 / -1; padding: 6px 10px; font-size: 13.5px; }

/* Three buttons rather than a select: it is one tap, and all three states are
   visible at once so "steady" reads as a thing you said, not as a default. */
.trend-pick { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.trend-pick button {
	padding: 4px 10px;
	font-size: 12.5px;
	color: var(--text-2);
	background: var(--surface);
	border-radius: 999px;
}
.trend-pick button:hover { background: #262c36; color: var(--text); }
.trend-pick button[aria-pressed="true"] {
	color: var(--text);
	border-color: var(--muted);
	background: #262c36;
	font-weight: 600;
}
.detail-row .note-input::placeholder { color: #5d6577; }

dialog menu { display: flex; align-items: center; gap: 8px; margin: 18px 0 0; padding: 0; }
.spacer { flex: 1; }

/* --------------------------------------------------------------- empty --- */

.empty { text-align: center; padding: 40px 24px; }
.empty h2 { font-size: 17px; margin: 0 0 8px; }
.empty p { color: var(--text-2); margin: 0 auto 16px; max-width: 46ch; }
.empty-inline { color: var(--muted); text-align: center; padding: 22px 0 6px; margin: 0; }

/* -------------------------------------------------------------- narrow --- */

@media (max-width: 860px) {
	.split { grid-template-columns: minmax(0, 1fr); }
	main { padding: 16px 14px 48px; }
	.topbar { padding: 14px 14px 10px; gap: 10px 12px; }
	h1 { width: 100%; }
	#new-snapshot { margin-left: auto; }
	.hero-value { font-size: 40px; }
	.picker select { max-width: 150px; }
}
