/* ============================================================================
 * DRK Fortbildungsportal – zentrales Design (ui.css)
 * Aufsetzend auf das QM-/ASB-Layout, aber in DRK-Rot; kein Gelb. Dark-Mode-fähig.
 * Icons kommen als Inline-SVG über ic() – KEINE Emojis.
 * ========================================================================== */

:root{
  --red:#E30613; --red-dark:#B3040F; --red-weich:#FEE2E2;
  --text:#23272E; --muted:#6B7280;
  --border:#E6E8EC; --bg:#F4F5F7; --white:#ffffff;
  --ok-bg:#E7F6EC; --ok-fg:#15803D;
  --mut-bg:#EEF0F3; --mut-fg:#6B7280;
  --radius:10px;
  --header-h:58px; --nav-w:236px;
}
html.dark{
  --text:#E5E7EB; --muted:#94A3B8;
  --border:#2A2F3A; --bg:#0F131A; --white:#161B22;
  --red-weich:rgba(227,6,19,.16);
  --ok-bg:rgba(22,163,74,.16); --ok-fg:#86EFAC;
  --mut-bg:rgba(148,163,184,.14); --mut-fg:#94A3B8;
}

*{box-sizing:border-box}
html,body{margin:0}
body{
  font-family:"Noto Sans",-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg); color:var(--text); font-size:15px; line-height:1.5;
}
a{color:inherit}
.picto{flex:0 0 auto}

/* ── Kopfleiste (roter Streifen) ── */
.app-header{position:sticky;top:0;z-index:40;background:var(--red);height:var(--header-h);
  display:flex;align-items:center;padding:0 1.1rem;}
