/* ============================================
   NachlassPilot.app — CI Design System v1
   Sidebar-Layout für Fachanwendung
   ============================================ */

/* 1. Design Tokens */
:root {
    --np-tinte: #0E2A33;
    --np-petrol: #0F3D46;
    --np-petrol-2: #164E59;
    --np-pergament: #F7F3EA;
    --np-stein: #E6E0D4;
    --np-messing: #B19343;
    --np-salbei: #6F7F73;
    --np-erfolg: #2E7D62;
    --np-warnung: #D49A2B;
    --np-kritisch: #C44840;
    --np-papier: #FFFCF5;

    --np-primary: var(--np-petrol);
    --np-primary-dark: var(--np-tinte);
    --np-primary-light: #DDEBF0;
    --np-bg: var(--np-pergament);
    --np-surface: var(--np-papier);
    --np-border: rgba(14,42,51,.14);
    --np-text: var(--np-tinte);
    --np-muted: #52616B;
    --np-muted2: #87919A;
    --np-accent: var(--np-messing);
    --np-success: var(--np-erfolg);
    --np-info: #2B6F89;
    --np-warning: var(--np-warnung);
    --np-danger: var(--np-kritisch);
    --np-neutral: #718096;
    --np-radius-sm: 6px;
    --np-radius-md: 10px;
    --np-shadow-sm: 0 1px 2px rgba(14,42,51,.08);
    --np-shadow-md: 0 8px 24px rgba(14,42,51,.10);
    --np-space-xs: 0.25rem;
    --np-space-sm: 0.5rem;
    --np-space-md: 1rem;
    --np-space-lg: 1.5rem;
    --np-font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --np-font-display: Georgia, "Times New Roman", serif;
    --np-sidebar-w: 220px;
}

/* 2. Base */
*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: var(--np-font);
    font-size: 14px;
    background: var(--np-pergament);
    background-image: linear-gradient(rgba(247,243,234,.88), rgba(247,243,234,.94)), url('../assets/nachlasspilot-ci/backgrounds/bg_paper_register_light.png');
    background-size: cover;
    background-attachment: fixed;
    color: var(--np-tinte);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    margin: 0;
}
a { color: var(--np-primary); text-decoration: none; }
a:hover { color: var(--np-primary-dark); }

/* 3. App Shell — Sidebar Layout */
.np-app { display: flex; min-height: 100vh; }

.np-sidebar {
    width: var(--np-sidebar-w);
    background: var(--np-tinte);
    background-image: linear-gradient(rgba(14,42,51,.96), rgba(14,42,51,.96)), url('../assets/nachlasspilot-ci/backgrounds/bg_register_dark.png');
    background-size: cover;
    background-position: center;
    color: rgba(255,255,255,.85);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    border-right: 1px solid rgba(177,147,67,.28);
}
.np-sidebar-brand {
    padding: .9rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex;
    flex-direction: column;
    gap: .15rem;
    align-items: flex-start;
}
.np-sidebar-brand img.np-brand-logo { width: 100%; max-width: 170px; height: auto; }
.np-sidebar-brand .np-brand-sub { font-size: .58rem; font-weight: 400; color: rgba(255,255,255,.45); letter-spacing: .04em; text-transform: uppercase; }
.np-sidebar-nav { flex: 1; padding: .5rem 0; }
.np-sidebar-section {
    padding: .6rem 1rem .2rem;
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.4);
}
.np-sidebar-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1rem;
    color: rgba(255,255,255,.7);
    font-size: .85rem;
    transition: .15s;
    text-decoration: none;
}
.np-sidebar-link:hover,
.np-sidebar-link.active {
    background: rgba(255,255,255,.08);
    color: #fff;
    border-left: 3px solid var(--np-messing);
    padding-left: calc(1rem - 3px);
}
.np-sidebar-link i { font-size: 1rem; width: 1.2rem; text-align: center; }
.np-sidebar-badge {
    margin-left: auto;
    font-size: .65rem;
    background: rgba(255,255,255,.15);
    padding: .1em .45em;
    border-radius: 10px;
}
.np-sidebar-footer {
    padding: .5rem 1rem;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: .75rem;
    color: rgba(255,255,255,.45);
}

