/* Crew Manager - Anwendungsstile */

:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-alt: #fafbfc;
    --border: #e3e5ea;
    --text: #1c1f26;
    --text-muted: #6b7280;
    --text-faint: #9aa0ab;
    --accent: #3d5bff;
    --accent-dark: #2c44d1;
    --accent-soft: #eaedff;
    --ok: #16a34a;
    --ok-soft: #e8f8ee;
    --warn: #b45309;
    --warn-soft: #fef3e0;
    --err: #dc2626;
    --err-soft: #fdeaea;
    --ring-ai: #dc2626;
    --ring-human: #2563eb;
    --sidebar-bg: #14161c;
    --sidebar-text: #cbd0dc;
    --sidebar-active: #232633;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(20,22,30,.04), 0 1px 8px rgba(20,22,30,.04);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.55; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; font-weight: 650; }
p { margin: 0 0 .75rem; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 232px; flex: 0 0 232px; background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: 1.25rem 1.1rem 1rem; }
.brand a { display: flex; line-height: 0; }
.brand-logo { max-width: 150px; height: auto; display: block; }
.nav { display: flex; flex-direction: column; gap: .1rem; padding: .5rem .7rem; flex: 1; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: .55rem;
    color: var(--sidebar-text); padding: .55rem .75rem; border-radius: 8px; font-size: .89rem;
    font-weight: 500;
}
.nav-icon { flex: none; width: 1.1em; text-align: center; }
.nav-item:hover { background: #1c1f29; text-decoration: none; color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.sidebar-footer { padding: .7rem; border-top: 1px solid #262a35; }
.user-box { padding: .6rem .75rem 0; }
.user-name { color: #fff; font-size: .85rem; font-weight: 600; }
.user-role { color: var(--text-faint); font-size: .75rem; margin-bottom: .4rem; }
.link-btn { display: inline-flex; align-items: center; gap: .4rem; background: none; border: 0; color: var(--sidebar-text); font-size: .78rem; padding: 0; cursor: pointer; }
.link-btn:hover { color: #fff; text-decoration: underline; }

.main { flex: 1; padding: 1.75rem 2.25rem 3rem; max-width: 1320px; margin: 0 auto; width: 100%; }

/* Flash */
.flash-stack { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: .5rem; }
.flash-stack-solo { max-width: 480px; margin: 1.5rem auto 0; }
.flash { padding: .65rem .9rem; border-radius: 8px; font-size: .88rem; }
.flash-success { background: var(--ok-soft); color: #0f6b32; }
.flash-error { background: var(--err-soft); color: #9c1c1c; }
.flash-info { background: var(--accent-soft); color: var(--accent-dark); }

/* Breadcrumb-Navi (nur Desktop, siehe partials/breadcrumbs.php - wird auf
   Mobil-Breiten ausgeblendet, siehe @media max-width: 860px weiter unten,
   das dort einheitliche Mobil-Menue deckt die Navigation dort bereits ab) */
.breadcrumbs { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--text-muted); margin-bottom: 1.1rem; flex-wrap: wrap; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent); text-decoration: underline; }
.breadcrumbs .current { color: var(--text); font-weight: 600; }
.breadcrumb-sep { color: var(--text-faint); }

/* Page header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.4rem; }
.page-sub { color: var(--text-muted); font-size: .88rem; margin-top: .15rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; }
.card h2 { font-size: 1.02rem; }
.card h3 { font-size: .92rem; }
.card-flat { background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; }
.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: .15rem; }
.kpi .value { font-size: 1.75rem; font-weight: 700; }
.kpi .label { color: var(--text-muted); font-size: .8rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .95rem; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-size: .86rem; font-weight: 550; cursor: pointer; }
.btn:hover { background: var(--surface-alt); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger { background: var(--err-soft); border-color: #f6c9c9; color: var(--err); }
.btn-danger:hover { background: #fbdada; }
.btn-sm { padding: .32rem .65rem; font-size: .78rem; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1rem; font-weight: 700; border-radius: 10px; }
.btn-sync { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-sync:hover { background: #96470a; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* Sync-Aktionsleiste je Assistent (Prompt/Langdock jetzt an einer Stelle) */
.sync-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.3rem; margin-bottom: 1.25rem; }
.sync-bar-status { display: flex; align-items: center; gap: .6rem; margin-bottom: .9rem; font-size: .92rem; font-weight: 600; }
.sync-bar-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

.spinner {
    display: inline-block; width: 12px; height: 12px; margin-right: .45rem; vertical-align: -1px;
    border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Forms */
label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-muted); margin: 0 0 .3rem; }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=search],
select, textarea {
    width: 100%; padding: .55rem .7rem; border-radius: 7px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-size: .88rem; font-family: inherit;
}
textarea { resize: vertical; }
.field { margin-bottom: .9rem; }
.field-row { display: flex; gap: .9rem; flex-wrap: wrap; }
.field-row > .field { flex: 1; min-width: 180px; }
.hint { color: var(--text-faint); font-size: .76rem; margin-top: .25rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 0 0 1rem; }
legend { padding: 0 .4rem; font-weight: 650; font-size: .88rem; }

