/**
 * Board Management System - Styles
 * Primary color: var(--color-title)
 * Background: var(--color-background)
 * Secondary color: var(--color-accent)
 */

/* Design-Tokens: zentrale Single Source of Truth (Light + Dark).
   theme.css wird NICHT mehr hier ge-@import-et (das erzwang manuelles
   Versions-Pflegen) — es wird dynamisch mit ?v=ASSET_VERSION geladen:
   - App-Seiten:        includes/header.php
   - Seiten ohne Header: eigener <link> im <head> (login, farben, orga …) */

/* ================================
   BASE: Variables -> siehe theme.css
   ================================ */


/* ================================
   BASE: SVG Icon Sprite
   ================================ */
.icon {
    display: inline-block;
    vertical-align: middle;
    fill: currentColor;
    flex-shrink: 0;
    pointer-events: none;
}

/* ================================
   BASE: Reset, Typography
   ================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

* {
    scrollbar-width: none;
}

*::-webkit-scrollbar {
    display: none;
}

body {
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--color-primary);
    background-color: var(--color-background);
    overflow: hidden;
}

/* iOS date/datetime input fix - prevent overflow */
input[type="date"],
input[type="datetime-local"] {
    -webkit-appearance: none;
    appearance: none;
    max-width: 100%;
    min-width: 0;
    min-height: 42px;
    color: var(--color-text);
    font-family: inherit;
}

/* Global select fix - prevent macOS/iOS from shrinking selects and rendering text in system-link blue */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    min-height: 42px;
    font-family: inherit;
    color: var(--color-text);
    -webkit-text-fill-color: var(--color-text);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px !important;
    cursor: pointer;
}

select option {
    color: var(--color-text);
    -webkit-text-fill-color: var(--color-text);
}

select:disabled {
    color: var(--color-text-light, var(--color-text-muted));
    -webkit-text-fill-color: var(--color-text-light, var(--color-text-muted));
    opacity: 1;
}

select[multiple] {
    background-image: none;
    padding-right: unset !important;
    min-height: unset;
}

/* iOS placeholder color for empty date inputs */
input[type="date"]:invalid,
input[type="datetime-local"]:invalid {
    color: var(--color-text-muted);
}

input[type="date"]::-webkit-date-and-time-value {
    text-align: left;
    color: var(--color-text);
}

/* Prevent iOS zoom on input focus - minimum 16px font-size.
   Deckt alle Text-Eingabefelder ab (auch type-los, time, month, week), schließt
   aber Button-/Toggle-Typen aus, damit deren Beschriftung/Layout nicht erzwungen
   auf 16px hochskaliert (nur Texteingaben lösen den iOS-Zoom überhaupt aus). */
@media (max-width: 767px) {
    input:not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="image"]),
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* ================================
   LAYOUT: App Container, Sidebar, Main Content
   ================================ */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--glass-bg);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    transition: width 0.25s ease;
}

.logo {
    padding: 12px 20px;
    /* border-bottom: 1px solid var(--color-border); */ /* ersetzt durch Blur-Fade auf .sidebar-logo-sticky */
    background-color: var(--glass-bg);
    color: var(--color-text);
    text-align: center;
    min-height: 65px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.logo img,
.logo .icon {
    max-width: 100%;
    height: auto;
}

.logo h1 {
    font-size: 18px;
    font-weight: 600;
}

.nav-menu {
    flex: 1;
}

.nav-section {
    margin-bottom: 10px;
}

.nav-section-title {
    padding: 10px 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
}

.nav-list {
    list-style: none;
}

.nav-item {
    padding: 5px 20px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    margin: 10px;
}

.nav-item:hover {
    background-color: var(--color-hover);
    color: var(--color-title);
    margin: 10px;
    border-radius: 5px;
}

.nav-item.active {
    background-color: var(--nav-active-bg);
    color: var(--nav-active-text);
    margin: 10px;
    border-radius: 5px;
}

.nav-item svg,
.nav-item img {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.nav-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    margin: 10px;
    border-radius: 5px;
}

.nav-item.disabled:hover {
    background-color: transparent;
    margin: 10px;
    border-radius: 5px;
}

.nav-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

/* Submenu styles */
.nav-item.has-submenu {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    margin: 10px;
}

.nav-item.has-submenu > .nav-link {
    padding: 5px 20px;
    justify-content: flex-start;
}

.nav-item.has-submenu:hover {
    background-color: transparent;
}

.nav-item.has-submenu > .nav-link:hover {
    background-color: var(--color-hover);
    border-radius: 5px;
}

.submenu-arrow {
    width: 14px !important;
    height: 14px !important;
    margin-left: auto;
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.nav-item.has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

.nav-submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease;
    opacity: 0;
    padding-left: 0;
    margin: 0;
}

.nav-item.has-submenu.open .nav-submenu {
    max-height: 500px;
    opacity: 1;
}

.nav-subitem {
    padding: 0;
}

.nav-subitem a {
    display: block;
    padding: 8px 20px 8px 48px;
    text-decoration: none;
    color: var(--color-text-secondary);
    font-size: 13px;
    transition: background-color 0.2s, color 0.2s;
}

.nav-subitem a:hover {
    background-color: var(--gray-100);
    color: var(--color-primary);
    border-radius: 5px;
}

.nav-subitem.active a {
    background-color: var(--gray-200);
    color: var(--color-primary);
    font-weight: 500;
    border-radius: 5px;
}

/* ---- Objekte-Schnellzugriff (Split-Link + zuletzt geöffnete / gepinnte Objekte) ---- */
.nav-item.objekte-nav > .nav-link-split {
    display: flex;
    align-items: center;
    padding: 0;
    gap: 0;
    width: 100%;
}
.objekte-nav .nav-link-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px 5px 20px;
    color: inherit;
    text-decoration: none;
    border-radius: 5px;
}
.objekte-nav .nav-link-main:hover {
    background-color: var(--color-hover);
}
.objekte-submenu-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    padding: 6px 14px 6px 6px;
    border-radius: 5px;
}
.objekte-submenu-toggle:hover {
    background-color: var(--color-hover);
}
.objekte-submenu-toggle:hover .submenu-arrow {
    opacity: 1;
}

/* Offen: mehr Höhe + Scroll bei vielen (gepinnten) Objekten */
.nav-item.objekte-nav.open .objekte-submenu {
    max-height: 60vh;
    overflow-y: auto;
}

/* Gruppen-Überschriften + Leer-/Ladezustand */
.objekte-group-label {
    padding: 8px 20px 2px 48px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    opacity: 0.7;
    pointer-events: none;
}
.objekte-empty span,
.objekte-loading span {
    display: block;
    padding: 8px 20px 8px 48px;
    font-size: 12px;
    color: var(--color-text-secondary);
    font-style: italic;
}

