/*
 * DSGVO Shield — Design System
 * Based on Apple iOS Dark Mode (HIG) color tokens
 * Font: Montserrat 400/500/600/700
 *
 * Apple dark-mode palette reference:
 *   systemBackground         #000000
 *   secondarySystemBackground #1c1c1e
 *   tertiarySystemBackground  #2c2c2e
 *   label                     #ffffff
 *   secondaryLabel            rgba(235,235,245,0.6)
 *   tertiaryLabel             rgba(235,235,245,0.3)
 *   quaternaryLabel           rgba(235,235,245,0.18)
 *   separator                 rgba(84,84,88,0.6)
 *   opaqueSeparator           #38383a
 *   systemFill                rgba(120,120,128,0.36)
 */

:root {
    --accent: #00d4aa;
    --accent-hover: #00bf9a;
    --accent-subtle: rgba(0,212,170,0.12);

    --bg-base: #000000;
    --bg-elevated: #1c1c1e;
    --bg-secondary: #2c2c2e;
    --bg-tertiary: #3a3a3c;
    --bg-hover: rgba(120,120,128,0.16);

    --text-primary: #ffffff;
    --text-secondary: rgba(235,235,245,0.6);
    --text-tertiary: rgba(235,235,245,0.3);
    --text-quaternary: rgba(235,235,245,0.18);

    --separator: rgba(84,84,88,0.6);
    --separator-opaque: #38383a;

    --red: #ff453a;
    --orange: #ff9f0a;
    --yellow: #ffd60a;
    --green: #30d158;
    --blue: #0a84ff;
    --purple: #bf5af2;

    --radius-s: 8px;
    --radius-m: 10px;
    --radius-l: 14px;

    --sidebar-w: 260px;
}

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

body {
    margin: 0;
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,h2,h3,h4,h5,h6 { font-weight: 600; letter-spacing: -0.3px; margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }

a { color: var(--accent); text-decoration: none; transition: opacity .15s; }
a:hover { opacity: .8; }

::selection { background: rgba(0,212,170,0.25); }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-elevated);
    border-right: 1px solid var(--separator-opaque);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform .25s ease;
}

.sidebar-brand {
    padding: 20px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--separator-opaque);
}
.sidebar-brand i { font-size: 22px; color: var(--accent); }
.sidebar-brand span { font-size: 16px; font-weight: 700; letter-spacing: -0.5px; }

.sidebar-user {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--separator-opaque);
}
.sidebar-user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    font-weight: 700;
    font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-tertiary); }

.sidebar-nav { flex: 1; padding: 10px 8px; }

.nav-section { margin-bottom: 4px; }
.nav-section-title {
    font-size: 11px; font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 10px 12px 4px;
}

.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    margin: 1px 0;
    border-radius: var(--radius-s);
    color: var(--text-secondary);
    font-size: 13px; font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-link i { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); opacity: 1; }
.nav-link.active {
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 600;
}

.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: #fff;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 10px; font-weight: 700;
    line-height: 16px;
}

/* ── Layout ────────────────────────────────────────────────── */
.main-container {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}
.main-content {
    padding: 28px 32px;
    max-width: 1200px;
}

/* ── Page Header ───────────────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-weight: 700; }
.page-header p { color: var(--text-secondary); margin-top: 2px; font-size: 13px; }

/* ── Cards ─────────────────────────────────────────────────── */
.card-custom, .card {
    background: var(--bg-elevated);
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-l);
    overflow: hidden;
}
.card-custom .card-header, .card .card-header {
    background: none;
    border-bottom: 1px solid var(--separator-opaque);
    padding: 14px 18px;
    font-size: 14px;
}
.card-custom .card-body, .card .card-body { padding: 18px; }

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-l);
    padding: 18px;
    transition: border-color .2s;
}
.stat-card:hover { border-color: var(--text-quaternary); }
.stat-card .stat-value {
    font-size: 28px; font-weight: 700; line-height: 1;
    margin-bottom: 4px;
}
.stat-card .stat-label {
    font-size: 12px; color: var(--text-secondary); font-weight: 500;
}
.stat-card .stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-s);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}

