/*
 * Staff portal.
 *
 * Dark by default: this gets used in dim foyers, on phones, early in the
 * morning. A white admin screen at 7am is harsh, and the door tool and the
 * office tool should not look like two different products.
 */

:root {
	--purple: #6D3B8C;
	--purple-lift: #8A55AA;
	--purple-deep: #4E2967;
	--gold: #F4D35E;
	--gold-deep: #D9B63C;
	--plum: #2D2338;
	--plum-deep: #1E1727;
	--card: #362B43;
	--card-lift: #40334F;
	--line: #4A3C59;
	--line-soft: #3B2F49;
	--text: #F5F1F8;
	--muted: #B5A7C2;
	--ok: #4ADE80;
	--ok-deep: #14532D;
	--warn: #FBBF24;
	--warn-deep: #4A3208;
	--bad: #F87171;
	--bad-deep: #4C1D1D;

	--radius: .75rem;
	--radius-lg: 1rem;
	--shadow: 0 4px 16px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--plum-deep);
	color: var(--text);
	font-family: "Libre Franklin", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 16px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
	padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--gold); }

.display {
	font-family: "Playfair Display", Georgia, serif;
	font-weight: 700;
	line-height: 1.2;
	margin: 0 0 .5rem;
}

h1, h2, h3 { line-height: 1.25; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ================================================================= Topbar */

.topbar {
	position: sticky;
	top: 0;
	z-index: 40;
	display: flex;
	align-items: center;
	gap: .75rem;
	padding: .7rem 1rem;
	padding-top: calc(.7rem + env(safe-area-inset-top));
	background: rgba(45, 35, 56, .96);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--line-soft);
}

.topbar__menu {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	flex: none;
	background: transparent;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	color: var(--text);
	cursor: pointer;
}

.topbar__menu svg { width: 1.15rem; height: 1.15rem; }
.topbar__menu:hover { background: var(--card); }

.topbar__brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }

.topbar__mark {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	flex: none;
	border-radius: 50%;
	background: rgba(244, 211, 94, .15);
	color: var(--gold);
}

.topbar__mark svg { width: 1rem; height: 1rem; }

.topbar__title {
	font-weight: 700;
	font-size: 1rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.topbar__user { margin-left: auto; display: flex; align-items: center; gap: .6rem; }

.avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	background: var(--purple);
	color: #fff;
	font-size: .7rem;
	font-weight: 800;
	letter-spacing: .02em;
}

.topbar__out {
	display: inline-flex;
	align-items: center;
	min-height: 38px;
	padding: 0 .8rem;
	border: 1px solid var(--line);
	border-radius: 999px;
	color: var(--muted);
	text-decoration: none;
	font-size: .8125rem;
	font-weight: 700;
}

.topbar__out:hover { color: var(--text); border-color: var(--gold); }

/* ================================================================ Sidenav */

.sidenav {
	position: fixed;
	inset: 0 auto 0 0;
	z-index: 50;
	width: 15.5rem;
	padding: 1rem .75rem 2rem;
	padding-top: calc(1rem + env(safe-area-inset-top));
	background: var(--plum);
	border-right: 1px solid var(--line-soft);
	transform: translateX(-100%);
	transition: transform 200ms ease;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.sidenav.is-open { transform: none; }

.sidenav__group {
	margin: 1.25rem 0 .35rem;
	padding: 0 .85rem;
	font-size: .65rem;
	font-weight: 800;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--muted);
	opacity: .75;
}

.sidenav__group:first-child { margin-top: 0; }
.sidenav ul { list-style: none; margin: 0; padding: 0; }

.sidenav a {
	display: flex;
	align-items: center;
	gap: .7rem;
	min-height: 46px;
	padding: .55rem .85rem;
	margin-bottom: .1rem;
	border-radius: var(--radius);
	color: var(--muted);
	text-decoration: none;
	font-weight: 600;
	font-size: .9375rem;
}

.sidenav a:hover { background: rgba(255, 255, 255, .05); color: var(--text); }

