/* Cairn — plain CSS on purpose. No build step, nothing to break on deploy. */

:root {
  --ink: #10151c;
  --ink-2: #3d4855;
  --ink-3: #6b7785;
  --line: #dfe4ea;
  --line-2: #eef1f4;
  --bg: #f6f7f9;
  --card: #ffffff;
  --brand: #1f3a5f;
  --brand-ink: #ffffff;
  --ok: #1c7a4f;
  --ok-bg: #e7f4ed;
  --warn: #8a6100;
  --warn-bg: #fdf3dd;
  --bad: #a32b2b;
  --bad-bg: #fbeaea;
  --na: #5a6472;
  --na-bg: #eef1f4;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 21, 28, .06), 0 1px 3px rgba(16, 21, 28, .04);
}

* { box-sizing: border-box; }

/* Must come with !important: any rule setting `display` (.btn is inline-block)
   otherwise beats the user agent's [hidden] { display: none }. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .85rem; }

.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }

/* Layout ------------------------------------------------------------ */

.topbar {
  background: var(--brand);
  color: var(--brand-ink);
  border-bottom: 1px solid rgba(0, 0, 0, .15);
}
.topbar .inner {
  max-width: 1100px; margin: 0 auto; padding: .7rem 1.25rem;
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.topbar a { color: rgba(255, 255, 255, .85); text-decoration: none; font-size: .9rem; }
.topbar a:hover, .topbar a.active { color: #fff; text-decoration: none; }
.brand {
  font-weight: 650; font-size: 1.05rem; color: #fff !important;
  display: flex; align-items: center; gap: .5rem; letter-spacing: -.01em;
}
.brand svg { flex: none; }
.topbar nav { display: flex; gap: 1.1rem; }
.topbar .spacer { margin-left: auto; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
.wrap.narrow { max-width: 460px; }

.page-head {
  display: flex; align-items: flex-start; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 1.25rem;
}
.page-head .spacer { margin-left: auto; }

/* Cards -------------------------------------------------------------- */

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem; margin-bottom: 1.15rem;
}
.card.tight { padding: .9rem 1rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.stat .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.stat .value { font-size: 1.7rem; font-weight: 650; letter-spacing: -.02em; margin-top: .15rem; }
.stat .value.sm { font-size: 1.1rem; font-weight: 600; }

/* Tables ------------------------------------------------------------- */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }

/* Badges ------------------------------------------------------------- */

.badge {
  display: inline-block; padding: .12rem .5rem; border-radius: 100px;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.na { background: var(--na-bg); color: var(--na); }

.level {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.9rem; height: 1.9rem; padding: 0 .4rem;
  border-radius: var(--radius); font-weight: 700; font-size: .95rem;
}
.level.l0 { background: var(--bad-bg); color: var(--bad); }
.level.l1 { background: var(--warn-bg); color: var(--warn); }
.level.l2 { background: #e6f0f7; color: #17557f; }
.level.l3 { background: var(--ok-bg); color: var(--ok); }

/* Forms -------------------------------------------------------------- */

label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .25rem; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=color], select, textarea {
  width: 100%; padding: .5rem .6rem; font: inherit; font-size: .92rem;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 6px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(31, 58, 95, .25); outline-offset: 1px; border-color: var(--brand);
}
textarea { resize: vertical; min-height: 60px; }
.field { margin-bottom: .9rem; }
.hint { font-size: .8rem; color: var(--ink-3); margin-top: .2rem; font-weight: 400; }

/* Field-level errors. The message belongs beside the input that caused it —
   a summary at the top of a long form makes the reader hunt for the field. */
.field-error { font-size: .82rem; color: var(--bad); margin-top: .25rem; font-weight: 500; }
.field-error::before { content: "↑ "; opacity: .7; }
input.is-invalid, select.is-invalid, textarea.is-invalid {
  border-color: var(--bad);
  background: #fffafa;
}
input.is-invalid:focus, select.is-invalid:focus, textarea.is-invalid:focus {
  outline-color: rgba(163, 43, 43, .3);
}

.btn {
  display: inline-block; padding: .5rem .95rem; font: inherit; font-size: .9rem; font-weight: 600;
  border-radius: 6px; border: 1px solid var(--brand); cursor: pointer;
  background: var(--brand); color: #fff; text-decoration: none;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn.secondary:hover { background: var(--bg); filter: none; }
.btn.danger { background: #fff; color: var(--bad); border-color: #e8c5c5; }
.btn.small { padding: .3rem .6rem; font-size: .82rem; }
.btn-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

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

.notice { padding: .7rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.notice.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe0cf; }
.notice.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #ecd9a6; }
.notice.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid #eec4c4; }
.notice ul { margin: .3rem 0 0; padding-left: 1.1rem; }

/* Assessment page ---------------------------------------------------- */

.control-block { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: 1rem; overflow: hidden; }
.control-head {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .8rem 1rem; background: #fbfcfd; border-bottom: 1px solid var(--line-2);
}
.control-head .spacer { margin-left: auto; }
.control-head h3 { margin: 0; }
.level-group { padding: .25rem 1rem .75rem; }
.level-label {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-3); font-weight: 600; margin: .9rem 0 .35rem;
}
.req { padding: .7rem 0; border-top: 1px solid var(--line-2); }
.req:first-of-type { border-top: 0; }
.req-text { margin-bottom: .5rem; }
.req-controls { display: grid; grid-template-columns: 200px 1fr 1fr; gap: .6rem; }
@media (max-width: 720px) { .req-controls { grid-template-columns: 1fr; } }

/* Opaque on purpose — a translucent bar lets the requirement text bleed
   through behind the save button, which reads as a rendering fault. */
.sticky-save {
  position: sticky; bottom: 0; background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 8px rgba(16, 21, 28, .07);
  padding: .75rem 1.25rem; margin: 1rem -1.25rem -4rem;
  display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
}

/* Evidence chips ----------------------------------------------------- */

.evidence { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; align-items: center; }
.file-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--line-2); border: 1px solid var(--line);
  border-radius: 100px; padding: .18rem .6rem; font-size: .82rem;
}
/* The upload control repeats on every requirement — 82 of them — so it is kept
   deliberately quiet. The Attach button only appears once a file is chosen. */
.file-chip.upload { background: transparent; border: 0; padding: 0; }
.file-chip.upload input[type=file] {
  width: auto; max-width: 170px; font-size: .72rem; border: 0; padding: 0;
  background: none; color: var(--ink-3);
}
.file-chip.upload input[type=file]::file-selector-button {
  font: inherit; font-size: .72rem; padding: .15rem .45rem; margin-right: .4rem;
  border: 1px solid var(--line); border-radius: 5px;
  background: #fff; color: var(--ink-3); cursor: pointer;
}
.file-chip.upload input[type=file]::file-selector-button:hover { background: var(--bg); }
.chip-x {
  background: none; border: 0; cursor: pointer; color: var(--ink-3);
  font-size: 1rem; line-height: 1; padding: 0 0 0 .1rem;
}
.chip-x:hover { color: var(--bad); }

/* Marketing ---------------------------------------------------------- */

.hero { padding: 4rem 0 2.5rem; text-align: center; }
.hero h1 { font-size: 2.4rem; max-width: 20ch; margin: 0 auto .75rem; }
.hero p.lead { font-size: 1.1rem; color: var(--ink-2); max-width: 56ch; margin: 0 auto 1.5rem; }
