:root {
	--bg: #f6f7f9;
	--surface: #ffffff;
	--surface-2: #f0f2f5;
	--text: #1b1f27;
	--muted: #5f6774;
	--border: #dfe3e8;
	--control-border: #858d99; /* fields and selects: 3:1 against the page (WCAG 1.4.11) */
	--accent: #2457d6;
	--accent-text: #ffffff;
	--accent-soft: #e8eefc;
	--danger: #c23934;
	--danger-contrast: #ffffff; /* text on a --danger button */
	--danger-soft: #fbeaea;
	--warn: #9a6100;
	--warn-soft: #fff4dc;
	--ok: #1f7a4a;
	--radius: 8px;
	--shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 6%);
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #121418;
		--surface: #1b1e24;
		--surface-2: #23272f;
		--text: #e7e9ee;
		--muted: #9aa2b0;
		--border: #2f343d;
		--control-border: #6b7380;
		--accent: #6d95ff;
		--accent-text: #0d1220;
		--accent-soft: #1f2a45;
		--danger: #ff7b72;
		--danger-contrast: #1b0b0a;
		--danger-soft: #3a1f1f;
		--warn: #e3b341;
		--warn-soft: #3a2f14;
		--ok: #56d364;
		--shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 16px rgb(0 0 0 / 30%);
		color-scheme: dark;
	}
}

* {
	box-sizing: border-box;
}

html {
	font-size: 100%; /* the browser's own text size setting carries through */
	/* Tabbing to something under the sticky top bar scrolls it clear. */
	scroll-padding-top: 4.5rem;
	scroll-padding-bottom: var(--dock-h, 1rem);
}
html,
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 0.9375rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 {
	font-size: 1.5rem;
	margin: 0 0 0.75rem;
}
h2 {
	font-size: 1.1rem;
	margin: 1.75rem 0 0.5rem;
}
p {
	margin: 0.25rem 0 0.75rem;
}
a {
	color: var(--accent);
}
code {
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	font-size: 0.92em;
}

.muted {
	color: var(--muted);
}
.small {
	font-size: 0.85rem;
}
.error {
	color: var(--danger);
}
.error:empty {
	display: none;
}
.nowrap {
	white-space: nowrap;
}
.pad {
	padding: 0 0.75rem;
}

/* ------------------------------------------------------------------------ */
/* Controls */

button,
.button {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font: inherit;
	padding: 0.45rem 0.85rem;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text);
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
	vertical-align: middle;
}
button:hover,
.button:hover {
	background: var(--surface-2);
}
button:disabled {
	opacity: 0.55;
	cursor: default;
}
button.primary,
.button.primary {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--accent-text);
	justify-content: center;
}
button.primary:hover,
.button.primary:hover {
	filter: brightness(1.08);
}
button.danger {
	background: var(--danger);
	border-color: var(--danger);
	color: var(--danger-contrast);
	justify-content: center;
}
button.ghost,
.button.ghost {
	background: transparent;
	border-color: transparent;
}
button.ghost:hover,
.button.ghost:hover {
	background: var(--surface-2);
}
.icon-btn {
	padding: 0.35rem;
}
button:focus-visible,
.button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

input,
select {
	font: inherit;
	width: 100%;
	padding: 0.5rem 0.65rem;
	border: 1px solid var(--control-border);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--text);
}
label {
	display: grid;
	gap: 0.3rem;
	font-weight: 500;
}

.icon {
	width: 18px;
	height: 18px;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.stack {
	display: grid;
	gap: 0.85rem;
}
/* Buttons keep their own width; on the sign-in cards the main button spans
   the form and the quieter ones sit centred under it. */
.stack > button,
.stack > .button {
	justify-self: start;
}
.card .stack > button.primary {
	justify-self: stretch;
}
.card .stack > button.ghost {
	justify-self: center;
}
input[type="checkbox"] {
	width: 1.1rem;
	height: 1.1rem;
	accent-color: var(--accent);
	vertical-align: middle;
}
.narrow {
	max-width: 26rem;
}
.actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.5rem;
}

/* ------------------------------------------------------------------------ */
/* Signed-out pages */

