/* ============================================================
   Mediaplanner - CSS Styles
   Modernes, professionelles Design für Shared Hosting
   ============================================================ */

/* --- Reset & Grundlagen --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --info: #0891b2;
    --info-light: #cffafe;

    --bg: #f1f5f9;
    --bg-white: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --radius: 8px;
    --radius-sm: 4px;

    --sidebar-width: 260px;
    --header-height: 64px;
}

html {
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
}

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

a:hover {
    text-decoration: underline;
}

/* --- Layout --- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: #1e293b;
    color: #cbd5e1;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    max-width: 180px;
    height: auto;
    display: block;
    margin-bottom: 14px;
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.sidebar-header span {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    padding: 16px 0;
}

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

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 24px 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: #cbd5e1;
    font-size: 14px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    text-decoration: none;
}

.nav-link.active {
    background: rgba(37,99,235,0.2);
    color: #60a5fa;
    border-left-color: var(--primary);
}

.nav-link .icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100%;
}

/* --- Header --- */
.top-header {
    height: var(--header-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
    overflow: hidden;
}

.top-header .page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-light);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

/* --- Content Area --- */
.content {
    padding: 32px;
    overflow-x: hidden;
}

/* --- Cards --- */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}

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

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.card-header h4 .emoji,
.card-body h4 .emoji {
    font-size: 1.5em;
    vertical-align: middle;
    margin-right: 4px;
}

.card-body {
    padding: 24px;
    overflow-x: auto;
}

/* --- Stat Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 80px;
    position: relative;
}

/* Klickbare Stat-Cards (a-Tags) */
a.stat-card-clickable,
a.stat-card-clickable:visited {
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}

a.stat-card-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.stat-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--warning, #f59e0b);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    line-height: 1.4;
}

a.stat-card-link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

a.stat-card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    line-height: 1;
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-light);
}

/* Stat cards without icon (label + value variant) */
.stat-label {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
    flex-shrink: 0;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
    display: flex;
    align-items: center;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.5;
}

.btn:hover { text-decoration: none; }

.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }

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

.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; }

.btn-outline   { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }

.btn-outline-primary { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-outline-success { background: #fff; color: var(--success); border-color: var(--success); }
.btn-outline-success:hover { background: var(--success); color: #fff; }

.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }

/* Icon-only buttons (no background, just the symbol) */
.btn-icon {
    background: none;
    border: none;
    padding: 4px 6px;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.15s, transform 0.15s;
    line-height: 1;
}

.btn-icon:hover {
    color: var(--text);
    transform: scale(1.15);
    text-decoration: none;
}

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

/* --- Forms --- */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-white);
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 20px;
    padding-right: 40px;
}

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

/* --- Tables --- */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8fafc;
}

table.sortable th[data-sort] {
    cursor: pointer;
    position: relative;
    padding-right: 20px;
}

table.sortable th[data-sort]::after {
    content: '⇅';
    display: inline-block;
    margin-left: 4px;
    opacity: 0.3;
    font-size: 11px;
    pointer-events: none;
}

table.sortable th[data-sort].sort-asc::after {
    content: '▲';
    opacity: 0.7;
}

table.sortable th[data-sort].sort-desc::after {
    content: '▼';
    opacity: 0.7;
}

table.sortable th[data-sort]:hover {
    color: var(--primary);
}

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

.table .actions {
    display: flex;
    gap: 8px;
}

/* --- Badges / Status --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-secondary { background: #f1f5f9; color: var(--secondary); }

/* --- Alerts / Flash Messages --- */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: var(--danger-light);  color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: var(--info-light);    color: #155e75; border: 1px solid #a5f3fc; }

/* --- Login Page --- */
.login-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    background: linear-gradient(150deg, #1e3a5f 0%, #2a5298 40%, #3b7dd8 70%, #4a9bd9 100%);
    padding: 12vh 20px 20px;
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://www.stapes.ch/new_world/img/hero-bg-4.svg');
    background-position: center top;
    background-size: cover;
    background-repeat: no-repeat;
    opacity: 0.12;
    pointer-events: none;
    z-index: 0;
}

.login-card {
    position: relative;
    z-index: 1;
    background: var(--bg-white);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 8px 24px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 400px;
    padding: 48px 40px;
}

.login-card h1 {
    font-size: 28px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 6px;
    color: #4f46e5;
    letter-spacing: 1px;
}

.login-logo {
    max-width: 170px;
    height: auto;
    display: block;
    margin: 0 auto 24px auto;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 36px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 4px;
    white-space: nowrap;
}

