/* ============================================================
   Vereinssoftware – Modern Off-White Design
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Tenant-Farben – werden per PHP inline überschrieben */
    --tenant-primary:    #3b6fd4;
    --tenant-secondary:  #1e2a45;
    --tenant-accent:     #f0a500;

    /* Abgeleitete Farben */
    --primary:           var(--tenant-primary);
    --primary-dark:      color-mix(in srgb, var(--tenant-primary) 80%, black);
    --primary-light:     color-mix(in srgb, var(--tenant-primary) 12%, white);
    --primary-muted:     color-mix(in srgb, var(--tenant-primary) 8%, white);

    --secondary:         var(--tenant-secondary);
    --accent:            var(--tenant-accent);

    /* Neutrale Farben */
    --success:           #16a34a;
    --success-light:     #dcfce7;
    --danger:            #dc2626;
    --danger-light:      #fee2e2;
    --warning:           #d97706;
    --warning-light:     #fef3c7;
    --info:              #0284c7;
    --info-light:        #e0f2fe;

    /* Off-White Palette */
    --bg:                #F5F4F0;
    --bg-warm:           #EFEDE8;
    --surface:           #FDFCFA;
    --surface-2:         #F8F7F3;
    --border:            rgba(0,0,0,0.08);
    --border-strong:     rgba(0,0,0,0.14);

    /* Text */
    --text:              #18181B;
    --text-secondary:    #52525B;
    --text-muted:        #A1A1AA;
    --text-invert:       #FAFAFA;

    /* Sidebar */
    --sidebar-bg:        var(--tenant-secondary);
    --sidebar-text:      rgba(255,255,255,0.72);
    --sidebar-hover:     rgba(255,255,255,0.07);
    --sidebar-active-bg: rgba(255,255,255,0.12);
    --sidebar-width:     256px;

    /* Schatten */
    --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
    --shadow:     0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-md:  0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-lg:  0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
    --shadow-colored: 0 8px 24px -4px color-mix(in srgb, var(--tenant-primary) 30%, transparent);

    /* Radien */
    --r-xs: 4px;
    --r-sm: 6px;
    --r:    10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --r-full: 9999px;

    /* Übergänge */
    --ease:      cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out:  cubic-bezier(0, 0, 0.2, 1);
    --ease-in:   cubic-bezier(0.4, 0, 1, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    --duration-fast:   120ms;
    --duration:        200ms;
    --duration-slow:   350ms;

    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* ============================================================
   App Shell
   ============================================================ */

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

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 200;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar { display: none; }

/* --- Logo-Bereich --- */

.sidebar-header {
    padding: 20px 16px 16px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r);
    background: rgba(255,255,255,0.06);
    text-decoration: none;
}

.sidebar-logo-img {
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    object-fit: contain;
    background: #fff;
    padding: 2px;
    flex-shrink: 0;
}

.sidebar-logo-placeholder {
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.sidebar-brand-text {
    min-width: 0;
}

.sidebar-brand-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-brand-sub {
    font-size: 11px;
    color: var(--sidebar-text);
    opacity: 0.6;
}

/* --- Navigation --- */

.sidebar-section {
    padding: 6px 12px 2px;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    padding: 0 4px;
    margin-bottom: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--r);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background var(--duration) var(--ease),
                color var(--duration) var(--ease),
                transform var(--duration-fast) var(--ease-spring);
    position: relative;
    line-height: 1;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: rgba(255,255,255,0.95);
    transform: translateX(2px);
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: #fff;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    font-size: 15px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--r-full);
    min-width: 18px;
    text-align: center;
}

/* --- Sidebar Footer --- */

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.07);
    margin-top: auto;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r);
    transition: background var(--duration) var(--ease);
}

.sidebar-user:hover { background: rgba(255,255,255,0.06); }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
}

.user-meta {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

.logout-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.4);
    text-decoration: none;
    font-size: 16px;
    transition: all var(--duration) var(--ease);
    flex-shrink: 0;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.9);
}

/* ============================================================
   Main Content
   ============================================================ */

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

.content-inner {
    padding: 32px 36px;
    max-width: 1280px;
}

/* ============================================================
   Auth Layout
   ============================================================ */

.auth-body {
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.auth-bg-shape {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.auth-bg-shape::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(ellipse, color-mix(in srgb, var(--tenant-primary) 10%, transparent) 0%, transparent 70%);
    border-radius: 50%;
}

.auth-bg-shape::after {
    content: '';
    position: absolute;
    bottom: -20%;
    right: -10%;
    width: 50%;
    height: 60%;
    background: radial-gradient(ellipse, color-mix(in srgb, var(--tenant-accent) 8%, transparent) 0%, transparent 70%);
    border-radius: 50%;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.auth-card {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 44px 40px;
    box-shadow: var(--shadow-lg),
                0 0 0 1px rgba(0,0,0,0.04);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo-wrap {
    width: 64px;
    height: 64px;
    border-radius: var(--r-md);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
    position: relative;
    overflow: hidden;
}

.auth-logo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.auth-logo-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.auth-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.4px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

/* ============================================================
   Page Header
   ============================================================ */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 400;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
    background: var(--surface);
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--duration) var(--ease),
                transform var(--duration) var(--ease);
}

.card:hover { box-shadow: var(--shadow); }

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface-2);
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
}

