/* =====================================================
   Donat Nebenkostenmanager – Frontend App
   ===================================================== */

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

/* Variablen auf #nkm-app gesetzt – überschreibt Theme/Elementor --primary etc. */
#nkm-app {
    /* ── Donat Farbwelt ─────────────────────────────────── */

    /* Hintergründe: warmes Creme */
    --bg:      #F2F0EA;
    --bg2:     #F7F5EF;
    --surface: #FFFFFF;
    --border:  #E6D9B8;
    --border2: #D4C89A;

    /* Text */
    --text:    #1F2328;
    --muted:   #5B616A;
    --light:   #9A9E9B;

    /* Primary: Donat Anthrazit – Kontrast 14:1 auf Weiß ✓ WCAG AAA */
    --primary:   #1F2328;
    --pri-lt:    #F7F5EF;
    --pri-mid:   #E0DDD5;
    --pri-hover: #0D1013;

    /* Akzent: Donat Pink – nur für Highlights, aktive States */
    --accent:    #FF4FA3;
    --acc-lt:    #FFF0F7;
    --acc-mid:   #FCC8DA;

    /* Status: Donat Green – Kontrast 6.1:1 ✓ WCAG AA */
    --green:     #1E6F5C;
    --grn-lt:    #E7F7F0;

    /* Status: Rot */
    --red:       #C0392B;
    --red-lt:    #FDF0EE;

    /* Status: Gelb/Amber (Jahreskorrektur-Badge etc.) */
    --yellow:    #7A5C00;
    --yel-lt:    #FFF6D8;

    /* Zusätzliche Donat-Töne */
    --tape:      #F2E6C6;
    --rosa:      #FCC8DA;
    --orange:    #C44B00;
    --purple:    #6B2FA0;
    --teal:      #1E6F5C;
    --blue:      #1F2328;

    /* Radius & Schatten – warm statt kühl */
    --r-sm:    6px;
    --r-md:    10px;
    --r-lg:    14px;
    --shadow:  0 1px 3px rgba(31,35,40,.08), 0 1px 2px rgba(31,35,40,.05);
    --shadow2: 0 4px 20px rgba(31,35,40,.12);
    --font:    -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
}

#nkm-app {
    /* Variablen oben gesetzt */
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    color: #1F2328;
    background: #F2F0EA;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---- Shell ---- */
.nkm-shell { display: flex; min-height: 100vh; }

.nkm-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #1F2328;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.nkm-sidebar-logo {
    padding: 20px 16px 16px;
    display: flex;
    align-items: center;
}
.nkm-logo-quer {
    width: 100%;
    max-width: 164px;
    height: auto;
    display: block;
    object-fit: contain;
    background: transparent;
}
.nkm-logo-rund {
    width: 34px;
    height: 34px;
    object-fit: contain;
    background: transparent;
    flex-shrink: 0;
}
/* Login-Logo größer */
.nkm-login-logo {
    text-align: center;
    margin-bottom: 12px;
}
.nkm-login-logo img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    background: transparent;
}
.nkm-nav { padding: 8px 12px; flex: 1; }
.nkm-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: rgba(255,255,255,.5);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    border-radius: 8px;
    margin-bottom: 2px;
    user-select: none;
}
.nkm-nav-item:hover {
    color: rgba(255,255,255,.9);
    background: rgba(255,255,255,.07);
}
.nkm-nav-item.active {
    color: #fff;
    background: rgba(255,255,255,.12);
    font-weight: 600;
}
.nkm-nav-item.active .nkm-nav-icon svg { fill: #FF4FA3; }
.nkm-nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nkm-nav-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}
.nkm-sidebar-footer {
    padding: 16px 20px;
    font-size: 10px;
    color: rgba(255,255,255,.2);
    letter-spacing: .03em;
}

.nkm-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ---- Topbar ---- */
.nkm-topbar {
    background: #F2F0EA;
    border-bottom: none;
    padding: 0 32px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}
