/* Finabase - Styles im Stil der Referenz-App */

html, body {
    height: 100%;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column; 
    background-color: #fdf8f1;
}

h1 {
    font-size: 30px;
    text-align: center;
}

h2 {
    font-size: 25px;
    opacity: 0.7;
    text-align: center;
}

h3 {
    padding-top: 10px;
    font-size: 20px;
}

h4 {
    font-size: 18px;
}

p {
    font-size: 18px;
    margin-top: 3px;
    margin-bottom: 5px;
}

/* Navigation */
nav {
    background-color: #DD3333;
    color: #fff;
    padding: 12px 10px;
    min-height: 56px;
    box-sizing: border-box;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

nav ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

nav ul li {
    margin-right: 20px;
    font-size: 18px;
}

nav ul li a {
    color: #fff;
    text-decoration: none;
    padding: 10px;
    display: block;
    transition: background-color 0.3s;
}

nav ul li a:hover {
    background-color: #C02A2A;
}

/* Submenu (Stammdaten-Dropdown) – Desktop */
.has-submenu {
    position: relative;
}

.submenu-toggle {
    cursor: pointer;
    user-select: none;
}

.submenu-arrow {
    font-size: 12px;
    margin-left: 2px;
    display: inline-block;
    transition: transform 0.2s;
}

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

.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #C02A2A;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    padding: 4px 0;
    z-index: 1001;
    flex-direction: column;
}

.has-submenu.open > .submenu {
    display: flex;
}

.submenu li {
    margin: 0;
    width: 100%;
}

.submenu li a {
    padding: 10px 20px;
    font-size: 15px;
    white-space: nowrap;
    border-radius: 0;
}

.submenu li a:hover {
    background-color: #a82424;
}

/* Hamburger Menu Button */
.hamburger-container {
    display: none;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: absolute;
    left: 10px;
}

.hamburger {
    display: flex;
    flex-direction: column;
    padding: 5px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: #fff;
    margin: 3px 0;
    transition: 0.3s;
}

.hamburger-label {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    user-select: none;
}

/* Main Content */
main {
    flex: 1;
    padding: 20px;
    margin-top: 64px; /* Platz für fixierte Navigation */
    padding-bottom: 80px;
}



/* Dashboard Cards */
.dashboard-cards {
    max-width: 1400px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin: 20px auto;
    padding: 0 20px;
}

.dashboard-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
    padding: 0;
    display: flex;
}

.dashboard-card-icon {
    width: 120px;
    min-height: 100%;
    height: 48px;
    border-right: 1px solid #e5e7eb;
    border-radius: 16px 0 0 16px;
    display: flex;
    align-items: center;
    align-self: stretch;
    justify-content: center;
    font-size: 48px;
}

.dashboard-card-body {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dashboard-card-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 0;
}

.dashboard-card-title {
    font-size: 26px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.dashboard-card-subtitle {
    font-size: 22px;
    color: #6b7280;
    margin: 4px 0 0 0;
}

.dashboard-card-content {
    margin: 0;
    font-size: 16px;
}

.dashboard-card-content p {
    padding-top: 10px;
    color: #6b7280;
}

.dashboard_highlight {
    margin-top: 10px;
    padding: 8px 16px;
    border-radius: 20px;
    background-color: transparent;
    border: 1px solid black;
    color: black;
    font-size: 16px;
    font-weight: 600;
    display: inline-block;
}

.dashboard-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-card-stat {
    text-align: center;
}

.dashboard-card-stat-number {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    display: block;
}

.dashboard-card-stat-label {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dashboard Finanzübersicht – kompakt, nur 3 Werte */
.dashboard-finanz-compact {
    padding: 4px 0;
}

.dashboard-finanz-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
}

.dashboard-finanz-label {
    color: #6b7280;
}

.dashboard-finanz-value {
    font-weight: 600;
}

.dashboard-finanz-result {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
    font-weight: 600;
}

/* Dashboard Jahresdurchschnitte – nicht anklickbar, volle Breite */
.dashboard-card--averages {
    grid-column: 1 / -1;
}

.dashboard-card--averages:hover {
    transform: none;
}

.dashboard-averages-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
}

