/* ============================================================
   WebTrader Pro - Component Library
   ============================================================ */

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
    padding: 8px 16px; font-family: var(--font); font-size: var(--fs-sm); font-weight: var(--fw-medium);
    line-height: 1; border-radius: var(--radius-md); border: 1px solid transparent;
    cursor: pointer; transition: all var(--tr-fast); white-space: nowrap; user-select: none;
    text-decoration: none;
}
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-primary {
    background: var(--accent); color: white; border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: var(--glow-blue); }
.btn-primary:active { background: var(--accent-active); }
.btn-secondary {
    background: transparent; color: var(--accent-text); border-color: var(--border-secondary);
}
.btn-secondary:hover { background: var(--accent-subtle); border-color: var(--accent); }
.btn-success {
    background: var(--profit); color: white; border-color: var(--profit);
}
.btn-success:hover { background: #059669; box-shadow: var(--glow-green); }
.btn-danger {
    background: var(--loss); color: white; border-color: var(--loss);
}
.btn-danger:hover { background: #dc2626; box-shadow: var(--glow-red); }
.btn-ghost {
    background: transparent; color: var(--text-secondary); border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-sm  { padding: 5px 10px; font-size: var(--fs-xs); }
.btn-lg  { padding: 12px 24px; font-size: var(--fs-md); }
.btn-xl  { padding: 14px 32px; font-size: var(--fs-lg); }
.btn-icon { padding: 8px; min-width: 34px; }
.btn-icon.btn-sm { padding: 5px; min-width: 26px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.btn-group .btn:last-child  { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.btn-group .btn + .btn { margin-left: -1px; }

/* ============ INPUTS ============ */
.form-group { margin-bottom: var(--sp-4); }
.form-label {
    display: block; margin-bottom: var(--sp-1); font-size: var(--fs-xs);
    font-weight: var(--fw-medium); color: var(--text-secondary); text-transform: uppercase;
    letter-spacing: 0.05em;
}
.input {
    width: 100%; padding: 9px 12px; font-family: var(--font); font-size: var(--fs-sm);
    color: var(--text-primary); background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-md); transition: all var(--tr-fast); outline: none;
}
.input::placeholder { color: var(--text-tertiary); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.input:disabled { opacity: 0.5; cursor: not-allowed; }
.input-sm { padding: 6px 10px; font-size: var(--fs-xs); }
.input-lg { padding: 12px 16px; font-size: var(--fs-md); }
.input-error { border-color: var(--loss); }
.input-error:focus { box-shadow: 0 0 0 3px var(--loss-bg); }
.input-group { display: flex; }
.input-group .input { border-radius: 0; }
.input-group .input:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.input-group .input:last-child  { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.input-group-prepend, .input-group-append {
    display: flex; align-items: center; padding: 0 12px; font-size: var(--fs-sm);
    color: var(--text-secondary); background: var(--bg-tertiary); border: 1px solid var(--border);
    white-space: nowrap;
}
.input-group-prepend { border-right: 0; border-radius: var(--radius-md) 0 0 var(--radius-md); }
.input-group-append  { border-left: 0; border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.input-with-icon { position: relative; }
.input-with-icon .input { padding-left: 36px; }
.input-with-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); pointer-events: none; }

.select {
    width: 100%; padding: 9px 32px 9px 12px; font-family: var(--font); font-size: var(--fs-sm);
    color: var(--text-primary); background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-md); cursor: pointer; outline: none;
    appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    transition: all var(--tr-fast);
}
.select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }

.checkbox-wrapper { display: flex; align-items: center; gap: var(--sp-2); cursor: pointer; }
.checkbox {
    width: 16px; height: 16px; border: 1px solid var(--border-secondary); border-radius: var(--radius-sm);
    background: var(--bg-input); cursor: pointer; appearance: none; transition: all var(--tr-fast);
    position: relative;
}
.checkbox:checked { background: var(--accent); border-color: var(--accent); }
.checkbox:checked::after {
    content: ''; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px;
    border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

.toggle {
    width: 40px; height: 22px; border-radius: var(--radius-full); background: var(--border-secondary);
    cursor: pointer; position: relative; appearance: none; transition: background var(--tr-fast);
    border: none;
}
.toggle::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
    border-radius: 50%; background: white; transition: transform var(--tr-fast);
}
.toggle:checked { background: var(--accent); }
.toggle:checked::after { transform: translateX(18px); }

.form-error { font-size: var(--fs-xs); color: var(--loss); margin-top: var(--sp-1); }
.form-hint  { font-size: var(--fs-xs); color: var(--text-tertiary); margin-top: var(--sp-1); }

textarea.input { resize: vertical; min-height: 80px; }

/* ============ CARDS ============ */
.card {
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg);
    overflow: hidden;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between; padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--border);
}
.card-header h3, .card-header h4 { font-size: var(--fs-md); margin: 0; }
.card-body { padding: var(--sp-5); }
.card-footer { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); }
.card-compact .card-header, .card-compact .card-footer { padding: var(--sp-3) var(--sp-4); }
.card-compact .card-body { padding: var(--sp-4); }
.card-hover { transition: all var(--tr-normal); }
.card-hover:hover { border-color: var(--accent); box-shadow: var(--glow-blue); transform: translateY(-1px); }

