/* Design tokens and components — see docs/design.md. Light theme only (deliberate:
   printed-document identity); dark mode is cheap later via these tokens. */

:root {
  /* light-only by design (printed-document identity, docs/design.md) — "only light"
     stops Chrome/Safari auto-dark from inverting the palette into mud. */
  color-scheme: only light;
  --paper: #f4efe2;
  --card: #fdfbf2;
  --ink: #2e2a21;
  --muted: #6e6654;
  --gold: #a98f1f;
  --gold-deep: #7e6a14;
  --hairline: #e2d8bc;
  --hairline-strong: #cfc29d;
  /* C-27: dark enough for AA on the 7%-tinted flash/pill backgrounds, not just on card. */
  --success: #446e3e;
  --danger: #a93e2c;
  --focus: #8a6d14;
  --b1: #35648f;
  --b2: #47804f;
  --b3: #6e4e93;
  --b4: #b0492f;
  --b5: #c07e24;
  --b6: #3e8b96;
  --shadow: 0 1px 3px rgba(60, 50, 20, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  margin: 0;
  min-height: 100vh;
}

h1,
h2,
h3,
.serif {
  font-family: Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-weight: 700;
  text-wrap: balance;
}

h1 {
  font-size: 1.9rem;
  margin: 0 0 0.25rem;
}

h2 {
  font-size: 1.35rem;
  margin: 0 0 1rem;
}

h3 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

a {
  color: var(--gold-deep);
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.container-narrow {
  max-width: 640px;
}

/* top bar */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--hairline);
  box-shadow: var(--shadow);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.wordmark {
  font-family: Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}

.wordmark span {
  color: var(--gold-deep);
}

.rolebadge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* typography helpers */
.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--gold-deep);
  margin: 0 0 0.35rem;
}

.lede {
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
  font-style: italic;
  color: var(--muted);
  margin: 0 0 1rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.num {
  font-variant-numeric: tabular-nums;
}

/* cards + grid */
.card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.grid {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.grid-tiles {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0;
}

.tile .spacer {
  flex: 1;
}

/* buttons + forms */
button,
.btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  padding: 0.6rem 1.25rem;
  min-height: 44px;
  border: 1px solid var(--gold-deep);
  background: var(--gold-deep);
  color: var(--card);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* darken, don't lighten: keeps the gold-deep label above 4.5:1 on hover (C-27) */
button:hover,
.btn:hover {
  filter: brightness(0.9);
}

.btn-quiet {
  background: transparent;
  color: var(--gold-deep);
  border-color: var(--hairline-strong);
}

.btn-small {
  min-height: 34px;
  padding: 0.25rem 0.8rem;
  font-size: 0.85rem;
}

button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  font: inherit;
  width: 100%;
  padding: 0.55rem 0.75rem;
  min-height: 44px;
  border: 1px solid var(--hairline-strong);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}

textarea {
  min-height: 8rem;
}

.field {
  margin-bottom: 1.1rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row .field {
  flex: 1;
  min-width: 160px;
}

/* pills */
.pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-radius: 99px;
  padding: 0.22rem 0.7rem;
  white-space: nowrap;
}

.pill-gold {
  background: var(--gold-deep);
  color: var(--card);
}

.pill-open {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--hairline-strong);
}

.pill-success {
  background: transparent;
  color: var(--success);
  border: 1px solid var(--success);
}

.pill-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

/* tables */
.table-scroll {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}

th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-deep);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--gold);
}

td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

/* flash messages */
.flash {
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid;
}

.flash-success {
  border-color: var(--success);
  color: var(--success);
  background: color-mix(in srgb, var(--success) 7%, var(--card));
}

.flash-error {
  border-color: var(--danger);
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 7%, var(--card));
}

/* invite link box */
.invite-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  word-break: break-all;
  background: var(--paper);
  border: 1px dashed var(--hairline-strong);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  display: block;
  max-width: 34rem;
}

