/**
 * Learner dashboard — front end.
 *
 * Sits inside whatever theme the site runs, so it stays neutral: system
 * fonts, no imposed background, colour used only where it carries meaning
 * (progress filled vs empty, delete vs everything else). The one place it
 * spends anything is the progress dots, because that is the thing the
 * learner opens the page to see.
 *
 * Everything is scoped under .tpi-learner so it cannot leak into the theme.
 */

.tpi-learner {
	--tpi-ink: #1a1a1a;
	--tpi-quiet: #6b6b6b;
	--tpi-line: #e0e0e0;
	--tpi-fill: #1e6b3a;
	--tpi-empty: #dcdcdc;
	--tpi-danger: #b32d2e;

	max-width: 780px;
	margin: 0 auto;
	color: var(--tpi-ink);
	font-size: 16px;
	line-height: 1.5;
}

.tpi-learner *,
.tpi-learner *::before,
.tpi-learner *::after {
	box-sizing: border-box;
}

/* ---------------------------------------------------------------
 * Notices
 * ------------------------------------------------------------- */

.tpi-learner-notice {
	padding: 24px;
	border: 1px solid var(--tpi-line);
	border-radius: 6px;
	text-align: center;
}

.tpi-learner-erased {
	margin: 16px auto;
	padding: 14px 18px;
	border-left: 3px solid var(--tpi-fill);
	background: #f4f8f5;
}

.tpi-learner-erased p {
	margin: 0;
}

.tpi-learner-error {
	margin: 0 0 16px;
	padding: 10px 14px;
	border-left: 3px solid var(--tpi-danger);
	background: #fcf0f1;
	color: #8a2424;
}

/* ---------------------------------------------------------------
 * Header and stats
 * ------------------------------------------------------------- */

.tpi-learner-header h2 {
	margin: 0 0 20px;
	font-size: 24px;
	line-height: 1.2;
}

.tpi-learner-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 12px;
	margin-bottom: 20px;
}

.tpi-learner-stat {
	padding: 16px;
	border: 1px solid var(--tpi-line);
	border-radius: 6px;
}

.tpi-learner-stat-value {
	display: block;
	font-size: 28px;
	font-weight: 600;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
}

.tpi-learner-stat-of {
	color: var(--tpi-quiet);
	font-size: 18px;
	font-weight: 400;
}

.tpi-learner-stat-label {
	display: block;
	margin-top: 4px;
	color: var(--tpi-quiet);
	font-size: 13px;
}

.tpi-learner-testdate {
	margin: 0 0 24px;
	padding: 12px 16px;
	border-left: 3px solid var(--tpi-fill);
	background: #f4f8f5;
}

/* ---------------------------------------------------------------
 * Sections
 * ------------------------------------------------------------- */

.tpi-learner-section {
	margin-bottom: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--tpi-line);
}

.tpi-learner-section h3 {
	margin: 0 0 12px;
	font-size: 18px;
}

.tpi-learner-intro,
.tpi-learner-empty {
	margin: 0 0 16px;
	color: var(--tpi-quiet);
	font-size: 14px;
}

/* ---------------------------------------------------------------
 * Lessons
 * ------------------------------------------------------------- */