.dashboard-averages-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-width: 200px;
    padding: 6px 0;
    font-size: 14px;
}

.dashboard-averages-label {
    color: #6b7280;
}

.dashboard-averages-value {
    font-weight: 600;
}

.dashboard-averages-totals {
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid #e5e7eb;
}

.dashboard-fixkosten-categories {
    width: 100%;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.dashboard-fixkosten-categories-header {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
}

.dashboard-fixkosten-cat-row {
    display: flex;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
    gap: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.dashboard-fixkosten-cat-row:hover {
    background-color: #f9fafb;
}

.dashboard-fixkosten-cat-name {
    flex: 1;
    color: #374151;
}

.dashboard-fixkosten-cat-value {
    font-weight: 600;
    color: #e74c3c;
}

.dashboard-fixkosten-cat-pct {
    min-width: 36px;
    color: #6b7280;
    font-size: 12px;
}

.dashboard-stats-loading {
    padding: 16px 0;
    color: #6b7280;
    font-size: 14px;
}

.dashboard-budget {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 4px solid #6b7280;
}

.dashboard-budget-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dashboard-budget-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.dashboard-budget-sublabel {
    font-size: 11px;
    color: #6b7280;
}

.dashboard-budget-value {
    font-size: 18px;
    font-weight: 700;
}

.dashboard-warning {
    padding: 10px 16px;
    margin-bottom: 12px;
    background: #fef2f2;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
    color: #b91c1c;
    font-size: 13px;
    line-height: 1.4;
}

.dashboard-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-width: 0;
}

.dashboard-stats-month {
    padding: 12px 16px;
    border-radius: 8px;
    background: #f9fafb;
    min-width: 0;
}

.dashboard-stats-month-title {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    padding: 0;
}

.dashboard-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    font-size: 13px;
    min-width: 0;
}

.dashboard-stats-label {
    color: #6b7280;
    flex-shrink: 0;
}

.dashboard-stats-value {
    font-weight: 600;
    white-space: nowrap;
    text-align: right;
    flex-shrink: 0;
}

.dashboard-stats-expense {
    color: #e74c3c;
}

.dashboard-stats-income {
    color: #059669;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.dashboard-card.clickable-card {
    cursor: pointer;
}

.dashboard-card.clickable-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

/* Buttons */
button {
    padding: 12px;
    border: 1px solid #DD3333;
    color: black;
    border-radius: 12px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #C02A2A;
    color: white;
}

.button-group {
    display: inline-flex;
    gap: 10px;
}

/* Forms */
input {
    width: 100%; 
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 18px;
    box-sizing: border-box;
}

textarea {
    width: 100%; 
    padding: 12px; 
    border: 1px solid #ddd; 
    border-radius: 6px; 
    font-family: inherit; 
    font-size: 18px; 
    resize: vertical;
    box-sizing: border-box;
}

select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

