/* Navion Ticketsystem — Corporate Design Navion GmbH
 * Wordmark: schwarz + Markengrün-Punkt
 * Typo: Inter
 * Stil: modern, luftig, minimalistisch, pill-förmige CTAs
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* Accessibility */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

:root {
    /* Markenfarben */
    --brand-black:       #000000;
    --brand-green:       #22C28A;   /* Logo-Punkt */
    --brand-green-dark:  #18A878;
    --brand-green-soft:  #E9F8F1;

    /* Text */
    --text:              #111827;
    --text-muted:        #6B7280;
    --text-light:        #9CA3AF;

    /* Flächen */
    --bg:                #FAFAFA;
    --card:              #FFFFFF;
    --border:            #ECECEC;
    --border-strong:     #D1D5DB;

    /* Status-Akzente (sanft) */
    --status-open-bg:      #EFF6FF;
    --status-open-fg:      #1E40AF;
    --status-progress-bg:  #FEF3C7;
    --status-progress-fg:  #92400E;
    --status-done-bg:      #E9F8F1;
    --status-done-fg:      #0F7A56;
    --status-rejected-bg:  #FEE2E2;
    --status-rejected-fg:  #991B1B;

    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow:    0 2px 8px rgba(0,0,0,.05);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.08);

    --ease: cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    letter-spacing: -0.02em;
    font-weight: 700;
    color: var(--text);
}

a { color: var(--text); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .15s var(--ease); }
a:hover { border-bottom-color: var(--brand-green); }

/* ============================================
   Header / Wordmark
   ============================================ */
header.site {
    background: rgba(255,255,255,.85);
    border-bottom: 1px solid var(--border);
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px) saturate(1.4);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: none !important;
    text-decoration: none;
}
.wordmark .logo-img {
    display: block;
    height: 26px;
    width: auto;
}
.wordmark .tagline {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 0;
    margin-left: 14px;
    padding-left: 14px;
    border-left: 1px solid var(--border);
}

/* Hamburger-Toggle (nur mobile sichtbar) */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    box-shadow: none;
}
.nav-toggle:hover { background: #F3F4F6; border-radius: var(--radius-sm); transform: none; box-shadow: none; }
.nav-toggle-bar {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.nav-toggle.is-open .nav-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.is-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle.is-open .nav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

header.site nav {
    display: flex;
    gap: 8px;
    align-items: center;
}
header.site nav a {
    color: var(--text);
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    border: none;
    transition: background .15s var(--ease);
}
header.site nav a:hover { background: #F3F4F6; }
header.site nav .admin-chip {
    background: var(--brand-green-soft);
    color: var(--status-done-fg);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
}

/* ============================================
   Layout
   ============================================ */
main {
    max-width: 1120px;
    margin: 36px auto 64px;
    padding: 0 24px;
}

.page-head {
    margin-bottom: 28px;
}
.page-head h1 {
    font-size: 32px;
    margin: 0 0 6px 0;
    letter-spacing: -0.03em;
}
.page-head .subtitle {
    color: var(--text-muted);
    font-size: 15px;
    margin: 0;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 26px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.card h2 { margin-top: 0; }

.ticket-card {
    cursor: pointer;
}
.ticket-card:hover {
    border-color: var(--brand-green);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.ticket-card .title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 8px;
}
.ticket-card h3 {
    margin: 0;
    font-size: 18px;
    line-height: 1.35;
    color: var(--text);
    font-weight: 700;
}
.ticket-card .meta {
    color: var(--text-muted);
    font-size: 12.5px;
    margin-top: 10px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.ticket-card .meta .dot-sep { color: var(--text-light); }
.ticket-card .summary {
    color: var(--text-muted);
    margin: 8px 0 0 0;
    font-size: 14.5px;
    line-height: 1.55;
}

/* ============================================
   Status-Badges
   ============================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    white-space: nowrap;
    letter-spacing: -0.005em;
}
.status-badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    display: inline-block;
    background: currentColor;
    opacity: .75;
}
.status-offen          { background: var(--status-open-bg);     color: var(--status-open-fg); }
.status-bearbeitung    { background: var(--status-progress-bg); color: var(--status-progress-fg); }
.status-umgesetzt      { background: var(--status-done-bg);     color: var(--status-done-fg); }
.status-abgelehnt      { background: var(--status-rejected-bg); color: var(--status-rejected-fg); }

/* Category-Chip (farbiger Punkt + Name) */
.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px 2px 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    white-space: nowrap;
}
/* Assignee-Chip in Ticket-Liste */
.assignee-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    font-weight: 500;
}
.assignee-chip .avatar {
    vertical-align: middle;
}

.cat-chip .cat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Due-Date-Chip */
.due-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: #7C2D12;
    background: #FFF7ED;
    border: 1px solid #FED7AA;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}
.due-chip.large {
    font-size: 13px;
    padding: 5px 12px;
}

/* Kommentar-Chip in der Übersicht — dezent, neutral, mit Bubble-Icon */
.comment-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-light);
    background: #F3F4F6;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    white-space: nowrap;
    line-height: 1.4;
}
.comment-chip-author { font-weight: 600; color: var(--text); }
.comment-chip-date   { color: var(--text-light); font-weight: 400; }

/* Hidden-Badge (versteckte Tickets) */
.hidden-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: #F3F4F6;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-pill);
    white-space: nowrap;
}

/* Vote-Pill */
.vote-pill {
    background: #F3F4F6;
    color: var(--text);
    padding: 5px 13px;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    border: 1px solid var(--border);
    transition: background .15s var(--ease), border-color .15s var(--ease);
}
.ticket-card:hover .vote-pill {
    background: var(--brand-green-soft);
    border-color: #BBEAD5;
    color: var(--status-done-fg);
}
.vote-pill.active {
    background: var(--brand-green-soft);
    color: var(--status-done-fg);
    border-color: #BBEAD5;
}

/* ============================================
   Buttons
   ============================================ */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--brand-black);
    color: #fff;
    border: none;
    padding: 11px 22px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    letter-spacing: -0.005em;
    transition: background .15s var(--ease), transform .08s var(--ease), box-shadow .15s var(--ease);
}
button:hover, .btn:hover {
    background: #1f1f1f;
    box-shadow: var(--shadow);
    border-color: transparent;
}
button:active, .btn:active { transform: translateY(1px); }

button.secondary, .btn.secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border-strong);
}
button.secondary:hover, .btn.secondary:hover { background: #F9FAFB; border-color: var(--text); }

button.primary-green, .btn.primary-green {
    background: var(--brand-green);
}
button.primary-green:hover, .btn.primary-green:hover {
    background: var(--brand-green-dark);
}

button.danger, .btn.danger {
    background: #fff;
    color: #B91C1C;
    border: 1px solid #FCA5A5;
}
button.danger:hover, .btn.danger:hover {
    background: #FEF2F2;
    color: #991B1B;
    border-color: #EF4444;
}

button:disabled, .btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-icon { padding: 9px 11px; }

/* ============================================
   Form-Controls
   ============================================ */
input[type=text], input[type=password], input[type=email],
input[type=search], input[type=url], input[type=tel],
input[type=number], input[type=date], textarea, select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
    background: #fff;
    color: var(--text);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--brand-green);
    box-shadow: 0 0 0 3px rgba(34,194,138,.18);
}
label {
    display: block;
    font-weight: 600;
    margin: 14px 0 7px 0;
    font-size: 13.5px;
    color: var(--text);
    letter-spacing: -0.005em;
}

/* ============================================
   Flash-Messages
   ============================================ */