/* Objekt-Zeile: Link + Pin-Button */
.objekte-item {
    display: flex;
    align-items: center;
    padding: 0;
}
.objekte-item .objekte-link {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 6px 4px 6px 48px;
    text-decoration: none;
    color: var(--color-text-secondary);
    border-radius: 5px;
    transition: background-color 0.2s, color 0.2s;
}
.objekte-item .objekte-link:hover {
    background-color: var(--gray-100);
    color: var(--color-primary);
}
.objekte-item .objekte-title {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.objekte-item .objekte-sub {
    font-size: 11px;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.objekte-pin {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 16px 6px 6px;
    color: var(--color-text-secondary);
    opacity: 0.3; /* normaler Pin dezent sichtbar */
    transition: opacity 0.15s, color 0.15s;
}
.objekte-item.is-pinned .objekte-pin {
    opacity: 0.8; /* gepinnter (voller) Pin deutlicher */
}
.objekte-pin:hover,
.objekte-item.is-pinned .objekte-pin:hover {
    opacity: 1;
    color: var(--color-primary);
}
.objekte-pin:disabled {
    opacity: 0.4;
    cursor: default;
}

/* Collapsed: nur Home-Icon, Toggle + Submenu ausblenden.
   Toggle hart ausblenden und Link NICHT strecken, damit der Container das
   Icon exakt mittig setzt (identisch zu normalen Nav-Icons). */
.sidebar.collapsed .objekte-nav > .nav-link-split {
    justify-content: center;
    padding: 5px 0;
}
.sidebar.collapsed .objekte-nav .objekte-submenu-toggle {
    display: none; /* kein !important — hover-expanded muss ihn wieder einblenden können */
}
.sidebar.collapsed .objekte-nav .nav-link-main {
    flex: 0 1 auto;
    width: auto;
    justify-content: center;
    gap: 0; /* sonst schiebt der 10px-Gap zum (per font-size:0 versteckten) Text das Icon aus der Mitte */
    padding: 5px 0;
}
/* Hover-Expanded: Split-Layout wiederherstellen */
.sidebar.collapsed.hover-expanded .objekte-nav .objekte-submenu-toggle {
    display: flex;
}
.sidebar.collapsed.hover-expanded .objekte-nav .nav-link-main {
    flex: 1; /* collapsed setzt flex:0 — sonst rückt der Toggle direkt neben den Text */
    justify-content: flex-start;
    gap: 10px; /* collapsed setzt gap:0 — sonst klebt das Icon am Text */
    padding: 5px 8px 5px 20px;
}

.unread-badge {
    background-color: #ef4444;   /* Solid red-500, Light + Dark */
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 10px;
    margin-left: auto;
    min-width: 18px;
    text-align: center;
}

.btn-new-board {
    margin: 10px 20px;
    padding: 8px 12px;
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-new-board:hover {
    opacity: 0.8;
}

/* ================================
   BOARD: Header, Search, Groups, Entries, Cells
   ================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* .board-header is defined in header.css (loaded after style.css) */

.board-header-2 {
    padding: 10px 16px;
    background-color: var(--glass-bg);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 65px;
    z-index: 99;
}

@media (min-width: 768px) {
    .board-header-2 {
        padding: 15px 30px;
    }
}

.search-filter-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 100px;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color 0.2s;
}

/* Tablet+ */
@media (min-width: 768px) {
    .search-filter-section {
        gap: 15px;
    }

    .search-input {
        min-width: 200px;
        padding: 8px 15px;
    }
}

.search-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: var(--shadow-focus);
}

.btn-filter {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    background-color: var(--color-white);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Mobile: nur Icon zeigen */
@media (max-width: 767px) {
    .btn-filter span,
    .btn-filter:not(:has(img))::after {
        display: none;
    }

    .btn-filter {
        padding: 8px;
    }
}

/* Tablet+: Text zeigen */
@media (min-width: 768px) {
    .btn-filter {
        gap: 6px;
        padding: 8px 16px;
        font-size: 14px;
    }
}

.btn-filter:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-filter.active {
    background-color: var(--color-white);
    border-color: var(--gray-900);
    color: var(--color-text);
}

/* Toggle Switch for "Show only me" */
.toggle-me-wrapper {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.toggle-me-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.toggle-me-checkbox {
    display: none;
}

.toggle-me-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background-color: var(--color-border);
    border-radius: 20px;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.toggle-me-text {
    font-size: 12px;
    white-space: nowrap;
}

/* Mobile: Toggle-Text kürzer */
@media (max-width: 479px) {
    .toggle-me-text {
        display: none;
    }
}

/* Tablet+: Toggle größer */
@media (min-width: 768px) {
    .toggle-me-slider {
        width: 42px;
        height: 24px;
    }

    .toggle-me-label {
        gap: 8px;
    }

    .toggle-me-text {
        font-size: 14px;
    }
}

.toggle-me-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background-color: var(--white);
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-me-checkbox:checked + .toggle-me-slider {
    background-color: var(--color-accent);
}

.toggle-me-checkbox:checked + .toggle-me-slider::before {
    transform: translateX(16px);
}

/* Tablet+: größerer Knob */
@media (min-width: 768px) {
    .toggle-me-slider::before {
        top: 3px;
        left: 3px;
        width: 18px;
        height: 18px;
    }

    .toggle-me-checkbox:checked + .toggle-me-slider::before {
        transform: translateX(18px);
    }
}

/* Active Filters - auf Mobile ausblenden wenn leer, oder unter Suche */
.active-filters {
    display: none;
    gap: 6px;
    flex-wrap: wrap;
}

.active-filters:not(:empty) {
    display: flex;
}

/* Mobile: Active Filters in neue Zeile */
@media (max-width: 767px) {
    .active-filters {
        width: 100%;
        margin-top: 8px;
    }
}

@media (min-width: 768px) {
    .active-filters {
        gap: 8px;
    }
}

.board-title-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.board-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-primary);
    margin: 0;
}

.btn-icon-small {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--color-text-secondary);
    padding: 4px 8px;
    transition: color 0.2s;
}

.btn-icon-small:hover {
    color: var(--color-primary);
}

.board-entry-count {
    font-size: 14px;
    color: var(--color-text-secondary);
    padding: 4px 12px;
    background-color: var(--gray-200);
    border-radius: var(--radius-xl);
}

.board-actions {
    display: flex;
    gap: 10px;
}

.btn-action {
    padding: 8px 16px;
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-action:hover {
    opacity: 0.8;
}

/* Gray variant for Add Group/Column buttons - now white with border */
.btn-action.btn-gray {
    background-color: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-action.btn-gray:hover {
    background-color: var(--gray-100);
    border-color: var(--color-primary);
}

/* Green variant for Add Entry button - now black */
.btn-action.btn-green {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.btn-action.btn-green:hover {
    opacity: 0.8;
}

/* Add Filter Button (dashed green border) */
.btn-add-filter {
    padding: 10px 16px;
    border: 1px dashed var(--gray-900);
    background: transparent;
    color: var(--gray-900);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-filter:hover {
    background: var(--gray-900);
    color: var(--color-white);
    border-style: solid;
}

/* Compose button (black) */
.btn-compose {
    padding: 8px 16px;
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-compose:hover {
    background-color: var(--gray-700);
}

/* Icon button */
.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    background-color: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: var(--gray-100);
    border-color: var(--color-primary);
}

.btn-icon img,
.btn-icon .icon {
    width: 16px;
    height: 16px;
}

/* Board Container */
.board-container {
    flex: 1;
    overflow: auto;
    overflow-x: auto;
    overflow-y: auto;
    padding: 20px;
    background-color: var(--color-white);
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-secondary);
}

.welcome-message h3 {
    margin-bottom: 10px;
    color: var(--color-primary);
}

/* Board Grid - List View (Monday.com style) */
.board-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
}

/* Group */
.group {
    width: 100%;
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
}

.group-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--color-background);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
}

.group-count {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-left: 8px;
}

.group-actions {
    display: flex;
    gap: 8px;
}

/* Small icon buttons inside groups */
.group-actions .btn-icon {
    width: auto;
    height: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 4px;
}

.group-actions .btn-icon:hover {
    color: var(--color-primary);
    background: none;
    border: none;
}

.group-body {
    flex: 1;
    overflow-x: auto;
    position: relative;
}

.table-header {
    display: flex;
    align-items: center;
    padding: 0;
    background-color: var(--color-background);
    color: var(--color-primary);
    font-weight: 600;
    font-size: 13px;
    position: sticky;
    top: 0;
    z-index: 10;
    min-width: max-content;
    height: 36px;
    /* Ensure header scrolls horizontally with content */
    flex-shrink: 0;
}

.entry {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--color-border-light);
    max-height: 40px;
    min-height: 40px;
    cursor: move;
    transition: background-color 0.2s;
    min-width: max-content;
    position: relative;
}

.group-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    background-color: var(--gray-50);
}

.btn-add-entry {
    width: 100%;
    padding: 8px;
    background-color: transparent;
    color: var(--color-primary);
    border: 1px dashed var(--color-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-add-entry:hover {
    background-color: var(--gray-200);
}

/* Entry - moved to group-body section above */

.entry:hover {
    background-color: var(--color-background);
}

.entry.dragging {
    opacity: 0.5;
}

.entry.drag-over {
    border-top: 2px solid var(--color-accent);
}

.entry-cell {
    padding: 8px 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    min-width: 100px;
    width: 150px;
    border-right: 1px solid var(--color-border-light);
    flex-shrink: 0;
}

.entry-cell:last-child {
    border-right: none;
}

.entry-actions {
    display: none;
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    gap: 5px;
    background-color: var(--color-white);
    padding: 2px;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 0 1px var(--color-line);
}

.entry:hover .entry-actions {
    display: flex;
}

.entry-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 14px;
    color: var(--color-text-secondary);
    transition: color 0.2s;
}

.entry-action-btn:hover {
    color: var(--color-primary);
}

.entry-action-btn.delete:hover {
    color: var(--color-error);
}

.entry-cell.cell-name {
    font-weight: 500;
    color: var(--color-primary);
}

.entry-cell[contenteditable="true"],
.name-text[contenteditable="true"] {
    cursor: text;
    outline: none;
}

.name-text[contenteditable="true"] {
    padding: 8px 12px;
    display: block;
}

.entry-cell[contenteditable="true"]:focus,
.name-text[contenteditable="true"]:focus {
    background-color: var(--color-white);
    box-shadow: inset 0 0 0 2px var(--color-accent);
}

/* WebSocket Real-time Collaboration Indicators */
.entry-cell.updated-by-other {
    animation: flash-update 0.6s ease;
}

@keyframes flash-update {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: var(--color-accent);
        box-shadow: 0 0 8px rgba(20,184,166, 0.3);
    }
}

/* Field Locking Indicators - DEAKTIVIERT (nicht benötigt)
.entry-cell.field-locked-by-other {
    position: relative;
    background-color: var(--color-warning-bg) !important;
    border: 1px solid #FFB800 !important;
    cursor: not-allowed !important;
    pointer-events: none;
}

.entry-cell.field-locked-by-other::before {
    content: '🔒';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    opacity: 0.7;
}

.lock-indicator {
    position: absolute;
    top: -8px;
    right: -8px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #FFB800;
    color: var(--white);
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid var(--white);
    box-shadow: 0 0 0 1px var(--color-line);
    z-index: 100;
    white-space: nowrap;
}

.lock-indicator img {
    filter: invert(1);
}
*/

