/* Compliance QC Tools: page shell. Self-hosted Poppins, layout, header and tool switcher,
   form controls, panels, tables, footer and wave. Look follows Tuscan Club University
   (Compliance Training/modules/template.html and sim/SPEC.md, Design). Light theme only.
   Components (citations, Regulatory Basis, timeline) are in components.css; print in print.css. */

/* Poppins, Latin subset, self-hosted (SIL Open Font License; see assets/fonts/OFL.txt). */
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/poppins-latin-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/poppins-latin-500.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/poppins-latin-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/poppins-latin-700.woff2") format("woff2"); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  overflow-x: hidden;
}
h1, h2, h3 { color: var(--title); line-height: 1.2; text-wrap: balance; }
h1 { margin: 4px 0 0; font-weight: 700; font-size: clamp(26px, 4vw, 36px); letter-spacing: -0.01em; }
h2 { margin: 0; font-weight: 700; font-size: clamp(19px, 2.2vw, 22px); }
h3 { margin: 0; font-weight: 600; font-size: 16px; color: var(--ink); }
p { margin: 0; max-width: 70ch; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.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;
}
.skip { position: absolute; left: -9999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; z-index: 10; }
.skip:focus { left: max(var(--gutter), env(safe-area-inset-left, 0px)); }
.print-only { display: none; }

/* ---------- Header: wordmark and tool switcher ---------- */
.site {
  max-width: 1180px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding-block: 18px 14px;
  border-bottom: 1px solid var(--rule);
}
.mark-link { text-decoration: none; display: inline-flex; min-height: 44px; align-items: center; }
.mark { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; font-family: var(--mark); color: var(--ink-2); line-height: 1; }
.mark b { font-size: 22px; font-weight: 700; font-variant: small-caps; letter-spacing: 0.02em; }
.mark span { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: 0.22em; }
.mark span::before, .mark span::after { content: ""; width: 28px; height: 2px; background: var(--accent); }

.tools { display: flex; align-items: center; }
.tools .tools-toggle { display: none; }
.tools ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.tools a, .tools .later {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px;
  font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: none;
  border-bottom: 2px solid transparent;
}
.tools a:hover { background: var(--wash); }
.tools a[aria-current="page"] { color: var(--title); font-weight: 600; border-bottom-color: var(--gold); }
.tools .later { color: var(--ink-2); cursor: default; }
.tools .later small { font-size: 11px; margin-left: 6px; letter-spacing: 0.04em; text-transform: uppercase; }

@media (max-width: 799px) {
  .tools { width: auto; }
  .tools .tools-toggle { display: inline-flex; }
  .tools ul {
    display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 5;
    flex-direction: column; gap: 0; background: var(--panel);
    border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
    padding: 4px max(var(--gutter), env(safe-area-inset-left, 0px));
  }
  .tools.open ul { display: flex; }
  .tools a, .tools .later { border-bottom: 1px solid var(--wash); padding: 0 4px; }
  .tools a[aria-current="page"] { border-bottom: 1px solid var(--wash); box-shadow: inset 0 -2px 0 var(--gold); }
  .site { position: relative; }
}

/* ---------- Page layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding-block: 24px 40px; display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; flex-direction: column; gap: 6px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.sub { color: var(--ink-2); max-width: 70ch; }
.flags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.work { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 799px) { .work { grid-template-columns: minmax(0, 1fr); } }

.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: 2px; padding: clamp(16px, 2.4vw, 24px); display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.panel-head .hint { font-size: 13px; color: var(--ink-2); }

/* ---------- Form controls (dates, amounts and categories only) ---------- */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, legend { font-size: 14px; font-weight: 600; padding: 0; }
.field .help { font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.field input, .field select {
  font: 400 16px var(--font); font-variant-numeric: tabular-nums;
  padding: 10px 12px; min-height: 44px; width: 100%;
  border: 1px solid var(--ink-2); border-radius: 2px;
  background: var(--panel); color: var(--ink);
}
.field select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%234D4D4D' stroke-width='2'/%3E%3C/svg%3E");
  background-position: right 14px center; background-size: 12px 8px; background-repeat: no-repeat; }
.field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field.required legend::after, .field.required > label::after { content: " (required)"; font-weight: 400; color: var(--ink-2); font-size: 13px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 14px;
  border: 1px solid var(--ink-2); border-radius: 0; background: var(--panel); cursor: pointer; font-size: 15px;
}
.choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--wash); font-weight: 600; }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }

.btn {
  font: 600 15px/1 var(--font); border-radius: 0; padding: 12px 18px; min-height: 44px; cursor: pointer;
  border: 1px solid var(--ink-2); background: var(--panel); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn:hover { background: var(--wash); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--title); }
.btn:disabled { opacity: 0.45; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------- Tables ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 2px; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { font-size: 13px; color: var(--head-ink); background: var(--head); font-weight: 600; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody th { font-weight: 600; }
td.date, .amt { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Notes ---------- */
.note { background: var(--warn-wash); border-radius: 2px; padding: 12px 14px; font-size: 14.5px; }
.note.plain { background: var(--wash); }
.gate { background: var(--wash); border: 1px dashed var(--ink-2); border-radius: 2px; padding: 16px; font-size: 15px; }

/* ---------- Footer and wave ---------- */
.foot {
  border-top: 1px solid var(--rule); padding-top: 14px;
  color: var(--ink-2); font-size: 13px; display: flex; flex-direction: column; gap: 6px;
}
.foot .asof { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.wave { display: block; height: 70px; margin-left: calc(-1 * max(var(--gutter), env(safe-area-inset-left, 0px))); width: calc(100% + max(var(--gutter), env(safe-area-inset-left, 0px)) + max(var(--gutter), env(safe-area-inset-right, 0px))); max-width: none; }
.wave path { fill: var(--head); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