.sidenav a.is-current {
	background: var(--purple);
	color: #fff;
	font-weight: 700;
	box-shadow: var(--shadow);
}

.sidenav svg { width: 1.1rem; height: 1.1rem; flex: none; opacity: .9; }

.sidenav__count {
	margin-left: auto;
	min-width: 1.35rem;
	height: 1.35rem;
	padding: 0 .35rem;
	border-radius: 999px;
	background: var(--bad);
	color: #fff;
	font-size: .7rem;
	font-weight: 800;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.scrim {
	position: fixed;
	inset: 0;
	z-index: 45;
	background: rgba(0, 0, 0, .55);
	opacity: 0;
	pointer-events: none;
	transition: opacity 200ms ease;
}

.scrim.is-open { opacity: 1; pointer-events: auto; }

@media (min-width: 1000px) {
	.topbar__menu { display: none; }
	.sidenav { transform: none; top: 3.4rem; }
	.scrim { display: none; }
	.layout { padding-left: 15.5rem; }
}

/* ================================================================= Layout */

.content { max-width: 52rem; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.shell { max-width: 26rem; margin: 0 auto; padding: 2rem 1rem 4rem; }

@media (min-width: 1000px) {
	.content { padding: 2rem 2.25rem 5rem; }
}

.page-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	margin-bottom: 1.25rem;
}

.page-head h1 { margin: 0; font-size: 1.5rem; }
.page-head__sub { margin: .2rem 0 0; color: var(--muted); font-size: .875rem; }

/* ================================================================== Cards */

.card {
	background: var(--card);
	border: 1px solid var(--line-soft);
	border-radius: var(--radius-lg);
	padding: 1.35rem;
	margin-bottom: 1rem;
}

.card--center { text-align: center; padding: 2.5rem 1.5rem; }
.card--flush { padding: 0; overflow: hidden; }
.card--alert { border-color: var(--warn); background: linear-gradient(rgba(251,191,36,.07), rgba(251,191,36,.07)) var(--card); }
.card--off { opacity: .55; }

.card__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .75rem;
	margin: 0 0 1rem;
	font-size: .7rem;
	font-weight: 800;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--gold);
}

.card__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3.5rem;
	height: 3.5rem;
	margin: 0 auto 1rem;
	border-radius: 50%;
	background: rgba(244, 211, 94, .12);
	color: var(--gold);
}

.card__icon svg { width: 1.6rem; height: 1.6rem; }

/* ================================================================== Stats */

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: 1.25rem; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stats--three { grid-template-columns: repeat(3, 1fr); }
.stats--two { grid-template-columns: repeat(2, 1fr); }

.stat {
	background: var(--card);
	border: 1px solid var(--line-soft);
	border-radius: var(--radius);
	padding: .9rem .75rem;
	text-align: center;
}

.stat__num {
	display: block;
	font-size: 1.6rem;
	font-weight: 800;
	line-height: 1.1;
	color: var(--gold);
	font-variant-numeric: tabular-nums;
}

.stat--money .stat__num { font-size: 1.25rem; }

.stat__label {
	display: block;
	margin-top: .25rem;
	font-size: .65rem;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--muted);
}

/* ================================================================ Buttons */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	min-height: 48px;
	padding: .7rem 1.35rem;
	border: 1px solid transparent;
	border-radius: 999px;
	font: inherit;
	font-weight: 700;
	font-size: .9375rem;
	line-height: 1;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: filter 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.btn svg { width: 1.05rem; height: 1.05rem; flex: none; }