/* User presence notification */
.user-join-notification,
.user-leave-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--color-surface);
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 0 0 1px var(--color-line);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    animation: slide-in-right 0.3s ease;
}

@keyframes slide-in-right {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.user-join-notification {
    border-left: 4px solid var(--color-accent);
}

.user-leave-notification {
    border-left: 4px solid var(--color-text-muted);
}

/* WebSocket connection status indicator */
.ws-status-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--color-surface);
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 0 0 1px var(--color-line);
    font-size: 12px;
    z-index: 9999;
}

.ws-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-accent);
    animation: pulse-dot 2s infinite;
}

.ws-status-dot.disconnected {
    background: var(--color-error);
    animation: none;
}

.ws-status-dot.connecting {
    background: #FFB800;
    animation: pulse-fast 1s infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes pulse-fast {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

/* Column Types Styling */
.cell-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-not-started {
    background-color: var(--color-border);
    color: var(--color-text-secondary);
}

.status-in-progress {
    background-color: var(--color-accent);
    color: var(--color-primary);
}

.status-completed {
    background-color: var(--color-success);
    color: var(--white);
}

.status-on-hold {
    background-color: var(--color-warning);
    color: var(--white);
}

.cell-date {
    color: var(--color-info);
    cursor: pointer;
}

.cell-email,
.cell-link,
.cell-phone {
    color: var(--color-link);
}

.cell-link a,
.cell-email a,
.cell-phone a {
    color: var(--color-link);
    text-decoration: none;
}

.cell-link a:hover,
.cell-email a:hover,
.cell-phone a:hover {
    text-decoration: underline;
}

/* User Column Styling */
.cell-user {
    padding: 4px 12px;
    display: flex;
    align-items: center;
}

.user-avatar-cell {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-border);
    cursor: pointer;
    transition: transform 0.2s;
}

.user-avatar-cell:hover {
    transform: scale(1.1);
}

.user-avatar-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-cell.disabled {
    border: 2px solid red;
}

.user-initials-cell {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
}

.user-avatar-cell.empty-user {
    background-color: var(--gray-200);
    border: 1px dashed var(--gray-400);
    cursor: pointer;
    transition: all 0.2s;
}

.user-avatar-cell.empty-user:hover {
    background-color: var(--color-border);
    border-color: var(--color-text-muted);
}

.empty-user-icon {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-muted);
}

/* User Selection Modal */
.user-selection-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.user-selection-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
}

.user-selection-item:hover {
    background-color: var(--color-background);
    border-color: var(--color-accent);
}

.user-selection-item.selected {
    background-color: var(--color-success-bg);
    border-color: var(--color-accent);
}

.user-avatar-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-border);
    flex-shrink: 0;
}

.user-avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-option.initials {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
}

.user-avatar-option.disabled {
    border: 2px solid red;
}

.user-avatar-option.empty {
    background-color: var(--gray-100);
    color: var(--color-text-muted);
    font-size: 20px;
}

.user-name-option {
    font-size: 14px;
    color: var(--color-primary);
    font-weight: 500;
}

/* User Selection Modal - Compact Grid Layout */
.user-selection-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-search-wrapper {
    position: sticky;
    top: 0;
    background: var(--color-surface);
    padding-bottom: 8px;
    z-index: 1;
}

.user-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.user-search-input:focus {
    border-color: var(--color-accent);
}

.user-search-input::placeholder {
    color: var(--color-text-muted);
}

.user-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 4px;
}

.user-selection-item-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.user-selection-item-compact:hover {
    background-color: var(--color-background);
    border-color: var(--color-accent);
}

.user-selection-item-compact.selected {
    background-color: var(--color-success-bg);
    border-color: var(--color-accent);
}

.user-avatar-compact {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-border);
    flex-shrink: 0;
    object-fit: cover;
}

.user-avatar-compact.initials {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
}

.user-avatar-compact.disabled {
    border: 2px solid red;
}

.user-avatar-compact.empty {
    background-color: var(--gray-100);
    color: var(--color-text-muted);
    font-size: 16px;
}

.user-name-compact {
    font-size: 12px;
    color: var(--color-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Status Selection Modal */
.status-selection-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 450px;
    overflow-y: auto;
}

.status-selection-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
}

.status-selection-item:hover {
    background-color: var(--color-background);
    border-color: var(--color-accent);
}

.status-selection-item.selected {
    background-color: var(--color-success-bg);
    border-color: var(--color-accent);
}

.status-color-preview {
    width: 28px;
    height: 22px;
    border-radius: 4px;
    flex-shrink: 0;
}

.status-label {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
}

.status-hint-icon {
    position: relative;
    flex-shrink: 0;
    color: var(--color-text-light);
    cursor: help;
    display: flex;
    align-items: center;
}

.status-hint-icon:hover {
    color: var(--color-text);
}

.status-hint-icon:hover::after {
    content: attr(data-hint);
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 8px;
    background: var(--color-text);
    color: var(--white);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
    max-width: 280px;
    white-space: normal;
}

.cell-number,
.cell-currency {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.cell-formula {
    text-align: right;
    font-variant-numeric: tabular-nums;
    background-color: var(--gray-100);
    color: var(--color-text-secondary);
    cursor: pointer;
}

.cell-formula:hover {
    background-color: var(--color-border);
}

/* Form help text */
.form-help {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 4px;
    line-height: 1.4;
}

/* Virtual Scrolling */
.virtual-scroll-wrapper {
    position: relative;
    width: 100%;
}

.virtual-scroll-content {
    position: absolute;
    left: 0;
    right: 0;
    min-width: max-content;
}

/* Group Totals Row */
.group-totals {
    display: flex;
    align-items: center;
    padding: 0;
    background-color: var(--gray-50);
    border-top: 2px solid var(--color-primary);
    font-weight: 600;
    min-width: max-content;
}

.total-cell {
    padding: 8px 12px;
    min-width: 100px;
    width: 150px;
    text-align: right;
    font-size: 13px;
    color: var(--color-primary);
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ================================
   COMPONENTS: Modals, Forms, Buttons
   ================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-content.filter-modal-wide {
    max-width: 800px;
}

.modal-header {
    padding: 20px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--color-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
    gap: 10px;
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--color-primary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: var(--shadow-focus);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.btn-primary:hover {
    opacity: 0.8;
}

.btn-secondary {
    background-color: var(--color-border);
    color: var(--color-primary);
}

.btn-secondary:hover {
    opacity: 0.8;
}

.btn-green {
    background-color: var(--color-accent);
    color: var(--color-primary);
}

.btn-green:hover {
    background-color: var(--color-accent-dark);
}

.btn-danger {
    background-color: var(--color-danger);
    color: var(--white);
}

.btn-danger:hover {
    background-color: var(--color-danger);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Table Header - moved to group-body section above */

.header-cell {
    padding: 8px 12px;
    min-width: 100px;
    width: 150px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-cell:last-child {
    border-right: none;
}

.header-cell-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-cell-actions {
    display: none;
    gap: 5px;
    margin-left: 5px;
}

.header-cell:hover .header-cell-actions {
    display: flex;
}

/* Draggable Columns */
.header-cell.draggable-column {
    cursor: move;
}

.header-cell.draggable-column:hover {
    background-color: rgba(20,184,166, 0.1);
}

.header-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font-size: 12px;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.header-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.column-resizer {
    position: absolute;
    right: 0;
    top: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    background-color: transparent;
    z-index: 20;
}

.column-resizer:hover {
    background-color: var(--color-accent);
}

.column-resizer.resizing {
    background-color: var(--color-accent);
}

/* ================================
   UTILITIES: Hidden, Text-Align, Live Updates
   ================================ */
.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Live Update Notification */
.live-update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.3);
    color: var(--color-title);
    padding: 12px 20px;
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(7.2px);
    -webkit-backdrop-filter: blur(7.2px);
    border: 1px solid rgba(0, 0, 0, 0.3);
    z-index: 9999;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.live-update-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.live-update-notification span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

/* Date Picker Styling */
.date-picker-input {
    cursor: pointer;
}

.date-picker-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    font-size: 16px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-200);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Status Management Modal */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background-color: var(--color-background);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    cursor: move;
}

.status-item:hover {
    background-color: var(--gray-200);
}

.status-drag-handle {
    cursor: grab;
    color: var(--color-text-secondary);
    font-size: 16px;
    user-select: none;
}

.status-item:active .status-drag-handle {
    cursor: grabbing;
}

/* Color picker wrapper and button */
.color-picker-wrapper {
    position: relative;
}

.status-color-button {
    width: 40px;
    height: 30px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.1s;
    padding: 0;
}

.status-color-button:hover {
    border-color: var(--color-accent);
    transform: scale(1.05);
}

.status-color-button:active {
    transform: scale(0.95);
}

/* Color palette popup */
.color-palette-popup {
    position: absolute;
    top: 35px;
    left: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: 0 0 0 1px var(--color-line);
    z-index: 1000;
    min-width: 280px;
}

.color-palette-picker {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.color-family {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.color-family-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-swatches {
    display: flex;
    gap: 6px;
}

.color-swatch {
    width: 50px;
    height: 32px;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.color-swatch:hover {
    border-color: var(--color-accent);
    transform: scale(1.05);
}

.color-swatch.selected {
    border-color: var(--color-primary);
    border-width: 3px;
    transform: scale(1.05);
}

.status-name-input {
    flex: 1;
    margin: 0 !important;
}

.status-delete-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    color: var(--color-text-secondary);
    transition: color 0.2s;
}

.status-delete-btn:hover {
    color: var(--color-error);
}

/* Filter System */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background-color: var(--gray-200);
    color: var(--color-text);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
}

.filter-chip-remove {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
    font-size: 14px;
    line-height: 1;
}

.filter-chip-remove:hover {
    color: var(--color-error);
}

/* Saved Filter Chips (gray background) */
.saved-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background-color: var(--color-border);
    color: var(--color-text);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.saved-filter-chip:hover {
    background-color: var(--gray-400);
}

.saved-filter-chip-name {
    cursor: pointer;
}

.saved-filter-chip-name:hover {
    text-decoration: underline;
}

.saved-filter-chip-remove {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
    font-size: 14px;
    line-height: 1;
}

.saved-filter-chip-remove:hover {
    color: var(--color-error);
}

.filter-modal-content {
    max-width: 700px;
}

/* Mobile: Filter-Modal Fullscreen */
@media (max-width: 767px) {
    .filter-modal-content,
    .modal-content.filter-modal-wide {
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .filter-modal-content .modal-body,
    .modal-content.filter-modal-wide .modal-body {
        max-height: calc(100vh - 140px);
        max-height: calc(100dvh - 140px);
        overflow-y: auto;
    }
}

/* UND/ODER-Verknuepfung der Filterbedingungen (Board-Filter, filter.js) */
.board-filter-logic {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-bottom: 10px;
}

.board-filter-logic-label {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.board-filter-logic-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
}

.board-filter-logic-option input {
    margin: 0;
    cursor: pointer;
}

/* Trenner zwischen den Bedingungen im Modal */
.filter-logic-sep {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
}

.filter-logic-sep::before,
.filter-logic-sep::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--color-border);
}

/* Trenner zwischen den aktiven Filter-Chips */
.filter-chip-connector {
    align-self: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
}

.filter-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background-color: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

/* Mobile: Filter-Item vertikal */
@media (max-width: 767px) {
    .filter-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 12px;
        position: relative;
    }

    .filter-item > select,
    .filter-item > input {
        width: 100% !important;
        min-width: 0 !important;
    }

    .filter-remove-btn {
        position: absolute;
        top: 8px;
        right: 8px;
    }
}

.filter-field-select {
    flex: 1;
    min-width: 150px;
}

.filter-operator-select {
    flex: 1;
    min-width: 120px;
}

.filter-value-input {
    flex: 2;
    min-width: 150px;
}

/* Multi-Select Dropdown for "Ist ein von" filter */
.multi-select-dropdown {
    position: relative;
    cursor: pointer;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    min-height: 38px;
}

.multi-select-display {
    padding: 8px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 28px;
}

.multi-select-display::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-top-color: var(--color-text-secondary);
}