/* test player */
.timerbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 0.6rem;
  margin-bottom: 1.2rem;
  gap: 1rem;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.05rem;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0.5rem 0 0;
}

legend {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 0.9rem;
  max-width: 62ch;
}

.choice {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  border: 1px solid var(--hairline-strong);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
  cursor: pointer;
  background: var(--card);
  font-weight: 400;
}

.choice:hover {
  border-color: var(--gold);
}

.choice input {
  margin-top: 0.2rem;
  width: 18px;
  height: 18px;
  accent-color: var(--gold-deep);
  flex-shrink: 0;
}

.ordering-row {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.ordering-row select {
  width: auto;
  min-width: 5.5rem;
}

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* track wrapper */
.track-frame {
  width: 100%;
  height: 78vh;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--card);
}

/* auth pages */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

footer.site {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2rem 0;
}

/* small screens: keep the timer bar tidy (C-27/C-29); tables scroll via .table-scroll */
@media (max-width: 640px) {
  .timerbar {
    flex-wrap: wrap;
    gap: 0.3rem;
  }
}

/* ——— ornament kit: landing-grade polish shared by interior screens ——— */

/* standard page head rhythm: eyebrow + h1 + lede */
.page-head {
  margin-bottom: 1.6rem;
  max-width: 62ch;
}

/* short double gold rule as a quiet section divider */
.rule-orn {
  width: 110px;
  margin: 2.4rem auto;
  border: 0;
  border-top: 3px double var(--gold);
}

/* empty state: dashed card, muted, centered */
.empty-card {
  background: transparent;
  border: 1.5px dashed var(--hairline-strong);
  border-radius: 10px;
  box-shadow: none;
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--muted);
}

.empty-card .icon {
  color: var(--gold);
  display: block;
  margin: 0 auto 0.6rem;
}

/* gentle lift for interactive tiles */
@media (prefers-reduced-motion: no-preference) {
  .lift {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(60, 50, 20, 0.12);
  }
}

/* score display + meter (the look Tafel III advertises on the landing page) */
.score {
  font-family: Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 2.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 0.1rem 0 0.9rem;
}

.meter {
  height: 10px;
  border-radius: 99px;
  background: var(--hairline);
  overflow: hidden;
  margin-bottom: 0.9rem;
}

.meter i {
  display: block;
  height: 100%;
  background: var(--gold-deep);
  border-radius: 99px;
}

/* result page (learn/result.html) */
.result-card {
  text-align: center;
}

.result-card .meter {
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.result-card .result-stufe {
  margin: 0 0 1.1rem;
}

.result-card .result-copy {
  max-width: 46ch;
  margin: 0 auto 1.5rem;
}

.result-card .signet {
  display: block;
  margin: 0 auto 1.4rem;
}

/* per-screen additions (interior elevation) */

/* auth screens: certificate head — house signet + centered eyebrow/title */
.auth-head {
  text-align: center;
}

.auth-head .auth-signet {
  display: inline-block;
  color: var(--gold-deep);
  margin-bottom: 0.4rem;
}

.auth-head .rule-orn {
  margin: 1rem auto 1.4rem;
}

/* short message pages (error): center the whole card */
.auth-card-center {
  text-align: center;
}

.auth-card-center .btn {
  margin-top: 0.8rem;
}

/* HR screens (hr/persons.html, hr/progress.html) */
.hr-assign-form {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.hr-empty-td {
  border-bottom: 0;
  padding: 1rem 0.75rem;
}

.hr-empty-td .empty-card p {
  margin: 0.15rem 0;
}

/* card heading with a leading gold line-art icon (tenant-detail sections) */
.adm-h2 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.adm-h2 svg {
  color: var(--gold);
  flex-shrink: 0;
}

/* styled empty row inside tables (empty states that live in a th:if row) */
.adm-empty {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 1.6rem 0.75rem;
}

/* Screen-reader-only content (C-27), e.g. the timer milestone announcements. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