/* Auth Pages */
.header {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #DD3333, #C02A2A);
    color: white;
    margin-bottom: 2rem;
    border-radius: 0 0 20px 20px;
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

.back-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.back-link:hover {
    opacity: 1;
}

.welcome-card,
.auth-card {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.welcome-card h2 {
    margin-bottom: 1rem;
    color: #DD3333;
}

.welcome-card p {
    margin-bottom: 1rem;
    color: #6b7280;
}

.pwa-install-section {
    margin-bottom: 1.25rem;
}

.btn-pwa-install {
    background: #1e3a8a;
    color: #fff;
    border: 2px solid #1e3a8a;
    font-size: 1rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    max-width: 100%;
}

.btn-pwa-install:hover {
    background: #1e40af;
    border-color: #1e40af;
    color: #fff;
}

.pwa-install-hint {
    font-size: 16px;
    color: #6b7280;
    margin: 0.5rem 0 0;
    line-height: 1.45;
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
}

.btn {
    background-color: white;
    color: black;
    padding: 0.75rem 1.5rem;
    border: 1px solid #DD3333;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background-color: #DD3333;
    color: white;
}

.btn-primary:hover {
    background-color: #C02A2A;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-secondary {
    background-color: #2ecc71;
    color: white;
}

.btn-secondary:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-block {
    width: 100%;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #DD3333;
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #7f8c8d;
}

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

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid #ddd;
}

.auth-footer a {
    color: #DD3333;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.error-message,
.success-message {
    padding: 1rem;
    border-radius: 5px;
    margin-top: 1rem;
}

.error-message {
    background-color: #fee;
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.success-message {
    background-color: #efe;
    color: #2ecc71;
    border: 1px solid #2ecc71;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Mobile Styles */
@media (max-width: 1200px) {
    .hamburger-container {
        display: flex;
    }

    nav {
        justify-content: space-between;
    }
    
    nav ul {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        width: 100%;
        background-color: #ffffff;
        flex-direction: column;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        padding: 0;
        margin: 0;
    }
    
    nav ul.active {
        display: flex;
    }
    
    nav ul li {
        width: 100%;
        margin: 0;
        border-bottom: 1px solid #e5e7eb;
    }
    
    nav ul li a {
        padding: 15px 20px;
        color: #333;
    }
    
    nav ul li a:hover {
        background-color: #f3f4f6;
        color: #DD3333;
    }
    
    /* Submenu mobile */
    .submenu {
        position: static;
        min-width: 0;
        background: #f9fafb;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
    }

    .has-submenu.open > .submenu {
        display: flex;
    }

    .submenu li a {
        padding: 12px 20px 12px 36px;
        font-size: 15px;
        color: #555;
    }

    .submenu li a:hover {
        background-color: #f3f4f6;
        color: #DD3333;
    }

    .submenu-toggle {
        color: #333 !important;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }
    
    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }

    .button-group {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        width: 100%;
        margin-bottom: 20px;
    }

    .button-group .btn {
        width: auto;
        min-width: 200px;
        max-width: 280px;
    }
}

@media (max-width: 1024px) {
    .dashboard-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 0 10px;
    }
    
    .dashboard-card {
        flex-direction: column;
        height: auto;
    }
    
    .dashboard-card-icon {
        width: 100%;
        min-height: 80px;
        font-size: 40px;
        border-bottom: 1px solid #e5e7eb;
        border-right: none;
        border-radius: 16px 16px 0 0;
        background: radial-gradient(circle, #ede7df 35px, transparent 35px);
    }
    
    .dashboard-card-body {
        padding: 20px;
    }

    .dashboard-stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-card-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .dashboard-card-stat {
        padding: 8px 0;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .dashboard-card-stat:nth-child(3n) {
        border-bottom: none;
    }
}

@media (max-width: 480px) {
    .dashboard-cards {
        padding: 0 5px;
    }
    
    .dashboard-card-body {
        padding: 18px;
    }

    .dashboard-card-title {
        font-size: 26px;
    }

    .dashboard-card-subtitle {
        font-size: 22px;
    }

    .dashboard-card-content {
        font-size: 16px;
    }
}

.table-header {
    margin-bottom: 20px;
    text-align: center;
    width: 100%;
}

.table-header p {
    margin-bottom: 10px;
}

/* ===== TABELLEN-STYLES ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.data-table thead {
    background-color: #DD3333;
    color: white;
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

.data-table tbody tr:hover {
    background-color: #f9fafb;
}

.data-table .search-row {
    background-color: #f3f4f6;
}

.search-filter-category-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.search-filter-category-wrap .search-select {
    width: 100%;
    min-width: 120px;
}

.data-table .search-row input,
.data-table .search-row select {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.action-btn {
    background: transparent;
    border: 1px solid #DD3333;
    color: black;
    padding: 6px;
    border-radius: 4px;
    margin-bottom: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 5px;
    transition: background-color 0.3s;
}

.action-btn:hover {
    background: #C02A2A;
}

.action-btn.small {
    padding: 4px 8px;
    font-size: 12px;
}

.pagination-controls {
    margin: 20px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.pagination-browser-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.pagination-btn {
    background: #DD3333;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.pagination-btn:hover:not(:disabled) {
    background: #C02A2A;
}

.pagination-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#clear-all-search-btn {
    display: block;
    align-self: center;
    width: auto;
    margin-bottom: 10px;
}

.pagination-info {
    font-size: 14px;
    color: #333;
    margin: 0 10px;
}

.page-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    text-align: center;
}

.page-header .back-button {
    display: inline-block;
    color: #DD3333;
    text-decoration: none;
    margin-right: 15px;
    font-size: 15px;
    padding: 8px 20px;
    border: 2px solid #DD3333;
    border-radius: 8px;
    background-color: #fff;
    transition: background-color 0.2s, color 0.2s;
}

.page-header .back-button:hover {
    background-color: #DD3333;
    color: #fff;
    text-decoration: none;
}

/* Mobile Labels auf Desktop verstecken */
.data-table .mobile-label {
    display: none;
}

.data-table .mobile-content {
    display: inline-block;
    white-space: nowrap;
}

/* Search Toggle Button – nur auf Mobile sichtbar */
.search-toggle-btn {
    display: none;
}

/* Mobile Styles für Tabellen */
@media (max-width: 768px) {
    .btn  {
        width: 100%;
        margin-bottom: 10px;
    }

    .search-toggle-btn {
        display: block !important;
        width: 100% !important;
        padding: 8px 16px;
        font-size: 14px;
        background: #f3f4f6;
        color: #374151;
        border: 1px solid #d1d5db;
        border-radius: 8px;
        margin-bottom: 10px;
        cursor: pointer;
        box-sizing: border-box;
    }
    .search-toggle-btn.active {
        background: #DD3333;
        color: #fff;
        border-color: #DD3333;
    }

    .pagination-btn,
    #clear-all-search-btn {
        width: 100% !important;
        box-sizing: border-box;
    }

    .data-table.search-row-hidden .search-row {
        display: none !important;
    }

    .data-table .search-row {
        background: #f9fafb;
        border: 1px dashed #d1d5db;
    }

    .data-table .search-row td:empty {
        display: none;
    }

    .data-table {
        display: block;
    }
    
    .data-table thead {
        display: none;
    }
    
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }
    
    .data-table tr {
        margin-bottom: 15px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 10px;
        background: white;
    }
    
    .data-table td {
        border: none;
        padding: 8px 0;
        text-align: left;
    }
    
    .data-table .mobile-label {
        font-weight: 600;
        color: #DD3333;
        display: inline-block;
        min-width: 120px;
        margin-right: 10px;
    }
    
    .data-table .mobile-content {
        display: inline-block;
    }
    
    .pagination-controls {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .pagination-browser-buttons {
        flex-direction: row;
        flex-wrap: nowrap;
        width: 100%;
        justify-content: space-between;
        gap: 5px;
    }
    
    .pagination-btn {
        flex: 1;
        min-width: 0;
        height: 40px;
        padding: 10px;
        position: relative;
    }
    
    /* Text in Buttons ausblenden, nur Icons anzeigen */
    .pagination-browser-buttons .pagination-btn {
        text-indent: -9999px;
        overflow: hidden;
        font-size: 0;
    }
    
    /* Icons über ::before anzeigen */
    .pagination-browser-buttons .pagination-btn::before {
        content: '';
        text-indent: 0;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        font-size: 18px;
        line-height: 1;
    }
    
    /* Icons für jeden Button spezifisch setzen */
    .pagination-browser-buttons .pagination-btn:first-child::before {
        content: '⏮️';
    }
    
    .pagination-browser-buttons .pagination-btn:nth-child(2)::before {
        content: '◀️';
    }
    
    .pagination-browser-buttons .pagination-btn:nth-last-child(2)::before {
        content: '▶️';
    }
    
    .pagination-browser-buttons .pagination-btn:last-child::before {
        content: '⏭️';
    }
    
    
}

/* ===== STATISTIK-SEITE ===== */

.stats-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    margin: 0 auto 20px auto;
    max-width: 1400px;
}

.stats-toolbar-group {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    text-align: left;
}

.stats-toolbar-group label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    text-align: left;
}

.stats-select {
    width: auto;
    min-width: 120px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: #1f2937;
    cursor: pointer;
    transition: border-color 0.2s;
    text-align: left;
}

.stats-select:focus {
    outline: none;
    border-color: #DD3333;
    box-shadow: 0 0 0 2px rgba(221, 51, 51, 0.15);
}

/* Stats-Filter-Dropdowns */
.stats-filter-dropdown-wrap {
    position: relative;
}
.stats-filter-dropdown {
    position: relative;
}
.stats-filter-btn {
    min-width: 80px;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: #1f2937;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    transition: border-color 0.2s;
}
.stats-filter-btn:hover {
    border-color: #DD3333;
}
.stats-filter-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 2px;
    min-width: 180px;
    max-width: 260px;
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
}
.stats-filter-panel.stats-filter-panel-open {
    display: block;
}
.stats-filter-actions {
    padding: 4px 6px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-start;
    gap: 4px;
    text-align: left;
}
.stats-filter-actions button {
    padding: 3px 8px;
    font-size: 11px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #f9fafb;
    cursor: pointer;
    text-align: left;
}
.stats-filter-actions button:hover {
    background: #f3f4f6;
}
.stats-filter-list {
    padding: 4px 6px;
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
}
.stats-filter-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 4px 6px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 3px;
    text-align: left;
    min-width: 0;
}
.stats-filter-item span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stats-filter-item:hover {
    background: #f3f4f6;
}
.stats-filter-item input {
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}
.stats-filter-empty {
    padding: 8px;
    font-size: 12px;
    color: #6b7280;
    text-align: left;
}