.flash {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14.5px;
    border: 1px solid transparent;
}
.flash.error { background: #FEF2F2; color: #991B1B; border-color: #FECACA; }
.flash.ok    { background: var(--brand-green-soft); color: var(--status-done-fg); border-color: #BBEAD5; }
.flash.info  { background: #F3F4F6; color: var(--text); border-color: var(--border); }

/* ============================================
   Login-Screen
   ============================================ */
.login-wrap {
    max-width: 420px;
    margin: 110px auto 40px;
}
.login-wrap .brand-large {
    text-align: center;
    margin-bottom: 28px;
}
.login-wrap .brand-large .logo-img-large {
    display: block;
    height: 58px;
    width: auto;
    margin: 0 auto;
}
.login-wrap .brand-large .tagline-below {
    display: block;
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 10px;
    font-weight: 500;
}
.login-wrap .card { padding: 32px; }

/* Microsoft-365-Login-Button */
.btn.sso-btn {
    background: #fff;
    color: #0F172A;
    border: 1px solid var(--border-strong);
    font-weight: 600;
    padding: 12px 18px;
}
.btn.sso-btn:hover {
    background: #F8FAFC;
    border-color: var(--text);
    box-shadow: var(--shadow);
}
.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 18px 0;
    color: var(--text-light);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ============================================
   Filter-Bar (Übersicht)
   ============================================ */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}
.segmented {
    display: inline-flex;
    background: #F3F4F6;
    border-radius: var(--radius-pill);
    padding: 3px;
}
.segmented a {
    padding: 7px 16px;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    border: none;
    transition: all .15s var(--ease);
}
.segmented a:hover { color: var(--text); }
.segmented a.active {
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.toggle-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-muted);
    user-select: none;
    cursor: pointer;
}
.toggle-row input[type=checkbox] {
    appearance: none;
    width: 36px; height: 20px;
    background: #D1D5DB;
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: background .2s var(--ease);
    margin: 0;
    border: none;
    padding: 0;
    box-shadow: none;
}
.toggle-row input[type=checkbox]::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s var(--ease);
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.toggle-row input[type=checkbox]:checked { background: var(--brand-green); }
.toggle-row input[type=checkbox]:checked::after { transform: translateX(16px); }
.toggle-row input[type=checkbox]:focus { box-shadow: 0 0 0 3px rgba(34,194,138,.25); }
.toggle-row .count-chip {
    background: #F3F4F6;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

/* Filter-Group (Label + Select zusammen) */
.filter-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.filter-group select {
    width: auto;
    min-width: 140px;
    padding: 7px 10px;
    font-size: 13.5px;
}
.filter-form {
    margin: 0;
    display: inline-flex;
    align-items: center;
}

/* Suchfeld */
.search-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}
.search-input {
    flex: 1;
    font-size: 14.5px;
    padding: 11px 16px;
}

/* Admin-Fields-Box in Formularen */
.admin-fields {
    margin: 22px 0 6px 0;
    padding: 18px 20px;
    background: #FAFAFA;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}
.admin-fields-title {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.admin-grid label { margin-top: 0; }
.check-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 0 0;
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
}
.check-row input[type=checkbox] {
    width: auto;
    margin: 0;
}

/* Color-Picker + Swatches (Kategorieverwaltung) */
.color-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.color-input {
    width: 48px;
    height: 40px;
    padding: 2px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: #fff;
}
.color-swatches {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    max-width: 260px;
}
.color-swatches.compact {
    grid-template-columns: repeat(8, 1fr);
    max-width: 220px;
}
.color-swatches .swatch {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    padding: 0;
    border: 1px solid rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform .1s var(--ease), box-shadow .1s var(--ease);
}
.color-swatches .swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 2px rgba(34,194,138,.3);
}

/* Kategorieverwaltung */
.cat-form-grid {
    display: grid;
    grid-template-columns: 1.2fr 1.6fr 0.8fr auto;
    gap: 16px;
    align-items: end;
}
.cat-form-grid label { margin-top: 0; }
.cat-form-submit { padding-bottom: 0; }

.cat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
/* Einheitliches Spalten-Raster für Kopfzeile + Kategoriezeilen:
   Farbe | Name | Reihenfolge | Nutzung | Aktionen */
.cat-row {
    display: grid;
    grid-template-columns: 210px minmax(160px, 1fr) 100px 90px 200px;
    gap: 14px;
    align-items: center;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}
.cat-row-head {
    padding: 6px 14px 2px 14px;
    border: none;
    background: transparent;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.cat-edit {
    display: contents; /* Formular-Felder übernehmen direkt die Grid-Spalten der Zeile. */
    margin: 0;
}
.cat-row input[type=text],
.cat-row input[type=number] {
    padding: 8px 10px;
    font-size: 14px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}
.cat-col-color {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}
.cat-col-color .color-input {
    flex: 0 0 auto;
    width: 44px;
    height: 36px;
}
.cat-col-color .color-swatches {
    display: grid;
    grid-template-columns: repeat(8, 16px);
    gap: 4px;
    margin: 0;
    max-width: none;
}
.cat-col-color .swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}
.cat-col-usage {
    font-size: 13px;
    white-space: nowrap;
}
.cat-col-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
}
.cat-delete {
    margin: 0;
}
.cat-delete-blocked {
    font-size: 12px;
    font-style: italic;
    color: var(--text-muted);
    white-space: nowrap;
    cursor: help;
}

/* Timeline */
.timeline-bucket { margin: 26px 0 14px 0; }
.timeline-bucket-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    margin: 0 0 14px 0;
    padding: 0 4px;
    color: var(--text);
}
.timeline-bucket-title .count-chip {
    background: var(--brand-green-soft);
    color: var(--status-done-fg);
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
}
.timeline-card { padding: 16px 20px; }
.timeline-card h3 { font-size: 16px; }

/* ============================================
   Ticket-Body (Rich-Text-Ausgabe)
   ============================================ */
/* Ticket-Body: collapsible bei langen Beschreibungen */
.ticket-body { font-size: 15.5px; color: var(--text); }
.ticket-body-wrap {
    position: relative;
    max-height: 400px;
    overflow: hidden;
    transition: max-height .4s var(--ease);
}
.ticket-body-wrap.is-expanded {
    max-height: none;
}
.ticket-body-wrap.is-truncated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(transparent, #fff);
    pointer-events: none;
}
.ticket-body-expand {
    display: none;
    text-align: center;
    margin-top: -8px;
    padding: 8px 0 4px;
    position: relative;
    z-index: 1;
}
.ticket-body-wrap.is-truncated + .ticket-body-expand {
    display: block;
}
.ticket-body-expand button {
    background: #fff;
    color: var(--brand-green-dark);
    border: 1px solid var(--border-strong);
    font-size: 13px;
    padding: 7px 18px;
    box-shadow: var(--shadow-sm);
}
.ticket-body-expand button:hover {
    background: var(--brand-green-soft);
    border-color: var(--brand-green);
}
.ticket-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 12px 0;
    border: 1px solid var(--border);
}

/* Editor: resizable images */
.ql-editor img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    cursor: pointer;
    transition: outline 0.15s;
}
/* Image resize overlay — thin dashed border + 4 black corner dots */
.img-resize-overlay {
    position: absolute;
    border: 1px dashed rgba(0,0,0,0.4);
    pointer-events: none;
    z-index: 50;
    box-sizing: border-box;
}
.img-resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
    pointer-events: auto;
}
.img-resize-nw { top: -4px; left: -4px; cursor: nw-resize; }
.img-resize-ne { top: -4px; right: -4px; cursor: ne-resize; }
.img-resize-sw { bottom: -4px; left: -4px; cursor: sw-resize; }
.img-resize-se { bottom: -4px; right: -4px; cursor: se-resize; }
.ticket-body h2, .ticket-body h3, .ticket-body h4 { color: var(--text); margin-top: 22px; }