.nkm-topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: #1F2328;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -.2px;
}
.nkm-topbar-title::after { display: none; }
.nkm-topbar-right { display: flex; align-items: center; gap: 10px; }
.nkm-topbar-user {
    font-size: 12px;
    font-weight: 500;
    color: #5B616A;
    background: rgba(31,35,40,.07);
    padding: 5px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---- Content Area ---- */
.nkm-content { padding: 28px 32px; flex: 1; background: #F2F0EA; }

/* ---- Cards ---- */
.nkm-card {
    background: #FFFFFF;
    border: none;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(31,35,40,.06);
    margin-bottom: 16px;
    overflow: hidden;
}
.nkm-card-header {
    padding: 18px 24px 14px;
    border-bottom: 1px solid #F0ECE2;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nkm-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #1F2328;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.nkm-card-body { padding: 20px 24px; }
.nkm-card-footer {
    padding: 12px 24px;
    border-top: 1px solid #F0ECE2;
    background: #FAFAF8;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ---- Grid ---- */
.nkm-grid { display: grid; gap: 20px; }
.nkm-grid-2 { grid-template-columns: 1fr 1fr; }
.nkm-grid-3 { grid-template-columns: repeat(3, 1fr); }
.nkm-grid-sidebar { grid-template-columns: 260px 1fr; align-items: start; }

/* ---- KPI ---- */
.nkm-kpi-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 24px; }
.nkm-kpi {
    background: #FFFFFF;
    border: none;
    border-radius: 16px;
    padding: 20px 22px;
    box-shadow: 0 2px 12px rgba(31,35,40,.06);
    transition: box-shadow .2s, transform .2s;
}
.nkm-kpi:hover { box-shadow: 0 6px 24px rgba(31,35,40,.1); transform: translateY(-1px); }
.nkm-kpi-c-yellow,.nkm-kpi-c-green,.nkm-kpi-c-blue,
.nkm-kpi-c-purple,.nkm-kpi-c-orange,.nkm-kpi-c-teal { /* flat, kein Streifen */ }
.nkm-kpi-icon { font-size: 22px; margin-bottom: 12px; display: block; }
.nkm-kpi-val { font-size: 26px; font-weight: 800; color: #1F2328; line-height: 1; margin-bottom: 4px; letter-spacing: -.5px; }
.nkm-kpi-lbl { font-size: 12px; font-weight: 600; color: #5B616A; text-transform: uppercase; letter-spacing: .04em; }
.nkm-kpi-sub { font-size: 11px; color: #9A9E9B; margin-top: 3px; }

/* ---- Forms ---- */
.nkm-field { margin-bottom: 14px; }
.nkm-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #5B616A;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 5px;
}
.nkm-input,
.nkm-select,
.nkm-textarea {
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    font-size: 13px;
    color: #1F2328;
    background: #fff;
    border: 1.5px solid #EDE8DC;
    border-radius: 10px;
    padding: 9px 12px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
    -webkit-appearance: none;
}
.nkm-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    cursor: pointer;
}
.nkm-textarea { min-height: 72px; resize: vertical; }
.nkm-input:focus, .nkm-select:focus, .nkm-textarea:focus {
    border-color: #FF4FA3;
    box-shadow: 0 0 0 3px rgba(255,79,163,.18);
}
.nkm-input-group { display: flex; }
.nkm-input-group .nkm-input {
    border-radius: 6px 0 0 6px;
    border-right: none;
    flex: 1;
}
.nkm-input-group-addon {
    background: #F2F0EA;
    border: 1.5px solid #D4C89A;
    border-radius: 0 6px 6px 0;
    padding: 9px 11px;
    font-size: 12px;
    font-weight: 600;
    color: #5B616A;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

/* ---- Buttons ---- */
#nkm-app .nkm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 18px;
    height: 38px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    cursor: pointer;
    border: 1.5px solid transparent;
    outline: none;
    transition: background .15s, color .15s, border-color .15s, opacity .15s;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    line-height: 1;
    vertical-align: middle;
    box-sizing: border-box;
}
#nkm-app .nkm-btn-primary { background: #1F2328; color: #fff; letter-spacing: .01em; }
#nkm-app .nkm-btn-primary:hover { background: #0D1013; color: #fff; }
#nkm-app .nkm-btn-secondary { background: #FFFFFF; color: #1F2328; border: 1.5px solid #D4C89A; }
#nkm-app .nkm-btn-secondary:hover { background: #F2F0EA; border-color: #FF4FA3; color: #FF4FA3; }
#nkm-app .nkm-btn-danger { background: #FDF0EE; color: #C0392B; border: 1.5px solid #C0392B; }
#nkm-app .nkm-btn-danger:hover { background: #C0392B; color: #fff; }
#nkm-app .nkm-btn-ghost { background: transparent; color: #5B616A; border: 1.5px solid transparent; }
#nkm-app .nkm-btn-ghost:hover { background: #F2F0EA; color: #1F2328; }
#nkm-app .nkm-btn-sm { padding: 0 10px; height: 30px; font-size: 12px; }
#nkm-app .nkm-btn-full { width: 100%; justify-content: center; }
#nkm-app .nkm-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Tables ---- */
.nkm-table-wrap { overflow-x: auto; }
.nkm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.nkm-table th {
    background: transparent;
    color: #9A9E9B;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 8px 16px 10px;
    text-align: left;
    border-bottom: 1px solid #F0ECE2;
    white-space: nowrap;
}
.nkm-table td {
    padding: 13px 16px;
    border-bottom: 1px solid #F7F5EF;
    vertical-align: middle;
    color: #1F2328;
}
.nkm-table tr:last-child td { border-bottom: none; }
.nkm-table tbody tr:hover td { background: #FAFAF8; }
.nkm-row-clickable.active td { background: #FFF0F7 !important; }
.nkm-table tfoot td { background: #FAFAF8; border-top: 1px solid #F0ECE2; font-weight: 700; color: #1F2328; }
.nkm-table .right { text-align: right; }
.nkm-table .num { font-variant-numeric: tabular-nums; }

/* ---- Badges ---- */
.nkm-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.nkm-badge-blue   { background: #FFF0F7; color: #1F2328; }
.nkm-badge-green  { background: #E7F7F0; color: #1E6F5C; }
.nkm-badge-red    { background: #FDF0EE; color: #C0392B; }
.nkm-badge-gray   { background: #F2F0EA; color: #5B616A; border: 1px solid #D4C89A; }
.nkm-badge-yellow { background: #FFF6D8; color: #7A5C00; }

/* ---- Monat-Tabs ---- */
.nkm-month-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.nkm-month-tab {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #5B616A;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all .15s;
    user-select: none;
}
.nkm-month-tab:hover { background: #FFFFFF; border-color: #D4C89A; color: #1F2328; }
.nkm-month-tab.active { background: #FF4FA3; color: #fff; border-color: #FF4FA3; }
.nkm-month-tab.has-data:not(.active) { color: #FF4FA3; }

/* ---- Filter Bar ---- */
.nkm-filters {
    background: #F7F5EF;
    border: 1px solid #E6D9B8;
    border-radius: 14px;
    padding: 14px 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(31,35,40,.08), 0 1px 2px rgba(31,35,40,.05);
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}
.nkm-filter-group { display: flex; flex-direction: column; gap: 4px; }
.nkm-filter-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #5B616A; }
.nkm-filter-group .nkm-select,
.nkm-filter-group .nkm-input { width: auto; min-width: 120px; }

/* ---- Misc ---- */
.nkm-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #5B616A;
    margin-bottom: 10px;
    margin-top: 4px;
}
.nkm-empty { text-align: center; padding: 40px 20px; color: #5B616A; }
.nkm-empty-icon { font-size: 36px; display: block; margin-bottom: 10px; }
.nkm-hint { font-size: 11px; color: #9A9E9B; margin-top: 4px; }
.nkm-meta { font-size: 12px; color: #5B616A; }
.nkm-divider { height: 1px; background: #E6D9B8; margin: 16px 0; }
.nkm-text-right { text-align: right; }
.nkm-fw-bold { font-weight: 700; }
.nkm-color-green { color: #1E6F5C; }
.nkm-color-red { color: #C0392B; }
.nkm-color-muted { color: #5B616A; }
.nkm-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1F2328;
    color: #fff;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(31,35,40,.12);
    z-index: 999;
    animation: nkm-slide-up .3s ease;
}
.nkm-toast.success { background: #1E6F5C; }
.nkm-toast.error   { background: #C0392B; }
@keyframes nkm-slide-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.nkm-loading { text-align: center; padding: 60px; color: #5B616A; }
.nkm-spinner {
    width: 28px; height: 28px;
    border: 3px solid #E6D9B8;
    border-top-color: #1F2328;
    border-radius: 50%;
    animation: nkm-spin .7s linear infinite;
    margin: 0 auto 12px;
}
@keyframes nkm-spin { to { transform: rotate(360deg); } }
.nkm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.nkm-modal {
    background: #FFFFFF;
    border-radius: 14px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    animation: nkm-modal-in .2s ease;
}
@keyframes nkm-modal-in {
    from { opacity: 0; transform: scale(.95); }
    to   { opacity: 1; transform: scale(1); }
}
.nkm-modal-header {
    padding: 18px 22px 14px;
    border-bottom: 1px solid #E6D9B8;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nkm-modal-title { font-size: 15px; font-weight: 700; }
.nkm-modal-close {
    background: none; border: none; font-size: 18px; cursor: pointer;
    color: #5B616A; padding: 4px; border-radius: 4px;
}
.nkm-modal-close:hover { background: #F2F0EA; color: #1F2328; }
.nkm-modal-body { padding: 20px 22px; }
.nkm-modal-footer {
    padding: 14px 22px;
    border-top: 1px solid #E6D9B8;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    background: #F2F0EA;
    border-radius: 0 0 14px 14px;
}

/* =====================================================
   RESPONSIVE – Mobile First
   Breakpoints:
     < 480px  = kleines Smartphone
     < 768px  = Smartphone/kleines Tablet
     ≥ 768px  = Tablet aufwärts (Sidebar sichtbar ab 900px)
   ===================================================== */

/* ---- Bottom Navigation (Mobile) ---- */
.nkm-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #1F2328;
    border-top: 1px solid rgba(255,255,255,.1);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nkm-bottom-nav-inner {
    display: flex;
    align-items: stretch;
    height: 56px;
    justify-content: space-around;
}
.nkm-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: rgba(255,255,255,.45);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: color .15s;
    user-select: none;
    padding: 6px 4px;
    -webkit-tap-highlight-color: transparent;
}
.nkm-bottom-nav-item .nkm-nav-icon { width: 24px; height: 24px; line-height: 1; }
.nkm-bottom-nav-item .nkm-nav-icon svg { width: 24px; height: 24px; }
.nkm-bottom-nav-item.active { color: #FF4FA3; }
.nkm-bottom-nav-item.active .nkm-nav-icon svg { fill: #FF4FA3; }

/* ---- Tablet: 900px ---- */
@media (max-width: 900px) {
    .nkm-sidebar { display: none; }
    .nkm-bottom-nav { display: flex; }
    /* Platz für Bottom-Nav */
    .nkm-content {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 16px);
    }
    .nkm-kpi-grid { grid-template-columns: 1fr 1fr; }
    .nkm-grid-sidebar { grid-template-columns: 1fr; }
    .nkm-grid-2 { grid-template-columns: 1fr; }
    .nkm-grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ---- Smartphone: 768px ---- */
@media (max-width: 768px) {
    .nkm-content {
        padding: 12px;
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 20px);
    }
    .nkm-topbar { padding: 0 14px; }
    .nkm-topbar-title { font-size: 15px; }

    /* Cards kompakter */
    .nkm-card { border-radius: 10px; margin-bottom: 12px; }
    .nkm-card-header { padding: 12px 14px 10px; flex-wrap: wrap; gap: 8px; }
    .nkm-card-body { padding: 12px 14px; }

    /* Filter-Bar stapelt sich vertikal – keine Box */
    .nkm-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 0;
        margin-bottom: 16px;
        background: transparent;
        border: none;
        box-shadow: none;
        border-radius: 0;
    }
    .nkm-filter-group { width: 100%; }
    .nkm-filter-group label { display: block; margin-bottom: 4px; }
    .nkm-filter-group .nkm-select,
    .nkm-filter-group .nkm-input { width: 100%; }
    .nkm-filters #nkm-app .nkm-btn, #nkm-app .nkm-filters .nkm-btn { width: 100%; justify-content: center; }

    /* Tabellen: horizontal scrollbar statt Überlauf */
    .nkm-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .nkm-table { min-width: 480px; }

    /* KPI Grid */
    .nkm-kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .nkm-kpi { padding: 14px; }
    .nkm-kpi-val { font-size: 24px; }
    .nkm-grid-3 { grid-template-columns: 1fr 1fr; }

    /* Modal als Bottom-Sheet */
    .nkm-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .nkm-modal {
        width: 100%;
        max-width: 100%;
        border-radius: 14px 14px 0 0;
        max-height: 92vh;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        animation: slideUp .25s ease;
    }
    .nkm-modal-body { max-height: 60vh; overflow-y: auto; }

    /* Drag-Handle für Bottom-Sheet */
    .nkm-modal::before {
        content: '';
        display: block;
        width: 36px; height: 4px;
        background: #D4C89A;
        border-radius: 2px;
        margin: 10px auto 0;
    }

    /* Buttons im Modal full-width */
    .nkm-modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
    }
    #nkm-app .nkm-modal-footer .nkm-btn { width: 100%; justify-content: center; }

    /* Grid im Modal: immer 1 Spalte */
    .nkm-modal .nkm-grid-2 { grid-template-columns: 1fr; }
}

/* ---- Kleines Smartphone: 480px ---- */
@media (max-width: 480px) {
    #nkm-app { font-size: 13px; }
    .nkm-content {
        padding: 8px;
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 20px);
    }
    .nkm-topbar { padding: 0 10px; height: 50px; }

    .nkm-kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .nkm-kpi { padding: 12px; }
    .nkm-kpi-icon { font-size: 20px; margin-bottom: 6px; }
    .nkm-kpi-val { font-size: 20px; }
    .nkm-kpi-lbl { font-size: 10px; }

    .nkm-grid-3 { grid-template-columns: 1fr; }

    /* Card-Header: Titel und Button stapeln */
    .nkm-card-header { flex-direction: column; align-items: flex-start; }
    #nkm-app .nkm-card-header .nkm-btn { align-self: stretch; justify-content: center; }

    /* Tabellen-Buttons größer für Touch */
    #nkm-app #nkm-app .nkm-table .nkm-btn-ghost.nkm-btn-sm {
        width: 34px; height: 34px;
        font-size: 16px;
    }

    /* Badges kleiner */
    .nkm-badge { font-size: 10px; padding: 2px 6px; }

    /* Bottom-Nav etwas höher für bessere Touch-Fläche */
    .nkm-bottom-nav-inner { height: 60px; }
    .nkm-bottom-nav-item { font-size: 9px; }
    .nkm-bottom-nav-item .nkm-nav-icon,
    .nkm-bottom-nav-item .nkm-nav-icon svg { width: 26px; height: 26px; }
}

/* Slide-Up Animation für Bottom-Sheet */
@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}


/* ====================================================
   Buttons & Icons – sauber und lesbar
   ==================================================== */

/* Basis-Buttons */
.nkm-btn { min-height: 36px; letter-spacing: .01em; }
.nkm-btn-sm { min-height: 28px; font-size: 12px; padding: 4px 10px; }
.nkm-btn-full { justify-content: center; }

/* Action-Buttons in Tabellen: quadratisch */
.nkm-table .nkm-btn-ghost.nkm-btn-sm {
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 6px;
    border: 1.5px solid #E6D9B8;
    color: #5B616A;
    vertical-align: middle;
    flex-shrink: 0;
}
#nkm-app .nkm-table .nkm-btn-ghost.nkm-btn-sm:hover {
    background: #F2F0EA;
    color: #1F2328;
    border-color: #D4C89A;
}
/* Tabellen-Aktionszelle: Buttons immer bündig */
.nkm-table td:last-child {
    white-space: nowrap;
    text-align: right;
    vertical-align: middle;
}
#nkm-app .nkm-table td:last-child .nkm-btn {
    vertical-align: middle;
}

/* Navigation Icons */
.nkm-nav-item { font-size: 13.5px; }
.nkm-nav-icon {
    font-size: 18px;
    min-width: 22px;
    text-align: center;
    font-style: normal;
    line-height: 1;
}

/* KPI Icons */
.nkm-kpi-icon { font-size: 26px; line-height: 1; display: block; margin-bottom: 10px; }

/* Monat-Tabs */
.nkm-month-tab { font-size: 11.5px; font-weight: 700; min-width: 40px; text-align: center; cursor: pointer; }

/* Filter-Buttons */
.nkm-filters .nkm-btn { padding: 9px 18px; align-self: flex-end; }

/* Card-Header Buttons */
.nkm-card-header .nkm-btn-sm { padding: 5px 12px; font-size: 12px; }

/* Zähler-Badges */
.nkm-badge-haus, .nkm-badge-wohnung {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.nkm-badge-haus    { background: #e8f4fd; color: #1a6fa8; }
.nkm-badge-wohnung { background: #fff0e0; color: #c06a00; }

/* ---- Login ---- */
.nkm-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F2F0EA;
    padding: 20px;
}
.nkm-login-box {
    background: #FFFFFF;
    border: 1px solid #E6D9B8;
    border-radius: 14px;
    padding: 40px 36px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
}
.nkm-login-logo { font-size: 40px; text-align: center; margin-bottom: 12px; }
.nkm-login-title { font-size: 20px; font-weight: 700; text-align: center; margin: 0 0 4px; }
.nkm-login-sub   { font-size: 13px; color: #5B616A; text-align: center; margin: 0 0 24px; }
.nkm-login-error {
    background: #fff0f0; border: 1px solid #fca5a5;
    color: #dc2626; border-radius: 6px;
    padding: 8px 12px; font-size: 13px; margin-bottom: 16px;
}
/* User-Button in Topbar */
.nkm-topbar-user {
    color: #5B616A;
    font-size: 13px;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background .15s;
    white-space: nowrap;
}
.nkm-topbar-user:hover { background: #F2F0EA; color: #1F2328; }

/* ---- Touch-Optimierungen ---- */
/* Mindest-Touch-Target 44px überall */
.nkm-btn { min-height: 44px; }
.nkm-btn.nkm-btn-sm { min-height: 36px; }

/* Inputs auf Mobile groß genug */
@media (max-width: 768px) {
    .nkm-input, .nkm-select, .nkm-textarea {
        font-size: 16px; /* verhindert iOS Auto-Zoom */
        min-height: 44px;
    }
    .nkm-textarea { min-height: 80px; }

    /* Topbar: Username auf kleinen Screens kürzen */
    .nkm-topbar-username {
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
        vertical-align: middle;
    }

    /* Cards: etwas weniger Padding */
    .nkm-card > * { padding-left: 14px; padding-right: 14px; }

    /* Kein hover-effect auf Touch-Geräten (verhindert sticky hover) */
    @media (hover: none) {
        .nkm-nav-item:hover,
        .nkm-btn:hover { opacity: 1; }
    }
}

/* ---- Scroll-Verbesserungen ---- */
.nkm-content {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

/* =====================================================
   DATA-CARDS – natives Card-Layout für alle Views
   Ersetzt Tabellen auf Mobile, funktioniert überall
   ===================================================== */

/* Card-Basis */
.nkm-data-card {
    background: #fff;
    border: none;
    border-radius: 16px;
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(31,35,40,.06);
    cursor: default;
    transition: box-shadow .15s;
}
.nkm-data-card.nkm-row-clickable { cursor: pointer; }
.nkm-data-card.nkm-row-clickable:hover {
    border-color: #D4C89A;
    box-shadow: 0 2px 8px rgba(31,35,40,.1);
}
.nkm-data-card.active {
    border-color: #FF4FA3 !important;
    border-left-width: 4px;
    box-shadow: 0 0 0 2px rgba(255,79,163,.15) !important;
}

/* Titel-Zeile der Card */
.nkm-data-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 14px 10px;
    background: #FAFAF8;
    border-bottom: 2px solid #F2E6C6;
    font-size: 14px;
    font-weight: 700;
    color: #1F2328;
    border-left: 4px solid #FF4FA3;
}

/* Label-Wert Zeilen */
.nkm-data-card-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 7px 14px;
    border-bottom: 1px solid #F2F0EA;
    font-size: 13px;
    gap: 8px;
}
.nkm-data-card-row:last-of-type { border-bottom: none; }
.nkm-data-label {
    font-size: 10px;
    font-weight: 700;
    color: #9A9E9B;
    text-transform: uppercase;
    letter-spacing: .05em;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Aktions-Zeile */
.nkm-data-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px 14px;
    background: #FAFAF8;
    border-top: 1px solid #F0ECE2;
}

/* Summen-Zeile */
.nkm-data-card-summe {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: none;
    border-radius: 16px;
    padding: 14px 18px;
    margin-top: 4px;
    font-size: 14px;
    box-shadow: 0 2px 12px rgba(31,35,40,.06);
}

/* Desktop: Tabelle zeigen, Cards ausblenden */
@media (min-width: 769px) {
    .nkm-data-card { display: none !important; }
    .nkm-data-card-summe { display: none !important; }
}

/* Mobile: Cards zeigen, Tabellen ausblenden */
@media (max-width: 768px) {
    .nkm-table-wrap .nkm-table { display: none !important; }
    .nkm-table { display: none !important; }

    /* Bottom-Nav gleichmäßig */
    .nkm-bottom-nav-inner { justify-content: space-evenly; }

    /* Filter stapeln */
    .nkm-filters { flex-direction: column; gap: 8px; }
    .nkm-filter-group { width: 100%; }
    .nkm-filter-group .nkm-select,
    .nkm-filter-group .nkm-input { width: 100%; }
    .nkm-filters #nkm-app .nkm-btn { width: 100%; justify-content: center; }

    /* Grids stapeln */
    .nkm-pv-grid  { grid-template-columns: 1fr !important; }
    .nkm-grid-2   { grid-template-columns: 1fr !important; }
    .nkm-kpi-grid { grid-template-columns: 1fr 1fr; }

    /* Pink-Akzent an Card-Titeln */
    .nkm-card-title {
        font-size: 16px;
        font-weight: 700;
        position: relative;
        padding-left: 12px;
    }
    .nkm-card-title::before {
        content: '';
        position: absolute;
        left: 0; top: 50%;
        transform: translateY(-50%);
        width: 4px; height: 70%;
        background: #FF4FA3;
        border-radius: 2px;
    }

    /* Modal als Bottom-Sheet */
    .nkm-modal-overlay { align-items: flex-end; padding: 0; }
    .nkm-modal {
        width: 100%; max-width: 100%;
        border-radius: 14px 14px 0 0;
        max-height: 90vh;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        animation: slideUp .25s ease;
    }
    .nkm-modal::before {
        content: '';
        display: block;
        width: 36px; height: 4px;
        background: #E6D9B8;
        border-radius: 2px;
        margin: 10px auto 0;
    }
    .nkm-modal-body { max-height: 62vh; overflow-y: auto; }
    .nkm-modal-footer { flex-direction: column-reverse; gap: 8px; }
    .nkm-modal-footer #nkm-app .nkm-btn { width: 100%; justify-content: center; }
    .nkm-modal #nkm-app .nkm-grid-2 { grid-template-columns: 1fr; }

    /* Actions-Buttons in Cards größer für Touch */
    .nkm-data-card-actions #nkm-app .nkm-btn,
    .nkm-data-card-actions .nkm-btn { min-height: 40px; }
}



/* ---- Logos ---- */
.nkm-bottom-nav-logo {
    display: none;
}
@media (max-width: 900px) {
    .nkm-bottom-nav-logo {
        display: flex;
        align-items: center;
        padding: 0 10px 0 14px;
        flex-shrink: 0;
    }
    .nkm-logo-rund {
        width: 38px;
        height: 38px;
        object-fit: contain;
    }
    .nkm-bottom-nav-inner { flex: 1; }
}

/* ---- Vorschau-Banner in der Abrechnung ---- */
.nkm-vorschau-banner {
    background: #FFF0F7;
    border: 1.5px solid #FF4FA3;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #C2185B;
}
.nkm-vorschau-badge {
    background: #FF4FA3;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: .08em;
    flex-shrink: 0;
    white-space: nowrap;
}
.nkm-vorschau-tag {
    display: inline-block;
    background: #FFF0F7;
    color: #FF4FA3;
    border: 1px solid #FF4FA3;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: .06em;
    vertical-align: middle;
    margin-left: 6px;
}