/* 4. Topbar */
.np-topbar {
    position: fixed;
    top: 0; left: var(--np-sidebar-w); right: 0;
    height: 44px;
    background: var(--np-surface);
    border-bottom: 1px solid var(--np-border);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    z-index: 999;
    gap: .75rem;
}
.np-topbar-tenant {
    font-size: .8rem;
    color: var(--np-muted);
    font-weight: 500;
}
.np-topbar-spacer { flex: 1; }
.np-topbar-user {
    font-size: .8rem;
    color: var(--np-muted);
}
.np-topbar .btn-np-ghost { font-size: .8rem; }

/* 5. Main Content */
.np-main {
    margin-left: var(--np-sidebar-w);
    padding-top: 44px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.np-content { padding: 1rem 1.25rem; }

/* 6. Page Header */
.np-page-header { margin-bottom: .75rem; }
.np-page-header .np-eyebrow {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--np-muted);
    margin-bottom: .1rem;
}
.np-page-header h1, .np-page-header .np-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--np-text);
    margin: 0 0 .15rem;
    font-family: var(--np-font-display);
    letter-spacing: -.01em;
}
.np-page-header .np-subtitle { font-size: .8rem; color: var(--np-muted); }

/* 7. Cards */
.np-card {
    background: rgba(255,252,245,.92);
    border: 1px solid var(--np-border);
    border-radius: var(--np-radius-md);
    box-shadow: var(--np-shadow-sm);
}
.np-card-header {
    padding: .6rem .85rem;
    border-bottom: 1px solid rgba(177,147,67,.22);
    font-weight: 600;
    font-size: .82rem;
    color: var(--np-text);
    background: linear-gradient(#fffaf1, #f4ebdc);
}
.np-card-body { padding: .75rem .85rem; }
.np-card-footer {
    padding: .5rem .85rem;
    border-top: 1px solid var(--np-border);
    background: var(--np-bg);
    font-size: .8rem;
}

/* 8. Stat Cards */
.np-stat-card {
    background: rgba(255,252,245,.94);
    border: 1px solid rgba(14,42,51,.13);
    border-radius: var(--np-radius-sm);
    box-shadow: var(--np-shadow-sm);
    text-align: center;
    padding: .6rem .4rem;
    display: block;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .15s;
}
.np-stat-card:hover { box-shadow: var(--np-shadow-md); }
.np-stat-card .np-stat-icon { font-size: 1rem; margin-bottom: .15rem; }
.np-stat-card .np-stat-value { font-size: 1.15rem; font-weight: 700; line-height: 1.2; }
.np-stat-card .np-stat-label { font-size: .6rem; text-transform: uppercase; letter-spacing: .06em; color: var(--np-muted); margin-top: .1rem; }

/* 9. Empty State */
.np-empty-state { text-align: center; padding: 2rem 1rem; }
.np-empty-state .np-empty-icon { font-size: 2rem; color: var(--np-border); margin-bottom: .5rem; }
.np-empty-state h3 { font-size: .95rem; color: var(--np-muted); font-weight: 500; margin: 0 0 .25rem; }
.np-empty-state p { color: var(--np-muted2); font-size: .82rem; margin: 0; }

/* 10. Buttons */
.btn-np-primary {
    background: linear-gradient(180deg, var(--np-petrol-2), var(--np-petrol));
    color: #fff;
    border: 1px solid rgba(14,42,51,.5);
    padding: .4rem .9rem;
    border-radius: var(--np-radius-sm);
    font-weight: 600;
    font-size: .82rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    transition: background .15s;
    box-shadow: 0 2px 8px rgba(14,42,51,.14);
}
.btn-np-primary:hover { background: linear-gradient(180deg, var(--np-petrol-2), var(--np-petrol)); color: #fff; opacity: .92; }
.btn-np-secondary {
    background: var(--np-surface);
    color: var(--np-text);
    border: 1px solid var(--np-border);
    padding: .4rem .9rem;
    border-radius: var(--np-radius-sm);
    font-weight: 500;
    font-size: .82rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    transition: background .15s;
}
.btn-np-secondary:hover { background: var(--np-bg); }
.btn-np-ghost {
    background: transparent;
    color: var(--np-muted);
    border: none;
    padding: .3rem .5rem;
    border-radius: var(--np-radius-sm);
    font-size: .8rem;
    cursor: pointer;
}
.btn-np-ghost:hover { background: var(--np-bg); color: var(--np-text); }
.btn-np-danger {
    background: var(--np-danger);
    color: #fff;
    border: none;
    padding: .4rem .9rem;
    border-radius: var(--np-radius-sm);
    font-weight: 600;
    font-size: .82rem;
    cursor: pointer;
}
.btn-np-danger:hover { background: #9e3d3b; color: #fff; }

/* 11. Badges */
.np-badge {
    display: inline-block;
    padding: .12em .45em;
    border-radius: 3px;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .02em;
    line-height: 1.4;
}
.np-badge-success { background: rgba(46,125,98,.14); color: var(--np-erfolg); border: 1px solid rgba(46,125,98,.22); }
.np-badge-warning { background: rgba(212,154,43,.14); color: #996817; border: 1px solid rgba(212,154,43,.28); }
.np-badge-danger { background: rgba(196,72,64,.12); color: var(--np-kritisch); border: 1px solid rgba(196,72,64,.24); }
.np-badge-info { background: rgba(43,111,137,.12); color: var(--np-info); border: 1px solid rgba(43,111,137,.22); }
.np-badge-neutral { background: rgba(113,128,150,.10); color: var(--np-muted); border: 1px solid rgba(113,128,150,.18); }
.np-badge-archived { background: rgba(113,128,150,.08); color: var(--np-muted2); border: 1px solid rgba(113,128,150,.12); }
.np-badge-info { background: var(--np-primary-light); color: var(--np-info); }
.np-badge-neutral { background: var(--np-bg); color: var(--np-muted); }
.np-badge-active { background: #e6f4ec; color: var(--np-success); }
.np-badge-draft { background: var(--np-primary-light); color: var(--np-primary); }
.np-badge-archived { background: #f0f0f0; color: var(--np-muted2); }

/* 12. Tables */
.np-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.np-table th {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .055em;
    color: rgba(14,42,51,.68);
    padding: .4rem .6rem;
    border-bottom: 2px solid rgba(177,147,67,.28);
    font-weight: 600;
    text-align: left;
    background: #efe7d8;
}
.np-table td { padding: .4rem .6rem; border-bottom: 1px solid var(--np-border); vertical-align: middle; }
.np-table tr:hover td { background: rgba(230,224,212,.22); }

/* 13. List Items */
.np-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .45rem .75rem;
    border-bottom: 1px solid var(--np-border);
    gap: .4rem;
    font-size: .85rem;
}
.np-list-item:last-child { border-bottom: none; }
.np-list-item:hover { background: var(--np-bg); }
.np-list-item .np-list-body { flex: 1; min-width: 0; }
.np-list-item .np-list-actions { display: flex; gap: .15rem; flex-shrink: 0; }

/* 14. Forms */
.np-form-section {
    background: var(--np-surface);
    border: 1px solid var(--np-border);
    border-radius: var(--np-radius-sm);
    padding: .85rem;
    margin-bottom: .75rem;
}
.np-form-section-title {
    font-size: .78rem;
    font-weight: 700;
    color: var(--np-text);
    margin-bottom: .6rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid var(--np-border);
}
.np-form-label { font-size: .75rem; font-weight: 600; color: var(--np-text); margin-bottom: .15rem; display: block; }

/* 15. Bootstrap Overrides */
.card { background: rgba(255,252,245,.92); border: 1px solid var(--np-border); border-radius: var(--np-radius-md); box-shadow: var(--np-shadow-sm); }
.card-header { background: linear-gradient(#fffaf1, #f4ebdc); border-bottom: 1px solid rgba(177,147,67,.22); font-weight: 600; font-size: .82rem; padding: .6rem .85rem; }
.card-body { padding: .75rem .85rem; }
.card-footer { background: var(--np-bg); border-top: 1px solid var(--np-border); padding: .5rem .85rem; }
.table { --bs-table-bg: rgba(255,252,245,.72); --bs-table-color: var(--np-text); --bs-table-border-color: rgba(14,42,51,.12); font-size: .85rem; }
.table th { background: #efe7d8; font-size: .68rem; text-transform: uppercase; letter-spacing: .055em; color: rgba(14,42,51,.68); font-weight: 600; }
.form-control, .form-select {
    border: 1px solid var(--np-border); border-radius: var(--np-radius-sm); font-size: .85rem;
    padding: .4rem .55rem; background: rgba(255,252,245,.72); color: var(--np-text);
}
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2352616B' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right .5rem center; background-size: 12px 10px;
    padding-right: 2rem; cursor: pointer; appearance: none;
}
.form-select:focus, .form-control:focus { border-color: var(--np-messing); box-shadow: 0 0 0 3px rgba(177,147,67,.15); outline: none; }
.alert { border: none; border-radius: var(--np-radius-sm); font-size: .82rem; padding: .5rem .75rem; }
.alert-success { background: rgba(46,125,98,.12); color: var(--np-erfolg); }
.alert-danger { background: rgba(196,72,64,.10); color: var(--np-kritisch); }
.alert-info { background: var(--np-primary-light); color: var(--np-info); }
.alert-warning { background: rgba(212,154,43,.12); color: #996817; }
.badge { font-weight: 500; font-size: .7rem; padding: .15em .45em; border-radius: 3px; }
.btn { font-weight: 500; border-radius: var(--np-radius-sm); font-size: .82rem; }
.list-group-item { border-color: var(--np-border); padding: .45rem .75rem; }
.nav-link { color: var(--np-muted); font-size: .8rem; }
.nav-link:hover { color: var(--np-petrol-2); }
.form-check-input:checked { background-color: var(--np-primary); border-color: var(--np-primary); }

/* 16. Placeholder */
.np-placeholder {
    background: var(--np-surface);
    border: 2px dashed var(--np-border);
    border-radius: var(--np-radius-md);
    padding: 2rem;
    text-align: center;
}
.np-placeholder-icon { font-size: 2.5rem; color: var(--np-border); margin-bottom: .75rem; }
.np-placeholder h3 { font-size: 1rem; color: var(--np-muted); margin: 0 0 .5rem; }
.np-placeholder p { font-size: .82rem; color: var(--np-muted2); max-width: 500px; margin: 0 auto .5rem; }
.np-placeholder .np-badge { display: inline-block; }

/* 17. Offcanvas mobile */
.np-sidebar-toggle { display: none; }
@media (max-width: 767.98px) {
    .np-sidebar { transform: translateX(-100%); transition: transform .2s; }
    .np-sidebar.open { transform: translateX(0); }
    .np-sidebar-toggle { display: flex; }
    .np-topbar { left: 0; }
    .np-main { margin-left: 0; }
    .np-content { padding: .75rem .5rem; }
    .np-stat-card { padding: .4rem .25rem; }
    .np-stat-card .np-stat-value { font-size: .95rem; }
    .np-page-header h1, .np-page-header .np-title { font-size: 1rem; }
}
@media (min-width: 768px) and (max-width: 1023.98px) {
    .np-content { padding: .75rem 1rem; }
}

/* 18. Drop Zone */
#dropZone {
    border: 2px dashed var(--np-border);
    border-radius: var(--np-radius-md);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
#dropZone:hover { border-color: var(--np-primary); background: var(--np-primary-light); }

/* 19. Estate Tab Bar — Registerkarten-Stil */
.np-tab-bar-wrapper {
    background: var(--np-tinte);
    background-image: linear-gradient(rgba(14,42,51,.96), rgba(14,42,51,.96)), url('../assets/nachlasspilot-ci/backgrounds/bg_register_dark.png');
    background-size: cover;
    padding-top: .5rem;
    position: sticky;
    top: 44px;
    z-index: 998;
}
.np-tab-scroll {
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    padding: 0 1.25rem;
}
.np-tab-scroll::-webkit-scrollbar { display: none; }
.np-tab-bar {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    min-width: max-content;
}
.np-tab {
    display: inline-flex;
    align-items: center;
    padding: .5rem .85rem;
    font-size: .78rem;
    font-weight: 500;
    color: rgba(255,255,255,.72);
    text-decoration: none;
    white-space: nowrap;
    background: rgba(255,255,255,.06);
    border-radius: 8px 8px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    transition: .15s;
    flex-shrink: 0;
}
.np-tab:hover {
    color: #fff;
    background: rgba(255,255,255,.14);
    text-decoration: none;
}
.np-tab.active {
    color: var(--np-text);
    background: var(--np-bg);
    border-color: rgba(0,0,0,.08);
    font-weight: 600;
    padding-bottom: calc(.5rem + 1px);
    margin-bottom: -1px;
}
.np-tab-mehr { cursor: pointer; }
@media (max-width: 1200px) {
    .np-tab { font-size: .7rem; padding: .4rem .6rem; }
    .np-tab.active { padding-bottom: calc(.4rem + 1px); }
}
@media (max-width: 900px) {
    .np-tab { font-size: .65rem; padding: .35rem .5rem; }
    .np-tab.active { padding-bottom: calc(.35rem + 1px); }
}
#npMehrMenu { display: none; }
#npMehrMenu.np-open { display: block; }

/* 20. CI Paper Cards & Aktenkarten */
.np-paper-card {
    background: rgba(255,252,245,.94);
    border: 1px solid rgba(14,42,51,.13);
    border-radius: var(--np-radius-md);
    box-shadow: var(--np-shadow-sm);
}
.np-paper-card-header {
    padding: .55rem .85rem;
    border-bottom: 1px solid rgba(177,147,67,.18);
    font-weight: 600;
    font-size: .82rem;
    color: var(--np-tinte);
    background: linear-gradient(#fffaf3, #f5edde);
    border-radius: var(--np-radius-md) var(--np-radius-md) 0 0;
}
.np-paper-card-body { padding: .75rem .85rem; }
.np-paper-card.np-tab-edge {
    border-left: 3px solid var(--np-messing);
    border-radius: 0 var(--np-radius-md) var(--np-radius-md) 0;
}

/* 21. File Cards (estate list) */
.np-file-card {
    background: rgba(255,252,245,.94);
    border: 1px solid rgba(14,42,51,.13);
    border-radius: 0 var(--np-radius-md) var(--np-radius-md) var(--np-radius-md);
    border-left: 4px solid var(--np-petrol);
    padding: .85rem;
    position: relative;
    transition: box-shadow .15s, transform .15s;
    height: 100%;
}
.np-file-card:hover {
    box-shadow: 0 12px 30px rgba(14,42,51,.10);
    transform: translateY(-1px);
    border-left-color: var(--np-messing);
}
.np-file-card .np-file-tab {
    position: absolute;
    top: -1px; left: -1px;
    background: var(--np-petrol);
    color: #fff;
    padding: .15rem .5rem .2rem .55rem;
    border-radius: 6px 0 6px 0;
    font-size: .6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.np-file-card .np-file-number {
    font-size: .65rem;
    color: var(--np-muted);
    letter-spacing: .04em;
    margin-bottom: .2rem;
}
.np-file-card .np-file-title {
    font-weight: 700;
    font-size: .95rem;
    color: var(--np-tinte);
    margin-bottom: .25rem;
    font-family: var(--np-font-display);
}
.np-file-card .np-file-meta {
    font-size: .72rem;
    color: var(--np-muted);
    line-height: 1.4;
}

/* 22. Filter Chips */
.np-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: .75rem;
}
.np-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .7rem;
    font-size: .72rem;
    font-weight: 500;
    border-radius: 20px;
    border: 1px solid rgba(177,147,67,.28);
    background: rgba(255,252,245,.8);
    color: var(--np-tinte);
    text-decoration: none;
    transition: .15s;
    cursor: pointer;
}
.np-filter-chip:hover,
.np-filter-chip.active {
    background: var(--np-petrol);
    color: #fff;
    border-color: var(--np-petrol);
    text-decoration: none;
}

/* 23. Activity Timeline */
.np-activity-timeline {
    position: relative;
    padding-left: 1.2rem;
}
.np-activity-timeline::before {
    content: '';
    position: absolute;
    left: 5px; top: 0; bottom: 0;
    width: 2px;
    background: rgba(177,147,67,.2);
}
.np-activity-item {
    position: relative;
    padding: .35rem 0 .35rem .8rem;
    font-size: .78rem;
    border-bottom: 1px solid rgba(14,42,51,.05);
}
.np-activity-item:last-child { border-bottom: none; }
.np-activity-item::before {
    content: '';
    position: absolute;
    left: -1.2rem; top: .55rem;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--np-petrol);
    border: 2px solid var(--np-pergament);
    box-shadow: 0 0 0 2px rgba(177,147,67,.25);
    z-index: 1;
}
.np-activity-item .np-activity-time {
    font-size: .65rem;
    color: var(--np-muted2);
    margin-bottom: .05rem;
}
.np-activity-item .np-activity-action {
    color: var(--np-tinte);
}
.np-activity-item .np-activity-user {
    font-size: .68rem;
    color: var(--np-muted);
}

/* 24. Empty State Notes */
.np-empty-note {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--np-muted);
    font-size: .82rem;
    font-style: italic;
}
.np-empty-note i { font-size: 1.5rem; display: block; margin-bottom: .4rem; color: rgba(177,147,67,.35); }

/* 25. Min-height for short pages */
.np-main { min-height: 100vh; display: flex; flex-direction: column; }
.np-content { flex: 1; }
footer { margin-top: auto; }