.center {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 2rem 1rem;
	gap: 1.25rem;
}
.card {
	width: 100%;
	max-width: 28rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	box-shadow: var(--shadow);
	padding: 1.75rem;
}
.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 700;
	color: var(--text);
	text-decoration: none;
}
.brand.big {
	font-size: 1.35rem;
}
.logo {
	width: 26px;
	height: 26px;
	fill: var(--accent-soft);
	stroke: var(--accent);
	stroke-width: 1.8;
}
.dev-note {
	color: var(--warn);
	font-size: 0.85rem;
}
.steps {
	display: flex;
	gap: 1rem;
	list-style: none;
	padding: 0;
	margin: 0 0 1rem;
	font-size: 0.85rem;
	color: var(--muted);
}
.steps li.now {
	color: var(--accent);
	font-weight: 600;
}
.steps li.done::before {
	content: "✓ ";
}
.qr-wrap {
	display: flex;
	justify-content: center;
}
.qr {
	width: 220px;
	height: 220px;
}
.qr-bg {
	fill: #fff;
}
.qr-fg {
	fill: #000;
}
.secret {
	display: block;
	word-break: break-all;
	padding: 0.5rem 0.65rem;
	margin-top: 0.4rem;
	background: var(--surface-2);
	border-radius: var(--radius);
}
.fingerprint {
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	font-size: 1.15rem;
	letter-spacing: 0.04em;
	padding: 0.75rem 1rem;
	background: var(--accent-soft);
	border-radius: var(--radius);
	text-align: center;
	word-spacing: 0.25em;
}

/* ------------------------------------------------------------------------ */
/* App shell */

.shell {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}
.topbar {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.6rem 1rem;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	position: sticky;
	top: 0;
	z-index: 5;
}
.spacer {
	flex: 1;
}
.who {
	color: var(--muted);
}
.body {
	flex: 1;
	display: flex;
	min-height: 0;
}
.sidebar {
	width: 15.5rem;
	flex: none;
	padding: 1rem 0.5rem;
	border-right: 1px solid var(--border);
	background: var(--surface);
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
}
.nav {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.45rem 0.75rem;
	border-radius: var(--radius);
	color: var(--text);
	text-decoration: none;
	min-width: 0;
}
.nav .label {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.nav:hover {
	background: var(--surface-2);
}
.nav.active {
	background: var(--accent-soft);
	color: var(--accent);
	font-weight: 600;
}
.nav-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 1rem 0 0.2rem;
	padding: 0 0.25rem 0 0.75rem;
	font-size: 0.8125rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
}
.role {
	font-size: 0.8125rem;
	color: var(--muted);
}
.main {
	flex: 1;
	min-width: 0;
	/* Room to scroll the last rows clear of the transfers panel. */
	padding: 1.25rem 1.5rem calc(var(--dock-h, 0px) + 4rem);
}
.content {
	max-width: 70rem;
}
.banner {
	display: flex;
	gap: 0.6rem;
	align-items: flex-start;
	padding: 0.75rem 1rem;
	margin-bottom: 1rem;
	background: var(--warn-soft);
	color: var(--text);
	border-radius: var(--radius);
}
.banner .icon {
	color: var(--warn);
	margin-top: 0.15rem;
}

/* ------------------------------------------------------------------------ */
/* Files */

