/********************/
/* LOCAL FONTS      */
/********************/

/* Open Sans Variable Font */
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 300 800;
    font-display: swap;
    src: url('../assets/fonts/OpenSans-Variable.woff2') format('woff2');
}

@font-face {
    font-family: 'Open Sans';
    font-style: italic;
    font-weight: 300 800;
    font-display: swap;
    src: url('../assets/fonts/OpenSans-Variable-Italic.woff2') format('woff2');
}

/* Material Symbols Outlined */
@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 100 700;
    font-display: block;
    src: url('../assets/fonts/MaterialSymbolsOutlined.woff2') format('woff2');
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/********************/
/* CSS VARIABLES    */
/********************/

:root {
    --color-primary: #0066cc;
    --color-primary-light: #3399ff;
    --color-primary-dark: #004d99;

    --color-secondary: #6c757d;
    --color-accent: #ff9900;

    --color-bg-main: #ffffff;
    --color-bg-secondary: #f8f9fa;
    --color-bg-card: #ffffff;

    --color-text-primary: #181729;
    --color-text-secondary: rgba(24, 23, 41, 0.55);
    --color-text-light: #6c757d;

    --color-border: #e0e0e0;
    --color-border-light: #f2f2f2;
    --color-shadow: rgba(0, 0, 0, 0.08);

    --color-input-bg: #fafafa;
    --color-input-border: #ccc;
    --color-input-focus: #0066cc;

    --color-triage-neu: #6c757d;
    --color-triage-erledigt: #28a745;
    --color-triage-zurueckgestellt: #fd7e14;
    --color-triage-abgelehnt: #dc3545;
    --color-triage-abklaerung: #6f42c1;

    --max-width: 1920px;
    --border-radius: 8px;
    --box-shadow-sm: 0 2px 4px var(--color-shadow);
    --box-shadow-md: 0 4px 12px var(--color-shadow);
    --box-shadow-lg: 0 8px 24px var(--color-shadow);

    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    --header-height: 104px;
    --filter-section-height: 200px; /* Default fallback, updated by JS */
}

/********************/
/* GENERAL RESET    */
/********************/

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--color-bg-secondary);
    padding: 0 var(--spacing-xl) var(--spacing-xl) var(--spacing-xl);
    margin: 0;
    font-family: "Open Sans", sans-serif;
    font-size: 14px;
    color: var(--color-text-primary);
    line-height: 1.6;
    min-height: 100vh;
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
}

/********************/
/* HEADER           */
/********************/

header {
    z-index: 1000;
    background-color: var(--color-bg-main);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: var(--box-shadow-sm);
}

.header__container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 104px;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
}

.header__container h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    margin-left: auto;
    margin-right: auto;
    color: var(--color-text-primary);
}

.header__logo {
    height: 100px;
    object-fit: contain;
}

.header__nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.header__nav .header-info-btn {
    margin-left: -12px;
}

.header__link {
    color: var(--color-text-primary);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
    position: relative;
}

.header__link:hover {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.header__link--active {
    color: var(--color-primary);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
}

.header__hamburger__menu {
    display: none;
}

/********************/
/* MAIN CONTENT     */
/********************/

main {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: var(--spacing-lg);
    padding-top: calc(var(--header-height) + var(--spacing-lg));
}

.main__content-area {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    width: 100%;
}

/********************/
/* FILTER SECTION   */
/********************/

.filter-section {
    background: var(--color-bg-card);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    box-shadow: var(--box-shadow-md);
    position: sticky;
    top: var(--header-height);
    z-index: 900;
    border-top: 1px solid var(--color-border-light);
    border-bottom: 1px solid var(--color-border-light);
    transition: border-radius 0.3s ease;
}

.filter-section.is-stuck {
    border-radius: 0;
}

/* Filter Bar: globale Suche + Location-Facette + Reset in einer Zeile */
.filter-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.search-field {
    flex: 1;
}

.search-field input[type="text"] {
    padding-left: 42px;
}

.search-field-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--color-text-secondary);
    pointer-events: none;
}

.location-filter {
    width: 230px;
    flex-shrink: 0;
}

.multiselect-button-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.location-filter-icon {
    color: var(--color-primary);
}

/* Reset icon button: optical vertical tweak with translateY */
.btn-reset-icon {
    background: transparent;
    border: none;
    color: var(--color-text-light);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(-1px); /* Feinjustierung: minimal weiter unten */
}