/* Table */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); font-size: .86rem; vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* Badges */
.badge { display: inline-block; padding: .18rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 650; white-space: nowrap; }
.badge-idee { background: #eef0f3; color: #4b5563; }
.badge-geplant { background: var(--accent-soft); color: var(--accent-dark); }
.badge-in_entwicklung { background: #f2e9ff; color: #7a2fd6; }
.badge-test { background: var(--warn-soft); color: var(--warn); }
.badge-produktiv { background: var(--ok-soft); color: #0f6b32; }
.badge-ueberarbeitung { background: #fde8e8; color: #b3261e; }
.badge-archiviert { background: #eef0f3; color: var(--text-faint); }

.badge-nicht_verbunden { background: #eef0f3; color: var(--text-faint); }
.badge-synchron { background: var(--ok-soft); color: #0f6b32; }
.badge-abweichend { background: var(--warn-soft); color: var(--warn); }
.badge-fehler { background: var(--err-soft); color: var(--err); }

.badge-offen { background: var(--accent-soft); color: var(--accent-dark); }
.badge-in_arbeit { background: var(--warn-soft); color: var(--warn); }
.badge-erledigt { background: var(--ok-soft); color: #0f6b32; }
.badge-blockiert { background: var(--err-soft); color: var(--err); }
.badge-hoch { background: var(--err-soft); color: var(--err); }
.badge-normal { background: #eef0f3; color: var(--text-muted); }
.badge-niedrig { background: #eef0f3; color: var(--text-faint); }

.badge-aktiv { background: var(--ok-soft); color: #0f6b32; }
.badge-pausiert { background: var(--warn-soft); color: var(--warn); }
.badge-ausgeschieden { background: #eef0f3; color: var(--text-faint); }

.badge-ai { background: var(--accent-soft); color: var(--accent-dark); }
.badge-human { background: #eef0f3; color: var(--text-muted); }

.dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:.4rem; vertical-align:middle; }

/* Tabs / pills */
.pill-nav { display: flex; gap: .4rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.pill { padding: .4rem .85rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: .82rem; font-weight: 550; color: var(--text-muted); }
.pill.active { background: var(--text); color: #fff; border-color: var(--text); }
.pill:hover { text-decoration: none; }

/* Empty state */
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--text-muted); }
.empty h3 { color: var(--text); margin-bottom: .3rem; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .kanban { grid-template-columns: repeat(2, 1fr); } }
.kanban-col { background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; min-height: 80px; }
.kanban-col h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); margin-bottom: .6rem; display:flex; justify-content:space-between; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .6rem .7rem; margin-bottom: .55rem; font-size: .84rem; box-shadow: var(--shadow); }
.kanban-card .meta { color: var(--text-faint); font-size: .74rem; margin-top: .3rem; }

/* Prompt / markdown */
.prompt-render { background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.5rem; max-height: 640px; overflow-y: auto; }
.prompt-render h1, .prompt-render h2, .prompt-render h3 { margin-top: 1.1rem; }
.prompt-render pre { background: #10121a; color: #dbe1f0; padding: .8rem 1rem; border-radius: 8px; overflow-x: auto; }
.prompt-render code { background: #eef0f3; padding: .1rem .3rem; border-radius: 4px; font-size: .85em; }
.prompt-render pre code { background: none; padding: 0; }
.prompt-render blockquote { border-left: 3px solid var(--accent); margin: .6rem 0; padding: .2rem .9rem; color: var(--text-muted); }
.prompt-render .md-table-wrap { overflow-x: auto; margin: .6rem 0; }
.prompt-render table { border-collapse: collapse; width: 100%; font-size: .88em; }
.prompt-render th, .prompt-render td { border: 1px solid var(--border); padding: .4rem .6rem; text-align: left; vertical-align: top; }
.prompt-render th { background: var(--surface); font-weight: 700; }
.prompt-render a[target="_blank"]::after { content: " ↗"; font-size: .85em; opacity: .7; }

textarea.prompt-editor { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; min-height: 420px; line-height: 1.5; }

/* Diff */
.diff { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.diff-line { padding: .1rem .8rem; white-space: pre-wrap; word-break: break-word; border-left: 3px solid transparent; }
.diff-add { background: #e9f9ee; border-left-color: var(--ok); }
.diff-remove { background: #fdecec; border-left-color: var(--err); }
.diff-equal { color: var(--text-faint); }

/* Avatar (Langdock liefert nur ein Emoji-Icon, kein Bild - Fallback: Initialen) */
.avatar {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark);
    font-weight: 700; overflow: hidden; line-height: 1;
}
.avatar-sm { width: 28px; height: 28px; font-size: 1rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.7rem; }
.avatar-xl { width: 104px; height: 104px; font-size: 2.6rem; }
.avatar-2xl { width: 218px; height: 218px; font-size: 5.2rem; }
.avatar-photo { background: var(--surface-alt); }
.avatar-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

/* Assistant grid */
.assistant-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: var(--shadow); color: var(--text); }
.assistant-card:hover { border-color: var(--accent); text-decoration: none; }
.assistant-card .name { font-weight: 650; font-size: 1rem; margin-bottom: .15rem; }
.assistant-card .title { color: var(--text-muted); font-size: .82rem; margin-bottom: .55rem; min-height: 1.2em; }
.assistant-card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: .6rem; font-size: .76rem; color: var(--text-faint); }

/* Detail tabs content spacing */
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); margin: 1.4rem 0 .5rem; font-weight: 650; }
.section-title:first-child { margin-top: 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag { background: var(--accent-soft); color: var(--accent-dark); padding: .15rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: .35rem .8rem; font-size: .86rem; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 2rem; }
.login-card h1 { text-align: center; font-size: 1.25rem; margin-bottom: .3rem; }
.login-card .sub { text-align: center; color: var(--text-muted); font-size: .84rem; margin-bottom: 1.5rem; }

/* Passwort anzeigen/verbergen */
.pw-toggle-wrap { position: relative; }
.pw-toggle-wrap input[type=password], .pw-toggle-wrap input[type=text] { padding-right: 5.2rem; }
.pw-toggle-btn {
    position: absolute; right: .4rem; top: 50%; transform: translateY(-50%);
    background: none; border: 0; color: var(--accent); font-size: .74rem; font-weight: 600;
    cursor: pointer; padding: .2rem .4rem;
}
.pw-toggle-btn:hover { text-decoration: underline; }

.status-config { display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; border-radius: 8px; background: var(--surface-alt); font-size: .84rem; margin-bottom: .6rem; }
.status-config.ok { background: var(--ok-soft); color: #0f6b32; }
.status-config.warn { background: var(--warn-soft); color: var(--warn); }
.status-config.err { background: var(--err-soft); color: var(--err); }

/* Personalakte: einheitliches, zentriertes Profil (fuer alle Akten gleich) */
.profile-page { max-width: 700px; margin: 0 auto; }
.profile-header { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .3rem; margin-bottom: 1.4rem; }
.profile-header h1 { margin-top: .6rem; font-size: 1.4rem; }
.profile-badges { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin-top: .3rem; }
.profile-card { text-align: left; }

/* Mein Konto: Aktive Sitzungen ("Meine Geraete") */
.session-row {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: .8rem 0; border-top: 1px solid var(--border);
}
.session-row:first-of-type { border-top: none; padding-top: 0; }
.session-device { font-weight: 600; font-size: .92rem; display: flex; align-items: center; gap: .5rem; }

/* Team-Chat */
.chat-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.chat-header h1 { font-size: 1.25rem; margin-bottom: .1rem; }
.chat-layout { display: flex; flex-direction: column; gap: 1.2rem; }
.chat-history { display: flex; flex-direction: column; gap: .3rem; width: 100%; }
.chat-main { width: 100%; }
.chat-new-btn { width: 100%; text-align: center; }
.chat-history-list { display: flex; flex-direction: column; gap: .25rem; margin: 0; padding: 0; list-style: none; }
.chat-history-row { display: flex; align-items: center; gap: .15rem; }
.chat-history-item {
    display: flex; align-items: flex-start; gap: .5rem; padding: .45rem .55rem; border-radius: 8px;
    color: var(--text); text-decoration: none; flex: 1; min-width: 0;
}
.chat-history-item:hover { background: var(--surface-alt); }
.chat-history-item.active { background: var(--accent-soft); }
.chat-history-icon { flex: none; }
.chat-history-text { display: flex; flex-direction: column; min-width: 0; }
.chat-history-title { font-size: .84rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-history-date { font-size: .72rem; color: var(--text-faint); }
.chat-history-delete-form { flex: none; }
.chat-history-delete {
    background: none; border: 0; cursor: pointer; font-size: .82rem; padding: .4rem .5rem;
    border-radius: 6px; color: var(--text-faint); line-height: 1;
}
.chat-history-delete:hover { background: var(--err-soft); color: var(--err); }
.chat-card { display: flex; flex-direction: column; gap: 1rem; }
.chat-thread { display: flex; flex-direction: column; gap: .7rem; max-height: 480px; overflow-y: auto; padding: 3px .3rem 3px 3px; }
.chat-row { display: flex; align-items: flex-end; gap: .5rem; }
.chat-row-assistant { align-self: flex-start; max-width: 94%; }
.chat-row-user { align-self: flex-end; flex-direction: row-reverse; max-width: 88%; }
.chat-row .avatar { flex: none; }
.chat-row .chat-bubble { max-width: 100%; min-width: 0; }
.chat-bubble { padding: .65rem .9rem; border-radius: 12px; font-size: .88rem; line-height: 1.5; max-width: 80%; overflow-wrap: anywhere; }
.chat-bubble-user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 3px; }
.chat-bubble-assistant { align-self: flex-start; background: var(--surface-alt); border: 1px solid var(--border); border-bottom-left-radius: 3px; max-width: 92%; }
.chat-bubble-assistant.prompt-render { max-height: none; overflow: visible; padding: .65rem .9rem; }
.chat-bubble-assistant p { margin: 0 0 .55rem; }
.chat-bubble-assistant p:last-child,
.chat-bubble-assistant ul:last-child,
.chat-bubble-assistant ol:last-child { margin-bottom: 0; }
.chat-bubble-assistant h1, .chat-bubble-assistant h2, .chat-bubble-assistant h3, .chat-bubble-assistant h4 { margin: .7rem 0 .35rem; font-size: 1rem; }
.chat-bubble-assistant h1:first-child, .chat-bubble-assistant h2:first-child, .chat-bubble-assistant h3:first-child, .chat-bubble-assistant h4:first-child { margin-top: 0; }
.chat-bubble-assistant ul, .chat-bubble-assistant ol { margin: 0 0 .55rem; padding-left: 1.2rem; }
.chat-bubble-assistant li { margin-bottom: .15rem; }
.md-image { max-width: 100%; border-radius: 8px; display: block; margin: .4rem 0; }
.chat-form { display: flex; flex-direction: column; gap: .6rem; }
.chat-form textarea {
    width: 100%; min-height: 200px; max-height: 500px; overflow-y: auto;
    resize: vertical; line-height: 1.55;
}
.chat-form-actions { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.chat-form-hint { font-size: .76rem; color: var(--text-faint); }
.chat-bubble-empty { background: var(--warn-soft); color: var(--warn); border: 1px dashed #e6c88a; }
.chat-bubble-streaming { min-width: 2.6rem; }
.chat-cursor { display: inline-block; margin-left: 1px; color: var(--text-muted); animation: chat-cursor-blink 1s steps(1) infinite; }
@keyframes chat-cursor-blink { 50% { opacity: 0; } }
.chat-stream-status { font-size: .82rem; color: var(--text-faint); font-style: italic; }
.chat-typing-dots { display: inline-flex; gap: .25rem; align-items: center; padding: .15rem 0; }
.chat-typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); animation: chat-typing-bounce 1.2s infinite ease-in-out; }
.chat-typing-dots span:nth-child(2) { animation-delay: .15s; }
.chat-typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes chat-typing-bounce { 0%, 80%, 100% { transform: scale(.6); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
.chat-trace { align-self: flex-start; max-width: 90%; margin-left: calc(28px + .5rem); font-size: .78rem; color: var(--text-muted); background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: .5rem .7rem; }
.chat-trace summary { cursor: pointer; font-weight: 600; }
.chat-trace ol { margin: .6rem 0 0; padding-left: 1.2rem; }
.chat-trace li { margin-bottom: .5rem; }
.chat-trace-reasoning strong { color: var(--text-faint); font-weight: 600; }
.chat-trace-tool_call strong { color: var(--accent-dark); }
.chat-trace-tool_result strong { color: #0f6b32; }
.chat-trace-detail { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .74rem; color: var(--text-faint); margin-top: .15rem; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 600px) {
    .chat-thread { max-height: 60vh; }
    .chat-row-assistant, .chat-row-user { max-width: 100%; }
}

/* Frage stellen (Startseite / Personalakte) */
.ask-box { display: flex; gap: .6rem; align-items: flex-end; margin-bottom: 1.6rem; }
.ask-box textarea { flex: 1; max-height: 500px; overflow-y: auto; line-height: 1.5; }
.ask-box textarea.is-expanded { min-height: 200px; }
.ask-box .btn { flex: none; }

/* Personalakten */
.char-counter { color: var(--text-faint); font-size: .76rem; margin-top: .25rem; text-align: right; }
.char-counter.over { color: var(--warn); font-weight: 600; }
.personnel-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: var(--shadow); color: var(--text); }
.personnel-card:hover { border-color: var(--accent); text-decoration: none; }
.personnel-card .name { font-weight: 650; font-size: 1rem; margin-bottom: .15rem; }
.personnel-card .role { color: var(--text-muted); font-size: .82rem; margin-bottom: .55rem; min-height: 1.2em; }
.ai-output { background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; max-height: 480px; overflow-y: auto; }

/* Schlanker Header fuer nicht-admin Mitarbeiter (nur Team-Startseite + Personalakten) */
.simple-shell { min-height: 100vh; display: flex; flex-direction: column; }
.simple-header {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1rem 2rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.simple-brand img { max-width: 150px; height: auto; display: block; }
.simple-header-user { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.user-name-light { font-size: .86rem; font-weight: 600; color: var(--text-muted); }
.link-btn-light { background: none; border: 0; color: var(--text-muted); font-size: .8rem; padding: 0; cursor: pointer; }
.link-btn-light:hover { color: var(--accent); text-decoration: underline; }
.simple-main { flex: 1; padding: 2rem 2.25rem 3rem; max-width: 1320px; margin: 0 auto; width: 100%; }

/* Einheitliches Mobil-Menue (siehe partials/mobile_nav.php): auf Desktop
   unsichtbar, auf schmalen Bildschirmen ersetzt es die sonst pro Seite
   unterschiedliche Icon-Reihe (Sidebar-Icons hier, schlanker Header dort)
   durch dieselbe aufklappbare Liste - egal auf welcher Seite man gerade
   ist, sieht ein Admin im Admin-Modus immer dasselbe Menue in derselben
   Reihenfolge, statt bei jeder Seite anders zusammengewuerfelter Icons
   ("springen"). Bewusst HIER platziert (nach .sidebar/.nav UND nach
   .simple-header/.simple-header-user): bei gleicher CSS-Spezifitaet
   gewinnt die spaeter im Stylesheet stehende Regel, unabhaengig davon,
   ob sie in einer @media-Klammer steht - stuende dieser Block vor den
   Basisregeln, wuerden .simple-header-user etc. hier wirkungslos
   ueberschrieben. */
.mobile-nav-toggle, .mobile-nav-overlay, .mobile-nav-drawer { display: none; }

@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar { position: static; width: 100%; height: auto; flex: none; }
    .brand { padding: .75rem 1rem; justify-content: space-between; }
    .brand-logo { max-width: 120px; }
    .nav, .sidebar-footer { display: none; }
    .main { padding: 1.2rem 1rem 2rem; }

    .simple-header { padding: .75rem 1rem; }
    .simple-brand img { max-width: 120px; }
    .simple-header-user, .simple-header > .badge { display: none; }
    .simple-main { padding: 1.2rem 1rem 2rem; }

    /* Auf Mobil uebernimmt das einheitliche Menue (siehe oben) die
       Navigation - die Breadcrumb-Zeile waere hier nur zusaetzliches
       Gedraenge auf wenig Platz. */
    .breadcrumbs { display: none; }

    /* Menue-Button */
    .mobile-nav-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 2.3rem; height: 2.3rem; border-radius: 8px; border: 1px solid var(--border);
        background: var(--surface); color: var(--text); font-size: 1.15rem; cursor: pointer; flex: none;
    }
    .sidebar .mobile-nav-toggle { background: #1c1f29; border-color: #2c303c; color: #fff; }

    /* Abdunklung + Schublade */
    .mobile-nav-overlay {
        display: block; position: fixed; inset: 0; background: rgba(10, 11, 15, .45);
        opacity: 0; pointer-events: none; transition: opacity .18s ease; z-index: 40;
    }
    .mobile-nav-drawer {
        display: flex; flex-direction: column; position: fixed; top: 0; right: 0; bottom: 0;
        width: min(84vw, 300px); background: var(--surface); box-shadow: -8px 0 28px rgba(0, 0, 0, .2);
        transform: translateX(100%); transition: transform .2s ease; z-index: 41; overflow-y: auto;
    }
    body.mobile-nav-open { overflow: hidden; }
    body.mobile-nav-open .mobile-nav-overlay { opacity: 1; pointer-events: auto; }
    body.mobile-nav-open .mobile-nav-drawer { transform: translateX(0); }

    .mobile-nav-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.1rem; border-bottom: 1px solid var(--border); flex: none; }
    .mobile-nav-drawer-head img { height: 26px; }
    .mobile-nav-close { background: none; border: 0; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--text-muted); padding: .2rem; }
    .mobile-nav-badge { padding: .2rem 1.1rem .7rem; }
    .mobile-nav-list { display: flex; flex-direction: column; padding: .5rem; gap: .1rem; }
    .mobile-nav-link, .mobile-nav-list form button {
        display: flex; align-items: center; gap: .8rem; padding: .8rem .8rem; border-radius: 8px;
        font-size: .95rem; font-weight: 550; color: var(--text); background: none; border: 0;
        width: 100%; text-align: left; cursor: pointer; font-family: inherit;
    }
    .mobile-nav-link:hover, .mobile-nav-list form button:hover { background: var(--surface-alt); text-decoration: none; }
    .mobile-nav-link.active { background: var(--accent-soft); color: var(--accent-dark); }
    .mobile-nav-list .nav-icon { font-size: 1.15rem; }
    .mobile-nav-divider { height: 1px; background: var(--border); margin: .5rem .4rem; flex: none; }
}

/* Team-Startseite */
.team-head { margin-bottom: 1.4rem; }
.team-head h1 { font-size: 1.6rem; }
.ring-legend { display: flex; gap: 1.2rem; margin-top: .6rem; font-size: .78rem; color: var(--text-muted); }
.ring-legend span { display: inline-flex; align-items: center; gap: .5rem; }
.ring-swatch { width: 12px; height: 12px; border-radius: 50%; background: var(--surface); flex: none; }
.admin-panel { margin-bottom: 1.5rem; }
.admin-panel summary { cursor: pointer; font-weight: 600; font-size: .84rem; color: var(--text-muted); }
.admin-panel-body { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-top: .8rem; padding: .9rem 1.1rem; background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius); }
.team-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 1.6rem; }
.team-search {
    flex: 0 1 260px; padding: .5rem .8rem; border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface); font-size: .86rem; color: var(--text);
}
.team-sort-label {
    display: inline-flex; align-items: center; gap: .4rem; margin-left: auto;
    font-size: .78rem; font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
.team-sort {
    flex: 0 0 auto; width: auto; padding: .3rem .55rem; border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface); font-size: .8rem; color: var(--text);
}
.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 0; }
.filter-chip {
    display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .9rem; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); font-size: .82rem; font-weight: 600;
    color: var(--text-muted); cursor: pointer;
}
.filter-chip:hover { border-color: var(--chip-color, var(--accent)); }
.filter-chip.active { background: var(--text); color: #fff; border-color: var(--text); }
.filter-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.4rem; }
.team-card {
    position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .55rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.6rem 1rem; box-shadow: var(--shadow); color: var(--text);
}
.team-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.team-card-name { font-weight: 650; font-size: 1rem; }
.team-card-title { color: var(--text-muted); font-size: .82rem; }
.team-card-cat { font-size: .74rem; font-weight: 650; }
.avatar-wrap { position: relative; display: inline-flex; }
.chat-status-badge {
    position: absolute; top: 4px; right: 4px; width: 26px; height: 26px;
    object-fit: contain;
    filter: drop-shadow(0 1px 1px rgba(20, 22, 30, .3));
}
/* Reine Gesprächszahl, direkt über dem Chat-Symbol rechts oben. */
.chat-conversation-count {
    position: absolute; top: 10px; right: 15px; z-index: 2;
    display: block; margin: 0; padding: 0; min-width: 0; height: auto;
    background: transparent; border: 0; border-radius: 0; box-shadow: none;
    color: #111; font-family: Arial, sans-serif; font-size: 10px; font-weight: 700; line-height: 1;
    pointer-events: none;
}

/* Vorschlaege zur Frage (prozentuale Uebereinstimmung) */
.match-card-form { display: contents; }
button.match-card { font: inherit; cursor: pointer; width: 100%; }
button.match-card:hover { border-color: var(--accent); }
.match-percent {
    position: absolute; inset: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: rgba(10, 10, 15, .55); color: #fff; font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em;
}

/* App-Footer (Nuetzliche Links + Kontakt + Langdock/Nutzer-Infos), 3-spaltig,
   am Ende jedes Seiteninhalts */
.app-footer { margin-top: 2.5rem; padding-top: 1.4rem; border-top: 1px solid var(--border); }
.app-footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.8rem; font-size: .82rem; color: var(--text-muted); }
.app-footer-col p { margin: 0 0 .5rem; }
.app-footer-col a { color: var(--text-muted); }
.app-footer-col a:hover { color: var(--accent); }
.app-footer-list { list-style: none; margin: 0 0 .8rem; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.app-footer-address { color: var(--text-faint); font-size: .8rem; line-height: 1.5; }
.app-footer-muted { color: var(--text-faint); font-size: .78rem; line-height: 1.5; }
@media (max-width: 700px) {
    .app-footer-cols { grid-template-columns: 1fr; gap: 1.3rem; }
}

/* KI-Kurzbeschreibung */
.bio-card p:last-of-type { margin-bottom: .9rem; }
.bio-punkte { margin: 0; padding-left: 1.1rem; font-size: .86rem; color: var(--text); }
.bio-punkte li { margin-bottom: .3rem; }

/* Statistik: einfaches CSS-Balkendiagramm ohne Chart-Bibliothek */
.stat-bars { display: flex; align-items: flex-end; gap: .3rem; height: 140px; padding-top: 1rem; }
.stat-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: .3rem; }
.stat-bar { width: 100%; min-height: 2px; background: var(--accent); border-radius: 3px 3px 0 0; }
.stat-bar-label { font-size: .68rem; color: var(--text-faint); }
