/* ==========================================================
   Ritu Kumar Admin - application styles

   Additions on top of the design system in admin.css. Keeping them
   here means admin.css stays exactly as the design handed it over
   and can be replaced wholesale when the design changes.
   ========================================================== */

/* ---------- Replacements for inline styles ----------
   Kept here rather than on the elements so markup carries no styling. */
.rk-table-full { width: 100%; }

.confirm-dialog { max-width: 420px; }

/* The sign-in alert only shows when the server put a message in it */
.login-alert.is-shown { display: block; }

/* Being signed out is not a failure, so it is not dressed as one */
.login-alert.is-notice {
	background: var(--sand);
	color: var(--body);
	border-color: var(--gold);
}

/* ---------- Status badges ----------
   "Inactive" reads as a light red label rather than the neutral draft tone,
   so a switched-off record is obvious at a glance down the column. Tokens
   are defined per theme because the design system's own palette flips in
   dark mode; both pairs clear 6:1 contrast, which small caps at 9.5px need. */
:root {
	--badge-off-bg: #FAE4E4;
	--badge-off-text: #A23A3A;
}

:root[data-theme="dark"] {
	--badge-off-bg: #3B2224;
	--badge-off-text: #E79A9A;
}

.badge-rk.inactive {
	background: var(--badge-off-bg);
	color: var(--badge-off-text);
}

/* ---------- Sidebar submenu ---------- */
.side-nav .sub-toggle {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 10px 14px;
	border: 0;
	background: none;
	color: var(--body);
	font-family: inherit;
	font-size: 14.5px;
	text-align: left;
	border-radius: 2px;
	transition: background .3s, color .3s;
}

.side-nav .sub-toggle .fa {
	width: 16px;
	text-align: center;
	color: var(--faint);
	transition: color .3s, transform .3s var(--ease);
}

.side-nav .sub-toggle:hover { background: var(--paper); color: var(--ink); }

.side-nav .has-sub.open > .sub-toggle { color: var(--ink); }
.side-nav .has-sub.open > .sub-toggle .caret { transform: rotate(180deg); }

.side-nav .sub-toggle .caret {
	margin-left: auto;
	width: auto;
	font-size: 12px;
}

.side-nav .sub-nav {
	list-style: none;
	margin: 0;
	padding: 0 0 0 14px;
	max-height: 0;
	overflow: hidden;
	transition: max-height .35s var(--ease);
}

/* Generous, because the Media submenu lists every active category and
   there can be dozens. The cap only exists to animate the collapse; the
   sidebar itself scrolls, so the list is never cut off. */
.side-nav .has-sub.open > .sub-nav { max-height: 1600px; }

.side-nav .sub-nav a {
	font-size: 13.5px;
	padding: 8px 14px;
	border-left: 1px solid var(--line);
	border-radius: 0 2px 2px 0;
}

.side-nav .sub-nav a .fa { font-size: 12px; }
.side-nav .sub-nav a.active { border-left-color: var(--rose); }

/* ---------- DataTables, dressed as the design system ---------- */
.dt-container { font-size: 14px; }

.dt-container .dt-length,
.dt-container .dt-search { margin-bottom: 16px; }

.dt-container .dt-length label,
.dt-container .dt-search label {
	font-size: 11px;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--faint);
	margin: 0 10px 0 0;
}

.dt-container select.dt-input,
.dt-container input.dt-input {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 2px;
	color: var(--ink);
	padding: 8px 12px;
	font-family: inherit;
	font-size: 14px;
}

.dt-container input.dt-input:focus,
.dt-container select.dt-input:focus {
	outline: none;
	border-color: var(--rose);
}

.dt-container .dt-info {
	font-size: 11px;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--faint);
	padding-top: 18px;
}

.dt-container .dt-paging { padding-top: 12px; }

.dt-container .dt-paging .dt-paging-button {
	background: none;
	border: 1px solid var(--line);
	border-radius: 2px;
	color: var(--body);
	padding: 6px 12px;
	margin-left: 6px;
	font-size: 13px;
	transition: background .3s, color .3s, border-color .3s;
}

.dt-container .dt-paging .dt-paging-button:hover:not(.disabled) {
	background: var(--blush);
	border-color: var(--blush);
	color: var(--rose);
}

.dt-container .dt-paging .dt-paging-button.current {
	background: var(--rose);
	border-color: var(--rose);
	color: var(--on-rose);
}

.dt-container .dt-paging .dt-paging-button.disabled {
	color: var(--faint);
	/* Readable but clearly inactive, in both themes */
	opacity: .7;
	border-color: transparent;
	cursor: default;
}

.rk-table thead th.dt-orderable-asc,
.rk-table thead th.dt-orderable-desc { cursor: pointer; }

.rk-table thead th .dt-column-order::before,
.rk-table thead th .dt-column-order::after { color: var(--faint); }

.dt-container .dt-empty { text-align: center; color: var(--faint); padding: 32px 16px; }

/* ---------- Row selection ---------- */
.rk-table th.select,
.rk-table td.select {
	width: 40px;
	padding-right: 0;
	text-align: left;
}

.rk-table .form-check-input {
	margin: 0;
	cursor: pointer;
	border-color: var(--faint);
}

.rk-table .form-check-input:checked {
	background-color: var(--rose);
	border-color: var(--rose);
}

.rk-table .form-check-input:focus {
	border-color: var(--rose);
	box-shadow: 0 0 0 .2rem var(--blush);
}

/* A row the server will not let go: shown as a gap, not a dead control */
.rk-table .select-locked {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 1px dashed var(--line);
	border-radius: 3px;
	vertical-align: middle;
}

/* ---------- Bulk action bar ----------
   Sits between the filters and the table, appearing only once something is
   ticked, so the listing is unchanged until there is a decision to make. */
.bulk-bar {
	display: none;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 18px;
	padding: 12px 16px;
	background: var(--blush);
	border-radius: 2px;
}

.bulk-bar.is-shown { display: flex; }

.bulk-bar .count {
	font-size: 12px;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--rose);
}

.bulk-bar .acts { display: flex; gap: 10px; }

.bulk-bar .btn-line {
	background: transparent;
	border-color: rgba(var(--shadow-rgb), .15);
}

/* ---------- Table filters ----------
   A filter set sits on the table's own top row rather than in a panel of
   its own: one control does not earn a card, and keeping it beside the
   search box puts every way of narrowing the list in one place. */
/* Several filter sets sit side by side, separated by a hairline so each
   group reads as its own question */
.dt-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }

.dt-filters .filter-set + .filter-set {
	padding-left: 22px;
	border-left: 1px solid var(--line);
}

