/* UMA — "Instrument of Record".
   Three ideas carry the design:
     1. The rail. A deep institutional ground on the left, so the product reads
        as an instrument rather than an admin panel.
     2. The masthead. Every screen opens like a page of an official register:
        eyebrow, display title, a short brass rule. Driven by the route, so
        every screen gets one without touching its view.
     3. The left edge carries state. A chip's status, the active nav item, a
        record on the spine, a flagged row — all say it the same way. One
        grammar, used everywhere, instead of an ornament used once. */

/* ---------------------------------------------------------------- shell -- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--authority-deep);
  color: var(--rail-ink);
  padding: 24px 14px 32px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .wordmark { color: #fff; }
.wordmark { font-family: var(--font-display); font-weight: 700; font-size: 26px;
  color: var(--authority); letter-spacing: 0.08em; }
.wordmark.small { font-size: 19px; margin: 0 8px 4px; }
/* The brass rule under the wordmark is the seal motif in its smallest form. */
.sidebar .wordmark.small::after {
  content: ''; display: block; width: 26px; height: 2px;
  background: var(--seal); margin-top: 10px; margin-bottom: 22px;
}

.nav-group { margin-bottom: 22px; display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  font-family: var(--font-data); font-size: var(--fs-eyebrow); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: rgba(196, 217, 227, 0.5); margin: 0 8px 8px; }
.sidebar a {
  display: block; padding: 7px 10px; border-radius: 6px;
  font-size: var(--fs-body); color: var(--rail-ink);
  border-left: 3px solid transparent; transition: background 120ms ease, color 120ms ease;
}
.sidebar a:hover { background: var(--rail-line); color: #fff; text-decoration: none; }
.sidebar a.active {
  background: rgba(255, 255, 255, 0.07); color: #fff; font-weight: 600;
  border-left-color: var(--seal);
}
.nav-soon { padding: 7px 10px; font-size: var(--fs-body);
  color: rgba(196, 217, 227, 0.45); display: flex; justify-content: space-between; }
.nav-soon em { font-style: normal; font-size: 10px; border: 1px solid var(--rail-line);
  border-radius: 999px; padding: 0 8px; }

.main { display: flex; flex-direction: column; min-width: 0; background: var(--paper); }

/* ------------------------------------------------------------- masthead -- */
/* The topbar IS the masthead: the route sets the eyebrow and the title, so
   every screen opens like a page of a register with no per-view markup. */
.topbar {
  padding: 22px var(--gutter) 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr auto; align-items: start;
  column-gap: 24px;
}
.topbar h1 {
  font-size: var(--fs-display); font-weight: 650; letter-spacing: -0.022em;
  line-height: 1.15; margin: 2px 0 0;
}
.masthead-id { min-width: 0; padding-bottom: 20px; position: relative; }
.masthead-id::after {
  content: ''; position: absolute; left: 0; bottom: 0;
  width: 44px; height: 2px; background: var(--seal);
}
.topbar-right { display: flex; align-items: center; gap: 14px; padding-top: 4px; }
.user-name { color: var(--ink-soft); font-size: var(--fs-small); }

.content { padding: var(--gutter); max-width: 1180px; width: 100%; }

/* --------------------------------------------------------------- panel -- */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px;
}
.panel > h2 {
  font-size: var(--fs-h2); font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: baseline; gap: 10px;
}
.panel > h2::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}
.panel > h3 { margin: 18px 0 8px; color: var(--ink); }
/* Nested record cards (finding cards inside the Findings panel): flatten. */
.panel .panel { background: var(--sunken); border-color: transparent;
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius-chip); padding: 14px 16px; margin-bottom: 12px; }
.panel .panel > h2::after { display: none; }

.empty { color: var(--ink-soft); font-size: var(--fs-small); }
.panel > ul { margin: 0; padding-left: 18px; }
.panel > ul > li { margin-bottom: 6px; }

/* --------------------------------------------------------------- table -- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
.table th {
  font-family: var(--font-data); font-size: var(--fs-eyebrow); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint);
  text-align: left; padding: 0 12px 8px 0; border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.table td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line);
  vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(14, 79, 110, 0.028); }
.table td strong { font-weight: 600; }

/* ------------------------------------------------------- buttons, forms -- */
.btn {
  font: inherit; font-size: var(--fs-body); font-weight: 500;
  border-radius: 7px; padding: 8px 16px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: background 120ms ease, border-color 120ms ease;
}
.btn:hover { background: var(--sunken); }
.btn.primary { background: var(--authority); border-color: var(--authority); color: #fff; }
.btn.primary:hover { background: var(--authority-mid); border-color: var(--authority-mid); }
.btn.ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-soft); }
.btn.ghost:hover { background: var(--sunken); color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

label { display: block; font-size: var(--fs-small); color: var(--ink-soft); margin: 14px 0 5px; }
input, select, textarea {
  font: inherit; font-size: var(--fs-body); width: 100%; padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: 7px;
  background: var(--surface); color: var(--ink);
}
input:hover, select:hover, textarea:hover { border-color: var(--ink-faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--authority);
  box-shadow: 0 0 0 3px var(--authority-soft); }
textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0 18px; }
.form-actions { margin-top: 16px; display: flex; gap: 10px; align-items: center; }
.form-error {
  color: var(--warn); font-size: var(--fs-small); background: var(--warn-soft);
  border-left: 3px solid var(--warn); border-radius: var(--radius-chip);
  padding: 9px 12px; margin: 10px 0;
}
label.checkline, label.check-label { display: flex; align-items: flex-start; gap: 9px;
  color: var(--ink); }