.login-card .form-control {
    background: #f5f7fa;
    border: 1px solid #e2e6ec;
    border-radius: 10px;
}

.login-card .form-control:focus {
    background: #fff;
    border-color: #3b7dd8;
    box-shadow: 0 0 0 3px rgba(59,125,216,0.12);
}

.login-card .btn {
    width: 100%;
    justify-content: center;
    padding: 13px;
    font-size: 15px;
    background: linear-gradient(135deg, #2a5298 0%, #3b7dd8 100%);
    border: none;
    border-radius: 12px;
    letter-spacing: 0.5px;
}

.login-card .btn:hover {
    background: linear-gradient(135deg, #1e3a5f 0%, #2a5298 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(42,82,152,0.35);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.card .empty-state {
    padding: 8px 16px;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p {
    max-width: 400px;
    margin: 0 auto 20px;
}

/* --- Mobile Card List --- */
.mobile-cards {
    display: none;
}

.mobile-card,
.mobile-card-item {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.mobile-card:last-child,
.mobile-card-item:last-child {
    border-bottom: none;
}

.mobile-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.mobile-card-link:hover {
    background: var(--bg-hover, #f5f7fa);
    border-radius: 6px;
}

.mobile-card-header,
.mobile-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    margin-bottom: 8px;
}

.mobile-card-header a,
.mobile-card-title a {
    color: var(--text);
}

.mobile-card-body {
    /* body wrapper for card rows */
}

.mobile-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 13px;
    color: var(--text-light);
}

.mobile-card-label {
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-right: 8px;
}

.mobile-card-value {
    text-align: right;
}

.mobile-card-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.mobile-card-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 6px 0;
}

.mobile-card-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
}

/* --- Responsive --- */

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

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

/* Yearly overview: desktop table vs mobile cards */
.yearly-cards-mobile {
    display: none;
}

.yearly-table-desktop {
    display: block;
}

/* Tablet breakpoint */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .content {
        padding: 24px 20px;
    }

    .top-header {
        padding: 0 20px;
    }

    .chart-bar-label {
        flex: 0 0 110px;
        font-size: 0.8rem;
    }

    .chart-bar-value {
        flex: 0 0 110px;
        font-size: 0.8rem;
    }
}

