/* panel.ylon.dev, direction C: a sidebar of modules, one page template per module, light and dark */

:root {
	--bg: #f3f5f6;
	--surface: #ffffff;
	--sunken: #e9edef;
	--ink: #181d20;
	--muted: #5d6870;
	--dim: #8a949b;
	--line: #dfe4e7;
	--accent: #1b7f8e;
	--accent-hover: #145f6b;
	--accent-soft: #dfeef1;
	--on-accent: #ffffff;
	--nav: #143a45;
	--nav-text: #d5e6ea;
	--nav-active: #1f5663;
	--nav-muted: #8fb3bb;
	--nav-dim: #7fa2aa;
	--nav-line: #245a67;
	--ok: #237a3c;
	--ok-soft: #dff0e3;
	--warn: #9a5a00;
	--warn-soft: #f7ecd6;
	--fail: #b3261e;
	--fail-soft: #f9e1de;
	--run: #2456b0;
	--run-soft: #e0e8f8;
	--pill-muted: #e6e9ee;
	--overlay: rgba(16, 24, 28, 0.5);
	--skeleton: #e3e8eb;
	--code-bg: #eef1f3;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #101416;
		--surface: #191e21;
		--sunken: #0c0f11;
		--ink: #e3e8ea;
		--muted: #97a3aa;
		--dim: #6b767d;
		--line: #2a3237;
		--accent: #5fc3d2;
		--accent-hover: #8dd6e1;
		--accent-soft: #153238;
		--on-accent: #0e1418;
		--nav: #0d2a32;
		--ok: #6dc684;
		--ok-soft: #173222;
		--warn: #e2a24c;
		--warn-soft: #33260f;
		--fail: #f08b82;
		--fail-soft: #3a1b18;
		--run: #86a9ef;
		--run-soft: #1a2640;
		--pill-muted: #262c33;
		--overlay: rgba(0, 0, 0, 0.62);
		--skeleton: #232a2f;
		--code-bg: #0c0f11;
		color-scheme: dark;
	}
}

