/* DIHAG Foundry Group Corporate Design:
   Azurblau #17509E · Navy #1A2644 · Anthrazit #424241 · Lichtblau #99B7CD · Orange #F08300
   Schrift: Exo (Regular/Bold) */
:root {
  --azur: #17509E;
  --navy: #1A2644;
  --anthrazit: #424241;
  --lichtblau: #99B7CD;
  --orange: #F08300;

  --primary: var(--azur);
  --primary-dark: var(--navy);
  --bg: #f3f6fa;
  --card: #ffffff;
  --text: var(--anthrazit);
  --muted: #6d7d8e;
  --border: #ccd9e6;
  --green: #1e7e34;
  --green-bg: #e6f4ea;
  --yellow: #9c5a00;
  --yellow-bg: #fdf1e0;
  --red: #b02a37;
  --red-bg: #fdecea;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Exo", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Header */
header { background: var(--navy); color: #fff; }
.header-inner {
  max-width: 1000px; margin: 0 auto; padding: 14px 20px;
  display: flex; justify-content: space-between; align-items: center;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 10px; background: #fff; color: var(--azur);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
}
.brand h1 { margin: 0; font-size: 22px; line-height: 1.1; }
.brand-sub { font-size: 12px; opacity: .85; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.btn-ghost {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.5);
  border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { background: rgba(255,255,255,.15); }

nav {
  max-width: 1000px; margin: 0 auto; padding: 0 20px;
  display: flex; gap: 4px; overflow-x: auto;
}
.nav-btn {
  background: transparent; border: none; color: rgba(255,255,255,.8);
  padding: 10px 16px; font-size: 14px; cursor: pointer;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.nav-btn.active { color: #fff; border-bottom-color: var(--orange); font-weight: 600; }
.nav-btn:hover { color: #fff; }
.badge-count {
  background: var(--orange); color: #fff; border-radius: 999px;
  padding: 1px 7px; font-size: 12px; margin-left: 4px;
}

/* Layout */
main { max-width: 1000px; margin: 24px auto; padding: 0 20px; }
.view { display: none; }
.view.active { display: block; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-bottom: 20px;
}
.card h2 { margin-top: 0; font-size: 19px; }
.hint { color: var(--muted); font-size: 14px; }

/* Formular */
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin: 18px 0;
}
.form-grid label { display: flex; flex-direction: column; font-size: 13px; font-weight: 600; gap: 5px; }
.form-grid .span2 { grid-column: span 2; }
input, select, textarea {
  font: inherit; font-weight: 400; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 14px 0; }
.checkline input { width: 16px; height: 16px; }

.btn-primary {
  background: var(--primary); color: #fff; border: none; border-radius: 7px;
  padding: 10px 22px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-small { padding: 6px 14px; font-size: 13px; margin-top: 8px; }

/* Bewertungs-Banner */
.banner { border-radius: 8px; padding: 12px 16px; margin: 10px 0; font-size: 14px; }
.banner ul { margin: 6px 0 0; padding-left: 20px; }
.banner-note { margin-top: 6px; font-size: 13px; opacity: .85; }
.banner-green { background: var(--green-bg); color: var(--green); border: 1px solid #bfe3c8; }
.banner-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid #f2cf9e; }
.banner-red { background: var(--red-bg); color: var(--red); border: 1px solid #f2c2c0; }

/* Vorgangs-Karten */
.item-list { display: flex; flex-direction: column; gap: 10px; }
.item-card {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px;
  cursor: pointer; transition: box-shadow .15s;
}
.item-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.item-line { font-size: 14px; margin: 2px 0; }
.muted { color: var(--muted); font-size: 13px; }
.redflag { color: var(--orange); font-weight: 600; font-size: 13px; }

.status { border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-green { background: var(--green-bg); color: var(--green); }
.st-yellow { background: var(--yellow-bg); color: var(--yellow); }
.st-red { background: var(--red-bg); color: var(--red); }
.st-gray { background: #eceff2; color: var(--muted); }

/* Filterleiste */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.filter-bar input[type="search"] { flex: 1 1 220px; min-width: 160px; }
.filter-bar select { flex: 0 0 auto; }
.btn-csv {
  margin-left: auto; background: var(--lichtblau); color: var(--navy); border: none;
  border-radius: 7px; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-csv:hover { background: #86a8c1; }
.table-scroll { overflow-x: auto; }
.row-click { cursor: pointer; }
.row-click:hover td { background: var(--bg); }

/* Auswertung */
.stat-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.stat-tile {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 18px; min-width: 110px; text-align: center;
}
.stat-num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--muted); }
.report-table { border-collapse: collapse; width: 100%; font-size: 14px; margin-bottom: 20px; }
.report-table th, .report-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.report-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

/* Einstellungen */
#einstellungenContent h3 {
  margin: 24px 0 10px; font-size: 15px; color: var(--navy);
  border-bottom: 2px solid var(--lichtblau); padding-bottom: 4px;
}
.rollen-table { border-collapse: collapse; width: 100%; font-size: 14px; margin-bottom: 10px; }
.rollen-table th, .rollen-table td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top;
}
.rollen-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.rollen-table td:first-child { font-weight: 600; white-space: nowrap; }
.settings-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin: 10px 0;
}
.settings-grid label { display: flex; flex-direction: column; font-size: 13px; font-weight: 600; gap: 5px; }
.settings-grid .span2 { grid-column: span 2; }
.settings-fs {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; margin: 12px 0;
}
.settings-fs legend { font-weight: 700; color: var(--azur); padding: 0 6px; }
#btnSaveSettings { margin-top: 18px; }

/* Hilfe */
.help { max-width: 760px; line-height: 1.55; }
.help h3 { margin: 22px 0 8px; font-size: 16px; color: var(--navy);
  border-bottom: 2px solid var(--lichtblau); padding-bottom: 4px; }
.help p { margin: 8px 0; }
.help ol, .help ul { margin: 8px 0; padding-left: 22px; }
.help li { margin: 5px 0; }
.help a { color: var(--azur); }
.ampel { list-style: none; padding-left: 0; }
.ampel li { display: flex; align-items: flex-start; gap: 9px; }
.dot { flex: 0 0 auto; width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; }
.dot-green { background: var(--green); }
.dot-yellow { background: var(--orange); }
.dot-red { background: var(--red); }

/* Modal */
.modal {
  position: fixed; inset: 0; background: rgba(20,30,40,.5);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
}
.modal[hidden] { display: none; }
.modal-content {
  background: #fff; border-radius: var(--radius); padding: 24px;
  max-width: 640px; width: 100%; max-height: 85vh; overflow-y: auto; position: relative;
}
.modal-close {
  position: absolute; top: 10px; right: 14px; background: none; border: none;
  font-size: 26px; color: var(--muted); cursor: pointer;
}
.detail-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.detail-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.detail-table .dt { color: var(--muted); width: 220px; }
.anlagen-box { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.anlagen-box strong { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.anlagen-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.anlagen-list a {
  color: var(--azur); text-decoration: none; font-size: 14px;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg);
}
.anlagen-list a:hover { border-color: var(--azur); }
#modalActions { margin-top: 16px; }
.input-error { border-color: var(--red) !important; outline: 2px solid var(--red); }
#modalActions textarea { width: 100%; margin-bottom: 10px; }
.modal-btns { display: flex; gap: 10px; }
.btn-approve {
  background: var(--green); color: #fff; border: none; border-radius: 7px;
  padding: 9px 20px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-reject {
  background: var(--red); color: #fff; border: none; border-radius: 7px;
  padding: 9px 20px; font-size: 14px; font-weight: 600; cursor: pointer;
}

/* Ladebildschirm & Toast */
#loadingScreen {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  z-index: 200;
}
#loadingScreen[hidden] { display: none; }
.spinner {
  width: 40px; height: 40px; border: 4px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; border-radius: 8px; padding: 12px 20px;
  font-size: 14px; max-width: 90vw; z-index: 300; box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
#toast[hidden] { display: none; }

@media (max-width: 640px) {
  .form-grid, .settings-grid { grid-template-columns: 1fr; }
  .form-grid .span2, .settings-grid .span2 { grid-column: span 1; }
}