.btn--gold { background: var(--gold); color: var(--plum); }
.btn--gold:hover { filter: brightness(1.06); color: var(--plum); }
.btn--purple { background: var(--purple); color: #fff; }
.btn--purple:hover { background: var(--purple-lift); color: #fff; }
.btn--quiet { background: transparent; color: var(--text); border-color: var(--line); }
.btn--quiet:hover { background: var(--card-lift); color: var(--text); }
.btn--bad { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn--bad:hover { background: var(--bad); color: #fff; }
.btn--block { width: 100%; }
.btn--sm { min-height: 40px; padding: .45rem 1rem; font-size: .8125rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.btn-row--end { justify-content: flex-end; }

/* Actions that move money or delete things get separated from the rest. */
.danger-zone {
	margin-top: 1.25rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--line-soft);
}

/* =================================================================== Form */

.field { margin-bottom: 1rem; }

.field > label,
.field__label {
	display: block;
	margin-bottom: .35rem;
	font-weight: 700;
	font-size: .8125rem;
	letter-spacing: .02em;
	color: var(--text);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="url"],
.field input[type="password"],
.field input[type="number"],
.field input[type="search"],
.field input[type="date"],
.field input[type="datetime-local"],
.field select,
.field textarea,
.search {
	width: 100%;
	min-height: 48px;
	padding: .65rem .85rem;
	background: var(--plum);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	color: var(--text);
	font: inherit;
	font-size: 16px; /* never smaller — iOS zooms the page on focus */
}

.field textarea { min-height: 8rem; line-height: 1.6; resize: vertical; }

.field input:focus,
.field select:focus,
.field textarea:focus,
.search:focus {
	outline: none;
	border-color: var(--gold);
	box-shadow: 0 0 0 3px rgba(244, 211, 94, .18);
}

.field__hint { margin: .35rem 0 0; font-size: .8125rem; color: var(--muted); }

.grid2 { display: grid; gap: 0 1rem; }
@media (min-width: 620px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.check {
	display: flex;
	gap: .7rem;
	align-items: flex-start;
	padding: .55rem 0;
	cursor: pointer;
}

.check input { margin-top: .2rem; width: 20px; height: 20px; flex: none; accent-color: var(--gold); }
.check strong { display: block; font-size: .9375rem; }
.check span.muted { display: block; font-size: .8125rem; margin-top: .1rem; }

.filters { display: grid; gap: .5rem; margin-bottom: 1rem; }
@media (min-width: 760px) { .filters { grid-template-columns: 1fr auto auto auto; align-items: center; } }
.filters .btn { min-height: 48px; }

/* ================================================================== Lists */

.hit {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .75rem;
	width: 100%;
	min-height: 62px;
	padding: .75rem 1rem;
	margin-bottom: .4rem;
	background: var(--card);
	border: 1px solid var(--line-soft);
	border-radius: var(--radius);
	color: var(--text);
	font: inherit;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
	transition: border-color 150ms ease, background-color 150ms ease;
}

.hit:hover { background: var(--card-lift); border-color: var(--line); color: var(--text); }
.hit__name { display: block; font-weight: 700; }
.hit__meta { display: block; font-size: .8125rem; color: var(--muted); margin-top: .1rem; }

.pill {
	display: inline-block;
	padding: .28rem .7rem;
	border-radius: 999px;
	font-size: .68rem;
	font-weight: 800;
	letter-spacing: .05em;
	text-transform: uppercase;
	white-space: nowrap;
}

.pill--ok { background: rgba(74, 222, 128, .16); color: var(--ok); }
.pill--warn { background: rgba(251, 191, 36, .16); color: var(--warn); }
.pill--bad { background: rgba(248, 113, 113, .16); color: var(--bad); }
.pill--off { background: rgba(255, 255, 255, .08); color: var(--muted); }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty svg { width: 2.5rem; height: 2.5rem; opacity: .4; margin-bottom: .75rem; }

/* ================================================================= Tables */

.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }

.table th {
	text-align: left;
	font-size: .68rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--muted);
	padding: .5rem .75rem;
	border-bottom: 1px solid var(--line);
}

.table td { padding: .6rem .75rem; border-bottom: 1px solid var(--line-soft); }
.table tr:last-child td { border-bottom: 0; }
.table--flush th:first-child, .table--flush td:first-child { padding-left: 1.35rem; }
.table--flush th:last-child, .table--flush td:last-child { padding-right: 1.35rem; }
.table-wrap { overflow-x: auto; }

/* ================================================================ Notices */

.notice {
	display: flex;
	gap: .6rem;
	align-items: flex-start;
	padding: .85rem 1rem;
	border-radius: var(--radius);
	margin: 0 0 1rem;
	font-size: .9375rem;
	border: 1px solid transparent;
}

.notice--ok { background: rgba(74, 222, 128, .12); border-color: rgba(74, 222, 128, .3); color: var(--ok); }
.notice--bad { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .3); color: var(--bad); }
.notice--warn { background: rgba(251, 191, 36, .12); border-color: rgba(251, 191, 36, .3); color: var(--warn); }
.notice a { color: inherit; font-weight: 700; }
.notice svg { width: 1.15rem; height: 1.15rem; flex: none; margin-top: .1rem; }

/* ================================================================== Tabs */

.tabs {
	display: flex;
	gap: .4rem;
	overflow-x: auto;
	margin-bottom: 1.25rem;
	padding-bottom: .3rem;
	-webkit-overflow-scrolling: touch;
}

.tab {
	flex: none;
	padding: .55rem 1rem;
	min-height: 40px;
	display: inline-flex;
	align-items: center;
	border-radius: 999px;
	background: var(--card);
	border: 1px solid var(--line-soft);
	color: var(--muted);
	text-decoration: none;
	font-weight: 700;
	font-size: .8125rem;
	white-space: nowrap;
}

.tab:hover { color: var(--text); border-color: var(--line); }
.tab.is-current { background: var(--purple); color: #fff; border-color: var(--purple); }

/* ================================================================ Details */

.person { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.answer { padding: .65rem 0; border-bottom: 1px solid var(--line-soft); }
.answer:last-child { border-bottom: 0; }
.answer__label { display: block; font-size: .68rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.answer__value { display: block; margin-top: .2rem; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .6rem 0; border-bottom: 1px solid var(--line-soft); font-size: .875rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline__when { display: block; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

details.disclosure { border-top: 1px solid var(--line-soft); padding-top: .85rem; margin-top: .85rem; }
details.disclosure summary { cursor: pointer; font-weight: 700; color: var(--gold); min-height: 44px; display: flex; align-items: center; font-size: .9375rem; }
details.disclosure[open] summary { margin-bottom: .5rem; }

/* ================================================================ Gallery */

.gallery { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }

.gallery__item {
	background: var(--card);
	border: 1px solid var(--line-soft);
	border-radius: var(--radius);
	overflow: hidden;
	text-align: center;
}

.gallery__thumb {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	background: var(--plum);
	position: relative;
	overflow: hidden;
}

.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.gallery__fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	gap: .4rem;
	width: 100%;
	height: 100%;
	color: var(--muted);
	font-size: .75rem;
	font-weight: 700;
}

.gallery__fallback svg { width: 1.5rem; height: 1.5rem; opacity: .6; }
.gallery__body { padding: .6rem .7rem .75rem; }
.gallery__name { margin: 0; font-weight: 700; font-size: .8125rem; line-height: 1.35; }
.gallery__meta { margin: .15rem 0 0; font-size: .7rem; color: var(--muted); }
.gallery__body a { font-size: .75rem; }

/* ================================================================ Scanner */

.scanner {
	position: relative;
	border-radius: var(--radius-lg);
	overflow: hidden;
	background: #000;
	aspect-ratio: 4 / 3;
	margin-bottom: 1rem;
}

#video { width: 100%; height: 100%; object-fit: cover; display: block; }

.scanner__frame {
	position: absolute;
	inset: 14% 11%;
	border: 3px solid rgba(244, 211, 94, .9);
	border-radius: var(--radius);
	box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4);
}

.result { margin-bottom: 1rem; }

.result__card {
	border-radius: var(--radius-lg);
	padding: 1.5rem 1.35rem;
	border: 1px solid;
	border-left-width: 8px;
	background: var(--card);
}

.result__card.ok { border-color: var(--ok); background: rgba(74, 222, 128, .1); }
.result__card.duplicate, .result__card.unpaid { border-color: var(--warn); background: rgba(251, 191, 36, .1); }
.result__card.cancelled, .result__card.unknown { border-color: var(--bad); background: rgba(248, 113, 113, .1); }
.result__card.undone { border-color: var(--muted); }

.result__status { margin: 0 0 .3rem; font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.result__card.ok .result__status { color: var(--ok); }
.result__card.duplicate .result__status, .result__card.unpaid .result__status { color: var(--warn); }
.result__card.cancelled .result__status, .result__card.unknown .result__status { color: var(--bad); }
.result__name { margin: 0; font-size: 1.75rem; font-weight: 800; line-height: 1.15; }
.result__meta, .result__msg { margin: .3rem 0 0; }
.result__msg { font-weight: 600; }
.result__flag { margin: .7rem 0 0; padding: .55rem .8rem; background: rgba(255, 255, 255, .07); border-radius: .5rem; font-weight: 700; font-size: .9375rem; }
.result__actions { margin-top: 1rem; }

/* =================================================================== Bars */

.bar { display: grid; grid-template-columns: 3.5rem 1fr auto; gap: .6rem; align-items: center; margin-bottom: .4rem; font-size: .8125rem; }
.bar__label { color: var(--muted); }
.bar__track { background: var(--plum); border-radius: 999px; height: .55rem; overflow: hidden; }
.bar__fill { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.bar__value { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.check-row { display: flex; gap: .75rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px solid var(--line-soft); }
.check-row:last-child { border-bottom: 0; }
.check-row strong { display: block; }
.check-dot { width: .65rem; height: .65rem; border-radius: 50%; flex: none; margin-top: .45rem; }
.check-dot.is-ok { background: var(--ok); }
.check-dot.is-bad { background: var(--bad); }
.check-fix { display: block; margin-top: .2rem; color: var(--warn); font-size: .8125rem; }

.footnote { text-align: center; padding: 0 1rem 2rem; }
.footnote p { margin: 0; font-size: .75rem; color: var(--muted); }

code { background: rgba(255, 255, 255, .07); padding: .1rem .35rem; border-radius: .25rem; font-size: .85em; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============================================================
   Native controls
   Browsers draw their own select and checkbox unless told not to,
   which is why the status dropdown arrived white on a dark page.
   ============================================================ */

select,
.field select,
.filters select {
	-webkit-appearance: none;
	appearance: none;
	background-color: var(--plum);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B5A7C2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right .8rem center;
	background-size: 1.05rem;
	padding-right: 2.5rem;
	color: var(--text);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	min-height: 48px;
	font: inherit;
	font-size: 16px;
}

select option { background: var(--plum); color: var(--text); }

input[type="checkbox"],
input[type="radio"] { accent-color: var(--gold); }

/* A radio label needs the text to sit beside the control, not fused to it. */
.check span > strong + .muted,
.check span.muted { display: block; }
.check--inline { align-items: center; }

/* =============================================================== Status */

.status { display: grid; gap: .5rem; }

.status__row {
	display: flex;
	align-items: center;
	gap: .7rem;
	padding: .6rem .85rem;
	background: var(--plum);
	border: 1px solid var(--line-soft);
	border-radius: var(--radius);
	font-size: .875rem;
}

.status__dot {
	width: .6rem;
	height: .6rem;
	border-radius: 50%;
	flex: none;
	box-shadow: 0 0 0 3px rgba(255, 255, 255, .05);
}

.status__dot.is-up { background: var(--ok); }
.status__dot.is-warn { background: var(--warn); }
.status__dot.is-down { background: var(--bad); }
.status__dot.is-idle { background: var(--muted); }

.status__name { font-weight: 600; }
.status__note { margin-left: auto; color: var(--muted); font-size: .8125rem; text-align: right; }

.status-strip {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
	align-items: center;
	padding: .6rem .9rem;
	margin-bottom: 1.25rem;
	background: var(--card);
	border: 1px solid var(--line-soft);
	border-radius: 999px;
	font-size: .8125rem;
}

.status-strip__item { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); }
.status-strip__more { margin-left: auto; }

/* =============================================================== Footer */

.sitefoot {
	margin-top: 3rem;
	padding: 1.5rem 1rem 2.5rem;
	border-top: 1px solid var(--line-soft);
	text-align: center;
}

.sitefoot__brand { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: .6rem; }
.sitefoot__logo { width: 2rem; height: 2rem; border-radius: 50%; object-fit: cover; }
.sitefoot__name { font-family: "Playfair Display", Georgia, serif; font-size: 1rem; color: var(--text); }
.sitefoot p { margin: .15rem 0; font-size: .75rem; color: var(--muted); }
.sitefoot a { color: var(--muted); text-decoration: underline; }
.sitefoot a:hover { color: var(--gold); }

/* ================================================================ Login */

.auth { max-width: 24rem; margin: 0 auto; padding: 3rem 1rem 4rem; }
.auth__mark { display: block; width: 5rem; height: 5rem; margin: 0 auto 1.25rem; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow); }

.auth__fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 5rem;
	height: 5rem;
	margin: 0 auto 1.25rem;
	border-radius: 50%;
	background: rgba(244, 211, 94, .14);
	color: var(--gold);
}

.auth__fallback svg { width: 2.2rem; height: 2.2rem; }
.auth__title { text-align: center; margin: 0 0 .3rem; font-size: 1.5rem; }
.auth__sub { text-align: center; color: var(--muted); font-size: .875rem; margin: 0 0 1.75rem; }
.auth__foot { text-align: center; margin-top: 1.25rem; font-size: .8125rem; }

/* ============================================================
   Guards

   A layout should never be destroyed by one image missing a rule.
   ============================================================ */

img, svg, video { max-width: 100%; }
img { height: auto; }

.topbar__mark { width: 2rem; height: 2rem; flex: none; object-fit: cover; border-radius: 50%; }
.sitefoot__logo { width: 2.25rem; height: 2.25rem; flex: none; object-fit: cover; border-radius: 50%; }
.auth__mark { width: 5.5rem; height: 5.5rem; flex: none; object-fit: cover; border-radius: 50%; }

/* ============================================================
   Edit drawer

   Editing slides in from the right rather than pushing the list
   down the page. Built on the URL, so it survives a refresh and
   works with the back button — and without JavaScript.
   ============================================================ */

.drawer {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 60;
	width: min(34rem, 100vw);
	background: var(--plum);
	border-left: 1px solid var(--line);
	box-shadow: -20px 0 50px rgba(0, 0, 0, .45);
	display: flex;
	flex-direction: column;
	animation: drawer-in 220ms cubic-bezier(.2, .8, .2, 1);
}

@keyframes drawer-in {
	from { transform: translateX(100%); }
	to { transform: none; }
}

.drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.1rem 1.35rem;
	padding-top: calc(1.1rem + env(safe-area-inset-top));
	border-bottom: 1px solid var(--line-soft);
	flex: none;
}

.drawer__title { margin: 0; font-size: 1.05rem; font-weight: 700; }
.drawer__sub { margin: .15rem 0 0; font-size: .8125rem; color: var(--muted); }

.drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	flex: none;
	border-radius: var(--radius);
	border: 1px solid var(--line);
	color: var(--muted);
	text-decoration: none;
}

.drawer__close:hover { color: var(--text); border-color: var(--gold); background: var(--card); }
.drawer__close svg { width: 1.1rem; height: 1.1rem; }

.drawer__body {
	padding: 1.35rem;
	padding-bottom: calc(1.35rem + env(safe-area-inset-bottom));
	overflow-y: auto;
	overscroll-behavior: contain;
	flex: 1;
}

.drawer__body .card { background: transparent; border: 0; padding: 0; margin: 0; }

.drawer-scrim {
	position: fixed;
	inset: 0;
	z-index: 55;
	background: rgba(0, 0, 0, .6);
	animation: fade-in 220ms ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 640px) {
	.drawer { width: 100vw; border-left: 0; }
}

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

/* ============================================================
   Breadcrumbs
   ============================================================ */

.crumbs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .4rem;
	margin: 0 0 1rem;
	font-size: .8125rem;
	color: var(--muted);
}

.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--gold); text-decoration: underline; }
.crumbs__sep { opacity: .5; }
.crumbs__here { color: var(--text); font-weight: 600; }

/* ============================================================
   Mobile
   ============================================================ */

@media (max-width: 640px) {
	.content { padding: 1rem .85rem 3.5rem; }
	.page-head h1 { font-size: 1.3rem; }
	.stats { gap: .45rem; }
	.stat { padding: .75rem .5rem; }
	.stat__num { font-size: 1.35rem; }
	.stat--money .stat__num { font-size: 1.05rem; }
	.card { padding: 1.1rem; border-radius: .85rem; }
	.btn { width: 100%; }
	.btn--sm { width: auto; }
	.btn-row { flex-direction: column; align-items: stretch; }
	.btn-row .btn--sm { width: 100%; }
	.person { flex-direction: column; gap: .5rem; }
	.hit { flex-wrap: wrap; }
	.table th, .table td { padding: .5rem .4rem; font-size: .8125rem; }
	.status__note { width: 100%; text-align: left; margin-left: 0; }
	.status__row { flex-wrap: wrap; }
}

/* Tables that cannot shrink get a hint that they scroll. */
.table-wrap { -webkit-overflow-scrolling: touch; }

@media (max-width: 640px) {
	.table-wrap::after {
		content: "Scroll sideways for more";
		display: block;
		padding: .5rem 0 0;
		font-size: .7rem;
		color: var(--muted);
		text-align: center;
	}
}

/* ============================================================
   Field selector fix

   `input[type="text"]` does not match `<input name="x">`. An input
   with no type attribute defaults to text behaviourally but has no
   type to match on, so those fields fell through to browser
   defaults — white boxes on a dark page.

   Matching the element and excluding the types that genuinely need
   different treatment is the reliable way round it.
   ============================================================ */

.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]),
.drawer input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]),
.card input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]),
.field select,
.field textarea,
.card select,
.card textarea,
.drawer select,
.drawer textarea,
input.search {
	width: 100%;
	min-height: 48px;
	padding: .65rem .85rem;
	background: var(--plum);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	color: var(--text);
	font: inherit;
	font-size: 16px;
	-webkit-appearance: none;
	appearance: none;
}

