/**
 * Shared foundation for every page: design tokens, reset, the site header (logo, language
 * switch, icon buttons, premium link), generic buttons, the sign-in / account modal, toasts,
 * focus rings and the reduced-motion switch.
 *
 * Linked FIRST by index, premium, download, collection, the panel and the panel gate, so page
 * stylesheets only carry what is specific to them and can still override a detail here. These
 * rules used to be copy-pasted into index.css, download.css, panel.css and panel-shell.css
 * (twice), and the copies had drifted: header spacing, icon-button colours and the account
 * modal's stat cards looked different depending on which page opened them.
 */

/* ------------------------------------------------------------------ *
 * Tokens
 * ------------------------------------------------------------------ */
:root {
	--bg: #09090b;
	--bg-card: #111113;
	--bg-secondary: #18181b;
	--bg-hover: rgba(255, 255, 255, 0.05);
	--text: #fafafa;
	--text-secondary: #a1a1aa;
	/* Muted text is used for sizes, hints and labels all over the site; #71717a measured
	   3.7-3.9:1 on the card colours, under the 4.5:1 that body text needs. */
	--text-muted: #8b8b94;
	--accent: #6366f1;
	--accent-hover: #5558e3;
	/* The second stop of the brand gradient (logo, bars, chart fills). */
	--accent-2: #8b5cf6;
	--border: #27272a;
	--success: #22c55e;
	--danger: #ef4444;
	--warning: #f59e0b;
	--radius: 12px;
}

.light {
	--bg: #fafafa;
	--bg-card: #ffffff;
	--bg-secondary: #f4f4f5;
	--bg-hover: rgba(0, 0, 0, 0.03);
	--text: #09090b;
	--text-secondary: #52525b;
	/* #a1a1aa on white was 2.3-2.6:1; the status greens/ambers used as text were ~2.2:1. */
	--text-muted: #71717a;
	--border: #e4e4e7;
	--success: #15803d;
	--warning: #b45309;
	/* #ef4444 measured 3.4-3.8:1 as error text on white and #f4f4f5; this is 5.3:1 on white and
	   4.8:1 on the field colour, and white text on a red button clears 4.5:1 as well. */
	--danger: #d02626;
}

/* The `hidden` attribute means hidden. The browser's own [hidden] rule is the weakest there is,
   so any class that sets `display` (.btn, .coll-download-wrap, a grid or a flex holder) used to
   win, and "hidden" controls showed: "Download all" under a locked collection's password form,
   "Grant to all" before its preview, a failed QR's empty card. */
[hidden] {
	display: none !important;
}

/* Checkboxes/radios: brand accent + dark rendering (A1) — light theme restores native look. */
input[type="checkbox"],
input[type="radio"],
/* Number/date/time spinners and the date-picker button are native widgets: without
   color-scheme they render as bright white squares on the dark theme. */
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="file"],
/* Text-ish controls join the list for the autofill case: the background the browser paints
   on a filled field follows the declared colour scheme, so saying "dark" here is what stops it
   arriving as a pale rectangle in the first place. */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="tel"],
textarea,
select {
	accent-color: var(--accent);
	color-scheme: dark;
}

.light input[type="checkbox"],
.light input[type="radio"],
.light input[type="number"],
.light input[type="date"],
.light input[type="time"],
.light input[type="datetime-local"],
.light input[type="month"],
.light input[type="week"],
.light input[type="file"],
.light input[type="text"],
.light input[type="password"],
.light input[type="email"],
.light input[type="search"],
.light input[type="url"],
.light input[type="tel"],
.light textarea,
.light select {
	color-scheme: light;
}

/* ------------------------------------------------------------------ *
 * Reset
 * ------------------------------------------------------------------ */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	/* scrollbar-color inherits, scrollbar-width does not — so the thin bar is set on every
	   element, or nested scrollers (tables, chip lists, tall modals) keep the OS default. */
	scrollbar-width: thin;
}

body {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	background: var(--bg);
	color: var(--text);
	min-height: 100vh;
	overflow-x: hidden;
}