.multi-select-panel {
    display: none;
    position: fixed;
    z-index: 10001;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 0 0 1px var(--color-line);
    max-height: 250px;
    overflow-y: auto;
}

.multi-select-panel.open {
    display: block;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: normal;
}

/* Die Klassenregel oben schlaegt das Browser-Default [hidden]{display:none} —
   ohne diese Regel bliebe die Textsuche im Dropdown wirkungslos. */
.multi-select-option[hidden] {
    display: none;
}

.multi-select-option:hover {
    background: var(--color-background);
}

.multi-select-option input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.multi-select-option span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-remove-btn {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-remove-btn:hover {
    color: var(--color-error);
}

.saved-filters-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.saved-filter-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
}

.saved-filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s;
}

.saved-filter-item:hover {
    background-color: var(--color-border);
}

.saved-filter-name {
    flex: 1;
    font-weight: 500;
}

.saved-filter-count {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-left: 10px;
}

.saved-filter-delete {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 16px;
}

.saved-filter-delete:hover {
    color: var(--color-error);
}

/* User Avatar */
.user-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    background-color: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: visible;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-left: 12px;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 1px var(--color-line);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-initials {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    user-select: none;
}

/* User Avatar Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 0 1px var(--color-line);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-avatar:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-primary);
    text-decoration: none;
    transition: background-color 0.2s;
    cursor: pointer;
    font-size: 14px;
}

.user-dropdown-item img {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border-radius: 0;
}

.user-dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.user-dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.user-dropdown-item:hover {
    background-color: var(--gray-100);
}

.user-dropdown-divider {
    height: 1px;
    background-color: var(--color-border);
    margin: 4px 0;
}

/* Sidebar Footer (Logout) */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--color-border);
    margin-top: auto;
}

.logout-link {
    display: block;
    text-align: center;
    padding: 10px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 5px;
    transition: all 0.2s;
}

.logout-link:hover {
    background-color: var(--gray-200);
    color: var(--color-primary);
}

/* ================== COMMENTS SYSTEM ================== */

/* Name cell with comment icon */
.name-cell-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.name-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* .comment-icon-wrapper and .comment-count are defined in "Comment Cell in Table" section below */

/* Comments Side Panel */
.comments-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    height: 100vh;
    height: 100dvh;
    background: var(--color-surface);
    box-shadow: 0 0 0 1px var(--color-line);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.comments-panel.active {
    right: 0;
}

/* Mobile: Comments-Panel Fullscreen */
@media (max-width: 767px) {
    .comments-panel {
        width: 100%;
        right: -100%;
    }

    .comments-panel.active {
        right: 0;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
    .comments-panel {
        width: 380px;
        right: -380px;
    }
}

.comments-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-background);
    gap: 12px;
}

@media (min-width: 768px) {
    .comments-panel-header {
        padding: 20px;
    }
}

/* 3-zeiliger Info-Block (Kontakt / Telefon-E-Mail / Objekt) */
.cp-header-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cp-header-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    line-height: 1.35;
    min-width: 0;
}

.cp-header-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    color: var(--color-text-secondary);
}

.cp-header-icon .icon {
    width: 14px;
    height: 14px;
}

.cp-header-content {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-header-line a {
    color: inherit;
    text-decoration: none;
}

.cp-header-line a:hover {
    text-decoration: underline;
}

.cp-header-name {
    font-weight: 600;
    color: var(--color-primary);
}

.cp-header-contact {
    color: var(--color-text-secondary);
}

.cp-header-property {
    color: var(--color-text-secondary);
}

.cp-header-sep {
    color: var(--color-text-secondary);
}

.comments-panel-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-text-secondary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.comments-panel-close:hover {
    background-color: color-mix(in srgb, var(--color-text) 8%, transparent);
}

.comments-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

@media (min-width: 768px) {
    .comments-panel-body {
        padding: 20px;
    }
}

.no-comments {
    text-align: center;
    color: var(--color-text-muted);
    padding: 40px 20px;
    font-size: 14px;
}

/* Comments Panel — Tabs (Updates / E-Mails) */
.comments-panel-tabs {
    display: flex;
    gap: 0;
    padding: 0 12px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
    flex-shrink: 0;
}

.cp-tab {
    flex: 1;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: color 0.15s, border-bottom-color 0.15s;
}

.cp-tab:hover {
    color: var(--color-text);
}

.cp-tab.cp-tab-active {
    color: var(--color-text);
    border-bottom-color: var(--color-accent);
}

.cp-tab-count {
    background: var(--color-line);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}

.cp-tab.cp-tab-active .cp-tab-count {
    background: var(--color-accent);
    color: var(--color-title);
}

.cp-tab-pane {
    display: none;
}

.cp-tab-pane.cp-tab-pane-active {
    display: flex;
    flex-direction: column;
}

.comments-panel.tab-emails .comments-panel-footer {
    display: none;
}

@media (max-width: 767px) {
    .cp-tab {
        padding: 10px 12px;
        font-size: 12px;
    }
}

/* Comments Panel — E-Mail Liste */
#azEmailsList {
    padding: 0;
}

#azEmailsList .no-comments {
    padding: 40px 20px;
}

.email-row {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border-light, var(--color-line));
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background-color 0.15s;
}

.email-row:hover {
    background: rgba(20,184,166, 0.05);
}

.email-row.email-row-unread {
    background: rgba(20,184,166, 0.08);
    border-left: 3px solid var(--color-accent);
    padding-left: 11px;
}

.email-row-head {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 13px;
}

.email-row-direction {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--color-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.email-row-counterpart {
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text);
}

