/*!
 * @Rank – Cron Expression Parser & Builder: 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-cron.
 *
 * Three rules here are function rather than decoration:
 *   · the expression is set in the monospace face at a larger size, because a
 *     crontab line is read character by character and the difference between
 *     a comma and a full stop decides what it means;
 *   · the run times use tabular figures, so a column of them lines up and an
 *     uneven gap is visible as a ragged column rather than needing arithmetic;
 *   · a run whose wall time does not exist, or happens twice, is coloured on
 *     the row itself — those two are the whole reason to look at a list of
 *     times rather than trust the sentence above it.
 */

.atrank-cron .atrank-cron-entry {
	display: flex;
	gap: 8px;
	align-items: stretch;
}

/* Read character by character: a comma and a full stop mean different things. */
.atrank-cron .atrank-cron-input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 8px 11px;
	border: 1px solid var(--line2);
	border-radius: var(--r);
	background: var(--inset);
	color: var(--txt);
	font-family: var(--mono);
	font-size: 16px;
	letter-spacing: 0.06em;
}
.atrank-cron .atrank-cron-input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: var(--ring);
}

.atrank-cron .atrank-cron-english {
	margin: 9px 0 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.45;
	color: var(--accent);
}
.atrank-cron .atrank-cron-english.is-err {
	color: var(--err);
	font-weight: 500;
}

/* ── The field breakdown ──────────────────────────────────────────────── */
.atrank-cron .atrank-cron-fields {
	display: grid;
	gap: 3px;
	margin-top: 9px;
}
.atrank-cron .atrank-cron-fieldrow {
	display: grid;
	grid-template-columns: 6ch 15ch minmax(0, 1fr);
	gap: 9px;
	align-items: baseline;
	padding: 3px 7px;
	border-radius: var(--r);
	background: var(--panel2);
	font-size: 11.5px;
}
.atrank-cron .atrank-cron-fieldraw {
	font-family: var(--mono);
	font-weight: 700;
	color: var(--accent);
	overflow-wrap: anywhere;
}
.atrank-cron .atrank-cron-fieldname {
	color: var(--dim);
}
.atrank-cron .atrank-cron-fieldvalues {
	font-family: var(--mono);
	color: var(--muted);
	overflow-wrap: anywhere;
}

/* ── The presets ──────────────────────────────────────────────────────── */
.atrank-cron .atrank-cron-presets {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	margin-top: 10px;
	padding-top: 9px;
	border-top: 1px solid var(--line);
}
.atrank-cron .atrank-cron-preset {
	padding: 3px 9px;
	border: 1px solid var(--line2);
	border-radius: 20px;
	background: var(--panel);
	color: var(--muted);
	font: inherit;
	font-size: 11.5px;
	cursor: pointer;
	transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.atrank-cron .atrank-cron-preset:hover {
	border-color: var(--accent);
	color: var(--accent);
}
.atrank-cron .atrank-cron-preset:focus-visible {
	outline: none;
	box-shadow: var(--ring);
}

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

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

.atrank-cron .atrank-cron-zonewrap {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
}
.atrank-cron .atrank-cron-select {
	font: inherit;
	font-size: 12px;
	max-width: 24ch;
	padding: 4px 7px;
	border-radius: var(--r);
	border: 1px solid var(--line2);
	background: var(--panel);
	color: var(--txt);
}
.atrank-cron .atrank-cron-select:focus-visible {
	outline: none;
	box-shadow: var(--ring);
	border-color: var(--accent);
}

/* ── The runs ─────────────────────────────────────────────────────────── */
.atrank-cron .atrank-cron-runs {
	display: grid;
	gap: 3px;
}

.atrank-cron .atrank-cron-run {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 9px;
	padding: 4px 8px;
	border: 1px solid var(--line);
	border-radius: var(--r);
	background: var(--panel2);
}
/* The two cases that are the reason to read a list of times at all. */
.atrank-cron .atrank-cron-run.is-missing {
	border-color: var(--err);
	background: var(--err-soft);
}
.atrank-cron .atrank-cron-run.is-double {
	border-color: var(--warn);
	background: var(--warn-soft);
}

.atrank-cron .atrank-cron-runindex {
	min-width: 2ch;
	font-size: 10.5px;
	color: var(--dim);
	font-variant-numeric: tabular-nums;
}
/* Tabular figures: a ragged column is what an uneven gap looks like. */
.atrank-cron .atrank-cron-runwhen {
	font-family: var(--mono);
	font-size: 12.5px;
	font-variant-numeric: tabular-nums;
	color: var(--txt);
	white-space: pre;
}
.atrank-cron .atrank-cron-runday {
	font-size: 11.5px;
	color: var(--dim);
}
.atrank-cron .atrank-cron-rungap {
	margin-left: auto;
	font-family: var(--mono);
	font-size: 11px;
	color: var(--muted);
}
.atrank-cron .atrank-cron-runflag {
	margin-left: auto;
	font-size: 11px;
	font-weight: 700;
}
.atrank-cron .atrank-cron-runflag.is-missing {
	color: var(--err);
}
.atrank-cron .atrank-cron-runflag.is-double {
	color: var(--warn);
}

/* ── The builder ──────────────────────────────────────────────────────── */
.atrank-cron .atrank-cron-buildrow {
	display: grid;
	grid-template-columns: 8ch minmax(0, 1fr);
	gap: 8px;
	align-items: center;
	margin-bottom: 6px;
}
.atrank-cron .atrank-cron-buildlabel {
	font-size: 11.5px;
	font-weight: 600;
	color: var(--dim);
}
.atrank-cron .atrank-cron-number {
	width: 100%;
	min-width: 0;
	font: inherit;
	font-size: 12.5px;
	font-variant-numeric: tabular-nums;
	padding: 4px 7px;
	border-radius: var(--r);
	border: 1px solid var(--line2);
	background: var(--panel);
	color: var(--txt);
}
.atrank-cron .atrank-cron-number:focus-visible {
	outline: none;
	box-shadow: var(--ring);
	border-color: var(--accent);
}
.atrank-cron .atrank-cron-buildapply {
	width: 100%;
	margin-top: 3px;
}