/* iOS Safari zooms into any focused field whose text is smaller than 16px and does not zoom
   back out, so on phones every form control is at least 16px. Checkboxes, radios, ranges,
   colour and file pickers have no text and are left alone. The input selector outweighs the
   page stylesheets' class rules on its own; a bare `select`/`textarea` does not (base.css is
   linked first, and .form-group select, .input, .auth-input, .pw-set-input kept about fifty of
   them at 14-15px), hence the `!important` on those two. */
@media (max-width: 768px) {
	input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]) {
		font-size: 16px;
	}

	select,
	textarea {
		font-size: 16px !important;
	}
}

/* Scrollbars styled to match the theme instead of the OS default light bar, on the document
   and on every nested scroller. Firefox uses the standard properties (see also the reset
   above), WebKit/Blink the ::-webkit- ones. */
html {
	scrollbar-color: var(--border) transparent;
}

*::-webkit-scrollbar {
	height: 10px;
	width: 10px;
}

*::-webkit-scrollbar-track {
	background: transparent;
}

*::-webkit-scrollbar-thumb {
	background: var(--border);
	border-radius: 8px;
	border: 2px solid transparent;
	background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
	background: var(--accent);
	background-clip: content-box;
}

/* WebKit needs the corner painted too, or it stays the default light square where a
   horizontal and a vertical bar meet. */
*::-webkit-scrollbar-corner {
	background: transparent;
}

/**
 * Autofilled fields.
 *
 * The browser paints its own background on an autofilled input and will not be talked out of it
 * with `background-color`; the standard answer is a huge inset shadow, which is what these rules
 * do. The catch is that the shadow has to be `!important` to win — and that also wipes out the
 * *focus* ring, which is a box-shadow too. So the focused case states both shadows together.
 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
	background-clip: padding-box !important;
	-webkit-box-shadow: 0 0 0 1000px var(--bg-secondary) inset !important;
	box-shadow: 0 0 0 1000px var(--bg-secondary) inset !important;
	-webkit-text-fill-color: var(--text) !important;
	/* The UA background also paints under the border, so restate the border the theme wants
	   instead of letting a light ring show through at the rounded corners. */
	border-color: var(--border) !important;
	caret-color: var(--text);
	transition: background-color 100000s ease-in-out 0s;
}

/* Focused *and* autofilled: the fill, then the ordinary focus ring on top of it. */
input:-webkit-autofill:focus,
textarea:-webkit-autofill:focus,
select:-webkit-autofill:focus {
	background-clip: padding-box !important;
	-webkit-box-shadow: 0 0 0 1000px var(--bg-secondary) inset, 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
	box-shadow: 0 0 0 1000px var(--bg-secondary) inset, 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
	-webkit-text-fill-color: var(--text) !important;
	border-color: var(--accent) !important;
	caret-color: var(--text);
}

input:autofill,
textarea:autofill {
	background-color: var(--bg-secondary) !important;
	color: var(--text) !important;
	border-color: var(--border) !important;
}

input:autofill:focus,
textarea:autofill:focus {
	border-color: var(--accent) !important;
}

/* Hidden from sight, still reachable by keyboard and screen readers. */
.visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------------ *
 * Header (src/includes/header_ui.php)
 * ------------------------------------------------------------------ */
/* Positioned so the notification popover can anchor under it on phones (notifications.css),
   and stacked above the page content it drops over. */
header {
	position: relative;
	z-index: 50;
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 40px;
}

.logo {
	display: flex;
	align-items: center;
	gap: 12px;
	text-decoration: none;
	color: var(--text);
}

