/* ── CSS-Variablen & Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --imi-dark:   #05263d;
  --imi-navy:   #0b3c5d;
  --imi-teal:   #00bfae;
  --imi-teal-d: #00897b;
  --imi-bg:     #f8fafc;
  --imi-border: #d1dce6;
  --imi-muted:  #5a7080;
  --imi-light:  #e7f3fd;
}

/* ── Base & Layout ───────────────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--imi-bg);
  color: #333;
  line-height: 1.6;
  font-size: 15px;
}
.container {
  max-width: 1100px;
  margin: 30px auto;
  padding: 0 20px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  background: linear-gradient(90deg, var(--imi-dark) 0%, var(--imi-navy) 100%);
  padding: 15px 25px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.sitename {
  font-size: 24px;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.sitename img { height: 32px; width: auto; }

/* ── Navigation / Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb { margin-top: 8px; font-size: 12px; color: #cbd5e1; }
.breadcrumb a { color: #fff; text-decoration: none; }
.breadcrumb a:hover { color: var(--imi-teal); }

.back-link {
  display: inline-block;
  margin-bottom: 15px;
  text-decoration: none;
  color: var(--imi-navy);
  font-size: 14px;
  font-weight: 700;
}
.back-link:hover { color: var(--imi-teal-d); }

/* ── Intro-Box ───────────────────────────────────────────────────────────── */
.imi-intro {
  background: linear-gradient(90deg, var(--imi-light), #f4faff);
  border-left: 5px solid var(--imi-navy);
  padding: 24px 28px;
  border-radius: 4px;
  margin-bottom: 22px;
}
.imi-intro h2 { margin-bottom: 10px; color: var(--imi-navy); font-size: 20px; }
.imi-intro p  { font-size: 15px; color: #444; }

/* ── Content-Box ─────────────────────────────────────────────────────────── */
.content-box {
  background: #fff;
  border: 1px solid var(--imi-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,.05);
  margin-bottom: 22px;
}
.box-header {
  background: var(--imi-navy);
  color: #fff;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.box-body { padding: 24px 28px; }
/* GEÄNDERT v2.0: tight-variant für Timeline-Box (vorher inline style="padding:16px") */
.box-body--tight { padding: 16px; }

/* ── Formular-Elemente ───────────────────────────────────────────────────── */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--imi-muted);
  margin-bottom: 4px;
  margin-top: 14px;
}
/* GEÄNDERT v2.0: :first-of-type entfernt – funktioniert nicht zuverlässig
   in dynamisch generierten Cards. Stattdessen .no-top-margin-label via JS. */
.label-first { margin-top: 0; }

input[type="text"],
input[type="date"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--imi-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: #333;
  transition: border .2s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--imi-navy);
  /* GEÄNDERT v2.0: Fokus-Shadow ergänzt (WCAG 1.4.11 / 2.4.7) */
  box-shadow: 0 0 0 3px rgba(11,60,93,.12);
}
textarea { resize: vertical; min-height: 60px; }

/* GEÄNDERT v2.0: select-auto – ersetzt inline style="width:auto" */
.select-auto { width: auto; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all .2s;
  font-family: inherit;
  /* GEÄNDERT v2.0: min-height ergänzt (WCAG 2.5.5 – 44px Touch-Ziel) */
  min-height: 44px;
}
/* GEÄNDERT v2.0: :focus-visible ergänzt (WCAG 2.4.7) */
.btn:focus-visible { outline: 3px solid var(--imi-teal); outline-offset: 2px; }

