/* secrets.bihealth.org — styles.
   BIH corporate design: BIH-Blau #003754 for text, bars, buttons and links at rest;
   dark red #b0101c only for hover/active and errors; Korall #ea5451 only as a
   non-essential accent (focus ring, small marks), never for text. */

:root {
    --blue: #003754;          /* BIH-Blau */
    --red: #b0101c;           /* hover / active / error */
    --korall: #ea5451;        /* accent only */
    --tint: #e6ecef;
    --tint-2: #f3f6f8;
    --line: #ccd7dd;
    --line-strong: #99afbb;
    --field: #73859f;
    --muted: #495c68;
    --ok: #1d6b3a;
    --ok-bg: #e5f3ea;
    --warn-bg: #fff6e0;
    --warn-line: #e0b85c;
    --warn-ink: #4a3a12;
    --danger-bg: #fdecec;
    --surface: #fff;
    --radius: 12px;
    --mono: "Cascadia Mono", "JetBrains Mono", "Consolas", "SFMono-Regular", "Menlo", monospace;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Trebuchet MS", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px; line-height: 1.5; color: var(--blue); background: var(--tint-2);
}
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul { list-style: none; }
h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; line-height: 1.3; }
h3 { font-size: 1.0625rem; line-height: 1.3; }
a { color: var(--blue); }
a:hover { color: var(--red); }
:focus-visible { outline: 3px solid var(--korall); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.xsmall { font-size: .8rem; }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.mono { font-family: var(--mono); }

/* ── Top bar ─────────────────────────────────────────────── */
.topbar {
    background: var(--blue); color: #fff; min-height: 58px;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
    gap: .4rem 1.25rem; padding: .25rem 1.25rem;
}
.brand { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; }
.brand img { display: block; width: auto; }
.brand .logo-standard { height: 46px; margin-left: -.75rem; }
.brand .logo-short { height: 40px; margin-left: -.6rem; display: none; }
.brand .sep { opacity: .4; font-weight: 300; font-size: 1.4rem; }
.brand .app { font-weight: 700; font-size: 1.15rem; letter-spacing: .01em; }
.topnav { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem 1.1rem; font-size: .92rem; }
.topnav a { color: #fff; text-decoration: none; padding: .3rem 0; border-bottom: 2px solid transparent; }
.topnav a:hover { color: #ffb0ac; }
.topnav a.current { border-bottom-color: var(--korall); font-weight: 700; }
.topnav .lang { color: #ccd7dd; }
.topnav .lang b { color: #fff; }
.topnav .who { display: flex; align-items: center; gap: .45rem; }
.avatar {
    width: 28px; height: 28px; border-radius: 50%; background: #fff; color: var(--blue);
    display: inline-grid; place-items: center; font-size: .75rem; font-weight: 700;
}
.btn-top {
    font: inherit; color: #fff; background: none; cursor: pointer; text-decoration: none;
    border: 1px solid rgba(255,255,255,.5); border-radius: 6px; padding: .2rem .7rem;
}
.btn-top:hover { background: rgba(255,255,255,.1); color: #fff; }
@media (max-width: 640px) {
    .brand .logo-standard { display: none; }
    .brand .logo-short { display: block; }
}

/* ── Layout ──────────────────────────────────────────────── */
.page { max-width: 1120px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; display: flex; flex-direction: column; gap: 1.5rem; }
.page.narrow { max-width: 640px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; }
.page-head p { margin-top: .35rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack.tight { gap: .4rem; }
.split { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }

.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.25rem; display: flex; flex-direction: column; gap: .9rem;
}
.card.flat { background: transparent; }
.card.tinted { background: var(--tint); border-color: var(--line-strong); }

/* ── Generator sidebar ───────────────────────────────────── */
.gen-nav { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.gen-nav .group { display: flex; flex-direction: column; gap: .1rem; }
.gen-nav .group .eyebrow { padding: 0 .65rem .25rem; }
.gen-nav button {
    all: unset; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    padding: .42rem .65rem; border-radius: 8px; font-size: .95rem;
}
.gen-nav button:hover { background: var(--tint); }
.gen-nav button.on { background: var(--blue); color: #fff; font-weight: 700; }
.gen-nav button .tag { font-size: .7rem; font-weight: 700; color: var(--muted); }
.gen-nav button.on .tag { color: #ccd7dd; }
.gen-nav button:focus-visible { outline: 3px solid var(--korall); }

/* ── Output ──────────────────────────────────────────────── */
.output {
    position: relative; border: 2px solid var(--blue); border-radius: 10px; background: #fff;
    padding: 1rem 1.1rem; min-height: 4.2rem; display: flex; align-items: center;
}
.output .value {
    font-family: var(--mono); font-size: 1.45rem; line-height: 1.4; letter-spacing: .02em;
    overflow-wrap: anywhere; word-break: break-all; flex: 1; user-select: all;
}
.output .value.multiline { font-size: 1rem; white-space: pre-wrap; word-break: normal; }
.output .value.masked { letter-spacing: .18em; color: var(--muted); }
.value .d { color: #1f5f8b; }                  /* digits */
.value .s { color: var(--blue); background: var(--tint); border-radius: 3px; font-weight: 700; } /* symbols */
.output .eye {
    all: unset; cursor: pointer; margin-left: .75rem; padding: .3rem; border-radius: 6px; color: var(--muted);
    display: grid; place-items: center;
}
.output .eye:hover { background: var(--tint); color: var(--blue); }

.strength { display: flex; align-items: center; gap: .75rem; font-size: .88rem; }
.strength .bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; width: 160px; }
.strength .bars span { height: 6px; border-radius: 3px; background: var(--line); }
.strength .bars span.on { background: var(--blue); }
.strength b { font-weight: 700; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    min-height: 44px; padding: 0 1.15rem; border-radius: 8px; cursor: pointer;
    font: inherit; font-weight: 700; text-decoration: none;
    background: var(--blue); color: #fff; border: 1px solid var(--blue);
}
.btn:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn.secondary { background: #fff; color: var(--blue); }
.btn.secondary:hover { background: var(--tint); color: var(--red); border-color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--blue); padding: 0 .6rem; }
.btn.ghost:hover { background: var(--tint); color: var(--red); }
.btn.danger { background: #fff; color: var(--blue); border-color: var(--line-strong); } /* red only on hover (BIH rule) */
.btn.danger:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn.big { min-height: 52px; font-size: 1.05rem; padding: 0 1.6rem; }
.btn.sm { min-height: 34px; padding: 0 .75rem; font-size: .88rem; }
.btn svg { width: 18px; height: 18px; }
.btn.copied { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ── Forms ───────────────────────────────────────────────── */
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem 1.25rem; }
label.field, .field { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 700; }
.field.wide { grid-column: 1 / -1; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
    font: inherit; font-weight: 400; color: var(--blue); background: #fff;
    border: 1px solid var(--field); border-radius: 8px; padding: .55rem .7rem; min-height: 44px; width: 100%;
}
textarea { min-height: 7rem; resize: vertical; font-family: var(--mono); font-size: .95rem; }
input[type=range] { width: 100%; accent-color: var(--blue); }
.checks { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-weight: 400; }
.checks label { display: inline-flex; align-items: center; gap: .4rem; font-size: .92rem; cursor: pointer; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--blue); }
.seg { display: inline-flex; border: 1px solid var(--field); border-radius: 8px; overflow: hidden; }
.seg button {
    font: inherit; font-size: .9rem; background: #fff; color: var(--blue); border: 0; border-right: 1px solid var(--line);
    padding: .45rem .8rem; cursor: pointer; min-height: 40px; white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--tint); }
.seg button.on { background: var(--blue); color: #fff; font-weight: 700; }
.seg button:disabled { color: #9aa8b2; background: #f6f8f9; cursor: not-allowed; }

/* ── Link panel ──────────────────────────────────────────── */
.link-panel { border-top: 1px solid var(--line); padding-top: 1.1rem; display: flex; flex-direction: column; gap: 1rem; }
.lockrow {
    display: flex; gap: .8rem; align-items: flex-start; padding: .8rem 1rem; border-radius: 10px;
    background: var(--tint); border: 1px solid var(--line-strong); font-size: .9rem;
}
.lockrow svg { flex: none; width: 20px; height: 20px; margin-top: .1rem; }
.lockrow ul { display: flex; flex-wrap: wrap; gap: .2rem 1rem; margin-top: .25rem; }
.lockrow li::before { content: "– "; color: var(--muted); }

.linkbox {
    display: flex; align-items: center; gap: .6rem; background: var(--tint-2); border: 1px solid var(--line-strong);
    border-radius: 10px; padding: .55rem .55rem .55rem .9rem;
}
.linkbox code { flex: 1; font-family: var(--mono); font-size: .95rem; overflow-wrap: anywhere; }
.linkbox code .frag { color: #1f5f8b; }

.notice { border-radius: 10px; padding: .75rem 1rem; font-size: .92rem; display: flex; gap: .7rem; align-items: flex-start; }
.notice svg { flex: none; width: 20px; height: 20px; margin-top: .1rem; }
.notice.info { background: var(--tint); border: 1px solid var(--line-strong); }
.notice.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.notice.ok { background: var(--ok-bg); border: 1px solid #9ccbad; color: #133f23; }
.notice.error { background: var(--danger-bg); border: 1px solid #ffb0ac; color: var(--red); }

/* ── Bulk list ───────────────────────────────────────────── */
.bulk { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.bulk li { display: flex; align-items: center; gap: .75rem; padding: .35rem .5rem .35rem .9rem; border-bottom: 1px solid var(--tint); }
.bulk li:last-child { border-bottom: 0; }
.bulk li:nth-child(odd) { background: var(--tint-2); }
.bulk .n { width: 1.6rem; color: var(--muted); font-size: .8rem; text-align: right; }
.bulk code { flex: 1; font-family: var(--mono); overflow-wrap: anywhere; }

/* ── NATO spelling ───────────────────────────────────────── */
.spell { display: flex; flex-wrap: wrap; gap: .4rem; }
.spell span {
    display: inline-flex; flex-direction: column; align-items: center; min-width: 3.4rem;
    border: 1px solid var(--line); border-radius: 8px; padding: .25rem .4rem; background: #fff;
}
.spell span b { font-family: var(--mono); font-size: 1.1rem; }
.spell span i { font-style: normal; font-size: .72rem; color: var(--muted); }

/* ── Pills, tables ───────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pill.active { background: var(--blue); color: #fff; }
.pill.viewed { background: var(--ok-bg); color: var(--ok); }
.pill.partial { background: var(--tint); color: var(--blue); border: 1px solid var(--line-strong); }
.pill.expired { background: #eceff1; color: var(--muted); }
.pill.revoked { background: var(--danger-bg); color: var(--red); }
.pill.mail { background: #fff; color: var(--blue); border: 1px solid var(--line-strong); font-weight: 400; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: .7rem .9rem; border-bottom: 1px solid var(--line); background: var(--tint-2); white-space: nowrap; }
td { padding: .7rem .9rem; border-bottom: 1px solid var(--tint); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafb; }
td .sub { display: block; font-size: .8rem; color: var(--muted); }
.views { display: flex; align-items: center; gap: .5rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.views .track { width: 54px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.views .track i { display: block; height: 100%; background: var(--blue); }

.stat { padding: 1rem 1.1rem; gap: .2rem; }
.stat .num { font-size: 1.9rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }

.tabs { display: flex; flex-wrap: wrap; gap: .3rem; }
.tabs button {
    font: inherit; font-size: .9rem; cursor: pointer; background: transparent; color: var(--blue);
    border: 1px solid transparent; border-radius: 999px; padding: .25rem .85rem;
}
.tabs button:hover { background: var(--tint); }
.tabs button.on { background: #fff; border-color: var(--line-strong); font-weight: 700; }
.tabs button .c { color: var(--muted); font-weight: 400; margin-left: .2rem; }

/* ── Recipient ───────────────────────────────────────────── */
.recv { max-width: 600px; margin: 0 auto; text-align: center; align-items: center; padding: 2.2rem 1.6rem; gap: 1.1rem; }
.recv .mark { width: 64px; height: 64px; }
.recv .sender { display: inline-flex; align-items: center; gap: .55rem; background: var(--tint); border-radius: 999px; padding: .3rem .9rem .3rem .35rem; font-size: .92rem; }
.recv .sender .avatar { background: var(--blue); color: #fff; }
.recv .meta { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.recv .meta b { color: var(--blue); }
.recv .output { width: 100%; text-align: left; }
.recv .msg { width: 100%; text-align: left; background: var(--tint-2); border-left: 4px solid var(--blue); border-radius: 0 8px 8px 0; padding: .7rem 1rem; font-size: .95rem; }

/* ── Timeline (access log) ───────────────────────────────── */
.timeline li { display: grid; grid-template-columns: 22px 1fr; gap: .7rem; padding-bottom: .9rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 10px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--blue); display: grid; place-items: center; font-size: .65rem; font-weight: 700; }
.timeline .dot.fill { background: var(--blue); color: #fff; }
.timeline .dot.red { border-color: var(--red); color: var(--red); }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; font-size: .93rem; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { font-size: .82rem; padding: .15rem .6rem; border-radius: 999px; background: var(--tint); border: 1px solid var(--line-strong); }

.steps { display: flex; gap: .4rem; align-items: center; font-size: .85rem; color: var(--muted); }
.steps .on { color: var(--blue); font-weight: 700; }
.steps i { width: 24px; height: 2px; background: var(--line); }

footer.foot {
    max-width: 1120px; margin: 0 auto; padding: 1.25rem; border-top: 1px solid var(--line);
    display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; font-size: .85rem; color: var(--muted);
}
footer.foot a { color: var(--muted); }
footer.foot .grow { flex: 1; }

.toast {
    position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
    background: var(--blue); color: #fff; padding: .6rem 1.1rem; border-radius: 10px; font-size: .92rem;
    box-shadow: 0 6px 24px rgba(0,55,84,.25); z-index: 60;
}

.pill.soon { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }
td:last-child { white-space: nowrap; }
@media (max-width: 640px) {
    .page { padding: 1.25rem .9rem 3rem; }
    .recv { padding: 1.5rem 1rem; }
    .output .value { font-size: 1.2rem; }
}

/* ── App additions ───────────────────────────────────────── */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; color: var(--blue); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: .5rem; }
.form-narrow { max-width: 460px; margin: 0 auto; width: 100%; }
.counter { font-size: .8rem; color: var(--muted); text-align: right; }
.counter.over { color: var(--red); font-weight: 700; }
.spinner { width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.prose { max-width: 760px; display: flex; flex-direction: column; gap: .9rem; }
.prose h2 { margin-top: .8rem; }
.prose ul { list-style: disc; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .3rem; }
.prose code { font-family: var(--mono); background: var(--tint); padding: 0 .3rem; border-radius: 4px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--blue); border-color: var(--blue); }
.btn.secondary[disabled]:hover { background: #fff; color: var(--blue); border-color: var(--blue); }

/* Utility classes (no inline styles: the CSP forbids them) */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.field.inline { flex-direction: row; align-items: center; gap: .5rem; }
.normal { font-weight: 400; }
.select-sm { min-height: 36px; padding: .25rem .5rem; width: auto; }
.summary { cursor: pointer; font-weight: 700; }
.mt { margin-top: .75rem; }
.row.tight { gap: .4rem; }
.input-num { width: 5.5rem; }
.card.gap-sm { gap: .7rem; }
.textarea-short { min-height: 3rem; font-family: inherit; font-size: 1rem; }
fieldset.card { margin: 0; min-width: 0; }
.topnav form { margin: 0; }
.topnav a.who { display: flex; align-items: center; gap: .45rem; border: 0; }
.result-link + .result-link { margin-top: .4rem; }
.result-link .to { font-size: .85rem; color: var(--muted); }
.big-title { font-size: 1.5rem; }
.field.span2 { grid-column: span 2; }
@media (max-width: 720px) { .field.span2 { grid-column: auto; } }
.recv form { text-align: left; }
.field-error { color: var(--red); font-weight: 400; font-size: .85rem; }
input[aria-invalid="true"] { border-color: var(--red); border-width: 2px; }
.auth-grid { max-width: 960px; margin: 0 auto; width: 100%; align-items: start; }
.qr { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* Dashboard */
.tabs a.tab { font-size: .9rem; color: var(--blue); text-decoration: none; border: 1px solid transparent; border-radius: 999px; padding: .25rem .85rem; }
.tabs a.tab:hover { background: var(--tint); }
.tabs a.tab.on { background: #fff; border-color: var(--line-strong); font-weight: 700; }
.search { max-width: 280px; min-height: 38px; }
.table-wrap.borderless { border: 0; }
.detail-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } }
.timeline .sub { display: block; }
.views .track i.w0 { width: 0%; }
.views .track i.w10 { width: 10%; }
.views .track i.w20 { width: 20%; }
.views .track i.w30 { width: 30%; }
.views .track i.w40 { width: 40%; }
.views .track i.w50 { width: 50%; }
.views .track i.w60 { width: 60%; }
.views .track i.w70 { width: 70%; }
.views .track i.w80 { width: 80%; }
.views .track i.w90 { width: 90%; }
.views .track i.w100 { width: 100%; }
.grow-input { flex: 1; min-width: 12rem; }
