/* The only hand-written CSS in the console. Pico dresses the semantic HTML; this adds
   the page shell — environment banner and sidebar — and the few things Pico can't know
   about. Colours come from Pico's variables where one fits, so its dark mode holds. */

:root {
	/* Pico scales type up to 131% on wide screens; a console of tables wants density. */
	--pico-font-size: 100%;
	--danger: #b3261e;
	--ok: #2e7d32;
	--env-height: 1.5rem;
	--sidebar-width: 13rem;
}

/* --- Shell ----------------------------------------------------------------- */

.env {
	position: sticky;
	top: 0;
	z-index: 10;
	height: var(--env-height);
	padding: 0.25rem 1rem;
	font-size: 0.75rem;
	line-height: 1rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-align: center;
	color: #fff;
}

/* Production is meant to be uncomfortable to look at. */
.env-production { background: var(--danger); }
.env-staging    { background: #8a6d00; }
.env-local      { background: #3a4a5a; }

/* Phones: brand and sign-out on one line, the page links wrapping under them — wrapped
   rather than scrolled, so the current page is never off-screen. Group labels only earn
   their space in the desktop sidebar. */
.sidebar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem 1rem;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--pico-muted-border-color);
	background: var(--pico-card-sectioning-background-color);
}
.brand { font-weight: 700; color: var(--pico-color); text-decoration: none; }
.signout { display: flex; align-items: center; gap: 0.75rem; margin: 0; }
.signout small { display: none; color: var(--pico-muted-color); overflow-wrap: anywhere; }
.signout button.secondary { --pico-color: var(--pico-muted-color); margin: 0; padding: 0.25rem 0.6rem; font-size: 0.8rem; }

.sidebar nav { order: 1; flex: 1 0 100%; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 0.25rem; }
.sidebar nav div,
.sidebar nav ul { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.25rem; margin: 0; padding: 0; }
.sidebar nav li { display: block; margin: 0; padding: 0; }
.sidebar nav .group { display: none; }
.sidebar nav a {
	display: block;
	margin: 0;
	padding: 0.3rem 0.6rem;
	border-radius: var(--pico-border-radius);
	color: var(--pico-color);
	white-space: nowrap;
	text-decoration: none;
}
.sidebar nav a:hover { background: var(--pico-muted-border-color); }
.sidebar nav a[aria-current="page"] {
	background: var(--pico-primary-focus);
	color: var(--pico-primary);
	font-weight: 600;
}

body.signed-out > main { max-width: 26rem; padding-top: 12vh; }

@media (min-width: 1024px) {
	body.signed-in {
		display: grid;
		grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
		align-items: start;
	}
	.env { grid-column: 1 / -1; }

	.sidebar {
		position: sticky;
		top: var(--env-height);
		display: flex;
		flex-direction: column;
		gap: 1.5rem;
		height: calc(100vh - var(--env-height));
		overflow-y: auto;
		padding: 1.25rem 0.75rem;
		border-bottom: 0;
		border-right: 1px solid var(--pico-muted-border-color);
	}
	.brand { padding: 0 0.6rem; }
	.sidebar nav { order: 0; flex: none; flex-direction: column; flex-wrap: nowrap; gap: 1.25rem; }
	.sidebar nav div,
	.sidebar nav ul { flex-direction: column; flex-wrap: nowrap; gap: 0.1rem; }
	.sidebar nav .group {
		display: block;
		padding: 0 0.6rem 0.25rem;
		font-size: 0.7rem;
		font-weight: 600;
		letter-spacing: 0.08em;
		text-transform: uppercase;
		color: var(--pico-muted-color);
	}
	.signout { flex-direction: column; align-items: flex-start; gap: 0.5rem; margin-top: auto; padding: 0 0.6rem; }
	.signout small { display: block; }

	body.signed-in > main { width: auto; max-width: 70rem; margin: 0; padding: 2rem 2.5rem; }
}

/* --- Content --------------------------------------------------------------- */

.flash {
	margin-bottom: 1.5rem;
	padding: 0.75rem 1rem;
	border-left: 4px solid;
}
.flash.error  { border-color: var(--danger); }
.flash.notice { border-color: var(--ok); }

/* Page header: an optional back link, the title, one line of context. */
header.page { margin-bottom: 1.75rem; }
header.page h1 { margin-bottom: 0.25rem; }
header.page p { margin: 0; color: var(--pico-muted-color); }
.back { display: inline-block; margin-bottom: 0.35rem; font-size: 0.85rem; text-decoration: none; }
main h2 { margin-top: 2rem; }
header.page + h2 { margin-top: 0; }

