/**
 * Design Tokens — design turn 4, artboard 4a/4b.
 *
 * Values from the artboard's markup; see docs/design-specs/turn-4-design-tokens.md.
 * Palette comes from admin-tokens.css, so this screen follows light/dark with the
 * rest of the suite.
 *
 * Note the name: admin-tokens.css is the SUITE's palette, this is the Design
 * Tokens SCREEN. Two different meanings of the word, one letter apart in the
 * filename — hence this comment rather than a rename that would touch every
 * screen's dependency.
 */

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

	--t-cols: 44px 1fr 34px 150px 200px 78px;

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

.ag-tok__lede {
	max-width: 90ch;
	margin: 0 0 20px;
	font-size: 13.5px;
	line-height: 1.6;
	color: var(--t-soft);
}

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

.ag-tok__lede code,
.ag-tok__rail-var,
.ag-tok__value,
.ag-tok__var {
	font-family: var(--ag-mono);
}

.ag-tok__label {
	display: block;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: .13em;
	text-transform: uppercase;
	color: var(--t-label);
}

/* ─── the add bar ─────────────────────────────────────────────────────── */

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

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

.ag-tok__add-top {
	display: flex;
	align-items: stretch;
	border-bottom: 1px solid var(--t-hair);
}

.ag-tok__add-field { flex: 1; padding: 16px 18px; min-width: 0; }

.ag-tok__add-input {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 10px;
	flex-wrap: wrap;
}

.ag-tok__add-swatch {
	width: 30px;
	height: 30px;
	flex: none;
	border: 1px solid var(--t-border);
	border-radius: 2px;
	background: var(--t-bg-alt);
}

.ag-tok__add-input input {
	flex: 1;
	min-width: 200px;
	font-family: var(--ag-mono);
	font-size: 17px;
	padding: 4px 0;
	color: var(--t-text);
	background: none;
	border: 0;
	border-bottom: 1px solid var(--t-border);
	border-radius: 0;
	box-shadow: none;
}

.ag-tok__add-input input:focus {
	border-bottom-color: var(--t-text);
	outline: 0;
	box-shadow: none;
}

.ag-tok__add-hint { font-size: 11.5px; color: var(--t-mute); }

.ag-tok__add-read {
	width: 300px;
	flex: none;
	padding: 16px 18px;
	background: var(--ag-accent-ground);
	border-left: 1px solid var(--t-hair);
}

.ag-tok__add-read p {
	margin: 8px 0 0;
	font-size: 12px;
	line-height: 1.5;
	color: var(--t-soft);
}

.ag-tok__add-row { display: flex; align-items: flex-start; }

.ag-tok__add-cell {
	flex: 1;
	padding: 14px 18px;
	min-width: 0;
	border-left: 1px solid var(--t-hair);
}

.ag-tok__add-cell:first-child { border-left: 0; }
.ag-tok__add-cell--filed { width: 300px; flex: none; }

.ag-tok__add-name,
.ag-tok__add-var {
	display: block;
	width: 100%;
	margin-top: 8px;
	padding: 3px 0;
	background: none;
	border: 0;
	border-bottom: 1px dashed var(--t-border);
	border-radius: 0;
	box-shadow: none;
	color: var(--t-text);
}

.ag-tok__add-name { font-size: 17px; font-weight: 600; }
.ag-tok__add-var { font-family: var(--ag-mono); font-size: 15px; }

.ag-tok__add-name:focus,
.ag-tok__add-var:focus {
	border-bottom-style: solid;
	border-bottom-color: var(--t-text);
	outline: 0;
	box-shadow: none;
}

.ag-tok__add-filed {
	display: block;
	margin-top: 8px;
	font-size: 13px;
	color: var(--t-text);
}

.ag-tok__add-note,
.ag-tok__alts {
	display: block;
	margin-top: 5px;
	font-size: 11.5px;
	line-height: 1.5;
	color: var(--t-mute);
}

.ag-tok__alts { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 12px; }

.ag-tok__alt {
	font-family: var(--ag-sans);
	font-size: 11.5px;
	padding: 4px 9px;
	background: var(--t-bg-alt);
	color: var(--t-soft);
	border: 1px solid var(--t-rule);
	border-radius: 2px;
	cursor: pointer;
}

.ag-tok__alt:hover { border-color: var(--t-mute); color: var(--t-text); }

.ag-tok__add-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 18px;
	background: var(--t-bg-alt);
	border-top: 1px solid var(--t-hair);
	font-size: 11.5px;
	color: var(--t-mute);
}

.ag-tok__save {
	font-family: var(--ag-sans);
	font-size: 11.5px;
	font-weight: 600;
	padding: 6px 14px;
	background: var(--t-accent);
	color: var(--t-ink);
	border: 1px solid var(--t-accent);
	border-radius: 2px;
	cursor: pointer;
}

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

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

.ag-tok__cols {
	display: flex;
	gap: 20px;
	margin-top: 22px;
	align-items: flex-start;
}

.ag-tok__list {
	flex: 1;
	min-width: 0;
	background: var(--t-bg);
	border: 1px solid var(--t-border);
	border-radius: 3px;
	overflow: hidden;
}

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

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

.ag-tok__head span:nth-child(2) { padding-left: 0; }
.ag-tok__h-rel { text-align: center; }
.ag-tok__h-used { padding-right: 14px; text-align: right; }

/* The three groups. The band colour says which one without reading it. */
.ag-tok__band {
	display: flex;
	align-items: baseline;
	gap: 10px;
	flex-wrap: wrap;
	padding: 8px 14px;
	background: var(--t-bg-alt);
	border-bottom: 1px solid var(--t-hair);
	border-left: 3px solid var(--t-text);
}

