/**
 * File Manager — design turn 3, artboard 3a/3b.
 *
 * Values from the artboard's markup; see docs/design-specs/turn-3-file-manager.md.
 * Palette comes from admin-tokens.css, so this screen follows light/dark with the
 * rest of the suite.
 *
 * Quick and Advanced are two column sets over one row, not two components: the
 * turn's point is that they are the same list answering two different questions,
 * so the row markup is identical and only the grid changes.
 */

.ag-files {
	--f-text:   var(--ag-text);
	--f-soft:   var(--ag-text-soft);
	--f-mute:   var(--ag-text-mute);
	--f-label:  var(--ag-text-faint);
	--f-rule:   var(--ag-rule);
	--f-hair:   var(--ag-rule-soft);
	--f-border: var(--ag-border);
	--f-bg:     var(--ag-bg);
	--f-bg-alt: var(--ag-bg-sunk);
	--f-accent: var(--ag-accent);
	--f-ink:    var(--ag-accent-ink);
	--f-rel:    var(--ag-relation);
	--f-warn:   var(--ag-warn);
	--f-warn-rule:   var(--ag-warn-rule);
	--f-warn-ground: var(--ag-warn-ground);

	font-family: var(--ag-sans);
	color: var(--f-text);
	max-width: 1440px;
}

.ag-files__lede {
	max-width: 92ch;
	margin: 0 0 18px;
	font-size: 13.5px;
	line-height: 1.6;
	color: var(--f-soft);
}

.ag-files__lede strong { color: var(--f-text); font-weight: 600; }

.ag-files__saved {
	margin: 0 0 14px;
	padding: 9px 14px;
	background: var(--ag-accent-ground);
	border-left: 3px solid var(--f-accent);
	font-size: 12.5px;
}

/* ─── tabs and the detail switch ──────────────────────────────────────── */

.ag-files__bar {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: -1px;
}

.ag-files__tabs { display: flex; gap: 2px; }

.ag-files__tab {
	display: flex;
	align-items: baseline;
	gap: 7px;
	padding: 8px 14px;
	font-size: 12.5px;
	color: var(--f-soft);
	text-decoration: none;
	background: var(--f-bg-alt);
	border: 1px solid var(--f-border);
	border-bottom: 0;
	border-radius: 3px 3px 0 0;
}

.ag-files__tab em {
	font-family: var(--ag-mono);
	font-style: normal;
	font-size: 10.5px;
	color: var(--f-mute);
}

.ag-files__tab:hover { color: var(--f-text); }

.ag-files__tab.is-on {
	background: var(--f-bg);
	color: var(--f-text);
	font-weight: 600;
}

.ag-files__detail {
	display: flex;
	align-items: center;
	gap: 8px;
	padding-bottom: 6px;
}

.ag-files__detail-label {
	font-size: 9px;
	font-weight: 600;
	letter-spacing: .13em;
	text-transform: uppercase;
	color: var(--f-label);
}

.ag-files__detail-opt {
	padding: 4px 11px;
	font-size: 11.5px;
	color: var(--f-soft);
	text-decoration: none;
	background: var(--f-bg-alt);
	border: 1px solid var(--f-border);
	border-radius: 2px;
}

.ag-files__detail-opt.is-on {
	background: var(--f-text);
	color: var(--f-bg);
	border-color: var(--f-text);
	font-weight: 600;
}

/* ─── the list ────────────────────────────────────────────────────────── */

.ag-files__panel {
	background: var(--f-bg);
	border: 1px solid var(--f-border);
	border-radius: 0 3px 3px 3px;
	overflow: hidden;
}

/* Quick answers "does it load", Advanced opens the other four lanes. */
.ag-files__panel--quick   { --f-cols: 22px 44px 1fr; }
.ag-files__panel--advanced { --f-cols: 22px 44px 1fr 34px 112px 168px 128px; }

.ag-files__head {
	display: grid;
	grid-template-columns: var(--f-cols);
	align-items: end;
	padding: 9px 0 8px;
	background: var(--f-bg-alt);
	border-bottom: 1px solid var(--f-rule);
}

.ag-files__head span {
	font-size: 9px;
	font-weight: 600;
	letter-spacing: .13em;
	text-transform: uppercase;
	color: var(--f-label);
	padding-right: 12px;
}

