/* Confirma AI First Certification. Colours: Confirma Green #009607, black, grey scale. */
@font-face { font-family: "DM Sans"; src: url("fonts/DMSans.ttf") format("truetype"); font-weight: 100 1000; font-display: swap; }

:root, [data-theme=light] {
  --bg: #f0f1f2; --surface: #ffffff; --surface2: #f5f6f7; --rule: #d6d9dc; --hover: #e9ebed;
  --fg: #111213; --muted: #5c6369; --accent: #009607; --accent-ink: #ffffff; --accent-text: #007a05;
  --tint: #e6f5e6; --sel: #007a05; --danger: #c92a2a; --warn: #b96a00; --head: #0b0c0c; --head-fg: #ffffff;
  --t-grey: #e9ebed; --t-orange: #fdf0d9; --t-red: #fde6e6; --t-green: #e0f3e1;
}
[data-theme=dark] {
  --bg: #0e0f10; --surface: #191b1c; --surface2: #222526; --rule: #34383b; --hover: #2a2d2f;
  --fg: #eef0f1; --muted: #9aa1a7; --accent: #009607; --accent-ink: #ffffff; --accent-text: #3fcf45;
  --tint: #12301a; --sel: #2fb536; --danger: #ff6b6b; --warn: #f5a524; --head: #000000; --head-fg: #ffffff;
  --t-grey: #2a2d2f; --t-orange: #3b2c10; --t-red: #3d1c1c; --t-green: #143619;
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 14px/1.45 "DM Sans", "Segoe UI", system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 700; }
h3 { font-size: 13.5px; font-weight: 700; }
a { color: var(--accent-text); }
small, .muted { color: var(--muted); }
small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 1px; }
.boot { padding: 40px; color: var(--muted); }
.kicker { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--accent-text); }
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template: 44px 1fr / 196px 1fr; height: 100%; }
.top { grid-column: 1 / -1; background: var(--head); color: var(--head-fg); display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.top img { height: 24px; }
.top .name { font-weight: 700; font-size: 14.5px; white-space: nowrap; }
.top .name b { color: #2fc236; font-weight: 700; }
.top .ver { color: #9aa1a7; font-size: 11.5px; white-space: nowrap; }
.top .sp { flex: 1; }
.top .who { font-size: 12.5px; color: #c9cdd1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .tb { background: none; border: 0; color: #fff; padding: 6px; border-radius: 6px; cursor: pointer; display: flex; position: relative; text-decoration: none; }
.top .tb:hover { background: #26292b; }
.badge { position: absolute; top: 0; right: -2px; background: var(--accent); color: #fff; border-radius: 999px; font-size: 10px; font-weight: 700; padding: 0 4px; min-width: 15px; text-align: center; }
.nav { background: var(--surface); border-right: 1px solid var(--rule); padding: 8px 6px; overflow: auto; display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 6px; color: var(--fg); text-decoration: none; font-weight: 500; font-size: 13.5px; }
.nav a:hover { background: var(--hover); }
.nav a.on { background: var(--tint); color: var(--accent-text); font-weight: 700; }
.nav .sep { margin: 8px 9px 3px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--muted); }
main { overflow: auto; padding: 14px 18px 40px; }
.page { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.pagehead { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.pagehead .sp { flex: 1; }
.offline { background: var(--t-orange); color: var(--fg); padding: 5px 12px; font-size: 12.5px; text-align: center; grid-column: 1 / -1; }

/* ---------- building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; }
.card > h2 { margin-bottom: 6px; }
.grid { display: grid; gap: 10px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row .sp { flex: 1; }
.btn { font: inherit; font-weight: 600; font-size: 13px; height: 30px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--rule); background: var(--surface); color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.pri:hover { filter: brightness(1.08); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.sm { height: 24px; padding: 0 8px; font-size: 12px; }
.btn.big { height: 38px; padding: 0 18px; font-size: 14px; }
.chip { display: inline-flex; align-items: center; border-radius: 999px; padding: 1px 9px; font-size: 11.5px; font-weight: 700; background: var(--t-grey); white-space: nowrap; }
.chip.orange { background: var(--t-orange); color: var(--warn); }
.chip.red { background: var(--t-red); color: var(--danger); }
.chip.green { background: var(--t-green); color: var(--accent-text); }
.chip.solid { background: var(--accent); color: #fff; }
.note { border-left: 3px solid var(--accent); background: var(--tint); padding: 8px 12px; border-radius: 0 7px 7px 0; }
.note.warn { border-color: var(--warn); background: var(--t-orange); }
.note.red { border-color: var(--danger); background: var(--t-red); }
ul.tight { margin: 4px 0 0; padding-left: 18px; }
ul.tight li { margin: 2px 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; padding: 5px 8px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td { padding: 6px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--hover); }
.tablewrap { overflow-x: auto; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); overflow-x: auto; }
.tabs a { padding: 7px 11px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--accent-text); border-color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 22px 10px; }

/* ---------- forms ---------- */
.fld { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 3px 10px; align-items: start; margin-bottom: 8px; }
.fld .lbl { font-weight: 600; font-size: 13px; padding-top: 5px; }
.fld .lbl i { color: var(--danger); font-style: normal; }
.fld .ctl { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
input:not([type=checkbox]):not([type=radio]), select, textarea { font: inherit; color: var(--fg); background: var(--surface2); border: 1px solid var(--rule); border-radius: 6px; padding: 5px 8px; width: 100%; min-height: 30px; }
textarea { resize: vertical; line-height: 1.4; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; margin: 2px 0 0; flex: none; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 3px 12px; padding-top: 4px; }
.chk { display: flex; gap: 7px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.inline { display: flex; gap: 8px; }
.inline > * { flex: 1; }
.pick { display: flex; gap: 9px; align-items: flex-start; border: 1px solid var(--rule); border-radius: 8px; padding: 9px 11px; cursor: pointer; background: var(--surface); }
.pick:has(input:checked) { border-color: var(--accent); background: var(--tint); box-shadow: inset 0 0 0 1px var(--accent); }

/* ---------- status journey ---------- */
.steps { display: flex; margin: 4px 0; }
.steps .st { flex: 1; text-align: center; position: relative; font-size: 11.5px; color: var(--muted); padding-top: 26px; min-width: 0; }
.steps .st::before { content: ""; position: absolute; top: 10px; left: -50%; right: 50%; height: 2px; background: var(--rule); }
.steps .st:first-child::before { display: none; }
.steps .st .dot { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 2px solid var(--rule); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; z-index: 1; }
.steps .st.done::before, .steps .st.now::before { background: var(--accent); }
.steps .st.done .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps .st.now { color: var(--fg); font-weight: 700; }
.steps .st.now .dot { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 3px var(--tint); }
.steps .st.hold .dot { border-color: var(--warn); color: var(--warn); box-shadow: 0 0 0 3px var(--t-orange); }
.wz { display: flex; gap: 4px; flex-wrap: wrap; }
.wz button { font: inherit; font-size: 12.5px; font-weight: 600; border: 1px solid var(--rule); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 3px 11px; cursor: pointer; }
.wz button.on { background: var(--fg); color: var(--surface); border-color: var(--fg); }
.level { border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.level .num { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; margin-right: 7px; }
.dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 5px 10px; font-size: 13.5px; }
.dl dt { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.msg { border: 1px solid var(--rule); border-radius: 8px; padding: 7px 10px; background: var(--surface2); }
.msg.request { border-color: var(--warn); background: var(--t-orange); }
.msg.applicant { margin-left: 24px; }
.msg .meta { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.tl { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.tl li { padding: 5px 0 5px 14px; border-left: 2px solid var(--rule); position: relative; }
.tl li::before { content: ""; position: absolute; left: -5px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
details.ex > summary { cursor: pointer; list-style: none; }
details.ex > summary::-webkit-details-marker { display: none; }
.certificate { border: 2px solid var(--accent); border-radius: 10px; padding: 22px; text-align: center; background: var(--surface); }
.certificate img { height: 70px; }
.certificate .big { font-size: 22px; font-weight: 800; margin: 6px 0 2px; }
pre { background: var(--surface2); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px; overflow-x: auto; font-size: 12px; margin: 4px 0; }
code { font-family: Consolas, Menlo, monospace; font-size: 12px; }

[data-theme=light] img.dk, [data-theme=dark] img.lt { display: none; }
@media print { img.dk { display: none !important; } img.lt { display: inline !important; } }

.av { border-radius: 50%; object-fit: cover; background: var(--tint); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; vertical-align: middle; }
.pro { grid-template-columns: minmax(0, 270px) minmax(0, 1fr); }
@media (max-width: 820px) { .pro { grid-template-columns: minmax(0, 1fr); } }

/* ---------- sign-in ---------- */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; padding: 26px 24px; text-align: center; }
.login img { height: 120px; display: block; margin: 0 auto 8px; }
.login form { text-align: left; margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.login input { height: 38px; font-size: 15px; }
.login .code { letter-spacing: .4em; text-align: center; font-size: 20px; font-weight: 700; }

/* ---------- dialogs and toasts ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); display: flex; align-items: center; justify-content: center; padding: 14px; z-index: 50; }
.overlay[hidden], .toast[hidden] { display: none; }
.dialog { background: var(--surface); border: 1px solid var(--rule); border-radius: 9px; width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; }
.dialog header { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
.dialog header h2 { flex: 1; }
.dialog .body { padding: 12px 14px; overflow: auto; }
.dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--rule); }
.dialog .fld { grid-template-columns: 130px minmax(0, 1fr); }
.x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 4px; }
.toast { position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%); background: #111; color: #fff; padding: 8px 16px; border-radius: 8px; font-weight: 600; font-size: 13px; z-index: 60; max-width: 90vw; box-shadow: 0 4px 16px rgba(0, 0, 0, .3); }
.toast.err { background: var(--danger); color: #fff; }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  .shell { grid-template: 44px 1fr auto / 1fr; }
  .nav { grid-row: 3; flex-direction: row; border-right: 0; border-top: 1px solid var(--rule); padding: 3px 4px calc(3px + env(safe-area-inset-bottom)); overflow-x: auto; gap: 0; }
  .nav a { flex-direction: column; gap: 1px; font-size: 10.5px; padding: 5px 8px; white-space: nowrap; flex: 1 0 auto; align-items: center; }
  .nav .sep, .top .ver, .top .who { display: none; }
  main { padding: 10px 10px 24px; }
  .g2, .g3, .g4, .split { grid-template-columns: minmax(0, 1fr); }
  .fld, .dl, .dialog .fld { grid-template-columns: minmax(0, 1fr); }
  .fld .lbl { padding-top: 0; }
  .steps .st { font-size: 10px; }
  .top .name { font-size: 13px; }
}
@media (min-width: 821px) and (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media print {
  body * { visibility: hidden; }
  .certificate, .certificate * { visibility: visible; }
  .certificate { position: absolute; left: 5%; top: 8%; width: 90%; }
  .certificate .btn { display: none; }
}