/* ============ TABLES ============ */
.table-container { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; }
.table th {
    padding: 10px 16px; font-size: var(--fs-xs); font-weight: var(--fw-semibold);
    color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em;
    background: var(--bg-tertiary); border-bottom: 1px solid var(--border);
    text-align: left; white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.table td {
    padding: 10px 16px; font-size: var(--fs-sm); border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr { transition: background var(--tr-fast); }
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr:last-child td { border-bottom: none; }
.table-striped tbody tr:nth-child(even) { background: var(--bg-tertiary); }
.table-compact th, .table-compact td { padding: 6px 12px; }
.table .col-number { text-align: right; font-family: var(--font-mono); }
.table .col-center { text-align: center; }
.table .col-actions { text-align: right; white-space: nowrap; }
.table .sortable { cursor: pointer; user-select: none; }
.table .sortable:hover { color: var(--text-primary); }

/* ============ BADGES ============ */
.badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
    font-size: var(--fs-xs); font-weight: var(--fw-medium); border-radius: var(--radius-full);
    line-height: 1.5; white-space: nowrap;
}
.badge-success { background: var(--profit-bg); color: var(--profit); }
.badge-danger  { background: var(--loss-bg); color: var(--loss); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); }

.status-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.status-dot-success { background: var(--profit); }
.status-dot-danger  { background: var(--loss); }
.status-dot-warning { background: var(--warning); }
.status-dot-info    { background: var(--info); }
.status-dot-neutral { background: var(--text-tertiary); }
.status-dot-pulse { animation: pulseDot 2s ease-in-out infinite; }

/* ============ MODAL ============ */
.modal-overlay {
    position: fixed; inset: 0; background: var(--bg-modal); display: flex;
    align-items: center; justify-content: center; z-index: var(--z-modal-bg);
    animation: fadeIn 0.15s ease; padding: var(--sp-4);
}
.modal {
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl); width: 100%; animation: slideUp 0.2s ease;
    max-height: 90vh; display: flex; flex-direction: column;
}
.modal-sm { max-width: 400px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: var(--fs-lg); }
.modal-body { padding: var(--sp-6); overflow-y: auto; flex: 1; }
.modal-footer {
    display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border);
}
.modal-close {
    display: flex; align-items: center; justify-content: center; width: 32px; height: 32px;
    border: none; background: transparent; color: var(--text-tertiary); cursor: pointer;
    border-radius: var(--radius-md); font-size: 18px; transition: all var(--tr-fast);
}
.modal-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
    background: var(--bg-secondary); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; z-index: var(--z-sticky);
    transition: width var(--tr-normal);
}
.sidebar-collapsed,
.app-layout.collapsed .sidebar { width: var(--sidebar-collapsed-w); overflow: hidden; }
.sidebar-collapsed .sidebar-item-text,
.sidebar-collapsed .sidebar-section-title,
.app-layout.collapsed .sidebar-title,
.app-layout.collapsed .sidebar-user-info,
.app-layout.collapsed .nav-section-title,
.app-layout.collapsed .nav-item span,
.app-layout.collapsed .sidebar-item-text,
.app-layout.collapsed .sidebar-section-title { display: none; }
.sidebar-collapsed .sidebar-logo-text,
.app-layout.collapsed .sidebar-logo-text { display: none; }

.sidebar-logo {
    display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--border); height: var(--header-h); flex-shrink: 0;
}
.sidebar-logo-icon { width: 32px; height: 32px; flex-shrink: 0; }
.sidebar-logo-text { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--accent-text); white-space: nowrap; }