.crumbs {
	font-size: 1.25rem;
	font-weight: 600;
	margin-bottom: 0.75rem;
	overflow-wrap: anywhere;
}
.crumbs a {
	color: var(--text);
	text-decoration: none;
}
.crumbs a:hover {
	text-decoration: underline;
}
.toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 1rem;
}
.toolbar select {
	width: auto;
}
.dropzone {
	border: 2px dashed transparent;
	border-radius: 12px;
	margin: -0.75rem;
	padding: 0.75rem;
}
.dropzone.over {
	border-color: var(--accent);
	background: var(--accent-soft);
}
table {
	width: 100%;
	border-collapse: collapse;
}
th {
	text-align: left;
	font-weight: 500;
	font-size: 0.8125rem;
	color: var(--muted);
	padding: 0.4rem 0.6rem;
	border-bottom: 1px solid var(--border);
}
td {
	padding: 0.45rem 0.6rem;
	border-bottom: 1px solid var(--border);
	vertical-align: middle;
}
table.files {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
}
table.files tbody tr:hover {
	background: var(--surface-2);
}
td .name {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	color: var(--text);
	text-decoration: none;
	overflow-wrap: anywhere;
}
a.name:hover,
button.linklike:hover {
	text-decoration: underline;
}
button.linklike,
button.linklike:hover {
	padding: 0;
	border: 0;
	background: none;
	white-space: normal;
	font: inherit;
	text-align: left;
	cursor: pointer;
	box-shadow: none;
	min-height: 0;
}
.preview {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	min-height: 8rem;
}
.preview-image {
	max-width: 100%;
	max-height: 70vh;
	object-fit: contain;
	border-radius: var(--radius);
	background: var(--surface-2);
}
.preview-text {
	align-self: stretch;
	max-height: 65vh;
	overflow: auto;
	margin: 0;
	padding: 0.75rem 1rem;
	background: var(--surface-2);
	border-radius: var(--radius);
	font-size: 0.85rem;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
.num {
	text-align: right;
	white-space: nowrap;
}
.row-actions {
	text-align: right;
	white-space: nowrap;
}
.empty {
	padding: 3rem 1rem;
	text-align: center;
	color: var(--muted);
	background: var(--surface);
	border: 1px dashed var(--border);
	border-radius: var(--radius);
}
.tag {
	display: inline-block;
	margin-left: 0.5rem;
	padding: 0.05rem 0.45rem;
	font-size: 0.8125rem;
	border-radius: 999px;
	background: var(--surface-2);
	color: var(--muted);
}
.tag.warn {
	background: var(--warn-soft);
	color: var(--warn);
}
.status {
	font-size: 0.85rem;
}
.status.pending_cert {
	color: var(--warn);
	font-weight: 600;
}
.status.disabled {
	color: var(--danger);
}
.status.active {
	color: var(--ok);
}
tr.bad td {
	background: var(--danger-soft);
}
.facts {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.35rem 1.25rem;
}
.facts dt {
	color: var(--muted);
}
.facts dd {
	margin: 0;
}
.invite {
	display: grid;
	grid-template-columns: 1.2fr 1.4fr 0.8fr auto;
	align-items: end;
	gap: 0.5rem;
	max-width: 52rem;
}
.notice {
	margin-top: 0.75rem;
	padding: 0.75rem 1rem;
	background: var(--accent-soft);
	border-radius: var(--radius);
	max-width: 52rem;
}
.notice.warn {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	align-items: flex-start;
	margin: 0 0 1rem;
	background: var(--warn-soft);
}
.notice.warn > div {
	flex: 1 1 20rem;
}
.notice.warn .icon {
	color: var(--warn);
	margin-top: 0.15rem;
}

/* ------------------------------------------------------------------------ */
/* Dialogs, toasts, transfers */

.overlay {
	position: fixed;
	inset: 0;
	background: rgb(10 14 22 / 45%);
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 10vh 1rem 1rem;
	z-index: 20;
}
.dialog {
	width: 100%;
	max-width: 26rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	box-shadow: var(--shadow);
	padding: 1.25rem 1.5rem 1.5rem;
	max-height: 80vh;
	overflow: auto;
}
.dialog.wide {
	max-width: 40rem;
}
/* A folder's links in its share dialog: one short entry each. */
.link-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.link-list li {
	display: grid;
	gap: 0.2rem;
	padding: 0.6rem 0;
	border-bottom: 1px solid var(--border);
	min-width: 0;
}
.link-list .name {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 500;
	overflow-wrap: anywhere;
	min-width: 0;
}
.link-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-top: 0.2rem;
}
.dialog-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.75rem;
}
.dialog-head h2 {
	margin: 0;
	overflow-wrap: anywhere;
}
.close {
	font-size: 1.4rem;
	line-height: 1;
	padding: 0.1rem 0.5rem;
}
.add-member {
	display: grid;
	gap: 0.4rem;
}
.add-member .row {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}
.add-member .row select {
	width: auto;
}
.plain-label {
	font-weight: 500;
}
.role-control {
	display: inline-flex;
	gap: 0.4rem;
	align-items: center;
}
.role-control select {
	width: auto;
}
.results {
	display: grid;
	gap: 0.25rem;
	margin-top: 0.4rem;
}
.result {
	justify-content: flex-start;
}
table.plain td,
table.plain th {
	padding-left: 0.25rem;
}
/* Toasts only inform: bottom centre, and clicks go straight through them to
   whatever is underneath. */