/* Paragraph-Spacing in gerenderten Quill-Bodies — bewusst minimal.
   Quill produziert für eine Leerzeile (Enter-Enter) ein <p><br></p>.
   Mit großen <p>-Margins entsteht dadurch der DOPPELTE Abstand:
   Margin-Bottom + Empty-P-Höhe + Margin-Top = ~3 Leerzeilen.
   Lösung: kleines Margin auf normale <p>, leere <p><br></p> per :has()
   neutralisieren — eine Enter-Enter-Pause sieht so genauso aus wie EINE
   sichtbare Leerzeile, nicht zwei. */
.ticket-body p,
.comment .cb p,
.rejection-reason p,
.umsetzung-reason p {
    margin: 0 0 6px 0;
}
.ticket-body p:has(> br:only-child),
.comment .cb p:has(> br:only-child),
.rejection-reason p:has(> br:only-child),
.umsetzung-reason p:has(> br:only-child) {
    margin: 0;
    line-height: 1;
}
.ticket-body p:last-child,
.comment .cb p:last-child,
.rejection-reason p:last-child,
.umsetzung-reason p:last-child {
    margin-bottom: 0;
}
.ticket-body blockquote {
    border-left: 3px solid var(--brand-green);
    margin: 16px 0;
    padding: 6px 16px;
    color: var(--text-muted);
    background: #FAFAFA;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.ticket-body pre {
    background: #F3F4F6;
    padding: 14px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 13.5px;
}
.ticket-body a { color: var(--brand-green-dark); border-bottom: 1px solid transparent; }
.ticket-body a:hover { border-bottom-color: var(--brand-green); }

/* ============================================
   Comments
   ============================================ */
/* Comments → see UX section below */

.detail-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 13.5px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.detail-meta strong { color: var(--text); font-weight: 600; }

.actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 22px;
}

/* ============================================
   Quill-Editor – CI anpassen
   ============================================ */
.ql-toolbar.ql-snow {
    border: 1px solid var(--border-strong);
    border-bottom: none;
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    background: #FAFAFA;
    padding: 10px 12px;
}
.ql-container.ql-snow {
    border: 1px solid var(--border-strong);
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
}
#editor { min-height: 300px; background: #fff; }
.ql-editor { padding: 16px 18px; line-height: 1.6; }
.ql-editor.ql-blank::before { color: var(--text-light); font-style: normal; }
.ql-snow .ql-stroke { stroke: var(--text); }
.ql-snow .ql-fill   { fill: var(--text); }
.ql-snow .ql-picker { color: var(--text); }
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--brand-green-dark); }
.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--brand-green-dark); }

/* Emoji-Button in der Quill-Toolbar */
.ql-snow.ql-toolbar button.ql-emoji {
    font-size: 17px;
    line-height: 1;
    width: 28px;
    padding: 0;
}
.ql-snow.ql-toolbar button.ql-emoji::before {
    content: '😊';
}

/* Emoji-Popover */
.emoji-popover {
    position: absolute;
    z-index: 30;
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 10px;
    width: 288px;
    max-height: 260px;
    overflow-y: auto;
    display: none;
}
.emoji-popover.open { display: block; }
.emoji-popover .emoji-group-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin: 6px 4px 4px;
}
.emoji-popover .emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
}
.emoji-popover button.emoji-btn {
    background: transparent;
    color: inherit;
    border: none;
    border-radius: 8px;
    padding: 4px 0;
    font-size: 20px;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: none;
    transition: background .1s var(--ease);
}
.emoji-popover button.emoji-btn:hover {
    background: var(--brand-green-soft);
    transform: none;
    box-shadow: none;
}

/* ============================================
   Utilities
   ============================================ */
.muted     { color: var(--text-muted); font-size: 13px; }
.small     { font-size: 13px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state h3 { color: var(--text); margin: 12px 0 6px 0; }

/* ============================================
   Login: Pulse-Wordmark
   ============================================ */
.login-wrap .brand-large .brand-name-large {
    display: block;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-top: 14px;
    color: var(--text);
}
.login-wrap .brand-large .brand-name-large::before {
    content: '🧠 ';
    margin-right: 4px;
    font-size: 28px;
}

/* ============================================
   Ticket-Typ: Idee/Problem
   ============================================ */

/* Pill-Toggle (im Formular) */
.type-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 4px;
}
.type-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px 16px;
    background: #fff;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
    margin: 0;
    font-weight: 500;
}
.type-option input[type=radio] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0; height: 0;
}
.type-option:hover { border-color: var(--text); background: #FAFAFA; }
.type-option .type-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
.type-option .type-hint {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    font-weight: 400;
}

/* Aktiv-Zustand farbkodiert pro Typ */
.type-option.type-idee.is-active {
    border-color: var(--brand-green);
    background: var(--brand-green-soft);
    box-shadow: 0 0 0 3px rgba(34,194,138,.18);
}
.type-option.type-problem.is-active {
    border-color: #F59E0B;
    background: #FFFBEB;
    box-shadow: 0 0 0 3px rgba(245,158,11,.18);
}

/* Type-Badge (in Listen + Detail) */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-pill);
    white-space: nowrap;
    letter-spacing: -0.005em;
    line-height: 1.4;
}
.type-badge.type-idee {
    background: var(--brand-green-soft);
    color: var(--status-done-fg);
    border: 1px solid #BBEAD5;
}
.type-badge.type-problem {
    background: #FFFBEB;
    color: #92400E;
    border: 1px solid #FDE68A;
}