.logo-icon {
	width: 42px;
	height: 42px;
	flex-shrink: 0;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.logo-icon svg {
	width: 22px;
	height: 22px;
	color: white;
}

.logo-text {
	font-size: 1.3rem;
	font-weight: 700;
}

/* Items stretch to the 40px icon-button height, so the premium link and the language switch
   line up with the buttons beside them. */
.header-actions {
	display: flex;
	gap: 8px;
}

.btn-icon {
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	border-radius: 10px;
	background: var(--bg-secondary);
	border: 1px solid var(--border);
	color: var(--text-secondary);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.btn-icon:hover {
	background: var(--bg-card);
	color: var(--text);
	border-color: var(--text-muted);
}

.btn-icon svg {
	width: 18px;
	height: 18px;
}

.btn-icon.logged-in {
	border-color: var(--accent);
	color: var(--accent);
}

/* Theme toggle: the sun shows on the dark theme, the moon on the light one. */
.sun {
	display: block;
}

.moon {
	display: none;
}

.light .sun {
	display: none;
}

.light .moon {
	display: block;
}

/* Language switcher (Faza 4.3) */
.lang-switch {
	display: inline-flex;
	gap: 2px;
	align-items: center;
	margin-right: 6px;
}

.lang-switch .lang-opt {
	padding: 4px 7px;
	border-radius: 6px;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: .04em;
	text-decoration: none;
	color: var(--text-muted, #94a3b8);
	transition: background .15s, color .15s;
}

.lang-switch .lang-opt:hover {
	background: var(--bg-hover, rgba(148, 163, 184, .12));
	color: var(--text);
}

.lang-switch .lang-opt.active {
	background: var(--accent);
	color: #fff;
}

/* Phones: the header row cannot hold the logo, up to four language links, the premium link,
   the bell, the theme toggle and the account button. Rather than push the account button off
   the screen (and widen the whole page with it), the actions drop onto their own row,
   right-aligned, and wrap again if a narrow phone still cannot fit them. */
@media (max-width: 600px) {
	header {
		flex-wrap: wrap;
		gap: 12px;
		margin-bottom: 28px;
	}

	.header-actions {
		margin-left: auto;
		flex-wrap: wrap;
		justify-content: flex-end;
		min-width: 0;
		/* With four finger-sized language links and the premium link the row needed 324px of
		   the 320 a 360px phone has, and the account button wrapped onto a row of its own. */
		gap: 6px;
	}

	.lang-switch {
		margin-right: 0;
	}
}

/* Bigger language links for fingers. */
@media (pointer: coarse) {
	.lang-switch .lang-opt {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 30px;
		min-height: 36px;
		padding: 0 6px;
		font-size: 0.78rem;
	}
}

/* ------------------------------------------------------------------ *
 * Buttons
 * ------------------------------------------------------------------ */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 20px;
	border-radius: 10px;
	border: 1px solid var(--border);
	background: var(--bg-secondary);
	color: var(--text);
	font-size: 0.9rem;
	font-weight: 500;
	text-decoration: none;
	cursor: pointer;
	transition: border-color 0.2s;
}

.btn-sm {
	padding: 6px 10px;
	font-size: 0.8rem;
}

.btn:hover {
	border-color: var(--accent);
	background-color: #6366f1b3;
}

/* A red button keeps a red edge on hover instead of the accent border every .btn gets. */
.btn.btn-danger:hover {
	border-color: var(--danger);
}

.btn svg {
	width: 16px;
	height: 16px;
}

.btn.btn-primary {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
}

.btn.btn-primary:hover {
	background: var(--accent-hover);
	border-color: var(--accent-hover);
}

/* Premium link in the header (pt 9). After .btn: it is a .btn and overrides its colours. */
.btn-premium {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 14px;
	font-size: 0.85rem;
	border-color: var(--accent);
	color: var(--accent);
}

.btn-premium:hover {
	background: var(--accent);
	color: #fff;
}

@media (max-width: 480px) {
	/* Icon-only on phones; the link keeps its name in aria-label/title. */
	.btn-premium {
		width: 40px;
		height: 40px;
		padding: 0;
		gap: 0;
		font-size: 0;
		justify-content: center;
		flex-shrink: 0;
	}

	.btn-premium i {
		font-size: 1rem;
	}
}

/* Focus ring: a designed accent ring instead of the browser's near-white default, and only
   for keyboard navigation. */
.btn:focus-visible,
.btn-icon:focus-visible,
.lang-opt:focus-visible,
.action-btn:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: 8px;
}

/* The other keyboard stops used to fall back to the browser's own ring (orange on some
   systems): the logo, the premium teaser, checkboxes and radios, sortable table headers. */
.logo:focus-visible,
.premium-teaser:focus-visible,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.logo:focus-visible {
	border-radius: 12px;
}

/* Inside the cell: a table wrapper that scrolls would clip a ring drawn outside it. */
th[tabindex]:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: -2px;
}

