/* panadura.city ops dashboard. Tokens follow the app's DESIGN.md. */
@font-face {
	font-family: Manrope;
	src: url('manrope.woff2') format('woff2');
	font-weight: 200 800;
	font-display: swap;
}

:root {
	--teal: #006d77;
	--aqua: #00a6a6;
	--sand: #f4a261;
	--ink: #173042;
	--page: #f7fafa;
	--surface: #ffffff;
	--line: #dce5e8;
	--muted: #4b5f6b;
	--track: #dce5e8;
	--bar: #00a6a6;
	--ok: #1f7a70;
	--ok-dot: #2a9d8f;
	--bad: #c42833;
	--bad-dot: #e63946;
	--caution: #9a4a15;
	--link: #006d77;
	--btn: #006d77;
	--on-btn: #ffffff;
	--shadow: 0 12px 30px -12px rgb(23 48 66 / 0.25);
	--map-bg: #eef4f5;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root {
		--ink: #f7fafa;
		--page: #0e1f2b;
		--surface: #173042;
		--line: #25465a;
		--muted: #9db0b9;
		--track: #25465a;
		--bar: #00a6a6;
		--ok: #4fd1c1;
		--ok-dot: #2a9d8f;
		--bad: #ff7a83;
		--caution: #f4a261;
		--link: #00a6a6;
		--btn: #006d77;
		--shadow: none;
		--map-bg: #0e1f2b;
		color-scheme: dark;
	}
}

* {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--page);
	color: var(--ink);
	font: 400 16px/1.5 Manrope, system-ui, sans-serif;
	font-variant-numeric: tabular-nums;
}

.wrap {
	max-width: 1080px;
	margin: 0 auto;
	padding: 16px 16px 48px;
}

@media (min-width: 600px) {
	.wrap {
		padding: 24px 24px 48px;
	}
}

.icon {
	width: 20px;
	height: 20px;
	flex: none;
}

/* Header */
.top {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 12px;
	margin-bottom: 16px;
}

.ghost {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 14px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--surface);
	color: var(--ink);
	font: 600 14px Manrope, system-ui, sans-serif;
	cursor: pointer;
}

.ghost:hover {
	border-color: var(--muted);
}

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

.sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

h2 {
	margin: 0 0 12px;
	font-size: 16px;
	font-weight: 800;
	letter-spacing: -0.01em;
}

/* Live panel: deep blue in both themes, so the route colours carry the page */
.live {
	--ink: #f7fafa;
	--muted: #9db0b9;
	--line: #25465a;
	--surface: #1f3d52;
	--map-bg: #0e1f2b;
	--ok: #4fd1c1;
	--bad: #ff7a83;
	--link: #00a6a6;
	color-scheme: dark;
	padding: 20px;
	border-radius: 28px;
	background: #173042;
	color: var(--ink);
}

.live-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px 32px;
	margin-bottom: 16px;
}

.today {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 32px;
	margin: 0;
}

.today div {
	display: flex;
	flex-direction: column-reverse;
}

.today dt {
	font-size: 12px;
	color: var(--muted);
}

.today dd {
	margin: 0;
	font-size: 20px;
	line-height: 1.2;
	font-weight: 800;
}

.today .lead-fig dd {
	color: var(--link);
}

.live-body {
	display: grid;
	gap: 16px;
}

@media (min-width: 900px) {
	.live-body {
		grid-template-columns: minmax(0, 1fr) 300px;
		align-items: stretch;
	}
}

.map {
	position: relative;
	margin: 0;
	border-radius: 14px;
	background: var(--map-bg);
	overflow: hidden;
}

.map > svg {
	display: block;
	width: 100%;
	height: auto;
	max-height: min(640px, 80vh);
	min-height: 240px;
}

