:root {
    --sidebar-w: 220px;
    --sidebar-bg: #1a1e2e;
    --card-radius: 10px;
    --shadow: 0 1px 4px rgba(0,0,0,.08);
}

body { background: #f0f2f5; font-size: .9rem; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed; top: 0; left: 0;
    z-index: 100; overflow-y: auto;
    display: flex; flex-direction: column;
    padding: 1rem .75rem;
}

.sidebar .brand {
    color: #fff; font-size: 1.05rem; font-weight: 700;
    text-decoration: none; display: flex; align-items: center; gap: .5rem;
    padding: .25rem .5rem; margin-bottom: .5rem;
}

.sidebar hr { border-color: rgba(255,255,255,.12); margin: .5rem 0; }

.sidebar .nav-link {
    color: rgba(255,255,255,.65);
    border-radius: 7px; padding: .45rem .75rem;
    transition: all .15s; font-size: .875rem;
}
.sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.1); }
.sidebar .nav-link.active { color: #fff; background: #0d6efd; }

.sidebar-user { font-size: .8rem; color: rgba(255,255,255,.45); padding: .25rem .5rem; }

/* ── Main content ── */
.main-content {
    margin-left: var(--sidebar-w);
    padding: 1.5rem;
    min-height: 100vh;
}

/* ── KPI Cards ── */
.kpi-card {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 1.25rem 1.25rem 1rem;
    border-left: 4px solid transparent;
    box-shadow: var(--shadow);
}
.kpi-card.c-blue   { border-left-color: #0d6efd; }
.kpi-card.c-green  { border-left-color: #198754; }
.kpi-card.c-orange { border-left-color: #fd7e14; }
.kpi-card.c-cyan   { border-left-color: #0dcaf0; }
.kpi-card.c-red    { border-left-color: #dc3545; }
.kpi-card.c-purple { border-left-color: #6f42c1; }

.kpi-label { font-size: .75rem; color: #888; text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 1.55rem; font-weight: 700; line-height: 1.2; margin-top: .2rem; }
.kpi-sub   { font-size: .78rem; color: #6c757d; margin-top: .2rem; }

/* ── Panel / Table Card ── */
.panel {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.panel-header {
    padding: .85rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    display: flex; align-items: center; justify-content: space-between;
}
.panel-body { padding: 1.25rem; }

.panel .table { margin: 0; font-size: .865rem; }
.panel .table thead th { background: #f8f9fa; font-weight: 600; border-bottom: 1px solid #e9ecef; }
.panel .table td, .panel .table th { vertical-align: middle; padding: .6rem .85rem; }

/* ── Badges ── */
.badge-active   { background: #d1fae5; color: #065f46; border-radius: 20px; padding: .2rem .6rem; font-size: .78rem; }
.badge-inactive { background: #f3f4f6; color: #6b7280; border-radius: 20px; padding: .2rem .6rem; font-size: .78rem; }
.badge-open     { background: #dbeafe; color: #1e40af; border-radius: 20px; padding: .2rem .6rem; font-size: .78rem; }
.badge-closed   { background: #f3f4f6; color: #374151; border-radius: 20px; padding: .2rem .6rem; font-size: .78rem; }
.badge-market   { background: #ede9fe; color: #5b21b6; border-radius: 20px; padding: .2rem .6rem; font-size: .78rem; }

/* ── Toast ── */
#toast-container {
    position: fixed; top: 1rem; right: 1rem;
    z-index: 9999; min-width: 280px;
}

/* ── Login page ── */
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1a1e2e 0%, #0d6efd 100%);
}
.login-card { width: 100%; max-width: 440px; border-radius: 14px; box-shadow: 0 8px 32px rgba(0,0,0,.2); }

/* ── Auto-refresh badge ── */
.refresh-badge {
    font-size: .72rem; color: #888;
    display: flex; align-items: center; gap: .3rem;
}
.refresh-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #28a745; animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Misc ── */
.text-danger.fw-semibold, .text-primary.fw-semibold { font-weight: 600 !important; }
.cursor-pointer { cursor: pointer; }
.table-empty-row td { text-align: center; color: #aaa; padding: 2rem; }

@media (max-width: 768px) {
    .sidebar { display: none !important; }
    .main-content { margin-left: 0; }
}