.email-row-date {
    font-size: 11px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.email-row-subject {
    font-size: 14px;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.email-row-attachment {
    color: var(--color-text-muted);
    flex-shrink: 0;
    display: inline-flex;
}

.email-row-preview {
    font-size: 12px;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-row.email-row-expanded {
    background: var(--gray-50);
    border-left: 3px solid var(--color-accent);
    padding-left: 11px;
}

.email-row-body {
    margin-top: 8px;
    padding: 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light, var(--color-line));
    border-radius: 4px;
    cursor: default;
}

.email-row-body iframe {
    width: 100%;
    height: 480px;
    max-height: 70vh;
    border: 0;
    background: var(--color-surface);
    display: block;
}

.email-row-body pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 13px;
    color: var(--color-text);
    margin: 0;
    max-height: 60vh;
    overflow-y: auto;
}

.email-row-body-loading,
.email-row-body-error {
    font-size: 12px;
    color: var(--color-text-muted);
    padding: 8px 4px;
}

.email-row-body-error {
    color: var(--red-700);
}

/* ================== YELLOW CARD ================== */

/* Yellow-Card-Modal über das Comments-Panel (z-index 10000) heben */
.modal.modal-above-panel {
    z-index: 10001;
}


/* Footer-Action-Bar: Senden + Gelbe Karte je 50% */
.az-comment-actions {
    gap: 8px;
    align-items: center;
}
.az-comment-actions .btn-submit-comment.btn-action-half {
    flex: 1;
    min-width: 0;
}
.az-comment-actions .btn-yellow-card {
    flex: 1;
    min-width: 0;
}

.btn-yellow-card {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    background: var(--amber-400);
    color: var(--color-text);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1;
}
.btn-yellow-card:hover {
    background: var(--amber-400);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 179, 0, 0.4);
}
.btn-yellow-card:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(255, 179, 0, 0.3);
}
.btn-yellow-card svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Yellow-Card-Modal */
.yc-section {
    margin-bottom: 20px;
}
.yc-section:last-child {
    margin-bottom: 0;
}
.yc-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin: 0 0 10px;
    letter-spacing: 0.4px;
}

.yc-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.yc-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    padding: 10px 12px;
    border-left: 3px solid var(--amber-400);
    background: var(--color-warning-bg);
    border-radius: 4px;
}
.yc-card-target {
    font-weight: 600;
    color: var(--color-text);
}
.yc-card-meta {
    grid-column: 1 / -1;
    font-size: 11px;
    color: var(--color-text-secondary);
}
.yc-card-reason {
    grid-column: 1 / -1;
    font-size: 13px;
    color: var(--gray-700);
    margin-top: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}
.yc-card-actions {
    display: flex;
    align-items: flex-start;
}
.yc-card-revoke {
    background: none;
    border: none;
    padding: 4px;
    color: var(--red-700);
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.yc-card-revoke:hover {
    background: rgba(198, 40, 40, 0.08);
}
.yc-card-revoke svg {
    width: 16px;
    height: 16px;
}

.yc-empty {
    padding: 16px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
    background: var(--color-background);
    border-radius: 4px;
}

.yc-form {
    background: var(--color-background);
    padding: 16px;
    border-radius: 4px;
}
.yc-form-radios {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.yc-form-radio {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border, var(--color-border));
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.yc-form-radio:hover {
    border-color: var(--amber-400);
}
.yc-form-radio input[type="radio"] {
    accent-color: var(--amber-400);
    cursor: pointer;
}
.yc-form-radio.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.yc-form-radio.disabled input[type="radio"] {
    cursor: not-allowed;
}
.yc-form-radio-role {
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    min-width: 70px;
}
.yc-form-radio-name {
    flex: 1;
    color: var(--color-text);
}

.yc-form-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    resize: vertical;
    border: 1px solid var(--color-border, var(--color-border));
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
    box-sizing: border-box;
}
.yc-form-textarea:focus {
    outline: none;
    border-color: var(--amber-400);
}

.yc-form-error {
    color: var(--red-700);
    font-size: 12px;
    margin-top: 6px;
    min-height: 16px;
}

.yc-form-submit {
    margin-top: 12px;
    width: 100%;
}

/* Comment Item */
.comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-border-light);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-item.comment-unread {
    border-left: 3px solid var(--color-accent, var(--color-accent));
    padding-left: 12px;
    background-color: rgba(20,184,166, 0.05);
    transition: background-color 0.6s ease, border-left-color 0.6s ease;
}

.comment-item.comment-unread-fading {
    background-color: transparent;
    border-left-color: transparent;
}

/* ---------------------------------------------------------------------------
   Angepinnte Kommentare (A-Z-Board, HR-Leads, HR-Onboarding)
   Gegenstueck im Backend: includes/comment_pins.php
   Controlling hat eigene Klassennamen -> assets/css/controlling.css
   --------------------------------------------------------------------------- */

/* Gruppen-Trenner "Angepinnt" / "Weitere Updates" ueber der Liste. */
.comments-group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

/* Das "Angepinnt"-Label in derselben Farbe wie der Block darunter. */
.comments-group-label.is-pinned {
    color: var(--color-error-text);
}

.comments-group-label:not(:first-child) {
    margin-top: 4px;
}

.comments-group-label .icon {
    fill: currentColor;
    flex-shrink: 0;
}

.comments-group-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--color-border-light);
}

/* Der angepinnte Kommentar selbst.
   Farbe bewusst NICHT amber/orange: der "Gelbe Karte"-Button sitzt im selben
   Panel-Footer und ist vollflaechig --amber-400. Das rote Paar ist hier dezent
   genug und in beiden Themes definiert (hell #fee2e2 / dunkel #450a0a).
   Eigenes Padding, damit der Inhalt nicht an der Kante der Flaeche klebt;
   der Trennstrich entfaellt, die Flaeche trennt bereits. */
.comment-item.is-pinned {
    padding: 10px 12px;
    border-left: 3px solid var(--color-error);
    border-bottom: none;
    border-radius: 0 8px 8px 0;
    background-color: var(--color-error-bg);
}

/* Ungelesen UND angepinnt: der Pin gewinnt, sonst kaempfen zwei Balken. */
.comment-item.is-pinned.comment-unread {
    border-left-color: var(--color-error);
    background-color: var(--color-error-bg);
}

/* Pin-Button in .comment-interactions, neben Reagieren/Antworten. */
.btn-comment-pin {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.btn-comment-pin .icon {
    fill: currentColor;
    display: block;
}

.btn-comment-pin:hover {
    color: var(--color-text);
    background-color: color-mix(in srgb, var(--color-text) 8%, transparent);
}

/* Gesetzter Pin: farbig und dauerhaft sichtbar. */
.btn-comment-pin.is-pinned {
    color: var(--color-error-text);
}

.btn-comment-pin.is-pinned:hover {
    color: var(--color-error-text);
    background-color: color-mix(in srgb, var(--color-error) 14%, transparent);
}

.btn-comment-pin[disabled] {
    opacity: 0.5;
    cursor: default;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background-color: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comment-avatar-placeholder {
    width: 40px;
    height: 40px;
    background-color: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
}

.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    gap: 10px;
}

.comment-author {
    font-weight: 600;
    color: var(--color-primary);
    font-size: 14px;
}

.comment-date {
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.comment-text {
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.comment-text .mention {
    color: var(--color-link);
    font-weight: 500;
}

.comment-text .mention.mention-group {
    background: rgba(155, 89, 182, 0.14);
    color: var(--purple-500);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}

#azMentionDropdown .mention-item.mention-item-group .mention-avatar-placeholder,
#ctrlMentionDropdown .mention-item.mention-item-group .mention-avatar-placeholder {
    background: rgba(155, 89, 182, 0.18);
    color: var(--purple-500);
    font-weight: 600;
}

.comment-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-edit-comment,
.btn-delete-comment {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-edit-comment:hover,
.btn-delete-comment:hover {
    background-color: color-mix(in srgb, var(--color-text) 8%, transparent);
    color: var(--color-text);
}

/* Inline comment editing */
.comment-edit-area {
    margin-top: 4px;
}

.comment-edit-textarea {
    width: 100%;
    font-size: 14px;
    line-height: 1.5;
    font-family: inherit;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    resize: vertical;
    min-height: 50px;
    box-sizing: border-box;
    color: var(--color-text);
    background: var(--color-bg);
}

.comment-edit-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb, 0, 102, 204), 0.15);
}

.comment-edit-buttons {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.btn-comment-save,
.btn-comment-cancel {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--color-border);
    transition: all 0.2s;
}

.btn-comment-save {
    background: var(--color-primary);
    color: var(--white);
    border-color: var(--color-primary);
}

.btn-comment-save:hover {
    opacity: 0.9;
}

.btn-comment-cancel {
    background: none;
    color: var(--color-text-secondary);
}

.btn-comment-cancel:hover {
    background-color: color-mix(in srgb, var(--color-text) 8%, transparent);
}

.btn-comment-save:disabled,
.btn-comment-cancel:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Comment Interactions (Reaktion, Reply, Seen) */
.comment-interactions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
}

