/* The management dashboard. Desktop-first, the mirror image of the field screens:
   a wide table beats a stack of cards when the job is scanning twenty rows for the
   one that is wrong. */

.page-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--s-3);
	margin-bottom: var(--s-5);
}

.page-head h1 {
	font-size: var(--fs-2xl);
}

/* Let the heading block shrink instead of pushing the action onto its own line: a
   long subtitle otherwise sets the minimum width of the whole row. */
.page-head > div {
	min-width: 0;
}

/* A table is the one thing that genuinely cannot reflow to 375px. Let it scroll
   inside its own box rather than pushing the whole page sideways. */
.table-scroll {
	overflow-x: auto;
	margin-bottom: var(--s-5);
	border: 1px solid var(--c-border);
	border-radius: var(--radius-lg);
	background: var(--c-surface);
}

.table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--fs-sm);
}

.table th,
.table td {
	padding: var(--s-2) var(--s-3);
	text-align: left;
	vertical-align: middle;
	border-bottom: 1px solid var(--c-border);
	white-space: nowrap;
}

.table thead th {
	white-space: normal;
	vertical-align: bottom;
	position: sticky;
	top: 0;
	z-index: 1;
	background: var(--c-surface-sunken);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--c-text-muted);
}

.table tbody tr:last-child td {
	border-bottom: 0;
}

.table tbody tr:hover {
	background: var(--c-primary-subtle);
}

.table__number {
	text-align: right;
}

/* Deactivated rows stay visible — they answer "who was on the team in February?" —
   but recede, so a scan for a live account does not stop on them. */
.table__row--muted td {
	color: var(--c-text-muted);
}

.table__actions {
	display: flex;
	gap: var(--s-2);
	justify-content: flex-end;
}

.fieldset {
	padding: var(--s-4);
	border: 1px solid var(--c-border);
	border-radius: var(--radius-lg);
	background: var(--c-surface);
}

.fieldset legend {
	padding: 0 var(--s-2);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--c-text-muted);
}

/* A secondary action next to a primary one: same size and hit area, less shouting. */
.btn--quiet {
	background: transparent;
	border: 1px solid var(--c-border-strong);
	color: var(--c-primary);
	font-weight: 600;
}

.btn--quiet:hover {
	background: var(--c-surface-sunken);
	color: var(--c-primary-hover);
}


/* --- Filters ------------------------------------------------------------- */

/* Tabs in all but name. Which set you are looking at has to be readable without
   reading — a manager lands here dozens of times a week. */
.filters {
	display: flex;
	gap: var(--s-1);
	margin-bottom: var(--s-4);
	border-bottom: 1px solid var(--c-border);
}

.filters__item {
	display: inline-flex;
	align-items: center;
	gap: var(--s-2);
	padding: var(--s-2) var(--s-3);
	margin-bottom: -1px;
	border: 1px solid transparent;
	border-bottom: 2px solid transparent;
	color: var(--c-text-muted);
	font-size: var(--fs-sm);
	font-weight: 600;
	text-decoration: none;
}

.filters__item:hover {
	color: var(--c-text);
	text-decoration: none;
}

.filters__item--on {
	border-bottom-color: var(--c-primary);
	color: var(--c-primary);
}

.filters__count {
	padding: 0 var(--s-2);
	border-radius: 999px;
	background: var(--c-surface-sunken);
	font-size: 0.75rem;
	font-weight: 700;
}

.filters__item--on .filters__count {
	background: var(--c-primary-subtle);
	color: var(--c-primary);
}

/* --- Desktop tables ------------------------------------------------------ */

/* Proportional columns rather than content-width ones: the header row should not
   jump sideways when a long email address arrives. */
.table--fixed {
	table-layout: fixed;
}

