/* =========================================================
   4smile Campus – Designsprache (CRM-Palette)
   Navy-Sidebar + warmer Canvas, chunky Pill-Buttons,
   Einsatzreife-Ampel, KPI-Kacheln, Kompetenzmatrix.
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --brand-50:  #f8f5f3;
    --brand-100: #f2dfdc;
    --brand-200: #ecc9c3;
    --brand-300: #d8ecec;
    --brand-400: #b4ddde;
    --brand-500: #b5c4db;
    --brand-600: #627596;
    --brand-700: #2d4267;
    --brand-800: #192946;
    --brand-900: #121f36;

    --accent: #ecc9c3;
    --mint:   #b4ddde;
    --steel:  #b5c4db;
    --canvas: #fffdfa;
    --ink:    #1d1d1b;

    --line:   #e9e2df;
    --shadow: 0 4px 20px rgba(25, 41, 70, .06);
    --shadow-nav: 0 20px 60px rgba(25, 41, 70, .14);

    --gruen:   #2f6b57;  --gruen-bg:  #e7f1ec;
    --gelb:    #8a6425;  --gelb-bg:   #f6efe0;
    --rot:     #a63f3f;  --rot-bg:    #f8e8e6;

    --ok:      #2f6b57;  --ok-bg:     #e7f1ec;
    --danger:  #a63f3f;  --danger-bg: #f8e8e6;
    --warn:    #8a6425;  --warn-bg:   #f6efe0;
    --info:    #2d4267;  --info-bg:   #e6ecf5;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-700); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; }

/* ---------- Kopfleiste ---------- */
.navtoggle { display: none; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 16px 26px 2px; }
.app-name { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .18em; color: var(--brand-600); }
.nav-burger { display: none; font-size: 20px; cursor: pointer; line-height: 1; border: 2px solid var(--brand-800); border-radius: 14px; padding: 5px 11px; background: #fff; }

/* ---------- Rumpf: Sidebar + Inhalt ---------- */
.shell { display: flex; align-items: flex-start; gap: 22px; padding: 8px 26px 40px; }

.sidebar {
    width: 258px; flex: none;
    background: var(--brand-800); color: #fff;
    border-radius: 24px; box-shadow: var(--shadow-nav);
    padding: 14px; position: sticky; top: 14px;
    max-height: calc(100vh - 28px); overflow-y: auto; z-index: 20;
    display: flex; flex-direction: column;
}
.logo-box { background: #fff; border-radius: 18px; padding: 14px; display: flex; justify-content: center; margin-bottom: 8px; }
.logo-box img { width: 100%; max-width: 150px; height: auto; display: block; }
.app-tag {
    text-align: center; font-size: 10px; font-weight: 700; letter-spacing: .28em;
    text-transform: uppercase; color: var(--mint); margin-bottom: 14px;
}
.app-tag--dark { color: var(--brand-600); margin-top: 4px; }

.mainnav { display: flex; flex-direction: column; gap: 5px; }
.mainnav a {
    display: block; border-radius: 999px; border: 1.5px solid transparent;
    background: rgba(255,255,255,.07); color: rgba(255,255,255,.92);
    padding: 9px 15px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
}
.mainnav a:hover { background: var(--accent); color: var(--brand-800); text-decoration: none; }
.mainnav a.aktiv { background: var(--mint); color: var(--brand-800); border-color: var(--brand-400); }
.nav-overlay { display: none; }

.nav-group { margin-top: 2px; }
.nav-group > summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; justify-content: space-between;
    border-radius: 999px; border: 1.5px solid transparent;
    background: rgba(255,255,255,.07); color: rgba(255,255,255,.92);
    padding: 9px 15px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: '▸'; font-size: 10px; opacity: .7; transition: transform .15s; }
.nav-group[open] > summary::after { transform: rotate(90deg); }
.nav-group > summary:hover { background: var(--accent); color: var(--brand-800); }
.nav-sub { display: flex; flex-direction: column; gap: 4px; margin: 5px 0 2px 10px; padding-left: 8px; border-left: 2px solid rgba(255,255,255,.12); }
.nav-sub a {
    display: block; border-radius: 999px; background: rgba(255,255,255,.05);
    color: rgba(255,255,255,.88); padding: 8px 13px; font-size: 10.5px;
    font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.nav-sub a:hover { background: var(--accent); color: var(--brand-800); text-decoration: none; }
.nav-sub a.aktiv { background: var(--mint); color: var(--brand-800); }

.session-card { margin-top: 16px; padding: 13px 14px; border-radius: 18px; background: rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 10px; }
.session-card .uname { display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; font-weight: 700; color: #fff; }
.session-card .uname small { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .16em; color: rgba(255,255,255,.6); }
.logout {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 38px; padding: 0 14px; border-radius: 999px;
    border: 1.5px solid var(--brand-400); background: var(--mint); color: var(--brand-800);
    font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
}
.logout:hover { background: var(--brand-300); text-decoration: none; }

.content { flex: 1; min-width: 0; max-width: 1200px; }
.seitentitel {
    display: inline-block; margin: 0 0 18px;
    background: var(--accent); color: var(--brand-800);
    padding: 5px 12px; border-radius: 6px;
    font-size: 22px; font-weight: 700; line-height: 1.15;
}
.site-footer { color: var(--brand-600); font-size: 10px; text-transform: uppercase; letter-spacing: .16em; padding: 22px 0 4px; }

/* ---------- Karten ---------- */
.card {
    border: 1px solid var(--line); border-radius: 16px; background: #fff;
    box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 14px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--brand-700); }
.card h3 { margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--brand-700); }
.card.schmal { max-width: 560px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.hervorgehoben { border-color: var(--brand-400); box-shadow: var(--shadow), 0 0 0 3px rgba(180,221,222,.5); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.hint { color: var(--brand-600); font-size: 12.5px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 42px; padding: 0 18px; border-radius: 999px; cursor: pointer;
    border: 1.5px solid transparent; font-size: 11px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .04em; transition: background .12s, border-color .12s;
    font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--mint); border-color: var(--brand-400); color: var(--brand-800); }
.btn-primary:hover:not(:disabled) { background: var(--brand-300); }
.btn-secondary { background: var(--accent); border-color: var(--brand-800); color: var(--brand-800); }
.btn-secondary:hover:not(:disabled) { background: var(--brand-100); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--brand-700); }
.btn-ghost:hover { background: var(--brand-50); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 10px; }
.btn-block { width: 100%; }

/* ---------- Formulare ---------- */
label { display: block; margin: 11px 0; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--brand-600); }
label.check { display: flex; align-items: center; gap: 9px; text-transform: none; letter-spacing: normal; font-size: 13.5px; font-weight: 500; color: var(--ink); margin: 7px 0; }
label.check input { width: auto; margin: 0; }
input, select, textarea {
    display: block; width: 100%; margin-top: 5px; padding: 10px 12px;
    border: 1.5px solid var(--brand-800); border-radius: 12px; background: #fff;
    font-family: inherit; font-size: 14px; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--brand-300); }
