/* v4safe web console. Fonts are IBM Plex (SIL OFL 1.1, see ../fonts/OFL.txt),
   self-hosted so pages make no third-party requests. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/IBMPlexSans-Regular.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/IBMPlexSans-Medium.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/IBMPlexSans-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/IBMPlexMono-Regular.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/IBMPlexMono-Medium.woff2") format("woff2"); }

:root {
  --ink: #0b1526;
  --ink-2: #1c2a40;
  --ink-3: #2c3b53;
  --canvas: #f2f3f0;
  --surface: #ffffff;
  --line: #d8dcd6;
  --line-strong: #b9bfb7;
  --muted: #535d6b;
  --brand: #0a7b5c;
  --brand-ink: #075a43;
  --brand-tint: #e6f2ee;
  --danger: #b42318;
  --danger-tint: #fdecea;
  --warn: #b54708;
  --warn-tint: #fdf1e7;
  --info-tint: #eceff3;

  --font-sans: "IBM Plex Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r-control: 3px;
  --r-panel: 4px;
  --content: 960px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  color: var(--ink);
  font: 400 15px/1.5 var(--font-sans);
}
a { color: var(--brand-ink); text-underline-offset: 2px; }
a:hover { color: var(--brand); }
code, pre, .mono { font-family: var(--font-mono); }
code { font-size: 0.88em; background: var(--info-tint); padding: 0.05em 0.3em; border-radius: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.005em; }
p { margin: 0 0 0.75rem; }
p:last-child { margin-bottom: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* --- Header ------------------------------------------------------------ */
.masthead { background: var(--ink); color: #fff; }
.masthead-inner {
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
.brand:hover { color: #fff; }
.brand svg { flex-shrink: 0; }
.brand .brand-4 { color: #5fd3a8; }
.role-tag {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b8c3d3;
  border-left: 1px solid var(--ink-3);
  padding-left: 1rem;
}
.identity {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: #d5dce6;
  min-width: 0;
}
.identity .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity .mono { color: #fff; font-size: 0.82rem; }
.identity form { margin: 0; }
.signout {
  background: none;
  border: 1px solid var(--ink-3);
  color: #fff;
  font: 500 0.8rem var(--font-sans);
  padding: 0.3rem 0.7rem;
  border-radius: var(--r-control);
  cursor: pointer;
}
.signout:hover { background: var(--ink-2); border-color: #45567099; }

/* --- Section tabs ------------------------------------------------------- */
.tabs { background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs-inner {
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
}
.tab {
  display: inline-block;
  padding: 0.8rem 0 0.7rem;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--brand); }

/* --- Page structure ------------------------------------------------------ */
main { flex: 1; width: 100%; max-width: var(--content); margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }
.page-head { margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.45rem; font-weight: 600; line-height: 1.25; }
.page-head .lede { color: var(--muted); margin: 0.3rem 0 0; max-width: 62ch; }
.count { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500; color: var(--muted); margin-left: 0.4rem; vertical-align: middle; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  margin-bottom: 1.25rem;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 0.95rem; font-weight: 600; }
.panel-head .hint { margin: 0; }
.panel-body { padding: 1.25rem; }
.panel-body > :first-child { margin-top: 0; }
.panel.flush .panel-body { padding: 0; }
.panel.danger-edge { border-top: 3px solid var(--danger); }

.footer { border-top: 1px solid var(--line); }
.footer-inner {
  max-width: var(--content);
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

/* --- Auth & public (centered) pages -------------------------------------- */
.auth-wrap { max-width: 420px; margin: 3.5rem auto 0; }
.auth-mark { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.auth-mark .brand { color: var(--ink); font-size: 1.25rem; }
.auth-mark .brand .brand-4 { color: var(--brand); }
.auth-wrap .panel-body { padding: 1.5rem; }
.auth-title { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.2rem; }
.auth-sub { color: var(--muted); font-size: 0.88rem; margin-bottom: 1.25rem; }
.auth-alt {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-panel);
  font-size: 0.88rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.public-wrap { max-width: 640px; margin: 2.5rem auto 0; }

/* --- Forms --------------------------------------------------------------- */
.field { margin-bottom: 1rem; }
.field:last-child { margin-bottom: 0; }
label, .label { display: block; font-size: 0.82rem; font-weight: 500; color: var(--ink-2); margin-bottom: 0.35rem; }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.3rem; }
input[type=text], input[type=password], input[type=url], select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  font: 400 0.95rem var(--font-sans);
}
textarea { min-height: 6.5rem; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #8a929c; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
.field-grid { display: grid; gap: 1rem; }
@media (min-width: 720px) { .field-grid { grid-template-columns: 1fr 1fr; } .field-grid .span-2 { grid-column: span 2; } }
.field-grid .field { margin-bottom: 0; }
.form-actions { margin-top: 1.25rem; display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

.check { display: flex; align-items: flex-start; gap: 0.55rem; margin: 0.6rem 0; font-size: 0.9rem; }
.check input { margin: 0.2rem 0 0; accent-color: var(--brand); width: 15px; height: 15px; flex-shrink: 0; }
.check label { margin: 0; font-weight: 400; font-size: 0.9rem; color: var(--ink); }

/* Radio option cards (signing mode) */
.options { display: grid; gap: 0.75rem; }
@media (min-width: 720px) { .options { grid-template-columns: 1fr 1fr; } }
.option { position: relative; margin: 0; font-size: inherit; font-weight: 400; color: var(--ink); }
.option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.option .option-body {
  display: block;
  height: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-panel);
  padding: 0.9rem 1rem 0.9rem 2.4rem;
  position: relative;
  cursor: pointer;
}
.option .option-body::before {
  content: "";
  position: absolute;
  left: 0.95rem;
  top: 1.05rem;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}
.option input:checked + .option-body { border-color: var(--brand); background: var(--brand-tint); }
.option input:checked + .option-body::before { border-color: var(--brand); box-shadow: inset 0 0 0 3px var(--surface); background: var(--brand); }
.option input:focus-visible + .option-body { outline: 2px solid var(--brand); outline-offset: 2px; }
.option-title { font-weight: 600; font-size: 0.92rem; display: block; }
.option-meta { font-size: 0.82rem; color: var(--muted); display: block; margin-top: 0.15rem; }

/* --- Buttons ------------------------------------------------------------- */
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0.45rem 1rem;
  border: 1px solid var(--brand);
  border-radius: var(--r-control);
  background: var(--brand);
  color: #fff;
  font: 500 0.9rem var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
button:hover, .button:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.button.secondary, button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.button.secondary:hover, button.secondary:hover { background: var(--canvas); color: var(--ink); border-color: var(--ink-3); }
.button.danger, button.danger { background: var(--surface); color: var(--danger); border-color: #e3a19b; }
.button.danger:hover, button.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.button.small, button.small { min-height: 30px; padding: 0.2rem 0.65rem; font-size: 0.8rem; }
.button.block, button.block { width: 100%; }

/* --- Notices ------------------------------------------------------------- */
.notice {
  border-left: 3px solid var(--ink-3);
  background: var(--info-tint);
  padding: 0.7rem 0.9rem;
  border-radius: 0 var(--r-control) var(--r-control) 0;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.notice.success { border-left-color: var(--brand); background: var(--brand-tint); }
.notice.error { border-left-color: var(--danger); background: var(--danger-tint); color: #7a1a12; }
.notice.warn { border-left-color: var(--warn); background: var(--warn-tint); color: #7a3306; }
.notice strong { font-weight: 600; }

/* --- Secret / code blocks ------------------------------------------------ */
.code-block { position: relative; margin: 0 0 1rem; }
.code-block:last-child { margin-bottom: 0; }
.code-block pre {
  margin: 0;
  background: var(--ink);
  color: #e3e9f1;
  border-radius: var(--r-panel);
  padding: 0.9rem 5.2rem 0.9rem 1rem;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
}
.code-block .copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  min-height: 26px;
  padding: 0.1rem 0.6rem;
  font-size: 0.75rem;
  background: var(--ink-2);
  color: #d5dce6;
  border: 1px solid var(--ink-3);
}
.code-block .copy-button:hover { background: var(--ink-3); color: #fff; }
.code-block .copy-button.copied { color: #5fd3a8; border-color: #5fd3a8; }
.code-label { font-size: 0.78rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.4rem; }
.plain-pre {
  margin: 0;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-all;
}

/* --- Data table ---------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  background: var(--canvas);
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: #fafbf9; }
table.data .mono { font-size: 0.84rem; }
table.data .actions { text-align: right; white-space: nowrap; }
table.data form { margin: 0; }
.inline-form { display: inline-flex; gap: 0.4rem; align-items: center; }
.inline-form input { min-height: 30px; width: 11rem; padding: 0.25rem 0.5rem; font-size: 0.82rem; }
.empty { padding: 2rem 1.25rem; text-align: center; color: var(--muted); }

/* --- Definition list (account) ------------------------------------------- */
dl.facts { margin: 0; display: grid; grid-template-columns: 10rem 1fr; }
dl.facts dt, dl.facts dd { margin: 0; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--line); }
dl.facts dt { font-size: 0.82rem; font-weight: 500; color: var(--muted); }
dl.facts dd { font-family: var(--font-mono); font-size: 0.88rem; }
dl.facts dd.text { font-family: var(--font-sans); font-size: 0.92rem; }
dl.facts dt:last-of-type, dl.facts dd:last-of-type { border-bottom: none; }

/* --- Registration QR ------------------------------------------------------ */
.qr-layout { display: grid; gap: 1.5rem; align-items: start; }
@media (min-width: 720px) { .qr-layout { grid-template-columns: 240px 1fr; } }
.qr-frame { border: 1px solid var(--line); border-radius: var(--r-panel); padding: 0.75rem; background: #fff; }
.qr-frame img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
ol.steps { margin: 0 0 1rem; padding: 0; list-style: none; counter-reset: step; }
ol.steps li { counter-increment: step; position: relative; padding: 0 0 0.85rem 2.1rem; }
ol.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.45rem;
  height: 1.45rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font: 500 0.75rem/1.35rem var(--font-mono);
  text-align: center;
  color: var(--ink-2);
}

/* --- Verification failure (public) ---------------------------------------- */
.alert-head { display: flex; gap: 0.9rem; align-items: flex-start; margin-bottom: 1rem; }
.alert-head svg { flex-shrink: 0; margin-top: 0.15rem; }
.alert-head h1 { font-size: 1.3rem; font-weight: 600; line-height: 1.3; }
.alert-head p { color: var(--muted); margin: 0.35rem 0 0; }

@media (max-width: 600px) {
  .masthead-inner { height: auto; min-height: 52px; flex-wrap: wrap; padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .role-tag { border-left: none; padding-left: 0; }
  .identity { margin-left: 0; width: 100%; justify-content: space-between; }
  main { padding-top: 1.25rem; }
  .auth-wrap { margin-top: 1.5rem; }
  dl.facts { grid-template-columns: 1fr; }
  dl.facts dt { border-bottom: none; padding-bottom: 0; }
  dl.facts dd { padding-top: 0.2rem; }
}