@media (max-width: 860px) {
	.dt-filters .filter-set + .filter-set { padding-left: 0; border-left: 0; }
}

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

.filter-set .scope-label { margin: 0; }

.filter-set .chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.filter-set .chip span { padding: 5px 13px; }

/* The top row carries the filters and the search box, one at each end */
.dt-container .dt-layout-row:first-child {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 20px;
	padding-bottom: 18px;
	border-bottom: 1px solid var(--line);
}

.dt-container .dt-layout-row:first-child .dt-layout-cell { margin: 0; }

/* The bottom row keeps the page size and the count together, paging opposite */
.dt-container .dt-layout-row:last-child {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.dt-container .dt-layout-row:last-child .dt-layout-cell {
	display: flex;
	align-items: center;
	gap: 18px;
	margin: 0;
}

.dt-container .dt-length,
.dt-container .dt-search,
.dt-container .dt-info { margin: 0; }

.dt-container .dt-paging { padding-top: 0; }

@media (max-width: 640px) {
	.dt-container .dt-layout-row:first-child,
	.dt-container .dt-layout-row:last-child { justify-content: flex-start; }

	/* The search grows to the panel width without pushing past it */
	.dt-container .dt-search {
		display: flex;
		align-items: center;
		gap: 10px;
		width: 100%;
	}

	.dt-container .dt-search label { flex: 0 0 auto; margin: 0; }

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

	.dt-container .dt-layout-row:last-child .dt-layout-cell { gap: 12px; }
}

/* The loading indicator: a small card over the table rather than text
   floating across the header row */
.dt-container .dt-processing {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 5;
	margin: 0;
	padding: 10px 18px;
	width: auto;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 2px;
	box-shadow: 0 10px 28px rgba(var(--shadow-rgb), .14);
	font-size: 11px;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--faint);
}

.dt-container .dt-processing div { display: none; }

.dt-container { position: relative; }

/* ---------- Two-line table cell ----------
   A primary value with its context beneath, so a row carries more detail
   without needing another column. */
.rk-table .stacked { display: flex; flex-direction: column; line-height: 1.35; }
.rk-table .stacked b { font-weight: 400; color: var(--ink); }
.rk-table .stacked small { color: var(--faint); font-size: 12px; }

/* ---------- File name cell ---------- */
.file-cell { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.file-cell .fa { color: var(--faint); width: 14px; text-align: center; }
.file-cell a { color: var(--ink); }
.file-cell a:hover { color: var(--rose); }

/* ---------- Under construction ---------- */
.under-construction { text-align: center; padding: 56px 20px; }

.under-construction .ic {
	display: inline-grid;
	place-items: center;
	width: 56px;
	height: 56px;
	margin-bottom: 18px;
	border-radius: 50%;
	background: var(--blush);
	color: var(--rose);
	font-size: 20px;
}

.under-construction .serif {
	font-family: var(--serif);
	font-size: 26px;
	color: var(--ink);
	margin-bottom: 8px;
}

.under-construction .lede { max-width: 420px; margin: 0 auto 22px; }

/* ---------- Upload progress ----------
   A large document can take minutes. The bar reports the real bytes moved,
   then switches to "Saving" once the browser has handed everything over,
   because the wait after that is the server writing to disk and has no
   percentage to report. */
.upload-progress {
	display: none;
	margin: 20px 0 4px;
	padding: 16px 18px;
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: 2px;
}

.upload-progress.is-busy { display: block; }

.upload-progress .up-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 10px;
}

.upload-progress .up-label {
	font-size: 11px;
	letter-spacing: .18em;
	text-transform: uppercase;
	color: var(--faint);
}

.upload-progress .up-pct {
	font-size: 15px;
	color: var(--ink);
	font-variant-numeric: tabular-nums;
}

.upload-progress .up-track {
	height: 4px;
	background: var(--line);
	border-radius: 30px;
	overflow: hidden;
}

.upload-progress .up-bar {
	height: 100%;
	width: 0;
	background: var(--rose);
	border-radius: 30px;
	transition: width .2s linear;
}

/* Once the bytes are sent there is nothing left to measure, so the bar
   keeps moving to show the server is still working */
.upload-progress .up-bar.is-done {
	background: linear-gradient(90deg, var(--rose) 0%, var(--gold) 50%, var(--rose) 100%);
	background-size: 200% 100%;
	animation: up-working 1.2s linear infinite;
}

@keyframes up-working {
	from { background-position: 200% 0; }
	to { background-position: 0 0; }
}

.upload-progress .up-meta {
	margin-top: 8px;
	font-size: 12px;
	color: var(--faint);
	font-variant-numeric: tabular-nums;
}

/* ---------- Form-level error ---------- */
.form-alert {
	display: none;
	margin-bottom: 18px;
	padding: 12px 16px;
	background: var(--badge-off-bg);
	color: var(--badge-off-text);
	border-left: 2px solid currentColor;
	border-radius: 2px;
	font-size: 13.5px;
}