/* Akzent-Strich links an der Karte je Ticket-Typ */
.ticket-card.type-accent-idee     { border-left: 3px solid var(--brand-green); }
.ticket-card.type-accent-problem  { border-left: 3px solid #F59E0B; }

/* Type-Segmented (Filter in Übersicht/Timeline) */
.type-segmented a.active {
    background: #fff;
    color: var(--text);
}

/* ============================================
   Form-Grid-2 (Name + Mail nebeneinander)
   ============================================ */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-grid-2 > div > label:first-child { margin-top: 18px; }

/* ============================================
   Ablehnungs-Box (Detail-Ansicht)
   ============================================ */
.rejection-box {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-left: 4px solid #DC2626;
    border-radius: var(--radius);
    padding: 14px 18px;
    margin: 18px 0;
}
.rejection-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    color: #991B1B;
    font-size: 13.5px;
}
.rejection-head strong { color: #991B1B; font-weight: 700; }
.rejection-head .muted { color: #B91C1C; opacity: .8; }
.rejection-reason {
    color: #7F1D1D;
    font-size: 14.5px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.rejection-reason img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 8px 0;
}

/* ============================================
   Umsetzungs-Box (Detail-Ansicht, analog zu rejection-box in grün)
   ============================================ */
.umsetzung-box {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    border-left: 4px solid #10B981;
    border-radius: var(--radius);
    padding: 14px 18px;
    margin: 18px 0;
}
.umsetzung-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    color: #065F46;
    font-size: 13.5px;
}
.umsetzung-head strong { color: #065F46; font-weight: 700; }
.umsetzung-head .muted { color: #0F7A56; opacity: .8; }
.umsetzung-reason {
    color: #064E3B;
    font-size: 14.5px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.umsetzung-reason img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 8px 0;
}

/* SSO-Identity-Panel (ersetzt Name/Mail-Felder, wenn via M365 angemeldet) */
.sso-identity {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 18px 0 6px 0;
    padding: 12px 16px;
    background: var(--brand-green-soft);
    border: 1px solid #BBEAD5;
    border-radius: var(--radius);
}
.sso-identity-name {
    font-weight: 700;
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.2;
}
.sso-identity-mail {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2px;
}
.sso-identity-chip {
    margin-left: auto;
    background: #fff;
    color: var(--status-done-fg);
    border: 1px solid #BBEAD5;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Avatar (M365-Profilbild oder Initialen-Fallback) */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    object-fit: cover;
    background: #E5E7EB;
    color: #374151;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    overflow: hidden;
    user-select: none;
}
.avatar-xs  { width: 18px; height: 18px; font-size: 8px; }
.avatar-sm  { width: 22px; height: 22px; font-size: 10px; }
.avatar-md  { width: 40px; height: 40px; font-size: 15px; }
.avatar-lg  { width: 56px; height: 56px; font-size: 20px; }
.avatar-fallback {
    background: var(--brand-green-soft);
    color: var(--status-done-fg);
}

/* User-Chip im Header (nur bei SSO sichtbar) */
header.site nav .user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #F3F4F6;
    color: var(--text);
    padding: 3px 12px 3px 4px;
    border-radius: var(--radius-pill);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
}
header.site nav .user-chip .avatar { box-shadow: 0 0 0 1px #fff; }
.user-chip-name {
    white-space: nowrap;
}

/* Reject-Form: kompakte Ticket-Zusammenfassung über dem Formular */
.reject-summary {
    padding: 14px 16px;
    background: #FAFAFA;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    margin-bottom: 18px;
}
.reject-summary h3 { color: var(--text); }

/* ============================================
   Avatar extra-small
   ============================================ */
.avatar-xs { width: 18px; height: 18px; font-size: 8px; }

/* ============================================
   Profil-Statistik-Karte (Startseite)
   ============================================ */
.profile-stats-card {
    background: linear-gradient(135deg, #fff 60%, var(--brand-green-soft) 100%);
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand-green);
    border-radius: var(--radius-lg);
    padding: 22px 26px;
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    box-shadow: var(--shadow);
    transition: box-shadow .18s var(--ease);
}
.profile-stats-card:hover {
    box-shadow: var(--shadow-lg);
}
.profile-stats-user {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 200px;
}
.profile-stats-name {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.profile-stats-name strong { font-size: 16px; }
.profile-stats-name .muted { font-size: 13px; }
.profile-stats-grid {
    display: flex;
    gap: 0;
    flex: 1;
    border-left: 1px solid var(--border);
    margin-left: 8px;
    padding-left: 8px;
}
.profile-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
}
.profile-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}
.profile-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
@media (max-width: 700px) {
    .profile-stats-card { flex-direction: column; align-items: stretch; }
    .profile-stats-grid { border-left: none; margin-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 4px; flex-wrap: wrap; }
    .profile-stat { min-width: 45%; }
}

/* ============================================
   Assigned-Chip (Ticket-Meta)
   ============================================ */
.assigned-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 4px;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: var(--radius-pill);
    font-size: 12.5px;
    font-weight: 600;
    color: #1E40AF;
    white-space: nowrap;
}

/* ============================================
   Ticket-Manage (inline im Ticket-Card)
   ============================================ */
.ticket-manage-section {
    border-top: 1px solid var(--border);
    margin-top: 24px;
    padding-top: 16px;
}
/* Manage-Bar: horizontal, kompakt */
.manage-bar {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-wrap: wrap;
}
.manage-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 0;
    flex: 0 1 auto;
    min-width: 0;
}
.manage-field .manage-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-light);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
}
.manage-input {
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-family: inherit;
    min-width: 0;
    width: auto;
    color: var(--text);
    transition: border-color .15s var(--ease);
}
/* Termin-Datepicker gleiche Breite wie Selects */
input[type=date].manage-input {
    width: 130px;
    font-size: 12.5px;
    padding: 6px 4px;
}
.manage-input:focus {
    outline: none;
    border-color: var(--brand-green);
    box-shadow: 0 0 0 2px rgba(34,194,138,.15);
}
.manage-input:hover {
    border-color: var(--text-light);
}
/* Begründung-Zeile (erscheint bei Statuswechsel) — volle Breite der Bar */
.manage-reason-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-basis: 100%;
    margin-top: 2px;
    order: 99;
}
.manage-reason-input {
    flex: 1;
    padding: 8px 10px;
    font-size: 13.5px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    font-family: inherit;
    width: auto;
    min-height: 38px;
}
.manage-reason-input:focus {
    outline: none;
    border-color: var(--brand-green);
    box-shadow: 0 0 0 2px rgba(34,194,138,.15);
}
/* Admin-Option: alle Mitarbeiter per Mail informieren (bei "umgesetzt") */
.reason-broadcast-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    background: #E9F8F1;
    border: 1px solid rgba(34,194,138,0.35);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--brand-green-dark);
    cursor: pointer;
    line-height: 1.4;
}
.reason-broadcast-row input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}
.reason-broadcast-row strong { font-weight: 600; }

/* Rich-Editor für Begründung (Quill) — kompakt, passt in die Manage-Bar */
.manage-reason-editor-wrap {
    flex: 1;
    min-width: 0;
}
.manage-reason-editor {
    min-height: 80px;
    background: #fff;
    font-size: 13.5px;
}
.manage-reason-editor-wrap .ql-toolbar {
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
    border-color: var(--border-strong);
}
.manage-reason-editor-wrap .ql-container {
    border-bottom-left-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    border-color: var(--border-strong);
    min-height: 80px;
    font-family: inherit;
}
.manage-reason-editor-wrap .ql-editor {
    min-height: 80px;
    padding: 8px 12px;
    font-size: 13.5px;
}

/* ============================================
   Ticket-Sharing: Picker-Dropdown (Multi-Select)
   ============================================ */
.share-field { position: relative; }

.share-picker { position: relative; }

/* Trigger muss globales button {background:#000} überschreiben — daher
   eigene background/color/padding/radius-Werte auf dem button-Element. */
button.share-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    text-align: left;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: normal;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: none;
    cursor: pointer;
}
button.share-picker-trigger:hover {
    background: #fff;
    color: var(--text);
    border-color: var(--text-light);
    box-shadow: none;
    transform: none;
}
button.share-picker-trigger.open,
button.share-picker-trigger:focus {
    background: #fff;
    color: var(--text);
    border-color: var(--brand-green);
    box-shadow: 0 0 0 2px rgba(34,194,138,.15);
    outline: none;
}
.share-picker-label { color: var(--text); }
.share-picker-caret { color: var(--text-light); font-size: 11px; }

.share-picker-popup[hidden] { display: none; }
.share-picker-popup {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    max-width: 320px;
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    z-index: 20;
    overflow: hidden;
}
.share-picker-list {
    max-height: 280px;
    overflow-y: auto;
    padding: 4px 0;
}
.share-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 14px;
    font-size: 13.5px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.1s;
}
.share-picker-row:hover { background: var(--brand-green-soft); }
.share-picker-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-green);
    flex-shrink: 0;
}
/* "Alle auswählen"-Zeile: leicht abgesetzt vom Rest */
.share-picker-row-all {
    background: #F9FAFB;
    border-bottom: 1px solid var(--border);
    padding: 6px 14px;
    margin-bottom: 4px;
}
.share-picker-row-all:hover { background: #F3F4F6; }
.share-picker-all-count {
    color: var(--text-light);
    font-style: normal;
    font-size: 12px;
    margin-left: 2px;
}
.share-picker-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: #F9FAFB;
    border-top: 1px solid var(--border);
}
.share-picker-count {
    font-size: 12px;
    color: var(--text-light);
}
.share-picker-hint {
    font-size: 11.5px;
    color: var(--text-light);
    font-style: italic;
}

