/**
 * Klassenkassa - Modernes Design-System & Responsive Styling
 * Mobile-First, CSS-Variables, Glassmorphism, Micro-Animations
 */

:root {
    /* Farbpalette (Finanz- & Schul-Optimiert) */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    --primary-subtle: #eef2ff;

    --emerald: #059669;
    --emerald-hover: #047857;
    --emerald-light: #d1fae5;
    --emerald-subtle: #ecfdf5;

    --rose: #e11d48;
    --rose-hover: #be123c;
    --rose-light: #ffe4e6;

    --amber: #d97706;
    --amber-light: #fef3c7;

    --blue: #2563eb;
    --blue-light: #dbeafe;

    --indigo: #6366f1;
    --indigo-light: #e0e7ff;

    /* Neutrale Töne & Hintergründe */
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-glass: rgba(255, 255, 255, 0.88);
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;

    --text-dark: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    /* Schatten */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

    /* Radien */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    /* Typografie */
    --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* ==========================================================
   1. RESET & BASIS
   ========================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-page);
    color: var(--text-body);
    line-height: 1.5;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: var(--primary-hover);
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* ==========================================================
   2. AUTH / LOGIN PAGE
   ========================================================== */
.auth-page {
    background: radial-gradient(circle at 50% 0%, #e0e7ff 0%, #f8fafc 55%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.auth-wrapper {
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem 2rem;
    position: relative;
    backdrop-filter: blur(10px);
}

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

.brand-badge {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary) 0%, #312e81 100%);
    color: #ffffff;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
    margin-bottom: 1rem;
}

.brand-badge-sm {
    width: 36px;
    height: 36px;
    margin-bottom: 0;
    box-shadow: none;
}

.brand-icon {
    width: 28px;
    height: 28px;
}

.brand-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.brand-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 340px;
    margin: 0 auto;
}

/* Microsoft 365 Button */
.btn-m365 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.85rem 1.25rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    color: #1e293b;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}
.btn-m365:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.m365-notice {
    background: #f1f5f9;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    text-align: center;
}

.m365-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    text-align: center;
    color: var(--text-light);
    font-size: 0.8rem;
    font-weight: 500;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}
.divider span {
    padding: 0 0.85rem;
}

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

.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.4rem;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

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

.input-icon {
    position: absolute;
    left: 0.85rem;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--text-dark);
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}
.input-wrapper .form-control {
    padding-left: 2.5rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-control-sm {
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
}

.font-mono {
    font-family: var(--font-mono) !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-rose {
    background: var(--rose);
    color: #ffffff;
}
.btn-rose:hover {
    background: var(--rose-hover);
    color: #ffffff;
}

.btn-success {
    background: var(--emerald);
    color: #ffffff;
}
.btn-success:hover {
    background: var(--emerald-hover);
    color: #ffffff;
}

.btn-outline-secondary {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-body);
}
.btn-outline-secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

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

.btn-outline-danger {
    background: transparent;
    border-color: #fecdd3;
    color: var(--rose);
}
.btn-outline-danger:hover {
    background: var(--rose-light);
}

.btn-outline-warning {
    background: transparent;
    border-color: #fde68a;
    color: #b45309;
}
.btn-outline-warning:hover {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

.btn-group-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-block {
    width: 100%;
}

.btn-icon-danger {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
}
.btn-icon-danger:hover {
    color: var(--rose);
    background: var(--rose-light);
}

.btn-icon-edit {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
}
.btn-icon-edit:hover {
    color: var(--primary);
    background: #eef2ff;
}

.btn-actions-inline {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

/* Demo Schnellauswahl */
.demo-box {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--border-color);
}
.demo-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.demo-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.btn-demo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.45rem 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: background 0.15s ease;
}
.btn-demo:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.auth-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}
.alert-danger {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
}
.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}

/* ==========================================================
   3. NAVBAR
   ========================================================== */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

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