.btn-reset-icon:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--color-primary);
    transform: translateY(-1px) rotate(-180deg);
}

.btn-reset-icon .material-symbols-outlined {
    font-size: 20px;
    line-height: 1;
    display: block; /* removes extra inline baseline space */
}

.info-button {
    background: none;
    border: none;
    padding: 0;
    margin-left: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.info-button:hover {
    background-color: transparent;
    transform: none;
    box-shadow: none;
}

.info-button .material-symbols-outlined {
    font-size: 20px;
    color: var(--color-text-secondary) !important;
}

.info-button .info-icon {
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.info-button:hover .material-symbols-outlined {
    color: var(--color-primary) !important;
}

/********************/
/* INPUTS & BUTTONS */
/********************/

.input-with-clear {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-with-clear input[type="text"] {
    padding-right: 36px;
    width: 100%;
    box-sizing: border-box;
}

.clear-input-btn {
    position: absolute;
    right: 4px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.clear-input-btn.visible {
    display: flex;
}

.clear-input-btn .material-symbols-outlined {
    font-size: 18px;
    color: var(--color-text-secondary) !important;
}

.clear-input-btn:hover .material-symbols-outlined {
    color: var(--color-primary) !important;
}

input[type="text"] {
    padding: 10px 12px;
    border: 1px solid var(--color-input-border);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: "Open Sans", sans-serif;
    background-color: var(--color-input-bg);
    color: var(--color-text-primary);
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    border-color: var(--color-input-focus);
    background-color: var(--color-bg-main);
    outline: none;
}

input[type="text"]::placeholder {
    color: #9e9e9e;
    font-style: italic;
    font-weight: 400;
    opacity: 1; /* Firefox override */
}

button {
    background-color: var(--color-bg-main);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    padding: 10px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: "Open Sans", sans-serif;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
}

button:hover {
    background-color: #f0f0f0;
    border-color: #999;
}

button:active {
    transform: translateY(0);
    background-color: #e8e8e8;
}

/* Datum-Sortierung im Tabellenkopf: der ganze Spaltenkopf ist ein
   klickbares Element, das die Richtung umschaltet; ein einzelner Pfeil
   zeigt den Zustand. Bewusst ohne Button-Chrome, damit es als Spaltenkopf
   liest und nicht als eingekastelter Button (Muster wie MUI/AG Grid). */
.th-sort {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    font-weight: 600;
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.th-sort:hover,
.th-sort:active {
    background: none;
    border: none;
    transform: none;
    color: var(--color-primary);
}

.th-sort:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: 3px;
}

.th-sort-icon {
    font-size: 18px;
    color: var(--color-text-secondary);
    opacity: 0; /* nur die aktive Sortierspalte zeigt ihren Pfeil dauerhaft */
    transition: color 0.2s ease, opacity 0.2s ease;
}

/* Hover auf einer sortierbaren Spalte: Pfeil dezent einblenden als
   "diese Spalte ist sortierbar"-Hinweis. */
.th-sort:hover .th-sort-icon {
    opacity: 0.6;
    color: var(--color-primary);
}

/* Aktive Sortierspalte: Pfeil dauerhaft sichtbar in Akzentfarbe; bleibt
   auch beim Hover voll sichtbar (Regel steht bewusst nach dem Hover). */
.th-sort.is-sorted .th-sort-icon {
    opacity: 1;
    color: var(--color-primary);
}

/********************/
/* MULTISELECT      */
/********************/

.multiselect-wrapper {
    position: relative;
}

.multiselect-button {
    width: 100%;
    justify-content: space-between;
    background-color: var(--color-input-bg);
    border: 1px solid var(--color-input-border);
    text-align: left;
    padding: 10px 12px;
}

.multiselect-button:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

.multiselect-button .material-symbols-outlined {
    font-size: 18px;
}

.multiselect-button .multiselect-chevron {
    transition: transform 0.3s ease;
}

.multiselect-button.active .multiselect-chevron {
    transform: rotate(180deg);
}

.multiselect-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--color-bg-main);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-md);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    padding: var(--spacing-sm);

    /* Modern Scrollbar Styling */
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.multiselect-dropdown::-webkit-scrollbar {
    width: 6px;
}

.multiselect-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.multiselect-dropdown::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

.multiselect-dropdown::-webkit-scrollbar-thumb:hover {
    background-color: #bbb;
}

.multiselect-dropdown.active {
    display: block;
}

.multiselect-actions {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background-color: var(--color-bg-secondary);
    border-radius: 6px;
    margin: 8px;
}

.multiselect-action-btn {
    flex: 1;
    padding: 8px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-bg-main);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.multiselect-action-btn:hover {
    background-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.multiselect-action-btn .material-symbols-outlined {
    font-size: 18px;
    color: var(--color-text-secondary);
}

.multiselect-action-btn:hover .material-symbols-outlined {
    color: white;
}

.multiselect-divider {
    height: 1px;
    background-color: var(--color-border);
    margin: 0 8px 8px 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm);
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.15s ease;
    user-select: none;
}

.checkbox-label:hover {
    background-color: #f5f5f5;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-custom {
    position: relative;
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-border);
    border-radius: 3px;
    margin-right: var(--spacing-sm);
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked ~ .checkbox-custom {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-label input[type="checkbox"]:checked ~ .checkbox-custom::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/********************/
/* TABLE CARD       */
/********************/

.table-card {
    background: var(--color-bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-md);
    max-width: 100%;
}

.table-wrapper {
    width: 100%;
    max-width: 100%;
}

/********************/
/* TABLE            */
/********************/

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

/* Fixed layout nur auf größeren Bildschirmen wo alle Spalten sichtbar sind */
@media screen and (min-width: 1251px) {
    table {
        table-layout: fixed;
    }
}

table thead {
    /* position: sticky; moved to th */
    z-index: 800;
}

table th {
    padding: var(--spacing-md);
    text-align: left;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    background-color: var(--color-bg-main); /* White background */
    position: sticky;
    top: calc(var(--header-height) + var(--filter-section-height));
    z-index: 800;
    /* Trennlinie als inset-Box-Shadow statt border-bottom: bei
       border-collapse gehört die untere Rahmenlinie der Tabelle, nicht der
       Zelle, und verschwindet sobald die th-Zelle sticky wird. Ein
       Box-Shadow bewegt sich dagegen mit dem Sticky-Element mit. */
    box-shadow: inset 0 -2px 0 var(--color-border), 0 2px 4px rgba(0, 0, 0, 0.05);
}

table td {
    padding: var(--spacing-md);
    border-bottom: 2px solid #d0d0d0; /* Thicker and darker border */
    vertical-align: top;
}

/* MBID-Spalte (erste Spalte) ohne Zeilenumbruch */
table td:first-child,
table th:first-child {
    white-space: nowrap;
}

table tbody tr {
    background-color: var(--color-bg-main);
    transition: background-color 0.15s ease;
}

table tbody tr:hover {
    background-color: #f8f9fa;
}

table tbody tr:last-child td {
    border-bottom: none;
}

table a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    transition: color 0.2s ease;
}

table a:hover {
    color: var(--color-primary-dark);
}

/* Spaltenbreiten für table-layout: fixed (nur Desktop) */
@media screen and (min-width: 1251px) {
    table th:nth-child(1) { width: 7%; }   /* MBID */
    table th:nth-child(2) { width: 8%; }   /* Datum */
    table th:nth-child(3) { width: 10%; }  /* Submitter */
    table th:nth-child(4) { width: 7%; }   /* Standort */
    table th:nth-child(5) { width: 7%; }   /* Raum */
    table th:nth-child(6) { width: 9%; }   /* Topic */
    table th:nth-child(7) { width: 27%; }  /* Kurzbeschrieb */
    table th:nth-child(8) { width: 7%; }   /* Unit */
    table th:nth-child(9) { width: 13%; }  /* Task Status */
    table th:nth-child(10) { width: 5%; }  /* Chevron */
}

/* Kategorie-Spalte mit Abstand rechts */
table td:nth-child(6) {
    padding-right: var(--spacing-lg);
}

/* Kurzbeschrieb-Spalte mit Textumbruch */
table td:nth-child(7) {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/********************/
/* Expandable Row Styles */
/********************/

tr.summary-row {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

tr.summary-row:hover {
    background-color: #f0f4f8;
}

tr.summary-row:active {
    background-color: #e8f0f8;
}

tr.summary-row td {
    border-bottom: none; /* Remove border from summary row to merge visually with detail if needed, or keep it */
    border-bottom: 1px solid var(--color-border-light);
}

tr.summary-row.expanded td {
    border-bottom: none;
    background-color: #f8f9fa;
}

tr.detail-row {
    display: none;
}

tr.detail-row.visible {
    display: table-row;
    position: relative;
    z-index: 900;
}

tr.detail-row td {
    padding: 0;
    border-bottom: 2px solid #d0d0d0;
    background-color: #f8f9fa;
    display: table-cell !important; /* Force display even if nth-child rules apply */
    max-width: 0; /* Force td to respect table width */
    overflow: visible; /* Allow tooltip to overflow */
}

.detail-content {
    padding: var(--spacing-lg);
    border-top: 1px dashed var(--color-border);
    animation: slideDown 0.3s ease-out;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    overflow: visible;
    position: relative;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chevron-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
    color: var(--color-text-light);
}

tr.summary-row.expanded .chevron-icon {
    transform: rotate(180deg);
    color: var(--color-primary);
}

/* Field Badges für die Spalten Unit & Task Status: tonale Chips
   (Pastellfläche + dunklere Schrift im selben Farbton, an die
   Asana-Farben der beiden Felder angelehnt) */
.field-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}

/* Unit (Fachbereich) */
.unit-tfs            { background-color: #c6f5ff; color: #006469; }
.unit-om             { background-color: #fff2c4; color: #795500; }
.unit-safety         { background-color: #ffdad6; color: #ba1a1a; }
.unit-none           { background-color: #ffffff; color: #37474f; border-color: #cfd8dc; }
.unit-default        { background-color: #f5f5f5; color: #616161; }

/* Task Status (Status Aufgabe) */
.ts-neu              { background-color: #ffffff; color: #37474f; border-color: #cfd8dc; }
.ts-warteschlange    { background-color: #fff2c4; color: #795500; }
.ts-in-planung       { background-color: #d9e2ff; color: #2b4bad; }
.ts-in-bearbeitung   { background-color: #d1f6d5; color: #256c2b; }
.ts-warten-extern    { background-color: #ffe9c7; color: #8a5300; }
.ts-warten-intern    { background-color: #ffddc2; color: #96420a; }
.ts-abklaerung-ihb   { background-color: #f0dbf7; color: #7c3a9d; }
.ts-zurueckgestellt  { background-color: #ececec; color: #5f5f5f; }
.ts-abgelehnt        { background-color: #ffdad6; color: #ba1a1a; }
.ts-sa-erledigt      { background-color: #c9e7ca; color: #1b5e20; }
.ts-default          { background-color: #f5f5f5; color: #616161; }

/********************/
/* DASHBOARD        */
/********************/

.dashboard-card {
    background: var(--color-bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-md);
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.dashboard-header:hover {
    background-color: #fafafa;
}

.dashboard-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-icon {
    color: var(--color-text-secondary);
    font-size: 22px;
}

.dashboard-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.dashboard-chevron {
    color: var(--color-text-secondary);
    font-size: 18px;
    transition: transform 0.3s ease;
}

.dashboard-header.expanded .dashboard-chevron {
    transform: rotate(180deg);
}

.dashboard-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0 var(--spacing-lg);
    background: var(--color-bg-card);
}

.dashboard-content.visible {
    max-height: 600px;
    padding: var(--spacing-lg);
}

.stats-grid {
    display: grid;
    /* 10 Kacheln: Open + 8 Status-Kacheln + Completed = 2 Reihen à 5 */
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    background: #e0e0e0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.stat-card {
    position: relative;
    background: var(--color-bg-card);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 100px;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.stat-card:hover {
    background-color: var(--color-bg-secondary);
}

/* Aktive Status-Kachel: statt einer flächigen Vollfüllung ein weiches,
   abgerundetes Highlight, das mit Abstand INNERHALB der Kachel schwebt und
   die Gitterlinien nicht berührt – schlichter und moderner (Linear/Notion-
   Muster). Als Pseudo-Element hinter dem Inhalt, damit es sanft ein- und
   ausblenden kann. */
.stat-card::before {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 8px;
    background-color: #e7f1fd;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    pointer-events: none;
    z-index: 0;
}

.stat-card.selected::before {
    opacity: 1;
}

.stat-card.selected:hover::before {
    background-color: #d7e8fc;
}

/* Auf einer selektierten Kachel keinen grauen Voll-Hover zeigen – das
   Feedback übernimmt das vertiefte Highlight. */
.stat-card.selected:hover {
    background-color: var(--color-bg-card);
}

.stat-card.selected .stat-value,
.stat-card.selected .stat-label {
    color: var(--color-primary);
}
.stat-icon-wrapper {
    display: none;
}

.stat-info {
    position: relative;
    z-index: 1; /* Inhalt über dem ::before-Highlight */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-align: center;
    line-height: 1.3;
}

.stat-value {
    font-size: 32px;
    font-weight: 300;
    color: var(--color-text-primary);
    line-height: 1;
    letter-spacing: -0.5px;
}

.stat-total .stat-value {
    font-weight: 500;
    color: #a0524d;
}

.stat-erledigt .stat-value {
    font-weight: 500;
    color: #6e8b5a;
}

/* "Completed Tickets" ist eine reine Anzeige – nicht anklickbar */
.stat-card.stat-erledigt {
    cursor: default;
    user-select: auto;
}

.stat-card.stat-erledigt:hover {
    background-color: var(--color-bg-card);
}

/********************/
/* FOOTER           */
/********************/

footer {
    margin-top: auto;
    padding-top: var(--spacing-xl);
}

.footer__container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: var(--spacing-lg) 0;
    color: var(--color-text-light);
    font-size: 13px;
}

.footer__links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer__link {
    color: var(--color-text-light);
    text-decoration: none;
    transition: color 0.2s ease;
    font-size: 13px;
}

.footer__link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.footer__separator {
    color: var(--color-border);
    user-select: none;
}

/********************/
/* UTILITY CLASSES  */
/********************/

mark {
    background-color: #fff59d;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
}

/********************/
/* TOOLTIP          */
/********************/

.asana-link-wrapper {
    position: relative;
    display: inline-block;
}

.asana-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    background-color: #2c3e50;
    color: #ffffff;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
    width: 240px;
    max-width: 240px;
    min-width: 200px;
    box-sizing: border-box;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    pointer-events: none;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: left;
}

.asana-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 20px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 8px 0 8px;
    border-color: #2c3e50 transparent transparent transparent;
}

.asana-link-wrapper:hover .asana-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.asana-tooltip-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
    word-break: normal;
    white-space: normal;
}

.asana-tooltip-content span:last-child {
    flex: 1;
    min-width: 0;
}

.asana-tooltip-icon {
    flex-shrink: 0;
    font-size: 16px !important;
    color: #ffd700;
    margin-top: 1px;
}

/********************/
/* LEGAL PAGES      */
/********************/

.legal-content {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-xl);
    line-height: 1.6;
}

.legal-content h2 {
    color: var(--color-text-primary);
    font-size: 28px;
    margin-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: var(--spacing-sm);
}

.legal-content h3 {
    color: var(--color-text-primary);
    font-size: 20px;
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-md);
}

.legal-content h4 {
    color: var(--color-text-primary);
    font-size: 16px;
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

.legal-content p {
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-md);
}

.legal-content ul {
    margin-left: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

.legal-content li {
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

.legal-content a {
    color: var(--color-primary);
    text-decoration: none;
}

.legal-content a:hover {
    text-decoration: underline;
}

.legal-content em {
    .in-progress-container {
        text-align: center;
        padding: var(--spacing-xl) 0;
        margin: var(--spacing-xl) 0;
    }

    .in-progress-icon {
        font-size: 80px !important;
        color: var(--color-text-secondary);
        display: block;
        margin: 0 auto var(--spacing-lg);
        opacity: 0.6;
    }

    .in-progress-text {
        font-size: 18px;
        font-weight: 500;
        color: var(--color-text-primary);
        margin-bottom: var(--spacing-sm);
    }

    .in-progress-subtext {
        font-size: 14px;
        color: var(--color-text-secondary);
    }

    color: var(--color-text-secondary);
    font-size: 14px;
}

.back-link {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
}

.back-link a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: gap 0.2s ease;
}

.back-link a:hover {
    gap: 12px;
}

.back-link .material-symbols-outlined {
    font-size: 20px;
}

/********************/
/* MODAL            */
/********************/

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--color-bg-main);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-main);
    color: var(--color-text-primary);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: none;
    box-shadow: none;
}

.modal-close .material-symbols-outlined {
    font-size: 24px;
    color: var(--color-text-secondary);
}

.modal-content {
    padding: var(--spacing-lg);
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

.modal-status-item {
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--color-border-light);
}

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

.modal-status-item strong {
    display: block;
    color: var(--color-primary);
    font-size: 15px;
    margin-bottom: 4px;
}

.modal-status-item p {
    color: var(--color-text-secondary);
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

/********************/
/* MOBILE ELEMENTS  */
/********************/

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    transition: right 0.3s ease;
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: flex-end;
}

.mobile-nav-overlay.active {
    right: 0;
}

.mobile-nav-content {
    width: 80%;
    max-width: 300px;
    height: 100%;
    background-color: var(--color-bg-main);
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
}

.mobile-nav-close {
    align-self: flex-end;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    margin-bottom: var(--spacing-xl);
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.mobile-nav-link {
    font-size: 18px;
    font-weight: 500;
    color: var(--color-text-primary);
    text-decoration: none;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--color-border-light);
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    text-align: left;
    cursor: pointer;
    width: 100%;
}

.mobile-nav-link.active {
    color: var(--color-primary);
    font-weight: 600;
}

.mobile-sync-info-btn {
    display: flex;
    align-items: center;
}

/********************/
/* RESPONSIVE       */
/********************/

@media screen and (max-width: 1250px) {
    /* Topic ausblenden (Index 6) */
    table th:nth-child(6),
    table td:nth-child(6) {
        display: none;
    }
}

@media screen and (max-width: 1190px) {
    /* Room ausblenden (Index 5) */
    table th:nth-child(5),
    table td:nth-child(5) {
        display: none;
    }
}

@media screen and (max-width: 1020px) {
    /* Location ausblenden (Index 4) */
    table th:nth-child(4),
    table td:nth-child(4) {
        display: none;
    }
}

@media screen and (max-width: 860px) {
    /* Header Adjustments */
    .header__link--active,
    .header__link,
    .header__nav .header-info-btn {
        display: none;
    }

    .header__hamburger__menu {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 24px;
        height: 18px;
        cursor: pointer;
    }

    .header__hamburger__bar {
        width: 100%;
        height: 2px;
        background-color: var(--color-text-primary);
        border-radius: 2px;
    }

    /* Filter bar: Suche in voller Breite, Location + Reset in zweiter Zeile */
    .filter-bar {
        flex-wrap: wrap;
    }

    .search-field {
        flex: 1 1 100%;
    }

    .location-filter {
        flex: 1;
        width: auto;
    }

    /* Dashboard Mobile Adjustments */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Im umgestellten 2-Spalten-Layout soll "Completed Tickets"
       oben rechts neben "Open Tickets" stehen. */
    .stat-card.stat-total {
        order: 0;
    }

    .stat-card.stat-erledigt {
        order: 1;
    }

    .stat-card.stat-status {
        order: 2;
    }

    .stat-card {
        min-height: 90px;
        padding: 16px 12px;
    }

    .stat-value {
        font-size: 28px;
    }

    /* Table Adjustments - Date ausblenden (Index 2) */
    table th:nth-child(2),
    table td:nth-child(2) {
        display: none;
    }

    /* Increase touch targets for mobile */
    tr.summary-row td {
        padding: 14px 8px;
        min-height: 48px;
    }

    .chevron-icon {
        font-size: 24px;
    }
}

@media screen and (max-width: 750px) {
    /* Short Description (Index 7) und Unit (Index 8) ausblenden */
    table th:nth-child(7),
    table td:nth-child(7),
    table th:nth-child(8),
    table td:nth-child(8) {
        display: none;
    }
}

@media screen and (max-width: 650px) {
    body {
        padding: 0 var(--spacing-md) var(--spacing-md) var(--spacing-md);
    }

    main {
        padding-top: calc(var(--header-height) + var(--spacing-md));
    }

    .header__container {
        padding: 0 var(--spacing-md);
    }

    /* iPhone: MBID, Submitter, Task Status, Chevron bleiben sichtbar */

    .header__container h1 {
        font-size: 16px;
        text-align: center;
    }

    .header__logo {
        height: 60px;
    }

    :root {
        --header-height: 80px;
    }

    .header__container {
        height: 80px;
    }
}

@media screen and (max-width: 560px) {
    body {
        font-size: 13px;
    }

    table {
        font-size: 13px;
    }

    table th,
    table td {
        padding: var(--spacing-sm);
    }

    /* Ensure touch targets remain accessible even on smallest screens */
    tr.summary-row td {
        padding: 12px 6px;
    }

    .chevron-icon {
        font-size: 22px;
    }

    /* Dashboard: Single column on very small screens */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card {
        min-height: 80px;
        padding: 14px 10px;
    }

    .stat-value {
        font-size: 24px;
    }

    .stat-label {
        font-size: 11px;
    }
}