input:disabled { background: var(--brand-50); color: var(--brand-600); border-color: var(--line); }
textarea { min-height: 90px; resize: vertical; }
.form-actions { margin-top: 16px; }
.inline-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-form label { margin: 0; }
.inline-input { width: auto; min-width: 220px; margin-top: 0; flex: 1; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 16px; margin: 8px 0 14px; }

/* ---------- Flash ---------- */
.flash { padding: 11px 15px; border-radius: 12px; margin-bottom: 14px; font-size: 13.5px; font-weight: 600; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-fehler { background: var(--danger-bg); color: var(--danger); }
.flash-info { background: var(--info-bg); color: var(--info); }

/* ---------- Badges ---------- */
.badge { display: inline-block; border-radius: 999px; background: var(--brand-50); border: 1px solid var(--line); padding: 3px 10px; font-size: 10.5px; font-weight: 700; color: var(--brand-700); }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge-inv-non { background: var(--gruen-bg); color: var(--gruen); border-color: transparent; }
.badge-inv-mini { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge-inv-inv { background: var(--rot-bg); color: var(--rot); border-color: transparent; }

/* ---------- Ampel ---------- */
.ampel { display: inline-block; width: 13px; height: 13px; border-radius: 50%; vertical-align: middle; margin-right: 6px; border: 1.5px solid rgba(0,0,0,.08); }
.ampel-gruen { background: #3f9d6f; }
.ampel-gelb  { background: #e0b040; }
.ampel-rot   { background: #cf6a5f; }

/* ---------- KPI-Kacheln ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 16px 18px; border-left: 5px solid var(--brand-500); }
.kpi-gruen { border-left-color: #3f9d6f; }
.kpi-gelb  { border-left-color: #e0b040; }
.kpi-rot   { border-left-color: #cf6a5f; }
.kpi-wert { font-size: 32px; font-weight: 700; color: var(--brand-800); line-height: 1; }
.kpi-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand-700); margin-top: 6px; }
.kpi-sub { font-size: 11px; color: var(--brand-600); margin-top: 2px; }

/* ---------- Baustein-Liste ---------- */
.baustein-liste { list-style: none; margin: 0; padding: 0; }
.baustein-liste li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--brand-50); flex-wrap: wrap; }
.baustein-liste li:last-child { border-bottom: none; }
.baustein-liste .meta { margin-left: auto; font-size: 11px; color: var(--brand-600); }

/* ---------- Tabellen ---------- */
table.liste, table.matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
table.liste thead th {
    background: var(--brand-800); color: #fff; text-align: left; padding: 9px 10px;
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    border-bottom: 2px solid var(--accent);
}
table.liste thead th:first-child { border-top-left-radius: 10px; }
table.liste thead th:last-child { border-top-right-radius: 10px; }
table.liste tbody td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.liste tbody tr:nth-child(even) { background: var(--brand-50); }

/* ---------- Kompetenzmatrix ---------- */
.matrix-scroll { overflow-x: auto; }
table.matrix { font-size: 12px; }
table.matrix th, table.matrix td { padding: 6px 4px; text-align: center; border-bottom: 1px solid var(--line); }
table.matrix thead th { background: var(--brand-800); color: #fff; position: sticky; top: 0; border-bottom: 2px solid var(--accent); }
.matrix-name { text-align: left !important; min-width: 170px; position: sticky; left: 0; background: #fff; z-index: 2; }
thead .matrix-name { background: var(--brand-800); z-index: 3; }
.matrix-name a { display: block; }
.matrix-name small { display: block; font-size: 10px; color: var(--brand-600); font-weight: 500; }
.matrix-col span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); font-size: 10px; letter-spacing: .02em; }
.matrix-col { height: 90px; }
.matrix-cell { width: 30px; }
.matrix-cell .ampel { margin: 0; }
.matrix-bilanz { white-space: nowrap; }
.mini { display: inline-block; min-width: 20px; padding: 1px 5px; border-radius: 6px; font-size: 11px; font-weight: 700; margin-right: 2px; }
.mini.gruen { background: var(--gruen-bg); color: var(--gruen); }
.mini.gelb  { background: var(--gelb-bg);  color: var(--gelb); }
.mini.rot   { background: var(--rot-bg);   color: var(--rot); }

/* ---------- Detail-Kopf ---------- */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.eyebrow { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; color: var(--brand-600); }
.detail-titel { margin: 4px 0 8px; font-size: 26px; font-weight: 700; color: var(--brand-800); }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inhalt { font-size: 14.5px; }
.inhalt ul { padding-left: 20px; }
.inhalt h2, .inhalt h3 { text-transform: none; letter-spacing: normal; color: var(--ink); }

/* ---------- Stand / Ampel-Karte ---------- */
.ampel-card-gruen { border-color: #3f9d6f; }
.ampel-card-gelb  { border-color: #e0b040; }
.ampel-card-rot   { border-color: #cf6a5f; }
.stand-ampel { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 12px; }
.stand-ampel .ampel { width: 16px; height: 16px; }
.stand-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 13.5px; }
.stand-dl dt { font-weight: 700; color: var(--brand-600); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; align-self: center; }
.stand-dl dd { margin: 0; }
.stand-dl-inline { grid-template-columns: repeat(3, auto); gap: 4px 24px; }
.stand-aktion { border-top: 1px solid var(--line); padding-top: 14px; }

/* ---------- Test ---------- */
.testform .frage-card { border-left: 4px solid var(--brand-400); }
.frage-titel { font-weight: 700; margin: 0 0 10px; font-size: 14.5px; }
.antwort-opt { display: flex; align-items: center; gap: 10px; text-transform: none; letter-spacing: normal; font-weight: 500; font-size: 14px; color: var(--ink); margin: 6px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.antwort-opt:hover { background: var(--brand-50); }
.antwort-opt input { width: auto; margin: 0; }
.result { display: flex; align-items: center; gap: 20px; }
.result-score { font-size: 44px; font-weight: 700; color: var(--brand-800); }
.result-ok { border-color: #3f9d6f; background: var(--gruen-bg); }
.result-fail { border-color: #cf6a5f; background: var(--rot-bg); }
.aufloesung { padding: 12px 14px; border-radius: 12px; margin-bottom: 10px; border: 1px solid var(--line); }
.aufloesung.a-ok { background: var(--gruen-bg); }
.aufloesung.a-fail { background: var(--rot-bg); }
.af-frage { font-weight: 700; margin: 0 0 8px; }
.af-antw { list-style: none; margin: 0; padding: 0; }
.af-antw li { padding: 4px 8px; border-radius: 8px; font-size: 13.5px; }
.af-antw li.korrekt { background: rgba(63,157,111,.18); font-weight: 600; }
.af-antw li.falsch { background: rgba(207,106,95,.18); text-decoration: line-through; }
.af-antw .mark { font-weight: 700; }
.af-erkl { margin: 8px 0 0; font-size: 13px; color: var(--brand-700); }

/* ---------- Ampel-Spalten (Einsatzreife) ---------- */
.ampel-spalten { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.ampel-spalte h3 { display: flex; align-items: center; gap: 6px; }
.ampel-spalte .count { margin-left: auto; background: var(--brand-50); border-radius: 8px; padding: 1px 8px; font-size: 13px; }
.ampel-spalte-gruen { border-top: 4px solid #3f9d6f; }
.ampel-spalte-gelb  { border-top: 4px solid #e0b040; }
.ampel-spalte-rot   { border-top: 4px solid #cf6a5f; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; background: var(--brand-50); border: 1px solid var(--line); }
.chip-gruen { background: var(--gruen-bg); color: var(--gruen); border-color: transparent; }
.person-karte .card-head { margin-bottom: 10px; }
.bilanz-mini { white-space: nowrap; }

/* ---------- Admin-Fragen / Log ---------- */
.frage-admin { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.antwort-zeile { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.antwort-zeile .check { margin: 0; }
.antwort-zeile input[type=text] { margin-top: 0; }
.log-liste { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.log-liste li { padding: 6px 0; border-bottom: 1px solid var(--brand-50); color: var(--brand-700); }

/* ---------- Filterleiste ---------- */
.filterbar { padding: 12px 18px; }
.filterform { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.filterform label { margin: 0; }
.filterform select { margin-top: 4px; }
.legende { margin-left: auto; font-size: 11.5px; color: var(--brand-600); display: flex; align-items: center; gap: 4px; }
.legende .ampel { margin: 0 2px 0 10px; }

/* ---------- Login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-wrap { width: 100%; max-width: 380px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-nav); padding: 28px 26px; }
.login-card h1 { text-align: center; font-size: 22px; color: var(--brand-800); margin: 6px 0 18px; }
.login-hint { text-align: center; font-size: 11.5px; color: var(--brand-600); margin-top: 14px; }
.login-card .logo-box { background: var(--brand-800); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .grid-2, .ampel-spalten { grid-template-columns: 1fr; }
    .nav-burger { display: inline-block; }
    .shell { padding: 8px 14px 40px; }
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; width: 270px; border-radius: 0 24px 24px 0;
        transform: translateX(-100%); transition: transform .2s;
    }
    .navtoggle:checked ~ .shell .sidebar { transform: translateX(0); }
    .navtoggle:checked ~ .shell .nav-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 15; }

    /* Tabelle → Karten (außer Matrix, die scrollt). */
    table.liste thead { display: none; }
    table.liste, table.liste tbody, table.liste tr, table.liste td { display: block; width: 100%; }
    table.liste tr { border: 1px solid var(--brand-800); border-radius: 14px; margin-bottom: 10px; padding: 6px 10px; background: #fff; }
    table.liste tbody tr:nth-child(even) { background: #fff; }
    table.liste td { border: none; display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
    table.liste td::before { content: attr(data-label); font-weight: 700; color: var(--brand-600); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
}