:root[data-theme="dark"] {
	--bg: #101416;
	--surface: #191e21;
	--sunken: #0c0f11;
	--ink: #e3e8ea;
	--muted: #97a3aa;
	--dim: #6b767d;
	--line: #2a3237;
	--accent: #5fc3d2;
	--accent-hover: #8dd6e1;
	--accent-soft: #153238;
	--on-accent: #0e1418;
	--nav: #0d2a32;
	--ok: #6dc684;
	--ok-soft: #173222;
	--warn: #e2a24c;
	--warn-soft: #33260f;
	--fail: #f08b82;
	--fail-soft: #3a1b18;
	--run: #86a9ef;
	--run-soft: #1a2640;
	--pill-muted: #262c33;
	--overlay: rgba(0, 0, 0, 0.62);
	--skeleton: #232a2f;
	--code-bg: #0c0f11;
	color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, sans-serif;
	font-size: 15px;
	line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
h2 { margin: 0; font-size: 16px; font-weight: 700; }

.mono { font-family: "Atkinson Hyperlegible Mono", ui-monospace, Consolas, monospace; font-size: 0.93em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.grow { flex-grow: 1; }
.strong { font-weight: 700; }

/* Shell */

.shell { display: flex; min-height: 100vh; }

.sidebar {
	width: 236px;
	flex: none;
	display: flex;
	flex-direction: column;
	padding: 20px 14px;
	background: var(--nav);
	color: var(--nav-text);
	position: sticky;
	top: 0;
	height: 100vh;
}
.brand { display: flex; align-items: center; padding: 4px 12px 22px; }
.brand a { color: #ffffff; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.menu-button { display: none; }
.nav-items { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; }
.nav-items > a, .nav-items > span { padding: 7px 12px; border-radius: 6px; color: var(--nav-text); }
.nav-items > a:hover { background: var(--nav-line); color: #ffffff; text-decoration: none; }
.nav-items > a[aria-current="page"] { background: var(--nav-active); color: #ffffff; font-weight: 700; }
.nav-items > .indent { padding-left: 24px; }
.nav-items > .unavailable { color: var(--nav-dim); }
.nav-group { padding: 18px 12px 6px; font-size: 12.5px; color: var(--nav-muted); font-weight: 700; letter-spacing: 0.02em; }
.nav-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px; border-top: 1px solid var(--nav-line); font-size: 13.5px; }
.nav-user > span { flex-grow: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link { color: var(--nav-text); }
.nav-link:hover { color: #ffffff; }

/* The sign-in page */
.signin-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding-inline: 16px; }
.signin { width: min(440px, 100%); display: flex; flex-direction: column; gap: 18px; padding: 32px 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.signin h1 { font-size: 22px; }
.signin p { margin: 0; }
.signin-button { height: 42px; font-size: 15px; }

.nav-footer { display: flex; align-items: center; gap: 10px; padding: 12px 12px 0; border-top: 1px solid var(--nav-line); font-size: 13.5px; }
.nav-footer select { flex-grow: 1; background: var(--nav); color: var(--nav-text); border: 1px solid var(--nav-line); border-radius: 6px; padding: 4px 6px; font: inherit; }

.main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 22px; padding: 28px 36px 48px; }
.page-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.crumbs:empty { display: none; }
.crumbs a::after { content: "/"; color: var(--dim); margin-left: 8px; }
.content { display: flex; flex-direction: column; gap: 22px; }
.banners { display: flex; flex-direction: column; gap: 10px; }
.banners:empty { display: none; }

/* Building blocks */

section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.card.pad { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.card.clip { overflow: hidden; }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(var(--columns, 4), minmax(0, 1fr)); }

.cell { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.cell-label { font-size: 13px; color: var(--muted); }
.cell-main { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.cell-sub { font-size: 13.5px; color: var(--muted); }

.big { font-size: 20px; font-weight: 700; }
.big.mono { font-weight: 500; }

.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 16px; font-size: 14.5px; }
.kv > dt { color: var(--muted); }
.kv > dd { margin: 0; overflow-wrap: anywhere; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 4px; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.pill svg { width: 14px; height: 14px; flex: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.fail { background: var(--fail-soft); color: var(--fail); }
.pill.run { background: var(--run-soft); color: var(--run); }
.pill.muted { background: var(--pill-muted); color: var(--muted); }
.pill .icon-cut { stroke: var(--surface); }
/* A status that opens what it's about */
a.pill-link { display: inline-flex; border-radius: 4px; text-decoration: none; vertical-align: baseline; }
a.pill-link:hover { text-decoration: none; }
a.pill-link:hover .pill { box-shadow: inset 0 0 0 1px currentColor; }
a.pill-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.button {
	display: inline-flex; align-items: center; justify-content: center; height: 34px; padding: 0 14px; border-radius: 6px;
	font: inherit; font-weight: 700; font-size: 13.5px; white-space: nowrap; cursor: pointer;
	background: var(--surface); color: var(--ink); border: 1px solid var(--line);
}
.button:hover { border-color: var(--dim); text-decoration: none; color: var(--ink); }
.button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.button.danger { background: var(--fail); color: var(--surface); border-color: var(--fail); }
.button:disabled { background: var(--sunken); color: var(--dim); border-color: var(--line); cursor: not-allowed; }
.button.small { height: 30px; font-size: 13px; }

.link { background: none; border: 0; padding: 0; font: inherit; font-size: 13.5px; color: var(--accent); cursor: pointer; }
.link:hover { color: var(--accent-hover); text-decoration: underline; }

.unavailable-reason { font-size: 13.5px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th { font-weight: 700; color: var(--muted); font-size: 13px; text-align: left; white-space: nowrap; }
td, th { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; white-space: nowrap; }
tr.total td { font-weight: 700; border-top: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
.sub { display: block; color: var(--muted); font-size: 13.5px; }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 8px; flex-wrap: wrap; }
.banner > svg { width: 16px; height: 16px; flex: none; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.fail { background: var(--fail-soft); color: var(--fail); }
.banner.muted { background: var(--pill-muted); color: var(--muted); }
.banner > .text { color: var(--ink); flex: 1 1 0; min-width: 12em; }

.attention { display: flex; align-items: center; gap: 14px; padding: 11px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.attention:last-child { border-bottom: 0; }
a.attention { color: var(--ink); }
a.attention:hover { background: var(--sunken); color: var(--ink); text-decoration: none; }
a.attention:hover .attention-open { text-decoration: underline; }
.attention-open { color: var(--accent); font-size: 13.5px; white-space: nowrap; }
.store-head a.strong { color: var(--ink); }
.store-head a.strong:hover { color: var(--accent-hover); }
td a.strong { color: var(--ink); }
td a.strong:hover { color: var(--accent-hover); }
tr.focus td { background: var(--accent-soft); }
.store.focus { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.run { background: var(--run-soft); color: var(--run); }
.attention > .text { flex-grow: 1; min-width: 12em; }
.quiet { display: flex; gap: 10px; align-items: center; padding: 14px 18px; }
.quiet svg { width: 16px; height: 16px; color: var(--ok); }

.stores { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.store { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.store-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.store-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.progress { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.progress > div { height: 6px; width: 0; background: var(--accent); }
.progress.ok > div { background: var(--ok); }
.progress.warn > div { background: var(--warn); }
.progress.fail > div { background: var(--fail); }
.progress.run > div { background: var(--run); }
.progress.indeterminate > div { width: 35%; animation: slide 1.6s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }

.log-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.log { margin: 0; padding: 12px 0; background: var(--code-bg); max-height: 520px; overflow: auto; font-family: "Atkinson Hyperlegible Mono", ui-monospace, Consolas, monospace; font-size: 13px; line-height: 20px; }
.log-line { display: flex; gap: 14px; padding: 0 16px; white-space: pre; }
.log-line > .number { color: var(--dim); min-width: 3ch; text-align: right; user-select: none; font-variant-numeric: tabular-nums; }
.log-line.bad { background: var(--fail-soft); }
.log-line.warn { background: var(--warn-soft); }
/* Where it went wrong: a bar and a marker on the line */
.log-line.target { box-shadow: inset 4px 0 0 var(--fail); }
.log-line.warn.target { box-shadow: inset 4px 0 0 var(--warn); }
.log-line.target > .number { color: var(--ink); font-weight: 700; }
.log-empty { padding: 12px 16px; color: var(--muted); }

.skeleton { display: block; height: 14px; border-radius: 4px; background: var(--skeleton); }

.schedule-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.store-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.store-choice label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 700; }
.store-choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.store-choice input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.time-input { width: 6.5ch; font-family: "Atkinson Hyperlegible Mono", ui-monospace, Consolas, monospace; font-size: 14px; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); box-sizing: content-box; }
.time-input:invalid { border-color: var(--fail); }

.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 28px 24px; }

/* Dialog and toasts */

.dialog { width: min(600px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 24px 26px; }
.dialog::backdrop { background: var(--overlay); }
.dialog h2 { font-size: 19px; }
.dialog[open] { display: flex; flex-direction: column; gap: 18px; }
.dialog-buttons { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding-top: 4px; }
.dialog .log { max-height: 60vh; }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; max-width: min(460px, calc(100vw - 40px)); z-index: 10; }
.toast { padding: 12px 16px; border-radius: 8px; background: var(--ink); color: var(--bg); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); }
.toast.fail { background: var(--fail); color: var(--surface); }

/* Narrow screens */

@media (max-width: 1100px) {
	.stores { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
	.shell { flex-direction: column; }
	.sidebar { width: auto; height: auto; position: sticky; top: 0; z-index: 5; padding: 10px 16px; }
	.brand { padding: 4px 0; justify-content: space-between; }
	.menu-button { display: inline-flex; background: none; color: var(--nav-text); border: 1px solid var(--nav-line); border-radius: 6px; padding: 4px 12px; font: inherit; }
	.nav-items { display: none; padding: 8px 0 4px; }
	.sidebar.open .nav-items { display: flex; }
	.main { padding: 20px 16px 40px; gap: 18px; }
	.grid, .stores { grid-template-columns: minmax(0, 1fr); }
	.kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
	.kv > dd { margin-bottom: 8px; }
	td, th { padding: 9px 10px; }
}

@media (prefers-reduced-motion: reduce) {
	.progress.indeterminate > div { animation: none; width: 100%; opacity: 0.5; }
}
