/* ── Inter Schriftart (lokal) ───────────────────────────────── */
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-Thin.woff2') format('woff2');
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-color: #f9f9fb;
    --card-bg: #ffffff;
    --primary: #09235d;
    --primary-hover: #1147bb;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --header-bg: #1a1a2e;
    --header-text: #f8fafc;
    --sekundary: #b8924a;

    /* Ergänzte Standardwerte für Badges & Alerts */
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 300; /* Inter Light als Standard */
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-color);
}

/* ==========================================
   APP STRUCTURE & HEADER / FOOTER
   ========================================== */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background: var(--header-bg);
    color: var(--header-text);
    /* Gleicher Seitenabstand wie .app-footer + .footer-content (max 1200px, zentriert) */
    padding-block: 1rem;
    padding-inline: max(2rem, calc((100% - 1200px) / 2));
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.app-title {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
}

.header-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-email {
    font-size: 0.875rem;
    color: #cbd5e1;
}

.app-main {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 3.5rem 4.5rem;
}

.app-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 1rem 2rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==========================================
   DASHBOARD & MODULE GRID
   ========================================== */
.dashboard-wrapper {
    max-width: 1200px;
    width: 100%;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.dashboard-header h1 {
    font-size: 1.875rem;
    margin: 0 0 0.5rem 0;
}

.dashboard-header p {
    color: var(--text-muted);
    margin: 0;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    justify-content: center;
}

.module-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.module-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.module-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.module-body h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.module-body p {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.4;
    margin: 0 0 1.5rem 0;
}

.module-footer {
    margin-top: auto;
}

.module-card.is-locked {
    background: #f1f5f9;
    border-color: #cbd5e1;
    opacity: 0.85;
}

.module-card.is-locked .module-icon {
    filter: grayscale(100%);
}

/* ==========================================
   BUTTONS SYSTEM (Vereinheitlicht)
   ========================================== */
.btn-action,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-module,
.btn-logout,
.btn-back-dashboard {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    border: 1px solid transparent;
    padding: 0.6rem 1rem;
    box-sizing: border-box;
}

/* Button Variante Primary */
.btn-primary,
.btn-primary-action,
.btn-module {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    width: 100%;
}

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

.btn-primary-auto {
    width: auto;
}

/* Button Variante Secondary */
.btn-secondary,
.btn-secondary-action {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}

.btn-secondary:hover,
.btn-secondary-action:hover {
    background: #e2e8f0;
}

/* Button Variante Danger */
.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

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

/* Spezifische Modifikationen */
.btn-logout {
    color: #f87171;
    padding: 0.4rem 0.8rem;
    border-color: var(--danger);
    background: transparent;
    font-weight: 500;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-back-dashboard {
    /*background: #334155;*/
    border-color: var(--border);
    color: #f8fafc;
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-back-dashboard:hover {
    background: #475569;
    color: #ffffff;
}

.btn-locked {
    background: #475569;
    color: white;
}

.btn-locked:hover {
    background: #334155;
}

.btn-sync {
    background: #f0f9ff;
    color: #0369a1;
    border-color: #bae6fd;
}

.btn-sync:hover {
    background: #e0f2fe;
}

.btn-icon-add, .btn-icon-delete, .btn-icon-close, .btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.btn-icon-add { font-size: 1.1rem; }
.btn-icon-delete { color: #94a3b8; }
.btn-icon-close {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
}
.btn-icon-close:hover { background-color: #f1f5f9; color: var(--text); }
.btn-delete { color: var(--danger); font-size: 0.85rem; font-weight: 500; }
.btn-delete:hover { text-decoration: underline; }

/* ==========================================
   FORMULARE & EINGABEFELDER (Vereinheitlicht)
   ========================================== */
.form-container {
    max-width: 850px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label,
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: #334155;
}

.form-group-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e6e6e6;
    border-radius: var(--radius-md);
    box-sizing: border-box;
    font-size: 0.9rem;
    background: #f2f2f2;
    color: var(--primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--sekundary);
    
}

.form-control-color {
    height: 40px;
    padding: 2px;
}

.form-textarea {
    font-family: inherit;
    resize: vertical;
}

.form-row { display: flex; gap: 0.75rem; }
.form-col { flex: 1; }

.form-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-2-1 { grid-template-columns: 1fr 2fr 1fr; }
.grid-contact-row { grid-template-columns: 1fr 2fr 1fr 2fr; gap: 0.8rem; align-items: end; }

.form-card {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-card-title {
    margin-top: 0;
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.5rem;
}

.form-footer-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* ==========================================
   LOGIN SCREEN
   ========================================== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 380px;
}

/* ==========================================
   ALERTS & BADGES
   ========================================== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    background: #fef2f2;
    color: var(--danger);
}

.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-info { background: #f3f4f6; color: #374151; }
.alert-danger { background: #fee2e2; color: #991b1b; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f1f5f9; color: #475569; }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }

.fc .fc-toolbar-title { font-size: 1.25rem; font-weight: 600; }
.fc .fc-button-primary:not(:disabled).fc-button-active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ==========================================
   MODALS
   ========================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.active { display: flex; }

.modal-content {
    background: #ffffff;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    padding: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-content-sm { max-width: 360px; }
.modal-content-lg { max-width: 720px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.modal-header { padding-bottom: 0.75rem; border-bottom: 1px solid var(--border);}
.modal-header h3 { margin: 0; font-size: 1.25rem; }
.modal-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1rem; margin-top: 0; }
.modal-footer { display: flex; justify-content: space-between; margin-top: 1.5rem; gap: 0.5rem; }
.modal-footer { padding-top: 0.75rem; border-top: 1px solid #f1f5f9; }
.modal-footer-right { display: flex; gap: 0.5rem; margin-left: auto; }

/* ==========================================
   TABELLEN & LINKS (modulübergreifend; Kontakte-Styles siehe contacts.css)
   ========================================== */

/* Tabellen Layout */
.table-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.table-card-header {
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.table-card-header h3 { margin: 0; font-size: 1rem; color: #334155; }

.table-responsive-wrapper {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: visible;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow-x: auto;       /* Behält horizontales Scrollen für mobile Geräte bei */
    overflow-y: visible;    /* Verhindert das Abschneiden von Menüs nach unten */
    min-height: 260px;      /* Garantiert Mindesthöhe bei nur 1 Datensatz */
    padding-bottom: 5rem;   /* Schafft zusätzlichen Puffer am Tabellenende */
}
.table-empty { padding: 2rem !important; text-align: center; color: #94a3b8; }

.link-primary { color: var(--primary); text-decoration: none; font-weight: 500; }
.link-secondary { color: #475569; text-decoration: none; font-size: 0.8rem; }
.link-edit { color: var(--primary); text-decoration: none; font-weight: 600; font-size: 0.85rem; }
.link-back { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }
.link-back:hover { color: var(--text); }
.detail-label { color: #94a3b8; font-size: 0.75rem; }
.text-muted-empty { color: #cbd5e1; }

/* Dropdown Actions Menü (3-Punkte) */

.actions-group { display: flex; gap: 0.75rem; justify-content: flex-end; align-items: center; }
.dropdown { position: relative; display: inline-block; }

.btn-dropdown-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-md);
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.btn-dropdown-toggle:hover { background: #e2e8f0; color: var(--text); }

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 100;
    min-width: 220px;
    padding: 0.35rem 0;
    text-align: left;
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
    color: #334155;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.15s;
    font-weight: 500;
}

.dropdown-item:hover { background: #f1f5f9; }
.dropdown-item.text-danger { color: var(--danger); }
.dropdown-item.text-danger:hover { background: #fef2f2; }

/* ==========================================
   KPI & INVOICING CARDS
   ========================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.kpi-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.kpi-value { font-size: 1.5rem; font-weight: 700; }

.filter-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.filter-group { flex: 1 1 180px; }
.filter-group.flex-grow-2 { flex-grow: 2; }

/* Utilities */
.text-dark { color: var(--text); }
.text-warning { color: #d97706; }
.text-primary { color: var(--primary); }
.text-end { text-align: right; }
.icon-svg { display: inline-block; vertical-align: middle; flex-shrink: 0; fill: currentColor; }
.form-inline-delete { display: inline; margin: 0; }

/* ==========================================================================
   MEDIA QUERIES
   ========================================================================== */
@media (max-width: 640px) {
    .app-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; padding-block: 1rem; }
    .header-user { width: 100%; justify-content: space-between; gap: 0.5rem; }
    .user-email { font-size: 0.8rem; }
    .app-main { padding: 0.75rem; }
    .dashboard-header { margin-bottom: 1.5rem; }
    .dashboard-header h1 { font-size: 1.5rem; }
    .modules-grid { grid-template-columns: 1fr; gap: 1rem; }
    .module-card { padding: 1.25rem; }
    .footer-content { flex-direction: column; gap: 0.5rem; text-align: center; }
    .login-card { padding: 1.5rem; }
    .btn-back-text { display: none; }

    .calendar-layout { flex-direction: column; height: auto; min-height: calc(100vh - 100px); gap: 1rem; }
    .calendar-sidebar { width: 100%; max-height: 220px; padding: 1rem; gap: 1rem; }
    .calendar-main { height: 600px; padding: 0.75rem; }
    .form-row { flex-direction: column; gap: 0.5rem; }

    .fc .fc-toolbar { flex-direction: column; gap: 0.5rem; }
    .fc .fc-toolbar-title { font-size: 1rem; }
    .fc .fc-button { padding: 0.3rem 0.5rem; font-size: 0.8rem; }
    .btn-action { justify-content: center; padding: 0.5rem; font-size: 0.8rem; }

}

@media (min-width: 641px) and (max-width: 1024px) {
    .app-header { padding-block: 1rem; }
    .app-main { padding: 1.5rem 1rem; }
    .modules-grid { grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
    .calendar-sidebar { width: 220px; padding: 1rem; }
    .calendar-main { padding: 1rem; }
    .fc .fc-toolbar-title { font-size: 1.1rem; }

}

@media (min-width: 1025px) {
    .modules-grid { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }

}
/* ==========================================
   DASHBOARD ACCORDION
   ========================================== */
.dashboard-accordion-group {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dashboard-accordion {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.dashboard-accordion[open] {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: #ffffff;
    cursor: pointer;
    user-select: none;
    list-style: none; /* Blendet den Standard-Browser-Pfeil aus */
}

/* Entfernt Standard-Pfeile in Chrome/Safari/Firefox */
.accordion-header::-webkit-details-marker,
.accordion-header::marker {
    display: none;
}

.accordion-header:hover {
    background: #f8fafc;
}

.accordion-title-group h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.2rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
}

.accordion-title-group small {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Eigener animierter Pfeil */
.accordion-icon {
    width: 20px;
    height: 20px;
    position: relative;
    flex-shrink: 0;
}

.accordion-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: translate(-50%, -65%) rotate(45deg);
    transition: transform 0.2s ease;
}

/* Pfeil-Rotation bei geöffnetem Status */
.dashboard-accordion[open] .accordion-icon::before {
    transform: translate(-50%, -35%) rotate(-135deg);
}

.accordion-content {
    padding: 0 1.5rem 1.5rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    margin-top: 0.5rem;
    padding-top: 1.25rem;
}
/* ==========================================
   LOGIN PAGE STYLES
   ========================================== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8fafc;
    margin: 0;
    padding: 1.5rem;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: #ffffff;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    padding: 2.5rem 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text, #0f172a);
    margin: 0 0 0.5rem 0;
}

.login-header p {
    color: var(--text-muted, #64748b);
    font-size: 0.875rem;
    margin: 0;
}

/* Form Elements */
.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text, #334155);
    margin-bottom: 0.5rem;
}

.login-form input[type="email"],
.login-form input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 1px solid var(--border, #cbd5e1);
    border-radius: var(--radius-md, 8px);
    background-color: #ffffff;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-block {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-md, 8px);
}

/* Alert Styling */
.alert-danger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md, 8px);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.alert-icon {
    font-size: 1.1rem;
}

/* Ergaenzungen fuer Formular-Grids auf mobilen Geraeten */
@media (max-width: 640px) {
    .grid-2, 
    .grid-3, 
    .grid-2-1, 
    .grid-1-2-1, 
    .grid-contact-row {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }

    .form-footer-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .form-footer-actions .btn-primary,
    .form-footer-actions .btn-secondary,
    .form-footer-actions .btn-danger {
        width: 100%;
    }

}

@media (min-width: 641px) and (max-width: 1024px) {
    .grid-3, 
    .grid-1-2-1, 
    .grid-contact-row {
        grid-template-columns: 1fr 1fr;
    }

}

/* ==========================================
   ADMIN LAYOUT & SIDEBAR (Ergänzung)
   ========================================== */
.admin-layout {
    display: flex;
    flex: 1;
    width: 100%;
    min-height: calc(100vh - 120px);
}

.sidebar {
    width: 260px;
    background: #ffffff;
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    flex-shrink: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.sidebar-menu li a:hover {
    background: #f8fafc;
    color: var(--text);
}

.sidebar-menu li.active a {
    color: var(--primary);
    background: #eff6ff;
    border-left-color: var(--primary);
    font-weight: 600;
}

.main-content {
    flex: 1;
    padding: 2rem;
    background: var(--bg-color);
    overflow-x: hidden;
}

/* Header & Action Bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.action-bar h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text);
}

.btn-create {
    width: auto !important;
}

/* Status-Pills & Badges */
.status-pill {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active {
    background: var(--success-bg);
    color: var(--success-text);
}

.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.badge-disabled {
    background: #f1f5f9;
    color: #94a3b8;
}

.module-badges-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

/* Adress-Box in Tabellen */
.address-box {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
    margin: 0.5rem 0;
    line-height: 1.4;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    margin: 1.25rem 0 0.75rem 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* Dropdown Anpassungen */
.dropdown-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

.dropdown-btn:hover {
    background: #e2e8f0;
    color: var(--text);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 50;
    min-width: 140px;
    overflow: hidden;
}

.dropdown-content button {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text);
}

.dropdown-content button:hover {
    background: #f1f5f9;
}

.dropdown-content button.danger {
    color: var(--danger);
}

.dropdown-content button.danger:hover {
    background: #fef2f2;
}

/* Responsive Sidebar */
@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.5rem 0;
    }

    .sidebar-menu {
        flex-direction: row;
        justify-content: border-around;
    }

    .sidebar-menu li a {
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 0.5rem 1rem;
    }

    .sidebar-menu li.active a {
        border-left-color: transparent;
        border-bottom-color: var(--primary);
    }
    
    .main-content {
        padding: 1rem;
    }

}
/* ==========================================
   ZENTRIERUNG FIX (MODALS & LOGIN)
   ========================================== */

/* 1. Modals exakt im Ansichtsfenster zentrieren */
.modal {
    display: none; /* Standabmäßig ausblenden */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5); /* Leicht abgedunkelter Hintergrund */
    backdrop-filter: blur(4px);
    z-index: 9999;
    
    /* Flexbox für vertikale und horizontale Zentrierung */
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

/* Modal Content Restriktionen für saubere Zentrierung */
.modal-content {
    background: #ffffff;
    border-radius: var(--radius-xl, 12px);
    width: 100%;
    max-width: 550px; /* Maximale Breite für Formulare */
    max-height: 90vh; /* Verhindert das Herausrutschen bei langen Formular-Inhalten */
    overflow-y: auto;  /* Scrollbar falls Inhalt zu lang ist */
    padding: 1.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    margin: auto; /* Zusätzlicher Zentrierungs-Fallback */
    position: relative;
}

/* 2. Login-Screen Zentrierung */
.login-wrapper {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color, #f8fafc);
    padding: 1.5rem;
    box-sizing: border-box;
}

.login-card {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}
/* ==========================================
   FLEXIBLE HÖHEN- UND TABELLEN-ANPASSUNG
   ========================================== */

/* 1. Hauptbereich bis zum Rand strecken */
.admin-layout {
    min-height: calc(100vh - 65px); /* Header-Höhe berücksichtigen */
    align-items: stretch;
}

.main-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* 2. Form-Card flexibel machen */
.main-content > .form-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

/* 3. Tabelle & Wrapper-Anpassung: Erzwingt sichtbare Zeilen ohne unnötige Scrollbar */
.table-responsive-wrapper {
    flex: 1;
    max-height: none !important; /* Aufheben von vorherigen Höhenbeschränkungen */
    height: auto !important;
    overflow-y: visible !important; /* Scrollbar für die Zeilen entfernen */
    overflow-x: auto; /* Horizontale Scrollbar für mobile Ansichten behalten */
}

.contacts-table {
    height: max-content;
}
/* --- BOARD LAYOUT & SCROLLING --- */
.kanban-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    width: 100%;
    box-sizing: border-box;
}

.kanban-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.kanban-header-actions {
    display: flex;
    gap: 0.5rem;
}

.kanban-board {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    flex-grow: 1;
    padding-bottom: 1rem;
    align-items: flex-start;
}

/* --- HORIZONTALE SPALTEN --- */
.kanban-column {
    min-width: 320px;
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 100%;
    overflow-y: auto;
    padding: 0.25rem;
    border-radius: 8px;
    /*background-color: rgba(0, 0, 0, 0.02);*/
}

/* --- VERTIKAL GESTAPELTE LISTEN --- */
.kanban-list {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.kanban-list-header {
    padding: 0.75rem 1rem;
    background: #ffffff;
    border-bottom: 1px solid #eee;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
}

.kanban-list-header-actions {
    display: flex;
    gap: 0.25rem;
}

.kanban-list-title {
    font-weight: 700;
    font-size: 1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.task-count {
    background: #e9ecef;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    color: #495057;
}

.kanban-tasks {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 50px;
    overflow-y: auto;
    flex-grow: 1;
}

/* --- TASK CARDS --- */
.task-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.85rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.08);
}

.task-card-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2d3748;
}

.task-card-description {
    font-size: 0.8rem;
    color: #718096;
    margin: 0 0 0.5rem 0;
}

.task-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    font-size: 0.8rem;
}

.task-card-date {
    color: #a0aec0;
}

.task-card-edit-btn {
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
}

/* --- FÄLLIGKEITS-HERVORHEBUNG --- */
.task-card.is-due-today {
    border-color: #4ade80;               /* helles Grün */
}
.task-card.is-due-today .task-card-date {
    color: #22c55e;
    font-weight: 600;
}

.task-card.is-overdue {
    border-color: #991b1b;               /* dunkles Rot */
}
.task-card.is-overdue .task-card-date {
    color: #991b1b;
    font-weight: 600;
}

/* --- BADGES & PRIORITY --- */
.badge-priority {
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.65rem;
}

.badge-low { background: #e2e8f0; color: #4a5568; }
.badge-medium { background: #feebc8; color: #744210; }
.badge-high { background: #fe2c2c22; color: #c53030; }
.badge-urgent { background: #9b2c2c; color: #ffffff; }

/* --- BUTTONS & ACTIONS --- */
.add-column-btn {
    min-width: 280px;
    background: rgba(255, 255, 255, 0.6);
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    color: #4a5568;
    transition: all 0.2s ease;
}

.add-column-btn:hover {
    background: #ffffff;
    border-color: #4299e1;
    color: #2b6cb0;
}

.stack-list-btn {
    border: 1px dashed #cbd5e0;
    background: #ffffff;
    border-radius: 6px;
    padding: 0.4rem;
    text-align: center;
    font-size: 0.85rem;
    color: #4a5568;
    cursor: pointer;
    margin: 0 0.75rem 0.75rem 0.75rem;
}

.stack-list-btn:hover {
    background: #edf2f7;
}

/* --- MODAL --- */
.kanban-modal {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 400px;
    width: 100%;
}

.kanban-modal-title {
    margin-top: 0;
}

.kanban-modal-group {
    margin-bottom: 1rem;
}

.kanban-modal-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.kanban-modal-input {
    width: 100%;
    padding: 0.5rem;
    box-sizing: border-box;
}

.kanban-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* --- DRAG & DROP STATES --- */
.dragging {
    opacity: 0.4;
}

.drag-over-list {
    background-color: #ebf8ff !important;
    border: 2px dashed #3182ce !important;
}

.drag-over-column {
    outline: 2px dashed #4299e1;
}

/* Container für das Logo */
.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem auto;
    background-color: #f1f5f9; /* Heller, moderner Hintergrund */
    border-radius: 50%;         /* Kreisförmiges Badge */
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Interaktiver Effekt beim Drüberfahren */
.login-logo:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Das eigentliche SVG-Bild */
.login-logo img,
.login-logo .logo-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
}

/* ==========================================
   HEADER & RESPONSIVE MOBILE DRAWER MENU
   ========================================== */

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.org-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #334155;
    color: #f8fafc;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.btn-header-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    border: 1px solid #64748b;
    color: #f8fafc;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-header-item:hover {
    background: #334155;
}

/* Visibility Utilities */
.mobile-only {
    display: none !important;
}

/* Off-Canvas Mobile Drawer Styling */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-menu {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 100%;
    max-width: 80%; /* Standard-Anforderung: Max 80% bei mittleren/kleinen Displays */
    background: var(--header-bg);
    color: var(--header-text);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
}

.mobile-nav-menu.is-active {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #334155;
}

.mobile-menu-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-close-menu {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.5rem;
}

.mobile-menu-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.org-badge-mobile {
    background: #334155;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    color: #f8fafc;
    font-weight: 500;
}

.mobile-menu-divider {
    border: 0;
    height: 1px;
    background: #334155;
    margin: 0.5rem 0;
}

.mobile-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: #2a2a40;
    border: 1px solid #475569;
    color: #f8fafc;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    text-align: left;
}

.mobile-menu-btn:hover {
    background: #334155;
}

.btn-logout-mobile {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger);
    color: #fca5a5;
}

.btn-logout-mobile:hover {
    background: rgba(239, 68, 68, 0.25);
}

.mobile-menu-toggle {
    background: transparent;
    border: none;
    color: #f8fafc;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:hover {
    background: #334155;
}

/* ==========================================
   MEDIA QUERIES (RESPONSIVE BREAKPOINTS)
   ========================================== */

/* Alle Geräte außer Desktop (Mobilgeräte & Tablets bis 1024px) */
@media (max-width: 1024px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }

    .app-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding-block: 0.85rem;
    }

}

/* Sehr kleine Smartphone-Displays (bis 480px) */
@media (max-width: 480px) {
    .mobile-nav-menu {
        max-width: 100%; /* Vollbreite bei sehr kleinen Bildschirmgrößen */
    }

}

/* ==========================================
   GLOBALER MODUL-HEADER
   Titel links, Aktionen (Button + ⋮-Menü) rechts.
   Verwendung:
   <div class="module-header">
     <div class="module-title-group"><h2>…</h2><p>…</p></div>
     <div class="module-actions">…</div>
   </div>
   ========================================== */
.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.module-title-group h2 { margin: 0; color: var(--text); font-size: 1.5rem; }
.module-title-group p { margin: 0.2rem 0 0 0; color: var(--text-muted); font-size: 0.9rem; }

.module-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.module-actions .dropdown-menu { min-width: 190px; }

/* <button> als Menüeintrag soll wie <a>-Einträge aussehen */
button.dropdown-item {
    font-family: inherit;
    text-align: left;
}

@media (max-width: 640px) {
    .module-header { flex-direction: column; align-items: stretch; }
    .module-actions .btn-action { flex: 1; }
}

/* Dropdown Menü Styling für Desktop */
.app-menu-container {
    position: relative;
    display: inline-block;
}

.btn-menu-trigger {
    background: transparent;
    border: none;
    color: #f8fafc;
    padding: 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.btn-menu-trigger:hover,
.btn-menu-trigger:focus {
    background-color: #334155;
    outline: none;
}

.app-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background-color: #1e293b;
    border: 1px solid #475569;
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    min-width: 160px;
    z-index: 1000;
    padding: 0.25rem 0;
}

.app-dropdown-menu.show {
    display: block;
}

.dropdown-item-btn {
    width: 100%;
    background: transparent;
    border: none;
    color: #f8fafc;
    padding: 0.6rem 1rem;
    text-align: left;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.15s ease;
}

.dropdown-item-btn:hover {
    background-color: #334155;
}

/* Lade-Zustand für Buttons (modulübergreifend, siehe assets/js/ui.js) */
.btn-loading {
    background: #64748b !important;
    border-color: #64748b !important;
    color: #ffffff !important;
    cursor: progress;
    pointer-events: none;
}
.btn-spinner {
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn-spinner { animation-duration: 2.5s; } }

/* Modal während eines laufenden Vorgangs: nicht schließbar */
.modal.is-busy .btn-icon-close,
.modal.is-busy .btn-secondary { pointer-events: none; opacity: 0.5; }
.modal-status { min-height: 1.2em; font-size: 0.85rem; color: var(--text-muted); text-align: right; }