/* Mobile breakpoint */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
    }

    .content {
        padding: 16px 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 16px;
    }

    .top-header {
        padding: 0 12px;
    }

    .top-header .page-title {
        font-size: 16px;
    }

    /* Hide username on very small screens, keep avatar */
    .user-info span {
        display: none;
    }

    .header-actions {
        gap: 8px;
    }

    .menu-toggle {
        display: block !important;
    }

    /* Page header stacks vertically */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header > div {
        flex-wrap: wrap;
        width: 100%;
        gap: 6px;
    }

    .page-header .btn {
        flex: 1 1 calc(50% - 6px);
        justify-content: center;
        min-width: 0;
        font-size: 12px;
        padding: 6px 8px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Tables always scroll horizontally */
    .card table.table,
    .card-body table.table,
    .card > table,
    .card > .table {
        display: block;
        overflow-x: auto;
    }

    /* Hide desktop table when mobile cards exist */
    .card.has-mobile-cards > table.table,
    .has-mobile-cards > .table,
    .has-mobile-cards .card-body > table.table,
    .has-mobile-cards .card-body > .table,
    .has-mobile-cards > div > table.table,
    .has-mobile-cards > div[style*="overflow"] {
        display: none !important;
    }

    /* Show mobile card list */
    .has-mobile-cards > .mobile-cards,
    .has-mobile-cards .card-body > .mobile-cards {
        display: block;
    }

    /* Yearly overview: hide table, show cards */
    .yearly-table-desktop {
        display: none !important;
    }

    .yearly-cards-mobile {
        display: block !important;
    }

    .table th,
    .table td {
        padding: 8px 10px;
        font-size: 13px;
        white-space: nowrap;
    }

    .table .actions {
        gap: 4px;
    }

    /* Form actions wrap on mobile */
    .form-actions {
        flex-wrap: wrap;
    }

    .form-actions .btn {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }

    /* Filter forms stack */
    .filter-form > div {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .filter-form .form-group {
        min-width: 0 !important;
        width: 100%;
    }

    .filter-form .btn {
        width: 100%;
        justify-content: center;
    }

    /* Login card responsive */
    .login-card {
        padding: 32px 24px;
    }

    .login-card h1 {
        font-size: 22px;
    }

    /* Card-header stacks on mobile */
    .card-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px;
    }

    .card-header > * {
        width: 100%;
    }

    /* Statistics: show mobile cards, hide tables */
    .has-stat-mobile-cards > table.table,
    .has-stat-mobile-cards .card-body > table.table,
    .has-stat-mobile-cards > .table {
        display: none !important;
    }

    .has-stat-mobile-cards > .stat-mobile-cards,
    .has-stat-mobile-cards .card-body > .stat-mobile-cards {
        display: block !important;
    }

    /* Placements grid: single column on mobile */
    .stats-two-col-grid {
        grid-template-columns: 1fr !important;
    }

    /* Chart bars: stack label on top */
    .chart-bars-stack-mobile .chart-bar-row {
        flex-wrap: wrap;
    }

    .chart-bars-stack-mobile .chart-bar-label {
        flex: 0 0 100%;
        text-align: left;
        margin-bottom: 2px;
    }

    .chart-bars-stack-mobile .chart-bar-track {
        flex: 1;
    }

    .chart-bars-stack-mobile .chart-bar-value {
        flex: 0 0 auto;
    }

    .card-header .btn,
    .card-header .btn-sm {
        align-self: flex-start;
        width: auto;
    }

    /* Alerts compact */
    .alert {
        padding: 10px 14px;
        font-size: 13px;
    }

    /* Stat values smaller */
    .stat-info h3 {
        font-size: 22px;
    }

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

    /* Compact table on mobile */
    .table-compact td,
    .table-compact th {
        padding: 4px 4px;
        font-size: 0.7rem;
    }

    .table-compact th:first-child {
        min-width: 100px;
    }

    /* Page header stacks on mobile */
    .page-header {
        gap: 6px;
    }

    .page-header > div {
        width: 100%;
        flex-wrap: wrap;
    }

    /* Form action buttons full width */
    .form-actions {
        flex-wrap: wrap;
    }

    .form-actions .btn {
        flex: 1;
        min-width: 0;
        text-align: center;
    }

    /* --- Sidebar mobile optimizations --- */
    .sidebar {
        width: 280px;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    .sidebar-header {
        padding: 16px 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border: none;
        background: rgba(255,255,255,0.1);
        border-radius: 50%;
        color: #cbd5e1;
        font-size: 20px;
        cursor: pointer;
        transition: background 0.15s;
        flex-shrink: 0;
    }

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

    .nav-link {
        padding: 12px 20px;
        font-size: 15px;
    }

    .nav-section-title {
        padding: 10px 20px 4px;
    }

    /* --- Mobile card improvements --- */
    .mobile-card,
    .mobile-card-item {
        padding: 14px 16px;
    }

    .mobile-card-title,
    .mobile-card-header {
        font-size: 14px;
    }

    .mobile-card-row {
        font-size: 13px;
        padding: 4px 0;
    }

    .mobile-card-actions {
        gap: 12px;
        margin-top: 8px;
        padding-top: 8px;
    }

    .mobile-card-actions .btn-icon {
        font-size: 20px;
        padding: 6px 8px;
    }

    /* --- Filter form mobile --- */
    .filter-form .form-group {
        margin-bottom: 8px;
    }

    .filter-form .form-control {
        font-size: 16px;
        padding: 10px 12px;
    }

    /* Better touch targets */
    .btn {
        min-height: 40px;
    }

    .btn-sm {
        min-height: 34px;
    }

    /* Dashboard stat cards on mobile */
    .stat-card {
        gap: 12px;
    }

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

    /* Compact header actions */
    .top-header {
        height: 56px;
    }

    .btn-outline.btn-sm {
        font-size: 12px;
        padding: 4px 10px;
    }
}

/* Very small phones */
@media (max-width: 480px) {
    .content {
        padding: 12px 8px;
    }

    .card-body {
        padding: 16px;
    }

    .card-header {
        padding: 14px 16px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }

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

    .stats-grid {
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
        gap: 10px;
    }

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

    .stat-info h3 {
        font-size: 18px;
    }

    .stat-info p {
        font-size: 12px;
    }

    .chart-bar-label {
        flex: 0 0 60px;
        font-size: 0.7rem;
    }

    .chart-bar-value {
        flex: 0 0 70px;
        font-size: 0.7rem;
    }

    .login-card {
        padding: 24px 16px;
        border-radius: 12px;
    }

    .login-card h1 {
        font-size: 20px;
    }

    /* Badge smaller */
    .badge {
        font-size: 11px;
        padding: 1px 8px;
    }

    .page-header h3 {
        font-size: 16px;
    }

    /* Table: hide less important columns on very small screens */
    .table th,
    .table td {
        font-size: 12px;
    }

    /* Review forms stack fully */
    .card-body form[style*="min-width"] {
        min-width: 100% !important;
    }

    /* Sidebar narrower on very small phones */
    .sidebar {
        width: 260px;
    }

    /* Filter form inputs smaller */
    .filter-form .form-control {
        font-size: 14px;
        padding: 8px 10px;
    }

    /* Nav links compact on very small phones */
    .nav-link {
        padding: 10px 16px;
        font-size: 14px;
    }

    .nav-section-title {
        padding: 8px 16px 4px;
        font-size: 10px;
    }

    /* Mobile cards compact */
    .mobile-card,
    .mobile-card-item {
        padding: 12px;
    }

    .mobile-card-row {
        font-size: 12px;
    }

    /* Header compact */
    .top-header {
        height: 50px;
        padding: 0 8px;
    }

    .top-header .page-title {
        font-size: 14px;
    }
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text);
}

