/* ============================================================
   TCMS – Tax Compliance Management System
   Haupt-Stylesheet (modern, ruhig, professionell)
   ============================================================ */

/* --- CSS-Variablen ---------------------------------------- */
:root {
    --primary:        #1e40af;
    --primary-hover:  #1d3a9e;
    --primary-light:  #dbeafe;
    --secondary:      #64748b;
    --success:        #15803d;
    --success-light:  #dcfce7;
    --danger:         #b91c1c;
    --danger-light:   #fee2e2;
    --warning:        #b45309;
    --warning-light:  #fef3c7;
    --info:           #0369a1;
    --info-light:     #e0f2fe;

    /* Statusfarben */
    --status-offen:        #dc2626;
    --status-zugewiesen:   #2563eb;
    --status-inbearbeitung:#d97706;
    --status-beantwortet:  #16a34a;
    --status-erneutopen:   #7c3aed;

    --sidebar-width:  260px;
    --topbar-height:  60px;

    --bg:             #f8fafc;
    --card-bg:        #ffffff;
    --border:         #e2e8f0;
    --text:           #1e293b;
    --text-muted:     #64748b;
    --text-light:     #94a3b8;

    --radius:         8px;
    --radius-lg:      12px;
    --shadow-sm:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow:         0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
    --shadow-lg:      0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
    --transition:     all .18s ease;
}

/* --- Reset & Base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); }

h1, h2, h3, h4 { line-height: 1.3; font-weight: 600; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }

p { color: var(--text-muted); line-height: 1.7; }

/* --- Layout ------------------------------------------------ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar ----------------------------------------------- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: #1e293b;
    color: #e2e8f0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand .brand-icon {
    width: 34px;
    height: 34px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand .brand-name {
    font-weight: 700;
    font-size: .85rem;
    color: #f1f5f9;
    letter-spacing: .02em;
    line-height: 1.2;
}

.sidebar-brand .brand-sub {
    font-size: .7rem;
    color: #94a3b8;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-section {
    padding: 16px 16px 6px;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #475569;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: #cbd5e1;
    font-size: .875rem;
    border-radius: 0;
    transition: var(--transition);
    position: relative;
    cursor: pointer;
    text-decoration: none;
}

.sidebar-link:hover {
    color: #f1f5f9;
    background: rgba(255,255,255,.06);
}

.sidebar-link.active {
    color: #fff;
    background: rgba(30,64,175,.4);
    font-weight: 500;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.sidebar-link .nav-icon {
    width: 18px;
    height: 18px;
    opacity: .8;
    flex-shrink: 0;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-link.active .nav-icon { opacity: 1; }

.sidebar-sublink {
    padding-left: 2.2rem;
    font-size: .82rem;
    opacity: .85;
}
.sidebar-sublink:hover { opacity: 1; }

.badge-section {
    display: inline-block;
    padding: 2px 8px;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 4px;
    font-size: .78rem;
    font-weight: 600;
}

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

/* Akkordeon-Untermenü */
.sidebar-submenu {
    display: none;
    padding: 2px 0 4px 38px;
}
.sidebar-submenu.open { display: block; }
.sidebar-submenu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: .82rem;
    color: #94a3b8;
    border-radius: 4px;
    transition: var(--transition);
    text-decoration: none;
}
.sidebar-submenu a:hover { color: #e2e8f0; background: rgba(255,255,255,.05); }
.sidebar-submenu a.active { color: #fff; font-weight: 500; }

.sidebar-user {
    padding: 14px 16px;
    border-top: 1px solid #334155;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .875rem;
    flex-shrink: 0;
}

.user-info .name {
    font-size: .8rem;
    color: #f1f5f9;
    font-weight: 500;
    line-height: 1.2;
}

.user-info .role {
    font-size: .68rem;
    color: #64748b;
}

.sidebar-user .logout-btn {
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fee2e2;
    color: #ef4444;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    transition: background .15s, color .15s, transform .15s;
}
.sidebar-user .logout-btn:hover {
    background: #ef4444;
    color: #fff;
    transform: scale(1.1);
}

/* --- Hauptinhalt ------------------------------------------- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Topbar ------------------------------------------------ */
.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
}

.topbar-left { flex: 1; display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    color: var(--text-muted);
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--text-light); }
.breadcrumb .current { color: var(--text); font-weight: 500; }