.sidebar-nav {
    flex: 1; overflow-y: auto; padding: var(--sp-3);
}
.sidebar-section-title {
    font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 0.08em; padding: var(--sp-4) var(--sp-3) var(--sp-2);
}
.sidebar-item {
    display: flex; align-items: center; gap: var(--sp-3); padding: 9px var(--sp-3);
    border-radius: var(--radius-md); color: var(--text-secondary); cursor: pointer;
    transition: all var(--tr-fast); text-decoration: none; margin-bottom: 2px;
    font-size: var(--fs-sm); font-weight: var(--fw-medium); position: relative;
}
.sidebar-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.sidebar-item.active {
    background: var(--accent-subtle); color: var(--accent-text);
    border-left: 3px solid var(--accent);
}
.sidebar-item-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.sidebar-item-text { white-space: nowrap; }
.sidebar-item-badge {
    margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
    font-size: 10px; font-weight: var(--fw-bold); background: var(--loss);
    color: white; border-radius: var(--radius-full); display: flex;
    align-items: center; justify-content: center;
}
.sidebar-divider { height: 1px; background: var(--border); margin: var(--sp-2) var(--sp-3); }

.sidebar-footer {
    padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); flex-shrink: 0;
}

/* ============ TOPBAR ============ */
.topbar {
    height: var(--header-h); background: var(--bg-secondary); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 var(--sp-5); position: sticky; top: 0; z-index: var(--z-sticky);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: var(--sp-3); }
.topbar-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.topbar-search {
    position: relative; width: 280px;
}
.topbar-search .input { border-radius: var(--radius-full); padding-left: 36px; background: var(--bg-tertiary); border-color: transparent; }
.topbar-search .input:focus { background: var(--bg-input); border-color: var(--accent); }
.topbar-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); }

.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }
.topbar-btn {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border: none; background: transparent; color: var(--text-secondary); cursor: pointer;
    border-radius: var(--radius-md); position: relative; transition: all var(--tr-fast);
}
.topbar-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.topbar-btn .notification-dot {
    position: absolute; top: 6px; right: 6px; width: 8px; height: 8px;
    background: var(--loss); border-radius: 50%; border: 2px solid var(--bg-secondary);
}

.topbar-avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--accent-subtle);
    display: flex; align-items: center; justify-content: center; font-size: var(--fs-sm);
    font-weight: var(--fw-semibold); color: var(--accent-text); cursor: pointer;
    border: 2px solid var(--border); transition: border-color var(--tr-fast);
}
.topbar-avatar:hover { border-color: var(--accent); }

/* ============ DROPDOWN ============ */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; top: calc(100% + 4px); right: 0; min-width: 200px;
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); z-index: var(--z-dropdown); animation: slideDown 0.15s ease;
    padding: var(--sp-1);
}
.dropdown-item {
    display: flex; align-items: center; gap: var(--sp-2); padding: 8px 12px;
    font-size: var(--fs-sm); color: var(--text-primary); cursor: pointer;
    border-radius: var(--radius-sm); transition: background var(--tr-fast);
}
.dropdown-item:hover { background: var(--bg-tertiary); }
.dropdown-item-danger { color: var(--loss); }
.dropdown-item-danger:hover { background: var(--loss-bg); }
.dropdown-divider { height: 1px; background: var(--border); margin: var(--sp-1) 0; }

/* ============ TOAST ============ */
.toast-container {
    position: fixed; top: var(--sp-4); right: var(--sp-4); display: flex;
    flex-direction: column; gap: var(--sp-3); z-index: var(--z-toast);
    pointer-events: none; max-width: 400px;
}
.toast {
    display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-4);
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); animation: slideInRight 0.3s ease; pointer-events: auto;
    border-left: 3px solid var(--border);
}
.toast-success { border-left-color: var(--profit); }
.toast-error   { border-left-color: var(--loss); }
.toast-warning { border-left-color: var(--warning); }
.toast-info    { border-left-color: var(--accent); }
.toast-message { flex: 1; font-size: var(--fs-sm); }
.toast-close {
    background: none; border: none; color: var(--text-tertiary); cursor: pointer;
    padding: 0; font-size: 16px; line-height: 1;
}
.toast-close:hover { color: var(--text-primary); }