/* ------------------------------------------------------------------ *
 * Toasts (FHUi.toast)
 * ------------------------------------------------------------------ */
/* Each entry is a clone of the page's own toast element, so it arrives carrying
   `position: fixed; bottom; left; transform` — all of which have to be neutralised here,
   because inside the stack the container does the positioning and the items simply flow.
   Newest sits at the bottom, nearest the corner it grew from. The width cap keeps a message
   with a long file name inside the screen on phones. */
.toast-stack {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	/* Explicit width: with left:50% the shrink-to-fit width would otherwise stop at half the
	   screen and stack a message into a tall narrow column. */
	width: max-content;
	max-width: min(calc(100vw - 32px), 640px);
	/* Above every dialog and backdrop (the collection page's member-password dialog sits at
	   10020): a message about what happened in a dialog has to be readable over it. */
	z-index: 20000;
	pointer-events: none;
}

.toast-stack .toast-item {
	position: static;
	left: auto;
	right: auto;
	bottom: auto;
	top: auto;
	margin: 0;
	max-width: 100%;
	white-space: normal;
	overflow-wrap: anywhere;
	transform: translateY(8px);
	opacity: 0;
	transition: opacity 0.25s ease, transform 0.25s ease;
	pointer-events: auto;
}

.toast-stack .toast-item.show {
	transform: translateY(0);
	opacity: 1;
}

/* ------------------------------------------------------------------ *
 * Sign-in / account modal (src/includes/auth_modal.php, the panel's account modal)
 * ------------------------------------------------------------------ */
.auth-modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.8);
	backdrop-filter: blur(12px) saturate(120%);
	-webkit-backdrop-filter: blur(12px) saturate(120%);
	display: none;
	/* Raised toward the top on desktop (LinkedIn pattern); centred on phones below. */
	align-items: flex-start;
	justify-content: center;
	overflow-y: auto;
	padding: 6vh 16px 24px;
	z-index: 1001;
}

.auth-modal.show {
	display: flex;
}

.auth-box {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: 16px;
	padding: 32px;
	width: 100%;
	max-width: 480px;
	position: relative;
	max-height: 90vh;
	overflow-y: auto;
}

.auth-close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 32px;
	height: 32px;
	border: none;
	background: var(--bg-secondary);
	border-radius: 8px;
	color: var(--text-muted);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s, color 0.2s;
}

.auth-close:hover {
	background: var(--border);
	color: var(--text);
}

.auth-box h3 {
	margin-bottom: 8px;
	font-size: 1.3rem;
	text-align: center;
}

.auth-box>p {
	color: var(--text-secondary);
	margin-bottom: 24px;
	font-size: 0.9rem;
	text-align: center;
}

.auth-tabs {
	display: flex;
	gap: 8px;
	margin-bottom: 24px;
}

.auth-tab {
	flex: 1;
	padding: 12px;
	border: 1px solid var(--border);
	background: var(--bg-secondary);
	border-radius: 10px;
	color: var(--text-secondary);
	cursor: pointer;
	font-size: 0.9rem;
	font-weight: 500;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.auth-tab.active {
	background: var(--accent);
	border-color: var(--accent);
	color: white;
}

.auth-tab:hover:not(.active) {
	border-color: var(--text-muted);
}

.auth-form {
	display: none;
}

.auth-form.active {
	display: block;
}

.form-group {
	margin-bottom: 16px;
}

.form-group label {
	display: block;
	margin-bottom: 8px;
	font-size: 0.85rem;
	font-weight: 500;
	color: var(--text-secondary);
}

.auth-input {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--border);
	background: var(--bg-secondary);
	border-radius: 10px;
	color: var(--text);
	font-size: 0.95rem;
	transition: border-color 0.2s, box-shadow 0.2s;
	outline: none;
}

.auth-input:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.auth-input::placeholder {
	color: var(--text-muted);
}