/* ── Info Box ──────────────────────────────────────────────── */
.info-box {
    background: var(--bg-elevated);
    border: 1px solid var(--separator-opaque);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-m);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex; gap: 10px; align-items: flex-start;
    line-height: 1.5;
}
.info-box i { color: var(--accent); font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.info-box.warning { border-left-color: var(--orange); }
.info-box.warning i { color: var(--orange); }
.info-box.danger { border-left-color: var(--red); }
.info-box.danger i { color: var(--red); }

/* ── Tables ────────────────────────────────────────────────── */
.table { color: var(--text-primary); margin-bottom: 0; }
.table-dark, .table { --bs-table-bg: transparent; --bs-table-color: var(--text-primary); }
.table-custom { --bs-table-bg: transparent; }
.table thead th, .table-custom th {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--separator-opaque);
    color: var(--text-secondary);
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .3px;
    padding: 10px 14px;
}
.table tbody td, .table-custom td {
    border-bottom: 1px solid rgba(84,84,88,0.25);
    padding: 11px 14px;
    vertical-align: middle;
    font-size: 13px;
}
.table tbody tr:hover { background: var(--bg-hover); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    border-radius: var(--radius-s);
    padding: 8px 16px;
    border: none;
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background .15s, opacity .15s;
    line-height: 1.4;
}
.btn:hover { opacity: .85; }
.btn:active { opacity: .7; }
.btn:disabled { opacity: .35; cursor: not-allowed; }