.btn-comment-react,
.btn-comment-reply {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.btn-comment-react:hover,
.btn-comment-reply:hover {
    color: var(--color-text);
    background-color: color-mix(in srgb, var(--color-text) 8%, transparent);
}

/* Reaktions-Trigger im Kommentar: Smiley-Icon bzw. eigenes Emoji.
   Feste Masse, damit der Wechsel Icon <-> Emoji die Zeile nicht verschiebt. */
.btn-comment-react {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 15px;
    line-height: 1;
    justify-content: center;
}

/* Keine eigene Abdunklung: gleiche Farbe wie der Antworten-Button daneben. */
.btn-comment-react .icon {
    fill: currentColor;
    display: block;
}

/* ===== Emoji-Reaktionen (Chat + Boards) ===== */
/* SSoT der Werte: includes/reactions.php und assets/js/reactions.js */

.reaction-picker {
    position: fixed;
    z-index: 10050;
    display: flex;
    gap: 2px;
    padding: 4px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16), 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* Feste Masse und kein Skalieren beim Hover: das Emoji darf nicht verrutschen,
   auch nicht um einen Pixel. Der Hover zeigt sich nur über die Fläche. */
.reaction-picker-btn {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.reaction-picker-btn:hover {
    background-color: var(--color-line);
}

.reaction-picker-btn.active {
    background-color: color-mix(in srgb, var(--color-primary, var(--green-900)) 18%, transparent);
}

.reaction-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.reaction-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    font-size: 12px;
    line-height: 18px;
    color: var(--color-text-secondary);
    background: var(--color-surface-2);
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.reaction-chip:hover {
    background: var(--color-line);
}

.reaction-chip.mine {
    color: var(--color-text);
    border-color: color-mix(in srgb, var(--color-primary, var(--green-900)) 45%, transparent);
    background: color-mix(in srgb, var(--color-primary, var(--green-900)) 12%, transparent);
}

.reaction-chip-emoji {
    font-size: 14px;
    line-height: 1;
}

/* Namens-Kästchen: wer hat genau diese Reaktion gegeben */
.reaction-tooltip {
    position: fixed;
    z-index: 10060;
    min-width: 120px;
    max-width: 260px;
    padding: 8px 12px;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 12px;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), 0 1px 4px rgba(0, 0, 0, 0.1);
}

.reaction-tooltip-head {
    font-weight: 600;
    padding-bottom: 4px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--color-line);
    white-space: nowrap;
}

.reaction-tooltip-name {
    padding: 2px 0;
    line-height: 1.4;
    color: var(--color-text-secondary);
}

/* Pfeil: --arrow-x zeigt auf die Mitte des Chips (JS setzt den Wert) */
.reaction-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: var(--arrow-x, 50%);
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--color-surface);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.08));
}

.reaction-tooltip.below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--color-surface);
    filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.08));
}

.reaction-chip-count {
    font-variant-numeric: tabular-nums;
}

.comment-seen {
    margin-left: auto;
    color: var(--color-text-secondary);
    font-size: 11px;
    opacity: 0.7;
    cursor: default;
}

/* User Popover (comment author hover) */
.user-popover {
    position: fixed;
    z-index: 10001;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 16px;
    min-width: 220px;
    font-size: 13px;
    display: none;
}

.user-popover .popover-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.user-popover .popover-position {
    color: var(--color-text-secondary);
    margin-bottom: 10px;
    font-size: 12px;
}

.user-popover .popover-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    color: var(--color-text);
}

.user-popover .popover-info .icon {
    flex-shrink: 0;
    color: var(--color-text-secondary);
}

.user-popover .popover-info a {
    color: var(--color-text);
    text-decoration: none;
}

.user-popover .popover-info a:hover {
    text-decoration: underline;
}

.comment-avatar,
.comment-author {
    cursor: pointer;
}

/* Comments Panel Footer */
.comments-panel-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    background-color: var(--color-background);
}

@media (min-width: 768px) {
    .comments-panel-footer {
        padding: 20px;
    }
}

#commentInput {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: 16px; /* Prevent iOS zoom */
    font-family: inherit;
    resize: vertical;
    margin-bottom: 10px;
    transition: border-color 0.2s;
    min-height: 80px;
}

@media (min-width: 768px) {
    #commentInput {
        font-size: 14px;
    }
}

#commentInput:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(20,184,166, 0.1);
}

.comment-input-wrapper {
    position: relative;
}

.btn-submit-comment {
    width: 100%;
    padding: 12px 20px;
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-submit-comment:hover {
    background-color: var(--gray-700);
    transform: translateY(-1px);
    box-shadow: 0 0 0 1px var(--color-line);
}

/* Mention Dropdown */
.mention-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 0 1px var(--color-line);
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 8px;
    z-index: 1000;
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.mention-item:hover,
.mention-item.selected {
    background-color: rgba(20,184,166, 0.1);
}

.mention-item-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background-color: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mention-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mention-avatar-placeholder {
    width: 32px;
    height: 32px;
    background-color: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
}

.mention-item-info {
    flex: 1;
    min-width: 0;
}

.mention-item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mention-item-username {
    font-size: 12px;
    color: var(--color-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ================== END COMMENTS SYSTEM ================== */

/* ================== DEAL COMMENTS ================== */

/* Comment Panel Overlay */
.comments-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.comments-panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Comment Cell in Table */
.comment-cell {
    width: 50px !important;
    text-align: center;
    padding: 4px 8px !important;
}

.comment-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
    position: relative;
}

.comment-icon-wrapper:hover {
    background-color: rgba(20,184,166, 0.1);
}

.comment-icon {
    opacity: 0.5;
    transition: opacity 0.2s;
}

.comment-icon-wrapper:hover .comment-icon {
    opacity: 1;
}

.comment-count {
    position: absolute;
    top: 0;
    right: 0;
    background-color: var(--color-accent);
    color: var(--color-primary);
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Deal Comments Panel specific */
#dealCommentsPanel {
    z-index: 10000;
}

#dealCommentsPanel .comments-panel-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#dealCommentsPanel textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 80px;
    max-height: 120px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

#dealCommentsPanel textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(20,184,166, 0.1);
}

#dealCommentsPanel .btn-submit-comment {
    width: 100%;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Quick Actions Container */
.quick-actions-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.quick-actions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 95px;
    overflow-y: auto;
    padding: 4px 0;
}

.quick-actions-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, transparent, var(--color-background));
    pointer-events: none;
}

/* Für das Panel (weißer Hintergrund) */
#dealCommentsPanel .quick-actions-wrapper::after {
    background: linear-gradient(to bottom, transparent, var(--color-background));
}

.quick-actions-container::-webkit-scrollbar {
    width: 4px;
}

.quick-actions-container::-webkit-scrollbar-track {
    background: var(--color-line);
    border-radius: 2px;
}

.quick-actions-container::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 2px;
}

.quick-actions-container::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

.quick-action-label {
    display: inline-block;
    padding: 6px 12px;
    background: var(--color-border);
    color: var(--gray-700);
    border: none;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-action-label:hover {
    background: var(--gray-400);
    transform: translateY(-1px);
}

.quick-action-label:active {
    background: var(--color-accent);
    color: var(--color-primary);
    transform: translateY(0);
}

/* Comment Avatar Initials */
.comment-avatar-initials {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    border-radius: 50%;
}

/* Comment Edit Textarea */
.comment-edit-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

.comment-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-comment-save,
.btn-comment-cancel {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-comment-save {
    background-color: var(--color-accent);
    color: var(--color-primary);
}

.btn-comment-save:hover {
    background-color: var(--color-accent-dark);
}

.btn-comment-cancel {
    background-color: var(--color-border);
    color: var(--gray-700);
}

.btn-comment-cancel:hover {
    background-color: var(--gray-400);
}

/* Comment Actions Buttons */
.comment-actions button {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    border-radius: 4px;
}

.comment-actions button:hover {
    opacity: 1;
    background-color: color-mix(in srgb, var(--color-text) 8%, transparent);
}

/* Property Link in Contact Comments */
.comment-property-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--color-text-secondary);
    text-decoration: none;
    margin-bottom: 6px;
    padding: 2px 8px;
    background-color: var(--gray-100);
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
}

.comment-property-link:hover {
    background-color: var(--color-border);
    color: var(--gray-700);
}

/* ================== END DEAL COMMENTS ================== */

/* ================== CONTACT UPDATES TAB ================== */

#tab-updates {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.updates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.updates-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.updates-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

.updates-loading {
    text-align: center;
    padding: 40px;
    color: var(--color-text-muted);
}

.updates-input-section {
    margin-top: auto;
    padding: 16px;
    background: var(--color-background);
    border-radius: var(--radius-lg);
    border-top: 1px solid var(--color-border);
}

.updates-input-section .comment-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.updates-input-section textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 80px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.updates-input-section textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(20,184,166, 0.1);
}

.updates-input-section .btn-submit-comment {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px 20px;
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.updates-input-section .btn-submit-comment:hover {
    background: var(--gray-700);
}

.updates-input-section .btn-submit-comment img {
    filter: invert(1);
}

/* ================== END CONTACT UPDATES TAB ================== */

/* ==========================================
   DELTA UPDATES - VISUAL FEEDBACK (DISABLED)
   User requested no visual animations
   ========================================== */

/* Animations disabled per user request */

/* ================== END DELTA UPDATES ==================
/* ================================
   GLOBAL SEARCH
   ================================ */
.global-search {
    padding: 16px 16px 16px 16px;
    position: relative;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    opacity: 0.5;
    pointer-events: none;
}

.global-search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--color-input-bg);
    transition: all 0.2s;
}

