/* ====== Guard Brave — Design System ====== */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #141b2d;
    --bg-card-hover: #1a2340;
    --bg-input: #0d1221;
    --bg-sidebar: #0c1120;
    --border-color: #1e2a3a;
    --border-light: #2a3a4a;
    --accent: #00e5c9;
    --accent-hover: #00ccb3;
    --accent-glow: rgba(0, 229, 201, 0.15);
    --text-primary: #e8eaf0;
    --text-secondary: #8892a4;
    --text-muted: #565e70;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --purple: #a855f7;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
}

button {
    cursor: pointer;
    font-family: var(--font);
}

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

/* ====== SIDEBAR ====== */
.sidebar {
    width: 210px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.sidebar-logo h2 {
    font-size: 15px;
    font-weight: 700;
}

.sidebar-logo span {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    margin-top: -2px;
}

.sidebar-section {
    padding: 12px 10px 4px;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidebar-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.sidebar-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-item .icon {
    font-size: 16px;
    width: 22px;
    text-align: center;
}

.sidebar-badge {
    font-size: 9px;
    padding: 2px 7px;
    background: var(--border-color);
    color: var(--text-muted);
    border-radius: 10px;
    margin-left: auto;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.sidebar-dark-mode {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 6px 12px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.sidebar-user:hover {
    background: var(--bg-card);
}

.sidebar-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #0891b2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #000;
    flex-shrink: 0;
}

.sidebar-user-info {
    font-size: 12px;
    overflow: hidden;
}

.sidebar-user-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    color: var(--text-muted);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu {
    position: absolute;
    bottom: 50px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 4px;
    display: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.user-menu.open {
    display: block;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
}

.user-menu-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.user-menu-item.danger {
    color: var(--danger);
}

/* ====== MAIN CONTENT ====== */
.main-content {
    flex: 1;
    margin-left: 210px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-primary);
}

.project-dropdown {
    position: relative;
}

.project-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.project-dropdown-btn:hover {
    border-color: var(--accent);
}

.project-dropdown-menu {
    position: absolute;
    top: 42px;
    left: 0;
    min-width: 260px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px;
    z-index: 200;
    display: none;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.project-dropdown-menu.open {
    display: block;
}

.project-dropdown-menu input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    margin-bottom: 6px;
    outline: none;
}

.project-dropdown-menu input:focus {
    border-color: var(--accent);
}

.project-option {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.project-option:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.project-option.active {
    background: var(--accent-glow);
    color: var(--accent);
}

.page-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ====== LOGIN ====== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #0f1a2e 0%, #080c14 70%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    text-align: center;
    padding: 20px;
}

.login-logo {
    margin-bottom: 20px;
}

.login-logo .icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 26px;
    font-weight: 700;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 13px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: left;
}

.login-card h3 {
    text-align: center;
    font-size: 16px;
    margin-bottom: 20px;
    font-weight: 600;
}

.login-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ====== FORM ====== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
    font-family: var(--font);
}

.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-wrapper {
    position: relative;
}

.input-wrapper .toggle-pw {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
}

.select {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    font-family: var(--font);
}

.select:focus {
    border-color: var(--accent);
}

.hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.error-msg {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 10px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 12px;
    text-align: center;
}

/* ====== BUTTONS ====== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 6px 10px;
}

.btn-full {
    width: 100%;
}

/* ====== CARDS ====== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-light);
}

/* ====== KPI ====== */
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 800;
}

.kpi-change {
    font-size: 11px;
    margin-top: 2px;
}

.kpi-change.positive {
    color: var(--success);
}

.kpi-change.negative {
    color: var(--danger);
}

.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* ====== TABLE ====== */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

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

/* ====== BADGES ====== */
.badge {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-accent {
    background: var(--accent-glow);
    color: var(--accent);
}

.badge-muted {
    background: rgba(86, 94, 112, 0.2);
    color: var(--text-muted);
}

/* ====== TABS ====== */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.tab {
    padding: 10px 18px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ====== TOGGLE ====== */
.toggle {
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: var(--border-color);
    border: none;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
}

.toggle::after {
    content: '';
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-muted);
    position: absolute;
    top: 3px;
    left: 3px;
    transition: var(--transition);
}

.toggle.active {
    background: var(--accent);
}

.toggle.active::after {
    left: 21px;
    background: #000;
}

/* ====== GRIDS ====== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

@media (max-width: 1024px) {

    .grid-4,
    .grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ====== CHART CONTAINERS ====== */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* ====== PROGRESS BAR ====== */
.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* ====== ALERT ====== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-info {
    background: rgba(0, 229, 201, 0.08);
    border: 1px solid rgba(0, 229, 201, 0.2);
    color: var(--accent);
}

.alert-success {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--success);
}

/* ====== TOAST ====== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--success);
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    z-index: 9999;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    animation: slideInUp 0.3s ease;
}

/* ====== TAG ====== */
.tag-highlight {
    display: inline-flex;
    padding: 3px 10px;
    background: rgba(0, 229, 201, 0.1);
    color: var(--accent);
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
}

/* ====== MODAL ====== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

/* ====== CODE BLOCK ====== */
.code-block {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: var(--accent);
    overflow-x: auto;
    white-space: pre;
    line-height: 1.6;
}

/* ====== HEADER ROW ====== */
.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* ====== ANIMATIONS ====== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease;
}

.animate-slideUp {
    animation: slideInUp 0.3s ease;
}

/* ====== CHECKBOX ====== */
.checkbox {
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background: var(--bg-input);
    cursor: pointer;
    accent-color: var(--accent);
}

/* ====== DONUT ====== */
.donut-chart {
    display: inline-block;
}

/* ====== PAGE SPECIFIC ====== */
.filter-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-bar .input {
    max-width: 400px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}