.table--fixed th:nth-child(1) { width: 18%; }
.table--fixed th:nth-child(2) { width: 22%; }
.table--fixed th:nth-child(3) { width: 8%; }
.table--fixed th:nth-child(4) { width: 12%; }
.table--fixed th:nth-child(5) { width: 12%; }
.table--fixed th:nth-child(6) { width: 8%; }
/* The rest goes to the actions column — enough for both buttons at their widest.
   A flex row with justify-content:flex-end overflows *leftwards* when it runs out of
   room, straight over the status badge, which is how this was first noticed. */

.table--fixed td:nth-child(1),
.table--fixed td:nth-child(2) {
	overflow: hidden;
	text-overflow: ellipsis;
}

.table__actions-head {
	text-align: right;
}

.table__empty {
	padding: var(--s-6);
	text-align: center;
	color: var(--c-text-muted);
}

/* Every row carries the same two buttons, so they are quiet and small — a wall of
   blue down the right-hand side would compete with the data. */
.row-actions {
	display: flex;
	gap: var(--s-2);
	justify-content: flex-end;
}

.btn--sm {
	min-height: 2rem;
	padding: 0 var(--s-3);
	font-size: var(--fs-sm);
}

/* --- Forms --------------------------------------------------------------- */

/* A form does not want the full width of a laptop: the eye should not have to travel
   across empty space between a label and its input. */
.form-page {
	max-width: 34rem;
}

.form-page .card {
	margin-bottom: var(--s-4);
}

/* Two fields that belong together, side by side above 40rem. */
.field-grid {
	display: grid;
	gap: var(--s-3);
}

@media (min-width: 40rem) {
	.field-grid {
		grid-template-columns: 1fr 1fr;
	}
}

/* Facts about an existing person: read-only, quiet, and not pretending to be a form. */
.meta-list {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: var(--s-1) var(--s-4);
	margin-bottom: var(--s-4);
	padding: var(--s-3) var(--s-4);
	background: var(--c-surface-sunken);
	border-radius: var(--radius-lg);
	font-size: var(--fs-sm);
}

.meta-list dt {
	color: var(--c-text-muted);
}

.meta-list dd {
	margin: 0;
	font-variant-numeric: tabular-nums;
}

/* The role radios read as a list of sentences, not a row of dots. */
.field--radio ul,
.form-page ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.form-page li label {
	display: flex;
	align-items: baseline;
	gap: var(--s-2);
	padding: var(--s-1) 0;
	font-weight: 400;
}


/* --- Reference data hub --------------------------------------------------- */

.cards {
	display: grid;
	gap: var(--s-3);
	grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}

.card--link {
	display: block;
	color: inherit;
	text-decoration: none;
	transition: border-color 120ms, box-shadow 120ms;
}

.card--link:hover {
	color: inherit;
	border-color: var(--c-primary);
	box-shadow: var(--shadow-lg);
	text-decoration: none;
}

.card__count {
	margin-top: var(--s-3);
	font-weight: 700;
}

/* A path back up, for screens two levels deep. The dashboard nav only reaches the
   hub, and a list of resorts is one further in. */
.crumbs {
	display: flex;
	align-items: center;
	gap: var(--s-2);
	margin-bottom: var(--s-3);
	font-size: var(--fs-sm);
	color: var(--c-text-muted);
}


/* --- Position list -------------------------------------------------------- */

/* Filters wrap rather than scroll: on a laptop they fill one line, on a narrow
   window they stack, and nothing is ever hidden behind a horizontal scrollbar. */
.filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--s-2);
	padding: var(--s-3);
	margin-bottom: var(--s-4);
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	border-radius: var(--radius-lg);
}

.filter-bar select,
.filter-bar input[type="search"] {
	width: auto;
	min-height: 2.25rem;
	padding: var(--s-1) var(--s-2);
	font-size: var(--fs-sm);
}

/* The search box gets the room; the selects size to their content. */
.filter-bar__search {
	flex: 1 1 18rem;
}

.filter-bar__search input {
	width: 100%;
}

/* Sits above the table so the count and the action are where the eye already is
   after ticking a row. */
.bulk-bar {
	display: flex;
	align-items: center;
	gap: var(--s-3);
	min-height: 2.5rem;
	margin-bottom: var(--s-2);
}

