/* =====================================================================
   Kredithelden Kundenportal – Design-System
   Mobil-first, WCAG 2.1 AA (Kontrast, Fokus, Touch-Targets >= 44px).
   Markenfarben als CSS-Variablen -> exakte Brand-Hex einfach austauschbar.
   ===================================================================== */

:root {
  /* Markenfarben – abgestimmt auf neu.kredithelden.de */
  --kh-blue:        #008EAD;
  --kh-blue-dark:   #006F8F;
  --kh-blue-light:  #E4F5FA;
  --kh-green:       #1E9E62;
  --kh-green-dark:  #157a4b;
  --kh-gold:        #F5A623;
  --kh-gold-dark:   #C7861A;

  --kh-ink:         #0A1E2C;
  --kh-body:        #2E4250;
  --kh-muted:       #6E7E86;
  --kh-line:        #D8EEF3;
  --kh-bg:          #F5FBFC;
  --kh-card:        #ffffff;

  --kh-danger:      #C0392B;
  --kh-danger-bg:   #fdecea;
  --kh-success:     #1E9E62;
  --kh-success-bg:  #e4f6ec;
  --kh-warn:        #9a6700;
  --kh-warn-bg:     #fdf3da;

  --radius: 16px;
  --shadow: 0 1px 3px rgba(11,31,42,.06), 0 8px 24px rgba(11,31,42,.09);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 17px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--kh-ink);
  background: var(--kh-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4 { line-height: 1.25; color: var(--kh-ink); margin: 0 0 .5em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
a { color: var(--kh-blue); }

/* Sichtbarer Fokus (Tastaturbedienung) */
:focus-visible { outline: 2px solid var(--kh-blue); outline-offset: 2px; border-radius: 6px; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--kh-ink); color: #fff;
  padding: .6rem 1rem; z-index: 200;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 1rem; }
.container--narrow { max-width: 560px; }
.main { padding: 1.5rem 0 4rem; }

.site-header {
  background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--kh-line); position: sticky; top: 0; z-index: 50;
}
.site-header__inner { display: flex; align-items: center; gap: 1rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; color: var(--kh-blue); text-decoration: none; font-size: 1.15rem; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--kh-blue), var(--kh-green));
  display: grid; place-items: center; color: #fff; font-weight: 800;
}
.brand small { display:block; font-weight:600; font-size:.62rem; letter-spacing:.06em; color: var(--kh-muted); text-transform: uppercase; }