/* ---------- Chosen files ---------- */
.selected-files {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.selected-files .sf {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 5px 12px;
	border: 1px solid var(--line);
	border-radius: 30px;
	background: var(--surface);
	font-size: 12.5px;
	color: var(--body);
}

.selected-files .sf .fa { color: var(--faint); font-size: 11px; }
.selected-files .sf small { color: var(--faint); }
.selected-files .sf.total { background: var(--blush); border-color: var(--blush); color: var(--rose); }

/* ---------- Remark history ----------
   Append-only, so it reads as a conversation rather than as editable
   content: each entry is a bubble beside its author's initial. The tint is
   tokenised per theme because the panel behind it is plain --surface, and a
   bubble the same colour as its panel is not a bubble. */
:root {
	--bubble-bg: #FBF7F4;
	--bubble-line: #EDE4DC;
}

:root[data-theme="dark"] {
	--bubble-bg: #2A2320;
	--bubble-line: #3A302A;
}

.remark-list { list-style: none; margin: 0 0 20px; padding: 0; }

.remark-list li {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: 12px;
}

.remark-list li:last-child { margin-bottom: 0; }

.remark-avatar {
	flex: none;
	width: 28px;
	height: 28px;
	margin-top: 2px;
	border-radius: 50%;
	background: var(--blush);
	color: var(--rose);
	font-size: 12px;
	line-height: 28px;
	text-align: center;
	letter-spacing: 0.02em;
}

.remark-bubble {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	padding: 10px 14px;
	border: 1px solid var(--bubble-line);
	border-radius: 2px 12px 12px 12px;
	background: var(--bubble-bg);
}

/* The tail, drawn as two triangles so the border reads through it */
.remark-bubble::before,
.remark-bubble::after {
	content: "";
	position: absolute;
	top: 9px;
	left: -7px;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 6px 7px 6px 0;
	border-color: transparent var(--bubble-line) transparent transparent;
}

.remark-bubble::after {
	left: -6px;
	border-right-color: var(--bubble-bg);
}

/* The newest remark is the one being read, so it is the one picked out */
.remark-list li:first-child .remark-avatar { background: var(--rose); color: #fff; }
.remark-list li:first-child .remark-bubble { border-color: var(--rose); }
.remark-list li:first-child .remark-bubble::before { border-right-color: var(--rose); }

.remark-list .who {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 4px;
}

.remark-list .who b { font-weight: 400; color: var(--ink); font-size: 13.5px; }
.remark-list .who time { color: var(--faint); font-size: 12px; white-space: nowrap; }

.remark-list p {
	margin: 0;
	color: var(--body);
	font-size: 13.5px;
	overflow-wrap: anywhere;
	white-space: pre-line;
}

/* Narrow column: the author and the time stop fighting for one line */
@media (max-width: 400px) {
	.remark-list .who { flex-direction: column; gap: 1px; }
}

.remark-add { border-top: 1px solid var(--line); padding-top: 16px; }

/* ---------- Category picker ---------- */
.category-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.category-picker .chip span { padding: 5px 12px; font-size: 12.5px; }

/* ---------- Attachments ---------- */
.media-list { list-style: none; margin: 0; padding: 0; }

.media-list li {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid var(--line);
}

.media-list li:last-child { border-bottom: 0; }

.media-list .ic {
	flex: 0 0 34px;
	height: 34px;
	display: grid;
	place-items: center;
	background: var(--blush);
	color: var(--rose);
	border-radius: 2px;
}

.media-list .meta { flex: 1; min-width: 0; }
.media-list .meta a { color: var(--ink); display: block; }
.media-list .meta a:hover { color: var(--rose); }
.media-list .meta small { color: var(--faint); font-size: 12px; }

/* An attached file carries a note, so its row is taller than a bare
   filename and the icon sits with the name rather than centred on both */
.media-list li.media-item { align-items: flex-start; }
.media-list li.media-item .ic { flex: 0 0 44px; height: 44px; margin-top: 2px; }
.media-list li.media-item .form-check { margin-top: 4px; white-space: nowrap; }

.media-count {
	font-size: 12px;
	color: var(--faint);
	white-space: nowrap;
}

/* ---------- Upload repeater ----------
   One row per document: the file, what it is, and a button to drop the
   row. Rows are added with the + below them. */
.upload-rows { margin-bottom: 12px; }

.upload-row {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 12px;
	padding: 12px;
	margin-bottom: 10px;
	border: 1px solid var(--line);
	border-radius: 3px;
	background: var(--bubble-bg);
}

.upload-row:last-child { margin-bottom: 0; }

/* Both fields keep a usable width and wrap onto their own line rather
   than squeezing, because the panel sits in a column that narrows */
.upload-row .ur-file { flex: 1 1 210px; min-width: 0; }
.upload-row .ur-about { flex: 2 1 230px; min-width: 0; }
.upload-row .form-label { font-size: 11px; }

.btn-row {
	flex: none;
	width: 32px;
	height: 32px;
	margin-top: 22px;
	display: grid;
	place-items: center;
	border: 1px solid var(--line);
	border-radius: 3px;
	background: var(--surface);
	color: var(--body);
	font-size: 12px;
	transition: color .15s, border-color .15s;
}

.btn-row:hover:not(:disabled) { color: var(--rose); border-color: var(--rose); }
.btn-row:disabled { opacity: .35; cursor: not-allowed; }

/* Pushed to the end of the row, so it stays at the right edge once the
   two fields have wrapped onto their own lines */
.upload-row .btn-row { margin-left: auto; }

/* What was chosen, shown before it is sent */
.ur-preview {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 8px;
	min-width: 0;
}

.ur-preview:empty { display: none; }

.ur-preview .up-thumb {
	flex: none;
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 2px;
	background: var(--surface);
	color: var(--faint);
}

.ur-preview .up-thumb img,
.ur-preview .up-thumb canvas {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* While the picture is being decoded: the box is already the right size,
   so nothing moves when it arrives */
.ur-preview .up-thumb.is-loading {
	position: relative;
	color: transparent;
}

.ur-preview .up-thumb.is-loading::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(100deg, var(--bubble-bg) 30%, var(--line) 50%, var(--bubble-bg) 70%);
	background-size: 300% 100%;
	animation: rk-shimmer 1.1s ease-in-out infinite;
}

@keyframes rk-shimmer {
	from { background-position: 150% 0; }
	to { background-position: -50% 0; }
}

@media (prefers-reduced-motion: reduce) {
	.ur-preview .up-thumb.is-loading::after { animation: none; }
}

.ur-preview .up-meta { min-width: 0; line-height: 1.35; }

.ur-preview .up-name {
	display: block;
	font-size: 12.5px;
	color: var(--ink);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ur-preview small { color: var(--faint); font-size: 11.5px; }
.ur-preview .up-more { color: var(--rose); }

/* An attached image shows itself rather than a generic icon */
.media-list .ic-thumb {
	overflow: hidden;
	padding: 0;
	background: var(--surface);
	border: 1px solid var(--line);
}

.media-list .ic-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* ---------- Card listing ----------
   The grid listing from the design, with the pieces a server-rendered
   page needs: a header row, selection and paging. */
.grid-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 18px;
}

.grid-tools { display: flex; align-items: center; gap: 10px; }
.grid-tools .btn-sm { white-space: nowrap; }

/* A chip that holds a tick rather than a radio */
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { padding: 5px 12px; font-size: 12.5px; }
.chip-check input:checked + span { background: var(--blush); border-color: var(--rose); color: var(--rose); }

/* The card's own tick. Always visible, unlike the hover actions: a person
   selecting several needs to see what is already ticked. It sits on the
   left because the edit and delete buttons stack down the right, and on a
   touch screen those are always on show. */
.pcard-select {
	position: absolute;
	z-index: 2;
	top: 12px;
	left: 12px;
	margin: 0;
	cursor: pointer;
}

.pcard-select input { position: absolute; opacity: 0; width: 0; height: 0; }

.pcard-select span {
	display: block;
	width: 22px;
	height: 22px;
	border: 1px solid var(--line);
	border-radius: 3px;
	background: rgba(var(--paper-rgb), .95);
	transition: background .15s, border-color .15s;
}

.pcard-select span::after {
	content: "\f00c";
	font-family: FontAwesome;
	font-size: 11px;
	line-height: 20px;
	display: block;
	text-align: center;
	color: transparent;
}

.pcard-select input:checked + span { background: var(--rose); border-color: var(--rose); }
.pcard-select input:checked + span::after { color: var(--on-rose); }
.pcard-select input:focus-visible + span { outline: 2px solid var(--rose); outline-offset: 2px; }

.pcard.is-selected { box-shadow: 0 0 0 2px var(--rose); }

.pcard-categories {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin: 12px 0 0;
	padding-top: 12px;
	border-top: 1px solid var(--line);
}

.pcard-remarks { font-size: 12px; color: var(--faint); margin-left: auto; white-space: nowrap; }

/* ---------- Paging ----------
   Square, quiet, and only the current page in rose. The markup is our own
   (x-pagination), so nothing here is undoing a framework's layout. */
.grid-pager {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid var(--line);
}

.pager-range {
	margin: 0;
	font-size: 11px;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--faint);
}

.grid-pager .pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.grid-pager .page-link {
	display: block;
	min-width: 34px;
	padding: 6px 10px;
	border: 1px solid var(--line);
	border-radius: 2px;
	background: var(--surface);
	color: var(--body);
	font-size: 13px;
	line-height: 1.4;
	text-align: center;
	text-decoration: none;
	font-variant-numeric: tabular-nums;
	transition: color .15s, border-color .15s;
}

.grid-pager .page-link:hover { color: var(--rose); border-color: var(--rose); }
.grid-pager .active .page-link { background: var(--rose); border-color: var(--rose); color: var(--on-rose); }
.grid-pager .disabled .page-link { opacity: .4; }
.grid-pager .gap .page-link { border-color: transparent; background: none; }

@media (max-width: 575px) {
	.grid-pager { justify-content: center; }
	.pager-range { flex: 1 1 100%; text-align: center; }
}

/* ---------- Image previews ----------
   Every preview draws the small copy; the original is one click away and
   always says so, because the two look the same at this size. */
/* The file name above is a block so it takes its own line; this sits in
   the line of small print beneath it, beside the size, so it needs to beat
   that rule rather than inherit it. */
.media-list .meta small .link-original,
.link-original {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-left: 12px;
	vertical-align: baseline;
	color: var(--rose);
	font-size: 11.5px;
	text-decoration: none;
	white-space: nowrap;
}

.link-original:hover { text-decoration: underline; }
.link-original .fa { font-size: 10px; }

/* An image in a table cell, in place of the file-type icon */
.file-thumb {
	width: 28px;
	height: 28px;
	object-fit: cover;
	border: 1px solid var(--line);
	border-radius: 2px;
	flex: none;
}

/* ---------- Long forms ----------
   The transparency form is twenty-four fields over seven sections. Three
   things make that bearable: the settings column stays in view, the
   sections are navigable, and saving never requires reaching the end. */
/* The rail runs the height of the form so the nav inside it can stay put
   for the whole way down. Pinning the whole rail was tried and dropped:
   its panels come to roughly 800px, more than a laptop window has, so it
   could only ever be shown clipped. */
.form-rail { height: 100%; }

/* Only the nav is pinned, and it is the part worth pinning: the panels
   below it are set once and then left alone. */
.form-nav {
	position: sticky;
	top: 88px;
	z-index: 2;
}

.form-nav ol {
	list-style: none;
	margin: 0;
	padding: 0;
	counter-reset: section;
}

.form-nav li { counter-increment: section; }

.form-nav a {
	display: flex;
	gap: 10px;
	padding: 7px 10px;
	border-left: 2px solid transparent;
	color: var(--body);
	font-size: 13px;
	text-decoration: none;
	transition: color .15s, border-color .15s, background .15s;
}

.form-nav a::before {
	content: counter(section);
	color: var(--faint);
	font-size: 11px;
	font-variant-numeric: tabular-nums;
	line-height: 1.5;
}

.form-nav a:hover { color: var(--rose); background: var(--bubble-bg); }

.form-nav a.is-current {
	border-left-color: var(--rose);
	background: var(--bubble-bg);
	color: var(--ink);
}

.form-nav a.is-current::before { color: var(--rose); }

/* A section jumped to sits below the sticky topbar, not under it */
.form-section { scroll-margin-top: 88px; }

/* ---------- Pinned form actions ---------- */
.form-actions.is-sticky {
	position: sticky;
	bottom: 0;
	z-index: 5;
	align-items: center;
	margin-top: 20px;
	padding: 14px 0;
	background: linear-gradient(to top, var(--paper) 70%, rgba(var(--paper-rgb), 0));
}

.form-actions-note {
	margin-right: auto;
	color: var(--faint);
	font-size: 11px;
	letter-spacing: .14em;
	text-transform: uppercase;
}

.form-actions-note::before {
	content: "";
	display: inline-block;
	width: 6px;
	height: 6px;
	margin-right: 8px;
	border-radius: 50%;
	background: var(--rose);
	vertical-align: middle;
}

/* A button that reads as a link, for an aside inside help text */
.link-button {
	padding: 0;
	border: 0;
	background: none;
	color: var(--rose);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.allowed-formats { margin-top: 6px; }

/* Stacked, the rail sits under the form and a section list there is just
   a lid on work already done, so it goes */
@media (max-width: 991.98px) {
	.form-rail { height: auto; }
	.form-nav { display: none; }
}

/* A section is focused when jumped to; it is a scroll target, not a control */
.form-section:focus { outline: none; }

/* ---------- Progress inside the pinned action bar ----------
   Sitting in the bar means it is on screen wherever the person was when
   they pressed save, so a long upload reads as progress rather than as a
   frozen page. It takes the full width of the bar, above the buttons. */
.form-actions.is-sticky .upload-progress {
	flex: 1 1 100%;
	order: -1;
	margin: 0 0 10px;
	padding: 10px 14px;
}

.form-actions.is-sticky .upload-progress .up-head { margin-bottom: 6px; }
.form-actions.is-sticky .upload-progress .up-pct { font-size: 13px; }

/* With progress showing, the buttons move over to make room for the
   byte count rather than leaving it to wrap */
.form-actions.is-sticky .upload-progress.is-busy ~ .form-actions-note { display: none; }

/* ---------- Categories on a card's picture ----------
   A grid is scanned by eye, and the categories are most of what is being looked
   for, so they sit on the cover rather than below the fold of the card.
   Solid pills rather than a dark scrim, because the cover may equally be
   a photograph or the pale placeholder with an initial on it. */
.pcard-strip {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
	padding: 10px;
	/* Only a hint of shading, enough to separate a white pill from a
	   white part of a photograph */
	background: linear-gradient(to top, rgba(var(--shadow-rgb), .28), rgba(var(--shadow-rgb), 0));
}

.pcard-strip .pcat {
	max-width: 100%;
	padding: 2px 8px;
	border-radius: 20px;
	background: rgba(255, 255, 255, .94);
	color: #241E1B;
	font-size: 10.5px;
	letter-spacing: .03em;
	line-height: 1.6;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	box-shadow: 0 1px 3px rgba(var(--shadow-rgb), .18);
}

.pcard-strip .pcat.is-more {
	background: var(--rose);
	color: var(--on-rose);
}

/* In the strip the count is laid out, not positioned */
.pcard-strip .pcard-count {
	position: static;
	margin-left: auto;
	flex: none;
}

@media (max-width: 767.98px) {
	.pcard-strip { padding: 8px; gap: 3px; }
	.pcard-strip .pcat { font-size: 10px; padding: 1px 6px; }
}

/* ---------- Search toolbar with a field picker ---------- */
.search-toolbar { align-items: center; }
.search-toolbar .search { flex: 1 1 320px; }
.search-toolbar .btn-sm { white-space: nowrap; }

.field-picker { position: relative; flex: 0 0 auto; }

.field-picker-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-width: 180px;
	height: 44px;
	padding: 0 14px;
	border: 1px solid var(--line);
	border-radius: 2px;
	background: var(--surface);
	color: var(--ink);
	font-size: 13.5px;
	text-align: left;
}

.field-picker-toggle:hover { border-color: var(--rose); }
.field-picker.is-open .field-picker-toggle { border-color: var(--rose); }
.field-picker-toggle .fa { color: var(--faint); font-size: 12px; }
.field-picker-toggle .fp-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.field-picker-menu {
	position: absolute;
	z-index: 20;
	top: calc(100% + 6px);
	left: 0;
	width: 300px;
	max-width: calc(100vw - 48px);
	border: 1px solid var(--line);
	border-radius: 2px;
	background: var(--surface);
	box-shadow: 0 18px 40px rgba(var(--shadow-rgb), .14);
}

.fp-find { position: relative; padding: 10px; border-bottom: 1px solid var(--line); }
.fp-find .fa { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 12px; }
.fp-find .form-control { padding-left: 30px; }

.fp-list {
	list-style: none;
	margin: 0;
	padding: 6px;
	max-height: 280px;
	overflow-y: auto;
	scrollbar-width: thin;
}

.fp-list li.is-hidden { display: none; }

.fp-list label {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 6px 8px;
	border-radius: 2px;
	font-size: 13px;
	color: var(--body);
	cursor: pointer;
}

.fp-list label:hover { background: var(--bubble-bg); color: var(--ink); }
.fp-list input { accent-color: var(--rose); flex: none; margin: 0; }

/* "All fields" is the default, so it is set apart from the real fields */
.fp-list .fp-all { border-bottom: 1px solid var(--line); margin-bottom: 4px; padding-bottom: 4px; }
.fp-list .fp-all label { color: var(--ink); }

.fp-empty { margin: 0; padding: 14px; color: var(--faint); font-size: 13px; text-align: center; }

@media (max-width: 575px) {
	.field-picker { flex: 1 1 100%; }
	.field-picker-toggle { width: 100%; }
	.field-picker-menu { width: 100%; }
}


/* ---------- Multi-select filter chips ----------
   The single-choice chip carries a radio dot; several-at-once carries a
   tick, so which kind of filter it is reads before anything is clicked. */
.chip-row-multi .chip span::before {
	width: 13px;
	height: 13px;
	border-radius: 2px;
	/* The tick is always there, invisible until it is ticked, so the chip
	   does not change size on selection */
	content: "\f00c";
	font-family: FontAwesome;
	font-size: 8px;
	line-height: 12px;
	text-align: center;
	color: transparent;
}

.chip-row-multi .chip input:checked + span::before {
	box-shadow: none;
	background: var(--rose);
	border-color: var(--rose);
	color: var(--on-rose);
}

/* The category row sits under the search, sharing its left edge */
.filter-panel .filter-set.mt-3 { width: 100%; }

/* ---------- Record card ----------
   Tuned against the real inventory: of thirty records none had a cover
   image, yet the picture area took 54% of every card to show the first
   letter of a title printed in full underneath. The panel is shorter now
   and the room goes to the facts a person would otherwise open the
   record to read. */
.prod-grid .pcard-media { height: 120px; min-height: 0; }

/* Set to the left and clear of the edit and delete buttons, which stack
   at the top right and are always on show on a touch screen — centred,
   the label sat underneath them. */
.pcard-blank {
	display: flex;
	align-items: center;
	gap: 7px;
	height: 100%;
	padding: 0 52px 22px 14px;
	color: var(--faint);
	font-size: 11px;
	letter-spacing: .12em;
	line-height: 1.3;
	text-transform: uppercase;
}

.pcard-blank .fa { flex: none; font-size: 16px; opacity: .5; }

/* Quiet: with no scans attached anywhere this repeats down the whole
   grid, and it is a note about what is missing, not a heading */
.pcard-blank { font-size: 10px; opacity: .75; }

/* Where it is and who took it */
.pcard-facts { margin: 10px 0 0; display: grid; gap: 3px; }
.pcard-facts > div { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.pcard-facts dt { flex: none; margin: 0; width: 12px; color: var(--faint); font-size: 10.5px; text-align: center; }

.pcard-facts dd {
	margin: 0;
	min-width: 0;
	color: var(--body);
	font-size: 12px;
	line-height: 1.45;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* A condition note: half the records say only "Fair", and the ones that
   say more are the ones worth noticing */
.pcard-flag {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	min-width: 0;
	color: var(--badge-off-text);
	font-size: 11px;
	line-height: 1.4;
}

.pcard-flag .fa { flex: none; font-size: 10px; }

/* Two badges now — digitised and status — and whether they fit on one
   line depends on how long each word happens to be, so the room for two
   rows is reserved on every card and the rows stay in step. */
/* One line, always.
   A fixed height was tried and clipped the badge, because the row carries
   its own padding and rule above it; holding the row to a single line
   gives every card the same height without a number to keep in step with
   the badge's own size. A long status gives way instead of wrapping. */
.pcard-categories {
	flex-wrap: nowrap;
	align-items: center;
	min-width: 0;
}

.pcard-categories .badge-rk {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pcard-categories .pcard-remarks { flex: none; }

/* The status rides on the picture, in the gap between the select tick on
   the left and the edit buttons on the right, which are always on show on
   a touch screen. Nothing below it moves whether it is there or not. */
.pcard-status {
	position: absolute;
	z-index: 2;
	top: 12px;
	left: 44px;
	right: 52px;
	display: flex;
	overflow: hidden;
}

.pcard-status .badge-rk {
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	box-shadow: 0 1px 4px rgba(var(--shadow-rgb), .16);
}

/* Reserved whether or not there is anything to say. A fixed height, not
   a minimum: the icon inside the flag makes its line taller than the
   text alone, which was enough to knock a row out of alignment. */
.pcard-note {
	display: flex;
	align-items: center;
	height: 20px;
	margin: 6px 0 0;
	overflow: hidden;
}

/* Titles in this inventory run to 87 characters. Two lines, and always
   two lines' worth of room, so the figures below line up across a row
   instead of stepping with the length of each title. */
.pcard-name { min-height: 2.4em; }

.pcard-name a {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Likewise the facts: a record missing one should not shuffle the rest */
/* Room for the one fact a card carries, kept whether or not this record
   has it, so the figures under it line up across the row */
.pcard-facts { min-height: 18px; align-content: start; }

/* The note is a flag, not a paragraph; the whole of it is on hover */
.pcard-flag {
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Visible only to a screen reader */
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* The count is the figure being scanned for, so it keeps its line; a long
   date gives way instead. "December 1994 -January 1995" was squeezing
   "384 TP" onto two lines and stepping the whole row out of alignment. */
.pcard-foot .pcard-price { flex: none; white-space: nowrap; }

.pcard-foot .pcard-stock {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---------- Status choice on the form ----------
   Each option carries what it means underneath it: "In-Review" is only
   self-explanatory to whoever named it. */
.status-choice .form-check-label { display: block; line-height: 1.35; }

.status-hint {
	display: block;
	margin-top: 1px;
	color: var(--faint);
	font-size: 11.5px;
}

/* On a phone the card is about 160px across and the tick, the two action
   buttons and this badge are all on the same line, which left "Draft"
   showing as "DR…". The buttons and the tick both sit closer to the edge
   at this size, so the badge takes that room back. */
@media (max-width: 767.98px) {
	.pcard-status {
		top: 8px;
		left: 36px;
		right: 42px;
	}

	.pcard-status .badge-rk {
		padding: 2px 6px;
		font-size: 8.5px;
		letter-spacing: .04em;
	}
}

/* ---------- Tabs ----------
   Bootstrap's own tab behaviour, dressed as the studio's pills rather
   than as the framework's underlined nav. */
.tab-head {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 18px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--line);
}

.tab-btn {
	padding: 6px 16px;
	border: 1px solid var(--line);
	border-radius: 30px;
	background: var(--surface);
	color: var(--body);
	font-size: 13px;
	transition: background .3s, border-color .3s, color .3s;
}

.tab-btn:hover { border-color: var(--rose); color: var(--ink); }

.tab-btn.active {
	background: var(--blush);
	border-color: var(--rose);
	color: var(--rose);
}

/* ---------- Category tally ----------
   A fixed height with its own scroller: nineteen categories today and
   more to come, and this panel should not push the page down as the
   inventory grows. */
.tally-scroll {
	max-height: 320px;
	overflow-y: auto;
	scrollbar-width: thin;
}

.tally { width: 100%; border-collapse: collapse; }

.tally th,
.tally td {
	padding: 9px 10px;
	border-bottom: 1px solid var(--line);
	font-weight: 400;
	text-align: left;
	vertical-align: middle;
}

/* The heading stays put while the list moves under it */
.tally thead th {
	position: sticky;
	top: 0;
	z-index: 1;
	background: var(--surface);
	color: var(--faint);
	font-size: 10.5px;
	letter-spacing: .14em;
	text-transform: uppercase;
	white-space: nowrap;
}

.tally tbody th { color: var(--ink); font-size: 13.5px; }
.tally tbody th a { color: inherit; }
.tally tbody th a:hover { color: var(--rose); }
.tally tbody tr:last-child th,
.tally tbody tr:last-child td { border-bottom: 0; }

.tally .num { text-align: right; font-variant-numeric: tabular-nums; }
.tally tbody .num { font-size: 14px; color: var(--ink); }

/* Half the page wide with four figures columns, so each is only as wide
   as the heading above it needs */
.tally .num { width: 58px; }
.tally th, .tally td { padding-left: 7px; padding-right: 7px; }
.tally thead th { font-size: 9.5px; letter-spacing: .1em; }
.tally th[scope="row"] { min-width: 0; }

/* A nought is still a count: it is printed, not greyed away */
.tally tbody .num { color: var(--ink); }

/* ---------- Activity log ----------
   Two readers: someone scanning the whole log for what happened, and
   someone on a record wanting the last edit. Both end up at the same
   field-by-field table, so it is styled once. */

/* The header of one entry: a handful of short labelled facts, laid out as
   many across as the panel can take rather than as a tall list */
.facts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 18px 24px;
	margin: 0;
}

.facts dt {
	margin-bottom: 3px;
	color: var(--faint);
	font-size: 10.5px;
	letter-spacing: .14em;
	text-transform: uppercase;
}

.facts dd {
	margin: 0;
	color: var(--ink);
	font-size: 14px;
	overflow-wrap: anywhere;
}

.facts dd small { font-size: 11.5px; }

/* What moved. Before and after sit side by side so the eye compares them
   on one line; the old value is dimmed, since the new one is the answer. */
.changes {
	width: 100%;
	border-collapse: collapse;
	font-size: 13.5px;
}

.changes th,
.changes td {
	padding: 9px 12px;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: top;
	overflow-wrap: anywhere;
}

.changes thead th {
	color: var(--faint);
	font-size: 10.5px;
	letter-spacing: .14em;
	text-transform: uppercase;
	white-space: nowrap;
}

.changes tbody th {
	width: 28%;
	color: var(--ink);
	font-weight: 400;
}

.changes .was { color: var(--faint); text-decoration: line-through; }
.changes .now { color: var(--ink); }

.changes tbody tr:last-child th,
.changes tbody tr:last-child td { border-bottom: 0; }

@media (max-width: 575.98px) {
	/* Three columns in a phone's width would leave a word per line, so
	   each field becomes a small stack instead */
	.changes thead { display: none; }
	.changes tbody th,
	.changes tbody td { display: block; width: auto; border-bottom: 0; padding: 2px 0; }
	.changes tbody th { padding-top: 10px; color: var(--faint); }
	.changes tbody tr { display: block; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
	.changes .was::before { content: "was "; text-decoration: none; }
	.changes .now::before { content: "now "; color: var(--faint); }
}

/* The same entries on the record's own page, as a line of events. The rule
   is drawn behind the markers rather than per entry, so it never stops
   short of the last one. */
.history-list {
	position: relative;
	list-style: none;
	margin: 0;
	padding: 0 0 0 22px;
}

.history-list::before {
	content: "";
	position: absolute;
	top: 6px;
	bottom: 6px;
	left: 4px;
	width: 1px;
	background: var(--line);
}

.history-list li { position: relative; padding-bottom: 16px; }
.history-list li:last-child { padding-bottom: 0; }

.history-mark {
	position: absolute;
	top: 5px;
	left: -22px;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--faint);
	box-shadow: 0 0 0 3px var(--surface);
}

.history-mark.active { background: var(--rose); }
.history-mark.low { background: var(--gold); }
.history-mark.inactive { background: var(--badge-off-text); }

.history-list .who {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 4px;
}

.history-list .who b { font-weight: 400; color: var(--ink); font-size: 13.5px; }
.history-list .who time { color: var(--faint); font-size: 12px; }
.history-list p { color: var(--faint); font-size: 13px; }

.history-changes summary {
	cursor: pointer;
	color: var(--rose);
	font-size: 13px;
}

.history-changes[open] summary { margin-bottom: 6px; }

.history-changes .changes {
	border: 1px solid var(--line);
	border-radius: 2px;
	background: var(--bubble-bg);
}

/* The History panel's own heading row: the title with the date range
   beside it, dropping under it when there is no room for both */
.history-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px 16px;
	margin-bottom: 16px;
}

.history-filter {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.history-filter label {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
}

.history-filter label span {
	color: var(--faint);
	font-size: 10.5px;
	letter-spacing: .14em;
	text-transform: uppercase;
}

/* Wide enough for the date and its picker, and no wider */
.history-filter input[type="date"] { width: 148px; }

.history-none { color: var(--faint); font-size: 13.5px; margin: 0; }

/* ---------- Date range filter ----------
   Shut, it is a chip that says what is chosen; open, a small panel holding
   the two dates. Fixed to the window rather than the row, because the
   table's scrolling box would clip anything inside it. */
.date-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 5px 11px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--surface);
	color: var(--body);
	font-size: 12.5px;
	line-height: 1.6;
	white-space: nowrap;
}

.date-toggle:hover { border-color: var(--faint); color: var(--ink); }

/* A chosen range must not widen the row: past this it is cut rather than
   pushing the search off the end */
.date-toggle [data-date-summary] {
	max-width: 118px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.date-toggle .fa { color: var(--faint); font-size: 11px; }

/* Set, it reads like a ticked chip, so a narrowed list never looks like
   the whole list */
.date-toggle.is-set {
	border-color: var(--rose);
	background: var(--blush);
	color: var(--rose);
}

.date-toggle.is-set .fa { color: inherit; }

.date-pop {
	position: fixed;
	z-index: 1040;
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 212px;
	padding: 14px;
	border: 1px solid var(--line);
	border-radius: 2px;
	background: var(--surface);
	box-shadow: 0 12px 28px rgba(31, 22, 18, .12);
}

.date-pop[hidden] { display: none; }

.date-pop label {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin: 0;
}

.date-pop label span {
	color: var(--faint);
	font-size: 10.5px;
	letter-spacing: .14em;
	text-transform: uppercase;
}

.date-pop input[type="date"] { width: 132px; }

.date-pop [data-date-clear] { align-self: flex-start; }

/* ---------- Table filters on a wide screen ----------
   Every way of narrowing a listing belongs on one line: the chips, the
   dropdown and the date range read as one row of questions, and a filter
   that drops to a line of its own looks like a separate thing. Below this
   width they wrap as before, which is the only way they fit. */
@media (min-width: 992px) {
	.dt-filters { flex-wrap: nowrap; gap: 10px 14px; }

	.dt-filters .filter-set { flex: 0 0 auto; }
	.dt-filters .filter-set + .filter-set { padding-left: 14px; }

	/* A group's own controls stay together: the row is only one line if
	   nothing inside it wraps either */
	.dt-filters .chip-row { flex-wrap: nowrap; }
	.dt-filters .filter-set { flex-wrap: nowrap; }

	.dt-filters .form-select { min-width: 0; width: 148px; }

	/* The search keeps its place at the end of the row, giving up width
	   before anything else does */
	/* The search is the one thing that gives when the row runs out of
	   room, so it is laid out to be able to: a fixed width would simply
	   push the end of the row past the panel. */
	.dt-container .dt-layout-row:first-child .dt-search {
		display: flex;
		flex: 0 1 auto;
		min-width: 0;
	}

	.dt-container .dt-layout-row:first-child .dt-search input {
		flex: 1 1 auto;
		width: auto;
		min-width: 110px;
		max-width: 170px;
		/* Space of its own, since the row's own gap is not enough once a
		   chosen range has widened the control before it */
		margin-left: 14px;
	}
}

/* On a full-width screen the search joins them, rather than dropping to a
   line of its own: with nothing allowed to wrap, the box gives up width
   until the row fits. Narrower than this it goes back under the filters,
   where there is room for it to stay usable. */
@media (min-width: 1100px) {
	/* Space kept between the last filter and the search, so a chosen range
	   never ends up leaning against the box next to it */
	.dt-container .dt-layout-row:first-child { flex-wrap: nowrap; gap: 20px; }

	/* The filters hold their size; the search is what gives */
	.dt-container .dt-layout-row:first-child .dt-filters { flex: 0 0 auto; }

	/* A flex item will not shrink below its content unless it is told it
	   may, and the search sits one box deeper than the rule above */
	.dt-container .dt-layout-row:first-child .dt-layout-cell { min-width: 0; }

	.dt-container .dt-layout-row:first-child .dt-search input { min-width: 110px; }
}

/* One row, one kind of control: the dropdown is shaped and sized like the
   chips and the date button beside it, so the filters read as one set of
   questions rather than three widgets that happened to meet. */
.dt-filters .form-select {
	padding: 5px 30px 5px 12px;
	border-radius: 999px;
	border-color: var(--line);
	background-color: var(--surface);
	background-position: right 11px center;
	font-size: 12.5px;
	line-height: 1.6;
}

.dt-filters .form-select:focus {
	border-color: var(--rose);
	box-shadow: none;
}

/* The search sits on the same line as the filters, so it is the same
   height as them; it keeps its square corners, being a field to type in
   rather than one more thing to pick */
@media (min-width: 992px) {
	.dt-container .dt-layout-row:first-child input.dt-input {
		padding: 5px 12px;
		font-size: 12.5px;
		line-height: 1.6;
	}
}

/* ---------- Grid or list ----------
   Two ways of reading the same inventory. The switch is a pair of icons
   rather than words: it sits above a listing that already carries a count
   and a selection, and the shapes say it quickly enough. */
.view-toggle {
	display: inline-flex;
	border: 1px solid var(--line);
	border-radius: 2px;
	overflow: hidden;
}

.view-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 30px;
	color: var(--faint);
	font-size: 13px;
	background: var(--surface);
}

.view-btn + .view-btn { border-left: 1px solid var(--line); }

.view-btn:hover { color: var(--ink); background: var(--sand); }

/* The one being read is filled in, so the pair reads as a switch rather
   than as two buttons that do nothing */
.view-btn.is-on {
	background: var(--blush);
	color: var(--rose);
}

/* ---------- The list view ----------
   A row carries the columns a card has no room for, so it is wide: the
   table scrolls sideways inside the panel rather than squeezing every
   column into something unreadable. */
.record-list td { vertical-align: middle; }

/* The scan beside the title it belongs to. A column of its own meant a
   column of empty boxes, since most records have no scan attached yet;
   here the space is held so the titles still line up, and an empty one is
   a quiet tint rather than a dashed hole. */
.record-id {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.record-thumb {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 2px;
	background: var(--sand);
	color: var(--line);
	font-size: 13px;
	overflow: hidden;
}

.record-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* The way into the rest of a record */
.record-list .expand { width: 30px; }

.row-expand {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border: 0;
	border-radius: 2px;
	background: none;
	color: var(--faint);
	font-size: 14px;
}

.row-expand:hover { background: var(--sand); color: var(--ink); }

.row-expand .fa { transition: transform .15s ease; }

.row-expand[aria-expanded="true"] { color: var(--rose); }

.row-expand[aria-expanded="true"] .fa { transform: rotate(90deg); }

/* The panel under a row: everything the columns had no room for, laid out
   as many across as the table is wide */
.row-detail > td {
	padding: 0 16px 18px 62px;
	background: var(--sand);
	white-space: normal;
}

/* Held against the left of the scrolling box, and no wider than what can
   be seen of it: the panel belongs to a table far wider than the screen,
   and a reader should not have to scroll sideways through a record's own
   detail. --wrap is the visible width, set by the script that opens it. */
.detail-grid {
	position: sticky;
	left: 62px;
	max-width: calc(var(--wrap, 100%) - 78px);
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 14px 28px;
	margin: 0;
	padding-top: 14px;
	border-top: 1px solid var(--line);
}

.detail-grid dt {
	margin-bottom: 2px;
	color: var(--faint);
	font-size: 10.5px;
	letter-spacing: .14em;
	text-transform: uppercase;
}

.detail-grid dd {
	margin: 0;
	color: var(--ink);
	font-size: 13px;
	/* The inventory's own line breaks are meaningful: a list of components
	   was entered as a list */
	white-space: pre-line;
	overflow-wrap: anywhere;
}

.record-list .nowrap { white-space: nowrap; }

/* The counts that ride along under the title */
.record-list .row-mark {
	margin-left: 8px;
	white-space: nowrap;
}

.record-list .row-mark .fa { margin-right: 3px; }

.record-list .row-flag {
	color: var(--rose);
	white-space: nowrap;
}

.record-list .row-flag .fa { margin-right: 4px; font-size: 11px; }

.record-list .pcat { margin: 0 4px 2px 0; }

.record-list .badge-rk { white-space: nowrap; }

/* Columns that would otherwise set their own width from the longest entry
   in them: an inventory holds descriptions that run to a paragraph, and a
   row is not where they are read. Each is cut to a sensible width with the
   whole of it on hover. */
.record-list th,
.record-list td { white-space: nowrap; }

.record-list .row-detail td { white-space: normal; }

.record-list .cut {
	max-width: 150px;
	overflow: hidden;
	text-overflow: ellipsis;
}

.record-list .record-cell { min-width: 210px; max-width: 240px; }

.record-list .record-cell .stacked { min-width: 0; }

.record-list .record-cell .stacked b,
.record-list .record-cell .stacked small {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* The row stays the height of its picture, whatever is written beside it */
.record-list td { padding-top: 8px; padding-bottom: 8px; }

/* The two states together, since a record's progress is one thought */
.record-list .state .badge-rk + .badge-rk { margin-left: 6px; }

/* The condition warning is a mark, not a sentence */
/* Not "mark": Bootstrap owns that class and paints it highlighter yellow */
.record-list .flag-col { width: 34px; text-align: center; }
.record-list .row-flag .fa { margin: 0; font-size: 12px; }

/* The record itself stays put while the rest of the row is scrolled to:
   a column of values is no use once you cannot see what they belong to. */
.record-list th.record-cell,
.record-list td.record-cell {
	position: sticky;
	left: 0;
	z-index: 2;
	background: var(--surface);
	box-shadow: 1px 0 0 var(--line);
}

.record-list .cut { max-width: 130px; }
.record-list td.cut { overflow: hidden; text-overflow: ellipsis; }

/* On a phone the panel gives up the indent that lines it up with the
   title, since there is no width to spare for it */
@media (max-width: 767.98px) {
	.row-detail > td { padding-left: 16px; }
	.detail-grid { left: 16px; max-width: calc(var(--wrap, 100%) - 32px); }
}

/* ---------- Dashboard sections ----------
   The page is read in bands now, so each says what it is before the boxes
   under it rather than leaving a reader to infer it from their labels. */
.section-title {
	margin: 0 0 12px;
	color: var(--faint);
	font-family: inherit;
	font-size: 11px;
	font-weight: 400;
	letter-spacing: .24em;
	text-transform: uppercase;
}

/* Five to a row on a wide screen. Bootstrap's grid is built on twelve, so
   a fifth has no column of its own and is given one here. */
@media (min-width: 1200px) {
	.col-xl-fifth {
		flex: 0 0 auto;
		width: 20%;
	}
}

/* A box that leads somewhere says so on hover, and still reads as a box
   rather than as a line of link text */
a.stat {
	display: block;
	color: inherit;
	text-decoration: none;
}

a.stat.is-link:hover {
	border-color: var(--rose);
	transform: translateY(-1px);
}

a.stat.is-link:hover .n { color: var(--rose); }

/* A media type's name is as long as it is — "Archival Photos (Vintage and
   New)" in a box a fifth of the row wide. Two lines, wrapping anywhere a
   long name needs to, and the tracking eased so the words fit in them. */
.col-xl-fifth .stat .k {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	overflow-wrap: anywhere;
	min-height: 2.4em;
	letter-spacing: .1em;
	line-height: 1.2;
}

/* The icon keeps its corner, so a name that runs to two lines does not
   push the figure about */
.col-xl-fifth .stat .k { padding-right: 34px; }

/* A section that is only holding its place */
.section-note {
	color: var(--faint);
	font-size: 13.5px;
}

/* A panel heading with an action beside it */
.panel-head-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 16px;
}
