/* ============================================================
   PCG Hub – Design-System („Datenweiser"-Stil, Akzent Schieferblau)
   ============================================================ */

@font-face {
  font-family: 'Manrope';
  src: url('/assets/fonts/manrope-var.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #16232e;
  --ink-soft: #51616e;
  --paper: #f4f6f5;
  --surface: #ffffff;
  --line: #e2e7e6;

  /* Schieferblau statt Petrol */
  --brand: #1d4e78;
  --brand-deep: #143a5c;
  --brand-soft: #e3ecf4;
  --brand-ghost: #f0f5f9;

  --amber: #a86a12;  --amber-bg: #fbf2e0;
  --green: #2c7a52;  --green-bg: #e5f2ea;
  --red:   #b0392f;  --red-bg:   #f9e9e7;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(22,35,46,.05), 0 4px 14px rgba(22,35,46,.06);
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Consolas', monospace;
}

/* ------------------------------------------------ Grundlagen */
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 450;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}
h1 { font-size: 1.45rem; font-weight: 750; letter-spacing: -.015em; margin: 0 0 .3rem; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 .8rem; }
h3 { font-size: .95rem; font-weight: 700; margin: 0 0 .5rem; }
a { color: var(--brand); }
a:hover { color: var(--brand-deep); }
p { margin: 0 0 .8rem; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ------------------------------------------------ App-Rahmen */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, var(--brand-deep), #0f2c47);
  color: #fff;
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  padding: 1.3rem 1rem 1.1rem;
}
.sidebar-logo { padding: 0 .55rem; margin-bottom: 1.6rem; }
.sidebar-logo .marke { font-weight: 800; font-size: 1.12rem; letter-spacing: -.01em; color: #fff; text-decoration: none; display: block; }
.sidebar-logo .zusatz { font-size: .62rem; text-transform: uppercase; letter-spacing: .14em; color: #9db8d2; font-weight: 700; }

.nav { flex: 1; display: flex; flex-direction: column; gap: .15rem; overflow-y: auto; }
.nav-label {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .12em;
  color: #7e9dc1; font-weight: 700; padding: .9rem .55rem .3rem;
}
.nav a {
  display: flex; align-items: center; gap: .6rem;
  color: rgba(255,255,255,.86); text-decoration: none;
  font-size: .89rem; font-weight: 600;
  padding: .5rem .55rem; border-radius: var(--radius-sm);
}
.nav a svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; flex: none; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.aktiv { background: rgba(255,255,255,.13); color: #fff; }
.nav .zaehler {
  margin-left: auto; font-size: .68rem; font-weight: 800;
  background: rgba(255,255,255,.16); border-radius: 99px; padding: .05rem .45rem;
}

.sidebar-fuss { border-top: 1px solid rgba(255,255,255,.14); padding-top: .9rem; margin-top: .9rem; }
.sidebar-benutzer { font-size: .82rem; font-weight: 700; padding: 0 .55rem; }
.sidebar-benutzer .rolle { display: block; font-weight: 500; font-size: .72rem; color: #9db8d2; }
.sidebar-fuss form { margin: .6rem 0 0; }
.btn-abmelden {
  width: 100%;
  background: transparent; color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.35); border-radius: var(--radius-sm);
  font: inherit; font-size: .8rem; font-weight: 700;
  padding: .42rem .6rem; cursor: pointer;
}
.btn-abmelden:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ------------------------------------------------ Topbar + Inhalt */
.haupt { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: .65rem 2rem;
  display: flex; align-items: center; gap: 1rem;
}
.schnellsuche { position: relative; flex: 1; max-width: 440px; }
.schnellsuche svg {
  position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; stroke: var(--ink-soft); fill: none; stroke-width: 2;
  pointer-events: none;
}
.schnellsuche input {
  width: 100%; border: 1px solid var(--line); border-radius: 99px;
  background: var(--paper); font: inherit; font-size: .86rem;
  padding: .48rem 1rem .48rem 2.3rem; color: var(--ink);
}
.schnellsuche input:focus {
  background: var(--surface); outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 10%, transparent);
}
.topbar-rechts { margin-left: auto; font-size: .82rem; color: var(--ink-soft); font-weight: 600; }

.content { padding: 1.6rem 2rem 2.4rem; width: 100%; max-width: none; }

.page-head {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: .8rem; margin-bottom: 1.2rem;
}
.page-head h1 { font-size: 1.35rem; }
.page-head .untertitel { color: var(--ink-soft); font-size: .88rem; margin: 0; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.head-actions .btn, .head-actions .btn-outline { min-height: 42px; }

/* ------------------------------------------------ Karten */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.25rem 1.4rem; margin-bottom: 1.2rem;
}
.card h2 { font-size: 1.02rem; }
.card-hint { font-size: .8rem; color: var(--ink-soft); }

/* ------------------------------------------------ Statistik-Kacheln */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.2rem; margin-bottom: 1.2rem;
}
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
}
.stat .zahl { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); font-weight: 700; }