.card-body {
    padding: 20px;
}

/* ============================================================
   Stats Grid
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--r-md);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform var(--duration) var(--ease-spring),
                box-shadow var(--duration) var(--ease);
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: var(--r);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon-wrap.blue   { background: var(--primary-light); }
.stat-icon-wrap.green  { background: var(--success-light); }
.stat-icon-wrap.red    { background: var(--danger-light); }
.stat-icon-wrap.yellow { background: var(--warning-light); }

.stat-value {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
    color: var(--text);
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ============================================================
   Dashboard Grid
   ============================================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 960px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Alerts
   ============================================================ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 16px;
    border-radius: var(--r);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown var(--duration-slow) var(--ease-out) both;
}

.alert::before {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-success { background: var(--success-light); color: #14532d; }
.alert-success::before { content: '✓'; color: var(--success); }

.alert-error   { background: var(--danger-light);  color: #7f1d1d; }
.alert-error::before   { content: '✕'; color: var(--danger); }

.alert-warning { background: var(--warning-light); color: #78350f; }
.alert-warning::before { content: '!'; color: var(--warning); }

.alert-info    { background: var(--info-light);    color: #0c4a6e; }
.alert-info::before    { content: 'i'; color: var(--info); font-style: italic; font-weight: 800; }

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--r-sm);
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
    letter-spacing: -0.1px;
    transition: all var(--duration-fast) var(--ease),
                transform var(--duration-fast) var(--ease-spring),
                box-shadow var(--duration-fast) var(--ease);
    position: relative;
    overflow: hidden;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-colored), 0 1px 2px rgba(0,0,0,0.1);
}
.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 8px 20px -4px color-mix(in srgb, var(--tenant-primary) 40%, transparent);
    transform: translateY(-1px);
}

.btn-success  { background: var(--success); color: #fff; box-shadow: 0 4px 12px rgba(22,163,74,0.25); }
.btn-success:hover { background: #15803d; transform: translateY(-1px); }

.btn-danger   { background: var(--danger); color: #fff; box-shadow: 0 4px 12px rgba(220,38,38,0.25); }
.btn-danger:hover { background: #b91c1c; transform: translateY(-1px); }

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

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

.btn-sm  { padding: 6px 12px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn-lg  { padding: 12px 28px; font-size: 15px; border-radius: var(--r); }
.btn-xl  { padding: 14px 32px; font-size: 16px; border-radius: var(--r-md); }
.btn-block { width: 100%; }

/* ============================================================
   Forms
   ============================================================ */

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

.form-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
    letter-spacing: 0.01em;
}

.form-label .required { color: var(--danger); }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--r-sm);
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease),
                background var(--duration) var(--ease);
    appearance: none;
    outline: none;
}

.form-control:hover {
    border-color: color-mix(in srgb, var(--tenant-primary) 40%, transparent);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tenant-primary) 15%, transparent);
    background: var(--surface);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2371717A' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

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

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

.form-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 14px;
}

/* Color Picker */
.color-picker-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker-group input[type="color"] {
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    border: 1.5px solid var(--border-strong);
    cursor: pointer;
    padding: 2px;
    background: var(--surface);
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: var(--r-sm);
    border: 1.5px solid var(--border);
    flex-shrink: 0;
}

/* ============================================================
   Tables
   ============================================================ */

.table-wrapper {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table thead th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
}

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

.data-table tbody tr {
    transition: background var(--duration-fast) var(--ease);
}

.data-table tbody tr:hover td {
    background: var(--primary-muted);
}

/* ============================================================
   Badges
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--r-full);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.badge-success   { background: var(--success-light); color: #166534; }
.badge-danger    { background: var(--danger-light);  color: #991b1b; }
.badge-warning   { background: var(--warning-light); color: #92400e; }
.badge-secondary { background: #f4f4f5; color: var(--text-secondary); }
.badge-primary   { background: var(--primary-light); color: var(--primary-dark); }
.badge-info      { background: var(--info-light);    color: #075985; }

/* ============================================================
   Transaction List
   ============================================================ */

.tx-list { list-style: none; }

.tx-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    transition: all var(--duration-fast) var(--ease);
}

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

.tx-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.tx-icon.income  { background: var(--success-light); color: var(--success); }
.tx-icon.expense { background: var(--danger-light);  color: var(--danger); }

.tx-body { flex: 1; min-width: 0; }

.tx-desc {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.tx-amount {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: -0.3px;
}

.tx-amount.income  { color: var(--success); }
.tx-amount.expense { color: var(--danger); }

/* ============================================================
   Email / Mail
   ============================================================ */

.email-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: all var(--duration-fast) var(--ease);
    cursor: pointer;
}

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