.ag-tok__band--builder    { border-left-color: var(--ag-pipe); background: var(--ag-band-global); }
.ag-tok__band--typography { border-left-color: var(--t-rel); }

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

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

.ag-tok__row {
	display: grid;
	grid-template-columns: var(--t-cols);
	align-items: center;
	padding: 10px 0;
	border-bottom: 1px solid var(--t-hair);
}

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

.ag-tok__row.is-flagged {
	background: var(--t-warn-ground);
	border-left: 3px solid var(--t-warn-rule);
	padding-left: 0;
}

.ag-tok__swatch-cell { padding-left: 14px; }

.ag-tok__swatch {
	display: block;
	width: 22px;
	height: 22px;
	border: 1px solid rgba(0, 0, 0, .18);
	border-radius: 2px;
}

.ag-tok__glyph {
	display: grid;
	place-content: center;
	width: 22px;
	height: 22px;
	font-family: var(--ag-mono);
	font-size: 12px;
	color: var(--t-mute);
	border: 1px solid var(--t-rule);
	border-radius: 2px;
}

.ag-tok__name-cell { padding-right: 16px; min-width: 0; }

.ag-tok__name { font-size: 13px; font-weight: 600; color: var(--t-text); }

.ag-tok__filed {
	font-size: 12px;
	color: var(--t-mute);
	margin-left: 8px;
}

.ag-tok__flag {
	display: block;
	margin-top: 4px;
	font-size: 11px;
	line-height: 1.45;
	color: var(--t-warn);
}

/* The bracket that says one token points at another. */
.ag-tok__rel-cell { display: flex; justify-content: center; }

.ag-tok__rel {
	display: block;
	width: 14px;
	height: 1px;
	background: var(--t-rel);
	position: relative;
}

.ag-tok__rel::before {
	content: "";
	position: absolute;
	left: 0;
	top: -4px;
	width: 1px;
	height: 9px;
	background: var(--t-rel);
}

.ag-tok__value { font-size: 12px; color: var(--t-text); }
.ag-tok__value.is-derived { color: var(--t-rel); }

.ag-tok__var {
	font-size: 11.5px;
	color: var(--t-soft);
	overflow-wrap: anywhere;
	padding-right: 10px;
}

.ag-tok__used {
	padding-right: 14px;
	font-family: var(--ag-mono);
	font-size: 12px;
	text-align: right;
	color: var(--t-text);
}

.ag-tok__zero { color: var(--t-label); }
.ag-tok__row.is-unused .ag-tok__name { color: var(--t-soft); }

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

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

.ag-tok__foot-figures strong { display: block; font-size: 12.5px; color: var(--t-text); }

.ag-tok__foot-figures span,
.ag-tok__foot-scan {
	display: block;
	font-size: 11px;
	color: var(--t-mute);
	margin-top: 3px;
}

/* ─── the rail ────────────────────────────────────────────────────────── */

.ag-tok__rail {
	width: 300px;
	flex: none;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.ag-tok__panel {
	background: var(--t-bg);
	border: 1px solid var(--t-border);
	border-radius: 3px;
	padding: 14px 16px 16px;
}

.ag-tok__panel--warn {
	background: var(--t-warn-ground);
	border-color: var(--t-warn-rule);
}

.ag-tok__panel p {
	margin: 8px 0 0;
	font-size: 12px;
	line-height: 1.55;
	color: var(--t-soft);
}

.ag-tok__panel--warn p { color: var(--ag-warn-ink); }

.ag-tok__rail-var {
	display: block;
	margin-top: 6px;
	font-size: 12px;
	color: var(--t-text);
	overflow-wrap: anywhere;
}

.ag-tok__rail-head {
	display: block;
	margin-top: 14px;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: .13em;
	text-transform: uppercase;
	color: var(--t-label);
}

.ag-tok__rail-list {
	margin: 7px 0 0;
	padding: 0;
	list-style: none;
}

.ag-tok__rail-list li {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 3px 0;
	font-size: 11.5px;
	color: var(--t-soft);
	border-bottom: 1px solid var(--t-hair);
}

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

.ag-tok__rail-list em {
	font-family: var(--ag-mono);
	font-style: normal;
	color: var(--t-text);
}

.ag-tok__rail-note { font-size: 12px; }
.ag-tok__rail-note strong { color: var(--t-text); }

.ag-tok__link {
	display: inline-block;
	margin-top: 10px;
	font-size: 12px;
	color: var(--t-text);
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-color: var(--t-border);
}

.ag-tok__link:hover { text-decoration-color: var(--t-text); }

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

@media (max-width: 1240px) {
	.ag-tok__cols { flex-direction: column; }
	.ag-tok__rail { width: 100%; flex-direction: row; flex-wrap: wrap; }
	.ag-tok__panel { flex: 1; min-width: 260px; }
	.ag-tok__add-top,
	.ag-tok__add-row { flex-direction: column; }
	.ag-tok__add-read,
	.ag-tok__add-cell--filed { width: auto; }
	.ag-tok__add-cell { border-left: 0; border-top: 1px solid var(--t-hair); }
}

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

	.ag-tok__row {
		grid-template-columns: 44px 1fr;
		gap: 4px 0;
		padding: 12px 0;
	}

	.ag-tok__rel-cell { display: none; }

	.ag-tok__value,
	.ag-tok__var,
	.ag-tok__used {
		grid-column: 2;
		text-align: left;
		padding-right: 14px;
	}
}