.nav { margin-left: auto; display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .8rem;
  color: var(--kh-ink); text-decoration: none; border-radius: 9px; font-weight: 600; font-size: .95rem;
}
.nav a:hover { background: var(--kh-blue-light); }
.nav a.is-active { background: var(--kh-blue-light); color: var(--kh-blue-dark); }
.nav__badge { background: var(--kh-green); color:#fff; border-radius: 999px; padding:.05rem .45rem; font-size:.72rem; margin-left:.35rem; }

.nav-toggle { display:none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: 0 1.4rem; border-radius: 999px; border: 2px solid transparent;
  font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none; letter-spacing: .01em;
  transition: background .18s, border-color .18s, box-shadow .18s, transform .05s; background: var(--kh-blue); color:#fff;
}
.btn:hover { background: var(--kh-blue-dark); }
.btn:active { transform: translateY(1px); }
.btn--block { width: 100%; }
.btn--green { background: var(--kh-green); } .btn--green:hover { background: var(--kh-green-dark); }
.btn--accent { background: var(--kh-gold); color: #1a1006; box-shadow: 0 4px 14px -4px rgba(245,166,35,.45); } .btn--accent:hover { background: var(--kh-gold-dark); color: #fff; box-shadow: 0 6px 18px -4px rgba(199,134,26,.5); }
.btn--ghost { background: #fff; color: var(--kh-blue); border-color: var(--kh-line); }
.btn--ghost:hover { background: var(--kh-blue-light); border-color: var(--kh-blue); }
.btn--danger { background: var(--kh-danger); } .btn--danger:hover { filter: brightness(.92); }
.btn--sm { min-height: 38px; padding: 0 .85rem; font-size: .9rem; }

/* ---------- Cards ---------- */
.card { background: var(--kh-card); border: 1px solid var(--kh-line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; }
.card__title { display:flex; align-items:center; gap:.5rem; justify-content: space-between; margin-bottom: .85rem; }
.card--accent { border-top: 4px solid var(--kh-blue); }
.grid { display: grid; gap: 1.25rem; }
@media (min-width: 760px) { .grid--2 { grid-template-columns: 1fr 1fr; } .grid--3 { grid-template-columns: repeat(3,1fr);} .grid--side { grid-template-columns: 1fr 320px; align-items:start; } }

.stat { text-align:center; }
.stat__num { font-size: 2rem; font-weight: 800; color: var(--kh-blue); }
.stat__label { color: var(--kh-muted); font-size:.9rem; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1rem; }
.field label { display:block; font-weight: 700; margin-bottom: .35rem; }
.field .hint { color: var(--kh-muted); font-size: .85rem; margin-top: .25rem; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: .6rem .9rem; font-size: 1rem; font-family: inherit;
  border: 1.5px solid var(--kh-line); border-radius: 12px; background:#fff; color: var(--kh-ink);
}
.textarea { min-height: 120px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--kh-blue); outline: none; box-shadow: 0 0 0 4px rgba(0,142,173,.12); }
.row { display:grid; gap: 1rem; }
@media (min-width:640px){ .row--2 { grid-template-columns:1fr 1fr; } .row--3 { grid-template-columns:1fr 1fr 1fr; } }
.check { display:flex; gap:.6rem; align-items:flex-start; padding:.6rem; border:1px solid var(--kh-line); border-radius:10px; }
.check input { width:24px; height:24px; margin-top:.15rem; flex:none; }

/* ---------- Alerts / Flash ---------- */
.alert { padding: .9rem 1rem; border-radius: 10px; margin-bottom: 1rem; border:1px solid transparent; font-weight:600; }
.alert--success { background: var(--kh-success-bg); color: var(--kh-green-dark); border-color:#bce6cd; }
.alert--error { background: var(--kh-danger-bg); color: var(--kh-danger); border-color:#f3c0ba; }
.alert--info { background: var(--kh-blue-light); color: var(--kh-blue-dark); border-color:#c5dcf5; }
.alert--warn { background: var(--kh-warn-bg); color: var(--kh-warn); border-color:#f0dca6; }

/* ---------- Badges & Status ---------- */
.badge { display:inline-flex; align-items:center; gap:.35rem; padding:.2rem .6rem; border-radius:999px; font-size:.8rem; font-weight:700; }
.badge--neu { background:#eef1f6; color:#48566a; }
.badge--in_bearbeitung { background: var(--kh-blue-light); color: var(--kh-blue-dark); }
.badge--angebot_vorhanden { background: var(--kh-warn-bg); color: var(--kh-warn); }
.badge--abgeschlossen { background: var(--kh-success-bg); color: var(--kh-green-dark); }
.badge--abgelehnt { background: var(--kh-danger-bg); color: var(--kh-danger); }

/* Stufen-/Fortschrittsanzeige */
.steps { display:flex; gap:.4rem; margin: .75rem 0; }
.steps__item { flex:1; text-align:center; }
.steps__dot { height:10px; border-radius:999px; background:var(--kh-line); }
.steps__dot.is-done { background: var(--kh-green); }
.steps__dot.is-current { background: var(--kh-blue); }
.steps__label { font-size:.72rem; color:var(--kh-muted); margin-top:.3rem; display:block; }
.progress { height: 14px; background: var(--kh-line); border-radius:999px; overflow:hidden; }
.progress__bar { height:100%; background: linear-gradient(90deg, var(--kh-blue), var(--kh-green)); }

/* ---------- Tables ---------- */
.table { width:100%; border-collapse: collapse; }
.table th, .table td { text-align:left; padding:.7rem .6rem; border-bottom:1px solid var(--kh-line); }
.table th { font-size:.8rem; text-transform:uppercase; letter-spacing:.04em; color:var(--kh-muted); }
.table tr:hover { background: var(--kh-bg); }
.table--wrap { overflow-x:auto; }

/* ---------- Messages thread ---------- */
.thread { display:flex; flex-direction:column; gap:.7rem; }
.msg { max-width: 80%; padding:.7rem .9rem; border-radius: 14px; }
.msg--in { align-self:flex-start; background:#eef2f7; border-bottom-left-radius:4px; }
.msg--out { align-self:flex-end; background: var(--kh-blue-light); border-bottom-right-radius:4px; }
.msg__meta { font-size:.72rem; color:var(--kh-muted); margin-top:.3rem; }

/* ---------- Signature pad ---------- */
.sigpad { border:2px dashed var(--kh-blue); border-radius:12px; background:#fff; touch-action:none; width:100%; height:200px; display:block; }
.sigpad-wrap { position:relative; }
.sigpad-clear { position:absolute; top:8px; right:8px; }

/* ---------- Upload progress ---------- */
.upload-progress { display:none; margin-top:1rem; }
.upload-progress.is-active { display:block; }
.upload-progress__bar-wrap {
  background: var(--kh-line); border-radius:999px; height:14px; overflow:hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.1);
}
.upload-progress__bar {
  height:100%; width:0%; background: linear-gradient(90deg, var(--kh-blue), var(--kh-green));
  border-radius:999px; transition: width .15s ease;
}
.upload-progress__label {
  margin-top:.4rem; font-size:.82rem; color: var(--kh-muted); display:flex; justify-content:space-between;
}
.upload-progress__label strong { color: var(--kh-ink); }

/* ---------- Misc ---------- */
.muted { color: var(--kh-muted); }
.small { font-size: .85rem; }
.list-reset { list-style:none; padding:0; margin:0; }
.dl { display:grid; grid-template-columns: minmax(120px,40%) 1fr; gap:.3rem .8rem; }
.dl dt { color: var(--kh-muted); }
.dl dd { margin:0; font-weight:600; }
.divider { height:1px; background:var(--kh-line); margin:1rem 0; border:0; }
.tag-row { display:flex; flex-wrap:wrap; gap:.4rem; }
.center { text-align:center; }
.mt0{margin-top:0}.mb0{margin-bottom:0}.mt1{margin-top:1rem}.mb1{margin-bottom:1rem}

.site-footer { border-top:1px solid var(--kh-line); background:#fff; padding:1.5rem 0; color:var(--kh-muted); font-size:.9rem; }
.site-footer a { color: var(--kh-muted); margin-right:1rem; }

/* ---------- Legal Modal ---------- */
.legal-backdrop {
  position: fixed; inset: 0; background: rgba(10,30,44,.55);
  z-index: 300; display: flex; align-items: center; justify-content: center;
  padding: 1rem; opacity: 0; visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
}
.legal-backdrop.is-open { opacity: 1; visibility: visible; }
.legal-modal {
  background: #fff; border-radius: 18px; width: 100%; max-width: 820px;
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 64px -16px rgba(10,30,44,.38);
  transform: translateY(14px); transition: transform .22s ease;
}
.legal-backdrop.is-open .legal-modal { transform: translateY(0); }
.legal-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.2rem; border-bottom: 1px solid var(--kh-line); flex-shrink: 0;
}
.legal-modal__title { font-weight: 700; font-size: 1rem; margin: 0; color: var(--kh-ink); }
.legal-modal__close {
  width: 36px; height: 36px; border-radius: 9px; border: 1.5px solid var(--kh-line);
  background: #fff; cursor: pointer; display: grid; place-items: center;
  font-size: 1rem; line-height: 1; color: var(--kh-muted);
  transition: background .15s, border-color .15s;
}
.legal-modal__close:hover { background: var(--kh-bg); border-color: var(--kh-blue); color: var(--kh-ink); }
.legal-modal__body {
  flex: 1; overflow-y: auto; padding: 1.25rem 1.5rem; min-height: 0;
  line-height: 1.65; font-size: .95rem; color: var(--kh-body, var(--kh-ink));
}
.legal-modal__body h3 { font-size: 1rem; margin: 1.25rem 0 .4rem; color: var(--kh-ink); }
.legal-modal__body h3:first-child { margin-top: 0; }
.legal-modal__body ul { padding-left: 1.25rem; margin: .4rem 0 .8rem; }
.legal-modal__body li { margin-bottom: .25rem; }
.legal-modal__body hr { border: 0; border-top: 1px solid var(--kh-line); margin: 1.25rem 0; }
.legal-modal__body a { color: var(--kh-blue); }

.hero { background: linear-gradient(135deg, var(--kh-blue) 0%, var(--kh-blue-dark) 100%); color:#fff; border-radius: 20px; padding: 2rem 1.75rem; margin-bottom:1.5rem; box-shadow: 0 8px 30px -8px rgba(0,111,143,.35); }
.hero h1 { color:#fff; letter-spacing: -.02em; }
.hero p { color: rgba(255,255,255,.88); margin-bottom:0; }

/* Mobile-Navigation */
@media (max-width: 720px) {
  .nav-toggle { display:inline-flex; margin-left:auto; min-height:44px; min-width:44px; align-items:center; justify-content:center; border:1px solid var(--kh-line); border-radius:10px; background:#fff; font-size:1.4rem; }
  .nav { display:none; width:100%; order:3; flex-direction:column; align-items:stretch; padding-bottom:.75rem; }
  .nav.is-open { display:flex; }
  .nav a { min-height:48px; }
  .site-header__inner { flex-wrap:wrap; }
}
