/* ============================================================
   oh!Power! – Design System v2
   CI: Schwarz #262626, Grün #63B12C, Poppins
   ============================================================ */

:root {
    /* Primär */
    --black: #262626;
    --green: #63B12C;
    --green-muted: #3F7A1A; /* WCAG AA: 5,0:1 auf Weiß (vorher #4A8820 = 4,34:1) */
    --green-bg: rgba(99, 177, 44, 0.10);
    --green-bg-strong: rgba(99, 177, 44, 0.15);

    /* Neutral */
    --bg: #FAFAFA;
    --white: #FFFFFF;
    --border-light: #E8E8E8;
    --border-medium: #D0D0D0;
    --text-primary: #262626;
    --text-secondary: #6B6B6B;
    --text-muted: #9A9A9A;
    --text-disabled: #C0C0C0;

    /* Status */
    --success: #63B12C;
    --warning: #E8A82C;
    --error: #D04545;
    --info: #4A7BC8;

    /* Layout */
    --sidebar-collapsed: 56px;
    --sidebar-expanded: 240px;
    --topbar-height: 56px;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px; /* Dashboard-Widgets */
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: 'Poppins', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--green-muted); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ───────────────────────────────── */
.h1, h1 { font-size: 28px; font-weight: 700; line-height: 1.2; color: var(--black); letter-spacing: -0.01em; }
.h2, h2 { font-size: 20px; font-weight: 600; line-height: 1.3; color: var(--black); }
.h3, h3 { font-size: 16px; font-weight: 500; line-height: 1.4; color: var(--black); }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.label-text { font-size: 12px; font-weight: 500; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); }

.brand-oh { color: var(--text-primary); }
.brand-power { color: var(--green); }
.brand-logo { height: 24px; width: auto; display: block; }

/* ── Topbar ───────────────────────────────────── */
/* ── Topbar (rechts neben Sidebar, wie Oh!Base!) ── */
.topbar {
    position: sticky; top: 0;
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-mobile-menu {
    display: none; /* Nur auf Mobile sichtbar */
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; padding: 8px; border-radius: var(--radius-sm);
    align-items: center; justify-content: center;
}

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.user-name { color: var(--text-primary); font-size: 13px; font-weight: 500; }
.user-role { color: var(--text-muted); font-size: 11px; text-transform: capitalize; }
.topbar-logout {
    color: var(--text-muted); display: flex; align-items: center;
    padding: 8px; border-radius: var(--radius-sm); transition: all 0.15s;
}
.topbar-logout:hover { color: var(--error); background: rgba(208,69,69,0.06); text-decoration: none; }

/* ── Scope-Wechsler ───────────────────────────── */
.scope-switcher { position: relative; }
.scope-trigger {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; height: 36px;
    background: var(--white); border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm); cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 500; color: var(--text-primary);
    transition: border-color 0.15s;
}
.scope-trigger:hover { border-color: var(--green); }
.scope-trigger svg { color: var(--text-muted); }
.scope-dropdown {
    display: none; position: absolute; top: calc(100% + 4px); right: 0;
    min-width: 200px; background: var(--white);
    border: 1px solid var(--border-light); border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); z-index: 200; overflow: hidden;
}
.scope-dropdown.open { display: block; }
.scope-option {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; font-size: 14px; font-weight: 500;
    color: var(--text-primary); cursor: pointer; transition: background 0.1s;
    text-decoration: none;
}
.scope-option:hover { background: var(--bg); text-decoration: none; }
.scope-option.active { background: var(--green-bg); }
.scope-option .check-icon { color: var(--green); width: 16px; }
.scope-option .scope-hint { font-size: 11px; color: var(--text-muted); margin-left: auto; }

/* ── Sidebar (Oh!Base!-Muster: Overlay-Expand) ── */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-collapsed);
    background: var(--white); border-right: 1px solid var(--border-light);
    display: flex; flex-direction: column; z-index: 40;
    transition: width 0.2s cubic-bezier(0.25,0.1,0.25,1), box-shadow 0.2s;
    transition-delay: 200ms; /* Schließen verzögert (wie Oh!Base!) */
    overflow: hidden;
}
.sidebar:hover, .sidebar-expanded .sidebar {
    width: var(--sidebar-expanded); box-shadow: 4px 0 24px rgba(0,0,0,0.06);
    transition-delay: 0ms; /* Öffnen sofort */
}