.topbar-tenant-badge {
    background: var(--primary-light);
    color: var(--primary);
    font-size: .72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: .02em;
}

/* Notification-Icon */
.notif-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    position: relative;
    transition: var(--transition);
    text-decoration: none;
}
.notif-btn:hover { background: var(--bg); color: var(--primary); }
.notif-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid #fff;
}

/* --- Seiteninhaltsbereich --------------------------------- */
.page-content {
    flex: 1;
    padding: 28px 28px 40px;
}

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

.page-title h1 {
    margin-bottom: 4px;
}

.page-title p {
    font-size: .875rem;
    color: var(--text-muted);
    margin: 0;
}

/* --- Karten ----------------------------------------------- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

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

.card-title {
    font-size: .95rem;
    font-weight: 600;
    color: var(--text);
}

.card-body { padding: 20px; }
.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* --- Buttons ---------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover   { background: var(--primary-hover); color: #fff; }

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

.btn-success   { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-success:hover   { background: #15803d; color: #fff; }

.btn-danger    { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover    { background: #b91c1c; color: #fff; }

.btn-warning   { background: #d97706; color: #fff; border-color: #d97706; }
.btn-warning:hover   { background: #b45309; color: #fff; }

.btn-ghost { background: transparent; color: var(--primary); border-color: transparent; padding-left: 8px; padding-right: 8px; }
.btn-ghost:hover { background: var(--primary-light); }

.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-xl { padding: 16px 32px; font-size: 1.05rem; }

.btn-icon { width: 34px; height: 34px; padding: 0; }

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

label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .875rem;
    color: var(--text);
    background: #fff;
    transition: var(--transition);
    line-height: 1.5;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,64,175,.1);
}

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(185,28,28,.1); }

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

select.form-control { cursor: pointer; }

.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: 4px; font-weight: 500; }

/* --- Status-Badges ---------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
}

.status-offen          { background: #fee2e2; color: #991b1b; }
.status-zugewiesen     { background: #dbeafe; color: #1e40af; }
.status-in-bearbeitung { background: #fef3c7; color: #92400e; }
.status-beantwortet    { background: #dcfce7; color: #14532d; }
.status-erneut-offen       { background: #ede9fe; color: #5b21b6; }
.status-abgeschlossen      { background: #dcfce7; color: #14532d; }
.status-teilweise          { background: #fff7ed; color: #9a3412; }
.status-neutral            { background: #f1f5f9; color: #475569; }
.status-aktiv              { background: #dcfce7; color: #14532d; }
.status-inaktiv            { background: #f1f5f9; color: #475569; }
.status-bereit-freigabe    { background: #e0f2fe; color: #0c4a6e; }
.status-eingereicht        { background: #fef3c7; color: #78350f; }

/* --- Fälligkeits-Badges ----------------------------------- */
.due-badge { display:inline-block; padding:2px 6px; border-radius:4px; font-size:.75rem; font-weight:600; }
.due-ok      { background:#f0fdf4; color:#166534; border:1px solid #bbf7d0; }
.due-warning { background:#fef9c3; color:#854d0e; border:1px solid #fde047; }
.due-overdue { background:#fef2f2; color:#991b1b; border:1px solid #fca5a5; }

/* --- Tabellen --------------------------------------------- */
.table-responsive { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

thead th {
    background: #f8fafc;
    padding: 10px 14px;
    text-align: left;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

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

tbody tr:hover td { background: #f8fafc; }

.td-muted { color: var(--text-muted); font-size: .82rem; }

/* --- Flash-Messages --------------------------------------- */
.flash-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}

.flash-msg {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: .875rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn .25s ease;
    border: 1px solid transparent;
}

@keyframes slideIn {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0);   opacity: 1; }
}

.flash-success { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.flash-error   { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.flash-info    { background: #dbeafe; color: #1e3a8a; border-color: #bfdbfe; }
.flash-warning { background: #fef3c7; color: #78350f; border-color: #fde68a; }

.flash-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: .6;
    font-size: 16px;
    padding: 0;
    line-height: 1;
}
.flash-close:hover { opacity: 1; }

/* --- Modal ------------------------------------------------ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn .2s ease;
}

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

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 520px;
    width: 100%;
    animation: scaleIn .2s ease;
    overflow: hidden;
}

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

.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title { font-size: 1rem; font-weight: 600; }

.modal-close {
    width: 28px; height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body   { padding: 20px; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: #f8fafc;
}

/* --- Fortschrittsbalken ----------------------------------- */
.progress-wrap {
    background: #e2e8f0;
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    border-radius: 20px;
    background: var(--primary);
    transition: width .4s ease;
}
.progress-bar.bar-success { background: #16a34a; }
.progress-bar.bar-warning { background: #d97706; }
.progress-bar.bar-danger  { background: #dc2626; }
.progress-label { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }

/* --- Statistik-Karten (Dashboard) ------------------------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    border-color: #cbd5e1;
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon-blue   { background: var(--primary-light);  color: var(--primary); }
.stat-icon-green  { background: var(--success-light);  color: var(--success); }
.stat-icon-orange { background: var(--warning-light);  color: var(--warning); }
.stat-icon-red    { background: var(--danger-light);   color: var(--danger); }
.stat-icon-purple { background: #ede9fe;               color: #6d28d9; }

.stat-info .value {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
    color: var(--text);
}

.stat-info .label {
    font-size: .8rem;
    color: var(--text-muted);
}

/* --- Leere-Zustands-Anzeige ------------------------------- */
.empty-state {
    text-align: center;
    padding: 56px 20px;
    color: var(--text-muted);
}
.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: .4;
}
.empty-state h3 { color: var(--text); margin-bottom: 8px; font-size: 1.1rem; }
.empty-state p  { font-size: .875rem; max-width: 320px; margin: 0 auto 20px; }

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

/* --- Grid ------------------------------------------------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* --- Utilities -------------------------------------------- */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: .82rem; }
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Login-Seite ------------------------------------------ */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #1e40af 100%);
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo .logo-icon {
    width: 54px;
    height: 54px;
    background: var(--primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    margin: 0 auto 12px;
}

.auth-logo h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.auth-logo p {
    font-size: .8rem;
    color: var(--text-muted);
    margin: 0;
}

.auth-errors {
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 18px;
}
.auth-errors li {
    font-size: .82rem;
    color: #991b1b;
    list-style: none;
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .page-content { padding: 16px; }
    .stat-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
    .auth-card { padding: 28px 20px; }
}

/* --- Missing vars aliases (dashboard/questionnaire compat) -- */
:root {
    --border-color:   #e2e8f0;
    --border-light:   #f1f5f9;
    --bg-secondary:   #f8fafc;
    --bg-hover:       #f1f5f9;
    --text-primary:   #1e293b;
    --text-secondary: #475569;
    --shadow-md:      0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

/* --- Toast ------------------------------------------------- */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: 360px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    background: #1e293b;
    color: #f1f5f9;
    padding: .75rem 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .25s, transform .25s;
    pointer-events: all;
    max-width: 100%;
    font-size: .875rem;
    line-height: 1.4;
}

.toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-hiding {
    opacity: 0;
    transform: translateY(8px);
}

.toast-success { border-left: 3px solid #22c55e; }
.toast-error   { border-left: 3px solid #ef4444; }
.toast-warning { border-left: 3px solid #f59e0b; }
.toast-info    { border-left: 3px solid #38bdf8; }

.toast-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: .05rem;
}

.toast-msg {
    flex: 1;
    word-break: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: .8rem;
    padding: 0;
    flex-shrink: 0;
    line-height: 1;
}

.toast-close:hover { color: #f1f5f9; }

/* --- Modal ------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 8000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity .2s;
}

.modal-visible { opacity: 1; }

.modal-dialog {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    overflow: hidden;
    transform: translateY(-8px);
    transition: transform .2s;
}

.modal-visible .modal-dialog { transform: translateY(0); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: .2rem .4rem;
    border-radius: var(--radius);
}

.modal-close:hover { background: var(--bg-secondary); }

.modal-body {
    padding: 1.25rem 1.5rem;
    font-size: .95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    padding: .875rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* --- Extra status badges ----------------------------------- */
.status-badge.status-teilweise_bearbeitet { background:#fef9c3; color:#854d0e; }
.status-badge.status-abgeschlossen        { background:#dcfce7; color:#166534; }
.status-badge.status-teilweise_erneut_offen { background:#ede9fe; color:#5b21b6; }
.status-badge.status-in-bearbeitung       { background:#fef3c7; color:#92400e; }
.status-badge.status-aktiv                { background:#dcfce7; color:#166534; }
.status-badge.status-inaktiv              { background:#f1f5f9; color:#64748b; }
.status-badge.status-neutral              { background:#f1f5f9; color:#64748b; }
.status-badge.status-bereit-freigabe      { background:#e0f2fe; color:#0c4a6e; }
.status-badge.status-eingereicht          { background:#fef3c7; color:#78350f; }

/* --- Inline form helper ------------------------------------ */
.inline-form { display:inline; }

/* --- Card grid --------------------------------------------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.card-footer {
    padding: .75rem 1rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: .4rem;
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* --- Form control sm --------------------------------------- */
.form-control-sm {
    padding: .3rem .6rem;
    font-size: .82rem;
}

/* --- Btn lg ------------------------------------------------ */
.btn-lg {
    padding: .7rem 1.6rem;
    font-size: 1rem;
}

/* --- Import ------------------------------------------------ */
.import-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 900px) { .import-layout { grid-template-columns: 1fr; } }

.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    position: relative;
}

.dropzone:hover, .dropzone-active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.dropzone-has-file {
    border-color: var(--success);
    background: #f0fdf4;
}

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.dropzone-icon {
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: .5rem;
}

.dropzone-text {
    font-size: .9rem;
    color: var(--text-secondary);
    margin-bottom: .25rem;
}

.dropzone-hint {
    font-size: .78rem;
    color: var(--text-muted);
    margin: 0;
}

.file-info-box {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .75rem;
    padding: .5rem .75rem;
    background: #f0fdf4;
    border-radius: var(--radius);
    border: 1px solid #bbf7d0;
    font-size: .875rem;
}

.import-help {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

.import-help h4 {
    font-size: .85rem;
    margin-bottom: .4rem;
    color: var(--text-secondary);
}

.import-help p {
    font-size: .83rem;
    margin-bottom: .4rem;
}

.mapping-grid {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.mapping-row {
    display: grid;
    grid-template-columns: 1fr 30px 1fr;
    align-items: center;
    gap: .5rem;
    padding: .6rem 0;
    border-bottom: 1px solid var(--border-light);
}

.mapping-row:last-child { border-bottom: none; }

.mapping-col-name {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    font-size: .9rem;
}

.mapping-arrow {
    color: var(--text-muted);
    text-align: center;
    font-size: 1.1rem;
}

.mapping-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.preview-table {
    font-size: .82rem;
}

.preview-table th {
    min-width: 100px;
    max-width: 200px;
}

.preview-table td {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-col-header {
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.badge-type {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 4px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: .75rem;
    font-weight: 700;
    font-family: monospace;
}


/* --- Audit / Filter ---------------------------------------- */
.filter-form {}
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .75rem;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
}

.pagination-info {
    font-size: .875rem;
    color: var(--text-muted);
}

.audit-details-row td {
    font-size: .78rem;
}

/* --- Page subtitle ----------------------------------------- */
.page-subtitle {
    color: var(--text-muted);
    font-size: .875rem;
    margin-top: .2rem;
}