.btn-accent, .btn-primary {
    background: var(--accent);
    color: #000;
}
.btn-accent:hover, .btn-primary:hover { background: var(--accent-hover); color: #000; opacity: 1; }

.btn-secondary, .btn-outline-light {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--separator-opaque);
}
.btn-secondary:hover, .btn-outline-light:hover { background: var(--bg-tertiary); color: #fff; opacity: 1; }

.btn-outline-secondary {
    background: transparent;
    border: 1px solid var(--separator-opaque);
    color: var(--text-secondary);
}
.btn-outline-secondary:hover { background: var(--bg-hover); color: var(--text-primary); opacity: 1; }

.btn-outline-success { background: transparent; border: 1px solid rgba(48,209,88,.4); color: var(--green); }
.btn-outline-success:hover { background: rgba(48,209,88,.1); color: var(--green); opacity: 1; }
.btn-success { background: var(--green); color: #000; }
.btn-success:hover { background: #28c04e; color: #000; opacity: 1; }

.btn-outline-danger { background: transparent; border: 1px solid rgba(255,69,58,.4); color: var(--red); }
.btn-outline-danger:hover { background: rgba(255,69,58,.1); color: var(--red); opacity: 1; }
.btn-danger { background: var(--red); color: #fff; }

.btn-outline-warning { background: transparent; border: 1px solid rgba(255,159,10,.4); color: var(--orange); }
.btn-outline-warning:hover { background: rgba(255,159,10,.1); color: var(--orange); opacity: 1; }
.btn-warning { background: var(--orange); color: #000; }

.btn-outline-info { background: transparent; border: 1px solid rgba(10,132,255,.4); color: var(--blue); }
.btn-outline-info:hover { background: rgba(10,132,255,.1); color: var(--blue); opacity: 1; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    font-size: 11px; font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-block;
}
.bg-primary, .badge-primary { background: rgba(10,132,255,.15) !important; color: var(--blue) !important; }
.bg-success, .badge-success { background: rgba(48,209,88,.15) !important; color: var(--green) !important; }
.bg-danger, .badge-danger { background: rgba(255,69,58,.15) !important; color: var(--red) !important; }
.bg-warning, .badge-warning { background: rgba(255,159,10,.15) !important; color: var(--orange) !important; }
.bg-info, .badge-info { background: rgba(10,132,255,.15) !important; color: var(--blue) !important; }
.bg-secondary, .badge-secondary { background: var(--bg-secondary) !important; color: var(--text-secondary) !important; }
.bg-dark { background: var(--bg-secondary) !important; color: var(--text-primary) !important; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-control, .form-select, textarea {
    background: var(--bg-secondary);
    border: 1px solid var(--separator-opaque);
    color: var(--text-primary);
    border-radius: var(--radius-s);
    padding: 9px 12px;
    font-size: 14px; font-family: inherit;
    transition: border-color .15s;
}
.form-control:focus, .form-select:focus, textarea:focus {
    background: var(--bg-secondary);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(0,212,170,.15);
    outline: none;
}
.form-control::placeholder { color: var(--text-tertiary); }
.form-check-input { background-color: var(--bg-secondary); border-color: var(--separator-opaque); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
label { font-weight: 500; margin-bottom: 4px; color: var(--text-primary); }

/* ── Alerts / Flash ────────────────────────────────────────── */
.flash-container {
    position: fixed; top: 16px; right: 16px;
    z-index: 1050; max-width: 380px;
}
.alert {
    background: var(--bg-elevated);
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-m);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-primary);
}
.alert-success { border-left: 3px solid var(--green); }
.alert-danger { border-left: 3px solid var(--red); }
.alert-warning { border-left: 3px solid var(--orange); }
.alert-info { border-left: 3px solid var(--blue); }
.btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ── Modals ────────────────────────────────────────────────── */
.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-l);
}
.modal-header { border-bottom: 1px solid var(--separator-opaque); padding: 16px 20px; background: none; }
.modal-body { padding: 20px; color: var(--text-primary); }
.modal-footer { border-top: 1px solid var(--separator-opaque); padding: 14px 20px; background: none; }

/* ── Progress Bar ──────────────────────────────────────────── */
.priority-bar, .progress {
    height: 6px; border-radius: 3px;
    background: var(--bg-tertiary);
    overflow: hidden;
}
.priority-bar .fill, .progress-bar {
    height: 100%; border-radius: 3px;
    background: var(--accent);
    transition: width .3s;
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
    text-align: center; padding: 48px 20px;
    color: var(--text-tertiary);
}
.empty-state i { font-size: 40px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 14px; }

/* ── Utilities ─────────────────────────────────────────────── */
.opacity-25 { opacity: .25; }
.opacity-50 { opacity: .5; }
.opacity-75 { opacity: .75; }
.text-accent { color: var(--accent) !important; }
.text-muted { color: var(--text-secondary) !important; }

/* ── Mobile ────────────────────────────────────────────────── */
.mobile-toggle {
    display: none;
    position: fixed; top: 12px; left: 12px;
    z-index: 200;
    width: 40px; height: 40px;
    border-radius: var(--radius-s);
    background: var(--bg-elevated);
    border: 1px solid var(--separator-opaque);
    color: var(--text-primary);
    font-size: 20px;
    align-items: center; justify-content: center;
    cursor: pointer;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: 4px 0 24px rgba(0,0,0,.5);
    }
    .sidebar.show { transform: translateX(0); }
    .main-container { margin-left: 0; }
    .main-content { padding: 16px; padding-top: 60px; }
    .mobile-toggle { display: flex; }
    h1 { font-size: 22px; } h2 { font-size: 20px; }
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-quaternary); }

/* ── Auth Pages (Login/Register) ─────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    padding: 20px;
}
.auth-card {
    max-width: 420px;
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-l);
    padding: 40px;
}
.auth-brand {
    text-align: center;
    margin-bottom: 32px;
}
.auth-brand-icon {
    width: 56px; height: 56px;
    background: var(--accent);
    border-radius: var(--radius-m);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: #000;
    margin: 0 auto 14px;
}
.auth-brand h2 {
    font-size: 22px; font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.auth-brand p {
    color: var(--text-tertiary);
    font-size: 13px; margin-top: 4px;
}
.auth-divider {
    border-top: 1px solid var(--separator-opaque);
    margin: 24px 0;
}
.auth-card .input-group-text {
    background: var(--bg-secondary);
    border: 1px solid var(--separator-opaque);
    color: var(--text-tertiary);
}

/* ── Grid Helpers ─────────────────────────────────────────── */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.grid-2col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
}

/* ── Status Legend ─────────────────────────────────────────── */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}
.status-grid-item .status-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
    font-weight: 500;
}
.status-grid-item p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ── Ring Chart (SVG) ─────────────────────────────────────── */
.ring-chart {
    width: 64px; height: 64px;
    transform: rotate(-90deg);
}
.ring-chart .ring-bg { fill: none; stroke: var(--bg-tertiary); stroke-width: 3; }
.ring-chart .ring-fill { fill: none; stroke: var(--accent); stroke-width: 3; transition: stroke-dasharray .4s; }