.ag-files__h-on { padding-left: 0; }

/* ─── the grip ────────────────────────────────────────────────────────── */

/* The artboard draws a handle on every row and says groups are fixed. Both are
   true here: a row can be dragged, and it can only land inside its own band. */
.ag-files__grip {
	display: block;
	width: 10px;
	height: 16px;
	margin-left: 8px;
	cursor: grab;
	background-image: radial-gradient(var(--f-border) 1px, transparent 1px);
	background-size: 4px 4px;
	background-position: 1px 2px;
	opacity: 0;
	transition: opacity .1s ease;
}

.ag-files__row:hover .ag-files__grip,
.ag-files__row:focus-within .ag-files__grip { opacity: 1; }

.ag-files__row.is-dragging {
	opacity: .45;
	cursor: grabbing;
}

.ag-files__row.is-over {
	box-shadow: inset 0 2px 0 var(--f-accent);
}

.ag-files__key--grip {
	background-image: radial-gradient(var(--f-border) 1px, transparent 1px);
	background-size: 4px 4px;
	width: 10px;
	height: 12px;
}

/* ─── saving ──────────────────────────────────────────────────────────── */

.ag-files__save[aria-busy="true"] { opacity: .6; pointer-events: none; }
.ag-files__h-dep { text-align: center; }

.ag-files__band {
	display: flex;
	align-items: baseline;
	gap: 10px;
	flex-wrap: wrap;
	padding: 8px 16px;
	background: var(--f-bg-alt);
	border-bottom: 1px solid var(--f-hair);
	border-left: 3px solid var(--f-text);
}

.ag-files__band--vendor  { border-left-color: var(--ag-pipe); background: var(--ag-band-global); }
.ag-files__band--uploads { border-left-color: var(--f-accent); }
.ag-files__band--admin   { border-left-color: var(--f-mute); }
.ag-files__band--fonts   { border-left-color: var(--f-rel); }

.ag-files__band-word {
	font-size: 10px;
	font-weight: 600;
	letter-spacing: .13em;
	text-transform: uppercase;
	color: var(--f-text);
}

.ag-files__band-note { font-size: 11.5px; color: var(--f-mute); }

.ag-files__row {
	display: grid;
	grid-template-columns: var(--f-cols);
	align-items: center;
	padding: 9px 0;
	border-bottom: 1px solid var(--f-hair);
	border-left: 3px solid transparent;
	cursor: pointer;
}

.ag-files__row:hover { background: var(--ag-bg-hover); }

/* Off is not an error, so it recedes rather than warning. */
.ag-files__row.is-off { background: var(--f-bg-alt); }
.ag-files__row.is-off .ag-files__name { color: var(--f-mute); text-decoration: line-through; }

/* Paid for by every visitor, useful to almost none of them. */
.ag-files__row.is-flagged {
	background: var(--f-warn-ground);
	border-left-color: var(--f-warn-rule);
}

.ag-files__row.is-flagged .ag-files__why { color: var(--f-warn); }

.ag-files__on { padding-left: 6px; }
.ag-files__on input { margin: 0; }

.ag-files__file { padding-right: 14px; min-width: 0; }

.ag-files__name {
	display: block;
	font-family: var(--ag-mono);
	font-size: 12px;
	color: var(--f-text);
	overflow-wrap: anywhere;
}

.ag-files__why {
	display: block;
	font-size: 11.5px;
	line-height: 1.45;
	color: var(--f-soft);
	margin-top: 3px;
}

/* The rail that says this file waits for another. */
.ag-files__dep { display: flex; justify-content: center; }

.ag-files__dep-rail {
	display: block;
	width: 9px;
	height: 22px;
	border-left: 1px solid var(--f-rel);
	border-top: 1px solid var(--f-rel);
	border-bottom: 1px solid var(--f-rel);
}

.ag-files__cell { padding-right: 12px; min-width: 0; }

.ag-files__cell select {
	width: 100%;
	max-width: 100%;
	font-size: 11.5px;
	min-height: 0;
	line-height: 1.6;
	padding: 2px 22px 2px 6px;
	color: var(--f-text);
	background-color: var(--f-bg);
	border-color: var(--f-border);
}

