/* OV-Logbuch – Tinte, Papier, Signal. Nur Systemschriften, keine externen Quellen. */
:root {
  --ink: #1c2a4a;
  --ink-2: #3b4a6b;
  --paper: #f5f7fa;
  --sheet: #ffffff;
  --rule: #d6dde8;
  --rule-2: #e9edf3;
  --muted: #5d6a82;
  --signal: #d98e1f;
  --signal-bg: #fdf1dc;
  --ok: #2c7a4b;
  --ok-bg: #e2f2e8;
  --bad: #b23a2f;
  --bad-bg: #fbe6e3;
  --focus: #2f6fdb;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --r: 4px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--ink) 35%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 .5rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.125rem; margin: 0 0 .5rem; font-weight: 650; }
p { margin: 0 0 1rem; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.strong { font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }

/* Kopfzeile */
.top { background: var(--ink); color: #fff; display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.25rem; flex-wrap: wrap; }
.top a { color: #fff; text-decoration: none; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.brand small { display: block; font-weight: 400; font-size: .75rem; opacity: .7; }
.brand span { line-height: 1.15; }
.brand-mark { width: 28px; height: 28px; fill: none; stroke: var(--signal); stroke-width: 1.8; stroke-linecap: round; }
.mainnav { display: flex; gap: .25rem; flex-wrap: wrap; }
.mainnav a { padding: .35rem .7rem; border-radius: var(--r); opacity: .85; }
.mainnav a:hover { opacity: 1; background: rgba(255,255,255,.08); }
.mainnav a[aria-current] { opacity: 1; background: rgba(255,255,255,.14); }
.me { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .875rem; }
.me .call { font-family: var(--mono); font-weight: 700; }
.me .role { opacity: .7; }
.me form { margin: 0; }
.me .linkish { color: #fff; opacity: .85; }
.count { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 1em; background: var(--signal); color: var(--ink); font-size: .75rem; font-weight: 700; text-align: center; }

main { flex: 1; padding: 1.5rem 1.25rem 3rem; width: 100%; margin: 0 auto; }
main.wrap { max-width: 1100px; }
main.wide { max-width: 1500px; }
main.narrow { max-width: 560px; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; border-top: 1px solid var(--rule); }

/* Meldungen */
.flashes { margin-bottom: 1rem; }
.flash { padding: .6rem .9rem; border-radius: var(--r); border-left: 4px solid var(--ink-2); background: var(--sheet); margin-bottom: .5rem; }
.flash-ok { border-color: var(--ok); background: var(--ok-bg); }
.flash-error { border-color: var(--bad); background: var(--bad-bg); }
.flash-warn { border-color: var(--signal); background: var(--signal-bg); }

/* Formulare */
label { display: flex; flex-direction: column; gap: .25rem; font-size: .875rem; font-weight: 600; color: var(--ink-2); }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; color: var(--ink); font-size: .95rem; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: .45rem .6rem; min-height: 2.25rem; }
input:focus, select:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 1rem; height: 1rem; accent-color: var(--ink); }
input.mono { text-transform: uppercase; }
input.mono.nocaps { text-transform: none; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.narrowform { max-width: 520px; }
fieldset { border: 1px solid var(--rule); border-radius: var(--r); padding: .75rem 1rem 1rem; margin: 0; background: var(--sheet); display: flex; flex-direction: column; gap: .5rem; }
legend { font-weight: 700; padding: 0 .3rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row form { margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: 600 .9rem/1 var(--sans); padding: .6rem .95rem; border-radius: var(--r); border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-2); }
.btn.danger { background: var(--sheet); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, white); }
.btn.danger:hover { background: var(--bad); color: #fff; }
.btn.small { padding: .4rem .65rem; font-size: .8rem; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); text-decoration: underline; cursor: pointer; }

/* Anmeldung */
.auth { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 1.75rem; margin-top: 2rem; }

/* Übersicht */
.intro { margin-bottom: 1.5rem; }
.block { margin: 2rem 0; }
.block > .tablewrap + p, .block > table + p { margin-top: .6rem; }
.mine { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); }
.mine li { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; flex-wrap: wrap; }
.mine li + li { border-top: 1px solid var(--rule-2); }
.mine-call { font: 700 1.25rem var(--mono); text-decoration: none; letter-spacing: .04em; }
.mine .actions { margin-left: auto; display: flex; gap: .5rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }

/* Klubstation als QSL-Karte: das eine auffällige Element */
.qslcard { display: flex; flex-direction: column; gap: .3rem; padding: 1.1rem 1.25rem 1rem; background: var(--sheet); border: 1px solid var(--rule); border-radius: 2px; text-decoration: none; position: relative; overflow: hidden; }
.qslcard::after { content: ""; position: absolute; inset: auto 0 0 0; height: 5px; background: repeating-linear-gradient(90deg, var(--ink) 0 18px, var(--signal) 18px 36px); }
.qslcard:hover { border-color: var(--ink-2); }
.qslcard-call { font: 800 2rem/1 var(--mono); letter-spacing: .08em; }
.qslcard-title { font-weight: 600; }
.qslcard-meta { color: var(--muted); font-size: .85rem; margin-bottom: .4rem; }

/* Logbuch-Kopf */
.lbhead { display: flex; gap: 2rem; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; padding-bottom: 1.25rem; border-bottom: 2px solid var(--ink); margin-bottom: 1rem; }
.stamp { font: 800 clamp(2.5rem, 6vw, 4.25rem)/.95 var(--mono); letter-spacing: .1em; margin: 0 0 .5rem; color: var(--ink); }
.lbhead-sub { color: var(--ink-2); margin: 0 0 .4rem; }
.perm { display: inline-block; font-size: .85rem; padding: .2rem .6rem; border-radius: var(--r); margin: .25rem 0 0; }
.perm-edit { background: var(--ok-bg); color: var(--ok); }
.perm-view { background: var(--rule-2); color: var(--ink-2); }
.figures { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 1rem; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); }
.figures div { padding: .55rem .9rem; min-width: 6.5rem; }
.figures div + div { border-left: 1px solid var(--rule-2); }
.figures dt { font-size: .75rem; color: var(--muted); }
.figures dd { margin: 0; font: 700 1.25rem var(--mono); font-variant-numeric: tabular-nums; }
.figures .hl dd { color: var(--signal); }
.figures .ok dd { color: var(--ok); }
.lbhead .figures { margin: 0; }

.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: 1rem 0; }
.toolbar .spacer { flex: 1; }