.tpi-learner-lessons {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tpi-learner-lessons li {
	padding: 10px 0;
	border-bottom: 1px solid var(--tpi-line);
}

.tpi-learner-lessons li:last-child {
	border-bottom: 0;
}

.tpi-learner-lesson-when {
	display: block;
	font-weight: 600;
}

.tpi-learner-lesson-meta,
.tpi-learner-lesson-focus {
	display: block;
	margin-top: 2px;
	color: var(--tpi-quiet);
	font-size: 14px;
}

/* ---------------------------------------------------------------
 * The record
 * ------------------------------------------------------------- */

.tpi-learner-group {
	margin-bottom: 20px;
}

.tpi-learner-group h4 {
	margin: 0 0 6px;
	color: var(--tpi-quiet);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.tpi-learner-skills {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tpi-learner-skill {
	display: grid;
	grid-template-columns: 1fr auto auto;
	align-items: center;
	gap: 12px;
	padding: 8px 0;
	border-bottom: 1px solid var(--tpi-line);
}

.tpi-learner-skill:last-child {
	border-bottom: 0;
}

.tpi-learner-skill-name {
	font-size: 15px;
}

.tpi-learner-skill-num {
	display: inline-block;
	min-width: 22px;
	color: var(--tpi-quiet);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

.tpi-learner-levels {
	display: flex;
	gap: 4px;
}

.tpi-learner-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--tpi-empty);
}

.tpi-learner-dot.is-filled {
	background: var(--tpi-fill);
}

.tpi-learner-skill-level {
	min-width: 84px;
	color: var(--tpi-quiet);
	font-size: 12px;
	text-align: right;
}

/* ---------------------------------------------------------------
 * Levels key
 * ------------------------------------------------------------- */

.tpi-learner-key,
.tpi-learner-erase {
	margin-top: 16px;
	padding: 12px 16px;
	border: 1px solid var(--tpi-line);
	border-radius: 6px;
}

.tpi-learner-key summary,
.tpi-learner-erase summary {
	cursor: pointer;
	font-weight: 600;
}

.tpi-learner-key dl {
	margin: 12px 0 0;
}

.tpi-learner-key dt {
	margin-top: 10px;
	font-weight: 600;
}

.tpi-learner-key dd {
	margin: 2px 0 0;
	color: var(--tpi-quiet);
	font-size: 14px;
}

/* ---------------------------------------------------------------
 * Data and erasure
 * ------------------------------------------------------------- */

.tpi-learner-data p {
	margin: 0 0 14px;
	font-size: 14px;
}

.tpi-learner-inline-form {
	margin-bottom: 8px;
}

.tpi-learner-erase {
	border-color: #e8c9ca;
}

.tpi-learner-erase summary {
	color: var(--tpi-danger);
}

.tpi-learner-erase label {
	display: block;
	margin-bottom: 4px;
	font-size: 13px;
	font-weight: 600;
}

.tpi-learner-erase input[type="text"] {
	width: 160px;
	margin-bottom: 10px;
	padding: 8px 10px;
	border: 1px solid var(--tpi-line);
	border-radius: 4px;
	font-size: 15px;
}

/* ---------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------- */

.tpi-learner .tpi-button {
	display: inline-block;
	padding: 9px 16px;
	border: 1px solid var(--tpi-ink);
	border-radius: 4px;
	background: var(--tpi-ink);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.tpi-learner .tpi-button:hover,
.tpi-learner .tpi-button:focus {
	opacity: 0.9;
	color: #fff;
}

.tpi-learner .tpi-button-quiet {
	background: transparent;
	border-color: var(--tpi-line);
	color: var(--tpi-ink);
}

.tpi-learner .tpi-button-quiet:hover,
.tpi-learner .tpi-button-quiet:focus {
	border-color: var(--tpi-ink);
	color: var(--tpi-ink);
}

.tpi-learner .tpi-button-danger {
	border-color: var(--tpi-danger);
	background: var(--tpi-danger);
}

.tpi-learner .tpi-button:focus-visible {
	outline: 2px solid var(--tpi-fill);
	outline-offset: 2px;
}

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

@media (max-width: 600px) {
	.tpi-learner-skill {
		grid-template-columns: 1fr auto;
		row-gap: 2px;
	}

	.tpi-learner-skill-level {
		grid-column: 1 / -1;
		text-align: left;
	}
}

/* ---------------------------------------------------------------
 * Money
 * ------------------------------------------------------------- */

.tpi-learner-balance {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 12px;
	padding: 14px 18px;
	border-left: 3px solid var(--tpi-fill);
	background: #f4f8f5;
}

.tpi-learner-balance-owed {
	border-left-color: var(--tpi-danger);
	background: #fcf0f1;
}

.tpi-learner-balance-value {
	font-size: 26px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.tpi-learner-balance-label {
	color: var(--tpi-quiet);
	font-size: 14px;
}

.tpi-learner-hours-left {
	margin: 0 0 16px;
	font-size: 14px;
}

.tpi-learner-statement {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.tpi-learner-statement th,
.tpi-learner-statement td {
	padding: 8px 4px;
	border-bottom: 1px solid var(--tpi-line);
	text-align: left;
}

.tpi-learner-statement th {
	color: var(--tpi-quiet);
	font-size: 12px;
	font-weight: 600;
}

.tpi-learner-amount {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.tpi-learner-amount.is-charge {
	color: var(--tpi-ink);
}

.tpi-learner-amount.is-payment {
	color: var(--tpi-fill);
}

.tpi-learner-detail {
	color: var(--tpi-quiet);
}