#notices {
	position: fixed;
	bottom: 1rem;
	left: 50%;
	transform: translateX(-50%);
	display: grid;
	justify-items: center;
	gap: 0.5rem;
	z-index: 30;
	width: max-content;
	max-width: min(28rem, calc(100vw - 2rem));
	pointer-events: none;
}
/* With a dialog open, notices move to the top, clear of its buttons. */
body.has-dialog #notices {
	bottom: auto;
	top: 1rem;
}
#toasts,
#alerts {
	display: grid;
	justify-items: center;
	gap: 0.5rem;
}
.toast {
	pointer-events: auto;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}
.toast-close {
	padding: 0 0.3rem;
	font-size: 1.1rem;
	line-height: 1;
	color: inherit;
}
.toast {
	padding: 0.65rem 0.9rem;
	border-radius: var(--radius);
	background: var(--surface);
	border: 1px solid var(--border);
	box-shadow: var(--shadow);
}
.toast.error {
	border-color: var(--danger);
	color: var(--danger);
}
.toast.success::before {
	content: "✓";
	color: var(--ok);
}
#transfers {
	position: fixed;
	bottom: 1rem;
	right: 1rem;
	display: grid;
	gap: 0.5rem;
	z-index: 15;
	width: min(22rem, calc(100vw - 2rem));
}
.transfer {
	padding: 0.6rem 0.8rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}