.share-empty-hint {
    display: flex;
    align-items: center;
    color: var(--text-light);
    font-size: 13px;
    font-style: italic;
    background: #F9FAFB;
}

/* ============================================
   Ticket-Sharing: Chip-Liste der mitlesenden User
   ============================================ */
.share-chips-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}
.share-chips-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 4px;
}
.share-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 4px 4px 10px;
    background: var(--brand-green-soft);
    border: 1px solid #BBEAD5;
    border-radius: 999px;
    font-size: 12.5px;
    color: var(--brand-green-dark);
    line-height: 1.2;
}
.share-chip-name { font-weight: 500; }
.share-chip-remove-form {
    margin: 0;
    padding: 0;
    line-height: 0;
}
.share-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    background: rgba(34,194,138,0.12);
    color: var(--brand-green-dark);
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background 0.15s;
}
.share-chip-remove:hover {
    background: #DC2626;
    color: #fff;
}

/* Toggle-Switch für Sichtbarkeit */
.manage-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0;
    user-select: none;
}
.manage-toggle-cb {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.manage-toggle-track {
    display: inline-block;
    width: 30px;
    height: 16px;
    background: var(--brand-green);
    border-radius: 999px;
    position: relative;
    transition: background .2s var(--ease);
    flex-shrink: 0;
}
.manage-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s var(--ease);
    box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
/* Checked = versteckt (rot) */
.manage-toggle-cb:checked ~ .manage-toggle-track {
    background: #EF4444;
}
.manage-toggle-cb:checked ~ .manage-toggle-track::after {
    transform: translateX(14px);
}
.manage-toggle-text {
    white-space: nowrap;
}
.manage-inline-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.manage-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
    min-width: 70px;
    flex-shrink: 0;
}
.manage-select {
    flex: 1 1 120px;
    min-width: 0;
    padding: 7px 10px;
    font-size: 13.5px;
}
.manage-reason {
    flex: 1 1 200px;
    min-width: 140px;
    padding: 7px 10px;
    font-size: 13.5px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: #fff;
}
.manage-reason:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16,185,129,0.12);
}

/* ============================================
   Priority Toggle + Badge
   ============================================ */

/* Form-Row: Kategorie + Priorität nebeneinander */
.form-row-flex {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.form-row-flex-main {
    flex: 1 1 auto;
    min-width: 0;
}
.form-row-flex-side {
    flex: 0 0 auto;
}

/* Priority Toggle (Radio-Gruppe auf new.php / edit.php) */
.priority-toggle {
    display: inline-flex;
    gap: 0;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
}
.priority-option {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: background .15s var(--ease), color .15s var(--ease);
    border-right: 1px solid var(--border);
    margin: 0;
    white-space: nowrap;
    user-select: none;
}
.priority-option:last-child { border-right: none; }
.priority-option input[type=radio] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0; height: 0;
}
.priority-option:hover { background: #F9FAFB; }
.priority-option.is-active {
    color: var(--text);
    font-weight: 600;
}
.priority-opt-niedrig.is-active { background: #EFF6FF; color: #1E40AF; }
.priority-opt-normal.is-active  { background: #E9F8F1; color: #0F7A56; }
.priority-opt-hoch.is-active    { background: #FEF2F2; color: #991B1B; }

/* Priority Badge (inline in Listen + Detail) */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 11px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}
.priority-badge-niedrig { background: #EFF6FF; color: #1E40AF; }
.priority-badge-normal  { background: #E9F8F1; color: #0F7A56; }
.priority-badge-hoch    { background: #FEF2F2; color: #991B1B; }

/* Compact card variant */
.card-compact {
    padding: 14px 20px;
}

/* Inline file upload zone (compact) */
.file-upload-zone-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 0;
}
.file-upload-zone-inline:hover { color: var(--text); }
.file-upload-icon-sm { font-size: 16px; }

/* Comment form actions row */
.comment-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}
.comment-file-attach {
    display: flex;
    align-items: center;
    gap: 8px;
}
.file-upload-pending-list {
    margin-top: 8px;
}
.file-upload-pending-list:empty { display: none; }

/* ============================================
   Activity Timeline
   ============================================ */
.activity-timeline {
    position: relative;
    padding-left: 24px;
}
.activity-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border);
    border-radius: 2px;
}
.activity-entry {
    position: relative;
    padding-bottom: 18px;
    padding-left: 4px;
    transition: background .15s var(--ease);
    border-radius: var(--radius-sm);
}
.activity-entry:last-child { padding-bottom: 0; }
.activity-marker {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--border-strong);
    z-index: 1;
}
.activity-created .activity-marker    { border-color: var(--brand-green); background: var(--brand-green-soft); }
.activity-status_changed .activity-marker { border-color: #F59E0B; background: #FFFBEB; }
.activity-assigned .activity-marker   { border-color: #3B82F6; background: #EFF6FF; }
.activity-commented .activity-marker  { border-color: var(--text-muted); background: #F3F4F6; }
.activity-visibility_changed .activity-marker { border-color: #8B5CF6; background: #F5F3FF; }

.activity-content {
    min-height: 16px;
}
.activity-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.activity-head strong {
    color: var(--text);
    font-weight: 600;
}
.activity-text {
    font-size: 14px;
    color: var(--text);
    line-height: 1.45;
}
/* Begründung als HTML-Box (Status-Change-Reasons mit Formatierung + Screenshots) */
.activity-reason {
    margin-top: 8px;
    padding: 10px 14px;
    background: #F9FAFB;
    border-left: 3px solid var(--brand-green);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text);
    line-height: 1.55;
}
.activity-reason-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.activity-reason-body p { margin: 0 0 6px 0; }
.activity-reason-body p:last-child { margin-bottom: 0; }
.activity-reason-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 6px 0;
    border: 1px solid var(--border);
}
.activity-reason-body ul,
.activity-reason-body ol { margin: 4px 0 6px 20px; padding: 0; }
.activity-reason-body a { color: var(--brand-green-dark); }

.activity-detail {
    margin-top: 4px;
    padding: 8px 12px;
    background: #F9FAFB;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    white-space: pre-wrap;
}

/* ============================================
   User-List (admin_users.php)
   ============================================ */
.user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.user-table thead th {
    padding: 8px 14px;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.user-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.user-table tbody tr:last-child td { border-bottom: none; }
.user-table tbody tr.user-row-me td {
    background: var(--brand-green-soft);
}
/* Admin-Toggle + Delete-Button nebeneinander */
.user-actions {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-nowrap { white-space: nowrap; }

/* ============================================
   Datei-Upload + Anhänge
   ============================================ */
.file-upload-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s var(--ease), background .15s var(--ease);
    background: #FAFAFA;
}
.file-upload-zone:hover,
.file-upload-zone.drag-over {
    border-color: var(--brand-green);
    background: var(--brand-green-soft);
}
.file-upload-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 14px;
}
.file-upload-icon { font-size: 28px; margin-bottom: 4px; }
.file-upload-link {
    color: var(--brand-green-dark);
    font-weight: 600;
    cursor: pointer;
    display: inline;
    margin: 0;
}
.file-upload-link:hover { text-decoration: underline; }

.attachments-section {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}
.attachments-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin: 0 0 10px 0;
}
.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #F9FAFB;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    transition: border-color .15s var(--ease), background .15s var(--ease);
}
.attachment-item:hover {
    border-color: var(--brand-green);
    background: var(--brand-green-soft);
}
.attachment-icon { font-size: 20px; flex-shrink: 0; }
.attachment-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.attachment-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.attachment-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.attachment-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-top: 6px;
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: var(--radius-sm);
}
.attachment-upload-row.is-done {
    background: var(--brand-green-soft);
    border-color: #BBEAD5;
}
.attachment-upload-row.is-error {
    background: #FEF2F2;
    border-color: #FECACA;
}
.attachment-upload-row.is-error .attachment-meta { color: #991B1B; }

/* ============================================
   Formular-Sektionen (visuelle Trenner)
   ============================================ */
.form-section {
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid var(--border);
}
.form-section:first-child { border-top: none; margin-top: 0; padding-top: 0; }

/* ============================================
   Kommentar-Avatare
   ============================================ */
.comment {
    display: flex;
    gap: 12px;
    border-top: 1px solid var(--border);
    padding: 16px 8px;
    margin: 0 -8px;
    border-radius: var(--radius-sm);
    transition: background .15s var(--ease);
}
.comment:hover {
    background: #FAFAFA;
}
.comment:first-of-type { border-top: none; padding-top: 8px; }
.comment-avatar {
    flex-shrink: 0;
    margin-top: 2px;
}
.comment-body { flex: 1; min-width: 0; }
.comment .ch {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 6px;
}
.comment .ch strong { color: var(--text); font-weight: 600; }
/* Datum-Span bekommt margin-right: auto → schiebt sich nach links,
   die Action-Buttons bleiben als Gruppe rechts zusammen. */
.comment .ch > span:not(.comment-edited) { margin-right: auto; }
/* Action-Buttons direkt nebeneinander, ohne Gap zwischen ihnen */
.comment-edit-btn + .comment-delete-btn { margin-left: -4px; }
/* Kommentar-Action-Buttons (Bearbeiten + Löschen) — dezent, erscheinen beim Hover */
.comment-edit-btn,
.comment-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 2px 6px;
    margin: 0;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    min-width: 0;
    min-height: 0;
    height: auto;
    width: auto;
    box-shadow: none;
}
.comment:hover .comment-edit-btn,
.comment:hover .comment-delete-btn { opacity: 0.6; }
.comment .comment-edit-btn:hover {
    opacity: 1;
    color: var(--brand-green-dark);
    background: rgba(34,194,138,0.08);
}
.comment .comment-delete-btn:hover {
    opacity: 1;
    color: #DC2626;
    background: rgba(220,38,38,0.08);
}
.comment-edited { font-style: italic; color: var(--text-muted); font-size: 12px; }