.stats-filter-reset-btn {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    text-align: left;
}
.stats-filter-reset-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.stats-balance-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.stats-balance-btn:hover {
    background: linear-gradient(135deg, #a93226, #c0392b);
}

.stats-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.stats-nav-btn:hover {
    background: #DD3333;
    color: #fff;
    border-color: #DD3333;
}

.stats-nav-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-nav-group .stats-current-label {
    flex: 1;
    min-width: 140px;
    text-align: center;
}

.stats-current-label {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    min-width: 160px;
    text-align: left;
    white-space: nowrap;
}

.stats-today-btn {
    padding: 6px 14px;
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.stats-today-btn:hover {
    background: linear-gradient(135deg, #a93226, #c0392b);
}

.stats-date-picker {
    width: auto !important;
    min-width: 150px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #1f2937;
    cursor: pointer;
    transition: border-color 0.2s;
    text-align: left;
}

.stats-date-picker:focus {
    outline: none;
    border-color: #DD3333;
    box-shadow: 0 0 0 2px rgba(221, 51, 51, 0.15);
}

.stats-chart-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    min-height: 400px;
    height: 55vh;
    position: relative;
}

.stats-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.stats-loading {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    color: #6b7280;
    z-index: 5;
}

/* Summary Cards */
.stats-summary {
    max-width: 1400px;
    margin: 20px auto 0 auto;
    text-align: left;
}

.stats-summary-cards {
    display: flex;
    justify-content: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.stats-summary-card {
    flex: 1;
    min-width: 180px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    border-top: 3px solid #d1d5db;
}

.stats-card-start {
    border-top-color: #6b7280;
}

.stats-card-budget {
    border-top-color: #ea580c;
}

.stats-card-income {
    border-top-color: #059669;
}

.stats-card-expense {
    border-top-color: #dc2626;
}

.stats-card-end {
    border-top-color: #2563eb;
}

.stats-card-freebudget {
    border-top-color: #0d9488;
}

.stats-card-freebudget .stats-card-value.stats-amount-income {
    color: #0d9488;
}

.stats-card-freebudget .stats-card-value.stats-amount-expense {
    color: #dc2626;
}

.stats-card-fixkosten {
    border-top-color: #7c3aed;
}

.stats-card-label {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stats-card-sub {
    font-size: 12px;
    color: #6b7280;
    margin-top: 6px;
}

/* Vertragsübersicht unter der Grafik */
.stats-events-section {
    max-width: 1400px;
    margin: 24px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    text-align: left;
}

.stats-events-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.stats-events-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.stats-events-filter {
    display: flex;
    gap: 8px;
}

.stats-events-filter-btn {
    padding: 8px 14px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: #4b5563;
    transition: background 0.2s, border-color 0.2s;
    text-align: left;
}

.stats-events-filter-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.stats-events-filter-btn.active {
    background: #DD3333;
    border-color: #DD3333;
    color: #fff;
}

.stats-events-table-wrap {
    overflow-x: auto;
}

.stats-events-fieldset {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 16px;
    padding: 0 16px 16px 16px;
    background: #fafbfc;
}

.stats-daily-fieldset {
    border-color: #d1d5db;
    border-style: dashed;
    background: #f8f9fb;
}

.stats-events-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-weight: 600;
    color: #374151;
    font-size: 15px;
}

.stats-category-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

.stats-category-icon-wrap img,
.stats-category-icon-wrap .stats-icon-emoji {
    max-width: 48px;
    max-height: 48px;
}

.stats-events-icon-col {
    width: 48px;
}

.stats-events-icon-cell {
    text-align: center;
    vertical-align: middle;
}

.stats-events-icon-cell img {
    max-width: 24px;
    max-height: 24px;
}

.stats-events-subtotal-row {
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
}

.stats-events-subtotal-row td {
    padding: 10px 16px;
}

.stats-ansparrate-legend {
    cursor: pointer;
    user-select: none;
}

.stats-ansparrate-details {
    display: none;
    margin-top: 12px;
}

.stats-ansparrate-details.stats-ansparrate-expanded {
    display: block;
}

.stats-events-sum-row {
    padding: 12px 16px;
    background: #f8fafc;
    border-top: 2px solid #e5e7eb;
    margin-top: 8px;
    margin-bottom: 16px;
    border-radius: 8px;
}

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

.stats-events-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: #6b7280;
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.stats-events-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #f3f4f6;
}

.stats-events-table tbody tr:hover {
    background: #f8fafc;
}

.stats-events-amount-col {
    text-align: right;
}

.stats-events-table td.stats-events-amount-col,
.stats-events-table td.stats-amount-income,
.stats-events-table td.stats-amount-expense {
    text-align: right;
    font-weight: 600;
}

.stats-amount-income {
    color: #059669;
}

.stats-amount-expense {
    color: #dc2626;
}

/* Korrigiertes Datum (Ausgabe von Wochenende/Feiertag auf nächsten Werktag) */
.stats-date-adjusted {
    color: #dc2626;
    font-weight: 500;
}

.stats-events-empty {
    color: #9ca3af;
    text-align: center;
    padding: 32px;
    font-style: italic;
}


/* Ansparrate aufklappbar */
.stats-ansparrate-summary {
    cursor: pointer;
    background: #f8fafc;
}

.stats-ansparrate-summary:hover {
    background: #f1f5f9;
}

.stats-expand-icon {
    display: inline-block;
    width: 16px;
    margin-right: 6px;
    font-size: 10px;
    transition: transform 0.2s;
}

.stats-ansparrate-details-row .stats-ansparrate-details {
    display: none;
    padding: 0 0 0 24px;
    background: #fafbfc;
}

.stats-ansparrate-details-row.stats-ansparrate-expanded .stats-ansparrate-details {
    display: block;
}

.stats-events-inner {
    width: 100%;
    border: none;
}

.stats-events-inner td {
    border-bottom: 1px solid #f3f4f6;
    padding: 8px 16px;
    font-size: 13px;
}

.stats-ansparrate-detail .stats-ansparrate-detail-label {
    padding-left: 8px;
}

.stats-card-value {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
}

.stats-card-income .stats-card-value {
    color: #059669;
}

.stats-card-expense .stats-card-value {
    color: #dc2626;
}

.stats-card-end .stats-card-value {
    color: #2563eb;
}

/* Statistik-Seite responsive */
@media (max-width: 768px) {
    .stats-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 16px;
        overflow: hidden;
    }

    .stats-toolbar-group {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 8px;
        width: 100%;
        box-sizing: border-box;
    }

    .stats-toolbar-group[style*="margin-left: auto"] {
        margin-left: 0 !important;
        flex-direction: column;
    }

    .stats-toolbar-group label {
        width: 100%;
        margin-bottom: 2px;
    }

    .stats-select,
    .stats-date-picker {
        width: 100% !important;
        min-width: 0;
        box-sizing: border-box;
    }

    .stats-toolbar-group > .stats-nav-btn {
        flex: 1 1 0;
        width: auto !important;
        min-width: 0;
    }

    .stats-filter-dropdown-wrap,
    .stats-filter-dropdown,
    .stats-filter-btn {
        width: 100% !important;
        box-sizing: border-box;
    }

    .stats-filter-btn {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .stats-filter-reset-btn,
    .stats-balance-btn {
        width: 100% !important;
        box-sizing: border-box;
        text-align: center;
    }

    .stats-nav-group {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stats-nav-group .stats-nav-btn {
        flex: 1 1 0;
        width: auto !important;
        min-width: 0;
    }

    .stats-nav-group .stats-current-label {
        flex: 2 1 0;
        min-width: 0;
        font-size: 15px;
        text-align: center;
    }

    .stats-nav-group .stats-today-btn {
        width: 100% !important;
        box-sizing: border-box;
        flex-basis: 100%;
    }

    .stats-chart-container {
        padding: 12px;
        min-height: 300px;
        height: 45vh;
    }

    .stats-summary-cards {
        flex-direction: column;
    }

    .stats-summary-card {
        min-width: auto;
    }

    .stats-events-header {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-events-filter {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .stats-events-filter-btn {
        width: 100% !important;
        box-sizing: border-box;
    }

    .stats-events-table th,
    .stats-events-table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .stats-filter-panel {
        max-width: calc(100vw - 40px);
    }
}

/* Kontostand Modal */
.dashboard-balance-value {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.balance-date {
    font-weight: normal;
    color: #6b7280;
    font-size: 0.85em;
}

.balance-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.balance-modal-overlay.is-open {
    display: flex;
}

.balance-modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.balance-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #fff;
    padding: 16px 24px;
    border-radius: 12px 12px 0 0;
}

.balance-modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.balance-modal-close {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.balance-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fff;
}

.balance-modal-body {
    padding: 24px;
}

.balance-modal-body label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.balance-modal-body select,
.balance-modal-body input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 8px;
    box-sizing: border-box;
}

.balance-modal-body #balance-current {
    font-size: 0.9em;
    color: #6b7280;
    margin-bottom: 16px;
}

.balance-message {
    margin-top: 12px;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9em;
    display: none;
}

.balance-save-btn {
    margin-top: 16px;
    width: 100%;
    padding: 12px;
    background: #c0392b;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.balance-save-btn:hover {
    background: #a93226;
}

/* ===== KI-CHAT ===== */

/* ===== KI-Berater Fullpage ===== */
.ai-page-container {
    max-width: 100%;
    margin: 0 auto;
}

.ai-page-status {
    background: #fef3cd;
    border: 1px solid #ffc107;
    border-radius: 12px;
    padding: 24px;
    color: #856404;
    font-size: 15px;
    text-align: center;
}

.ai-page-status code {
    background: rgba(0,0,0,0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.ai-chat-fullpage {
    height: calc(100vh - 160px);
    min-height: 400px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    padding: 16px;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 10px;
}

.page-header h1 {
    margin: 0;
}

.back-button {
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 8px;
    background: #f3f4f6;
    transition: background 0.2s;
    white-space: nowrap;
}

.back-button:hover {
    background: #e5e7eb;
    color: #374151;
}

.ai-chat-container {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ai-chat-fullpage .ai-chat-container,
.ai-chat-container.ai-chat-fullpage {
    height: 100%;
}

.ai-chat-toolbar {
    display: flex;
    justify-content: flex-end;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.ai-chat-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    color: #6b7280;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-chat-clear-btn:hover {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fca5a5;
}

.ai-chat-clear-btn svg {
    flex-shrink: 0;
}

/* ===== Generisches Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay[style*="flex"] {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: #DD3333;
    color: #fff;
    border-radius: 16px 16px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2em;
}

.modal-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255,255,255,0.2);
}

.modal-content form,
.modal-content .modal-body {
    padding: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: #374151;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #DD3333;
    box-shadow: 0 0 0 3px rgba(221,51,51,0.1);
}

.form-hint {
    display: block;
    margin-top: 4px;
    color: #9ca3af;
    font-size: 12px;
}

.form-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
}

.attachment-content-tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    padding: 0 24px;
    background: #fff;
}

.attachment-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.attachment-tab:hover {
    color: #374151;
}

.attachment-tab.active {
    color: #DD3333;
    border-bottom-color: #DD3333;
}

.attachment-content-preview {
    padding: 24px;
    margin: 0;
    background: #f9fafb;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.6;
    max-height: 60vh;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.ai-chat-message {
    display: flex;
    max-width: 85%;
    animation: aiFadeIn 0.3s ease;
}

@keyframes aiFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-chat-message--user {
    align-self: flex-end;
}

.ai-chat-message--assistant {
    align-self: flex-start;
}

.ai-chat-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.ai-chat-message--user .ai-chat-bubble {
    background: #DD3333;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-chat-message--assistant .ai-chat-bubble {
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

.ai-chat-bubble p {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.ai-chat-bubble p:last-child {
    margin-bottom: 0;
}

.ai-chat-bubble strong, .ai-chat-bubble b {
    font-weight: 700;
}

.ai-chat-bubble em, .ai-chat-bubble i {
    font-style: italic;
}

.ai-chat-bubble ul, .ai-chat-bubble ol {
    margin: 4px 0 8px 18px;
    padding: 0;
}

.ai-chat-bubble li {
    margin-bottom: 2px;
    font-size: 14px;
}

.ai-chat-typing {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
    align-items: center;
}

.ai-chat-typing-dot {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: aiTypingBounce 1.4s ease-in-out infinite;
}

.ai-chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes aiTypingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

.ai-chat-input-area {
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
    flex-shrink: 0;
}

.ai-chat-fullpage .ai-chat-input-area {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 12px 0 4px;
    z-index: 10;
}

.ai-chat-input-wrap {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.ai-chat-input {
    flex: 1;
    resize: none;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    max-height: 120px;
    overflow-y: auto;
    transition: border-color 0.2s;
    box-sizing: border-box;
    width: auto;
}

.ai-chat-input:focus {
    outline: none;
    border-color: #DD3333;
    box-shadow: 0 0 0 2px rgba(221, 51, 51, 0.12);
}

.ai-chat-send-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border: none;
    background: #DD3333;
    color: #fff;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    padding: 0;
}

.ai-chat-send-btn:hover {
    background: #C02A2A;
    transform: scale(1.05);
}

.ai-chat-send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

.ai-chat-error {
    padding: 8px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 13px;
    margin-top: 4px;
}

@media (max-width: 768px) {
    .ai-chat-message {
        max-width: 92%;
    }

    .ai-chat-bubble {
        font-size: 16px;
        padding: 8px 12px;
    }

    .ai-chat-fullpage {
        height: calc(100vh - 140px);
        min-height: 300px;
        border-radius: 12px;
        padding: 10px;
    }

    .page-header {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* ===== MOBILE: Mindest-Schriftgröße 16px ===== */
@media (max-width: 768px) {
    body {
        font-size: 16px !important;
    }

    p, li, a, span, label, td, th, div,
    input, select, textarea, button, small,
    .btn, .action-btn, .pagination-btn,
    .pagination-info,
    .data-table td, .data-table th,
    .data-table .search-row input,
    .data-table .search-row select,
    .data-table .mobile-label,
    .data-table .mobile-content,
    .back-button,
    .page-header .back-button,
    .stats-toolbar-group label,
    .stats-select,
    .stats-filter-btn,
    .stats-filter-dropdown-label,
    .stats-filter-option,
    .stats-filter-option label,
    .tax-year-select, .tax-toolbar label,
    .tax-category-name, .tax-contract-title,
    .tax-contract-amount, .tax-contract-info,
    .tax-grand-total small,
    .searchable-select-input,
    .searchable-select-option,
    .ai-chat-bubble,
    .ai-chat-input,
    .ai-chat-send,
    .ai-chat-timestamp,
    .submenu li a,
    nav ul li a,
    .credit-modal-summary,
    .credit-modal-summary .summary-label,
    .credit-schedule-table td,
    .credit-schedule-table th,
    .analyze-tbl td, .analyze-tbl th,
    .analyze-summary,
    .form-hint, .form-group label,
    .form-group input, .form-group select, .form-group textarea {
        font-size: 16px !important;
    }

    .action-btn.small {
        font-size: 14px !important;
    }

    h1 { font-size: 24px !important; }
    h2 { font-size: 20px !important; }
    h3 { font-size: 18px !important; }
}