.transfer-name {
	font-size: 0.85rem;
	margin-bottom: 0.35rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.track {
	height: 4px;
	background: var(--surface-2);
	border-radius: 999px;
	overflow: hidden;
}
.bar {
	height: 100%;
	width: 0;
	background: var(--accent);
	transition: width 0.2s;
}
.transfer.failed .bar {
	background: var(--danger);
}
.transfer.waiting .bar {
	background: var(--warn);
}
.transfer-note {
	margin-top: 0.35rem;
}
.transfer-failures {
	margin: 0.35rem 0 0;
	padding-left: 1.1rem;
	max-height: 8rem;
	overflow-y: auto;
	overflow-wrap: anywhere;
}
.transfer .row-actions {
	margin-top: 0.4rem;
}

/* ------------------------------------------------------------------------ */
/* Narrow screens */

@media (max-width: 760px) {
	.body {
		flex-direction: column;
	}
	.sidebar {
		width: auto;
		border-right: 0;
		border-bottom: 1px solid var(--border);
		flex-direction: row;
		flex-wrap: wrap;
		padding: 0.5rem;
	}
	/* The section headings go, but not the New shared folder button. */
	.nav-head {
		margin: 0;
		padding: 0;
		font-size: 0;
	}
	.nav-head .icon-btn {
		font-size: 15px;
	}
	.sidebar > p.pad {
		display: none;
	}
	.main {
		padding: 1rem 1rem calc(var(--dock-h, 0px) + 4rem);
	}
	.who {
		display: none;
	}
	.invite {
		grid-template-columns: 1fr;
	}
	/* The file list drops its size column; other tables scroll instead. */
	table.files td:nth-child(3),
	table.files th:nth-child(3) {
		display: none;
	}
}

/* ------------------------------------------------------------------------ */
/* Menus, selection, search, pickers */

.menu {
	position: absolute;
	z-index: 40;
	min-width: 12rem;
	padding: 0.3rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	display: grid;
}
.menu-item {
	border: 0;
	background: transparent;
	justify-content: flex-start;
	width: 100%;
	padding: 0.45rem 0.6rem;
}
.menu-item:hover {
	background: var(--surface-2);
}
.menu-item:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: -2px;
	background: var(--accent-soft);
}
.menu-sep {
	height: 1px;
	margin: 0.25rem 0.2rem;
	background: var(--border);
}
.danger-text {
	color: var(--danger);
}
button.danger-outline {
	color: var(--danger);
	border-color: var(--danger);
	background: transparent;
}
.selection-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem;
	padding: 0.4rem 0.6rem;
	margin-bottom: 0.6rem;
	background: var(--accent-soft);
	border-radius: var(--radius);
}
.search {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0 0.6rem;
	border: 1px solid var(--control-border);
	border-radius: var(--radius);
	background: var(--surface);
	min-width: 14rem;
	font-weight: 400;
}
.search input {
	border: 0;
	padding: 0.45rem 0;
	background: transparent;
}
.search input:focus-visible {
	outline: none;
}
.search:focus-within {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}
th button.sort {
	border: 0;
	background: transparent;
	padding: 0;
	font: inherit;
	color: inherit;
}
th button.sort:hover {
	color: var(--text);
	background: transparent;
}
td.check,
th.check {
	width: 2rem;
	padding-right: 0;
}
td.check input,
th.check input,
label.inline input {
	width: auto;
}
label.inline {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 400;
}
table.files tbody tr.selected {
	background: var(--accent-soft);
}
.dir-list {
	display: grid;
	gap: 0.15rem;
	max-height: 40vh;
	overflow: auto;
	padding: 0.25rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
}
.dir-pick {
	border: 0;
	background: transparent;
	justify-content: flex-start;
}
.dir-pick.chosen {
	background: var(--accent-soft);
	color: var(--accent);
	font-weight: 600;
}
.dir-pick.d1 { padding-left: 1.6rem; }
.dir-pick.d2 { padding-left: 2.6rem; }
.dir-pick.d3 { padding-left: 3.6rem; }
.dir-pick.d4 { padding-left: 4.6rem; }
.dir-pick.d5 { padding-left: 5.6rem; }
.dir-pick.d6 { padding-left: 6.6rem; }
.actions.wrap {
	flex-wrap: wrap;
}
.transfer-head {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}
.transfer-head .transfer-name {
	flex: 1;
	margin: 0;
}
.table-scroll {
	overflow-x: auto;
}
.card.wide {
	max-width: 44rem;
}
.single-file {
	display: grid;
	justify-items: start;
	gap: 0.4rem;
}
.name.big {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0 0 0.25rem;
	font-size: 1.15rem;
	font-weight: 600;
}
.privacy {
	max-width: 40rem;
	text-align: center;
}
h3 {
	font-size: 1rem;
	margin: 0.75rem 0 0.25rem;
}
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
.skip {
	position: absolute;
	left: -999px;
	top: 0.5rem;
	z-index: 50;
	padding: 0.4rem 0.8rem;
	background: var(--surface);
	border-radius: var(--radius);
}
.skip:focus {
	left: 0.5rem;
}
.content:focus {
	outline: none;
}

@media (max-width: 760px) {
	.search {
		min-width: 0;
		flex: 1 1 100%;
	}
	.toolbar .spacer {
		display: none;
	}
	table.files td,
	table.files th {
		padding-left: 0.35rem;
		padding-right: 0.35rem;
	}
	.topbar {
		padding: 0.5rem 0.75rem;
	}
}

/* ------------------------------------------------------------------------ */
/* Row actions with words look like buttons; icon-only ones stay quiet. */
.row-actions button.ghost:not(.icon-btn),
.row-actions .button.ghost {
	border-color: var(--control-border);
	padding: 0.25rem 0.6rem;
}
.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;
}
.page-title {
	font-size: 1.5rem;
	margin: 0 0 0.75rem;
	overflow-wrap: anywhere;
}
.crumbs ol {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	list-style: none;
	margin: 0 0 0.25rem;
	padding: 0;
	font-size: 0.875rem;
}
.crumbs li + li::before {
	content: "/";
	margin-right: 0.25rem;
	color: var(--muted);
}
fieldset.dir-list {
	border: 0;
	margin: 0;
	padding: 0;
}
label.dir-pick {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 400;
	cursor: pointer;
	padding: 0.4rem 0.6rem;
	border-radius: var(--radius);
}
.dir-pick input {
	width: auto;
	margin: 0;
}
.dir-pick:has(input:checked) {
	background: var(--accent-soft);
	font-weight: 600;
}
.tag.warn button,
button.tag {
	border: 0;
	font: inherit;
	cursor: pointer;
}
.transfer.finished .bar {
	background: var(--ok);
}
.transfers-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	font-size: 0.875rem;
	padding: 0.4rem 0.6rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}