.field textarea,
.card textarea,
.drawer textarea { min-height: 7rem; line-height: 1.6; resize: vertical; padding-top: .75rem; }

.field select,
.card select,
.drawer select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B5A7C2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right .85rem center;
	background-size: 1.05rem;
	padding-right: 2.6rem;
}

.field input::placeholder,
.field textarea::placeholder,
.drawer input::placeholder,
.drawer textarea::placeholder { color: var(--muted); opacity: .75; }

.field input:focus,
.field select:focus,
.field textarea:focus,
.drawer input:focus,
.drawer select:focus,
.drawer textarea:focus,
input.search:focus {
	outline: none;
	border-color: var(--gold);
	box-shadow: 0 0 0 3px rgba(244, 211, 94, .18);
}

/* Checkboxes get a consistent size, since browsers vary a lot. */
input[type="checkbox"],
input[type="radio"] {
	width: 20px;
	height: 20px;
	accent-color: var(--gold);
	flex: none;
}

input[type="file"] {
	width: 100%;
	padding: .6rem;
	background: var(--plum);
	border: 1px dashed var(--line);
	border-radius: var(--radius);
	color: var(--muted);
	font: inherit;
	font-size: .875rem;
}

/* ---------------------------------------------- Drawer exit animation */

.drawer.is-closing { animation: drawer-out 200ms cubic-bezier(.4, 0, .8, .4) forwards; }
.drawer-scrim.is-closing { animation: fade-out 200ms ease forwards; }