.email-item:hover {
    padding-left: 6px;
    padding-right: 6px;
    margin: 0 -6px;
    background: var(--primary-muted);
    border-radius: var(--r-sm);
}

.email-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    margin-top: 5px;
}

.email-dot.read {
    background: transparent;
    border: 1.5px solid var(--border-strong);
}

.email-content { flex: 1; min-width: 0; }

.email-from {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.email-subject {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.email-date {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.mail-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 16px;
    align-items: start;
}

.mail-list-item {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease);
}

.mail-list-item:hover { background: var(--primary-muted); }
.mail-list-item.active { background: var(--primary-light); }
.mail-list-item.unread .mail-list-from { font-weight: 700; color: var(--text); }

.mail-list-from {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mail-list-subject {
    font-size: 12.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.mail-list-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}

.mail-view-subject {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: 10px;
    color: var(--text);
}

.mail-view-meta {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.mail-body {
    font-size: 14px;
    line-height: 1.75;
    color: var(--text);
    word-break: break-word;
}

/* ============================================================
   Pagination
   ============================================================ */

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    padding-top: 16px;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: var(--r-sm);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    transition: all var(--duration-fast) var(--ease);
}

.page-btn:hover { background: var(--bg-warm); color: var(--text); }
.page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: var(--shadow-colored);
}

/* ============================================================
   Search
   ============================================================ */

.search-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input { max-width: 280px; }

.search-wrapper {
    position: relative;
}

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

.search-wrapper input { padding-left: 36px; }

/* ============================================================
   Empty States
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--r-md);
    background: var(--bg-warm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 16px;
}

.empty-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.empty-text {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ============================================================
   Action Buttons
   ============================================================ */

.action-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ============================================================
   Branding – Color Preview
   ============================================================ */

.branding-preview {
    border-radius: var(--r-md);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.branding-preview-bar {
    height: 8px;
    display: flex;
}

.branding-preview-sidebar {
    width: 80px;
    height: 120px;
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 4px;
}

.branding-preview-dot {
    height: 6px;
    border-radius: 3px;
    opacity: 0.6;
    background: rgba(255,255,255,0.5);
}

.branding-preview-dot.active {
    background: rgba(255,255,255,0.9);
    width: 60%;
    opacity: 1;
}

/* ============================================================
   Utilities
   ============================================================ */

.text-muted    { color: var(--text-muted) !important; }
.text-success  { color: var(--success) !important; }
.text-danger   { color: var(--danger)  !important; }
.text-primary  { color: var(--primary) !important; }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.fw-bold       { font-weight: 700; }
.fw-semibold   { font-weight: 600; }

.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 14px; }
.mb-3 { margin-bottom: 24px; }

.d-flex          { display: flex; }
.gap-1           { gap: 6px; }
.gap-2           { gap: 10px; }
.gap-3           { gap: 16px; }
.align-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1          { flex: 1; }

.balance-positive { color: var(--success); font-weight: 800; }
.balance-negative { color: var(--danger);  font-weight: 800; }

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* ============================================================
   Animations
   ============================================================ */

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

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

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Seiteninhalt Einblendung */
.page-animate {
    animation: slideUp var(--duration-slow) var(--ease-out) both;
}

.card.animate-in {
    animation: scaleIn var(--duration-slow) var(--ease-out) both;
}

/* Staggered card delay */
.card.animate-in:nth-child(1) { animation-delay: 0ms; }
.card.animate-in:nth-child(2) { animation-delay: 60ms; }
.card.animate-in:nth-child(3) { animation-delay: 120ms; }
.card.animate-in:nth-child(4) { animation-delay: 180ms; }

.stat-card.animate-in {
    animation: slideUp var(--duration-slow) var(--ease-spring) both;
}

.stat-card.animate-in:nth-child(1) { animation-delay: 0ms; }
.stat-card.animate-in:nth-child(2) { animation-delay: 60ms; }
.stat-card.animate-in:nth-child(3) { animation-delay: 120ms; }
.stat-card.animate-in:nth-child(4) { animation-delay: 180ms; }

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg,
        var(--bg-warm) 25%,
        var(--surface-2) 50%,
        var(--bg-warm) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--r-sm);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); transition: transform var(--duration-slow) var(--ease); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main-content { margin-left: 0; }
    .sidebar-overlay {
        position: fixed; inset: 0; background: rgba(0,0,0,0.4);
        z-index: 199; display: none;
        animation: fadeIn var(--duration) var(--ease);
    }
    .sidebar-overlay.show { display: block; }
    .mobile-header {
        display: flex !important;
        align-items: center;
        gap: 12px;
        padding: 14px 20px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 0;
        z-index: 100;
        box-shadow: var(--shadow-xs);
    }
}

.mobile-header { display: none; }

@media (max-width: 768px) {
    .content-inner { padding: 16px 18px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .mail-layout { grid-template-columns: 1fr; }
    .page-title { font-size: 20px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 28px 22px; border-radius: var(--r-lg); }
    .page-header { flex-direction: column; }
    .page-header .btn { width: 100%; }
}
