:root {
	--blue: #7db5ff;
	--blue-line: #5e98e4;
	--ink: #17324d;
	--mute: #5d7084;
	--line: #d5e2f0;
	--paper: #f3f7fb;
	--sheet: #fff;
	--danger: #8d2f2f;
	--shadow: 0 6px 16px rgba(94, 152, 228, 0.28);
	font-family: "WenQuanYi Micro Hei", "Droid Sans Fallback", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
	margin: 0;
	min-height: 100%;
	background: var(--paper);
	color: var(--ink);
	font-size: 16px;
	line-height: 1.45;
}

button, input, textarea { font: inherit; color: inherit; }

a { color: inherit; }

button { cursor: pointer; }

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

.dev-banner {
	background: #17324d;
	color: #fff;
	font-weight: 700;
	font-size: 14px;
	padding: 10px 16px;
}

.shell {
	display: grid;
	grid-template-columns: 232px minmax(0, 1fr);
	min-height: 100vh;
}

.rail {
	background: var(--sheet);
	border-right: 1px solid var(--line);
	padding: 22px 16px;
	display: flex;
	flex-direction: column;
	gap: 18px;
	position: sticky;
	top: 0;
	height: 100vh;
}

.brand {
	display: flex;
	gap: 10px;
	align-items: center;
	text-decoration: none;
}

.brand strong {
	display: block;
	font-size: 20px;
	font-weight: 800;
	letter-spacing: -0.03em;
}

.brand small {
	display: block;
	color: var(--mute);
	font-size: 13px;
}

nav {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.nav-link {
	display: block;
	padding: 10px 12px;
	border-radius: 10px;
	text-decoration: none;
	font-weight: 700;
	border-left: 3px solid transparent;
}

.nav-link[aria-current="page"] {
	background: #f3f8ff;
	border-left-color: var(--blue);
}

.who, .logout {
	margin: 0;
	color: var(--mute);
	font-size: 13px;
}

.logout { margin-top: auto; }

.sheet {
	margin: 28px;
	background: var(--sheet);
	border: 1px solid var(--line);
	border-top: 4px solid var(--blue);
	padding: 28px 28px 40px;
	min-width: 0;
}

.eyebrow {
	margin: 0 0 6px;
	color: var(--blue-line);
	font-weight: 800;
	letter-spacing: 0.08em;
	font-size: 12px;
}

h1 {
	margin: 0 0 8px;
	font-size: 32px;
	line-height: 1.15;
	font-weight: 800;
	letter-spacing: -0.03em;
}

.lede, .note, .empty, .form-error {
	color: var(--mute);
}

.form-error { color: var(--danger); font-weight: 700; }

.metrics {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0;
	border-top: 1px solid var(--line);
	margin-top: 22px;
}

.metric {
	padding: 18px 8px 8px 0;
	border-bottom: 1px solid var(--line);
}

.metric:nth-child(odd) { padding-right: 22px; }
.metric:nth-child(even) { padding-left: 22px; border-left: 1px solid var(--line); }

.metric header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}

.metric h2 { margin: 0; font-size: 16px; font-weight: 800; }

.metric strong {
	font-size: 32px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.04em;
}

.metric .open-count {
	color: var(--mute);
	font-size: 13px;
	font-weight: 700;
}

.bars { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }

.bars li {
	display: grid;
	grid-template-columns: 52px minmax(0, 1fr) 28px;
	gap: 8px;
	align-items: center;
	font-variant-numeric: tabular-nums;
	font-size: 13px;
}

.bar {
	display: block;
	height: 8px;
	background: #e7f1ff;
	border-radius: 99px;
	overflow: hidden;
}

.bar i {
	display: block;
	height: 100%;
	background: var(--blue);
	border-radius: inherit;
}

.toolbar, .split, .actions, .choice, .picker-nav, .picker-time, .picker-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.toolbar { margin: 18px 0; }

.search {
	display: flex;
	gap: 8px;
	flex: 1;
	min-width: 0;
}

.search input { flex: 1; min-width: 0; }