@keyframes drawer-out {
	from { transform: none; }
	to { transform: translateX(100%); }
}

@keyframes fade-out {
	from { opacity: 1; }
	to { opacity: 0; }
}

/* ============================================================
   Landing page
   ============================================================ */

.landing {
	position: relative;
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* A slow gradient wash rather than a photograph: it loads instantly,
   never crops badly, and does not compete with the wordmark. */
.landing::before {
	content: "";
	position: absolute;
	inset: 0;
	background:
		radial-gradient(60rem 40rem at 15% -10%, rgba(109, 59, 140, .55), transparent 60%),
		radial-gradient(45rem 35rem at 95% 10%, rgba(244, 211, 94, .12), transparent 60%),
		radial-gradient(50rem 40rem at 50% 110%, rgba(109, 59, 140, .35), transparent 60%);
	pointer-events: none;
}

.landing__bar {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1.1rem 1.5rem;
	padding-top: calc(1.1rem + env(safe-area-inset-top));
}

.landing__brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--text); }
.landing__brand img { width: 2.5rem; height: 2.5rem; border-radius: 50%; object-fit: cover; }
.landing__brandname { font-family: "Playfair Display", Georgia, serif; font-size: 1.05rem; font-weight: 700; }
.landing__nav { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

.landing__inner {
	position: relative;
	z-index: 2;
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 2.5rem 1.5rem 3.5rem;
	max-width: 46rem;
	margin: 0 auto;
}

.landing__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	padding: .4rem 1rem;
	margin-bottom: 1.75rem;
	border: 1px solid rgba(244, 211, 94, .35);
	border-radius: 999px;
	background: rgba(244, 211, 94, .08);
	font-size: .7rem;
	font-weight: 800;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--gold);
}

