:root {
    --bg: #f3f4f6;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --text: #111827;
    --text-muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --border: #e5e7eb;
    --shadow-soft: 0 10px 25px rgba(15,23,42,0.08);
}
[data-theme="dark"] {
    --bg: #020617;
    --bg-card: #020617;
    --bg-header: #020617;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --primary: #3b82f6;
    --primary-dark: #60a5fa;
    --border: #1f2937;
    --shadow-soft: 0 16px 35px rgba(0,0,0,0.65);
}
*,
*::before,
*::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-header);
    box-shadow: var(--shadow-soft);
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-logo {
    height: 30px;
    width: 30px;
    border-radius: 10px;
}
.brand-text {
    font-size: 15px;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-weight: 600;
}
.brand-text span {
    opacity: .7;
    font-weight: 400;
    margin-left: 4px;
}
.app-nav {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
}
.app-nav a {
    text-decoration: none;
    color: var(--text);
    opacity: .8;
}
.app-nav a:hover { opacity: 1; }
.theme-toggle {
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: 4px 10px;
    font-size: 12px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}
.menu-toggle {
    display: none;
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    color: var(--text);
}
.app-nav-links { display:flex; }
.app-nav-links.open { display:flex; }

@media (max-width: 768px) {
    .app-header { flex-wrap: wrap; gap: 8px; }
    .app-nav-links { display:none; width:100%; }
    .app-nav-links.open { display:flex; }
    .app-nav { flex-wrap:wrap; justify-content:flex-start; gap:8px; width:100%; }
    .menu-toggle { display:block; }
}

.app-container {
    max-width: 1200px;
    margin: 20px auto 32px;
    padding: 0 16px;
}
.card, .form-card {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 18px 18px 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
}
.card h1 { font-size: 24px; margin-top:0;}
.card h2 { font-size: 20px; margin-top:0;}
.card h3 { font-size: 17px; margin-top:0;}

.full-page-center {
    min-height: 100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:16px;
}
.login-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px 24px 22px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    width: 100%;
    max-width: 380px;
}
.login-card h1 { margin:0 0 4px; font-size:22px; }
.login-sub { font-size:13px; color:var(--text-muted); }

label {
    display:block;
    margin-top:10px;
    margin-bottom:4px;
    font-size:13px;
    color:var(--text-muted);
}
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
    width:100%;
    padding:8px 10px;
    border-radius:8px;
    border:1px solid var(--border);
    font-size:14px;
    background:transparent;
    color:var(--text);
}
input:focus,select:focus {
    outline:none;
    border-color:var(--primary);
    box-shadow:0 0 0 1px rgba(37,99,235,0.4);
    background:rgba(15,23,42,0.02);
}
button,.button {
    display:inline-block;
    padding:8px 16px;
    border-radius:999px;
    border:none;
    background:var(--primary);
    color:#f9fafb;
    font-size:14px;
    font-weight:500;
    cursor:pointer;
    transition:transform .06s, box-shadow .12s, background .12s;
}
button:hover,.button:hover {
    background:var(--primary-dark);
    box-shadow:0 10px 24px rgba(37,99,235,0.45);
    transform:translateY(-1px);
}
button:active,.button:active {
    transform:translateY(0);
    box-shadow:none;
}
button[disabled],.button[disabled] { opacity:.6; cursor:not-allowed; }

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

.button-outline {
    background:transparent;
    color:var(--primary);
    border:1px solid var(--primary);
    box-shadow:none;
}

.button-outline:hover {
    background:rgba(37,99,235,0.05);
    box-shadow:none;
}

.button-success {
    background:#16a34a;
}

.button-success:hover {
    background:#15803d;
}

.button-danger {
    background:#dc2626;
}

.button-danger:hover {
    background:#b91c1c;
}