.brand-title-text {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.02em;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-greeting {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
}

/* ==========================================================
   4. MAIN CONTENT & KPI CARDS
   ========================================================== */
.main-content {
    padding-top: 2rem;
    padding-bottom: 4rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.student-kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-primary {
    border-color: #a7f3d0;
    background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
}

.kpi-warning {
    border-color: #fde68a;
    background: linear-gradient(180deg, #ffffff 0%, #fffbeb 100%);
}

.kpi-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bg-emerald-light { background: var(--emerald-light); color: var(--emerald); }
.bg-blue-light    { background: var(--blue-light); color: var(--blue); }
.bg-amber-light   { background: var(--amber-light); color: var(--amber); }
.bg-rose-light    { background: var(--rose-light); color: var(--rose); }

.kpi-info {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.kpi-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.text-emerald { color: var(--emerald); }
.text-rose    { color: var(--rose); }
.text-amber   { color: var(--amber); }
.text-blue    { color: var(--blue); }
.text-dark    { color: var(--text-dark); }
.font-bold    { font-weight: 700; }
.font-lg      { font-size: 1.25rem; }

/* ==========================================================
   5. TABS & CARDS
   ========================================================== */
.nav-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 2px;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    margin-bottom: -2px;
}
.tab-btn:hover {
    color: var(--primary);
}
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

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

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ==========================================================
   6. TABELLEN (BUCHUNG & AUSGABEN)
   ========================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th {
    background: #f8fafc;
    padding: 0.85rem 1.25rem;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: #f8fafc;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.student-name-action-row {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.student-name-text {
    font-weight: 700;
    color: var(--text-dark);
}

.btn-xs {
    padding: 0.24rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    line-height: 1.25;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn-mark-inline {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn-mark-inline:hover {
    transform: translateY(-1px);
}

.btn-check-toggle {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 2px solid #cbd5e1;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: transparent;
    padding: 0;
}

.btn-check-toggle:hover {
    border-color: var(--emerald);
    background: #f0fdf4;
    color: #6ee7b7;
    transform: scale(1.08);
}

.btn-check-toggle.is-checked {
    background: var(--emerald);
    border-color: var(--emerald);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}

.btn-check-toggle.is-checked:hover {
    background: #059669;
    border-color: #059669;
    transform: scale(1.08);
}

.btn-check-toggle .check-svg {
    stroke-dasharray: 24;
    stroke-dashoffset: 0;
    transition: all 0.2s ease;
}

.btn-check-toggle:not(.is-checked) .check-svg {
    opacity: 0;
}

.btn-check-toggle:not(.is-checked):hover .check-svg {
    opacity: 0.6;
}

@keyframes rowHighlightAnim {
    0% { background-color: #d1fae5; }
    100% { background-color: transparent; }
}

.data-table tr.row-highlight td {
    animation: rowHighlightAnim 1.6s ease-out;
}

.card-school-year {
    border-color: #fde68a;
    background: linear-gradient(180deg, #ffffff 0%, #fffdf5 100%);
}

.text-amber {
    color: var(--amber);
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-full);
}

.badge-paid {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.badge-open {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-refund {
    background: #f5f3ff;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
}

.badge-receipt {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s ease;
}
.badge-receipt:hover {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
    text-decoration: none;
}

.badge-buffer {
    background: #f3e8ff;
    color: #7e22ce;
    border: 1px solid #e9d5ff;
}

.badge-info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.badge-class {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.role-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}
.role-badge-admin { background: #fee2e2; color: #991b1b; }
.role-badge-student { background: #e0e7ff; color: #3730a3; }

/* Filter & Suchleiste */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-input-wrap {
    width: 240px;
}

/* ==========================================================
   7. FORDERUNGEN-GRID (ADMIN)
   ========================================================== */
.demands-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    padding: 1.5rem;
}

.demand-item-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.15s ease;
}
.demand-item-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-md);
}

.demand-card-badge-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

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

.demand-item-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-dark);
}

.demand-item-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.demand-amount-highlight {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-dark);
}
.per-student {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Progressbar */
.progress-section {
    margin-top: 0.5rem;
}
.progress-labels {
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
}
.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: var(--radius-full);
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--emerald) 0%, #10b981 100%);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

/* ==========================================================
   8. SCHÜLER-DASHBOARD CARDS & BANNER
   ========================================================== */
.welcome-banner {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    border-radius: var(--radius-md);
    padding: 2rem;
    color: #ffffff;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}
.welcome-banner h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}
.welcome-banner p {
    color: #e0e7ff;
    font-size: 0.95rem;
    max-width: 600px;
}

.student-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.student-demand-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.15s ease;
}
.student-demand-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.card-overdue {
    border-color: #fecdd3;
    background: linear-gradient(180deg, #ffffff 0%, #fff1f2 100%);
}

.card-demand-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
}

.card-demand-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.card-demand-amount {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-dark);
}

.card-due-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
}

/* ==========================================================
   9. ZAHLUNGS-MODAL & EPC-QR (GIROCODE)
   ========================================================== */
.modal-payment {
    max-width: 520px;
}

.payment-modal-intro {
    background: #f8fafc;
    border-left: 4px solid var(--primary);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-body);
    margin-bottom: 1.25rem;
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.qrcode-wrapper {
    background: #ffffff;
    padding: 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 228px;
    min-height: 228px;
}
.qrcode-wrapper img, .qrcode-wrapper canvas {
    display: block;
    margin: 0 auto;
}