.header-inner{display:flex;align-items:center;gap:1rem;width:100%}
.brand{display:flex;align-items:center;gap:.8rem;text-decoration:none}
.logobox{background:#fff;border-radius:10px;padding:.28rem .5rem;display:flex;align-items:center}
.logobox img{height:30px;width:auto;display:block}
.brand .titles{display:flex;flex-direction:column;line-height:1.15;color:#fff}
.brand .t1{font-weight:800;font-size:1.02rem;letter-spacing:.01em}
.brand .t2{font-size:.7rem;font-weight:600;color:rgba(255,255,255,.85)}
.header-spacer{margin-left:auto}
.hamburger{display:none;background:rgba(255,255,255,.15);border:1px solid rgba(255,255,255,.3);
  color:#fff;width:36px;height:36px;border-radius:9px;cursor:pointer;font-size:1.1rem;align-items:center;justify-content:center}
.dm-toggle{background:rgba(255,255,255,.15);border:1px solid rgba(255,255,255,.3);color:#fff;
  width:36px;height:36px;border-radius:9px;font-size:1.05rem;cursor:pointer;display:flex;align-items:center;justify-content:center}
/* Einlog-Kachel: weiß mit schwarzem Rand */
.profile{position:relative;display:flex;align-items:center;gap:.55rem;background:#fff;border:2px solid #111;
  border-radius:11px;padding:.28rem .7rem .28rem .38rem;font-weight:700;font-size:.86rem;color:#23272E;cursor:pointer}
.profile .av{width:27px;height:27px;border-radius:50%;background:var(--red);color:#fff;
  display:flex;align-items:center;justify-content:center;font-size:.72rem;font-weight:800}
.profile .chev{color:#6B7280;font-size:.8rem}
.profile-menu{position:absolute;top:calc(100% + 8px);right:0;min-width:180px;background:var(--white);
  border:1px solid var(--border);border-radius:12px;box-shadow:0 12px 30px rgba(0,0,0,.18);padding:.35rem;display:none;z-index:60}
.profile-menu.open{display:block}
.profile-menu a{display:flex;align-items:center;gap:.55rem;padding:.55rem .7rem;border-radius:8px;
  text-decoration:none;color:var(--text);font-size:.88rem;font-weight:600}
.profile-menu a:hover{background:var(--bg)}
.profile-menu a.danger{color:var(--red)}

/* ── Layout: Sidebar + Inhalt ── */
.app-layout{display:flex;min-height:calc(100vh - var(--header-h))}
.app-side{width:var(--nav-w);flex:0 0 auto;background:var(--white);border-right:1px solid var(--border);
  padding:.9rem .7rem;position:sticky;top:var(--header-h);align-self:flex-start;
  height:calc(100vh - var(--header-h));overflow-y:auto;display:flex;flex-direction:column}
.nav-foot{margin-top:auto;padding:.9rem .5rem .2rem;display:flex;gap:.45rem;flex-wrap:wrap;font-size:.72rem;
  border-top:1px solid var(--border)}
.nav-foot a{color:var(--muted);text-decoration:none;font-weight:600}
.nav-foot a:hover{color:var(--red)}
.nav-foot span{color:var(--muted)}
.nav-sec{font-size:.66rem;font-weight:800;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);
  padding:.35rem .75rem;margin-top:.7rem}
.nav-sec:first-child{margin-top:0}
.nav-item{display:flex;align-items:center;gap:.7rem;padding:.6rem .8rem;border-radius:var(--radius);
  color:var(--text);font-weight:600;font-size:.93rem;text-decoration:none;margin-bottom:.12rem}
.nav-item .picto{font-size:1.2rem}
.nav-item:hover{background:var(--bg)}
.nav-item.active{background:var(--red);color:#fff;box-shadow:0 2px 7px rgba(227,6,19,.35)}
.rot90{transform:rotate(90deg)}
.nav-overlay{display:none;position:fixed;inset:var(--header-h) 0 0 0;background:rgba(0,0,0,.4);z-index:30}
.nav-overlay.open{display:block}

.app-main{flex:1;min-width:0;padding:1.3rem 1.6rem}

/* Desktop: Hauptseiten-Sidebar einklappbar (Hamburger auch am Desktop; Standard eingeklappt) */
@media (min-width:821px){
  .hamburger{display:flex}
  html.nav-collapsed .app-side{display:none}
}

/* ── Seitenkopf: Zurück + Überschrift in EINER Zeile, volle Breite ── */
.mb-head{display:flex;align-items:center;justify-content:space-between;gap:.7rem 1rem;flex-wrap:wrap;margin-bottom:1.1rem}
.mb-head-l{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap}
.mb-head-r{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}
.mb-h1{font-size:1.4rem;font-weight:800;display:flex;align-items:center;gap:.5rem;margin:0}
.mb-h1 .picto{color:var(--red);font-size:1.2rem}
.mb-back{display:inline-flex;align-items:center;gap:.35rem;border:1px solid var(--border);background:var(--white);
  color:var(--muted);border-radius:10px;padding:.42rem .7rem;font-size:.85rem;font-weight:700;text-decoration:none}
.mb-back:hover{background:var(--bg);color:var(--text);border-color:var(--muted)}
/* schmale Seite → Karte mittig zentriert */
.narrow{max-width:560px;margin:0 auto}

/* ── Karten / Raster / Kennzahlen ── */
.card{background:var(--white);border:1px solid var(--border);border-radius:14px;padding:1.1rem 1.2rem;margin-bottom:1rem}
.card-title{font-size:1rem;font-weight:800;margin:0 0 .6rem;display:flex;align-items:center;gap:.5rem}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:1rem;margin-bottom:1.2rem}
.stat .label{font-size:.72rem;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);font-weight:800}
.stat .big{font-size:2rem;font-weight:800;margin:.2rem 0 .1rem}
.stat .sub{font-size:.82rem;color:var(--muted)}
.bar{height:9px;background:var(--bg);border-radius:99px;overflow:hidden;margin-top:.7rem}
/* Bestätigungs-Dialog (ersetzt native confirm()-Popups) */
.dc-overlay{position:fixed;inset:0;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center;z-index:1000;padding:1rem}
.dc-box{background:var(--white);color:var(--text);border:1px solid var(--border);border-radius:14px;max-width:420px;width:100%;padding:1.3rem 1.4rem;box-shadow:0 16px 40px rgba(0,0,0,.28)}
.dc-msg{margin:0 0 1.1rem;font-size:1rem;line-height:1.45}
.dc-actions{display:flex;gap:.5rem;justify-content:flex-end}
.bar>i{display:block;height:100%;background:var(--red);border-radius:99px}

/* ── Buttons ── */
.btn{display:inline-flex;align-items:center;gap:.4rem;border:1.5px solid var(--border);background:var(--white);
  color:var(--text);border-radius:9px;padding:.5rem .85rem;font-size:.88rem;font-weight:700;cursor:pointer;text-decoration:none}
.btn:hover{border-color:var(--muted)}
.btn.primary{border:0;background:var(--red);color:#fff;border-radius:11px;padding:.6rem 1.05rem;font-weight:800;
  box-shadow:0 3px 10px rgba(0,0,0,.14)}
.btn.primary:hover{background:var(--red-dark)}
.btn.danger{color:var(--red)}
.btn.danger:hover{background:var(--red);color:#fff;border-color:var(--red)}

/* ── Reiter ── */
.tabs{display:flex;gap:.35rem;flex-wrap:wrap;border-bottom:2px solid var(--border);margin:1.2rem 0 1rem}
.tab{border:1px solid var(--border);border-bottom:0;background:var(--bg);color:var(--muted);
  border-radius:10px 10px 0 0;padding:.55rem 1rem;font-size:.92rem;font-weight:700;cursor:pointer;margin-bottom:-2px;text-decoration:none}
.tab.active{background:var(--white);color:var(--red);border-bottom:2px solid var(--white)}

/* ── Tabellen ── */
.table{width:100%;border-collapse:collapse;background:var(--white);border:1px solid var(--border);border-radius:14px;overflow:hidden}
.table th,.table td{padding:.68rem .85rem;text-align:left;border-bottom:1px solid var(--border);font-size:.9rem;vertical-align:middle}
.table th{background:var(--bg);color:var(--muted);font-size:.7rem;text-transform:uppercase;letter-spacing:.05em}
.table tbody tr:last-child td{border-bottom:0}
.table tbody tr:hover{background:rgba(125,135,155,.10)}
.right{text-align:right}

/* ── Badges ── */
.badge{font-size:.72rem;font-weight:800;padding:.14rem .6rem;border-radius:20px;white-space:nowrap;display:inline-block}
.badge.ok{background:var(--ok-bg);color:var(--ok-fg)}
.badge.offen{background:var(--mut-bg);color:var(--mut-fg)}
.badge.abg{background:var(--red-weich);color:var(--red-dark)}
.badge.mut{background:var(--mut-bg);color:var(--mut-fg)}

/* ── Kacheln (Landing wie QM) ── */
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:1rem}
.tile{display:flex;flex-direction:column;gap:.55rem;background:var(--white);border:1px solid var(--border);
  border-radius:14px;padding:1.2rem;text-decoration:none;color:var(--text);transition:border-color .12s,transform .1s,box-shadow .12s}
.tile:hover{border-color:var(--red);transform:translateY(-2px);box-shadow:0 6px 16px rgba(0,0,0,.08)}
.tile .tile-ic{width:44px;height:44px;border-radius:11px;background:var(--red-weich);color:var(--red);
  display:flex;align-items:center;justify-content:center;font-size:1.4rem}
.tile .tile-t{font-weight:800;font-size:1.02rem}
.tile .tile-d{font-size:.85rem;color:var(--muted)}

/* ── Hinweise ── */
.flash{background:var(--ok-bg);color:var(--ok-fg);border-radius:10px;padding:.55rem .8rem;margin:0 0 1rem;font-weight:600}
.error{background:var(--red-weich);color:var(--red-dark);border:1px solid var(--red);border-radius:10px;padding:.55rem .8rem;margin:0 0 1rem;font-weight:600}
.hint{color:var(--muted);font-size:.85rem;margin:.1rem 0 .9rem}

/* ── Formulare ── */
.form-group{margin-bottom:.9rem;display:flex;flex-direction:column;gap:.3rem}
.form-group label{font-size:.82rem;font-weight:700;color:var(--text)}
input:not([type=checkbox]):not([type=radio]),select,textarea{
  background:var(--bg);border:1.5px solid var(--border);border-radius:9px;padding:.55rem .7rem;
  font-size:.9rem;font-family:inherit;color:var(--text);outline:none}
input:focus,select:focus,textarea:focus{background:var(--white);border-color:var(--red);box-shadow:0 0 0 3px rgba(227,6,19,.12)}
input::placeholder,textarea::placeholder{color:var(--muted)}

/* ── Login (schmal, zentriert) ── */
.login-wrap{max-width:420px;margin:8vh auto;padding:0 1rem}

/* ── Kacheln (Hub-Seiten wie „Personal") ── */
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:1rem}
.tile{display:flex;flex-direction:column;gap:.45rem;background:var(--white);border:1px solid var(--border);border-radius:14px;padding:1.2rem 1.3rem;text-decoration:none;color:var(--text);transition:border-color .12s,box-shadow .12s,transform .1s}
.tile:hover{border-color:var(--red);box-shadow:0 6px 18px rgba(0,0,0,.10);transform:translateY(-2px)}
.tile .ti{font-size:1.7rem;color:var(--red);line-height:1}
.tile .tt{font-weight:800;font-size:1.02rem}
.tile .td{font-size:.84rem;color:var(--muted)}

/* ── Mobil ── */
@media (max-width:820px){
  .hamburger{display:flex}
  .brand .t2{display:none}
  .app-side{position:fixed;top:var(--header-h);left:0;bottom:0;transform:translateX(-100%);transition:transform .2s;z-index:35}
  .app-side.open{transform:translateX(0)}
  .app-main{padding:1rem}
}