#transfers.collapsed .transfer {
	display: none;
}
#transfers:empty {
	display: none;
}

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

/* Windows High Contrast and other forced colours: keep state visible. */
@media (forced-colors: active) {
	.bar {
		background: Highlight;
	}
	tr.selected,
	.nav.active,
	.dir-pick:has(input:checked) {
		outline: 2px solid Highlight;
	}
}

@media (max-width: 760px) {
	/* Notices sit above the transfers panel, not on top of it. */
	#notices {
		bottom: calc(var(--dock-h, 0px) + 1rem);
	}
	.nav-head {
		font-size: 0.8125rem;
		text-transform: none;
		letter-spacing: 0;
	}
	/* Narrow tables become stacked cards rather than running off the edge. */
	table.stacky,
	table.stacky tbody,
	table.stacky tr,
	table.stacky td {
		display: block;
		width: 100%;
	}
	table.stacky thead {
		display: none;
	}
	table.stacky tr {
		padding: 0.5rem 0;
		border-bottom: 1px solid var(--border);
	}
	table.stacky td {
		border: 0;
		padding: 0.15rem 0.25rem;
	}
	table.stacky td.row-actions {
		text-align: left;
	}
}

.fingerprint {
	max-width: 24ch;
	margin-inline: auto;
	text-align: center;
}
tr.note td {
	text-align: center;
	padding: 1rem;
}

/* Names keep their own direction: a right-to-left name can't reorder the
   words around it. Long unbroken names wrap rather than push past the edge. */
.name,
.transfer-name,
.dialog-head h2 {
	unicode-bidi: isolate;
}
.name.big {
	overflow-wrap: anywhere;
	min-width: 0;
}

.title-row {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}
.title-row .page-title {
	margin: 0;
}
.title-row {
	margin-bottom: 0.75rem;
}
/* The transfers panel never grows past half the window: it scrolls. */
#transfers {
	max-height: min(50vh, 26rem);
	overflow-y: auto;
	overscroll-behavior: contain;
}
#transfers .transfers-head {
	position: sticky;
	top: 0;
	z-index: 1;
}

.shared-mark {
	display: inline-flex;
	margin-left: 0.4rem;
	color: var(--accent);
	vertical-align: middle;
}
.shared-mark .icon {
	width: 15px;
	height: 15px;
}

/* ------------------------------------------------------------------------ */
/* Icon view */
.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
	gap: 0.75rem;
}
.card {
	position: relative;
	padding: 0.5rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	min-width: 0;
}
.card.selected {
	outline: 2px solid var(--accent);
	background: var(--accent-soft);
}
.card-open {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}
.card-pic {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 4 / 3;
	background: var(--surface-2);
	border-radius: calc(var(--radius) - 2px);
	overflow: hidden;
}
.card-pic img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.icon.big {
	width: 44px;
	height: 44px;
	stroke-width: 1.3;
	color: var(--muted);
}
.card-name {
	margin-top: 0.4rem;
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	unicode-bidi: isolate;
}
.card-meta {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.card-check {
	position: absolute;
	top: 0.85rem;
	left: 0.85rem;
}
.card-more {
	position: absolute;
	top: 0.6rem;
	right: 0.6rem;
	background: var(--surface);
}
.more-row {
	margin-top: 0.75rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}
.row-actions > * + * {
	margin-left: 0.35rem;
}
/* Long file names shorten with "…" instead of pushing the panel's buttons
   off its right edge (flex and grid items won't shrink below their content
   unless told to). */
#transfers {
	overflow-x: hidden;
}
#transfers > *,
.transfer-head .transfer-name {
	min-width: 0;
}
/* Headings get focus on arrival (so screen readers announce the page), but
   they aren't controls: no focus ring on them. */
h1[tabindex="-1"]:focus,
#main:focus {
	outline: none;
}