.auth-input.error {
	border-color: var(--danger);
}

.auth-input.success {
	border-color: var(--success);
}

/* Password strength meter + requirement checklist (sign-up, reset, panel forms). */
.pwd-meter {
	height: 4px;
	background: var(--border);
	margin-top: 8px;
	border-radius: 2px;
	overflow: hidden;
}

.pwd-meter-fill {
	height: 100%;
	width: 0%;
	background: var(--danger);
	transition: width 0.3s ease, background-color 0.3s ease;
}

.pwd-reqs {
	list-style: none;
	padding: 0;
	margin: 10px 0 0;
	font-size: 0.75rem;
	color: var(--text-muted);
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.pwd-reqs li {
	display: flex;
	align-items: center;
	gap: 4px;
	transition: color 0.3s;
}

.pwd-reqs li.valid {
	color: var(--success);
}

.pwd-reqs li::before {
	content: '\2022';
}

.pwd-reqs li.valid::before {
	content: '\2713';
}

/* Live "available / taken / checking" hint under a field. */
.field-status {
	font-size: 0.8rem;
	font-weight: 500;
	margin-top: 6px;
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.field-status.show {
	max-height: 30px;
	opacity: 1;
	margin-top: 8px;
}

.field-status.status-ok {
	color: var(--success);
}

.field-status.status-bad {
	color: var(--danger);
}

.field-status.status-load {
	color: var(--accent);
}

.auth-submit {
	width: 100%;
	padding: 14px;
	border: none;
	background: var(--accent);
	color: white;
	border-radius: 10px;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.2s, transform 0.2s, opacity 0.2s;
	margin-top: 8px;
}

.auth-submit:hover:not(:disabled) {
	background: var(--accent-hover);
}

.auth-submit:active:not(:disabled) {
	transform: scale(0.98);
}

.auth-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.auth-message {
	padding: 12px;
	border-radius: 8px;
	margin-bottom: 16px;
	text-align: center;
	font-size: 0.85rem;
	display: none;
}

/* The close button sits in the box's top-right corner, exactly where a message shown at the
   top of the box ends; keep both edges clear of it so the text stays centred. */
.auth-close ~ .auth-message {
	margin-left: 28px;
	margin-right: 28px;
}

.auth-message.show {
	display: block;
	animation: fadeIn 0.3s;
}

.auth-message.error {
	background: rgba(239, 68, 68, 0.1);
	color: var(--danger);
	border: 1px solid rgba(239, 68, 68, 0.2);
}

.auth-message.success {
	background: rgba(34, 197, 94, 0.1);
	color: var(--success);
	border: 1px solid rgba(34, 197, 94, 0.2);
}

.auth-message.fade-out {
	animation: fadeOut 0.5s forwards;
	/* Ensure content doesn't spill during the height collapse. */
	overflow: hidden;
}

.auth-user {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px;
	background: var(--bg-hover);
	border-radius: 12px;
	margin-bottom: 20px;
	border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-user-icon {
	width: 48px;
	height: 48px;
	background: var(--accent);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-weight: 700;
	font-size: 1.2rem;
}

.auth-user-info {
	flex: 1;
}

.auth-user-name {
	font-weight: 600;
	font-size: 1rem;
	margin-bottom: 2px;
}

.auth-user-role {
	font-size: 0.8rem;
	color: var(--text-muted);
}

.auth-links {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.auth-link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: var(--bg-secondary);
	border: 1px solid var(--border);
	border-radius: 10px;
	color: var(--text);
	text-decoration: none;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s;
	cursor: pointer;
}

.auth-link:hover {
	border-color: var(--accent);
	background: rgba(99, 102, 241, 0.1);
}

.auth-link svg {
	width: 18px;
	height: 18px;
	color: var(--text-secondary);
}

.auth-link.danger:hover {
	border-color: var(--danger);
	background: rgba(239, 68, 68, 0.1);
}

.auth-link.danger:hover svg {
	color: var(--danger);
}

#authGuest p {
	margin-bottom: 1vh;
}

#authGuest,
#authUser {
	transition: opacity 0.3s ease, transform 0.3s ease;
}

#authGuest.fade-out {
	opacity: 0;
	transform: translateY(-10px);
	pointer-events: none;
}