.btn-primary { background: var(--imi-navy); color: #fff; }
.btn-primary:hover { background: #1565a0; }
.btn-accent  { background: var(--imi-teal); color: #fff; }
.btn-accent:hover  { background: var(--imi-teal-d); }
.btn-outline { background: #fff; color: var(--imi-navy); border: 2px solid var(--imi-navy); }
.btn-outline:hover { background: var(--imi-navy); color: #fff; }
.btn-danger  { background: #ef5350; color: #fff; }
.btn-danger:hover  { background: #c62828; }
/* GEÄNDERT v2.0: btn-sm min-height auf 32px gesetzt (akzeptabel für Icon-Aktionen) */
.btn-sm { padding: 6px 12px; font-size: 12px; min-height: 32px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ── Grid-Helpers ────────────────────────────────────────────────────────── */
.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
/* GEÄNDERT v2.0: .meta-full ersetzt inline style="grid-column:1/-1" */
.meta-full { grid-column: 1 / -1; }

/* ── Step Wizard ──────────────────────────────────────────────────────────── */
.steps-nav {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border: 1px solid var(--imi-border);
  border-radius: 8px;
  overflow: hidden;
}
.step-tab {
  flex: 1;
  padding: 12px 8px;
  background: #f0f4f8;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--imi-muted);
  font-family: inherit;
  text-align: center;
  border-right: 1px solid var(--imi-border);
  transition: all .2s;
  /* GEÄNDERT v2.0: min-height ergänzt (WCAG 2.5.5) */
  min-height: 44px;
}
.step-tab:last-child { border-right: none; }
.step-tab.active { background: var(--imi-navy); color: #fff; }
.step-tab.done   { background: var(--imi-light); color: var(--imi-navy); }
.step-tab:focus-visible { outline: 3px solid var(--imi-teal); outline-offset: -3px; }

.step-panel { display: none; }
.step-panel.active { display: block; }

/* ── Phase Cards ─────────────────────────────────────────────────────────── */
.phase-card {
  background: #f7fafd;
  border: 1px solid var(--imi-border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
}
.phase-num {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--imi-muted);
  text-transform: uppercase;
}
.phase-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.phase-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.phase-title-in { font-size: 15px; font-weight: 700; color: var(--imi-navy); }
.phase-grid   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.phase-grid-2 { display: grid; grid-template-columns: 1fr 1fr;     gap: 12px; }

/* GEÄNDERT v3.0: Dauer-Eingabe mit Einheiten-Toggle (Wochen / Tage) */
.dur-row { display: flex; gap: 6px; align-items: stretch; }
.dur-row input[type="number"] { flex: 1; min-width: 0; }
.dur-row select { flex-shrink: 0; width: auto; }
.dur-hint { font-size: 11px; color: var(--imi-teal-d); font-weight: 600; margin-top: 4px; min-height: 16px; }

/* ── Tags (Deliverables) ─────────────────────────────────────────────────── */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag {
  background: var(--imi-light);
  color: var(--imi-navy);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tag button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--imi-navy);
  font-size: 14px;
  line-height: 1;
  padding: 0;
  /* GEÄNDERT v2.0: min-height/width für Touch-Ziel (WCAG 2.5.5) */
  min-width: 20px;
  min-height: 20px;
}
.tag-input-row { display: flex; gap: 8px; margin-top: 6px; }
.tag-input-row input { flex: 1; }
/* GEÄNDERT v2.0: margin-top auf phase-card labels – ersetzt label:first-of-type */
.phase-card label { margin-top: 0; }

/* ── Timeline SVG ────────────────────────────────────────────────────────── */
#timelineWrap { overflow-x: auto; padding: 10px 0; }
svg#timeline { display: block; min-width: 700px; }

/* ── Risk Table ──────────────────────────────────────────────────────────── */
.risk-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.risk-table th {
  background: var(--imi-navy);
  color: #fff;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
}
.risk-table td { padding: 8px 12px; border-bottom: 1px solid #e8ecf0; vertical-align: top; }
.risk-table tr:last-child td { border-bottom: none; }
.risk-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.risk-low  { background: #c8e6c9; color: #1b5e20; }
.risk-med  { background: #fff9c4; color: #f57f17; }
.risk-high { background: #ffcdd2; color: #b71c1c; }

/* ── Risk Add Box ────────────────────────────────────────────────────────── */
/* GEÄNDERT v2.0: inline styles entfernt, Klassen verwendet */
.risk-add-box {
  background: #f7fafd;
  border: 1px solid var(--imi-border);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}
.risk-add-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--imi-navy);
  margin-bottom: 12px;
}
.risk-mit-row  { margin-top: 12px; }
.risk-phase-row { margin-top: 12px; }

/* ── JSON Output ─────────────────────────────────────────────────────────── */
.json-out {
  background: #1e2d3d;
  color: #7dd3fc;
  font-family: monospace;
  font-size: 12px;
  padding: 16px;
  border-radius: 6px;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre;
  line-height: 1.5;
}

/* ── Milestone List ──────────────────────────────────────────────────────── */
.milestone-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #e8ecf0;
}
.milestone-row:last-child { border-bottom: none; }
.ms-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ms-name { flex: 1; font-weight: 600; font-size: 14px; }
.ms-date { font-size: 12px; color: var(--imi-muted); }
.ms-phase {
  font-size: 11px;
  background: var(--imi-light);
  color: var(--imi-navy);
  border-radius: 10px;
  padding: 2px 8px;
  font-weight: 600;
}

/* ── Summary Stats ───────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--imi-border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.stat-num { font-size: 28px; font-weight: 700; color: var(--imi-navy); }
.stat-num--warn { color: #ef5350; }
.stat-num--ok   { color: var(--imi-teal-d); }
.stat-lbl { font-size: 12px; color: var(--imi-muted); font-weight: 600; text-transform: uppercase; margin-top: 4px; }

/* ── Deliverable tags in Preview ─────────────────────────────────────────── */
.del-preview-header {
  font-weight: 700;
  color: var(--imi-navy);
  font-size: 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.del-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.del-section { margin-bottom: 16px; }
.tag--doc { background: #f0f4f8; color: var(--imi-navy); }

/* ── Hint text ───────────────────────────────────────────────────────────── */
/* GEÄNDERT v2.0: inline style entfernt, Klasse genutzt */
.hint-text { font-size: 14px; color: var(--imi-muted); margin-top: 0; margin-bottom: 12px; }

/* ── Dep Matrix ──────────────────────────────────────────────────────────── */
.dep-select { width: 100%; }
.dep-entry  { margin-bottom: 14px; }
.dep-hint   { font-size: 11px; color: var(--imi-muted); margin-top: 3px; }

/* ── Progress / Spinner ──────────────────────────────────────────────────── */
#exportProgress {
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--imi-navy);
  font-weight: 600;
  margin-top: 10px;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid var(--imi-border);
  border-top-color: var(--imi-navy);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  font-size: 13px;
  color: #64748b;
  margin-top: 40px;
  padding-bottom: 30px;
}
footer a { color: var(--imi-navy); text-decoration: none; margin: 0 10px; }
footer a:hover { color: var(--imi-teal-d); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .meta-grid,
  .phase-grid,
  .phase-grid-2,
  .stat-grid { grid-template-columns: 1fr; }

  .steps-nav { flex-direction: column; }
  .step-tab { border-right: none; border-bottom: 1px solid var(--imi-border); }
  .step-tab:last-child { border-bottom: none; }

  .box-body { padding: 16px; }
  .risk-table { font-size: 11px; }
  .risk-table th, .risk-table td { padding: 6px 8px; }
}
