/* DESIGN-001 components: buttons, focus, flash, forms, cards, progress, status chips, dashboard.
   Light only. Focus is always a visible oranje ring. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--oranje); outline-offset: 3px; border-radius: 2px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 1px; border-color: var(--saltire); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Buttons */
.button, button.button, input.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  font-family: var(--ui); font-weight: 600; font-size: .92rem; line-height: 1.2;
  background: var(--saltire); color: var(--sheet); text-decoration: none; cursor: pointer;
  padding: 10px 18px; border: 1px solid var(--saltire); border-radius: var(--radius);
}
.button:hover { background: #163E70; border-color: #163E70; }
.button-ghost, button.button-ghost { background: var(--sheet); color: var(--saltire); }
.button-ghost:hover { background: var(--saltire-wash); border-color: var(--saltire); }
.button-small { min-height: 36px; padding: 6px 14px; font-size: .86rem; }
.button.is-done { background: var(--saltire-wash); color: var(--saltire); }
.button.is-done::before { content: ""; width: 9px; height: 5px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg) translateY(-2px); }
.inline-form { display: inline; margin: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--saltire); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin: var(--space-3) 0 0; }

/* Header account area */
.account { display: flex; align-items: center; gap: var(--space-3); font-family: var(--ui); font-size: .9rem; }
.account a:not(.button) { color: var(--ink); text-decoration: none; }
.account a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--oranje); }
.account .who { color: var(--muted); max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Flash */
.flash { font-family: var(--ui); font-size: .92rem; border-radius: var(--radius); padding: 10px 14px; margin: 0 0 var(--space-5); max-width: var(--measure); }
.flash-notice { background: var(--saltire-wash); color: #143A68; border-left: 3px solid var(--saltire); }
.flash-alert { background: var(--oranje-wash); color: var(--oranje-ink); border-left: 3px solid var(--oranje); }

/* Cards */
.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: var(--space-5); min-width: 0; }
.card h2 { font-size: 1.5rem; margin: 6px 0 var(--space-2); }
.card h3 { font-size: 1.25rem; margin: 6px 0 var(--space-3); }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--saltire); text-decoration: underline; }
.h3 { font-size: 1.3rem; }
.section-h { font-size: 1.4rem; margin: var(--space-6) 0 var(--space-3); }
.panel-h, .card .panel-h { font-family: var(--ui); font-size: .74rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--space-2); }
.meta-line { font-family: var(--ui); font-size: .9rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.meta-line b { color: var(--ink); }

/* Forms */
.auth { max-width: 460px; margin: 0 auto; }
.auth-head { margin-bottom: var(--space-4); }
.auth-head h1 { font-size: clamp(2rem, 6vw, 2.6rem); }
.auth-alt { font-family: var(--ui); font-size: .9rem; color: var(--muted); margin-top: var(--space-4); display: flex; flex-wrap: wrap; gap: 4px 8px; }
.form-card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: var(--space-5); display: grid; gap: var(--space-4); }
.form-card .field input, .form-card .field textarea { width: 100%; }
.field { display: grid; gap: 4px; min-width: 0; align-content: start; font-family: var(--ui); font-size: .9rem; }
.field label, .field legend { font-weight: 600; color: var(--ink); }
.field .help { font-size: .8rem; color: var(--muted); }
.field input[type="email"], .field input[type="password"], .field input[type="text"], .field textarea {
  font: inherit; font-size: 1rem; padding: 10px 12px; border: 1px solid #B9C1B6; border-radius: var(--radius); background: var(--sheet); color: var(--ink); min-height: 44px;
}
.field textarea { font-family: var(--text); line-height: 1.55; resize: vertical; }
.radios { border: 0; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.radios label { font-weight: 400; display: flex; gap: 8px; align-items: baseline; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.form-errors { background: var(--oranje-wash); color: var(--oranje-ink); border-radius: var(--radius); padding: 10px 14px; font-family: var(--ui); font-size: .9rem; }
.form-errors p { margin: 0 0 4px; }
.form-errors ul { margin: 0; padding-left: 18px; }
.field_with_errors { display: contents; }
.field_with_errors input, .field_with_errors textarea { border-color: var(--oranje); }

/* Progress */
.progress { height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: var(--saltire); transition: width .3s; }
.prog-label { font-family: var(--ui); font-size: .8rem; color: var(--muted); margin: 6px 0 0; }
@media (prefers-reduced-motion: reduce) { .progress i { transition: none; } }

/* Submission status */
.status-chip { display: inline-block; font-family: var(--ui); font-size: .72rem; font-weight: 600; letter-spacing: .04em; border-radius: 999px; padding: 2px 10px; border: 1px solid var(--rule); white-space: nowrap; }
.status-submitted { background: var(--sheet); color: var(--muted); }
.status-reviewed { background: var(--saltire-wash); color: var(--saltire); border-color: var(--saltire-wash); }
.status-returned { background: var(--oranje-wash); color: var(--oranje-ink); border-color: var(--oranje-wash); }

/* Chips used as filters */
.chips { gap: var(--space-2); }
.chip { font-family: var(--ui); font-size: .84rem; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--sheet); color: var(--ink); text-decoration: none; }
.chip[aria-current="true"] { background: var(--saltire); border-color: var(--saltire); color: var(--sheet); }

/* Course page enrollment panel */
.enroll-panel { max-width: 560px; margin: 0 0 var(--space-5); }

/* Dashboard */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-6); align-items: start; }
.dash-main > .card.current { border-top: 3px solid var(--saltire); }
.dash-rail { display: grid; gap: var(--space-5); background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: var(--space-5); font-family: var(--ui); font-size: .9rem; }
.dash-rail p { margin: 0 0 var(--space-2); }
.course-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }
.course-card .button { margin-top: var(--space-3); }
.done-note { font-family: var(--ui); font-size: .88rem; color: var(--saltire); font-weight: 600; margin: var(--space-3) 0 0; }
.sub-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding-bottom: var(--space-2); border-bottom: 1px solid var(--rule); }
.done-list li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-family: var(--ui); }
.dot-done { width: 12px; height: 12px; border-radius: 50%; background: var(--saltire); }
.empty { max-width: 560px; }

/* Admin review */
.submission-body { max-width: var(--measure); margin-bottom: var(--space-5); }
.table-wrap { overflow-x: auto; }

@media (max-width: 900px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .account .who { display: none; }
  .card, .form-card { padding: var(--space-4); }
}
.card .prog-label + p, .card .prog-label + .row-actions, .card .prog-label + .button { margin-top: var(--space-4); }