/* Sidebar close button - hidden on desktop */
.sidebar-close {
    display: none;
}

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

/* --- Page Toolbar (compact filter + actions in one row) --- */
.page-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-toolbar .toolbar-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.page-toolbar .toolbar-filters .form-control {
    height: 40px;
    font-size: 14px;
}

.page-toolbar .toolbar-filters .form-group {
    margin-bottom: 0;
    min-width: 120px;
}

.page-toolbar .toolbar-filters .form-group label {
    display: none;
}

.page-toolbar .toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .page-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .page-toolbar .toolbar-filters {
        flex-direction: column;
        width: 100%;
        align-items: flex-start;
    }
    .page-toolbar .toolbar-filters .form-group,
    .page-toolbar .toolbar-filters .form-control,
    .page-toolbar .toolbar-filters input[type="text"] {
        width: 100%;
        min-width: 0;
    }
    .page-toolbar .toolbar-actions {
        flex-wrap: wrap;
    }
    .page-toolbar .toolbar-actions .form-control,
    .page-toolbar .toolbar-actions select.form-control {
        width: 100%;
        min-width: 0 !important;
        flex: 1 1 auto;
    }
}

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

.page-header > div {
    display: flex;
    gap: 8px;
}

.page-header > :only-child {
    margin-left: auto;
}

/* --- Utilities --- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

/* --- Chart Bars (CSS-only bar charts) --- */
.chart-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.chart-bar-row:last-child {
    margin-bottom: 0;
}

.chart-bar-label {
    flex: 0 0 140px;
    font-size: 0.85rem;
    color: var(--text);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-bar-track {
    flex: 1;
    height: 22px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    gap: 2px;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    min-width: 2px;
}

.chart-bar-value {
    flex: 0 0 130px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    text-align: right;
}

/* --- Checkbox Cards (month selector) --- */
.checkbox-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}

.checkbox-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.checkbox-card input:checked + span {
    color: var(--primary-dark);
    font-weight: 600;
}

.checkbox-card:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* --- Month Toggle Selector --- */
.month-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.month-selector-actions {
    display: flex;
    gap: 6px;
}

.month-quick-btn {
    padding: 4px 12px;
    font-size: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.month-selector-grid {
    display: flex;
    gap: 8px;
}

.month-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 9px 0;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
    text-align: center;
}

.month-toggle input {
    display: none;
}

.month-toggle span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-light);
    pointer-events: none;
}

.month-toggle:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.month-toggle:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary);
}

.month-toggle:has(input:checked) span {
    color: #fff;
    font-weight: 600;
}

@media (max-width: 768px) {
    .month-selector-grid {
        flex-wrap: wrap;
        gap: 8px;
    }
    .month-toggle {
        flex: 0 0 calc(16.666% - 7px);
    }
}

@media (max-width: 480px) {
    .month-toggle {
        flex: 0 0 calc(25% - 6px);
    }
}

/* --- Form Row --- */
.form-row {
    display: flex;
    gap: 16px;
}

.form-row > .form-group {
    flex: 1;
}

/* --- Form Actions (buttons at bottom of form) --- */
.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .chart-bar-label {
        flex: 0 0 80px;
        font-size: 0.75rem;
    }

    .chart-bar-value {
        flex: 0 0 90px;
        font-size: 0.75rem;
    }

    /* Checkbox month grid wraps */
    .month-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* --- Form Hints --- */
.form-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Checkbox Label --- */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* card-header reset removed - using default padding from above */

/* --- Compact Table --- */
.table-compact td,
.table-compact th {
    padding: 6px 8px;
    font-size: 0.8rem;
}