.landing__eyebrow svg { width: .85rem; height: .85rem; }

.landing__mark {
	width: 8rem;
	height: 8rem;
	border-radius: 50%;
	object-fit: cover;
	margin: 0 auto 2rem;
	box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
}

.landing__title {
	font-family: "Playfair Display", Georgia, serif;
	font-weight: 700;
	font-size: clamp(2.25rem, 1.4rem + 4vw, 3.75rem);
	line-height: 1.08;
	margin: 0 0 .5rem;
	color: #fff;
}

.landing__accent { display: block; color: var(--gold); }

.landing__verse {
	margin: 1.5rem auto 0;
	max-width: 32rem;
	font-family: "Playfair Display", Georgia, serif;
	font-size: 1.15rem;
	line-height: 1.55;
	color: rgba(255, 255, 255, .88);
}

.landing__cite {
	display: block;
	margin-top: .6rem;
	font-family: "Libre Franklin", sans-serif;
	font-size: .7rem;
	font-weight: 700;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--gold);
}

.landing__lede { margin: 1.75rem auto 2.25rem; max-width: 34rem; font-size: 1.0625rem; line-height: 1.7; color: var(--muted); }
.landing__actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; }
.landing__actions .btn { min-width: 12rem; }

.landing__cards {
	position: relative;
	z-index: 2;
	display: grid;
	gap: .85rem;
	grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
	max-width: 46rem;
	margin: 0 auto;
	padding: 0 1.5rem 3rem;
}