.map .casing {
	fill: none;
	stroke: var(--map-bg);
	stroke-width: 7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.map .line {
	fill: none;
	stroke-width: 3;
	stroke-linecap: round;
	stroke-linejoin: round;
	opacity: 0.75;
	transition: opacity 0.2s;
}

.map[data-focus]:not([data-focus='']) .line {
	stroke-width: 4;
	opacity: 1;
}

.map .lines g.dim .line,
.map .bus.dim {
	opacity: 0.12;
}

.map .lines g.dim .casing {
	display: none;
}

.map .bus {
	stroke: var(--map-bg);
	stroke-width: 2;
	transition: opacity 0.2s;
}

.map .ping {
	fill: none;
	stroke-width: 2;
	animation: ping 1.4s ease-out forwards;
	transform-box: fill-box;
	transform-origin: center;
}

@keyframes ping {
	from {
		opacity: 0.9;
		transform: scale(1);
	}

	to {
		opacity: 0;
		transform: scale(4);
	}
}

.map .place circle {
	fill: var(--surface);
	stroke: var(--ink);
	stroke-width: 2;
}

.map .place text {
	fill: var(--ink);
	font: 700 14px Manrope, system-ui, sans-serif;
	paint-order: stroke;
	stroke: var(--map-bg);
	stroke-width: 4px;
	stroke-linejoin: round;
}

.map-msg {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	margin: 0;
	padding: 24px;
	text-align: center;
	color: var(--muted);
	font-size: 14px;
}

.map-msg[hidden] {
	display: none;
}

.map-cap {
	display: flex;
	padding: 0 12px 10px;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 4px 12px;
	font-size: 12px;
	font-weight: 600;
	color: var(--muted);
}

.map-cap > span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.map-cap .icon {
	width: 16px;
	height: 16px;
	color: var(--ok-dot);
}

.map.stale .map-cap .icon {
	color: var(--bad-dot);
}

.ping-key i {
	width: 12px;
	height: 12px;
	border: 2px solid var(--muted);
	border-radius: 999px;
}

/* Routes on the road */
.roster {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.roster h2 {
	margin: 4px 0 8px;
	font-weight: 600;
	color: var(--muted);
}

.roster h2 b {
	font-size: 28px;
	line-height: 1.15;
	font-weight: 800;
	letter-spacing: -0.02em;
	color: var(--ink);
}

.routes-live {
	display: grid;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.routes-live button {
	display: grid;
	grid-template-columns: 4px auto minmax(0, 1fr) 36px auto;
	align-items: center;
	gap: 2px 10px;
	width: 100%;
	min-height: 44px;
	padding: 6px 10px 6px 6px;
	border: 0;
	border-radius: 10px;
	background: none;
	color: var(--ink);
	font: 400 14px/1.3 Manrope, system-ui, sans-serif;
	text-align: left;
	cursor: pointer;
}

.routes-live button:hover {
	background: var(--surface);
}

.routes-live button[aria-pressed='true'] {
	background: var(--surface);
	box-shadow: inset 0 0 0 1px var(--focus, var(--line));
}

.routes-live .swatch {
	grid-row: span 2;
	align-self: stretch;
	border-radius: 999px;
}

.routes-live .who {
	display: contents;
}

.routes-live .who b {
	font-weight: 800;
}

.routes-live .name {
	overflow: hidden;
	color: var(--muted);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.routes-live .dirs {
	grid-column: 2 / -1;
	overflow: hidden;
	font-size: 12px;
	color: var(--muted);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.routes-live .dirs:empty {
	display: none;
}

.routes-live .load {
	height: 4px;
	border-radius: 999px;
	background: var(--line);
	overflow: hidden;
}

.routes-live .load i {
	display: block;
	height: 100%;
	border-radius: 999px;
	transition: width 0.4s;
}

.routes-live .n {
	min-width: 4.5em;
	font-weight: 700;
	text-align: right;
}

.routes-live .idle b,
.routes-live .idle .n {
	color: var(--muted);
}

.hint {
	margin: auto 0 0;
	padding: 12px 6px 0;
	font-size: 12px;
	color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
	.routes-live .load i {
		transition: none;
	}
}

/* Status */
.status {
	display: flex;
	align-items: center;
	gap: 12px;
}

.status .badge {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--state) 18%, transparent);
	color: var(--state);
}

.status[data-state='recording'] {
	--state: var(--ok);
}

.status[data-state='waiting'],
.status[data-state='loading'] {
	--state: var(--muted);
}

.status[data-state='problem'] {
	--state: var(--bad);
}

.status h1 {
	margin: 0;
	font-size: 20px;
	line-height: 1.2;
	font-weight: 800;
}

.status p {
	margin: 0;
	font-size: 14px;
	color: var(--muted);
}

/* The sheet below: what the data says */
.sheet {
	display: grid;
	gap: 40px;
	margin-top: 16px;
	padding: 24px 20px;
	border-radius: 22px;
	background: var(--surface);
}

@media (min-width: 900px) {
	.sheet {
		grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
		grid-template-areas: 'acc reports' 'acc store' 'model model';
		align-items: start;
		gap: 40px 48px;
		padding: 28px 32px;
	}
}

@media (min-width: 900px) {
	.sheet .acc {
		grid-area: acc;
	}

	.sheet .reports {
		grid-area: reports;
	}

	.sheet .store {
		grid-area: store;
	}

	.sheet .model {
		grid-area: model;
		padding-top: 32px;
		border-top: 1px solid var(--line);
	}

	.sheet .acc {
		align-self: stretch;
	}
}

.sec-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}

.sec-head h2 {
	margin: 0;
}

.seg {
	display: inline-flex;
	padding: 3px;
	border-radius: 999px;
	background: var(--page);
}

.seg button {
	min-height: 36px;
	padding: 0 14px;
	border: 0;
	border-radius: 999px;
	background: none;
	color: var(--muted);
	font: 600 14px Manrope, system-ui, sans-serif;
	cursor: pointer;
}

.seg button[aria-pressed='true'] {
	background: var(--btn);
	color: var(--on-btn);
}

.note {
	margin: 12px 0 0;
	font-size: 12px;
	color: var(--muted);
}

.note b {
	color: var(--ink);
}

/* Model: progress, then the steps */
.days {
	margin: 0 0 12px;
	font-size: 14px;
	color: var(--muted);
}

.days b {
	font-size: 28px;
	line-height: 1.15;
	font-weight: 800;
	color: var(--ink);
}

.meter {
	position: relative;
	height: 8px;
	border-radius: 999px;
	background: var(--track);
}

.meter .fill {
	height: 100%;
	min-width: 8px;
	border-radius: 999px;
	background: var(--bar);
}

.meter .mark {
	position: absolute;
	top: -3px;
	width: 2px;
	height: 14px;
	border-radius: 1px;
	background: var(--ink);
}

.milestones {
	position: relative;
	height: 36px;
	margin-top: 6px;
	font-size: 12px;
	color: var(--muted);
}

.milestones span {
	position: absolute;
	top: 0;
	line-height: 1.35;
}

.milestones b {
	display: block;
	color: var(--ink);
	font-weight: 700;
}

/* Charts */
.chart {
	position: relative;
}

.chart svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

.chart .axis {
	fill: var(--muted);
	font: 600 11px Manrope, system-ui, sans-serif;
}

.chart .base {
	stroke: var(--line);
	stroke-width: 1;
}

.chart .grid-line {
	stroke: var(--line);
	stroke-width: 1;
	stroke-dasharray: 2 4;
}

.chart .bar {
	fill: var(--bar);
}

.chart .bar.zero {
	fill: var(--track);
}

.chart .hit {
	fill: transparent;
	cursor: default;
}

.chart .hit:focus-visible {
	outline: none;
	fill: color-mix(in srgb, var(--aqua) 14%, transparent);
}

.chart .hit:hover + .bar,
.chart .hit:focus-visible + .bar {
	fill: var(--teal);
}

@media (prefers-color-scheme: dark) {
	.chart .hit:hover + .bar,
	.chart .hit:focus-visible + .bar {
		fill: #7fdcdc;
	}
}

.tip {
	position: absolute;
	z-index: 2;
	pointer-events: none;
	padding: 6px 10px;
	border-radius: 10px;
	background: var(--ink);
	color: var(--page);
	font-size: 12px;
	line-height: 1.35;
	white-space: nowrap;
	transform: translate(-50%, calc(-100% - 8px));
}

.tip strong {
	display: block;
	font-size: 14px;
	font-weight: 800;
}

.tip[hidden] {
	display: none;
}

.empty {
	display: grid;
	place-items: center;
	min-height: 120px;
	margin: 0;
	padding: 16px;
	border-radius: 14px;
	background: color-mix(in srgb, var(--track) 35%, transparent);
	color: var(--muted);
	font-size: 14px;
	text-align: center;
}

details.table {
	margin-top: 8px;
	font-size: 14px;
}

details.table summary {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--link);
	font-weight: 700;
	cursor: pointer;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

th,
td {
	padding: 6px 4px;
	text-align: right;
	border-bottom: 1px solid var(--line);
}

th:first-child,
td:first-child {
	text-align: left;
}

th {
	color: var(--muted);
	font-weight: 700;
	font-size: 12px;
}

.scroll {
	max-height: 280px;
	overflow: auto;
}

/* Login */
.login {
	display: grid;
	min-height: 100vh;
	min-height: 100dvh;
	place-items: center;
	padding: 16px;
}

.login .card {
	background: var(--surface);
	border-radius: 22px;
	box-shadow: var(--shadow);
	width: 100%;
	max-width: 380px;
	padding: 28px 24px;
}

.login h1 {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 4px;
	font-size: 28px;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.login h1 .icon {
	width: 28px;
	height: 28px;
	color: var(--link);
}

.login label {
	display: block;
	margin: 20px 0 6px;
	font-size: 14px;
	font-weight: 700;
}

.login input {
	width: 100%;
	min-height: 48px;
	padding: 0 14px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--page);
	color: var(--ink);
	font: 500 16px Manrope, system-ui, sans-serif;
}

.login input:focus-visible {
	outline: 3px solid var(--aqua);
	outline-offset: 1px;
	border-color: transparent;
}

.primary {
	width: 100%;
	min-height: 48px;
	margin-top: 16px;
	border: 0;
	border-radius: 10px;
	background: var(--btn);
	color: var(--on-btn);
	font: 700 16px Manrope, system-ui, sans-serif;
	cursor: pointer;
}

.primary:hover {
	filter: brightness(1.08);
}

.login .msg {
	margin: 12px 0 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--bad);
}

.login .msg:empty {
	display: none;
}

/* Model steps: a real sequence, left to right on wide screens */
.steps {
	display: grid;
	gap: 12px;
	margin: 20px 0 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 600px) {
	.steps {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.steps li {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding-top: 10px;
	border-top: 3px solid var(--line);
	font-size: 12px;
}

.steps li[data-state='done'] {
	border-top-color: var(--ok-dot);
}

.steps li[data-state='active'] {
	border-top-color: var(--aqua);
}

.steps .dot {
	display: none;
}

.steps .t {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
}

.steps .d {
	color: var(--muted);
	line-height: 1.4;
}

.steps .now {
	padding: 1px 8px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--aqua) 16%, transparent);
	color: var(--link);
	font-size: 12px;
	font-weight: 700;
}

.spin {
	animation: spin 1.6s linear infinite;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.spin {
		animation: none;
	}
}

.better {
	color: var(--ok);
	font-weight: 700;
}

.worse {
	color: var(--bad);
	font-weight: 700;
}

/* Storage */
.rows {
	display: grid;
	margin: 0;
	font-size: 14px;
}

.rows div {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid var(--line);
}

.rows div:last-child {
	border-bottom: 0;
}

.rows dt {
	color: var(--muted);
}

.rows dd {
	margin: 0;
	font-weight: 700;
	text-align: right;
}

.foot {
	margin: 16px 0 0;
	font-size: 12px;
	color: var(--muted);
	text-align: center;
}

.err {
	color: var(--bad);
}

/* Lanka Metro's arrival times */
.acc-said {
	max-width: 36em;
	margin: 0 0 20px;
	font-size: 20px;
	line-height: 1.4;
	color: var(--muted);
}

.acc-said b {
	color: var(--ink);
	font-weight: 800;
}

.acc-sub {
	margin: 0 0 12px;
	font-size: 14px;
	color: var(--muted);
}

.acc-rows {
	display: grid;
	margin: 0;
	padding: 0;
	list-style: none;
}

.acc-rows li {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: baseline;
	gap: 6px 16px;
	padding: 12px 0;
	border-top: 1px solid var(--line);
}

.acc-rows .h {
	font-size: 14px;
	font-weight: 700;
}

/* Dark: how far off it usually is. Light: how far off it rarely goes past. */
.acc-rows .bar {
	position: relative;
	height: 12px;
	border-radius: 999px;
	background: var(--track);
	overflow: hidden;
}

.acc-rows .bar i {
	position: absolute;
	inset: 0 auto 0 0;
	border-radius: 999px;
}

.acc-rows .bar .p90 {
	background: color-mix(in srgb, var(--aqua) 35%, transparent);
}

.acc-rows .bar .med {
	background: var(--bar);
}

.acc-rows .u {
	font-size: 14px;
	font-weight: 800;
}

.acc-rows .bar {
	grid-column: 1 / -1;
}

.acc-rows .x {
	grid-column: 1 / -1;
	font-size: 12px;
	color: var(--muted);
}

.acc .table {
	margin-top: 16px;
}

@media (prefers-color-scheme: dark) {
	.live {
		box-shadow: inset 0 0 0 1px #25465a;
	}

	.steps .now {
		color: #7fdcdc;
	}
}
