:root {
    --bg-dark: #0f111a;
    --bg-panel: rgba(26, 29, 41, 0.6);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.05);
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    --glow: 0 0 20px rgba(99, 102, 241, 0.3);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-footer {
    padding: 16px;
    margin-top: auto;
    border-top: 1px solid var(--border);
}


.logo {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    border-radius: 8px;
    box-shadow: var(--glow);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.nav-item:hover {
    color: var(--text-main);
    background: var(--glass-bg);
}

.nav-item.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.15);
    border-left: 3px solid var(--primary);
}

.nav-item.active svg {
    opacity: 1;
    color: var(--primary);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

.topbar {
    height: 72px;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 5;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 8px 16px;
    width: 300px;
    transition: all 0.3s ease;
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.search-bar svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    margin-right: 8px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-main);
    outline: none;
    width: 100%;
    font-family: inherit;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.content-area {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.view-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.section-header p {
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.glass {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none !important;
}

.btn.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn.primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}

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

.btn.outline:hover {
    background: var(--glass-bg);
    border-color: rgba(255,255,255,0.2);
}

.action-input {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px 16px;
    border-radius: 8px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    min-width: 240px;
}

.action-input:focus {
    border-color: var(--primary);
}

.no-spin::-webkit-outer-spin-button,
.no-spin::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.no-spin {
    -moz-appearance: textfield;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0,0,0,0.5);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.stat-icon.purple { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }

.stat-info h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-info .stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
}

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th:not(:first-child), 
.data-table td:not(:first-child) {
    text-align: right;
}

.data-table th, .data-table td {
    padding: 16px 24px;
    white-space: nowrap;
}
.data-table td:first-child {
    white-space: normal;
    word-break: break-word;
}
.data-table td {
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #1a1d29;
    box-shadow: 0 1px 0 var(--border);
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: var(--glass-bg);
}

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

.text-center { text-align: center; }

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.status-scale {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-blacklist {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-neutral {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.data-table tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background-color: #1a1d29;
    box-shadow: 0 -1px 0 var(--border);
    font-weight: 700;
}

.search-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.search-clear {
    position: absolute;
    right: 12px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.25rem;
    font-weight: 300;
    line-height: 1;
    display: none;
    transition: color 0.2s;
    user-select: none;
}

.search-clear:hover {
    color: var(--text-main);
}

.search-wrapper input:not(:placeholder-shown) + .search-clear {
    display: block;
}

.btn.full-width {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px;
}

.profile-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-dropdown {
    flex: 1;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 9px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
    cursor: pointer;
    min-width: 0;
}

.profile-dropdown:focus {
    border-color: var(--primary);
}

.btn-profile-dots {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.btn-profile-dots:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.profile-context-menu {
    background: #1e2132;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    margin-top: 6px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.15s ease;
}

.ctx-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: 7px;
    text-align: left;
    transition: background 0.2s;
}

.ctx-menu-item:hover {
    background: var(--glass-bg);
}

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

.ctx-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-box {
    width: 460px;
    max-width: 95vw;
    border-radius: 18px;
    overflow: hidden;
}

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.no-profile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 26, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 900; 
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.no-profile-card {
    width: 420px;
    max-width: 92vw;
    padding: 48px 40px;
    border-radius: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.no-profile-icon {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    margin-bottom: 8px;
}

.no-profile-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.no-profile-card p {
    font-size: 0.9375rem;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 300px;
}

/* Markdown Content */
.markdown-body {
    font-family: var(--font-sans);
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
}
.markdown-body h1 { font-size: 1.5rem; }
.markdown-body h2 { font-size: 1.25rem; }
.markdown-body h3 { font-size: 1.1rem; }
.markdown-body p { margin-bottom: 16px; }
.markdown-body ul, .markdown-body ol {
    margin-bottom: 16px;
    padding-left: 24px;
}
.markdown-body li { margin-bottom: 8px; }
.markdown-body strong { font-weight: 600; color: #fff; }
.markdown-body code {
    background-color: var(--surface);
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.9em;
}
.markdown-body pre {
    background-color: var(--surface);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
}
.markdown-body pre code {
    background-color: transparent;
    padding: 0;
}