/* --- Inline Form (for delete buttons) --- */
.inline-form {
    display: inline;
}

/* --- Actions cell --- */
.actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

/* --- Button success --- */
.btn-success {
    background: var(--success);
    color: #fff;
    border: none;
}
.btn-success:hover {
    background: #15803d;
}

/* --- Statistics Mobile Cards --- */
.stat-mobile-cards {
    display: none;
}

.stat-mobile-card {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 16px;
}

.stat-mobile-card:last-child {
    border-bottom: none;
}

.stat-mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.stat-mobile-card-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.stat-mobile-card-badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

.stat-mobile-card-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-mobile-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.stat-mobile-card-row .label {
    color: var(--text-muted);
    font-weight: 500;
}

.stat-mobile-card-row .value {
    font-weight: 600;
    color: var(--text);
    text-align: right;
}

.stat-mobile-card-bar {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-mobile-card-bar-track {
    flex: 1;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}

.stat-mobile-card-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.stat-mobile-card-bar-pct {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 42px;
    text-align: right;
}

.stat-mobile-card-total {
    padding: 14px 16px;
    border-top: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 14px;
    background: #f8fafc;
}

/* --- App Footer --- */
.app-footer {
    text-align: center;
    padding: 24px 16px;
    margin-top: 40px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.app-footer a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

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

@media (max-width: 480px) {
    .app-footer {
        font-size: 0.7rem;
        padding: 16px 10px;
    }
}

/* --- Custom Confirm Modal --- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 16px;
}

.confirm-overlay.active {
    opacity: 1;
}

.confirm-dialog {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 420px;
    width: 100%;
    transform: scale(0.9) translateY(10px);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.confirm-overlay.active .confirm-dialog {
    transform: scale(1) translateY(0);
}

.confirm-dialog-header {
    padding: 20px 24px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.confirm-dialog-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.confirm-dialog-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.confirm-dialog-body {
    padding: 12px 24px 20px;
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.5;
}

.confirm-dialog-footer {
    padding: 0 24px 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.confirm-dialog-footer .btn {
    min-width: 100px;
    justify-content: center;
}

/* --- Client Dashboard Card Grid --- */
.client-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.client-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
}

.client-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.client-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px 12px;
    gap: 12px;
}

.client-card-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}

a.client-card-title:hover {
    color: var(--primary);
    text-decoration: underline;
}