.table-responsive { overflow-x:auto; }
table {
    width:100%;
    border-collapse:collapse;
    margin-top:12px;
    font-size:14px;
    background: var(--bg-card);
}
th,td {
    padding:10px 14px;
    border-bottom:1px solid var(--border);
    text-align:left;
}
th {
    font-size:13px;
    text-transform:none;
    letter-spacing:0;
    color:var(--text);
    background:#f3f4f6;
}
tr:nth-child(even) td { background:#f9fafb; }

.split-layout { display:flex; flex-wrap:wrap; gap:20px; }
.split-layout .column { flex:1 1 320px; }

.dashboard-grid {
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(170px,1fr));
    gap:16px;
}
.dashboard-tile {
    display:flex;
    flex-direction:column;
    justify-content:center;
    padding:14px;
    border-radius:14px;
    background:radial-gradient(circle at 0 0, rgba(59,130,246,0.12), transparent 55%), var(--bg-card);
    border:1px solid var(--border);
    box-shadow:var(--shadow-soft);
    text-decoration:none;
    color:var(--text);
    transition:transform .08s, box-shadow .12s, border-color .12s;
}
.dashboard-tile strong { font-size:15px; }
.dashboard-tile span { font-size:12px; color:var(--text-muted); margin-top:4px; }
.dashboard-tile:hover { transform:translateY(-2px); border-color:var(--primary); }