.field input, .field textarea, .reason textarea, .search input {
	border: 1px solid var(--line);
	border-radius: 12px;
	background: #fff;
	padding: 10px 12px;
	min-height: 44px;
}

.field input, .field textarea, .reason textarea {
	width: 100%;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: #fff;
	padding: 10px 12px;
	min-height: 44px;
}

.field { display: grid; gap: 6px; margin: 12px 0; }
.field span { font-weight: 800; font-size: 14px; }

.btn, .btn-quiet {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 0 16px;
	border-radius: 999px;
	border: 1px solid var(--blue-line);
	font-weight: 800;
	text-decoration: none;
	box-shadow: var(--shadow);
}

.btn { background: var(--blue); color: #fff; }
.btn:hover { background: #6e9fe0; }
.btn-quiet {
	background: #fff;
	color: var(--ink);
	box-shadow: 0 4px 12px rgba(94, 152, 228, 0.16);
}
.btn[disabled] { opacity: 0.45; cursor: default; }

.list { display: grid; margin: 8px 0 0; }
.item {
	display: grid;
	gap: 6px;
	padding: 16px 0;
	border-top: 1px solid var(--line);
}
.item h2, .item h3 { margin: 0; font-size: 18px; }
.item .btn, .item .btn-quiet { justify-self: start; }
.item a { font-weight: 800; text-decoration: none; }
.meta { color: var(--mute); font-size: 13px; }
.badge {
	display: inline-block;
	margin-right: 6px;
	padding: 2px 8px;
	border-radius: 99px;
	background: #eef5ff;
	color: #2d5f93;
	font-size: 12px;
	font-weight: 800;
}
.badge.warn { background: #fff4e8; color: #8a4b12; }
.badge.stop { background: #fdecec; color: var(--danger); }

.defs { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 12px; margin: 18px 0; }
.defs dt { color: var(--mute); font-weight: 700; }
.defs dd { margin: 0; }

.reason, .picker-pop {
	margin-top: 8px;
	padding: 12px;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: #f8fbff;
}

.choice button[aria-pressed="true"] { background: var(--blue); color: #fff; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.tabs button[aria-selected="true"] { background: var(--blue); color: #fff; }

.picker { position: relative; }
.picker-pop { position: absolute; z-index: 3; left: 0; right: 0; background: #fff; }
.picker-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 8px 0; }
.picker-grid button, .picker-nav button, .picker-time button, .picker-actions button:not(.btn) {
	min-height: 36px;
	border: 1px solid var(--line);
	background: #fff;
	border-radius: 8px;
	font-weight: 700;
}
.picker-grid button[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue-line); }
.picker-grid .dow { text-align: center; color: var(--mute); font-size: 12px; font-weight: 800; }

.gate {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 24px;
}
.gate-card {
	width: min(440px, 100%);
	background: #fff;
	border: 1px solid var(--line);
	border-top: 4px solid var(--blue);
	padding: 28px;
	display: grid;
	gap: 12px;
}
.gate-card h1 { font-size: 28px; }
.dev-note { margin: 8px 0 0; color: var(--mute); font-size: 14px; }

@media (max-width: 800px) {
	.shell { display: block; }
	.rail {
		position: sticky;
		top: 0;
		height: auto;
		z-index: 4;
		border-right: 0;
		border-bottom: 1px solid var(--line);
		padding: 12px;
		gap: 10px;
	}
	nav { flex-direction: row; flex-wrap: wrap; }
	.nav-link { border-left: 0; border-bottom: 3px solid transparent; }
	.nav-link[aria-current="page"] { border-bottom-color: var(--blue); }
	.who { display: none; }
	.logout { margin-top: 0; }
	.sheet { margin: 0; border-left: 0; border-right: 0; padding: 18px 14px 32px; }
	h1 { font-size: 26px; }
	.metrics { grid-template-columns: 1fr; }
	.metric:nth-child(odd), .metric:nth-child(even) { padding: 16px 0; border-left: 0; }
	.defs { grid-template-columns: 1fr; }
	.picker-pop { position: static; }
}