/* Inline-Edit-Form */
.comment-edit-form { margin-top: 8px; }
.comment-edit-form .ql-toolbar { padding: 4px 6px; background: #fff; }
.comment-edit-form .ql-editor { min-height: 60px; font-size: 14.5px; background: #fff; }
.comment-edit-form .ql-container { background: #fff; }
.comment-edit-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }

/* Während dem Bearbeiten den grünen Eigen-Kommentar-Hintergrund neutralisieren,
   damit der Editor sauber weiß auf Weiß wirkt. */
.comment-own .comment-body:has(.comment-edit-form) {
    background: #fff;
    border-color: var(--border);
}

.comment .cb { font-size: 14.5px; }
.comment .cb img { max-width: 100%; height: auto; border-radius: var(--radius); margin: 8px 0; }

/* Kommentar-Aktionen (Like-Button etc.) — direkt unter dem Comment-Body */
.comment-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}
.comment-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-light);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    line-height: 1.4;
    letter-spacing: normal;
    box-shadow: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.08s;
}
.comment-like-btn:hover {
    background: var(--brand-green-soft);
    border-color: rgba(34,194,138,0.4);
    color: var(--brand-green-dark);
    box-shadow: none;
    transform: none;
}
.comment-like-btn.liked {
    background: var(--brand-green-soft);
    border-color: rgba(34,194,138,0.5);
    color: var(--brand-green-dark);
    font-weight: 600;
}
.comment-like-btn.liked:hover {
    background: #D4F5E5;
}
.comment-like-icon { font-size: 14px; line-height: 1; }
.comment-like-count { min-width: 8px; }
.comment-like-count[hidden] { display: none; }

/* Passiver Like-Counter (eigene Kommentare — nicht klickbar) */
.comment-like-display {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--brand-green-soft);
    border: 1px solid rgba(34,194,138,0.3);
    border-radius: var(--radius-pill);
    color: var(--brand-green-dark);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
    cursor: default;
}

/* Kommentar-Editor (kompakter als Ticket-Editor) */
#comment-editor { min-height: 100px; }
#comment-editor .ql-editor { min-height: 80px; font-size: 14.5px; }
.comment-own .comment-body {
    background: var(--brand-green-soft);
    border: 1px solid #BBEAD5;
    border-radius: var(--radius);
    padding: 10px 14px;
}

/* ============================================
   Vote-Button (inline in Meta)
   ============================================ */
.vote-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: #F3F4F6;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all .15s var(--ease);
    white-space: nowrap;
    font-family: inherit;
    box-shadow: none;
}
.vote-inline:hover {
    border-color: var(--brand-green);
    background: var(--brand-green-soft);
    color: var(--status-done-fg);
    transform: none;
    box-shadow: none;
}
.vote-inline:disabled {
    cursor: default;
    opacity: 1;
    background: var(--brand-green-soft);
    border-color: #BBEAD5;
    color: var(--status-done-fg);
}
.vote-inline:disabled:hover { transform: none; box-shadow: none; }

/* ============================================
   Detail-Akzent pro Typ (Ticket-Detailseite)
   ============================================ */
.card.type-detail-idee    { border-left: 3px solid var(--brand-green); }
.card.type-detail-problem { border-left: 3px solid #F59E0B; }

/* ============================================
   Empty State (aufgewertet)
   ============================================ */
.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-muted);
}
.empty-state-icon {
    font-size: 52px;
    margin-bottom: 12px;
    display: block;
    opacity: .7;
}
.empty-state h3 { color: var(--text); margin: 12px 0 8px 0; font-size: 18px; }
.empty-state p  { font-size: 14.5px; line-height: 1.55; max-width: 380px; margin: 0 auto; }

/* ============================================
   View-Tabs (oberhalb Filter-Bar)
   ============================================ */
.view-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 14px;
    border-bottom: 2px solid var(--border);
}
.view-tabs a {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s var(--ease), border-color .15s var(--ease);
}
.view-tabs a:hover { color: var(--text); }
.view-tabs a.active {
    color: var(--text);
    border-bottom-color: var(--brand-green);
}

/* ============================================
   V2: Admin-Dashboard + Sub-Navigation
   ============================================ */

.admin-subnav {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin: 0 0 24px 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}
.admin-subnav a {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    border: none;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.admin-subnav a:hover {
    background: #F9FAFB;
    color: var(--text);
    border-color: transparent;
}
.admin-subnav a.active {
    background: var(--brand-green-soft);
    color: var(--brand-green-dark);
    font-weight: 600;
}

.admin-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.dashboard-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow .15s var(--ease);
}
.dashboard-card:hover { box-shadow: var(--shadow); }
.dashboard-card.card-warn {
    border-color: #F59E0B;
    background: #FFFBEB;
}
.dashboard-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dashboard-card-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.dashboard-card-icon { font-size: 18px; opacity: 0.6; }
.dashboard-card-value {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1;
}
.dashboard-card-value .value-sub {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 4px;
}
.dashboard-card-sub {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}
.dashboard-card-sub small {
    font-size: 12px;
    color: var(--text-light);
}

