/* DisProX 2.0 — Design System v2
 * Modernes dunkles ERP-Cockpit, mobile-first, ohne externe Libs.
 * @since 23.05.2026 (Phase D.6)
 */

:root {
    --bg-primary:    #0b1220;
    --bg-secondary:  #121a2c;
    --bg-tertiary:   #0a0f1c;
    --bg-elevated:   #1c2640;
    --bg-hover:      #243049;
    --border:        #1c2640;
    --border-strong: #2c3955;
    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;
    --accent:        #3b82f6;
    --accent-2:      #8b5cf6;
    --accent-hover:  #2563eb;
    --success:       #10b981;
    --warning:       #f59e0b;
    --danger:        #ef4444;
    --info:          #06b6d4;
    --radius-sm:  6px;
    --radius:     10px;
    --radius-lg:  16px;
    --shadow:    0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 20px 40px -8px rgba(0,0,0,0.5);
    --sidebar-width: 260px;
    --header-height: 64px;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', Consolas, monospace;
}

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

html, body {
    height: 100%;
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 0.12s; }
a:hover { color: #60a5fa; }

/* SVG-Icons */
.icon-svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-svg.sm { width: 14px; height: 14px; }
.icon-svg.lg { width: 24px; height: 24px; }
.icon-svg.xl { width: 32px; height: 32px; }

/* ===== LAYOUT ===== */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas: "sidebar header" "sidebar main";
    min-height: 100vh;
}

.app-sidebar {
    grid-area: sidebar;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    overflow-y: auto;
}

.app-header {
    grid-area: header;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    backdrop-filter: blur(8px);
    position: sticky; top: 0; z-index: 10;
}

.app-main {
    grid-area: main;
    padding: 2rem 2rem 3rem;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-primary) 100%);
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; grid-template-areas: "header" "main"; }
    .app-sidebar { display: none; }
    .app-main { padding: 1rem; }
}

/* ===== SIDEBAR ===== */
.sidebar-brand {
    padding: 0 1.25rem;
    display: flex; align-items: center; gap: 0.75rem;
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
    flex-shrink: 0;
}
.sidebar-brand .logo {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.15rem; color: #fff;
    box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}
.sidebar-brand .name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.sidebar-brand .ver { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }

.sidebar-nav { flex: 1; padding: 1.25rem 0.75rem; overflow-y: auto; }
.sidebar-section {
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted); padding: 1rem 0.75rem 0.5rem; font-weight: 700;
}
.sidebar-link {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.55rem 0.75rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}
.sidebar-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.sidebar-link.active {
    background: linear-gradient(90deg, var(--accent), rgba(59,130,246,0));
    color: #fff;
    box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar-link .icon-svg { opacity: 0.85; }
.sidebar-link.active .icon-svg { opacity: 1; }
.sidebar-link .badge { margin-left: auto; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ===== HEADER ===== */
.header-left  { display: flex; align-items: center; gap: 1rem; flex: 1; }
.header-title { font-size: 1.05rem; font-weight: 600; }
.header-search {
    flex: 1; max-width: 400px; position: relative;
}
.header-search input {
    width: 100%;
    padding: 0.5rem 0.85rem 0.5rem 2.2rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
}
.header-search input:focus { outline: none; border-color: var(--accent); }
.header-search .search-icon {
    position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%);
    color: var(--text-muted);
}
.header-actions { display: flex; align-items: center; gap: 0.65rem; }
.header-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: background 0.12s, color 0.12s;
}
.header-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.header-btn .notify-dot {
    position: absolute; top: 8px; right: 8px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}
.user-menu {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.35rem 0.75rem 0.35rem 0.4rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}
.user-avatar {
    width: 28px; height: 28px; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem; color: #fff;
}
.env-tag {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.env-tag.test    { background: rgba(59,130,246,0.18); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.env-tag.production, .env-tag.prod { background: rgba(239,68,68,0.18); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.env-tag.local   { background: rgba(100,116,139,0.18); color: var(--text-secondary); border: 1px solid rgba(100,116,139,0.3); }

/* ===== PAGE / HERO ===== */
.page-hero {
    margin-bottom: 1.5rem;
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
}
.page-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
.page-sub   { color: var(--text-secondary); font-size: 0.95rem; }
.page-actions { display: flex; gap: 0.5rem; }

/* ===== KPI-CARDS ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.kpi {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: transform 0.12s, border-color 0.12s;
}
.kpi:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem; }
.kpi-label { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.kpi-icon {
    width: 36px; height: 36px;
    background: rgba(59,130,246,0.15);
    color: var(--accent);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
}
.kpi-icon.success { background: rgba(16,185,129,0.15); color: var(--success); }
.kpi-icon.warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.kpi-icon.danger  { background: rgba(239,68,68,0.15);  color: var(--danger); }
.kpi-icon.purple  { background: rgba(139,92,246,0.15); color: var(--accent-2); }
.kpi-value { font-size: 1.85rem; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.kpi-foot { margin-top: 0.5rem; font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.4rem; }
.kpi-trend { display: inline-flex; align-items: center; gap: 0.2rem; font-weight: 600; }
.kpi-trend.up   { color: var(--success); }
.kpi-trend.down { color: var(--danger); }
.kpi-trend.flat { color: var(--text-muted); }

/* ===== SECTION-CARDS ===== */
.section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.section-head {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
}
.section-title {
    font-size: 0.95rem; font-weight: 700;
    display: flex; align-items: center; gap: 0.5rem;
}
.section-title .icon-svg { color: var(--accent); }
.section-action { font-size: 0.8rem; color: var(--text-secondary); }
.section-body { padding: 1rem 1.25rem; }
.section-body.tight { padding: 0; }

/* ===== DASHBOARD-GRID ===== */
.dash-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }

/* ===== ACTION-ITEMS ===== */
.action-list { list-style: none; }
.action-item {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 0.9rem;
    transition: background 0.12s;
}
.action-item:last-child { border-bottom: none; }
.action-item:hover { background: rgba(255,255,255,0.02); }
.action-item .ai-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.action-item .ai-icon.warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.action-item .ai-icon.danger  { background: rgba(239,68,68,0.15); color: var(--danger); }
.action-item .ai-icon.info    { background: rgba(6,182,212,0.15); color: var(--info); }
.action-item .ai-body { flex: 1; min-width: 0; }
.action-item .ai-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.15rem; }
.action-item .ai-meta  { font-size: 0.8rem; color: var(--text-muted); }
.action-item .ai-count {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem; font-weight: 600;
    border: 1px solid var(--border-strong);
}

/* ===== QUICK ACTIONS ===== */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 1rem 1.25rem;
}
.quick-action {
    display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
    padding: 0.85rem 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.12s, color 0.12s, transform 0.08s;
}
.quick-action:hover { background: var(--bg-hover); color: var(--text-primary); transform: translateY(-2px); }
.quick-action .icon-svg { color: var(--accent); }

