:root {
    --red: #d1001f;
    --red-dark: #a80019;
    --red-soft: #fce9ed;
    --grey-50: #e7eaee;
    --grey-100: #dfe3e8;
    --grey-200: #dde3ea;
    --grey-300: #cfd6df;
    --grey-500: #667085;
    --grey-700: #344054;
    --grey-900: #1d2939;
    --white: #f4f5f7;
    --success: #067647;
    --danger: #b42318;
    --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
    --radius: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: 'Inter', Arial, sans-serif;
    background: #d8dde3;
    color: var(--grey-900);
}

a { color: inherit; text-decoration: none; }
p { color: var(--grey-500); line-height: 1.6; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.12; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.6rem); }
h2 { font-size: clamp(1.35rem, 2.5vw, 1.9rem); }
h3 { font-size: 1.08rem; }
label { display: block; margin-bottom: 7px; font-weight: 700; color: var(--grey-700); }

.topline { height: 6px; background: var(--red); }
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--grey-200);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-inner,
.wrap {
    width: min(1160px, calc(100vw - 32px));
    margin: 0 auto;
}
.topbar-inner {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.brand-mark {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    background: var(--red);
    color: var(--white);
    font-weight: 800;
    font-size: 1.1rem;
    border-radius: 4px;
}
.brand-text strong { display: block; font-size: 1.06rem; color: var(--grey-900); }
.brand-text small { display: block; color: var(--grey-500); margin-top: 2px; font-size: .9rem; }

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}
.nav-links a,
.user-badge {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--grey-700);
    font-weight: 600;
}
.nav-links a:hover {
    border-color: var(--grey-200);
    background: #d8dde3;
    color: var(--red);
}
.nav-links .nav-cta {
    background: var(--red);
    color: var(--white);
    border-color: var(--red);
}
.nav-links .nav-cta:hover { background: var(--red-dark); color: var(--white); border-color: var(--red-dark); }
.user-badge {
    background: var(--red-soft);
    border-color: #f6c9d2;
    color: var(--red-dark);
}

main.wrap { padding: 24px 0 0; }
.section-label {
    display: inline-block;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--red);
    margin-bottom: 12px;
}

.card,
.content-panel,
.service-card,
.info-box,
.auth-card,
.profile-balance,
.admin-balance {
    background: var(--white);
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.landing-grid {
    display: grid;
    grid-template-columns: 1.5fr .85fr;
    gap: 22px;
    margin-bottom: 24px;
}
.landing-main {
    background: linear-gradient(90deg, var(--red) 0 10px, var(--white) 10px 100%);
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    padding: 30px 32px;
    box-shadow: var(--shadow);
}
.landing-main p { max-width: 48rem; }
.landing-side {
    display: grid;
    gap: 16px;
}
.info-box {
    padding: 22px;
}
.info-box-accent {
    background: linear-gradient(180deg, #fff5f7 0%, #ffffff 100%);
    border-left: 5px solid var(--red);
}
.metric-label {
    color: var(--grey-500);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: .8rem;
    font-weight: 800;
}
.metric-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--grey-900);
    margin-top: 10px;
}
.metric-sub { margin-top: 8px; }
.metric-inline {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    border-top: 1px solid var(--grey-100);
}
.metric-inline:first-of-type { margin-top: 10px; }
.metric-inline strong { color: var(--grey-900); }