/* Chips (generisch für Dashboard-Cards) */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}
.chip-blue  { background: #EFF6FF; color: #1E40AF; }
.chip-amber { background: #FEF3C7; color: #92400E; }
.chip-green { background: #E9F8F1; color: #0F7A56; }
.chip-red   { background: #FEE2E2; color: #991B1B; }
.chip-gray  { background: #F3F4F6; color: #6B7280; }
.chip-link {
    font-size: 12px;
    color: var(--brand-green-dark);
    font-weight: 600;
    border: none;
    margin-left: auto;
}

/* Budget-Bar (Fortschrittsbalken) */
.budget-bar {
    width: 100%;
    height: 6px;
    background: #F3F4F6;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}
.budget-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-green) 0%, #F59E0B 80%, #EF4444 100%);
    transition: width .3s var(--ease);
}

/* Einfache Tabelle (für Top-Kategorien, Reminder-Logs etc.) */
.simple-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.simple-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}
.simple-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.simple-table tr:last-child td { border-bottom: none; }

/* ============================================
   V2: Admin-Settings (Provider / Features / Prompts / Glossary / Reminders)
   ============================================ */

.settings-section { margin-bottom: 20px; }
.settings-section h2 {
    margin: 0 0 6px 0;
    font-size: 20px;
    letter-spacing: -0.02em;
}
.section-subhead {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 20px 0 10px 0;
}

/* Provider-Auswahl */
.provider-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 14px 0;
}
.provider-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: #fff;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s var(--ease), background .15s var(--ease);
    margin: 0;
}
.provider-row:hover { border-color: var(--text); }
.provider-row.is-active {
    border-color: var(--brand-green);
    background: var(--brand-green-soft);
    box-shadow: 0 0 0 3px rgba(34,194,138,.15);
}
.provider-row input[type=radio] {
    flex-shrink: 0;
    accent-color: var(--brand-green);
}
.provider-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.provider-info strong { font-size: 15px; }
.provider-info small { font-size: 12.5px; color: var(--text-muted); }
.provider-status { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.provider-row.is-whisper { cursor: default; opacity: 0.9; }
.provider-row.is-whisper:hover { border-color: var(--border-strong); }

.ai-test-result {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: none;
}
.ai-test-result.ok { background: #E9F8F1; color: #0F7A56; display: block; }
.ai-test-result.err { background: #FEE2E2; color: #991B1B; display: block; }

/* Feature-Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin: 14px 0;
}
.feature-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin: 0;
}
.feature-check:hover { background: #FAFAFA; }
.feature-check input[type=checkbox] { margin-top: 3px; flex-shrink: 0; accent-color: var(--brand-green); }
.feature-check strong { display: block; font-size: 14px; }
.feature-check small { font-size: 12.5px; color: var(--text-muted); line-height: 1.4; }
.feature-check.feature-child { margin-left: 24px; border-left: 3px solid var(--brand-green); }

/* Limits-Grid */
.limits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px 16px;
    margin: 10px 0;
}
.limits-grid > div { display: flex; flex-direction: column; gap: 4px; }
.limits-grid label { font-size: 13px; font-weight: 600; margin: 0; }
.limits-grid input { padding: 7px 10px; font-size: 14px; }
.limits-grid small { font-size: 12px; color: var(--text-muted); }

/* Usage-Cards (im Feature-Dashboard) */
.usage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 10px 0;
}
.usage-card {
    background: #FAFAFA;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}
.usage-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.usage-value { font-size: 22px; font-weight: 700; margin: 4px 0; letter-spacing: -0.01em; }

/* Prompt-Textareas */
.prompt-textarea {
    width: 100%;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    padding: 12px 14px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    resize: vertical;
    min-height: 160px;
}
.prompt-textarea:focus {
    outline: none;
    border-color: var(--brand-green);
    box-shadow: 0 0 0 3px rgba(34,194,138,.15);
}

/* Glossar + Reminder-Tabellen */
.glossary-table input[type=text],
.glossary-table input[type=number],
.reminder-stages-table input[type=text],
.reminder-stages-table input[type=number],
.reminder-stages-table select {
    width: 100%;
    padding: 6px 8px;
    font-size: 13.5px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.glossary-delete-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity .15s var(--ease);
}
.glossary-delete-label:has(input:checked) {
    opacity: 1;
    color: #EF4444;
    font-weight: 600;
}
.glossary-delete-label input { accent-color: #EF4444; }

.glossary-add {
    margin-top: 16px;
    padding: 12px 14px;
    background: #FAFAFA;
    border-radius: var(--radius-sm);
}
.glossary-add summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--brand-green-dark);
}
.glossary-add-rows { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.glossary-add-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 8px;
}
.glossary-add-row input { padding: 7px 10px; font-size: 13.5px; }
.glossary-add-row-wide {
    grid-template-columns: 2fr 100px 130px;
}

/* Cron-Command-Block */
.cron-command {
    background: #111827;
    color: #E5E7EB;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', Consolas, monospace;
    font-size: 13px;
    overflow-x: auto;
    margin: 10px 0;
    user-select: all;
}
.cron-command code { background: transparent; color: inherit; }

/* Toggle-Switch-Row (größer als manage-toggle) */
.toggle-switch-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 0;
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}
.toggle-switch-row input[type=checkbox] {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
}
.toggle-switch-track {
    display: inline-block;
    width: 44px;
    height: 24px;
    background: #CBD5E1;
    border-radius: 999px;
    position: relative;
    transition: background .2s var(--ease);
}
.toggle-switch-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s var(--ease);
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch-row input:checked ~ .toggle-switch-track {
    background: var(--brand-green);
}
.toggle-switch-row input:checked ~ .toggle-switch-track::after {
    transform: translateX(20px);
}

/* ============================================
   V2: KI-Features in new.php
   ============================================ */

/* Duplikat-Warnung */
.duplicate-warning {
    background: #FFFBEB;
    border: 1.5px solid #F59E0B;
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 12px 0 18px 0;
    animation: fadeInDup .25s var(--ease);
}
@keyframes fadeInDup {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.duplicate-warning-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.duplicate-warning-title {
    font-size: 14px;
    font-weight: 700;
    color: #92400E;
}
.duplicate-warning-ignore {
    background: transparent;
    border: 1px solid #E5E7EB;
    color: var(--text-muted);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    cursor: pointer;
}
.duplicate-warning-ignore:hover { background: #F3F4F6; color: var(--text); }
.duplicate-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.duplicate-list li {
    padding: 6px 0;
    border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}
.duplicate-list li:last-child { border-bottom: none; }
.duplicate-list a {
    color: #92400E;
    font-weight: 600;
    border-bottom: 1px solid transparent;
}
.duplicate-list a:hover { border-bottom-color: #92400E; }
.duplicate-sim {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-left: 6px;
}
.duplicate-reason {
    font-size: 13px;
    color: #78350F;
    margin-top: 2px;
    font-style: italic;
}

/* Suggest-Pills (Kategorie / Priorität) */
.ai-suggest-pill {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    background: var(--brand-green-soft);
    color: var(--brand-green-dark);
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    cursor: pointer;
    margin-left: 8px;
    border: 1px solid rgba(34,194,138,0.3);
    transition: background .15s var(--ease), transform .1s var(--ease);
    animation: fadeInPill .25s var(--ease);
}
.ai-suggest-pill:hover {
    background: var(--brand-green);
    color: #fff;
    transform: scale(1.03);
}
@keyframes fadeInPill {
    from { opacity: 0; transform: translateX(-4px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ============================================
   V2: Voice-Recorder (Spracheingabe)
   ============================================ */

.description-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.voice-record-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    background: #fff;
    color: var(--brand-green-dark);
    border: 1.5px solid var(--brand-green);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background .15s var(--ease), color .15s var(--ease), transform .1s var(--ease);
    white-space: nowrap;
}
.voice-record-btn:hover:not(:disabled) {
    background: var(--brand-green-soft);
}
.voice-record-btn:active:not(:disabled) {
    transform: scale(0.98);
}
.voice-record-btn:disabled {
    cursor: wait;
    opacity: 0.7;
}
.voice-record-btn.is-recording {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #EF4444;
    animation: voicePulse 1.2s ease-in-out infinite;
}
.voice-record-btn.is-recording.is-warning {
    background: #FEF3C7;
    color: #92400E;
    border-color: #F59E0B;
}
@keyframes voicePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50%      { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}
.voice-record-btn.is-transcribing {
    background: #F3F4F6;
    color: var(--text-muted);
    border-color: var(--border-strong);
}

.voice-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--brand-green);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
    z-index: 9999;
    pointer-events: none;
}
.voice-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   V2: Auto-Kategorisierung + Proposals + Misc
   ============================================ */

/* Sub-Nav Badge (Anzahl Pending-Vorschläge) */
.subnav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    margin-left: 4px;
    background: #EF4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    vertical-align: 1px;
}

/* Auto-Kategorie-Hinweis in new.php */
.ai-auto-category-notice {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    background: var(--brand-green-soft);
    border: 1px solid rgba(34,194,138,0.3);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--brand-green-dark);
}
.ai-auto-category-notice strong { font-weight: 600; }
.ai-auto-category-notice small { font-size: 12.5px; color: var(--text-muted); font-weight: 400; }

/* KI-Kategorie-Pill (klickbar, öffnet Dropdown zum Override) */
.ai-cat-picker {
    display: block;
    margin-bottom: 4px;
}
.ai-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    transition: background .15s var(--ease), border-color .15s var(--ease);
    font-family: inherit;
    max-width: 100%;
}
.ai-cat-pill:hover {
    background: #FAFAFA;
    border-color: var(--text);
}
.ai-cat-picker[data-state="waiting"] .ai-cat-pill,
.ai-cat-picker[data-state="loading"] .ai-cat-pill {
    color: var(--text-muted);
    font-weight: 400;
    font-style: italic;
    background: #FAFAFA;
}
.ai-cat-pill .pill-icon { font-size: 16px; }
.ai-cat-pill .pill-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ai-cat-pill .pill-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ai-cat-pill .pill-edit-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-left: 4px;
    opacity: 0;
    transition: opacity .15s var(--ease);
}
.ai-cat-pill:hover .pill-edit-hint { opacity: 1; }
.ai-cat-picker[data-state="ready"] .ai-cat-pill,
.ai-cat-picker[data-state="manual"] .ai-cat-pill {
    background: #fff;
}
.ai-cat-select {
    width: auto;
    min-width: 240px;
}