.table__pick {
	width: 2.5rem;
	text-align: center;
}

.table__pick input {
	width: 1.1rem;
	height: 1.1rem;
	min-height: 0;
}

.table__sortable a {
	display: inline-flex;
	align-items: center;
	gap: var(--s-1);
	color: inherit;
	text-decoration: none;
	white-space: nowrap;
}

.table__sortable a:hover {
	color: var(--c-primary);
}

.table__sortable--on {
	color: var(--c-primary);
}

.pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--s-3);
	margin-bottom: var(--s-6);
}

.pagination__where {
	font-size: var(--fs-sm);
	color: var(--c-text-muted);
}

/* --- Position detail ------------------------------------------------------ */

.detail-grid {
	display: grid;
	gap: var(--s-3);
	margin-bottom: var(--s-5);
	grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
}

.detail-grid .meta-list {
	background: transparent;
	padding: 0;
}

.reports h2 {
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--c-text-muted);
	margin-bottom: var(--s-3);
}

/* One card per report, newest first — the answer to "why is this still open?". */
.report-card {
	padding: var(--s-4);
	margin-bottom: var(--s-3);
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	border-radius: var(--radius-lg);
}

.report-card__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--s-3);
	margin-bottom: var(--s-2);
}

.photo-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
	gap: var(--s-2);
	margin-top: var(--s-3);
	list-style: none;
	padding: 0;
}

.photo-gallery img {
	width: 100%;
	/* `height: auto` is load-bearing, not tidiness. The <img> carries width and
	   height attributes so the row does not jump while the photo loads, and those
	   map to CSS as presentational hints. A hint only loses to a real rule on the
	   same property — nothing here set `height`, so `height: 900px` survived and
	   `aspect-ratio` was ignored, because it applies only when height is auto. The
	   result was a 160×900 sliver of one photo. */
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: var(--radius);
	background: var(--c-surface-sunken);
}

.plain-list {
	list-style: none;
	margin: var(--s-2) 0 0;
	padding: 0;
	font-size: var(--fs-sm);
}

.plain-list li {
	padding: var(--s-1) 0;
	border-bottom: 1px solid var(--c-border);
}

.text-danger {
	color: var(--c-danger);
	font-weight: 600;
}


/* --- Week dashboard ------------------------------------------------------- */

.counters {
	display: grid;
	gap: var(--s-3);
	margin-bottom: var(--s-5);
	grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

/* A coloured edge rather than a coloured card: four saturated blocks across the top
   of a screen compete with the data underneath, and the point of the colour is only
   to say which number is the worrying one. */
.counter {
	position: relative;
	background: var(--c-surface);
	border: 1px solid var(--c-border);
	border-left: 4px solid var(--c-border-strong);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow);
}

.counter--danger { border-left-color: var(--c-danger); }
.counter--success { border-left-color: var(--c-success); }
.counter--warning { border-left-color: var(--c-warning); }
.counter--info { border-left-color: var(--c-primary); }
.counter--muted { border-left-color: var(--c-border-strong); }

.counter__peek {
	display: block;
	padding: var(--s-3) var(--s-4);
	color: inherit;
	text-decoration: none;
}

.counter__peek:hover {
	color: inherit;
	text-decoration: none;
	background: var(--c-primary-subtle);
	border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.counter__label {
	display: block;
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--c-text-muted);
}

.counter__value {
	display: block;
	font-size: 2rem;
	font-weight: 700;
	line-height: 1.15;
}

.counter__note {
	display: block;
	font-size: var(--fs-sm);
	color: var(--c-text-muted);
}

/* Its own target, in the corner, because it does something different from the card:
   the card peeks, this leaves. */
.counter__arrow {
	position: absolute;
	top: var(--s-2);
	right: var(--s-3);
	padding: 0 var(--s-1);
	color: var(--c-text-muted);
	text-decoration: none;
	font-size: var(--fs-lg);
	line-height: 1;
}