label.checkline input, label.check-label input { width: auto; margin-top: 3px; }

/* ------------------------------------------------------- number strip -- */
/* Lifecycle numbers: data first, label under, no card chrome. */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.tile { background: var(--surface); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 3px; color: var(--ink);
  border-left: 3px solid transparent; }
.tile strong { font-family: var(--font-data); font-size: 25px; font-weight: 500;
  letter-spacing: -0.02em; line-height: 1.1; }
.tile span { color: var(--ink-soft); font-size: var(--fs-small); }
.tile em { font-style: normal; font-size: 11.5px; color: var(--ink-faint); }
.tile.amber { border-left-color: var(--amber); }
a.tile:hover { text-decoration: none; background: var(--sunken); }

/* ---------------------------------------------------------------- spine -- */
/* Record lists. Entries stack down a hairline and are pinned to it — the
   append-only record made visible. Brass at the head, fading with age. */
.spine { position: relative; margin: 0; padding: 2px 0 2px 24px; list-style: none; }
.spine::before {
  content: ''; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 1px;
  background: linear-gradient(var(--seal), var(--line-strong) 42%, var(--line));
}
.spine > li { position: relative; padding: 0 0 12px; }
.spine > li::before {
  content: ''; position: absolute; left: -23px; top: 7px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--surface);
  border: 1.5px solid var(--line-strong);
}
.spine > li.sealed::before { border-color: var(--seal); background: var(--seal); }
.spine > li.superseded { color: var(--ink-faint); }
.spine > li.superseded::before { background: var(--line); }