.global-search-input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: var(--color-input-bg);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 16px;
    right: 16px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 0 0 1px var(--color-line);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
}

.search-results:empty {
    display: none !important;
}

.search-result-group {
    padding: 12px 0;
}

.search-result-group:not(:last-child) {
    border-bottom: 1px solid var(--color-border-light);
}

.search-result-title {
    padding: 0 12px 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-result-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.search-result-item:hover {
    background: var(--color-background);
}

.search-result-icon {
    width: 16px;
    height: 16px;
    opacity: 0.6;
    flex-shrink: 0;
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 12px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
}

.search-loading {
    padding: 20px;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 14px;
}

/* =============================================
   COLLAPSIBLE SIDEBAR
   ============================================= */

/* Toggle Button */
.sidebar-toggle {
    display: none; /* hidden on mobile, shown on desktop via media query */
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--color-text-secondary);
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.sidebar-toggle:hover {
    background-color: var(--gray-200);
    color: var(--color-text);
}

.sidebar-toggle-icon {
    width: 16px !important;
    height: 16px !important;
    transform: rotate(90deg);
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle-icon {
    transform: rotate(-90deg);
}

/* Logo variants */
.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-small {
    display: none;
}

/* Logo variants hidden via .logo-link display:none in collapsed */

/* Collapsed search icon */
.global-search-collapsed {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 12px 0;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: color 0.2s;
}

.global-search-collapsed:hover {
    color: var(--color-text);
}

.global-search-collapsed svg,
.global-search-collapsed .icon {
    width: 18px;
    height: 18px;
}

/* ---- Collapsed State ---- */
.sidebar.collapsed {
    width: 60px;
    overflow: hidden;
}

.sidebar.collapsed .logo {
    padding: 8px;
    justify-content: center;
    gap: 0;
    min-height: auto;
}

.sidebar.collapsed .logo .logo-link {
    display: none;
}

.sidebar.collapsed .logo .sidebar-toggle {
    width: 36px;
    height: 36px;
}

.sidebar.collapsed .global-search {
    display: none;
}

.sidebar.collapsed .global-search-collapsed {
    display: flex;
}

.sidebar.collapsed .nav-section-title {
    display: none;
}

.sidebar.collapsed .nav-item {
    padding: 5px 0;
    margin: 4px 8px;
    justify-content: center;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    gap: 0;
}

.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-link .unread-badge {
    display: none;
}

/* Hide text nodes in collapsed nav-links */
.sidebar.collapsed .nav-link {
    font-size: 0;
}

/* SVGs/icons unaffected by font-size:0 — they use explicit width/height */

/* Unread indicator dot in collapsed state */
.sidebar.collapsed .nav-item:has(.unread-badge) .nav-link::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: var(--color-error);
    border-radius: 50%;
}

.sidebar.collapsed .nav-item:has(.unread-badge) {
    position: relative;
}

/* Hide submenus in collapsed */
.sidebar.collapsed .nav-item.has-submenu .nav-submenu {
    display: none;
}

.sidebar.collapsed .nav-item.has-submenu .submenu-arrow {
    display: none;
}

.sidebar.collapsed .nav-item.has-submenu {
    align-items: center;
}

.sidebar.collapsed .nav-item.has-submenu > .nav-link {
    padding: 5px 0;
    justify-content: center;
}

/* ---- Fade Animations ---- */
@keyframes sidebarFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---- Hover Expand (Overlay via JS class) ---- */
.sidebar.collapsed.hover-expanded {
    width: 250px;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
    overflow-y: auto;
}

.sidebar.collapsed.hover-expanded .logo {
    padding: 12px 20px;
    justify-content: space-between;
    min-height: 65px;
}

.sidebar.collapsed.hover-expanded .logo .logo-link {
    display: flex;
    animation: sidebarFadeIn 0.3s ease;
}

.sidebar.collapsed.hover-expanded .logo .sidebar-toggle {
    width: 28px;
    height: 28px;
}

.sidebar.collapsed.hover-expanded .global-search {
    display: block;
    animation: sidebarFadeIn 0.3s ease;
}

.sidebar.collapsed.hover-expanded .global-search-collapsed {
    display: none;
}

.sidebar.collapsed.hover-expanded .nav-section-title {
    display: block;
    animation: sidebarFadeIn 0.2s ease;
}

.sidebar.collapsed.hover-expanded .nav-item {
    padding: 5px 20px;
    margin: 10px;
    justify-content: flex-start;
}

.sidebar.collapsed.hover-expanded .nav-item.has-submenu {
    padding: 0;
    margin: 10px;
}

.sidebar.collapsed.hover-expanded .nav-link {
    justify-content: flex-start;
    gap: 10px;
    font-size: 14px;
    white-space: nowrap;
}

.sidebar.collapsed.hover-expanded .nav-link span,
.sidebar.collapsed.hover-expanded .nav-link .unread-badge {
    display: inline-flex;
}

.sidebar.collapsed.hover-expanded .nav-item:has(.unread-badge) .nav-link::after {
    display: none;
}

.sidebar.collapsed.hover-expanded .nav-item.has-submenu .submenu-arrow {
    display: block;
}

.sidebar.collapsed.hover-expanded .nav-item.has-submenu .nav-submenu {
    display: block;
    max-height: 0;
    opacity: 0;
}

.sidebar.collapsed.hover-expanded .nav-item.has-submenu.open .nav-submenu {
    max-height: 500px;
    opacity: 1;
}

.sidebar.collapsed.hover-expanded .nav-item.has-submenu {
    align-items: stretch;
}

.sidebar.collapsed.hover-expanded .nav-item.has-submenu > .nav-link {
    padding: 5px 20px;
    justify-content: flex-start;
}

/* ---- Fade-out phase before collapse ---- */
.sidebar.collapsed.hover-fading {
    width: 250px;
    overflow-y: auto;
}

.sidebar.collapsed.hover-fading .logo .logo-link,
.sidebar.collapsed.hover-fading .global-search,
.sidebar.collapsed.hover-fading .nav-section-title {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar.collapsed.hover-fading .logo {
    padding: 12px 20px;
    justify-content: space-between;
    min-height: 65px;
}

.sidebar.collapsed.hover-fading .logo .logo-link {
    display: flex;
}

.sidebar.collapsed.hover-fading .logo .sidebar-toggle {
    width: 28px;
    height: 28px;
}

.sidebar.collapsed.hover-fading .global-search {
    display: block;
}

.sidebar.collapsed.hover-fading .global-search-collapsed {
    display: none;
}

.sidebar.collapsed.hover-fading .nav-section-title {
    display: block;
}

.sidebar.collapsed.hover-fading .nav-item {
    padding: 5px 20px;
    margin: 10px;
    justify-content: flex-start;
}

.sidebar.collapsed.hover-fading .nav-item.has-submenu {
    padding: 0;
    margin: 10px;
}

.sidebar.collapsed.hover-fading .nav-link {
    justify-content: flex-start;
    gap: 10px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.sidebar.collapsed.hover-fading .nav-link span,
.sidebar.collapsed.hover-fading .nav-link .unread-badge {
    display: inline-flex;
}

.sidebar.collapsed.hover-fading .nav-item:has(.unread-badge) .nav-link::after {
    display: none;
}

.sidebar.collapsed.hover-fading .nav-item.has-submenu .submenu-arrow {
    display: block;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar.collapsed.hover-fading .nav-item.has-submenu .nav-submenu {
    display: none;
}

.sidebar.collapsed.hover-fading .nav-item.has-submenu {
    align-items: stretch;
}

.sidebar.collapsed.hover-fading .nav-item.has-submenu > .nav-link {
    padding: 5px 20px;
    justify-content: flex-start;
}

/* Objekte-Split-Link im Hover-Overlay: die generischen .nav-link-Regeln oben
   setzen Padding auf den Split-CONTAINER — Padding/Gap liegen aber auf
   .nav-link-main, sonst doppelte Einrückung. Muss NACH den Regeln oben stehen. */
.sidebar.collapsed.hover-expanded .nav-item.objekte-nav > .nav-link-split,
.sidebar.collapsed.hover-fading .nav-item.objekte-nav > .nav-link-split {
    padding: 0;
    gap: 0;
}
.sidebar.collapsed.hover-fading .objekte-nav .objekte-submenu-toggle {
    display: flex;
}
.sidebar.collapsed.hover-fading .objekte-nav .nav-link-main {
    flex: 1;
    justify-content: flex-start;
    gap: 10px;
    padding: 5px 8px 5px 20px;
}

/* =============================================
   MOBILE SIDEBAR - FLY-OUT NAVIGATION
   ============================================= */

/* ================================
   RESPONSIVE: Mobile, Tablet, Desktop
   ================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Sidebar Close Button */
.sidebar-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.sidebar-close:hover {
    background: var(--color-border);
}

.sidebar-close::before,
.sidebar-close::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 2px;
    background: var(--gray-700);
    top: 50%;
    left: 50%;
}

.sidebar-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.sidebar-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Mobile Styles (< 768px) */
@media (max-width: 767px) {
    /* Sidebar als Fly-Out */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile */
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
    }

    /* Sidebar geöffnet */
    .app-container.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    /* Overlay aktiv wenn Sidebar offen */
    .app-container.sidebar-open .sidebar-overlay {
        display: block;
        opacity: 1;
    }

    /* Close Button und Logo auf Mobile ausblenden */
    .sidebar-close {
        display: none;
    }

    .sidebar .logo {
        display: none;
    }

    /* Main Content nimmt volle Breite */
    .main-content {
        width: 100%;
        margin-left: 0;
    }

    /* Body Scroll verhindern wenn Sidebar offen */
    body.sidebar-open {
        overflow: hidden;
    }
}

/* Tablet + Desktop (>= 768px) — Sidebar mit Toggle */
@media (min-width: 768px) {
    .sidebar {
        position: relative;
        transform: none;
        width: 250px;
        transition: width 0.25s ease;
    }

    .sidebar.collapsed {
        width: 60px;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 998;
        transition: width 0.25s ease;
    }

    .sidebar.collapsed ~ .main-content {
        margin-left: 60px;
    }

    .sidebar.collapsed.hover-expanded,
    .sidebar.collapsed.hover-fading {
        width: 250px;
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .sidebar-close {
        display: none !important;
    }

    .mobile-menu-toggle {
        display: none !important;
    }
}

/* =============================================
   Social Kit
   ============================================= */
.social-kit-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.social-kit-item {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--gray-50);
}

.social-kit-item img {
    width: 100%;
    display: block;
}

.social-kit-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
}

.social-kit-item-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
}

