/* Funken Transfer Radar — Designsystem
   Angelehnt an funken-akademie.de: hochkontrastig schwarz-weiß,
   Markenfarbe Violett (#9666ff), Slab-Serif-Headlines.
   Cyan = KI, Grün = Forschung/validiert, Blau = Unternehmen,
   Violett = Kreativ/Marke, Amber = Hypothese, Rot = Risiko. */

:root {
    --night: #0a0a0a;        /* Funken-Schwarz (Navigation) */
    --night-2: #1f1f1f;
    --paper: #f4f4f2;        /* leicht warmes Weiß */
    --card: #ffffff;
    --ink: #0a0a0a;
    --muted: #6b6b6b;
    --line: #e2e2de;
    --brand: #9666ff;        /* Funken-Violett (Logo) */
    --brand-dk: #7d4ff0;
    --cyan: #0aa6c9;
    --blue: #2563b8;
    --green: #1e8a5a;
    --violet: #9666ff;
    --amber: #b07a10;
    --red: #c2403a;
    --radius: 8px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--paper);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.55;
}
a { color: var(--brand-dk); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, .brand-title, .card-title, .kpi .num {
    font-family: "Zilla Slab", Georgia, serif;
    letter-spacing: -0.01em;
}

.app { display: flex; min-height: 100vh; }

/* ---------- Navigation ---------- */
.sidenav {
    width: 230px; flex-shrink: 0;
    background: var(--night);
    color: #cfcfcf;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.brand { padding: 22px 18px 18px; border-bottom: 1px solid #2a2a2a; }
.brand-logo { width: 100%; max-width: 150px; height: auto; display: block; }
.brand-title { font-weight: 700; letter-spacing: 1px; font-size: 14px; color: #fff; }
.brand-sub { font-size: 10.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--brand); margin-top: 10px; font-weight: 600; }
.sidenav nav { flex: 1; padding: 12px 0; }
.sidenav nav a {
    display: block; padding: 9px 18px; color: #cfcfcf; font-size: 14px;
}
.sidenav nav a:hover { background: var(--night-2); text-decoration: none; }
.sidenav nav a.active { background: var(--night-2); color: #fff; border-left: 3px solid var(--brand); padding-left: 15px; }
.sidenav-foot { padding: 14px 18px; border-top: 1px solid #2a2a2a; font-size: 12px; }
.foot-note { color: #8a8a8a; margin-top: 8px; }

/* ---------- Topbar & Content ---------- */
.main { flex: 1; min-width: 0; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 28px; background: var(--card); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 5;
}
.search input {
    width: 420px; max-width: 60vw; padding: 8px 12px;
    border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
    background: var(--paper);
}
.topbar-meta { font-size: 13px; color: var(--muted); }
.content { padding: 26px 28px 60px; max-width: 1280px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 26px 0 10px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
.page-sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }

/* ---------- Cards & Grid ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px;
}
.card h3 { margin-top: 0; }
.card-title { font-weight: 700; margin-bottom: 6px; }
.card .meta { color: var(--muted); font-size: 13px; }
.card.accent-blue   { border-top: 3px solid var(--blue); }
.card.accent-green  { border-top: 3px solid var(--green); }
.card.accent-violet { border-top: 3px solid var(--violet); }
.card.accent-cyan   { border-top: 3px solid var(--cyan); }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: 2px 9px; border-radius: 20px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .2px;
    border: 1px solid transparent; vertical-align: middle;
}
.b-grey   { background: #eef0f4; color: #5a6575; }
.b-green  { background: #e4f4ec; color: var(--green); }
.b-amber  { background: #faf1dc; color: var(--amber); }
.b-red    { background: #fbe9e8; color: var(--red); }
.b-cyan   { background: #e1f5fa; color: #08819c; }
.b-blue   { background: #e6eefb; color: var(--blue); }
.b-violet { background: #f0e9fa; color: var(--violet); }

/* ---------- Tabellen ---------- */
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { background: #fafbfc; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
tr:last-child td { border-bottom: none; }

/* ---------- Match-Karte ---------- */
.match-card { display: flex; flex-direction: column; gap: 8px; }
.match-partners { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13.5px; }
.match-partners .p { padding: 3px 10px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); }
.p.p-company  { border-left: 3px solid var(--blue); }
.p.p-research { border-left: 3px solid var(--green); }
.p.p-creative { border-left: 3px solid var(--violet); }

.quality { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; background: #fafbfc; }
.quality-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13.5px; }
.quality-row span:first-child { color: var(--muted); }
.q-good { color: var(--green); font-weight: 600; }
.q-neutral { color: var(--ink); }

/* ---------- Evidenz ---------- */
.evidence { border-left: 3px solid var(--line); padding: 8px 14px; margin: 8px 0; background: var(--card); border-radius: 0 8px 8px 0; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.evidence.k-fakt { border-left-color: var(--green); }
.evidence.k-hypothese { border-left-color: var(--amber); }
.evidence .src { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ---------- Formulare / Buttons ---------- */
.btn {
    display: inline-block; padding: 7px 14px; border-radius: 8px;
    border: 1px solid var(--line); background: var(--card); color: var(--ink);
    font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--paper); text-decoration: none; }
.btn-primary { background: var(--night); color: #fff; border-color: var(--night); }
.btn-primary:hover { background: var(--night-2); }
.btn-ai { background: var(--cyan); color: #fff; border-color: var(--cyan); }
.btn-ai:hover { background: #0894b3; }
.btn-danger { color: var(--red); border-color: #efcaca; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
form.inline { display: inline; }
select, input[type="text"] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; background: var(--card); }

/* ---------- Filterleiste ---------- */
.filterbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.filterbar .label { font-size: 13px; color: var(--muted); }

/* ---------- Tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--line); margin: 16px 0; }
.tabs a { padding: 8px 14px; font-size: 14px; color: var(--muted); border-radius: 8px 8px 0 0; }
.tabs a.active { color: var(--ink); font-weight: 700; border-bottom: 2px solid var(--night); margin-bottom: -2px; }
.tabs a:hover { text-decoration: none; background: var(--paper); }

/* ---------- Dashboard ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .num { font-size: 26px; font-weight: 800; }
.kpi .lbl { font-size: 12.5px; color: var(--muted); }
.trend-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.trend-pill {
    padding: 6px 14px; border-radius: 20px; background: var(--card);
    border: 1px solid var(--line); font-size: 13.5px; font-weight: 600;
}
.trend-pill:hover { border-color: var(--brand); text-decoration: none; }
.signal { padding: 10px 0; border-bottom: 1px solid var(--line); }
.signal:last-child { border-bottom: none; }
.signal .s-text { font-weight: 600; }
.signal .s-meaning, .signal .s-action { font-size: 13.5px; color: var(--muted); }
.signal .s-action::before { content: "→ "; color: var(--cyan); }
.signals-table td { vertical-align: top; }
.signals-table .s-text { font-weight: 600; }
.signals-table .s-meaning, .signals-table .s-action { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.signals-table .s-action::before { content: "→ "; color: var(--cyan); }
.signal-actions { display: flex; flex-wrap: wrap; gap: 5px; max-width: 260px; }

/* ---------- Canvas (Projektstudio) ---------- */
.canvas-block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.canvas-block .cb-label { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.canvas-block.cb-creative { border-left: 4px solid var(--violet); }
.canvas-block.cb-research { border-left: 4px solid var(--green); }
.canvas-block.cb-company  { border-left: 4px solid var(--blue); }
.canvas-block.cb-funding  { border-left: 4px solid var(--amber); }

/* ---------- Hinweise ---------- */
.notice { padding: 12px 16px; border-radius: 8px; font-size: 13.5px; margin: 14px 0; }
.notice-info { background: #e1f5fa; color: #075e72; }
.notice-warn { background: #faf1dc; color: #7a5408; }
.notice-legal { background: #eef0f4; color: #4a5568; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt0 { margin-top: 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } .sidenav { width: 180px; } }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--night); }
.login-card { background: var(--card); border-radius: 14px; border-top: 4px solid var(--brand); padding: 36px 34px; width: 360px; max-width: 90vw; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.login-card label { display: block; }
code { background: #eef0f4; padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.btn-xs { padding: 3px 8px; font-size: 12px; }

/* ---------- Sidebar-Nutzer ---------- */
.foot-user { display: block; color: #fff; font-weight: 700; font-size: 14px; }
.foot-user:hover { color: var(--cyan); text-decoration: none; }

/* ---------- Alternative Partner ---------- */
.alt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 5px 0; }
.alt-row .p { font-size: 13px; }

/* ---------- Einklappbares Menü (Pfeil direkt am Seitenmenü) ---------- */
.sidenav { position: relative; transition: width .16s ease; }
.nav-collapse-btn {
    position: absolute; top: 16px; right: -12px; z-index: 30;
    width: 24px; height: 24px; padding: 0; border-radius: 50%;
    background: var(--brand); color: #fff; border: 2px solid var(--paper);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.28);
}
.nav-collapse-btn:hover { background: var(--brand-dk); }
.nav-collapse-btn .chev { font-size: 15px; line-height: 1; transition: transform .16s ease; }
/* Eingeklappt: schmaler, dunkler Streifen bleibt sichtbar – nur der Pfeil ragt heraus */
html.nav-collapsed .sidenav { width: 18px; min-width: 18px; }
html.nav-collapsed .sidenav > .brand,
html.nav-collapsed .sidenav > nav,
html.nav-collapsed .sidenav > .sidenav-foot { display: none; }
html.nav-collapsed .nav-collapse-btn .chev { transform: rotate(180deg); }

/* Prominente Match-Suche (vormals in der Kopfleiste) */
.search-lg { display: flex; gap: 8px; margin-bottom: 18px; }
.search-lg input { flex: 1; width: auto; max-width: none; padding: 11px 14px; font-size: 15px; }
.foot-ki { display: flex; align-items: center; gap: 10px; margin-top: 10px; }

/* ---------- Avatar ---------- */
.avatar {
    border-radius: 50%; object-fit: cover; display: inline-flex;
    align-items: center; justify-content: center; vertical-align: middle; flex-shrink: 0;
}
.avatar-initials { background: var(--brand); color: #fff; font-weight: 700; font-family: "Zilla Slab", serif; }
.foot-user-row { display: flex; align-items: center; gap: 10px; }
.foot-user-row:hover { text-decoration: none; }
.foot-user-row > span { display: flex; flex-direction: column; min-width: 0; }
.foot-user-row .foot-note { margin-top: 1px; }
.topbar-meta { display: flex; align-items: center; gap: 12px; }

/* ---------- Methoden-Nutzungsbalken ---------- */
.usage-bar { background: var(--line); border-radius: 6px; height: 7px; overflow: hidden; margin-bottom: 4px; }
.usage-bar span { display: block; height: 100%; background: var(--brand); border-radius: 6px; }

/* ---------- Avatar-Editor ---------- */
.avatar-edit { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

/* ---------- Kontakt-Visitenkarten ---------- */
.vcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; margin-top: 6px; }
.vcard { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--blue); border-radius: var(--radius); padding: 14px; }
.vc-photo { flex-shrink: 0; }
.vc-photo img, .vc-initials {
    width: 56px; height: 56px; border-radius: 50%; object-fit: cover; display: block;
}
.vc-initials { display: flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; font-weight: 700; font-family: "Zilla Slab", serif; font-size: 20px; }
.vc-body { flex: 1; min-width: 0; }
.vc-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vc-name { font-weight: 700; font-family: "Zilla Slab", serif; font-size: 15.5px; }
.vc-role { font-size: 13.5px; color: var(--ink); margin-top: 1px; }
.vc-org { font-size: 13px; color: var(--muted); margin: 1px 0 8px; }
.vc-rows { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.vc-row { display: flex; gap: 8px; font-size: 13.5px; }
.vc-row .vc-k { flex: 0 0 56px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; padding-top: 1px; }
.vc-src { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; word-break: break-word; }
.vc-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* Feld-Herkunft auf Visitenkarten */
.vc-row .vc-v { min-width: 0; }
.vc-prov { font-size: 11px; color: var(--muted); font-style: italic; white-space: nowrap; }
.vc-photo { position: relative; text-align: center; }
.vc-photo-prov { margin-top: 4px; font-style: normal; font-size: 10px; }

/* ---------- KI-Job-Queue: Overlay unten rechts ---------- */
.job-overlay {
    position: fixed; right: 18px; bottom: 18px; width: 320px; max-width: calc(100vw - 36px);
    background: var(--card); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,.18); z-index: 60; overflow: hidden; font-size: 13px;
}
.job-overlay-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 12px; background: var(--night); color: #fff;
}
.job-overlay-title { font-weight: 600; letter-spacing: .3px; }
.job-overlay-title::before {
    content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--cyan); margin-right: 7px; vertical-align: middle;
}
#job-overlay-close { background: none; border: none; color: #cfcfcf; font-size: 18px; cursor: pointer; line-height: 1; padding: 0 2px; }
#job-overlay-close:hover { color: #fff; }
.job-overlay-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.job-item { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.job-item:last-child { border-bottom: none; }
.job-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.job-label { font-weight: 600; }
.job-msg { color: var(--muted); margin-top: 3px; line-height: 1.4; }
.job-badge { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #eef0f4; color: #5a6575; white-space: nowrap; }
.job-badge.ok { background: #e4f4ec; color: var(--green); }
.job-badge.err { background: #fbe9e8; color: var(--red); }
.job-badge.wait { background: #faf1dc; color: var(--amber); }
.job-open { font-size: 12px; font-weight: 600; white-space: nowrap; }
.job-spin {
    width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--cyan);
    border-radius: 50%; display: inline-block; animation: jobspin .7s linear infinite; flex-shrink: 0;
}
@keyframes jobspin { to { transform: rotate(360deg); } }
.job-cost {
    display: inline-block; margin-top: 5px; font-size: 11.5px; color: var(--muted);
    background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 0 7px; cursor: help;
}

/* ---------- Ausklappbare Laien-Erklärung (Match) ---------- */
details.explainer { margin: 8px 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
details.explainer > summary { cursor: pointer; padding: 9px 14px; font-weight: 600; color: var(--brand-dk); list-style: none; }
details.explainer > summary::-webkit-details-marker { display: none; }
details.explainer > summary::before { content: "▸ "; color: var(--brand); }
details.explainer[open] > summary::before { content: "▾ "; }
details.explainer > p { padding: 2px 14px 10px; margin: 0; line-height: 1.6; }
details.explainer > form { padding: 0 14px 12px; }