.counter__arrow:hover {
	color: var(--c-primary);
	text-decoration: none;
}

/* Two columns on a laptop, not three: these panels are lists of sentences, and a
   third column narrows each one to the point where every line wraps. */
.week-grid {
	display: grid;
	gap: var(--s-3);
	margin-bottom: var(--s-3);
	grid-template-columns: repeat(auto-fit, minmax(30rem, 1fr));
	/* Each panel is its own height. Stretching them to match the tallest in the row
	   left a short list sitting in an acre of white while the reader scrolled past
	   nothing. */
	align-items: start;
}

.week-grid .card__title,
.card__title {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--s-3);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--c-text-muted);
	margin-bottom: var(--s-3);
}

.card__more {
	font-size: var(--fs-sm);
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
	white-space: nowrap;
}

/* One row in a panel: an id, a body that takes the slack, and a tail that does not
   wrap. Used by three of the four panels, so they line up with each other. */
.line {
	display: flex;
	align-items: baseline;
	gap: var(--s-3);
	padding: var(--s-2) 0;
	border-bottom: 1px solid var(--c-border);
	color: inherit;
	text-decoration: none;
}

.line:last-child {
	border-bottom: 0;
}

.line:hover {
	color: inherit;
	text-decoration: none;
	background: var(--c-primary-subtle);
}

.line__id {
	flex: none;
	font-weight: 700;
	font-size: var(--fs-sm);
}

.line__body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.line__tail {
	flex: none;
	display: flex;
	align-items: center;
	gap: var(--s-2);
}

.bar-row {
	display: grid;
	grid-template-columns: 8rem 1fr 3.5rem;
	align-items: center;
	gap: var(--s-3);
	padding: var(--s-1) 0;
	font-size: var(--fs-sm);
}

.bar-row__track {
	height: 6px;
	border-radius: 999px;
	background: var(--c-surface-sunken);
	overflow: hidden;
}

.bar-row__fill {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: var(--c-primary);
}

.bar-row__value {
	text-align: right;
	font-weight: 600;
}

/* --- Submit matrix -------------------------------------------------------- */

/* Seven columns per person: somebody who stopped submitting on Wednesday is a gap you
   see, rather than a number you have to work out. */
.submit-matrix__day {
	text-align: center;
	width: 4.5rem;
}

.submit-matrix__day span {
	display: block;
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
}

.submit-matrix__cell {
	text-align: center;
	font-size: var(--fs-lg);
	line-height: 1;
}

.submit-matrix__cell--submitted { color: var(--c-success); }
.submit-matrix__cell--reopened { color: var(--c-warning); }
.submit-matrix__cell--draft { color: var(--c-text-muted); }

/* --- Drill-down dialog ---------------------------------------------------- */

.drill {
	width: min(56rem, 92vw);
	max-height: 86vh;
	padding: 0;
	border: 0;
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-lg);
	background: var(--c-surface);
	color: var(--c-text);
}

.drill::backdrop {
	background: rgb(20 24 28 / 0.45);
}

.drill__inner {
	position: relative;
	padding: var(--s-5);
	max-height: 86vh;
	overflow-y: auto;
}

.drill h2 {
	font-size: var(--fs-xl);
	margin-bottom: var(--s-4);
	padding-right: var(--s-6);
}

.drill__close {
	position: absolute;
	top: var(--s-3);
	right: var(--s-3);
	display: grid;
	place-items: center;
	width: var(--tap-min);
	height: var(--tap-min);
	border-radius: var(--radius);
	background: transparent;
	font-size: var(--fs-xl);
	line-height: 1;
	cursor: pointer;
}

.drill__close:hover {
	background: var(--c-surface-sunken);
}

/* Says which slice of the data is on screen when somebody arrives from elsewhere. */
.scope-banner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--s-3);
	padding: var(--s-2) var(--s-3);
	margin-bottom: var(--s-3);
	background: var(--c-primary-subtle);
	border-radius: var(--radius);
	font-size: var(--fs-sm);
}