details.stats { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: .5rem 1rem; margin-bottom: 1rem; }
details summary { cursor: pointer; font-weight: 600; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; padding: .75rem 0; }
table.mini { border-collapse: collapse; width: 100%; font-size: .875rem; }
table.mini caption { text-align: left; font-weight: 700; padding-bottom: .3rem; }
table.mini th { text-align: left; font-weight: 600; width: 4.5rem; padding: .15rem 0; }
table.mini td { padding: .15rem .4rem; }
progress { width: 100%; height: .6rem; appearance: none; border: 0; background: var(--rule-2); border-radius: 2px; }
progress::-webkit-progress-bar { background: var(--rule-2); border-radius: 2px; }
progress::-webkit-progress-value { background: var(--ink-2); border-radius: 2px; }
progress::-moz-progress-bar { background: var(--ink-2); border-radius: 2px; }

.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; padding: .75rem; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); margin-bottom: 1rem; }
.filters label { font-size: .75rem; }
.filters input[name=q] { min-width: 15rem; }
.filters .linkish { align-self: center; font-size: .875rem; }

.bulkbar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; padding: .6rem .75rem; background: var(--signal-bg); border: 1px solid color-mix(in srgb, var(--signal) 40%, white); border-radius: var(--r); margin-bottom: .75rem; }
.bulkbar label { font-size: .75rem; }
.bulkbar label.check { font-size: .875rem; align-self: center; }