.social-kit-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--white);
    background: var(--green-900);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.social-kit-download-btn:hover {
    background: var(--green-900);
}
@media all and (max-width: 767px){
    .board-entry-count{
        font-size: 12px;
    }
}

/* SP Badge (Suchprofil-Match) */
.sp-badge {
    display: inline-flex;
    align-items: center;
    background: var(--color-accent-bg);
    color: var(--color-accent-text);
    border: 1px solid color-mix(in srgb, var(--color-accent) 38%, transparent);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: baseline;
    line-height: normal;
    letter-spacing: 0.5px;
    position: relative;
    top: -1px;
}

/* ============================================
   Kunden-Feedback (Landing-Page Absage)
   Genutzt in property_detail, contact_detail, deals
   ============================================ */
.feedback-cell {
    max-width: 220px;
    vertical-align: middle;
}

.feedback-empty {
    color: var(--color-text-muted, var(--color-text-muted));
    font-size: 13px;
}

.feedback-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    max-width: 100%;
}

.feedback-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.feedback-badge .feedback-badge-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.feedback-badge-yes {
    background-color: rgba(52, 199, 89, 0.15);
    color: var(--color-success-text);
}

.feedback-badge-no {
    background-color: rgba(231, 76, 60, 0.15);
    color: var(--color-error);
}

.feedback-comment-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--color-text-muted, var(--color-text-muted));
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.feedback-comment-btn:hover {
    background: color-mix(in srgb, var(--color-text) 8%, transparent);
    color: var(--color-text, var(--gray-700));
}

.feedback-comment-btn .icon {
    width: 14px;
    height: 14px;
}

.feedback-popover {
    position: absolute;
    z-index: 1000;
    min-width: 200px;
    max-width: 300px;
    padding: 12px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border, var(--color-border));
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
    font-size: 13px;
    color: var(--color-text, var(--gray-700));
    line-height: 1.45;
}

.feedback-popover-quote {
    margin: 0 0 8px 0;
    padding-left: 10px;
    border-left: 3px solid var(--color-border, var(--color-border));
    white-space: pre-wrap;
    word-break: break-word;
}

.feedback-popover-meta {
    font-size: 11px;
    color: var(--color-text-muted, var(--color-text-muted));
}

/* ---------------------------------------------------------------------------
   Übergabe der Betreuung an Research — Bestätigungsfenster + Beleg-Hinweis
   Genutzt von ZWEI Seiten mit demselben Wortlaut: a-z-board.php (Spalte Verkauf)
   und property_detail.php (Feld Betreuer). Deshalb hier und nicht in einer der
   beiden Seiten-CSS-Dateien. Text-SSoT ist includes/az_research_handover.php.
   --------------------------------------------------------------------------- */

/* Der Bestätigungsdialog kann aus einer bereits offenen Auswahl heraus aufgehen
   (A-Z: Benutzer-Auswahl, Objektseite: Formular). Er muss darüber liegen —
   `.modal` und `.modal-overlay` teilen sich sonst z-index 1000 und es gewinnt,
   was zufällig später im DOM steht. Gilt für beide Bauformen, die ID ist dieselbe. */
#researchHandoverModal {
    z-index: 10001;
}

.research-handover-text {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
}

.research-handover-details {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    gap: 6px 16px;
    margin: 0 0 16px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-subtle, rgba(0, 0, 0, 0.04));
}

.research-handover-details dt {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.research-handover-details dd {
    margin: 0;
    font-size: 14px;
    color: var(--color-text);
}

.research-handover-note {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--color-text-secondary);
}

/* Beleg-Kommentar: sichtbar machen, dass hier nichts mehr zu ändern ist */
.comment-protected-note {
    margin-top: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

/* Begründung zu „Nicht verkauft" (6.15) — Dialog im A-Z-Board und auf der
   Objektseite. Beide nutzen dieselben Klassen, deshalb hier und nicht in einer
   Seiten-CSS. */
.az-not-sold-counter {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-text-secondary);
}

.az-not-sold-counter.is-ok {
    color: var(--color-success, #4EB371);
}

.az-not-sold-error {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--color-danger-bg, #FDE4E1);
    color: var(--color-danger, #B3261E);
    font-size: 13px;
    line-height: 1.4;
}

/* ==========================================================================
   Performance-Punkte (1-5) — window.PerformanceDots in app.js
   Controlling-Tabelle, Mitarbeiter-Modal, Personen-Kartei
   ========================================================================== */

.perf-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
    --perf-dot: 10px;
    --perf-on: var(--color-text-muted);
}

.perf-dots-sm { --perf-dot: 8px; gap: 3px; }
.perf-dots-lg { --perf-dot: 14px; gap: 5px; }

.perf-dot {
    width: var(--perf-dot);
    height: var(--perf-dot);
    border-radius: 50%;
    background: var(--color-border);
    flex-shrink: 0;
}

.perf-dot.is-on {
    background: var(--perf-on);
}

.perf-good { --perf-on: var(--color-success); }
.perf-mid  { --perf-on: var(--color-warning); }
.perf-bad  { --perf-on: var(--color-error); }

.perf-dots.is-empty {
    color: var(--color-text-muted);
    font-size: 12px;
}

/* Text neben den Punkten („Sehr gut", „4,2") in der Stufenfarbe */
.perf-text-good { color: var(--color-success); }
.perf-text-mid  { color: var(--color-warning-text, var(--color-warning)); }
.perf-text-bad  { color: var(--color-error); }

.perf-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.perf-breakdown-head {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding-bottom: 6px;
}

.perf-breakdown-headtext {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.perf-breakdown-headtext strong {
    font-size: 18px;
    font-weight: 700;
}

.perf-breakdown-sub,
.perf-breakdown-empty,
.perf-breakdown-foot {
    font-size: 12px;
    color: var(--color-text-muted);
    margin: 0;
}

.perf-breakdown-foot {
    line-height: 1.5;
    padding-top: 4px;
}

.perf-area {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
}

.perf-area-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
    list-style: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.perf-area-summary::-webkit-details-marker {
    display: none;
}

.perf-area-summary::after {
    content: '';
    width: 7px;
    height: 7px;
    margin-left: 4px;
    border-right: 2px solid var(--color-text-muted);
    border-bottom: 2px solid var(--color-text-muted);
    transform: rotate(45deg) translateY(-2px);
    transition: transform .15s ease;
}

.perf-area[open] > .perf-area-summary::after {
    transform: rotate(225deg) translateY(-2px);
}

.perf-area-summary:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
    border-radius: 10px;
}

.perf-area-label {
    flex: 1 1 auto;
    min-width: 0;
}

.perf-area-score {
    font-variant-numeric: tabular-nums;
    min-width: 28px;
    text-align: right;
}

.perf-area-none {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
}

.perf-metrics {
    list-style: none;
    margin: 0;
    padding: 0 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.perf-metric {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: center;
    column-gap: 10px;
    font-size: 12px;
    color: var(--color-text);
}

.perf-metric-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.perf-metric-median {
    color: var(--color-text-muted);
    text-align: right;
    white-space: nowrap;
}

.perf-metric-note {
    grid-column: 1 / -1;
    font-size: 11px;
    color: var(--color-warning-text, var(--color-text-muted));
}

.perf-metric-empty {
    display: block;
    color: var(--color-text-muted);
}

@media (max-width: 520px) {
    .perf-metric {
        grid-template-columns: minmax(0, 1fr) auto;
        row-gap: 2px;
    }

    .perf-metric-median {
        text-align: left;
    }
}