.client-card-details {
    padding: 0 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.client-card-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.client-card-label {
    color: var(--text-muted);
    font-weight: 500;
}

.client-card-value {
    color: var(--text);
}

.client-card-action {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-align: right;
}

.client-card-action a {
    text-decoration: none;
}

.client-card-action a:hover {
    text-decoration: none;
    opacity: 0.75;
}

.client-card:hover .client-card-action {
    background: #f0f7ff;
}

.client-card-pending {
    border-left: 3px solid var(--warning, #f59e0b);
}

/* In-App Approval Forms */
.client-card-approval {
    border-top: 1px solid var(--border, #e5e7eb);
    padding: 12px 16px;
    background: #fafbfc;
}

.approval-actions {
    display: flex;
    gap: 12px;
}

.approval-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.approval-comment {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border, #d1d5db);
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: inherit;
    resize: vertical;
    min-height: 40px;
    line-height: 1.4;
    background: #fff;
    transition: border-color 0.2s;
}

.approval-comment:focus {
    outline: none;
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.approval-form-reject .approval-comment:focus {
    border-color: var(--danger, #ef4444);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.12);
}

.approval-form .btn {
    align-self: stretch;
    font-size: 0.82rem;
    padding: 6px 12px;
}

.approval-form .btn-success,
.detail-approval-form .btn-success {
    background: var(--success-light, #dcfce7);
    color: var(--success, #16a34a);
    border: 1.5px solid var(--success, #16a34a);
}

.approval-form .btn-success:hover,
.detail-approval-form .btn-success:hover {
    background: var(--success, #16a34a);
    color: #fff;
}

.approval-form .btn-danger,
.detail-approval-form .btn-danger {
    background: var(--danger-light, #fee2e2);
    color: var(--danger, #dc2626);
    border: 1.5px solid var(--danger, #dc2626);
}

.approval-form .btn-danger:hover,
.detail-approval-form .btn-danger:hover {
    background: var(--danger, #dc2626);
    color: #fff;
}

/* Soft Approval Buttons (reusable) */
.btn-approve-soft {
    background: var(--success-light, #dcfce7);
    color: var(--success, #16a34a);
    border: 1.5px solid var(--success, #16a34a);
}

.btn-approve-soft:hover {
    background: var(--success, #16a34a);
    color: #fff;
}

.btn-reject-soft {
    background: var(--danger-light, #fee2e2);
    color: var(--danger, #dc2626);
    border: 1.5px solid var(--danger, #dc2626);
}

.btn-reject-soft:hover {
    background: var(--danger, #dc2626);
    color: #fff;
}

@media (max-width: 600px) {
    .approval-actions {
        flex-direction: column;
        gap: 10px;
    }
}

/* Compact Approval Action Buttons (Table Rows) */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform 0.15s, box-shadow 0.15s;
    background: transparent;
    padding: 0;
}

.btn-action:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.btn-action-approve:hover {
    background: #d4edda;
}

.btn-action-reject:hover {
    background: #f8d7da;
}

.actions .inline-form {
    display: inline;
}

/* Detail Page Approval Forms */
.detail-approval-forms {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.detail-approval-form {
    flex: 1;
    min-width: 240px;
}

.detail-approval-form .form-group {
    margin-bottom: 12px;
}

.detail-approval-form .form-control {
    width: 100%;
    box-sizing: border-box;
}

.detail-approval-form .btn {
    padding: 8px 20px;
}

@media (max-width: 768px) {
    .detail-approval-forms {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .client-cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Activity Timeline */
.activity-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    border-radius: 6px;
}

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

.activity-item:hover {
    background: var(--bg-hover, rgba(0,0,0,0.03));
}

.activity-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    line-height: 1.4;
}

.activity-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.activity-text {
    font-size: 0.9rem;
    line-height: 1.4;
}

.activity-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Session Timeout Warning Modal --- */
.session-timeout-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 16px;
}

.session-timeout-overlay.active {
    opacity: 1;
}

.session-timeout-dialog {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 440px;
    width: 100%;
    transform: scale(0.9) translateY(10px);
    transition: transform 0.3s ease;
    overflow: hidden;
    border-top: 4px solid var(--warning, #f59e0b);
}

.session-timeout-overlay.active .session-timeout-dialog {
    transform: scale(1) translateY(0);
}

.session-timeout-header {
    padding: 24px 24px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.session-timeout-icon {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}

.session-timeout-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.session-timeout-body {
    padding: 16px 24px 20px;
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
}

.session-timeout-body p {
    margin: 0 0 8px 0;
}

.session-timeout-body p:last-child {
    margin-bottom: 0;
}

.session-countdown {
    font-size: 16px;
    font-weight: 700;
    color: var(--warning, #f59e0b);
    transition: color 0.3s ease;
}

.session-countdown-critical {
    color: var(--danger, #ef4444) !important;
    animation: session-blink 1s infinite;
}

@keyframes session-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.session-timeout-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.session-timeout-footer .btn {
    min-width: 120px;
    justify-content: center;
}

/* =====================================================================
   Corporate Design - Kunden
   ===================================================================== */

/* Color picker + Text input nebeneinander */
.cd-color-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cd-color-input input[type="color"] {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.cd-color-input .form-control {
    flex: 1;
}

/* Logo-Vorschau im Formular */
.cd-logo-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
}

.cd-logo-preview img {
    max-width: 120px;
    max-height: 60px;
    object-fit: contain;
}

.cd-logo-remove {
    font-size: 0.85rem;
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Detail-Seite: CD-Grid */
.cd-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.cd-detail-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.cd-detail-logo-img {
    max-width: 160px;
    max-height: 80px;
    object-fit: contain;
}

/* Farbfelder */
.cd-color-swatches {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.cd-color-swatch {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cd-swatch {
    display: inline-block;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.cd-swatch-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* CD-Profil-Karten (Formular + Detail) */
.cd-profile-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    background: var(--bg-light);
}

.cd-profile-card:last-child {
    margin-bottom: 0;
}

.cd-profile-default {
    border-color: var(--primary);
    border-width: 2px;
}

.cd-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.cd-profile-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cd-profile-view {
    margin-top: 12px;
}

.cd-profile-edit {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.cd-profile-form {
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 20px;
    background: var(--bg-light);
}

/* Custom File Upload Button */
.file-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.file-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.file-upload-btn:hover {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.file-upload-btn input[type="file"] {
    display: none;
}

.file-upload-icon {
    font-size: 1.05rem;
}

.file-upload-name {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.file-upload-name.has-file {
    color: var(--text-primary);
    font-weight: 500;
}

/* Font Fieldset */
.cd-font-fieldset {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin: 12px 0;
    background: transparent;
}

.cd-font-fieldset legend {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0 8px;
}

/* Font Detail Row (Anzeige) */
.cd-font-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
}

.cd-font-card:last-child {
    margin-bottom: 0;
}

.cd-font-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cd-font-card-color {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

.cd-font-card-file {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--primary);
    text-decoration: none;
    padding: 3px 10px;
    background: rgba(37, 99, 235, 0.06);
    border-radius: 6px;
    width: fit-content;
    transition: background 0.15s;
}

.cd-font-card-file:hover {
    background: rgba(37, 99, 235, 0.12);
    text-decoration: none;
}

.cd-font-card-badge {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 500;
}

.cd-font-detail-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.cd-font-detail-row:last-child {
    margin-bottom: 0;
}

.cd-font-file-link {
    font-size: 0.8rem;
    color: var(--primary);
    text-decoration: none;
    margin-left: 4px;
}

.cd-font-file-link:hover {
    text-decoration: underline;
}

/* Font Preview (im Edit-Modus) */
.cd-font-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.cd-font-preview a {
    color: var(--primary);
    text-decoration: none;
}

.cd-font-preview a:hover {
    text-decoration: underline;
}

/* =====================================================================
   Filter-Toolbar (Dokumente)
   ===================================================================== */
.filter-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-light);
}

.filter-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fff;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

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

.filter-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.filter-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.08);
}

.filter-tab.active .filter-tab-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.filter-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-left: auto;
}

.filter-search {
    flex-shrink: 0;
}

.filter-search-input {
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
    width: 200px;
    border-radius: 20px !important;
}

.filter-month-select {
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
    width: auto !important;
    min-width: 160px;
    border-radius: 20px !important;
}

.filter-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .filter-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .filter-controls {
        margin-left: 0;
    }

    .filter-search-input {
        width: 100%;
    }

    .filter-month-select {
        width: 100% !important;
    }
}

/* =====================================================================
   Action Banner (Kunden-Dashboard)
   ===================================================================== */
.action-banner {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: var(--radius);
    border-left: 4px solid #f59e0b;
    max-width: 100%;
    width: auto;
}

.action-banner-icon {
    font-size: 1.6rem;
    line-height: 1;
    flex-shrink: 0;
}

.action-banner-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.action-banner-content strong {
    font-size: 0.95rem;
    color: #92400e;
}

.action-banner-detail {
    font-size: 0.82rem;
    color: #a16207;
}

/* Warning-Highlight Filter Tab */
.filter-tab-warning {
    border-color: var(--warning, #f59e0b);
    color: #a16207;
    background: #fffbeb;
}

.filter-tab-warning:hover {
    background: var(--warning, #f59e0b);
    color: #fff;
    border-color: var(--warning, #f59e0b);
}

.filter-tab-warning.active {
    background: var(--warning, #f59e0b);
    border-color: var(--warning, #f59e0b);
    color: #fff;
}

@media (max-width: 600px) {
    .action-banner {
        flex-direction: column;
        text-align: center;
    }
}

/* ============================================================
   Custom Modal Dialogs (Confirm / Prompt)
   ============================================================ */
.st-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 16px;
}

.st-modal-overlay.active {
    opacity: 1;
}

.st-modal {
    background: var(--bg-white, #fff);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 420px;
    transform: translateY(12px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.st-modal-overlay.active .st-modal {
    transform: translateY(0) scale(1);
}

.st-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 24px 0 24px;
}

.st-modal-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.st-modal-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text, #1e293b);
    line-height: 1.3;
}

.st-modal-body {
    padding: 16px 24px;
}

.st-modal-message {
    font-size: 0.92rem;
    color: var(--text-light, #64748b);
    line-height: 1.5;
    margin: 0;
}

.st-modal-input {
    width: 100%;
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text, #1e293b);
    background: var(--bg, #f8fafc);
    margin-top: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: vertical;
    min-height: 40px;
    font-family: inherit;
}

.st-modal-input:focus {
    outline: none;
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    background: #fff;
}

.st-modal-input.st-modal-input-error {
    border-color: var(--danger, #dc2626);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.st-modal-error {
    color: var(--danger, #dc2626);
    font-size: 0.82rem;
    margin-top: 6px;
    display: none;
}

.st-modal-error.visible {
    display: block;
}

.st-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 24px 20px;
}

.st-modal-btn {
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.15s ease;
    font-family: inherit;
    line-height: 1.4;
}

.st-modal-btn-cancel {
    background: var(--bg, #f1f5f9);
    color: var(--text-light, #64748b);
    border-color: var(--border, #e2e8f0);
}

.st-modal-btn-cancel:hover {
    background: #e2e8f0;
    color: var(--text, #1e293b);
}

.st-modal-btn-confirm {
    color: #fff;
}

.st-modal-btn-confirm.st-modal-btn-primary {
    background: var(--primary, #2563eb);
}

.st-modal-btn-confirm.st-modal-btn-primary:hover {
    background: var(--primary-dark, #1d4ed8);
}

.st-modal-btn-confirm.st-modal-btn-success {
    background: var(--success, #16a34a);
}

.st-modal-btn-confirm.st-modal-btn-success:hover {
    background: #15803d;
}

.st-modal-btn-confirm.st-modal-btn-danger {
    background: var(--danger, #dc2626);
}

.st-modal-btn-confirm.st-modal-btn-danger:hover {
    background: #b91c1c;
}

.st-modal-btn-confirm.st-modal-btn-warning {
    background: var(--warning, #d97706);
}

.st-modal-btn-confirm.st-modal-btn-warning:hover {
    background: #b45309;
}

@media (max-width: 480px) {
    .st-modal {
        max-width: 100%;
    }

    .st-modal-header {
        padding: 16px 18px 0;
    }

    .st-modal-body {
        padding: 14px 18px;
    }

    .st-modal-footer {
        padding: 8px 18px 16px;
        flex-direction: column-reverse;
    }

    .st-modal-btn {
        width: 100%;
        text-align: center;
    }
}

/* --- Canton Checkbox Grid --- */
.canton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px;
}

.canton-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.canton-checkbox:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.canton-checkbox input:checked + .canton-code {
    background: var(--primary);
    color: #fff;
}

.canton-code {
    display: inline-block;
    min-width: 26px;
    text-align: center;
    padding: 2px 4px;
    font-weight: 700;
    font-size: 11px;
    border-radius: 4px;
    background: #e5e7eb;
    color: #374151;
    transition: all 0.15s;
}

.canton-name {
    color: var(--text);
}

/* --- Geo Statistics Map --- */
.geo-map-wrapper {
    display: flex;
    justify-content: center;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    padding: 20px;
    border: 1px solid var(--border);
}

.geo-map-wrapper svg {
    width: 100%;
    max-width: 560px;
    height: auto;
}

.geo-hex {
    cursor: pointer;
    transition: all 0.2s ease;
}

.geo-hex:hover {
    filter: brightness(0.85) drop-shadow(0 3px 8px rgba(0,0,0,0.2));
}

.geo-hex:hover polygon {
    stroke-width: 3;
}

.geo-hex polygon {
    transition: fill 0.3s, stroke-width 0.15s;
}

/* --- Cell Bar (inline horizontal bar in table cells) --- */
.cell-bar {
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    min-width: 6px;
    background: rgba(37, 99, 235, 0.12);
    border-radius: 4px;
    border-left: 3px solid rgba(37, 99, 235, 0.35);
    transition: width 0.4s ease;
    pointer-events: none;
}
.cell-bar-green {
    background: rgba(22, 163, 97, 0.12);
    border-left-color: rgba(22, 163, 97, 0.35);
}

/* --- Municipality Tag Input --- */
.muni-field {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #fff;
}

.muni-field-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.muni-field-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.muni-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-height: 34px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f9fafb;
    cursor: text;
}

.muni-tags-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.muni-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 10px;
    background: #dbeafe;
    color: #1e3a5f;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.4;
}

.muni-tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: none;
    background: rgba(0,0,0,0.1);
    color: #1e3a5f;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 0;
    transition: background 0.15s;
}

.muni-tag-remove:hover {
    background: rgba(220, 38, 38, 0.2);
    color: #dc2626;
}

.muni-tag-input {
    flex: 1;
    min-width: 140px;
    border: none;
    background: transparent;
    font-size: 13px;
    padding: 4px;
    outline: none;
}

.geo-tooltip {
    position: absolute;
    background: #1f2937;
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 100;
    max-width: 260px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.geo-tooltip.visible {
    opacity: 1;
}

.geo-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.geo-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.geo-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.1);
}

.geo-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.geo-stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}

.geo-stat-card h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--text-light);
}

.geo-stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.geo-stat-card .stat-sub {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
}

@media (max-width: 768px) {
    .canton-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .geo-stats-grid {
        grid-template-columns: 1fr;
    }
    .geo-map-wrapper {
        padding: 12px;
    }
    .geo-map-wrapper svg {
        min-width: 400px;
    }
    .muni-tags-container {
        min-height: 28px;
    }
}
