/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
    --sidebar-bg:       #1c1c1c;
    --sidebar-hover:    #111;
    --sidebar-text:     #adb5bd;
    --sidebar-active:   #fff;
    --sidebar-width:    250px;
    --accent:           #0d6efd;
    --accent-dark:      #0a58ca;
    --topbar-height:    56px;
    --body-bg:          #f0f2f5;
    --card-shadow:      0 1px 4px rgba(0,0,0,.08);
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
body {
    background: var(--body-bg);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
#wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
#sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform .25s ease;
}

#sidebar .sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

#sidebar .sidebar-brand a {
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: .3px;
}

#sidebar .sidebar-brand small {
    display: block;
    color: var(--sidebar-text);
    font-size: .7rem;
    font-weight: 400;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#sidebar .nav-section {
    padding: 16px 12px 4px;
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #555;
    font-weight: 600;
}

#sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 6px;
    margin: 1px 8px;
    font-size: .875rem;
    transition: background .15s, color .15s;
}

#sidebar .nav-link i {
    font-size: .95rem;
    width: 18px;
    text-align: center;
    opacity: .7;
}

#sidebar .nav-link:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
}

#sidebar .nav-link:hover i,
#sidebar .nav-link.active i {
    opacity: 1;
}

#sidebar .nav-link.active {
    background: var(--accent);
    color: #fff;
}

#sidebar .sidebar-footer {
    margin-top: auto;
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,.08);
}

/* ── Main content ─────────────────────────────────────────────────────────── */
#main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Topbar ───────────────────────────────────────────────────────────────── */
#topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 99;
    gap: 12px;
}

#topbar .topbar-title {
    font-weight: 600;
    font-size: 1rem;
    color: #212529;
    flex: 1;
}

#topbar .topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .875rem;
    color: #495057;
}

#topbar .topbar-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
}

#sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #495057;
    cursor: pointer;
}

/* ── Page body ────────────────────────────────────────────────────────────── */
#page-body {
    padding: 28px 28px 40px;
    flex: 1;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #212529;
    margin: 0;
}

.page-header p {
    color: #6c757d;
    margin: 4px 0 0;
    font-size: .9rem;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    padding: 14px 20px;
    border-radius: 10px 10px 0 0 !important;
}

/* ── Stat cards ───────────────────────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    padding: 20px 22px;
}

.stat-card .stat-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #6c757d;
    font-weight: 600;
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: #212529;
    line-height: 1;
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-icon-blue   { background: rgba(13,110,253,.1); color: var(--accent); }
.stat-icon-green  { background: rgba(25,135,84,.1);  color: #198754; }
.stat-icon-yellow { background: rgba(255,193,7,.15); color: #b78a00; }
.stat-icon-red    { background: rgba(220,53,69,.1);  color: #dc3545; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #6c757d;
    font-weight: 600;
    border-bottom-width: 1px;
}

.table td {
    font-size: .875rem;
    vertical-align: middle;
}

.table-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.table-card .table {
    margin-bottom: 0;
}

.table-card .table thead th {
    background: #fafafa;
    padding: 12px 16px;
}

.table-card .table tbody td {
    padding: 12px 16px;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.badge-buy   { background: rgba(25,135,84,.12);  color: #198754; }
.badge-sell  { background: rgba(220,53,69,.12);  color: #dc3545; }
.badge-hold  { background: rgba(13,110,253,.12); color: #0d6efd; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-label {
    font-weight: 500;
    font-size: .875rem;
    color: #495057;
}

.form-control, .form-select {
    font-size: .875rem;
    border-color: #dee2e6;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13,110,253,.12);
}

/* ── Auth pages ───────────────────────────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--body-bg);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    padding: 36px 40px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo h1 {
    font-size: 1.4rem;
    font-weight: 800;
    color: #212529;
    margin: 0;
}

.auth-logo p {
    color: #6c757d;
    font-size: .85rem;
    margin: 4px 0 0;
}

/* ── Messages ─────────────────────────────────────────────────────────────── */
.message-row {
    cursor: pointer;
    transition: background .12s;
}

.message-row:hover {
    background: #f8f9fa;
}

.message-row.unread td {
    font-weight: 600;
    color: #212529;
}

.message-bubble {
    background: #f0f2f5;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: .875rem;
    line-height: 1.5;
    max-width: 75%;
}

.message-bubble.mine {
    background: var(--accent);
    color: #fff;
    margin-left: auto;
}

.message-meta {
    font-size: .72rem;
    color: #adb5bd;
    margin-top: 4px;
}

.message-meta.mine {
    text-align: right;
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
    border: none;
    border-radius: 8px;
    font-size: .875rem;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    font-size: .875rem;
    font-weight: 500;
    border-radius: 7px;
}

.btn-sm {
    border-radius: 5px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.open {
        transform: translateX(0);
    }

    #main-content {
        margin-left: 0;
    }

    #sidebar-toggle {
        display: block;
    }

    #page-body {
        padding: 16px;
    }
}

/* ── Misc ─────────────────────────────────────────────────────────────────── */
.text-money { font-variant-numeric: tabular-nums; font-weight: 600; }
.cursor-pointer { cursor: pointer; }
.no-data { text-align: center; padding: 48px 0; color: #adb5bd; font-size: .95rem; }