/* In-page filters (report status): the chosen one filled, like the sidebar. */
nav.tabs ul { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0 0 1rem; padding: 0; }
nav.tabs li { padding: 0; }
nav.tabs a { display: block; margin: 0; padding: 0.3rem 0.7rem; border-radius: var(--pico-border-radius); text-decoration: none; }
nav.tabs a[aria-current="page"] { background: var(--pico-primary-focus); font-weight: 600; }

/* Operational tables are for scanning, so trade Pico's comfortable spacing for
   density and keep wide ones scrollable rather than letting the page scroll. */
table { font-size: 0.9rem; }
table :where(th, td) { padding: 0.4rem 0.6rem; }
.scroll { overflow-x: auto; }

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.muted, .muted { color: var(--pico-muted-color); }

/* Buttons size to their label. Pico's classless build stretches every submit to full
   width and has no variants, so `.secondary` (outlined) and `.danger` live here. */
button[type="submit"] { width: auto; }
button { white-space: nowrap; }
.signed-out button[type="submit"] { width: 100%; }
button.secondary {
	--pico-background-color: transparent;
	--pico-border-color: var(--pico-muted-border-color);
	--pico-color: inherit;
}
button.secondary:is(:hover, :focus) {
	--pico-background-color: var(--pico-muted-border-color);
	--pico-border-color: var(--pico-muted-border-color);
	--pico-color: inherit;
}
button.danger,
button.danger:is(:hover, :focus) {
	--pico-background-color: var(--danger);
	--pico-border-color: var(--danger);
	--pico-color: #fff;
}

/* One-button forms sit inline; small, so a table row with an action stays one line. */
form.inline { display: inline-block; margin: 0; }
table button, form.inline button { margin: 0; padding: 0.25rem 0.7rem; font-size: 0.85rem; }
form.inline select { width: auto; margin: 0; padding: 0.25rem 2rem 0.25rem 0.6rem; font-size: 0.85rem; }

/* Job, report and invite states. Pico's ins/del colours are tuned for both themes. */
.status {
	display: inline-block;
	padding: 0 0.45rem;
	border: 1px solid currentColor;
	border-radius: 1rem;
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1.5;
	white-space: nowrap;
}
.status-good   { color: var(--pico-ins-color); }
.status-bad    { color: var(--pico-del-color); }
.status-active { color: var(--pico-primary); }
.status-muted  { color: var(--pico-muted-color); }

/* Confirmation panels: the operator types the target to arm the button. */
.confirm { border: 1px solid var(--danger); padding: 1rem; }
.confirm code { user-select: all; }

/* Stat tiles: a headline number with its label under it. Pico's <article> gives the
   card; the grid wraps to however many fit, so phones get one column for free. */
.tiles {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
	gap: 0.75rem;
	margin-bottom: 1.5rem;
}
.tile { margin: 0; padding: 0.9rem 1rem; }
.tile strong { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile span, .tile small { display: block; }
.tile small { color: var(--pico-muted-color); }

/* Catalog snapshot line: when the numbers are from, with Refresh beside it. */
.snapshot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.snapshot button { margin: 0; padding: 0.25rem 0.7rem; font-size: 0.85rem; }

/* Reader-written text keeps its line breaks, and a long unbroken string can't widen the page. */
.report-text { white-space: pre-line; overflow-wrap: anywhere; }

/* A row of one-button forms. */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }

/* Book editor: the cover picker is a wrapping grid of edition jackets, the current one
   outlined; tags are a row of removable chips. */
.covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.covers figure { margin: 0; padding: 0.5rem; border: 1px solid var(--pico-muted-border-color); }
.covers figure.current { border: 2px solid var(--ok); }
.covers img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: contain; background: var(--pico-muted-border-color); }
.covers figcaption { font-size: 0.8rem; margin: 0.4rem 0; }
.covers form { display: block; margin: 0; }
.covers button { width: 100%; padding: 0.3rem; font-size: 0.8rem; }
.url { overflow-wrap: anywhere; color: var(--pico-muted-color); }
/* inline-block keeps the host whole on its own line in a narrow card; it only breaks
   when it's wider than the card itself. */
.url mark { display: inline-block; max-width: 100%; padding: 0 0.15em; }
.covers .url { font-size: 0.7rem; }
.cover-source { font-size: 0.85rem; }
.tag-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-list li { list-style: none; margin: 0; }
.tag-list form { margin: 0; display: inline-flex; align-items: center; gap: 0.25rem; }
.tag-list button { margin: 0; padding: 0.1rem 0.45rem; }

/* Report detail: the author's photo, so a "that's not them" report checks at a glance. */
.report-photo { display: block; max-width: 9rem; max-height: 12rem; object-fit: contain; background: var(--pico-muted-border-color); }

