:root {
  --paper: #F6F3EC;
  --paper-dim: #EFEBE0;
  --ink: #211E1A;
  --ink-soft: #5A554C;
  --line: #D8D2C4;
  --stamp-red: #B23A2E;
  --ledger-green: #3F6B4A;
  --gold: #A9862F;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

h1, h2, h3 {
  font-family: Georgia, "Iowan Old Style", ui-serif, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
}
h1 { font-size: 2rem; border-bottom: 3px solid var(--ink); padding-bottom: 0.4em; }
h2 { font-size: 1.3rem; margin-top: 2.2em; }

.eyebrow {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.3em;
}

nav {
  display: flex; gap: 1.4rem; align-items: center;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--line);
  background: var(--paper-dim);
  position: relative;
}
nav a { color: var(--ink); text-decoration: none; font-size: 0.92rem; }
nav a:hover { color: var(--stamp-red); }
nav .brand { font-family: Georgia, serif; font-weight: 700; font-size: 1.05rem; margin-right: auto; }
.nav-links { display: flex; gap: 1.4rem; align-items: center; flex-wrap: wrap; }
.nav-toggle { display: none; }
.nav-toggle-label { display: none; }

.card {
  background: white; border: 1px solid var(--line); border-radius: 3px;
  padding: 1.4rem; margin-bottom: 1.2rem;
}

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.6em 0.7em; border-bottom: 1px solid var(--line); }
th { font-family: ui-monospace, monospace; font-size: 0.72rem; letter-spacing: 0.08em;
     text-transform: uppercase; color: var(--ink-soft); }
tr:hover td { background: var(--paper-dim); }
a.row-link { color: var(--ink); text-decoration: none; font-weight: 600; }
a.row-link:hover { color: var(--stamp-red); }

.slug { font-family: ui-monospace, monospace; font-size: 0.85em; color: var(--ink-soft); word-break: break-all; }

.stamp {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25em 0.6em;
  border: 2px solid currentColor;
  border-radius: 2px;
  transform: rotate(-2deg);
  font-weight: 700;
}
.stamp-go, .stamp-generated { color: var(--ledger-green); }
.stamp-nogo, .stamp-rejected, .stamp-fehlt { color: var(--stamp-red); }
.stamp-pending { color: var(--gold); }

.btn {
  display: inline-block; font: inherit; font-weight: 600; font-size: 0.88rem;
  padding: 0.65em 1.2em; border-radius: 3px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper); cursor: pointer; text-decoration: none;
  min-height: 44px; box-sizing: border-box; line-height: 1.6;
}
.btn:hover { background: var(--stamp-red); border-color: var(--stamp-red); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--paper-dim); color: var(--ink); }
.btn-danger { background: var(--stamp-red); border-color: var(--stamp-red); }

form.inline { display: inline; }

label { display: block; font-size: 0.85rem; font-weight: 600; margin: 0.8em 0 0.3em; }
input[type=text], input[type=password], input[type=number], input[type=email],
textarea, select {
  width: 100%; padding: 0.65em 0.7em; border: 1px solid var(--line); border-radius: 3px;
  font: inherit; background: var(--paper); min-height: 44px; box-sizing: border-box;
}
textarea { min-height: auto; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6em; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.6em; }
.bsr-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6em; }

.flash { padding: 0.8em 1em; border-radius: 3px; margin-bottom: 1em; font-size: 0.9rem; }
.flash-success { background: #E7EFE8; border: 1px solid var(--ledger-green); color: var(--ledger-green); }
.flash-error { background: #F5E6E4; border: 1px solid var(--stamp-red); color: var(--stamp-red); }

.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 140px; background: white; border: 1px solid var(--line);
  border-radius: 3px; padding: 1rem 1.2rem;
}
.stat .num { font-family: Georgia, serif; font-size: 2rem; font-weight: 700; }
.stat .label { font-size: 0.78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }

.login-box {
  max-width: 360px; margin: 10vh auto; background: white; border: 1px solid var(--line);
  border-radius: 4px; padding: 2rem;
}

.pdf-embed { width: 100%; height: 480px; border: 1px solid var(--line); border-radius: 3px; }
.pdf-fallback-link { display: block; margin-top: 0.5em; font-size: 0.85rem; }
.pdf-embed-note { display: none; }

.muted { color: var(--ink-soft); font-size: 0.88rem; }

/* ---------------- Mobil-Optimierung ---------------- */
@media (max-width: 780px) {
  .wrap { padding: 1.2rem 1rem 3rem; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.1rem; margin-top: 1.6em; }

  /* Hamburger-Navigation (rein CSS, kein JS) */
  nav { flex-wrap: nowrap; padding: 0.8rem 1rem; }
  nav .brand { font-size: 0.95rem; }
  .nav-toggle-label {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; cursor: pointer; font-size: 1.4rem;
    border: 1px solid var(--line); border-radius: 3px; background: white;
  }
  nav .nav-links {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper-dim); border-bottom: 1px solid var(--line);
    z-index: 20;
  }
  nav .nav-links a {
    padding: 0.9em 1.2rem; border-top: 1px solid var(--line);
    font-size: 1rem; min-height: 44px; display: flex; align-items: center;
  }
  .nav-toggle:checked ~ .nav-links { display: flex; }

  /* Grids stapeln sich auf schmalen Screens */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .bsr-grid { grid-template-columns: repeat(2, 1fr); }

  .stat-row { gap: 0.7rem; }
  .stat { min-width: calc(50% - 0.35rem); padding: 0.8rem 1rem; }
  .stat .num { font-size: 1.5rem; }

  table { font-size: 0.82rem; }
  th, td { padding: 0.5em 0.5em; }

  .pdf-embed { height: 320px; }
  .pdf-embed { display: none; }
  .pdf-embed-note { display: block; }

  .btn { display: block; width: 100%; text-align: center; margin-bottom: 0.5em; }
  .btn + .btn { margin-left: 0 !important; }
}