/* ------------------------------------------------ Tabellen */
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-soft); font-weight: 700;
  padding: .45rem .6rem; border-bottom: 1.5px solid var(--line);
}
td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--brand-ghost); }
tbody tr:last-child td { border-bottom: none; }
td .btn-sm { white-space: nowrap; }

/* ------------------------------------------------ Mono-Badge */
.az {
  font-family: var(--mono); font-size: .8rem; font-weight: 600;
  background: var(--brand-soft); color: var(--brand-deep);
  border-radius: 5px; padding: .12rem .45rem; white-space: nowrap;
}

/* ------------------------------------------------ Status-Badges */
.badge {
  display: inline-block; border-radius: 99px;
  font-size: .72rem; font-weight: 700;
  padding: .16rem .6rem;
  vertical-align: middle; white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red   { background: var(--red-bg);   color: var(--red); }
.badge-gray  { background: #eceff0; color: var(--ink-soft); }
.badge-brand { background: var(--brand-soft); color: var(--brand-deep); }

/* ------------------------------------------------ Buttons */
.btn, .btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-size: .86rem; font-weight: 700;
  min-height: 40px; padding: .4rem 1rem;
  border-radius: var(--radius-sm); cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn { background: var(--brand); color: #fff; border: 1.5px solid var(--brand); }
.btn:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.btn-outline { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-outline:hover { background: var(--brand-ghost); color: var(--brand-deep); }
.btn-sm { min-height: 33px; padding: .2rem .7rem; font-size: .8rem; }
.btn-rot { background: var(--red); border-color: var(--red); }
.btn-rot:hover { background: #8f2e26; border-color: #8f2e26; }
.btn:disabled, .btn-outline:disabled { opacity: .5; cursor: not-allowed; }

/* ------------------------------------------------ Formulare */
label { display: block; font-size: .82rem; font-weight: 700; margin-bottom: .3rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="file"], select, textarea {
  width: 100%; font: inherit; font-size: .9rem; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: 42px; padding: .5rem .7rem;
  appearance: none; -webkit-appearance: none;
}
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .45; cursor: pointer; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2351616e' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center;
  padding-right: 2rem;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 10%, transparent);
}
.field { margin-bottom: 1rem; }
.field .help { font-size: .76rem; color: var(--ink-soft); margin-top: .25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; font-size: .88rem; }
.check input { width: auto; min-height: 0; appearance: auto; -webkit-appearance: auto; }

/* ------------------------------------------------ Flash-Meldungen */
.flash {
  border-radius: var(--radius-sm); padding: .7rem 1rem;
  font-size: .88rem; font-weight: 600; margin-bottom: 1.2rem;
}
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-error   { background: var(--red-bg);   color: var(--red); }
.flash-info    { background: var(--brand-soft); color: var(--brand-deep); }

/* ------------------------------------------------ Leerzustände */
.empty { text-align: center; color: var(--ink-soft); padding: 2.6rem 1rem; }
.empty .btn { margin-top: .8rem; }

/* ------------------------------------------------ Tabs */
.tabs {
  display: flex; gap: 1.2rem; flex-wrap: wrap;
  border-bottom: 1.5px solid var(--line); margin-bottom: 1.2rem;
}
.tabs a {
  text-decoration: none; color: var(--ink-soft); font-size: .88rem; font-weight: 600;
  padding: .45rem .1rem; margin-bottom: -1.5px;
  border-bottom: 2.5px solid transparent;
}
.tabs a:hover { color: var(--ink); }
.tabs a.aktiv { color: var(--brand); font-weight: 800; border-bottom-color: var(--brand); }

/* ------------------------------------------------ Dropzone */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 1.6rem 1rem; text-align: center; cursor: pointer;
  color: var(--ink-soft);
}
.dropzone svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.8; margin-bottom: .3rem; }
.dropzone .haupt-zeile { font-weight: 700; color: var(--ink); font-size: .9rem; }
.dropzone .hinweis { font-size: .78rem; }
.dropzone:hover, .dropzone.drag {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 4%, var(--surface));
  color: var(--brand);
}
.dropzone input[type="file"] { display: none; }
.dropzone .datei-anzeige { font-family: var(--mono); font-size: .8rem; color: var(--brand-deep); margin-top: .4rem; }