/* ----------------------------------------------------------------- tabs -- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line);
  margin-bottom: var(--gutter); flex-wrap: wrap; }
.tabs a { padding: 9px 15px; color: var(--ink-soft); border-bottom: 2px solid transparent;
  margin-bottom: -1px; font-size: var(--fs-body); }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--authority); border-bottom-color: var(--seal); font-weight: 600; }

/* ---------------------------------------------------------------- login -- */
.login-body { background: var(--authority-deep); min-height: 100vh; }
.login-split { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-identity { padding: 64px 56px; display: flex; flex-direction: column;
  justify-content: center; gap: 8px; }
.login-identity .wordmark { color: #fff; font-size: 42px; letter-spacing: 0.06em; }
.login-identity .wordmark::after { content: ''; display: block; width: 52px; height: 2px;
  background: var(--seal); margin-top: 18px; }
.login-identity h1 { font-size: var(--fs-display); color: #fff; font-weight: 600; }
.login-identity p { color: var(--rail-ink); max-width: 46ch; }
.login-place { font-family: var(--font-data); font-size: var(--fs-small);
  letter-spacing: 0.04em; color: rgba(196, 217, 227, 0.72); margin-top: -6px; }
.login-lede { font-size: 15px; line-height: 1.6; color: #E7F1F6; margin: 6px 0 10px; }

/* Three things this system does that a spreadsheet cannot. True, specific,
   and the right thing to read while someone types a password. */
.assurances { margin: 10px 0 0; display: grid; gap: 14px; max-width: 46ch; }
.assurances > div { border-left: 2px solid var(--seal); padding-left: 14px; }
.assurances dt {
  font-family: var(--font-data); font-size: var(--fs-eyebrow); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.16em; color: var(--seal);
  margin-bottom: 3px;
}
.assurances dd { margin: 0; color: var(--rail-ink); font-size: var(--fs-small);
  line-height: 1.55; }
.login-public { margin-top: 26px; font-size: var(--fs-small); }
.login-public a { color: var(--rail-ink); text-decoration: underline;
  text-underline-offset: 3px; text-decoration-color: rgba(196, 217, 227, 0.4); }
.login-public a:hover { color: #fff; text-decoration-color: var(--seal); }
.login-public span { color: rgba(196, 217, 227, 0.4); margin: 0 6px; }
.login-card { display: flex; align-items: center; justify-content: center; padding: 40px;
  background: var(--paper); }
.auth-step { width: 372px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow-raise);
  animation: rise 260ms cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }
.auth-step h2 { margin-bottom: 8px; }
.auth-step .btn { width: 100%; margin-top: 18px; }
.totp-qr { display: block; width: 184px; height: 184px; margin: 14px auto;
  border: 1px solid var(--line); border-radius: var(--radius); }
.totp-secret { font-family: var(--font-data); font-size: var(--fs-small);
  color: var(--ink-soft); text-align: center; }

/* ------------------------------------------------------------ record head -- */
/* The header of a working file — the audit hub, and anywhere else a screen is
   about ONE record. Whose file, what kind, what state, in that order. */
.record-head {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px;
  border-top: 3px solid var(--authority);
}
.record-head-top { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 6px; }
.record-subject { display: block; font-size: 25px; font-weight: 650;
  letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 16px; }
.record-subject::after { display: none; }
.record-meta { display: flex; flex-wrap: wrap; gap: 4px 34px; margin: 0 0 14px;
  padding-top: 15px; border-top: 1px solid var(--line); }
.record-meta dt {
  font-family: var(--font-data); font-size: var(--fs-eyebrow);
  text-transform: uppercase; letter-spacing: 0.13em; color: var(--ink-faint);
}
.record-meta dd { margin: 3px 0 0; font-size: var(--fs-body); }
.record-note { color: var(--ink-soft); font-size: var(--fs-small); margin: 0 0 8px; }

/* A finding wears its grade on the left edge — same grammar as chips and the
   rail, applied where a working auditor most needs to scan. */
.finding.major_nc    { border-left-color: var(--warn); }
.finding.minor_nc    { border-left-color: var(--amber); }
.finding.observation { border-left-color: var(--authority-mid); }
.finding.ofi         { border-left-color: var(--line-strong); }

/* The standing state of a relationship: labelled readings, not a chip run. */
.kpi-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 1px; margin: 0 0 16px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.kpi-strip > div { background: var(--surface); padding: 11px 14px;
  border-left: 3px solid transparent; }
.kpi-strip > div.ok    { border-left-color: var(--ok); }
.kpi-strip > div.amber { border-left-color: var(--amber); }
.kpi-strip dt {
  font-family: var(--font-data); font-size: var(--fs-eyebrow);
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-faint);
  margin-bottom: 4px;
}
.kpi-strip dd { margin: 0; font-size: var(--fs-body); font-weight: 500; }

/* The client timeline is the clearest case for the spine: everything that has
   happened to this client, in order, and nothing ever removed. */
.timeline > li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.tl-when { font-family: var(--font-data); font-size: var(--fs-small);
  color: var(--ink-faint); min-width: 118px; }
.tl-what { flex: 1 1 240px; min-width: 0; }

/* ------------------------------------------------- public: verify + list -- */
/* What a certified client's own customer sees. It is a public register, so it
   is presented as one: an institutional band, then paper. */
.public-body { background: var(--paper); min-height: 100vh;
  display: flex; flex-direction: column; }
.public-head { background: var(--authority-deep); padding: 16px 0; }
.public-inner { max-width: 820px; margin: 0 auto; padding: 0 24px; width: 100%; }
.public-head .public-inner { display: flex; align-items: center;
  justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.public-head .wordmark { color: #fff; font-size: 21px; letter-spacing: 0.1em; }
.public-nav { display: flex; gap: 20px; }
.public-nav a { color: var(--rail-ink); font-size: var(--fs-small);
  border-bottom: 2px solid transparent; padding-bottom: 3px; }
.public-nav a:hover { color: #fff; text-decoration: none; }
.public-nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--seal); }
.public-main { padding: 44px 0 64px; flex: 1; }
.public-main h1 { font-size: var(--fs-display); font-weight: 650;
  letter-spacing: -0.022em; line-height: 1.2; margin: 6px 0 12px; }
.public-lede { color: var(--ink-soft); max-width: 62ch; margin-bottom: 26px; }
.public-form { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 26px; }
.public-form label { margin-top: 0; }

.directory-card { display: block; }
.dir-entry { border: 1px solid var(--line); border-left: 3px solid var(--ok);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px;
  background: var(--surface); }
.dir-entry h2 { font-size: var(--fs-h2); margin-bottom: 8px; }
.dir-entry.suspended { border-left-color: var(--amber); }
.dir-location { color: var(--ink-soft); font-size: var(--fs-small); }
.vf-issuer { color: var(--ink-soft); font-size: var(--fs-small); }

/* ---------------------------------------------------------- certificate -- */
/* The artifact the whole business produces. It is a document, not a screen:
   a sheet with a double rule, connective phrases set small and quiet, and the
   two things that matter — who is certified, and to what — given the space.
   Everything else on the page is chrome and gets out of the way. */
.cert-sheet {
  background: var(--surface); text-align: center;
  max-width: 780px; margin: 0 auto 18px;
  padding: 56px 56px 44px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  box-shadow: var(--shadow-raise);
  position: relative;
}
/* The inner rule. Two lines, one brass, is the whole of the ornament. */
.cert-sheet::before {
  content: ''; position: absolute; inset: 12px; pointer-events: none;
  border: 1px solid var(--line);
}
.cert-sheet::after {
  content: ''; position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  width: 132px; height: 3px; background: var(--seal);
}
.cert-head { margin-bottom: 34px; padding-bottom: 24px;
  border-bottom: 1px solid var(--line); }
.cert-print .cb-mark { margin-bottom: 12px; }
.cert-print .cb-mark img, .cert-accreditation img { max-height: 64px; max-width: 100%; }
.cert-print .wordmark { font-size: 36px; letter-spacing: 0.12em; color: var(--authority); }
.cert-issuer { color: var(--ink-soft); font-size: var(--fs-small); margin: 0; line-height: 1.6; }
.cert-issuer strong { color: var(--ink); font-size: var(--fs-body); }

/* Connective tissue: "certifies that…", "conform to…". Present, never loud. */
.cert-lede {
  font-family: var(--font-data); font-size: var(--fs-eyebrow);
  text-transform: uppercase; letter-spacing: 0.18em; color: var(--ink-faint);
  margin: 0 0 12px;
}
.cert-subject {
  display: block; font-size: 30px; font-weight: 650; letter-spacing: -0.02em;
  line-height: 1.2; margin: 0 0 6px;
}
.cert-subject::after { display: none; }
.cert-location { color: var(--ink-soft); font-size: var(--fs-small); margin: 0 0 30px; }
.cert-standards { margin-bottom: 30px; }
.cert-standard {
  font-family: var(--font-display); font-size: 17px; font-weight: 600;
  color: var(--authority); margin: 0 0 4px;
}
.cert-scope { max-width: 54ch; margin: 0 auto 34px; line-height: 1.6; }

.cert-seal { display: flex; justify-content: center; gap: 10px; margin-bottom: 24px; }
.cert-dates {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 0 40px;
  margin: 0 0 8px; padding-top: 22px; border-top: 1px solid var(--line);
}
.cert-dates dt {
  font-family: var(--font-data); font-size: var(--fs-eyebrow);
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-faint);
}
.cert-dates dd { margin: 2px 0 0; font-family: var(--font-data); font-size: var(--fs-body); }
.cert-revision { color: var(--warn); font-size: var(--fs-small); margin-top: 14px; }

.cert-foot { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.cert-verify { font-family: var(--font-data); font-size: var(--fs-small);
  color: var(--ink-soft); margin: 0; overflow-wrap: anywhere; }
.cert-accreditation { display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin: 18px 0 0; color: var(--ink-soft); font-size: var(--fs-small); }

/* The #/cb preview: same document, quarter scale, obviously a preview. */
.cert-print.preview { border: 1px dashed var(--line-strong); border-radius: var(--radius);
  padding: 26px; box-shadow: none; max-width: none; }
.cert-print.preview::before, .cert-print.preview::after { display: none; }

/* --------------------------------------------------- module affordances -- */
.prog-cycle { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.prog-cycle:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.prog-add, .prog-transfer { margin-top: 12px; }
.prog-add summary, .prog-transfer summary { cursor: pointer; color: var(--authority);
  font-size: var(--fs-small); }
.prog-add[open] summary, .prog-transfer[open] summary { margin-bottom: 10px; }

/* ----------------------------------------------------------- responsive -- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 64px 1fr; }
  .sidebar { padding: 20px 8px; }
  .sidebar .nav-label, .sidebar .nav-soon { display: none; }
  .sidebar a { font-size: 0; text-align: center; padding: 9px 4px; }
  .sidebar a::before { content: attr(data-abbr); font-size: 12px;
    font-family: var(--font-data); }
  .sidebar .wordmark.small { font-size: 15px; text-align: center; margin: 0 0 4px; }
  .sidebar .wordmark.small::after { margin-left: auto; margin-right: auto; }
  .login-split { grid-template-columns: 1fr; }
  .login-identity { padding: 40px 28px; }
  .topbar { padding: 16px 18px 0; }
  .topbar h1 { font-size: 24px; }
  .content { padding: 18px; }
  .tile-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------------------------------------------------------- print -- */
@media print {
  @page { size: A4; margin: 14mm; }
  .sidebar, .topbar, .no-print { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .panel { border: 0; }
  /* The certificate prints as the sheet itself: no shadow, no rounding, and
     the rules kept — they are part of the document, not decoration. */
  .cert-sheet { box-shadow: none; max-width: none; margin: 0;
    padding: 30px 34px; page-break-inside: avoid; }
  .cert-sheet::after { top: -1px; }
}