.ag-files__legend {
	display: flex;
	gap: 20px;
	flex-wrap: wrap;
	padding: 10px 16px;
	background: var(--f-bg-alt);
	font-size: 11px;
	color: var(--f-mute);
}

.ag-files__legend span { display: flex; align-items: center; gap: 8px; }

.ag-files__key {
	display: inline-block;
	width: 9px;
	height: 12px;
	flex: none;
}

.ag-files__key--dep {
	border-left: 1px solid var(--f-rel);
	border-top: 1px solid var(--f-rel);
	border-bottom: 1px solid var(--f-rel);
}

.ag-files__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	padding: 12px 16px;
	background: var(--f-bg-alt);
	border-top: 1px solid var(--f-rule);
}

.ag-files__foot strong { display: block; font-size: 12.5px; }
.ag-files__foot span { display: block; font-size: 11px; color: var(--f-mute); margin-top: 3px; }

.ag-files__save {
	font-family: var(--ag-sans);
	font-size: 12.5px;
	font-weight: 600;
	padding: 8px 16px;
	background: var(--f-accent);
	color: var(--f-ink);
	border: 1px solid var(--f-accent);
	border-radius: 2px;
	cursor: pointer;
}

.ag-files__save:focus-visible { outline: 2px solid #2271b1; outline-offset: 2px; }

.ag-files__empty {
	margin: 0;
	padding: 22px 16px;
	font-size: 12.5px;
	color: var(--f-mute);
}

.ag-files__aside {
	margin: 16px 0 0;
	font-size: 12px;
	color: var(--f-mute);
}

/* ─── fonts ───────────────────────────────────────────────────────────── */

.ag-files__family {
	padding: 13px 16px;
	border-bottom: 1px solid var(--f-hair);
}

.ag-files__family-head {
	display: flex;
	align-items: baseline;
	gap: 10px;
	flex-wrap: wrap;
}

.ag-files__family-head .ag-files__name { font-family: var(--ag-sans); font-size: 13.5px; font-weight: 600; }

.ag-files__tag {
	font-size: 9.5px;
	font-weight: 600;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--f-ink);
	background: var(--f-accent);
	padding: 1px 6px;
	border-radius: 2px;
}

.ag-files__family-meta { font-family: var(--ag-mono); font-size: 11px; color: var(--f-mute); }

.ag-files__formats {
	margin: 9px 0 0;
	padding: 0;
	list-style: none;
	max-width: 620px;
}

.ag-files__formats li {
	display: grid;
	grid-template-columns: 58px 1fr 120px;
	align-items: center;
	gap: 10px;
	padding: 2px 0;
}

.ag-files__format {
	font-family: var(--ag-mono);
	font-size: 11px;
	color: var(--f-text);
}

.ag-files__bar-track {
	display: block;
	height: 7px;
	background: var(--f-hair);
	border-radius: 1px;
	overflow: hidden;
}

.ag-files__bar-track i { display: block; height: 100%; background: var(--f-mute); }

/* The one a browser will actually take. */
.ag-files__formats li:first-child .ag-files__bar-track i { background: var(--f-text); }

.ag-files__format-meta {
	font-family: var(--ag-mono);
	font-size: 10.5px;
	color: var(--f-mute);
	text-align: right;
}

.ag-files__family-note {
	margin: 8px 0 0;
	padding-left: 9px;
	border-left: 2px solid var(--f-warn-rule);
	font-size: 11.5px;
	line-height: 1.5;
	color: var(--f-warn);
	max-width: 78ch;
}

/* ─── narrow ──────────────────────────────────────────────────────────── */

@media (max-width: 1180px) {
	.ag-files__panel--advanced { --f-cols: 22px 44px 1fr 34px 100px 140px 110px; }
}

@media (max-width: 980px) {
	.ag-files__head { display: none; }

	.ag-files__panel--advanced,
	.ag-files__panel--quick { --f-cols: 22px 44px 1fr; }

	.ag-files__row { padding: 12px 0; row-gap: 6px; }
	.ag-files__dep { display: none; }

	.ag-files__cell {
		grid-column: 3;
		padding-right: 16px;
	}

	.ag-files__formats li { grid-template-columns: 50px 1fr; }
	.ag-files__format-meta { grid-column: 2; text-align: left; }
}