/* ------------------------------------------------ Fortschrittsbalken */
.meter { height: 12px; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 99px; }
.meter-green > span { background: var(--green); }
.meter-amber > span { background: var(--amber); }
.meter-red   > span { background: var(--red); }

/* ------------------------------------------------ Dialoge */
.dw-dialog {
  border: none; border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(22,35,46,.28);
  padding: 1.4rem 1.5rem; max-width: 460px; width: calc(100% - 2rem);
}
.dw-dialog::backdrop { background: rgba(22,35,46,.45); }
.dw-dialog h3 { margin-top: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }

/* ------------------------------------------------ Login / öffentliche Seiten */
.auth-seite {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(600px 300px at 85% -5%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 70%),
    var(--paper);
}
.auth-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow);
  padding: 1.8rem 1.7rem; width: 100%; max-width: 400px;
}
.auth-marke { text-align: center; margin-bottom: 1.4rem; }
.auth-marke .marke { font-weight: 800; font-size: 1.25rem; letter-spacing: -.01em; color: var(--brand-deep); }
.auth-marke .zusatz { font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-soft); font-weight: 700; }
.code-input {
  font-family: var(--mono); font-size: 1.35rem; letter-spacing: .45em;
  text-align: center; text-indent: .45em;
}
.auth-links { text-align: center; font-size: .82rem; margin-top: 1rem; }

/* ------------------------------------------------ Diverses */
.verlauf { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.verlauf li { padding: .45rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .7rem; }
.verlauf li:last-child { border-bottom: none; }
.verlauf .zeit { color: var(--ink-soft); font-size: .76rem; white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: .1rem; }
.notiz { border-bottom: 1px solid var(--line); padding: .6rem 0; font-size: .87rem; }
.notiz:last-child { border-bottom: none; }
.notiz .meta { font-size: .74rem; color: var(--ink-soft); margin-top: .15rem; }
.def-liste { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; font-size: .88rem; margin: 0; }
.def-liste dt { color: var(--ink-soft); font-weight: 600; }
.def-liste dd { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.mono { font-family: var(--mono); }
.text-soft { color: var(--ink-soft); }
.text-klein { font-size: .8rem; }
.mb-0 { margin-bottom: 0; }

/* ------------------------------------------------ Responsiv */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto;
    flex-direction: row; align-items: center; flex-wrap: wrap; gap: .4rem;
    padding: .7rem 1rem;
  }
  .sidebar-logo { margin: 0 .8rem 0 0; padding: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav-label { display: none; }
  .sidebar-fuss { border: none; margin: 0; padding: 0; margin-left: auto; display: flex; align-items: center; gap: .7rem; }
  .sidebar-benutzer { padding: 0; }
  .sidebar-fuss form { margin: 0; }
  .topbar, .content { padding-left: 1rem; padding-right: 1rem; }
  .form-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .btn-outline, .nav a, .tabs a, .dropzone { transition: background .12s ease, color .12s ease, border-color .12s ease; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------ Rechtliches & QR */
.rechts-links { text-align: center; margin-top: 1rem; font-size: .78rem; }
.rechts-links a { color: var(--ink-soft); text-decoration: none; margin: 0 .5rem; }
.rechts-links a:hover { color: var(--brand); text-decoration: underline; }
.sidebar-rechtliches { margin-top: .7rem; padding: 0 .55rem; font-size: .7rem; }
.sidebar-rechtliches a { color: #7e9dc1; text-decoration: none; margin-right: .8rem; }
.sidebar-rechtliches a:hover { color: #fff; text-decoration: underline; }
.qr-rahmen { text-align: center; margin: .4rem 0 1rem; }
.qr-rahmen svg { max-width: 190px; height: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }

/* ---- Akkordeon-Navigation ---- */
.nav-gruppe { margin-top: .35rem; }
.nav-gruppe-kopf {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: 0; cursor: pointer;
  padding: .55rem .9rem .35rem; color: var(--nav-label, #7f9cbc);
  font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  font-family: inherit;
}
.nav-gruppe-kopf:hover { color: #fff; }
.nav-gruppe-kopf .pfeil {
  width: .5rem; height: .5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s ease; margin-right: .2rem;
}
.nav-gruppe.offen .nav-gruppe-kopf .pfeil { transform: rotate(45deg); }
.nav-gruppe-inhalt { display: none; }
.nav-gruppe.offen .nav-gruppe-inhalt { display: block; }