.qr-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.payment-details-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}

.detail-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-right: 0.5rem;
}

.detail-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

.detail-value {
    font-size: 0.85rem;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-body);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.btn-copy:hover {
    background: #e2e8f0;
    color: var(--text-dark);
}
.btn-copy.copied {
    background: var(--emerald-light);
    border-color: #a7f3d0;
    color: var(--emerald);
}

/* ==========================================================
   10. MODAL BASIS
   ========================================================== */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-backdrop.active {
    display: flex;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-dialog {
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalScaleIn 0.2s ease-out;
}

@keyframes modalScaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
}
.btn-close:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
}

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

.checkbox-label, .radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-dark);
    cursor: pointer;
    margin-bottom: 0.35rem;
}

.student-picker-box {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin-top: 0.5rem;
}
.student-checkbox-list {
    max-height: 140px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.student-check-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

/* Einstellungen Seite */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.settings-form {
    padding: 1.5rem;
}

.student-list-box {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.student-item-row {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.m365-status-card {
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}
.m365-status-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
}
.status-online { background: var(--emerald); }
.status-offline { background: var(--amber); }

/* ==========================================================
   11. TOAST NOTIFICATIONS & SPINNER
   ========================================================== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--text-dark);
    color: #ffffff;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 200;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast-success {
    background: #064e3b;
    border-left: 4px solid var(--emerald);
}
.toast-error {
    background: #4c0519;
    border-left: 4px solid var(--rose);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utilities */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-end { display: flex; align-items: center; justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.small { font-size: 0.8rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: 1rem; }
.d-block { display: block; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-warning {
    background: #f59e0b;
    color: #ffffff;
}
.btn-warning:hover {
    background: #d97706;
    color: #ffffff;
}

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

/* ==========================================================
   12. E-MAIL ZAHLUNGSERINNERUNGEN & SMTP UI
   ========================================================== */
.modal-lg {
    max-width: 740px;
}

.demand-card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.25rem;
}
.demand-card-footer .btn {
    flex: 1 1 auto;
}

.reminded-info {
    font-size: 0.74rem;
    color: var(--indigo);
    font-weight: 500;
    margin-top: 2px;
}

.smtp-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
}

.smtp-test-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.smtp-test-inline .form-control-sm {
    width: 230px;
}

.smtp-warning-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
}

.reminder-select-links {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
}
.link-btn:hover {
    text-decoration: underline;
}

.reminder-recipients-list {
    max-height: 210px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #f8fafc;
}

.reminder-recipient-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
    background: #ffffff;
    cursor: pointer;
    transition: background 0.12s ease;
}
.reminder-recipient-item:last-child {
    border-bottom: none;
}
.reminder-recipient-item:hover {
    background: #f8fafc;
}
.reminder-recipient-item input[type="checkbox"] {
    margin-top: 4px;
    flex-shrink: 0;
}
.reminder-recipient-item.is-disabled,
.reminder-recipient-item.is-skipped-24h {
    opacity: 0.55;
    background: #f8fafc;
}

.reminder-recipient-main {
    flex: 1;
    min-width: 0;
}

.reminder-recipient-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.reminder-recipient-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.35;
}

.reminded-pill {
    display: inline-block;
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-full);
    padding: 1px 7px;
    font-size: 0.7rem;
    font-weight: 600;
}
.reminded-pill.is-recent {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.placeholder-chips {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.chip-btn {
    background: var(--primary-subtle);
    color: var(--primary);
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    padding: 2px 7px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s ease;
}
.chip-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.email-preview-box {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    overflow: hidden;
}

.email-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dark);
}

.email-preview-subject {
    padding: 0.5rem 0.85rem;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.82rem;
    background: #ffffff;
    color: var(--text-dark);
}

.email-preview-body {
    padding: 0.75rem 0.85rem;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    line-height: 1.45;
    color: var(--text-body);
    white-space: pre-wrap;
    max-height: 185px;
    overflow-y: auto;
    background: #ffffff;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    .navbar-inner {
        height: 56px;
    }
    .hide-mobile {
        display: none;
    }
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .search-input-wrap {
        width: 100%;
    }
    .filter-bar {
        width: 100%;
        margin-top: 0.75rem;
    }
    .smtp-test-inline,
    .smtp-test-inline .form-control-sm {
        width: 100%;
    }
    .data-table th, .data-table td {
        padding: 0.65rem 0.75rem;
    }
    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
}
