/*!
 * @Rank – JWT Decoder & Inspector: the tool's own rules.
 *
 * The palette, header, cards, buttons, notices and toast all come from
 * assets/css/atrank-core.css. Only what is specific to this tool is here, and
 * every rule is anchored on .atrank-jwt.
 *
 * Two rules here are function rather than decoration:
 *   · the verdict bar sits ABOVE the decoded contents and is coloured, because
 *     an unverified payload shown in a tidy box reads as trustworthy and is
 *     not — the state of the signature has to be seen before the claims are;
 *   · the three parts of the token are tinted in the field itself, so the
 *     boundary between header, payload and signature is visible in the paste
 *     rather than only in the panels below.
 */

.atrank-jwt .atrank-cardhead {
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 6px;
}
.atrank-jwt .atrank-cardhead h2 {
	margin: 0;
	font-size: 13px;
	font-weight: 700;
	color: var(--accent);
}

.atrank-jwt .atrank-jwt-token {
	display: block;
	width: 100%;
	min-width: 0;
	min-height: 72px;
	max-height: 30vh;
	resize: vertical;
	padding: 9px 11px;
	border: 1px solid var(--line2);
	border-radius: var(--r);
	background: var(--inset);
	color: var(--txt);
	font-family: var(--mono);
	font-size: 12.5px;
	line-height: 1.6;
	overflow-wrap: anywhere;
	word-break: break-all;
}
.atrank-jwt .atrank-jwt-token:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: var(--ring);
}

/* Above the contents, and coloured. A tidy payload in a neat box reads as
   trustworthy; the signature state has to be seen first. */
.atrank-jwt .atrank-jwt-verdict:not(:empty) {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 9px;
	margin-top: 9px;
	padding: 7px 11px;
	border: 1px solid var(--line);
	border-radius: var(--r);
	background: var(--panel2);
	font-size: 12px;
	line-height: 1.45;
}
.atrank-jwt .atrank-jwt-verdict strong {
	font-size: 11.5px;
	letter-spacing: 0.05em;
	white-space: nowrap;
}
.atrank-jwt .atrank-jwt-verdict.is-ok {
	background: var(--ok-soft);
	border-color: var(--ok);
	color: var(--ok);
}
.atrank-jwt .atrank-jwt-verdict.is-err {
	background: var(--err-soft);
	border-color: var(--err);
	color: var(--err);
}
.atrank-jwt .atrank-jwt-verdict.is-warn {
	background: var(--warn-soft);
	border-color: var(--warn);
	color: var(--warn);
}

/* ── Layout ───────────────────────────────────────────────────────────── */
.atrank-jwt .atrank-jwt-panes {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
	margin-top: 10px;
	align-items: start;
}
@media (min-width: 960px) {
	.atrank-jwt .atrank-jwt-panes {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	}
}
.atrank-jwt .atrank-jwt-col {
	display: grid;
	gap: 10px;
	min-width: 0;
	align-content: start;
}

.atrank-jwt .atrank-jwt-json {
	margin: 0;
	padding: 9px 11px;
	border: 1px solid var(--line);
	border-radius: var(--r);
	background: var(--inset);
	color: var(--txt);
	font-family: var(--mono);
	font-size: 12px;
	line-height: 1.55;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	min-height: 2.4em;
	/* Capped and scrolled rather than grown. A payload is whatever somebody's
	   identity provider decided to put in it — an enterprise token with thirty
	   claims and a permissions array would otherwise make the page several
	   screens long, and the claims table beside it is the better reading of the
	   same data anyway. */
	max-height: 190px;
	overflow-y: auto;
}
.atrank-jwt #atrank-jwt-header {
	max-height: 120px;
}

/* ── The claims ───────────────────────────────────────────────────────── */
.atrank-jwt .atrank-jwt-claims {
	display: grid;
	gap: 6px;
	/* Bounded for the same reason as the JSON panels, and this is the one that
	   actually mattered: an enterprise token with thirty claims and a
	   permissions array produced a page two and a half screens tall. Six claims
	   — the ordinary case — never reach this. */
	max-height: 620px;
	overflow-y: auto;
}

.atrank-jwt .atrank-jwt-claim {
	display: grid;
	grid-template-columns: minmax(6ch, auto) minmax(0, 1fr);
	gap: 9px;
	padding: 6px 9px;
	border: 1px solid var(--line);
	border-radius: var(--r);
	background: var(--panel2);
}
.atrank-jwt .atrank-jwt-claim.is-ok {
	border-color: var(--ok);
}
.atrank-jwt .atrank-jwt-claim.is-err {
	border-color: var(--err);
	background: var(--err-soft);
}

.atrank-jwt .atrank-jwt-claimname {
	font-family: var(--mono);
	font-size: 12px;
	font-weight: 700;
	color: var(--muted);
}
.atrank-jwt .atrank-jwt-claimname.is-registered {
	color: var(--accent);
}

.atrank-jwt .atrank-jwt-claimbody {
	min-width: 0;
}
.atrank-jwt .atrank-jwt-claimvalue {
	font-family: var(--mono);
	font-size: 12px;
	color: var(--txt);
	overflow-wrap: anywhere;
	white-space: pre-wrap;
}
.atrank-jwt .atrank-jwt-claimtime {
	margin-top: 2px;
	font-family: var(--mono);
	font-size: 11px;
	color: var(--muted);
}
.atrank-jwt .atrank-jwt-claim.is-err .atrank-jwt-claimtime {
	color: var(--err);
	font-weight: 700;
}
.atrank-jwt .atrank-jwt-claimmeaning {
	margin-top: 3px;
	font-size: 11px;
	line-height: 1.45;
	color: var(--dim);
}

/* ── Checking ─────────────────────────────────────────────────────────── */
.atrank-jwt .atrank-jwt-field {
	display: block;
	margin-bottom: 8px;
}
.atrank-jwt .atrank-jwt-label {
	display: block;
	margin-bottom: 3px;
	font-size: 11.5px;
	font-weight: 600;
	color: var(--dim);
}
.atrank-jwt .atrank-jwt-select {
	font: inherit;
	font-size: 12.5px;
	padding: 5px 8px;
	border-radius: var(--r);
	border: 1px solid var(--line2);
	background: var(--panel);
	color: var(--txt);
}
.atrank-jwt .atrank-jwt-key {
	display: block;
	width: 100%;
	min-width: 0;
	resize: vertical;
	padding: 7px 9px;
	border: 1px solid var(--line2);
	border-radius: var(--r);
	background: var(--inset);
	color: var(--txt);
	font-family: var(--mono);
	font-size: 12px;
	line-height: 1.5;
	overflow-wrap: anywhere;
}
.atrank-jwt .atrank-jwt-select:focus,
.atrank-jwt .atrank-jwt-key:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: var(--ring);
}