/* Content-Check-Box (Verständlichkeits-Tipps) */
.content-check-box {
    margin: 10px 0 16px 0;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    line-height: 1.5;
    animation: fadeInCC .25s var(--ease);
}
@keyframes fadeInCC {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.content-check-box.is-good {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #E9F8F1;
    border: 1px solid rgba(34,194,138,0.3);
    color: #0F7A56;
}
.content-check-box.is-tip {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    color: #1E3A8A;
}
.content-check-box.is-warn {
    background: #FFFBEB;
    border: 1px solid #FCD34D;
    color: #92400E;
}
.content-check-box.is-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #F9FAFB;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.content-check-box.is-hint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #FAFAFA;
    border: 1px dashed var(--border-strong);
    color: var(--text-muted);
    font-style: italic;
    font-size: 13px;
}
.content-check-box.is-hint .cc-icon {
    font-style: normal;
}
.cc-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(34,194,138,0.2);
    border-top-color: var(--brand-green);
    border-radius: 50%;
    animation: ccSpin .8s linear infinite;
    flex-shrink: 0;
}
@keyframes ccSpin {
    to { transform: rotate(360deg); }
}
.pill-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(34,194,138,0.25);
    border-top-color: var(--brand-green);
    border-radius: 50%;
    animation: ccSpin .8s linear infinite;
    flex-shrink: 0;
}
.content-check-box .cc-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.content-check-box .cc-icon { font-size: 16px; }
.content-check-box .cc-title { font-weight: 600; font-size: 13.5px; flex: 1; }
.content-check-box .cc-summary { font-size: 13.5px; }
.content-check-box .cc-dismiss {
    background: transparent;
    border: none;
    color: currentColor;
    opacity: 0.5;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
}
.content-check-box .cc-dismiss:hover { opacity: 1; background: rgba(0,0,0,0.05); }
.content-check-box .cc-tips {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.content-check-box .cc-tips li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.content-check-box .cc-tip-icon { flex-shrink: 0; }
.content-check-box .cc-tip-text { flex: 1; }

/* Proposal-Card (Admin-Review-Queue) */
.proposal-card { margin-bottom: 14px; }
.proposal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.proposal-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--brand-green-dark);
    letter-spacing: -0.01em;
}
.proposal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 16px;
}
.proposal-col { display: flex; flex-direction: column; gap: 4px; }
.proposal-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}
.proposal-form {
    background: #FAFAFA;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin: 0;
}
.proposal-edit-grid {
    display: grid;
    grid-template-columns: 2fr 3fr 100px;
    gap: 10px 12px;
    margin-bottom: 12px;
}
.proposal-edit-grid label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 3px 0;
}
.proposal-edit-grid input[type=text] {
    padding: 7px 10px;
    font-size: 13.5px;
}
.proposal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.proposal-actions button { margin: 0; }

/* Kategorie-Description-Input in admin_categories.php */
.cat-description-input {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 6px 8px;
    font-size: 12.5px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.cat-description-input:focus {
    outline: none;
    border-color: var(--brand-green);
    box-shadow: 0 0 0 2px rgba(34,194,138,.15);
    color: var(--text);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    header.site { padding: 14px 18px; flex-wrap: wrap; }
    header.site nav {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 2px;
        padding-top: 12px;
        border-top: 1px solid var(--border);
        margin-top: 12px;
    }
    header.site nav.is-open { display: flex; }
    header.site nav a {
        width: 100%;
        padding: 10px 14px;
        border-radius: var(--radius-sm);
    }
    header.site nav .user-chip { margin-top: 4px; }
    .wordmark .tagline { display: none; }
    main { padding: 0 16px; margin: 20px auto 40px; }
    .page-head h1 { font-size: 26px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .segmented { justify-content: center; }
    .type-toggle { grid-template-columns: 1fr; }
    .form-grid-2 { grid-template-columns: 1fr; gap: 0; }
    .form-grid-2 > div > label:first-child { margin-top: 18px; }
    .form-row-flex { flex-direction: column; }
    .user-table thead { display: none; }
    .user-table, .user-table tbody, .user-table tr, .user-table td {
        display: block; width: 100%;
    }
    .user-table tbody tr {
        padding: 12px 0;
        border-bottom: 1px solid var(--border);
    }
    .user-table tbody td {
        padding: 2px 14px;
        border-bottom: none;
    }
    .admin-grid { grid-template-columns: 1fr; }
    .admin-dashboard { grid-template-columns: 1fr; }
    .admin-subnav { flex-wrap: wrap; }
    .view-tabs a { padding: 10px 14px; font-size: 13px; }
    .manage-bar { flex-direction: column; }
    .manage-field { width: 100%; }
    .manage-input { width: 100%; }
    .manage-inline-form { flex-direction: column; align-items: stretch; }
    .manage-label { min-width: auto; }
    .manage-select { flex: 1 1 auto; }
    .manage-reason { flex: 1 1 auto; }
    .comment-form-actions { flex-direction: column; align-items: stretch; }
}