/* ============ LOADING ============ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-quaternary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; width: 100%; margin-bottom: var(--sp-2); }
.skeleton-text:last-child { width: 60%; }
.skeleton-circle { border-radius: 50%; }
.skeleton-rect { border-radius: var(--radius-md); }

.spinner {
    width: 24px; height: 24px; border: 2.5px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }

.loading-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,0.3); display: flex;
    align-items: center; justify-content: center; z-index: 10; border-radius: inherit;
    backdrop-filter: blur(2px);
}

/* ============ TABS ============ */
.tabs { display: flex; border-bottom: 1px solid var(--border); gap: 0; }
.tab-item {
    padding: 10px 16px; font-size: var(--fs-sm); font-weight: var(--fw-medium);
    color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent;
    transition: all var(--tr-fast); white-space: nowrap;
}
.tab-item:hover { color: var(--text-primary); }
.tab-item.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tab-content { padding-top: var(--sp-4); }

/* ============ PAGINATION ============ */
.pagination { display: flex; align-items: center; gap: var(--sp-1); }
.page-item {
    min-width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    font-size: var(--fs-sm); border-radius: var(--radius-md); cursor: pointer;
    color: var(--text-secondary); transition: all var(--tr-fast); border: 1px solid transparent;
}
.page-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.page-item.active { background: var(--accent); color: white; }
.page-item.disabled { opacity: 0.4; cursor: not-allowed; }

/* ============ EMPTY STATE ============ */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: var(--sp-12) var(--sp-6); text-align: center;
}
.empty-state-icon { font-size: 48px; color: var(--text-tertiary); margin-bottom: var(--sp-4); opacity: 0.5; }
.empty-state-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin-bottom: var(--sp-2); }
.empty-state-text  { font-size: var(--fs-sm); color: var(--text-secondary); max-width: 400px; }

/* ============ AVATAR ============ */
.avatar {
    display: flex; align-items: center; justify-content: center; border-radius: 50%;
    font-weight: var(--fw-semibold); background: var(--accent-subtle); color: var(--accent-text);
    flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: var(--fs-xs); }
.avatar-md { width: 36px; height: 36px; font-size: var(--fs-sm); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--fs-md); }
.avatar-xl { width: 64px; height: 64px; font-size: var(--fs-xl); }

/* ============ STAT CARD ============ */
.stat-card {
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-2);
}
.stat-card-label { font-size: var(--fs-xs); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card-value { font-size: var(--fs-2xl); font-weight: var(--fw-bold); font-family: var(--font-mono); }
.stat-card-change { font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.stat-card-change.positive { color: var(--profit); }
.stat-card-change.negative { color: var(--loss); }

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

/* Main content area (supports both .app-main and .main-content) */
.app-main, .main-content {
    flex: 1; margin-left: var(--sidebar-w); transition: margin-left var(--tr-normal);
    display: flex; flex-direction: column; min-height: 100vh;
}
.sidebar-collapsed ~ .app-main,
.sidebar-collapsed ~ .main-content,
.app-layout.collapsed .app-main,
.app-layout.collapsed .main-content { margin-left: var(--sidebar-collapsed-w); }

.app-content, .page-content { flex: 1; padding: var(--sp-6); overflow-y: auto; }

.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--sp-6);
}
.page-header h1, .page-header h2 { margin: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-5); }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--sp-5); }

@media (max-width: 1024px) {
    .app-main, .main-content { margin-left: 0; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .app-content, .page-content { padding: var(--sp-4); }
}

/* ============ SIDEBAR HEADER ============ */
.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 var(--sp-3) 0 0; border-bottom: 1px solid var(--border);
    height: var(--header-h); flex-shrink: 0;
}
.sidebar-header .sidebar-logo {
    border-bottom: none; height: auto; flex-shrink: 0;
}
.sidebar-title {
    font-size: var(--fs-lg); font-weight: var(--fw-bold);
    color: var(--accent-text); white-space: nowrap;
}
.sidebar-collapse-btn {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border: none; background: transparent; color: var(--text-tertiary); cursor: pointer;
    border-radius: var(--radius-md); transition: all var(--tr-fast);
}
.sidebar-collapse-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.sidebar-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

/* ============ SIDEBAR NAV SECTIONS ============ */
.nav-section { margin-bottom: var(--sp-1); }
.nav-section-title {
    font-size: 10px; font-weight: var(--fw-semibold); color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 0.1em;
    padding: var(--sp-4) var(--sp-3) var(--sp-2);
}
.nav-item {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: 9px var(--sp-3); border-radius: var(--radius-md);
    color: var(--text-secondary); cursor: pointer; transition: all var(--tr-fast);
    text-decoration: none; margin-bottom: 1px; font-size: var(--fs-sm);
    font-weight: var(--fw-medium); position: relative; border-left: 3px solid transparent;
}
.nav-item svg { flex-shrink: 0; opacity: 0.7; transition: opacity var(--tr-fast); }
.nav-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
    background: var(--accent-subtle); color: var(--accent-text);
    border-left-color: var(--accent); font-weight: var(--fw-semibold);
}
.nav-item.active svg { opacity: 1; color: var(--accent-text); }