/* ===== ACTIVITY FEED ===== */
.activity-list { list-style: none; }
.activity-item {
    padding: 0.7rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex; gap: 0.85rem;
    font-size: 0.85rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent);
    margin-top: 6px;
    flex-shrink: 0;
}
.activity-dot.success { background: var(--success); }
.activity-dot.warning { background: var(--warning); }
.activity-dot.danger  { background: var(--danger); }
.activity-body { flex: 1; min-width: 0; }
.activity-text { color: var(--text-primary); }
.activity-meta { color: var(--text-muted); font-size: 0.75rem; margin-top: 0.1rem; }

/* ===== MINI CHART (SVG) ===== */
.chart-wrap { padding: 1rem 1.25rem 1.5rem; }
.chart-svg  { width: 100%; height: 140px; }
.chart-bar  { fill: var(--accent); opacity: 0.85; transition: opacity 0.12s; }
.chart-bar:hover { opacity: 1; }
.chart-axis-x { fill: var(--text-muted); font-size: 10px; font-family: var(--font-mono); }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.12s, transform 0.08s, box-shadow 0.12s;
    text-decoration: none;
    font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary    { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(59,130,246,0.25); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary  { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-ghost      { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger     { background: var(--danger); color: #fff; }
.btn-success    { background: var(--success); color: #fff; }
.btn-block      { width: 100%; justify-content: center; }
.btn-lg         { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-sm         { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; margin-bottom: 0.4rem; font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.12s, background 0.12s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.form-help { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-error { font-size: 0.8rem; color: var(--danger); margin-top: 0.3rem; }

/* ===== ALERTS ===== */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: flex; align-items: center; gap: 0.6rem;
}
.alert-info    { background: rgba(6,182,212,0.1);  border-color: var(--info);    color: var(--info); }
.alert-success { background: rgba(16,185,129,0.1); border-color: var(--success); color: var(--success); }
.alert-warn    { background: rgba(245,158,11,0.1); border-color: var(--warning); color: var(--warning); }
.alert-danger  { background: rgba(239,68,68,0.1);  border-color: var(--danger);  color: var(--danger); }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-secondary); }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 0.85rem 1rem; text-align: left; }
.table thead th { background: var(--bg-tertiary); color: var(--text-secondary); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border-strong); }
.table tbody tr { border-bottom: 1px solid var(--border); }
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* ===== AUTH-PAGE ===== */
.auth-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    background:
        radial-gradient(circle at top right, rgba(59,130,246,0.15), transparent 60%),
        radial-gradient(circle at bottom left, rgba(139,92,246,0.12), transparent 50%),
        var(--bg-primary);
}
.auth-card {
    width: 100%; max-width: 420px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}
.auth-brand { text-align: center; margin-bottom: 2rem; }
.auth-brand .logo {
    width: 64px; height: 64px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem; font-weight: 800; color: #fff;
    box-shadow: 0 12px 32px rgba(59,130,246,0.3);
}
.auth-brand h1 { font-size: 1.5rem; margin-bottom: 0.25rem; letter-spacing: -0.02em; }
.auth-brand .sub { color: var(--text-secondary); font-size: 0.9rem; }

/* ===== UTIL ===== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.text-sm { font-size: 0.85rem; }
.badge {
    display: inline-block; padding: 2px 8px;
    border-radius: 999px; font-size: 0.7rem; font-weight: 700;
    letter-spacing: 0.02em;
}
.badge-success { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-warn    { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-info    { background: rgba(6,182,212,0.15); color: var(--info); }
.badge-accent  { background: rgba(59,130,246,0.15); color: var(--accent); }

.empty-state {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}
.empty-state .icon-svg { width: 40px; height: 40px; margin: 0 auto 0.75rem; opacity: 0.5; }
.empty-state .empty-title { color: var(--text-secondary); font-weight: 600; margin-bottom: 0.25rem; }
.empty-state .empty-sub { font-size: 0.85rem; }