#authUser.fade-in {
	animation: slideUp 0.4s ease;
}

.session-info {
	font-size: 0.75rem;
	color: var(--text-muted);
	text-align: center;
	margin-top: 8px;
}

.session-info span {
	color: var(--accent);
}

/* Account stats in the modal. */
.user-stats-grid {
	display: flex;
	gap: 12px;
	margin-top: 16px;
	margin-bottom: 24px;
	width: 100%;
	justify-content: space-around;
}

.user-stat-card {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	width: 100%;
	padding: 12px;
	background: var(--bg-hover);
	border: 1px solid var(--border);
	border-radius: 12px;
	text-align: center;
	transition: border-color 0.2s, transform 0.2s;
}

.user-stat-card:hover {
	border-color: var(--accent);
	transform: translateY(-2px);
}

.user-stat-card span {
	display: block;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--text-muted);
	margin-bottom: 4px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.user-stat-card strong {
	display: block;
	font-size: 1.1rem;
	color: var(--accent);
	margin-bottom: 4px;
}

/* "Resend activation e-mail" block under a refused sign-in. */
.resend-activation-container {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	text-align: center;
	width: 100%;
}

.btn-resend {
	background: transparent;
	border: 1px solid #32323b;
	color: var(--text);
	padding: 8px 16px;
	border-radius: 6px;
	cursor: pointer;
	transition: background-color 0.2s, border-color 0.2s;
	font-size: 0.9rem;
	width: 75%;
	justify-content: center;
	margin: 0 auto;
	display: inline-flex;
}

.btn-resend:hover {
	background: rgba(255, 255, 255, 0.05);
	border-color: var(--text-muted, #666);
}

.resend-confirm-prompt {
	margin-bottom: 8px;
	font-size: 0.9em;
	color: var(--text-secondary);
}

.resend-confirm-actions {
	display: flex;
	gap: 8px;
	justify-content: center;
}

.resend-status {
	font-size: 0.9em;
	color: var(--text-muted);
}

.resend-status.success {
	color: var(--success);
}

/* Captcha / password / QR overlays on the public pages (.captcha-overlay on the upload page,
   .captcha-modal on download and collection pages) share the box itself. */
.captcha-box {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: 16px;
	padding: 32px;
	text-align: center;
	max-width: 400px;
}

.captcha-box h3 {
	margin-bottom: 8px;
	font-size: 1.2rem;
}

.captcha-box p {
	color: var(--text-secondary);
	margin-bottom: 24px;
	font-size: 0.9rem;
	/* Long file names (underscores aren't break points) must wrap inside the modal. */
	overflow-wrap: anywhere;
}

.captcha-widget {
	display: flex;
	justify-content: center;
	margin-bottom: 16px;
}

.captcha-error {
	color: var(--danger);
	font-size: 0.85rem;
	margin-top: 12px;
	display: none;
}

.captcha-loading {
	color: var(--text-secondary);
	font-size: 0.85rem;
}

/* Phones: a centred dialog. Centring with auto margins instead of align-items:center keeps
   the top of a dialog taller than the screen (keyboard open) reachable by scrolling — a
   centred flex item overflows upwards, past the scroll origin. */
@media (max-width: 600px) {
	.auth-modal {
		padding: 16px;
	}

	.auth-modal > * {
		margin-block: auto;
	}

	.auth-box {
		padding: 24px;
	}
}

/* ------------------------------------------------------------------ *
 * Shared keyframes
 * ------------------------------------------------------------------ */
@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes slideUp {
	from {
		opacity: 0;
		transform: translateY(15px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Collapses a dismissed message so the content below closes the gap. */
@keyframes fadeOut {
	from {
		opacity: 1;
		transform: translateY(0);
		max-height: 100px;
		margin-bottom: 16px;
		padding: 12px;
		border-width: 1px;
	}

	to {
		opacity: 0;
		transform: translateY(10px);
		max-height: 0;
		margin-bottom: 0;
		padding: 0;
		border-width: 0;
	}
}

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