/* Tabellen */
.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); }
table.log, table.list { border-collapse: collapse; width: 100%; font-size: .875rem; }
table.log th, table.list th { text-align: left; font-weight: 650; color: var(--ink-2); background: var(--rule-2); padding: .45rem .55rem; border-bottom: 1px solid var(--rule); white-space: nowrap; position: sticky; top: 0; }
table.log th a, table.list th a { text-decoration: none; color: inherit; }
table.log td, table.list td { padding: .3rem .55rem; border-bottom: 1px solid var(--rule-2); vertical-align: middle; }
table.log tbody tr:hover { background: #f8fafc; }
table.log tbody tr:nth-child(5n) td { border-bottom-color: var(--rule); }
table.log a { text-decoration: none; }
table.log td.trunc { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.log .cb { width: 2rem; text-align: center; }
th.qsl, td.qsl { text-align: center; width: 3.6rem; padding-left: .2rem; padding-right: .2rem; }
table.list td.actions { text-align: right; white-space: nowrap; }
table.list td.actions form { display: inline-block; margin: 0 0 0 .3rem; }
table.list td.actions > a { margin-left: .3rem; }
table th.r, table td.r { text-align: right; }
.editlink { font-size: 1.05rem; padding: .1rem .35rem; border-radius: var(--r); }
.editlink:hover { background: var(--rule-2); }

/* QSL-Status */
.qslsel, .qslbadge { font: 700 .8rem var(--mono); border-radius: 3px; min-height: 0; padding: .15rem .25rem; border: 1px solid var(--rule); background: var(--sheet); color: var(--muted); width: 2.9rem; text-align: center; display: inline-block; }
.qslsel { cursor: pointer; }
[data-val="Y"], [data-val="V"] { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, white); color: var(--ok); }
[data-val="R"], [data-val="Q"] { background: var(--signal-bg); border-color: color-mix(in srgb, var(--signal) 45%, white); color: #8a5408; }
[data-val="N"] { color: var(--ink-2); }
[data-val="I"] { color: var(--muted); text-decoration: line-through; }
.qslsel.saving { opacity: .5; }
.qslsel.saved { box-shadow: 0 0 0 2px var(--ok); transition: box-shadow .6s; }
.qslsel.failed { box-shadow: 0 0 0 2px var(--bad); }

.tag { display: inline-block; font-size: .7rem; font-weight: 600; padding: 0 .35rem; border-radius: 3px; background: var(--rule-2); color: var(--ink-2); vertical-align: middle; }
.status { font-size: .8rem; padding: .1rem .45rem; border-radius: 3px; }
.s-pending { background: var(--signal-bg); color: #8a5408; }
.s-active { background: var(--ok-bg); color: var(--ok); }
.s-disabled { background: var(--bad-bg); color: var(--bad); }

.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin: 1rem 0; }
.empty { padding: 1.5rem; text-align: center; color: var(--muted); background: var(--sheet); border: 1px dashed var(--rule); border-radius: var(--r); }
.legend { margin-top: .75rem; }
.crumbs { font-size: .875rem; margin-bottom: .25rem; }
.crumbs a::before { content: "‹ "; }

/* QSO-Formular */
.qsoform { display: flex; flex-direction: column; gap: 1rem; }
.qsoform .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.qsoform .grid .wide { grid-column: span 2; }
.qsoform .grid.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 720px; }
@media (max-width: 760px) { .qsoform .grid.grid3 { grid-template-columns: 1fr; } .qsoform .grid.grid3 > span { display: none; } }
.qsoform .grid .full { grid-column: 1 / -1; }
.callinput { font-size: 1.5rem; font-weight: 700; letter-spacing: .05em; }
.danger-zone { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
details.replace { border: 1px solid color-mix(in srgb, var(--bad) 30%, white); background: var(--bad-bg); border-radius: var(--r); padding: .6rem 1rem; }
details.replace[open] { display: flex; flex-direction: column; gap: .6rem; }
.drop input[type=file] { padding: 1rem; border-style: dashed; }
ul.errors { font-size: .875rem; font-family: var(--mono); }

/* Verwaltung */
.subnav { display: flex; gap: .25rem; border-bottom: 1px solid var(--rule); margin: .5rem 0 1.5rem; flex-wrap: wrap; }
.subnav a { padding: .5rem .8rem; text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 650; }
.twocol { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem; }
.twocol h2 { margin-top: 1.25rem; }
.twocol h2:first-child { margin-top: 0; }
ul.plain { list-style: none; padding: 0; }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .35rem .75rem; }
.credentials { background: var(--sheet); border: 2px solid var(--ink); border-radius: var(--r); padding: 1.25rem 1.5rem; max-width: 520px; margin-bottom: 1.5rem; }
.credentials dl { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; }
.credentials dt { color: var(--muted); }
.credentials dd { margin: 0; }
.credentials .big { font-size: 1.35rem; font-weight: 700; letter-spacing: .05em; }
table.audit td:last-child { color: var(--ink-2); }

@media (max-width: 760px) {
  .top { gap: .75rem; }
  .me { margin-left: 0; width: 100%; }
  .twocol { grid-template-columns: 1fr; }
  .lbhead { align-items: flex-start; }
  .figures div { min-width: 5.5rem; }
  .mine .actions { margin-left: 0; }
  .filters input[name=q] { min-width: 0; width: 100%; }
  .filters label { flex: 1 1 45%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .top, .toolbar, .filters, .bulkbar, .pager, .foot, details.stats, .cb, .editlink { display: none !important; }
  body { background: #fff; }
  .tablewrap { border: 0; overflow: visible; }
}