/* Sidebar Header: Logo + Hamburger */
.sidebar-header {
    height: var(--topbar-height); display: flex; align-items: center;
    border-bottom: 1px solid var(--border-light); flex-shrink: 0;
    padding: 0 6px; transition: padding 0.2s cubic-bezier(0.25,0.1,0.25,1);
}
.sidebar:hover .sidebar-header, .sidebar-expanded .sidebar-header {
    justify-content: space-between; padding: 0 10px 0 16px;
}
.sidebar-logo-link { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; padding: 0 4px; }
.sidebar-logo-icon { width: 36px; height: auto; display: block; }
.sidebar-logo-full { height: 22px; width: auto; display: none; }
.sidebar:hover .sidebar-logo-icon, .sidebar-expanded .sidebar-logo-icon { display: none; }
.sidebar:hover .sidebar-logo-full, .sidebar-expanded .sidebar-logo-full { display: block; }
.sidebar-toggle {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; flex-shrink: 0;
    opacity: 0; transition: opacity 120ms, background 120ms;
}
.sidebar:hover .sidebar-toggle, .sidebar-expanded .sidebar-toggle { opacity: 1; transition-delay: 80ms; }
.sidebar-toggle:hover { background: rgba(0,0,0,0.04); }

/* Sidebar Nav */
.sidebar-nav {
    list-style: none; padding: 8px 6px; flex: 1; overflow-y: auto; overflow-x: hidden;
    scrollbar-width: thin; scrollbar-color: var(--border-light) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
.sidebar-link {
    display: flex; align-items: center; height: 34px; padding: 0 14px; margin-bottom: 1px;
    border-radius: var(--radius-sm); text-decoration: none;
    color: var(--text-secondary); font-size: 14px; font-weight: 500;
    white-space: nowrap; transition: background 120ms, color 120ms;
    position: relative;
}
.sidebar-link svg { flex-shrink: 0; width: 18px; height: 18px; }
.sidebar-link span {
    margin-left: 12px; flex: 1; opacity: 0; transform: translateX(-4px);
    transition: opacity 120ms, transform 180ms;
}
.sidebar:hover .sidebar-link span, .sidebar-expanded .sidebar-link span {
    opacity: 1; transform: translateX(0); transition-delay: 60ms;
}
.sidebar-link:hover { background: rgba(0,0,0,0.03); color: var(--text-primary); text-decoration: none; }
.sidebar-link.active { background: var(--green-bg); color: var(--text-primary); }
.sidebar-link.active::before {
    content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
    width: 3px; background: var(--green); border-radius: 0 2px 2px 0;
}
.sidebar-link.active svg { stroke: var(--green); }
.sidebar-sub {
    list-style: none; padding: 0 0 4px 30px; overflow: hidden;
    max-height: 0; transition: max-height 220ms ease;
}
.sidebar:hover .sidebar-sub, .sidebar-expanded .sidebar-sub { max-height: 720px; }
body:not(.sidebar-expanded) .sidebar:not(:hover) .sidebar-sub { max-height: 0 !important; }
.sidebar-sublink {
    display: flex; justify-content: space-between; align-items: center;
    height: 30px; padding: 0 10px;
    font-size: 13px; font-weight: 500; color: var(--text-muted);
    text-decoration: none; border-radius: var(--radius-sm); transition: background 120ms, color 120ms;
    position: relative;
}
.sidebar-sublink:hover { background: rgba(0,0,0,0.03); color: var(--text-primary); text-decoration: none; }
.sidebar-counter { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.sidebar-sublink.active { color: var(--green-muted); font-weight: 600; }
.sidebar-sublink.active::before {
    content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px;
    width: 2px; background: var(--green); border-radius: 1px;
}

/* Sidebar: aufklappbare Gruppen innerhalb von Sub-Navigationen */
.sidebar-gruppe { margin-top: 2px; }
.sidebar-gruppe-kopf {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    height: 26px; padding: 0 10px; border: none; background: none; cursor: pointer;
    font-family: inherit; font-size: 10.5px; font-weight: 600; letter-spacing: 0.07em;
    text-transform: uppercase; color: var(--text-muted); border-radius: var(--radius-sm);
    transition: color 120ms, background 120ms;
}
.sidebar-gruppe-kopf:hover { color: var(--text-primary); background: rgba(0,0,0,0.03); }
.sidebar-gruppe-kopf svg { transition: transform 160ms; flex: none; }
.sidebar-gruppe.offen > .sidebar-gruppe-kopf svg { transform: rotate(180deg); }
.sidebar-gruppe-liste {
    list-style: none; margin: 0; padding: 0 0 0 8px; overflow: hidden;
    max-height: 0; transition: max-height 200ms ease;
}
.sidebar-gruppe.offen > .sidebar-gruppe-liste { max-height: 400px; }

/* Sidebar Footer: User Card (wie Oh!Base!) */
.sidebar-footer {
    border-top: 1px solid var(--border-light); padding: 8px 6px; flex-shrink: 0;
}
.sidebar-user-card {
    display: flex; align-items: center; padding: 6px 8px;
    border-radius: var(--radius-sm); transition: background 120ms;
}
.sidebar-user-card:hover { background: rgba(0,0,0,0.03); }
.sidebar-user-avatar {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, #4a8820, #6fb83e); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 10.5px; font-weight: 600;
}
.sidebar-user-info {
    margin-left: 10px; flex: 1; min-width: 0;
    opacity: 0; transition: opacity 120ms; overflow: hidden;
}
.sidebar:hover .sidebar-user-info, .sidebar-expanded .sidebar-user-info { opacity: 1; transition-delay: 80ms; }
.sidebar-user-name {
    font-size: 13px; font-weight: 500; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.sidebar-logout {
    color: var(--text-muted); display: flex; align-items: center; padding: 4px;
    border-radius: var(--radius-sm); opacity: 0; transition: opacity 120ms, color 120ms;
    text-decoration: none;
}
.sidebar:hover .sidebar-logout, .sidebar-expanded .sidebar-logout { opacity: 1; transition-delay: 80ms; }
.sidebar-logout:hover { color: var(--error); text-decoration: none; }

/* powered by aPunkt AI (wie Dickreich-Demo) */
.sidebar-powered {
    display: flex; align-items: center; padding: 6px 8px; margin-top: 4px;
    border-top: 1px solid var(--border-light);
    text-decoration: none; white-space: nowrap;
}
.sidebar-powered:hover { text-decoration: none; }
.sidebar-powered-icon { width: 28px; height: 28px; flex-shrink: 0; }
.sidebar-powered-text {
    margin-left: 10px; font-size: 11px; color: var(--text-muted);
    opacity: 0; transition: opacity 120ms; overflow: hidden;
}
.sidebar:hover .sidebar-powered-text, .sidebar-expanded .sidebar-powered-text { opacity: 1; transition-delay: 80ms; }
.sidebar-powered-text b { font-weight: 600; color: var(--text-secondary); }
.sidebar-powered:hover .sidebar-powered-text b { color: #00AFB9; }

/* ── Content ──────────────────────────────────── */
/* ── Main Area (rechts neben Sidebar, wie Oh!Base!) ── */
.main-area {
    margin-left: var(--sidebar-collapsed);
    flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}
.content {
    padding: 24px 32px 32px; flex: 1;
}

/* Layout-Typen */
.page-wide { max-width: 1600px; }
.page-comfortable { max-width: 1600px; }
.page-narrow { max-width: 800px; }
.page-full { padding: 0 !important; width: calc(100vw - var(--sidebar-collapsed)); overflow-x: hidden; }
.sidebar-expanded .page-full { width: calc(100vw - var(--sidebar-expanded)); }

/* ── Page Header ──────────────────────────────── */
.page-header { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border-light); }
.page-header-flex { display: flex; justify-content: space-between; align-items: flex-start; }
.page-subtitle { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

/* ── Breadcrumb ───────────────────────────────── */
.breadcrumb { font-size: 13px; margin-bottom: 12px; color: var(--text-muted); }
.breadcrumb a { color: var(--green-muted); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { margin: 0 6px; color: var(--text-disabled); }

/* ── Buttons ──────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border: none; border-radius: var(--radius-sm);
    font: inherit; font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all 0.15s; text-decoration: none; line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--green-muted); }
.btn-secondary { background: var(--white); color: var(--text-primary); border: 1px solid var(--border-medium); }
.btn-secondary:hover { background: #F4F4F4; }
.btn-ghost { background: transparent; color: var(--text-secondary); padding: 8px 16px; }
.btn-ghost:hover { background: rgba(0,0,0,0.04); }
.btn-ghost-danger { background: transparent; color: var(--error); padding: 8px 16px; }
.btn-ghost-danger:hover { background: rgba(208,69,69,0.06); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-full { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-sm); background: transparent; }
.btn-icon:hover { background: rgba(0,0,0,0.06); }

/* ── Cards ────────────────────────────────────── */
.card {
    background: var(--white); border: 1px solid var(--border-light);
    border-radius: var(--radius); padding: 20px;
}
.card-link { text-decoration: none; display: block; transition: border-color 0.15s, box-shadow 0.15s; cursor: pointer; }
.card-link:hover { border-color: var(--border-medium); box-shadow: 0 1px 4px rgba(0,0,0,0.05); text-decoration: none; }
.card-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.card-meta { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.card-desc { font-size: 13px; color: var(--text-secondary); margin-top: 8px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Badges ───────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; height: 22px;
    padding: 0 8px; border-radius: 4px;
    font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-neutral { background: #F0F0F0; color: var(--text-secondary); }
.badge-success { background: var(--green-bg-strong); color: var(--green-muted); }
.badge-warning { background: rgba(232,168,44,0.12); color: #B8851F; }
.badge-error { background: rgba(208,69,69,0.12); color: #B83838; }
.badge-info { background: rgba(74,123,200,0.12); color: #3A65A8; }

.scope-badge { display: none; }
.scope-badge.visible { display: inline-flex; }

/* ── Filter ───────────────────────────────────── */
.filter-bar { margin-top: 16px; margin-bottom: 20px; }
.filter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
    display: inline-flex; align-items: center; height: 34px;
    padding: 0 14px; border-radius: 17px;
    border: 1px solid var(--border-medium); background: var(--white);
    font-size: 13px; font-weight: 500; color: var(--text-secondary);
    text-decoration: none; transition: all 0.15s; cursor: pointer;
}
.chip:hover { background: #F8F8F8; text-decoration: none; }
.chip-active, .chip.active { background: var(--green-bg); border-color: var(--green); color: var(--green-muted); }
.filter-search { display: flex; gap: 6px; }
.filter-search input {
    height: 34px; padding: 0 12px; border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm); font: inherit; font-size: 13px; width: 240px;
}
.filter-search input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(99,177,44,0.12); }

/* ── Forms ────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 6px;
}
.form-group label .required { color: var(--error); }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; max-width: 480px; height: 40px; padding: 0 12px;
    border: 1px solid var(--border-medium); border-radius: var(--radius-sm);
    font: inherit; font-size: 14px; color: var(--text-primary); background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.form-group select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239A9A9A' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
/* Wiederverwendbarer App-Chevron für freistehende native Selects (statt nativem Browser-Pfeil) */
.select-chevron { appearance: none; -webkit-appearance: none; -moz-appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239A9A9A' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px !important; }

/* ── Pilot: Bild-Karte zur Antwort (Katalog-Foto oder frei lizenziertes Wikimedia-Bild) ── */
.pilot-bild-card { margin-top: 8px; max-width: 260px; border: 1px solid var(--border-light); border-radius: 10px; overflow: hidden; background: #fff; }
.pilot-bild-card img { display: block; width: 100%; max-height: 200px; object-fit: contain; background: #fff; }
.pilot-bild-meta { padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; }
.pilot-bild-titel { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.3; }
.pilot-bild-links { display: flex; flex-wrap: wrap; gap: 10px; }
.pilot-bild-link { font-size: 11px; color: var(--green); text-decoration: none; white-space: nowrap; }
.pilot-bild-link:hover { text-decoration: underline; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(99,177,44,0.12); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-disabled); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row .form-group input, .form-row .form-group select { max-width: 100%; }
.form-actions { margin-top: 24px; display: flex; gap: 12px; align-items: center; }
.helper-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.error-text { font-size: 12px; font-weight: 500; color: var(--error); margin-top: 4px; }

/* ── Form Wide (Produkt-Edit etc.) ───────────── */
.form-wide { max-width: 1200px; }
.form-wide .form-group input,
.form-wide .form-group textarea,
.form-wide .form-group select { max-width: 100%; }
.form-wide .form-select { max-width: 100%; }
.form-wide .form-section-narrow { max-width: 720px; }
.form-wide .form-section-narrow .form-select { max-width: 480px; }
.form-wide textarea.textarea-lg { min-height: 160px; }
.form-wide textarea.textarea-md { min-height: 120px; }
.form-section { margin-bottom: 8px; }
.form-section-title {
    font-size: 16px; font-weight: 500; color: var(--black);
    padding-bottom: 12px; margin-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 768px) {
    .form-row-3 { grid-template-columns: 1fr; }
}

/* ── Tables ───────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%; border-collapse: collapse; background: var(--white);
    border: 1px solid var(--border-light); border-radius: var(--radius); overflow: hidden;
}
.data-table th {
    padding: 12px 16px; text-align: left;
    font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted); background: var(--bg); border-bottom: 1px solid var(--border-light);
}
.data-table td {
    padding: 14px 16px; font-size: 14px; vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr[onclick]:hover td, .data-table tr.clickable:hover td { background: var(--bg); cursor: pointer; }
.data-table a { color: var(--text-primary); }
.data-table a:hover { color: var(--green-muted); }
.data-table tr.row-muted td { color: var(--text-muted); }
.data-table tr.row-muted td strong { color: var(--text-secondary); font-weight: 500; }
.table-hint { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Row Menu (⋯ Drei-Punkte-Menü) ──────────── */
.row-menu { position: relative; }
.row-menu-trigger {
    background: none; border: none; font-size: 18px; color: var(--text-muted);
    cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm);
    transition: background 0.1s; line-height: 1;
}
.row-menu-trigger:hover { background: rgba(0,0,0,0.04); color: var(--text-primary); }
.row-menu-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 2px);
    min-width: 160px; background: var(--white);
    border: 1px solid var(--border-light); border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); z-index: 200; overflow: hidden;
}
.row-menu.open .row-menu-dropdown { display: block; }
.row-menu-item {
    display: block; width: 100%; padding: 9px 14px;
    font: inherit; font-size: 13px; font-weight: 500;
    color: var(--text-primary); text-decoration: none; text-align: left;
    border: none; background: none; cursor: pointer;
    transition: background 0.1s;
}
.row-menu-item:hover { background: var(--bg); text-decoration: none; }
.row-menu-danger { color: var(--error); }
.row-menu-danger:hover { background: rgba(208,69,69,0.06); }

/* ── Badge-Button (klickbar) ─────────────────── */
.badge-btn {
    display: inline-flex; align-items: center; height: 22px;
    padding: 0 8px; border-radius: 4px; border: none;
    font: inherit; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px;
    cursor: pointer; transition: all 0.15s;
}
.badge-btn-active { background: var(--green-bg-strong); color: var(--green-muted); }
.badge-btn-active:hover { background: var(--green-bg); outline: 1px solid var(--green); }
.badge-btn-muted { background: #F0F0F0; color: var(--text-muted); }
.badge-btn-muted:hover { background: #E8E8E8; outline: 1px solid var(--border-medium); }

/* ── Bulk-Bar ────────────────────────────────── */
.bulk-bar {
    background: var(--white); border: 1px solid var(--border-light); border-radius: var(--radius);
    padding: 10px 16px; margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.bulk-bar form { display: flex; align-items: center; gap: 10px; }

/* ── Alerts ───────────────────────────────────── */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px;
    margin-bottom: 16px; border-left: 3px solid;
}
.alert-success { background: rgba(99,177,44,0.08); border-color: var(--success); color: var(--green-muted); }
.alert-error { background: rgba(208,69,69,0.06); border-color: var(--error); color: var(--error); }
.alert-warning { background: rgba(232,168,44,0.06); border-color: var(--warning); color: #9A6B10; }
.alert-info { background: rgba(74,123,200,0.06); border-color: var(--info); color: #3A65A8; }

/* ── Grid ─────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Empty State ──────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon { margin-bottom: 12px; color: var(--text-muted); }
.empty-state h2 { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.empty-state p { color: var(--text-secondary); margin-top: 6px; font-size: 14px; }
.empty-state .btn { margin-top: 16px; }

/* ── Detail Page ──────────────────────────────── */
.detail-grid { display: flex; flex-direction: column; gap: 20px; }
.detail-fields { margin-top: 12px; }
.detail-field { padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.detail-field:last-child { border-bottom: none; }
.field-label { display: block; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px; }
.detail-field a { color: var(--green-muted); }

/* ── Produkt-Liste in Detail ──────────────────── */
.produkt-list { margin-top: 12px; }
.produkt-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid var(--border-light);
    text-decoration: none; color: var(--text-primary); transition: color 0.1s;
}
.produkt-item:hover { color: var(--green-muted); text-decoration: none; }
.produkt-item:last-child { border-bottom: none; }
.produkt-name { font-size: 14px; font-weight: 500; }
.produkt-kat { font-size: 12px; color: var(--text-muted); }

/* ── Login ────────────────────────────────────── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card { background: var(--white); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 36px 32px; }
.login-brand { text-align: center; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.login-subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }
.login-error { background: rgba(208,69,69,0.06); border: 1px solid rgba(208,69,69,0.2); border-left: 3px solid var(--error); color: var(--error); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.login-form .form-group input { max-width: 100%; }
.login-form .btn { margin-top: 8px; }
.login-footer { text-align: center; font-size: 11px; color: var(--text-muted); margin-top: 24px; }

/* ── Markdown body (shared) ───────────────────── */
.markdown-body { font-size: 14px; line-height: 1.6; color: var(--text-primary); }
.markdown-body p { margin-bottom: 8px; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body strong { font-weight: 600; }
.markdown-body ul, .markdown-body ol { margin: 8px 0; padding-left: 20px; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body blockquote { border-left: 3px solid var(--border-medium); padding-left: 12px; color: var(--text-secondary); margin: 8px 0; }
.markdown-body code { background: var(--bg); padding: 2px 6px; border-radius: 3px; font-size: 13px; }
.markdown-body pre { background: var(--bg); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; margin: 8px 0; }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.markdown-body th, .markdown-body td { padding: 6px 10px; border: 1px solid var(--border-light); text-align: left; font-size: 13px; }
.markdown-body th { background: var(--bg); font-weight: 500; }

/* ── Detail page 2-col layout ────────────────── */
.detail-2col { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }

/* ── Image lightbox ──────────────────────────── */
.lightbox-overlay {
    display: none; position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.85); align-items: center; justify-content: center;
    cursor: zoom-out;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: 8px; }
.lightbox-close {
    position: absolute; top: 16px; right: 16px;
    background: rgba(0,0,0,0.5); border: none; color: #fff;
    width: 40px; height: 40px; border-radius: 20px;
    font-size: 24px; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(0,0,0,0.8); }

/* ── Drag-Sortable (Medien) ──────────────── */
.drag-handle {
    cursor: grab; color: var(--text-muted); font-size: 14px;
    padding: 4px 2px; flex-shrink: 0; user-select: none;
    transition: color 0.1s;
}
.drag-handle:hover { color: var(--text-primary); }
.medien-item.dragging { opacity: 0.4; }
.medien-item.drag-over { border-top: 2px solid var(--green); }

/* ── Medien-Bibliothek ───────────────────── */
.mbib-group { margin-bottom: 4px; }
.mbib-group-header {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 0; cursor: pointer; user-select: none;
    border-bottom: 1px solid var(--border-light);
}
.mbib-group-header strong { font-size: 13px; }
.mbib-group-chevron { font-size: 10px; color: var(--text-muted); transition: transform 0.15s; }
.mbib-group.collapsed .mbib-group-chevron { transform: rotate(-90deg); }
.mbib-group.collapsed .mbib-group-body { display: none; }
.mbib-group-count {
    font-size: 11px; color: var(--text-muted); background: var(--bg);
    padding: 1px 7px; border-radius: 8px;
}

.mbib-row {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 0; border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.mbib-row:last-child { border-bottom: none; }

.mbib-thumb {
    width: 36px; height: 36px; border-radius: 4px; flex-shrink: 0;
    object-fit: cover; border: 1px solid var(--border-light);
}
.mbib-thumb-pdf {
    background: #FFF0F0; border-color: #E8D0D0; color: #B83838;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700;
}
.mbib-thumb-img {
    background: var(--green-bg); border-color: var(--green); color: var(--green-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700;
}
.mbib-thumb-doc {
    background: var(--bg); color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 8px; font-weight: 700;
}

.mbib-info { flex: 1; min-width: 0; }
.mbib-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; font-weight: 500; }
.mbib-badge { font-size: 9px; flex-shrink: 0; }
.mbib-meta { font-size: 11px; color: var(--text-muted); flex-shrink: 0; min-width: 60px; text-align: right; }

.mbib-actions {
    display: flex; gap: 6px; align-items: center; flex-shrink: 0;
}
.mbib-actions a, .mbib-actions button {
    color: var(--text-muted); transition: color 0.1s;
}
.mbib-actions a:hover { color: var(--green-muted); text-decoration: none; }
.mbib-actions button:hover { color: var(--error); }

@media (max-width: 640px) {
    .mbib-row { flex-wrap: wrap; gap: 6px; }
    .mbib-meta { display: none; }
    .mbib-badge { display: none; }
    .mbib-info { min-width: 60%; }
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .detail-2col { grid-template-columns: 1fr 300px; }
}
@media (max-width: 768px) {
    .detail-2col { grid-template-columns: 1fr; }
    .content { padding: 20px 16px 24px; }
    h1 { font-size: 22px; }
    .data-table th { font-size: 10px; padding: 10px 12px; }
    .data-table td { padding: 12px; font-size: 13px; }
    .table-wrap { -webkit-overflow-scrolling: touch; }
    .table-wrap::after {
        content: ''; position: sticky; right: 0; top: 0; bottom: 0;
        width: 24px; pointer-events: none;
        background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
    }
    .btn { padding: 12px 20px; min-height: 44px; }
    .btn-sm { padding: 10px 14px; min-height: 40px; }
    .chip { height: 38px; padding: 0 16px; }
    .search-input-wrap input { max-width: 100%; height: 40px; }
}
@media (max-width: 768px) {
    .topbar-mobile-menu { display: flex; }
    .sidebar { transform: translateX(-100%); width: var(--sidebar-expanded); pointer-events: none; }
    .sidebar:hover { width: var(--sidebar-expanded); }
    .sidebar-expanded .sidebar { transform: translateX(0); pointer-events: auto; }
    .sidebar-expanded .sidebar-overlay { display: block; }
    .main-area { margin-left: 0; }
    .content { padding: 16px 12px 24px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .page-header-flex { flex-direction: column; gap: 12px; }
    .page-header-flex .btn { width: 100%; }
    .filter-row { flex-direction: column; align-items: stretch; }
    .filter-chips { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
    .filter-search input { width: 100%; }
    .topbar-user { display: none; }
    .scope-switcher .scope-trigger span { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
    .card { padding: 16px; }
    .form-group input, .form-group textarea, .form-group select { max-width: 100%; }

    /* Gallery thumbnails: horizontal scroll on mobile */
    .gallery-thumbs { overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; }
    .gallery-thumbs img { scroll-snap-align: start; flex-shrink: 0; }

    /* Download buttons: full-width on mobile */
    .doc-download-btn { width: 100%; justify-content: center; margin-top: 8px; }
}
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 80;
}

/* ── Custom Select (reusable) ─────────────────── */
.custom-select { position: relative; }
.custom-select-trigger {
    display: flex; align-items: center; gap: 6px;
    padding: 0 12px; height: 34px;
    background: var(--white); border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm); cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 500; color: var(--text-primary);
    transition: border-color 0.15s; white-space: nowrap;
}
.custom-select-trigger:hover { border-color: var(--green); }
.custom-select-trigger svg { color: var(--text-muted); flex-shrink: 0; }
.custom-select-dropdown {
    display: none; position: absolute; top: calc(100% + 4px); left: 0;
    min-width: 200px; max-height: 320px; overflow-y: auto;
    background: var(--white); border: 1px solid var(--border-light);
    border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    z-index: 200;
}
.custom-select.open .custom-select-dropdown { display: block; }
.custom-select-option {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 14px; font-size: 13px; font-weight: 500;
    color: var(--text-primary); cursor: pointer; text-decoration: none;
    transition: background 0.1s;
}
.custom-select-option:hover { background: var(--bg); text-decoration: none; }
.custom-select-option.active { background: var(--green-bg); }
.custom-select-option .check-icon { color: var(--green); flex-shrink: 0; }

/* ── Scrollable Filter Chips (POLISH-7) ───────── */
/* Filter-Chips wrap naturally (no scroll) */
.filter-chips-wrap { flex: 1; min-width: 0; }
.filter-chips-wrap .filter-chips { flex-wrap: wrap; gap: 8px; }

/* ── Sidebar Footer Fix (POLISH-2) ────────────── */
.sidebar-footer span { opacity: 0; transition: opacity 0.15s; }
.sidebar:hover .sidebar-footer span { opacity: 1; }

/* ── Login v2 (Split-Layout) ─────────────────── */
.login-page-v2 {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: var(--bg); padding: 24px;
}
.login-outer { width: 100%; max-width: 960px; }
.login-split {
    display: flex; background: var(--white);
    border-radius: 16px; overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}

/* Left column */
.login-left {
    flex: 1; background: var(--black); color: #fff;
    padding: 48px; display: flex; flex-direction: column;
    position: relative; overflow: hidden; min-height: 520px;
}
.login-left-deco {
    position: absolute; right: -100px; top: 50%; transform: translateY(-50%);
    width: 280px; height: 280px; border-radius: 50%;
    background: var(--green); opacity: 0.12; filter: blur(8px);
    pointer-events: none;
}
.login-left-content { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100%; }
.login-left-brand { font-size: 24px; font-weight: 700; color: #fff; letter-spacing: -0.01em; }
.login-headline { font-size: 32px; font-weight: 700; line-height: 1.2; color: #fff; }
.login-pitch {
    margin-top: 16px; font-size: 15px; line-height: 1.5;
    color: rgba(255,255,255,0.7); max-width: 360px;
}
.login-features { list-style: none; }
.login-features li {
    display: flex; align-items: center; gap: 12px;
    font-size: 14px; color: #fff; padding: 6px 0;
}
.login-features li::before {
    content: ''; width: 8px; height: 8px; border-radius: 50%;
    background: var(--green); flex-shrink: 0;
}
.login-copyright { font-size: 12px; color: rgba(255,255,255,0.4); }

/* Right column */
.login-right {
    flex: 1; padding: 48px; display: flex; align-items: center; justify-content: center;
}
.login-right-content { width: 100%; max-width: 360px; }
.login-title { font-size: 24px; font-weight: 700; color: var(--text-primary); }
.login-subtitle-v2 { font-size: 14px; color: var(--text-secondary); margin-top: 4px; margin-bottom: 32px; }

.login-form-v2 .form-group { margin-bottom: 16px; }
.login-form-v2 .form-group label {
    display: block; font-size: 12px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-secondary); margin-bottom: 6px;
}

.input-icon-wrap { position: relative; }
.input-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none; transition: color 0.15s;
}
.input-icon-wrap input {
    width: 100%; height: 44px; padding: 0 14px 0 42px;
    border: 1px solid var(--border-medium); border-radius: var(--radius-sm);
    font: inherit; font-size: 14px; color: var(--text-primary); background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input-icon-wrap input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(99,177,44,0.15); }
.input-icon-wrap input:focus ~ .input-icon,
.input-icon-wrap input:focus + .input-icon { color: var(--text-primary); }
/* Fix: icon is before input, not after — use sibling differently */
.input-icon-wrap:focus-within .input-icon { color: var(--text-primary); }
.input-icon-wrap input::placeholder { color: var(--text-disabled); }

.btn-login {
    width: 100%; height: 48px; margin-top: 8px;
    font-size: 15px; font-weight: 500; border-radius: var(--radius-sm);
}

/* Mobile login */
@media (max-width: 768px) {
    .login-page-v2 { padding: 0; align-items: stretch; }
    .login-outer { max-width: 100%; }
    .login-split { flex-direction: column; border-radius: 0; box-shadow: none; min-height: 100vh; }
    .login-left { min-height: auto; padding: 32px 24px 24px; }
    .login-left-deco { display: none; }
    .login-features, .login-copyright { display: none; }
    .login-headline { font-size: 24px; }
    .login-pitch { font-size: 14px; margin-top: 8px; }
    .login-right { padding: 24px; flex: 1; }
    .login-left { border-radius: 0; }
}

/* ── Search Input with Icon ───────────────────── */
.search-input-wrap { position: relative; }
.search-input-wrap .search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none; transition: color 0.15s;
}
.search-input-wrap input {
    height: 34px; padding: 0 12px 0 36px;
    border: 1px solid var(--border-medium); border-radius: var(--radius-sm);
    font: inherit; font-size: 13px; color: var(--text-primary); background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s; width: 100%; max-width: 320px;
}
.search-input-wrap input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(99,177,44,0.12); }
.search-input-wrap:focus-within .search-icon { color: var(--text-primary); }
.search-input-wrap input::placeholder { color: var(--text-disabled); }

/* ── Custom Select Chevron Rotation ───────────── */
.custom-select-trigger svg,
.scope-trigger svg { transition: transform 0.15s ease; }
.custom-select.open .custom-select-trigger svg,
.scope-dropdown.open ~ .scope-trigger svg { transform: rotate(180deg); }

/* ── Form-Select (styled select for forms) ────── */
.form-select { position: relative; max-width: 480px; }
.form-select-trigger {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; height: 40px; padding: 0 12px;
    background: var(--white); border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm); cursor: pointer;
    font: inherit; font-size: 14px; color: var(--text-primary);
    transition: border-color 0.15s;
}
.form-select-trigger:hover { border-color: var(--green); }
.form-select.open .form-select-trigger { border-color: var(--green); box-shadow: 0 0 0 3px rgba(99,177,44,0.12); }
.form-select-trigger svg { color: var(--text-muted); flex-shrink: 0; transition: transform 0.15s; }
.form-select.open .form-select-trigger svg { transform: rotate(180deg); }
.form-select-label { flex: 1; text-align: left; }
.form-select-dropdown {
    display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    max-height: 280px; overflow-y: auto;
    background: var(--white); border: 1px solid var(--border-light);
    border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    z-index: 200;
}
.form-select.open .form-select-dropdown { display: block; }
.form-select-option {
    display: block; padding: 9px 12px; font-size: 13px; font-weight: 500;
    color: var(--text-primary); cursor: pointer; transition: background 0.1s;
}
.form-select-option:hover { background: var(--bg); }
.form-select-option.active { background: var(--green-bg); color: var(--green-muted); }

/* Dropzone — Drag & Drop Upload */
.dropzone { border:2px dashed var(--border-medium); border-radius:var(--radius); padding:24px 20px; text-align:center; cursor:pointer; transition:border-color .15s, background .15s; background:var(--white); }
.dropzone:hover, .dropzone.dragover { border-color:var(--green); background:var(--green-bg); }
.dropzone.has-file { border-style:solid; border-color:var(--green); padding:12px; }
.dropzone-text { font-size:14px; color:var(--text-secondary); }
.dropzone-link { color:var(--green-muted); font-weight:500; text-decoration:underline; cursor:pointer; }
.dropzone-hint { font-size:12px; color:var(--text-muted); margin-top:4px; }
.dropzone-preview { display:flex; align-items:center; gap:12px; text-align:left; }
.dropzone-preview img { width:64px; height:64px; border-radius:8px; object-fit:cover; background:#f5f5f5; }
.dropzone-preview-info { flex:1; font-size:13px; }
.dropzone-preview-name { font-weight:500; color:var(--text-primary); }
.dropzone-preview-meta { font-size:11px; color:var(--text-muted); margin-top:2px; }
.dropzone-preview-actions { font-size:12px; margin-top:4px; }
.dropzone-preview-actions a { color:var(--green-muted); cursor:pointer; }