.badge {
    display:inline-flex;
    align-items:center;
    padding:2px 8px;
    border-radius:999px;
    font-size:11px;
}
.badge-open { background:#ecfdf3; color:#166534; }
[data-theme="dark"] .badge-open { background:rgba(22,101,52,0.35); color:#bbf7d0; }
.badge-closed { background:#eff6ff; color:#1d4ed8; }
[data-theme="dark"] .badge-closed { background:rgba(37,99,235,0.35); color:#bfdbfe; }

.msg { font-size:13px; color:#16a34a; }
.error { font-size:13px; color:#dc2626; }

.modal-backdrop {
    position:fixed;
    inset:0;
    background:rgba(15,23,42,0.6);
    display:none;
    align-items:center;
    justify-content:center;
    z-index:60;
}
.modal-backdrop.open { display:flex; }
.modal {
    background:var(--bg-card);
    border-radius:14px;
    padding:16px 18px 14px;
    max-width:420px;
    width:100%;
    box-shadow:var(--shadow-soft);
    border:1px solid var(--border);
}
.modal-header {
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:8px;
}
.modal-header h3 { margin:0; font-size:16px; }
.modal-close {
    background:transparent;
    border:none;
    font-size:20px;
    line-height:1;
    cursor:pointer;
    color:var(--text-muted);
}

.mt-1 { margin-top:4px;}
.mt-2 { margin-top:8px;}
.mt-3 { margin-top:12px;}
.mt-4 { margin-top:16px;}
.mt-5 { margin-top:20px;}

@media (max-width:768px){
    .app-container { padding:0 12px 24px; margin-top:16px; }
    .card { padding:16px 14px 12px; }
    table { font-size:12px; }
    th,td { padding:6px 6px; }
}

/* ===========================
   Login-Layout (mobile-first)
   =========================== */

.login-body {
    background: radial-gradient(circle at top left, rgba(71,163,240,0.18), transparent 60%) fixed,
                var(--bg);
    min-height: 100vh;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px 16px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.login-logo {
    width: 40px;
    height: 40px;
    border-radius: 14px;
}

.login-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.login-brand-main {
    font-size: 18px;
    letter-spacing: .18em;
    text-transform: uppercase;
    font-weight: 600;
}

.login-brand-sub {
    font-size: 13px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: 22px;
    padding: 18px 18px 18px;
    border: 1px solid rgba(148,163,184,0.18);
    box-shadow: var(--shadow-soft);
}

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

.login-subline {
    margin-top: 6px;
    font-size: 14px;
    color: var(--text-muted);
}

.login-footer {
    margin-top: 18px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Mobile: Login etwas höher positionieren */
@media (max-width: 640px) {
    .login-wrapper {
        justify-content: flex-start;
        padding-top: 64px;
    }

    .login-card {
        padding: 16px 14px 16px;
        border-radius: 20px;
    }

    .login-brand-main {
        font-size: 16px;
    }
}

/* Inventuren-Ansichten: Spalten untereinander (volle Breite) */
.split-layout {
    display: block;
}

.split-layout .column {
    width: 100%;
    margin-bottom: 24px;
}

/* ===========================
   Landing Pages (Start hinter Login)
   =========================== */
.landing-container {
    max-width: 1200px;
    margin: 32px auto 40px;
    padding: 0 16px;
}

.landing-header {
    margin-bottom: 24px;
}

.landing-header h1 {
    font-size: 26px;
    margin: 0;
}

.landing-header p {
    margin-top: 6px;
    font-size: 14px;
    color: var(--text-muted);
}

.landing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.landing-card {
    background: var(--bg-card);
    border-radius: 22px;
    padding: 22px 22px 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 150px;
}

.landing-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.landing-card-icon {
    font-size: 22px;
}

.landing-card-title {
    font-size: 18px;
    font-weight: 600;
}

.landing-card-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.landing-card-actions {
    margin-top: auto;
}

/* Mobile-Optimierung */
@media (max-width: 640px) {
    .landing-container {
        margin-top: 20px;
    }

    .landing-card {
        border-radius: 20px;
        padding: 18px 16px 14px;
    }

    .landing-card-title {
        font-size: 16px;
    }
}

/* Tabellen als Karten auf Mobile */
@media (max-width: 720px) {
    table.table-mobile thead {
        display: none;
    }

    table.table-mobile,
    table.table-mobile tbody,
    table.table-mobile tr,
    table.table-mobile td {
        display: block;
        width: 100%;
    }

    table.table-mobile tr {
        margin-bottom: 12px;
        border-radius: 16px;
        border: 1px solid var(--border);
        padding: 8px 10px;
        background: var(--bg-card);
    }

    table.table-mobile td {
        font-size: 13px;
        padding: 4px 0;
    }

    table.table-mobile td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .08em;
        color: var(--text-muted);
        margin-bottom: 1px;
    }
}


/* Mobile card layout for Positions-Tabellen */
@media (max-width: 768px) {
    table.table-positions {
        width: 100%;
        border-collapse: collapse;
    }
    table.table-positions thead {
        display: none;
    }
    table.table-positions tr {
        display: block;
        margin-bottom: 10px;
        border-radius: 12px;
        background: var(--bg-card);
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
        padding: 8px 10px;
    }
    table.table-positions td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 4px 0;
        font-size: 13px;
        border: none;
    }
    table.table-positions td::before {
        content: attr(data-label);
        font-weight: 500;
        margin-right: 8px;
        color: var(--text-muted);
        text-align: left;
    }
    table.table-positions td:last-child {
        flex-wrap: wrap;
        gap: 6px;
    }
    table.table-positions td:last-child .button,
    table.table-positions td:last-child button {
        width: auto;
        flex: 0 0 auto;
        font-size: 12px;
        padding: 4px 10px;
    }
}


/* Kompaktere Darstellung für kleine Bildschirme */
@media (max-width: 768px) {
    .app-container {
        padding: 10px 8px 18px;
    }
    .card {
        padding: 14px 14px;
        margin-bottom: 14px;
    }
    .card h1 {
        font-size: 18px;
        margin-bottom: 6px;
    }
    .card h3 {
        font-size: 15px;
        margin-top: 10px;
        margin-bottom: 6px;
    }
    .card p {
        font-size: 13px;
    }
    form input[type="text"],
    form input[type="email"],
    form input[type="number"],
    form input[type="date"],
    form select {
        font-size: 14px;
        height: 36px;
        padding: 4px 8px;
    }
    form .mt-3 {
        margin-top: 10px;
    }
    button,
    .button {
        font-size: 13px;
        padding: 6px 10px;
        height: 36px;
    }
}


/* =======================
   Formular-Layout (Vereinsmanager-Style)
   ======================= */

.form-card {
    max-width: 520px;
}

.form-card h1,
.form-card h2 {
    font-size: 20px;
    margin: 0 0 6px;
}

.form-card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    margin-bottom: 10px;
}

.form-body {
    margin-top: 10px;
}

.form-field {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 14px;
    background: transparent;
    color: var(--text);
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.4);
    background: rgba(15, 23, 42, 0.02);
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.form-col-6 {
    flex: 1 1 200px;
    min-width: 0;
}

.form-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.form-actions .button,
.form-actions button {
    min-width: 140px;
}

.form-message {
    font-size: 13px;
    margin-bottom: 8px;
}

.form-message.error {
    color: #b91c1c;
}

.form-message.success {
    color: #15803d;
}