.hero-actions,
.form-actions,
.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.btn,
button {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 4px;
    border: 1px solid var(--red);
    background: var(--red);
    color: var(--white);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.btn:hover,
button:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn.secondary,
button.secondary {
    background: #6b7280;
    border-color: #6b7280;
    color: var(--white);
}
.btn.secondary:hover,
button.secondary:hover { background: #4b5563; border-color: #4b5563; }
.btn.ghost {
    background: var(--white);
    color: var(--red);
    border-color: var(--red);
}
.btn.ghost:hover { background: var(--red-soft); color: var(--red-dark); border-color: var(--red-dark); }

.service-grid,
.content-grid,
.grid,
.grid-2,
.grid-3,
.grid-4,
.info-grid,
.dashboard-grid,
.form-grid,
.stats-bar {
    display: grid;
    gap: 20px;
}
.service-grid,
.info-grid,
.dashboard-grid,
.form-grid,
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.content-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 24px 0; }

.service-card {
    padding: 24px;
    border-top: 4px solid var(--red);
}
.content-panel {
    padding: 24px;
}
.content-panel-light { background: #fafbfc; }
.plain-list {
    margin: 0;
    padding-left: 18px;
    color: var(--grey-700);
}
.plain-list li { margin-bottom: 10px; }
.process-list {
    display: grid;
    gap: 14px;
    margin-top: 8px;
}
.process-list div {
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 12px;
    align-items: start;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--grey-100);
}
.process-list strong {
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    background: var(--red);
    color: var(--white);
    border-radius: 4px;
}
.process-list span { color: var(--grey-700); }

.card { padding: 24px; }
.kicker {
    color: var(--red);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 800;
    margin-bottom: 8px;
}
.muted { color: var(--grey-500); }
.metric-highlight {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    align-items: baseline;
    flex-wrap: wrap;
}
.metric-highlight strong { color: var(--red-dark); font-size: 1.8rem; }
.hero-list,
.list-clean {
    margin: 14px 0 0;
    padding-left: 18px;
    color: var(--grey-700);
}
.hero-list li,
.list-clean li { margin-bottom: 8px; }
.stat-box {
    padding: 18px;
    border: 1px solid var(--grey-200);
    background: var(--white);
    border-radius: var(--radius);
}
.stat-box strong { display: block; margin-top: 6px; }

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--grey-300);
    border-radius: 4px;
    font: inherit;
    color: var(--grey-900);
    background: var(--white);
}
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(209,0,31,.10);
}
.actions input,
.actions select,
.actions button { width: auto; flex: 1 1 0; min-width: 85px; }
.form-note { margin-top: 10px; font-size: .94rem; }

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 4px;
    border: 1px solid transparent;
    font-weight: 600;
}
.flash.ok { color: var(--success); background: #ecfdf3; border-color: #abefc6; }
.flash.err { color: var(--danger); background: #fef3f2; border-color: #fecdca; }

.auth-shell {
    min-height: calc(100vh - 180px);
    display: grid;
    place-items: center;
    padding: 18px 0 24px;
}
.auth-card {
    width: min(560px, 100%);
    padding: 28px;
    border-top: 4px solid var(--red);
}
.centered { text-align: center; }

.profile-hero,
.admin-hero {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin: 8px 0 20px;
}
.profile-balance,
.admin-balance {
    min-width: 270px;
    padding: 18px 20px;
    border-left: 5px solid var(--red);
}
.profile-balance strong,
.admin-balance strong {
    font-size: 2rem;
    color: var(--grey-900);
}
.balance-positive { color: var(--success); font-weight: 700; }
.balance-negative { color: var(--danger); font-weight: 700; }

.table-card { padding: 0; overflow: hidden; }
.table-head { padding: 24px 24px 10px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
thead th {
    background: #f9fafb;
    color: var(--grey-500);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}
th, td {
    padding: 14px 16px;
    text-align: left;
    border-top: 1px solid var(--grey-100);
    vertical-align: top;
}
tbody tr:hover { background: #fafbfc; }
.pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: .84rem;
    font-weight: 600;
    background: var(--red-soft);
    color: var(--red-dark);
    border: 1px solid #f7c8d1;
}
.inline-stack { display: flex; flex-direction: column; gap: 5px; }
.empty-state { padding: 24px; text-align: center; color: var(--grey-500); }

.footer {
    margin-top: 32px;
    background: #cfd6df;
    border-top: 1px solid var(--grey-200);
}
.footer-inner {
    min-height: 92px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.footer-brand { font-weight: 800; color: var(--red); }
.footer-text { margin: 6px 0 0; max-width: 42rem; }
.footer-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.footer-links a { color: var(--grey-700); }
.footer-links a:hover { color: var(--red); }

@media (max-width: 980px) {
    .landing-grid,
    .service-grid,
    .content-grid,
    .grid-2,
    .grid-3,
    .grid-4,
    .info-grid,
    .dashboard-grid,
    .form-grid,
    .stats-bar {
        grid-template-columns: 1fr;
    }
    .topbar-inner,
    .profile-hero,
    .admin-hero,
    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }
    .profile-balance,
    .admin-balance { min-width: 0; width: 100%; }
}

@media (max-width: 640px) {
    .topbar-inner,
    .wrap { width: min(100vw - 20px, 1160px); }
    .hero-actions,
    .form-actions,
    .actions { flex-direction: column; }
    .btn,
    button,
    .actions input,
    .actions select,
    .actions button { width: 100%; }
    .landing-main,
    .card,
    .content-panel,
    .service-card,
    .info-box,
    .auth-card { padding: 20px; }
    .nav-links { width: 100%; justify-content: flex-start; }
}


/* Grauer Sparkassen-/Banking-Hintergrund */
body {
    background: #d8dde3;
}

.topbar,
.card,
.content-panel,
.service-card,
.info-box,
.auth-card,
.profile-balance,
.admin-balance,
.footer {
    background: #f1f3f5;
}

.content-panel-light,
.card.soft {
    background: #e9edf2;
}

.landing-main {
    background: linear-gradient(90deg, var(--red) 0 10px, #f1f3f5 10px 100%);
}

input,
select,
textarea,
.stat-box {
    background: #ffffff;
}

thead th {
    background: #e7eaee;
}

tbody tr:hover {
    background: #e9edf2;
}

.info-box-accent {
    background: linear-gradient(180deg, #f1dce1 0%, #f1f3f5 100%);
}

.iban-value { font-size: clamp(1.05rem, 2.4vw, 1.6rem); word-break: break-word; letter-spacing: .02em; }

.loan-admin-row {
    display: grid;
    grid-template-columns: minmax(170px, 1.4fr) repeat(5, minmax(110px, 1fr)) minmax(80px, .7fr) minmax(90px, .7fr) minmax(100px, .8fr);
    gap: 8px;
    align-items: center;
}

.danger-pill {
    background: #fef3f2 !important;
    color: #b42318 !important;
    border-color: #fecdca !important;
}

@media (max-width: 980px) {
    .loan-admin-row {
        grid-template-columns: 1fr;
    }
}

input[readonly] { background: #eef1f5; color: #667085; cursor: not-allowed; }


.account-status-notice {
    border: 1px solid var(--grey-300);
    border-left: 6px solid var(--red);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin: 0 0 20px;
    background: #f1f3f5;
    box-shadow: var(--shadow);
}
.account-status-notice strong {
    display: block;
    margin-bottom: 6px;
}
.account-status-notice p {
    margin: 0;
}
.account-status-notice.warn {
    border-left-color: #f59e0b;
    background: #fff7ed;
}
.account-status-notice.err {
    border-left-color: var(--danger);
    background: #fef3f2;
}
.warning-pill {
    background: #fff7ed !important;
    color: #b45309 !important;
    border-color: #fed7aa !important;
}
.danger-pill {
    background: #fef3f2 !important;
    color: var(--danger) !important;
    border-color: #fecdca !important;
}
button:disabled {
    opacity: .55;
    cursor: not-allowed;
}


.nav-loan,
.nav-loan-admin {
    background: var(--red-soft);
    border-color: #f7c8d1 !important;
    color: var(--red-dark) !important;
    font-weight: 800 !important;
}


.transfer-form {
    display: grid;
    gap: 10px;
    max-width: 720px;
}
textarea {
    width: 100%;
    border: 1px solid var(--grey-300);
    border-radius: 4px;
    padding: 10px 12px;
    font: inherit;
}
.nav-links a[href*="messages.php"] {
    font-weight: 800;
}

/* Bessere Dropdown-Navigation */
.nav-dropdown {
    position: relative;
    display: inline-flex;
}
.nav-dropdown::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 14px;
    z-index: 49;
}
.nav-dropbtn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 14px 0 16px;
    border: 1px solid var(--grey-200);
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #eef2f6 100%);
    color: var(--grey-700);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    width: auto;
    box-shadow: 0 4px 14px rgba(16, 24, 40, 0.06);
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.nav-dropbtn:hover,
.nav-dropdown:focus-within .nav-dropbtn,
.nav-dropdown:hover .nav-dropbtn {
    border-color: #f1b7c2;
    background: linear-gradient(180deg, #fff7f9 0%, #fdecef 100%);
    color: var(--red-dark);
    box-shadow: 0 10px 24px rgba(209, 0, 31, 0.12);
    transform: translateY(-1px);
}
.nav-dropbtn.nav-staff {
    background: linear-gradient(180deg, #fff5f7 0%, #f9dce4 100%);
    border-color: #efb2c0;
    color: var(--red-dark);
}
.nav-dropbtn.nav-staff:hover,
.nav-dropdown:focus-within .nav-dropbtn.nav-staff,
.nav-dropdown:hover .nav-dropbtn.nav-staff {
    background: linear-gradient(180deg, #fff1f4 0%, #f7cfd8 100%);
    border-color: #e68ea2;
}
.nav-drop-label {
    white-space: nowrap;
}
.nav-drop-chevron {
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-1px);
    transition: transform .18s ease;
    flex: 0 0 auto;
    margin-top: -3px;
}
.nav-dropdown:hover .nav-drop-chevron,
.nav-dropdown:focus-within .nav-drop-chevron {
    transform: rotate(225deg) translateY(-1px);
}
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 240px;
    display: grid;
    gap: 6px;
    padding: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f5f7fa 100%);
    border: 1px solid var(--grey-200);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(16, 24, 40, 0.16);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -7px;
    right: 24px;
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-top: 1px solid var(--grey-200);
    border-left: 1px solid var(--grey-200);
    transform: rotate(45deg);
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}
.nav-dropdown-menu a {
    width: 100%;
    justify-content: flex-start;
    min-height: 42px;
    padding: 0 12px;
    white-space: nowrap;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    transition: background .16s ease, border-color .16s ease, color .16s ease, padding-left .16s ease;
}
.nav-dropdown-menu a:hover,
.nav-dropdown-menu a:focus-visible {
    background: #fff1f4;
    border-color: #f4cad3;
    color: var(--red-dark);
    padding-left: 16px;
    outline: none;
}

@media (max-width: 820px) {
    .nav-dropdown,
    .nav-dropbtn,
    .nav-dropdown-menu {
        width: 100%;
    }
    .nav-dropdown {
        display: grid;
    }
    .nav-dropdown::after {
        display: none;
    }
    .nav-dropbtn {
        justify-content: space-between;
        border-radius: 12px;
    }
    .nav-dropdown-menu {
        position: static;
        margin-top: 6px;
        min-width: 0;
        padding: 8px;
        box-shadow: none;
        background: #eef2f6;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
    }
    .nav-dropdown-menu::before {
        display: none;
    }
}
