/* ============================================================
   MILO COCKPIT – Design-System v2
   Abstands-Skala: 4 / 8 / 12 / 16 / 24 / 32 / 48
   ============================================================ */
:root {
  --sidebar-bg: #131f38;
  --sidebar-bg2: #0e1830;
  --sidebar-text: #aab6c9;
  --bg: #f2f4f7;
  --card: #ffffff;
  --border: #e3e7ee;
  --border-stark: #d3d9e3;
  --text: #1a2233;
  --muted: #67718a;
  --accent: #1b2c52;
  --accent-hover: #263c6e;
  --orange: #fca311;
  --orange-hover: #e5940e;
  --green: #1f8a4c;
  --green-bg: #e4f4ea;
  --red: #cc3d3d;
  --red-bg: #fbebeb;
  --gelb-bg: #fff4dd;
  --gelb-text: #9a6b00;
  --radius: 12px;
  --radius-klein: 8px;
  --schatten: 0 1px 2px rgba(16, 24, 40, 0.05);
  --schatten-hover: 0 4px 14px rgba(16, 24, 40, 0.09);
  --fokus: 0 0 0 3px rgba(27, 44, 82, 0.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px;
  line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
::selection { background: rgba(252, 163, 17, 0.3); }

/* ---------------------------------------------------------- Layout */
.layout { display: flex; min-height: 100vh; }
.content {
  flex: 1; padding: 36px 44px 96px; max-width: 1240px; min-width: 0;
}
@media (max-width: 900px) { .content { padding: 20px 16px 64px; } }

/* ---------------------------------------------------------- Sidebar */
.sidebar {
  width: 236px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
  color: var(--sidebar-text); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .logo {
  padding: 26px 22px 20px; font-weight: 800; font-size: 17px; color: #fff;
  letter-spacing: 0.5px; border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar .logo span { color: var(--orange); }
.sidebar nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 1px 0;
  color: var(--sidebar-text); text-decoration: none;
  font-size: 14px; font-weight: 500;
  border-radius: 8px; transition: background 0.14s ease, color 0.14s ease;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.sidebar nav a.aktiv {
  background: var(--orange); color: #14213d; font-weight: 700;
}
.sidebar nav .gruppe {
  padding: 20px 12px 6px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 1.4px; color: #5d6a82; font-weight: 700;
}
.sidebar .userbox {
  padding: 14px 22px; border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 13px; display: flex; justify-content: space-between; align-items: center;
}
.sidebar .userbox a { color: #5d6a82; text-decoration: none; }
.sidebar .userbox a:hover { color: #fff; }
.sidebar .userbox .name { color: #fff; font-weight: 600; }

/* ---------------------------------------------------------- Seitenkopf */
.seitenkopf { margin-bottom: 32px; }
.seitenkopf h1 {
  margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -0.3px;
}
.seitenkopf .untertitel { color: var(--muted); font-size: 14.5px; }
.seitenkopf .kopfzeile {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; flex-wrap: wrap;
}
.seitenkopf .kopfzeile > div:last-child { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------- Abschnitte & Karten */
.abschnitt { margin-bottom: 36px; }
.abschnitt > h2 {
  font-size: 12.5px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted); margin: 0 0 12px; font-weight: 700;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.karte {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--schatten);
}

/* ---------------------------------------------------------- 12-Spalten-Raster */
.raster { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px 20px; }
.s2 { grid-column: span 2; } .s3 { grid-column: span 3; }
.s4 { grid-column: span 4; } .s6 { grid-column: span 6; }
.s8 { grid-column: span 8; } .s12 { grid-column: span 12; }
@media (max-width: 900px) {
  .s2, .s3, .s4 { grid-column: span 6; }
  .s6, .s8 { grid-column: span 12; }
}

/* ---------------------------------------------------------- Formulare */
label {
  display: block; font-size: 12px; font-weight: 700; color: var(--muted);
  margin-bottom: 6px; letter-spacing: 0.2px; text-transform: uppercase;
}
.raster > div > label + * { margin-top: 0; }
input[type=text], input[type=number], input[type=password],
input[type=file], textarea, select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-stark); border-radius: var(--radius-klein);
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
input[type=file] { padding: 8px 10px; font-size: 13.5px; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--fokus);
}
input::placeholder, textarea::placeholder { color: #a6aec0; }
input:disabled { background: #f2f4f7; color: var(--muted); }
.feldhinweis { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.feldhinweis strong { color: var(--text); }

/* ---------------------------------------------------------- Knöpfe */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; min-height: 40px;
  border-radius: var(--radius-klein); border: none;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 14px;
  font-family: inherit; cursor: pointer; text-decoration: none;
  white-space: nowrap; line-height: 1;
  transition: background 0.14s ease, transform 0.08s ease, box-shadow 0.14s ease;
}
.btn:hover { background: var(--accent-hover); color: #fff; box-shadow: var(--schatten-hover); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--fokus); }
.btn.orange { background: var(--orange); color: #14213d; }
.btn.orange:hover { background: var(--orange-hover); color: #14213d; }
.btn.klein { padding: 7px 13px; min-height: 32px; font-size: 13px; }
.btn.hell { background: #edf0f5; color: var(--text); }
.btn.hell:hover { background: #e2e6ee; box-shadow: none; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
/* Triage-Farben: Heute rot, Diese Woche gelb, Kenntnisnahme lila, Erledigt grün */
.btn.rot { background: #cc3d3d; color: #fff; }
.btn.rot:hover { background: #b83232; }
.btn.gelb { background: #f2c200; color: #3d3200; }
.btn.gelb:hover { background: #ddb100; }
.btn.lila { background: #7c3aed; color: #fff; }
.btn.lila:hover { background: #6d2fd6; }
.btn.gruen { background: var(--green); color: #fff; }
.btn.gruen:hover { background: #1a7440; }
/* Mail-Listenzeilen: Label + Betreff oben, Aktionen rechts, Vorschau aufklappbar */
.mailkopf { display: flex; align-items: center; gap: 14px; }
.mailkopf .badge { flex-shrink: 0; }
.mailbetreff {
  flex: 1; min-width: 0; font-size: 15px; font-weight: 700;
  color: var(--text); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mailbetreff:hover { color: var(--accent); text-decoration: underline; }
.mailaktionen { display: flex; gap: 8px; flex-shrink: 0; margin-left: auto; }
.mailaktionen .aktionsspalte { width: 128px; min-width: 128px; justify-content: center; }
.mailvorschau { margin: 8px 0 0 2px; }
.mailvorschau summary {
  cursor: pointer; font-size: 12.5px; color: var(--muted); font-weight: 600;
  list-style-position: inside;
}
.mailvorschau summary:hover { color: var(--text); }
.mailvorschau .mailsnippet {
  margin-top: 8px; padding: 12px 14px; background: #f7f9fc;
  border: 1px solid var(--border); border-radius: var(--radius-klein);
  font-size: 13.5px; color: var(--text); line-height: 1.6;
}
@media (max-width: 1100px) {
  .mailkopf { flex-wrap: wrap; }
  .mailbetreff { min-width: 100%; order: -1; white-space: normal; }
}

/* Triage-Knopfleiste: vier gleich große Knöpfe, ordentlich Luft */
.triage-knoepfe {
  display: flex; gap: 12px; margin: 24px 0 8px; flex-wrap: wrap;
}
.triage-knoepfe .btn {
  flex: 1 1 0; min-width: 150px; min-height: 46px; font-size: 14.5px;
}
.antwort-bereich {
  border-top: 1px solid var(--border); margin-top: 24px; padding-top: 20px;
}
.antwort-bereich .btn { min-height: 42px; }
.badge.rot { background: var(--red-bg); color: var(--red); }
.badge.gelb { background: #fdf3cc; color: #8a6d00; }
.badge.lila { background: #f0e8fd; color: #6d2fd6; }

/* ---------------------------------------------------------- Aufgaben-/Listenzeilen */
.taskliste { display: flex; flex-direction: column; gap: 10px; }
.taskzeile .badge.bereich {
  min-width: 104px; text-align: center; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.taskzeile {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
  box-shadow: var(--schatten);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.taskzeile:hover { border-color: var(--border-stark); box-shadow: var(--schatten-hover); }
.taskzeile.erledigt { opacity: 0.55; }
.taskzeile.erledigt:hover { box-shadow: var(--schatten); }
.taskzeile .titel { flex: 1; font-weight: 600; min-width: 200px; }
.taskzeile .titel a { color: var(--text); text-decoration: none; }
.taskzeile .titel a:hover { color: var(--accent); text-decoration: underline; }
.taskzeile .meta { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.taskzeile form { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* ---------------------------------------------------------- Badges */
.badge {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
  line-height: 1.3;
}
.badge.offen { background: var(--gelb-bg); color: var(--gelb-text); }
.badge.erledigt { background: var(--green-bg); color: var(--green); }
.badge.nichts { background: #edf0f5; color: var(--muted); }
.badge.bereich { background: #e8edf7; color: var(--accent); }

/* ---------------------------------------------------------- Fortschritt */
.fortschritt {
  height: 8px; background: #e2e6ee; border-radius: 6px; overflow: hidden;
}
.fortschritt > div {
  height: 100%; background: linear-gradient(90deg, var(--green), #2eb567);
  border-radius: 6px; transition: width 0.4s ease;
}

/* ---------------------------------------------------------- Kennzahl-Kacheln */
.kachel { display: flex; flex-direction: column; gap: 4px; }
.kachel .wert {
  font-size: clamp(17px, 1.55vw, 26px); font-weight: 800; letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap;
}
.kachel .label {
  font-size: 11.5px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
}
.kachel .zusatz { font-size: 12.5px; color: var(--muted); }
.kachel .wert.gruen { color: var(--green); }
.kachel .wert.rot { color: var(--red); }

/* ---------------------------------------------------------- Tabellen */
table.daten { width: 100%; border-collapse: collapse; font-size: 14px; }
table.daten th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--border);
  font-weight: 700; white-space: nowrap;
}
table.daten td {
  padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top;
}
table.daten tr:last-child td { border-bottom: none; }
table.daten tbody tr, table.daten tr { transition: background 0.1s ease; }
table.daten tr:hover td { background: #f7f9fc; }
table.daten td.zahl, table.daten th.zahl {
  text-align: right; font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------- Meldungen */
.flash {
  background: var(--green-bg); color: var(--green); border: 1px solid #bfe3cd;
  padding: 12px 18px; border-radius: var(--radius-klein);
  margin-bottom: 24px; font-weight: 600; font-size: 14px;
}
.hinweis {
  background: var(--gelb-bg); border: 1px solid #f0dcae; color: var(--gelb-text);
  padding: 14px 18px; border-radius: var(--radius-klein);
  font-size: 14px; line-height: 1.6;
}
.hinweis a { color: inherit; font-weight: 600; }

/* ---------------------------------------------------------- Login */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
}
.login-box {
  background: #fff; border-radius: 16px; padding: 40px; width: 380px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
}
.login-box h1 { margin: 0 0 4px; font-size: 23px; letter-spacing: -0.3px; }
.login-box h1 span { color: var(--orange); }
.login-box .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 26px; }
.login-box .feld { margin-bottom: 16px; }
.login-box .btn { width: 100%; margin-top: 8px; min-height: 44px; font-size: 15px; }
.login-fehler {
  background: var(--red-bg); color: var(--red); padding: 11px 14px;
  border-radius: var(--radius-klein); font-size: 13.5px; margin-bottom: 16px;
}

/* ---------------------------------------------------------- Feinheiten */
iframe { display: block; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c9d0dc; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #aeb8c8; }
::-webkit-scrollbar-track { background: transparent; }