/* Report detail: a report-resolution proposal, one block per operation. */
.proposal header, .proposal footer { margin-bottom: 0.75rem; }
.proposal-closed { opacity: 0.75; }
.proposal-op { margin-bottom: 1rem; }
.proposal-op p { margin-bottom: 0.25rem; }
.proposal-op-invalid { opacity: 0.55; }
.proposal-op-unsourced { border-left: 3px solid var(--pico-del-color); padding-left: 0.75rem; }
.evidence { margin: 0 0 0.25rem; font-size: 0.9rem; }
.evidence li { overflow-wrap: anywhere; }
.proposal del { color: var(--pico-del-color); }
.proposal ins { color: var(--pico-ins-color); text-decoration: none; font-weight: 600; }
.proposal .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.proposal .actions a[role="button"] { margin: 0; padding: 0.25rem 0.7rem; font-size: 0.85rem; }
form.reject { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
form.reject :is(select, input) { width: auto; margin: 0; padding: 0.25rem 0.6rem; font-size: 0.85rem; }
form.reject button { margin: 0; padding: 0.25rem 0.7rem; font-size: 0.85rem; }
.proposal-op-link { border-left: 3px solid var(--danger); padding-left: 0.75rem; }
.proposal .covers { display: inline-flex; align-items: center; gap: 0.5rem; }
.proposal .covers img { max-height: 9rem; }
.tag-added { color: var(--pico-ins-color); }
.tag-removed { color: var(--pico-del-color); }
form.revise { margin: 0.75rem 0; }
form.revise textarea { margin-bottom: 0.4rem; font-size: 0.9rem; }
form.revise button { margin: 0; padding: 0.25rem 0.7rem; font-size: 0.85rem; }
.revising { font-style: italic; }
.revisions { margin: 0.75rem 0; font-size: 0.9rem; }
.revisions li { margin-bottom: 0.4rem; }
.evidence-image { display: block; max-height: 8rem; max-width: 8rem; margin: 0.25rem 0; object-fit: contain; }

/* Report detail: the subject as its reader page lays it out, the proposal's change marked
   in place. Sized after the client's book page, not reproducing its styling. */
.reader-view { max-width: 42rem; }
.reader-view del { color: var(--pico-del-color); }
.reader-view ins { color: var(--pico-ins-color); text-decoration: none; font-weight: 600; background: color-mix(in srgb, var(--pico-ins-color) 12%, transparent); }
.reader-view h3 { margin-bottom: 0.25rem; font-family: "EB Garamond", Georgia, serif; font-size: 1.6rem; line-height: 1.15; }
.reader-view h4 { margin: 1.25rem 0 0.5rem; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--pico-muted-color); }
.reader-view section p { margin-bottom: 0.25rem; }
.reader-head { display: flex; gap: 1.25rem; align-items: flex-start; }
.reader-head > div:last-child { flex: 1; min-width: 0; }
.reader-sub { margin-bottom: 0.25rem; color: var(--pico-muted-color); }
.reader-covers { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
.reader-cover { width: 7rem; aspect-ratio: 2 / 3; object-fit: cover; border: 1px solid var(--pico-muted-border-color); background: var(--pico-muted-border-color); }
.reader-cover.blank, .reader-photo.blank { display: flex; align-items: center; justify-content: center; font-size: 0.75rem; color: var(--pico-muted-color); }
.reader-cover.was { width: 4.5rem; opacity: 0.5; }
.reader-photo.was { opacity: 0.5; }
.reader-cover.now, .reader-photo.now { outline: 3px solid var(--pico-ins-color); outline-offset: 2px; }
.reader-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.5rem 0 0; padding: 0; list-style: none; }
.reader-tags li { margin: 0; padding: 0.1rem 0.6rem; border-radius: 999px; font-size: 0.8rem; background: var(--pico-muted-border-color); list-style: none; }
.reader-tags li.tag-added { outline: 2px solid var(--pico-ins-color); }
.reader-tags li.chip-hidden { opacity: 0.45; border: 1px dashed var(--pico-muted-color); background: none; }
.reader-credit { display: flex; gap: 0.75rem; align-items: flex-start; margin-bottom: 0.75rem; }
.reader-credit.credit-added { border-left: 3px solid var(--pico-ins-color); padding-left: 0.5rem; }
.reader-credit.credit-removed { opacity: 0.6; }
.reader-photo { width: 2.5rem; height: 2.5rem; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--pico-muted-border-color); }
.reader-bio { display: block; }
.raw-fields { margin-top: 1.5rem; }
@media (max-width: 480px) { .reader-cover { width: 5.5rem; } }