.landing__card {
	padding: 1.25rem;
	background: rgba(54, 43, 67, .6);
	border: 1px solid var(--line-soft);
	border-radius: var(--radius-lg);
	backdrop-filter: blur(6px);
	text-align: left;
}

.landing__card h2 { margin: .6rem 0 .3rem; font-size: .95rem; }
.landing__card p { margin: 0; font-size: .8125rem; line-height: 1.6; color: var(--muted); }

.landing__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 50%;
	background: rgba(244, 211, 94, .12);
	color: var(--gold);
}

.landing__icon svg { width: 1.05rem; height: 1.05rem; }

.landing__foot {
	position: relative;
	z-index: 2;
	padding: 1.5rem 1.5rem calc(2rem + env(safe-area-inset-bottom));
	border-top: 1px solid var(--line-soft);
	text-align: center;
}

.landing__foot p { margin: .2rem 0; font-size: .75rem; color: var(--muted); }

@media (max-width: 640px) {
	.landing__bar { padding: .9rem 1rem; }
	.landing__brandname { font-size: .95rem; }
	.landing__mark { width: 6rem; height: 6rem; }
	.landing__actions .btn { width: 100%; }
	.landing__nav .btn { min-height: 42px; padding: .5rem 1rem; font-size: .8125rem; }
}