/* ============ SIDEBAR USER ============ */
.sidebar-user {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-2) 0; border-radius: var(--radius-md);
    cursor: pointer; transition: all var(--tr-fast);
}
.sidebar-user:hover { background: var(--bg-tertiary); padding-left: var(--sp-2); padding-right: var(--sp-2); }
.sidebar-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: var(--fs-sm); font-weight: var(--fw-bold); flex-shrink: 0;
    box-shadow: 0 2px 8px var(--accent-glow);
}
.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-name {
    font-size: var(--fs-sm); font-weight: var(--fw-medium);
    color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-email {
    font-size: 10px; color: var(--text-tertiary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ============ TOPBAR EXTRAS ============ */
.topbar-icon-btn {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border: none; background: transparent; color: var(--text-secondary); cursor: pointer;
    border-radius: var(--radius-md); transition: all var(--tr-fast); position: relative;
}
.topbar-icon-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.topbar-divider { width: 1px; height: 24px; background: var(--border); margin: 0 var(--sp-1); }
.page-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--text-primary); }
.lang-badge {
    font-size: 10px; font-weight: var(--fw-bold); color: var(--accent-text);
    background: var(--accent-subtle); padding: 2px 6px; border-radius: var(--radius-sm);
    letter-spacing: 0.05em;
}
.mobile-menu-btn {
    display: none; width: 36px; height: 36px; align-items: center; justify-content: center;
    border: none; background: transparent; color: var(--text-secondary); cursor: pointer;
    border-radius: var(--radius-md); transition: all var(--tr-fast);
}
.mobile-menu-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* ============ LOGIN SCREEN ============ */
.login-overlay {
    position: fixed; inset: 0; z-index: var(--z-max);
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(59,130,246,0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.06) 0%, transparent 50%);
}
.login-card {
    width: 100%; max-width: 400px; padding: var(--sp-8);
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}
.login-logo {
    display: flex; flex-direction: column; align-items: center;
    gap: var(--sp-3); margin-bottom: var(--sp-8);
}
.login-logo h2 {
    font-size: var(--fs-2xl); font-weight: var(--fw-bold);
    color: var(--text-primary); margin: 0;
}
.login-logo p {
    font-size: var(--fs-sm); color: var(--text-tertiary); margin: 0;
}
.login-form .form-group { margin-bottom: var(--sp-4); }
.login-form .form-label {
    display: block; font-size: var(--fs-xs); font-weight: var(--fw-medium);
    color: var(--text-secondary); margin-bottom: var(--sp-1);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.login-form .input {
    width: 100%; padding: 11px 14px; background: var(--bg-tertiary);
    border: 1px solid var(--border); border-radius: var(--radius-md);
    color: var(--text-primary); font-size: var(--fs-sm); transition: all var(--tr-fast);
}
.login-form .input:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle);
    background: var(--bg-input); outline: none;
}
.login-form .btn-primary {
    width: 100%; padding: 12px; font-size: var(--fs-md); font-weight: var(--fw-semibold);
    margin-top: var(--sp-2);
}
.login-error {
    display: none; margin-top: var(--sp-3); padding: var(--sp-3);
    background: var(--loss-bg); border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius-md); color: var(--loss);
    font-size: var(--fs-xs); text-align: center;
}
.login-footer {
    margin-top: var(--sp-6); padding-top: var(--sp-4);
    border-top: 1px solid var(--border); text-align: center;
    font-size: var(--fs-xs); color: var(--text-tertiary);
}

/* ============ MOBILE SIDEBAR ============ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%); z-index: var(--z-modal);
    }
    .mobile-sidebar-open .sidebar {
        transform: translateX(0); box-shadow: var(--shadow-xl);
    }
    .mobile-sidebar-open::before {
        content: ''; position: fixed; inset: 0;
        background: rgba(0,0,0,0.5); z-index: calc(var(--z-modal) - 1);
    }
    .mobile-menu-btn { display: flex; }
    .main-content, .app-main { margin-left: 0; }
}
