@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    --rc-primary: #2563EB;
    --rc-primary-dark: #1D4ED8;
    --rc-secondary: #14B8A6;
    --rc-bg: #F8FAFC;
    --rc-card: #FFFFFF;
    --rc-text: #0F172A;
    --rc-text2: #64748B;
    --rc-border: #E2E8F0;
    --rc-success: #16A34A;
    --rc-error: #DC2626;
    --rc-soft-primary: #EFF6FF;
    --rc-soft-secondary: #F0FDFA;
    --rc-soft-success: #F0FDF4;
    --rc-soft-danger: #FEF2F2;
    --rc-soft-warning: #FFFBEB;
    --rc-soft-info: #F0F9FF;
    --rc-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.05);
    /* Height of the top header box (topbar 76px + 1px border) so the
       sidebar logo box stays perfectly equal to it. */
    --rc-statusbar-h: 0px;
    --rc-header-h: calc(76px + 1px);
    /* Re-skin Sash primary to RC blue */
    --primary-rgb: 37, 99, 235;
    --primary: #2563EB;
    --primary-bg-color: rgb(37, 99, 235);
    --primary-bg-hover: rgb(37, 99, 235, 0.9);
    --primary-bg-border: rgb(37, 99, 235);
}

body.app,
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif !important;
    background: var(--rc-bg);
    color: var(--rc-text);
    -webkit-font-smoothing: antialiased;
}

/* ================= Layout offsets ================= */
.page { padding-block-start: 0 !important; }

.app-content {
    margin-inline-start: 260px !important;
}

.app-content .side-app {
    padding-block-start: var(--rc-header-h, 101px) !important;
    padding-inline-end: 1.5rem !important;
    padding-inline-start: 1.5rem !important;
}

/* ================= Sidebar ================= */
.app-sidebar {
    position: fixed !important;
    inset-block-start: 0;
    inset-block-end: 0;
    inset-inline-start: 0;
    width: 260px !important;
    background: var(--rc-card) !important;
    border-inline-end: 1px solid var(--rc-border) !important;
    box-shadow: none !important;
    padding-block-start: 0 !important;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1001 !important;
    display: block !important;
    -webkit-transition: transform 300ms ease;
    transition: transform 300ms ease;
}

.rc-brand-box {
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--rc-header-h, 77px);
    flex-shrink: 0;
    border-block-end: 1px solid var(--rc-border);
    background: var(--rc-card);
}

.rc-brand-box a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    text-decoration: none;
}

.rc-brand-box img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    object-position: center;
}

.rc-nav {
    padding: 0.75rem 0.9rem 1.5rem;
}

.rc-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--rc-text2);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 10px;
    margin-block-end: 2px;
    transition: all 0.18s;
}

.rc-nav-link:hover {
    background: var(--rc-bg);
    color: var(--rc-primary);
}

.rc-nav-link.active {
    background: var(--rc-soft-primary);
    color: var(--rc-primary);
    font-weight: 600;
}

.rc-nav-link i { width: 18px; text-align: center; font-size: 15px; }

.rc-nav-group { margin-block-end: 2px; }

.rc-nav-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    background: none;
    border: 0;
    color: var(--rc-text2);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.18s;
}

.rc-nav-toggle:hover { background: var(--rc-bg); color: var(--rc-primary); }

.rc-nav-toggle i.rc-ic { width: 18px; text-align: center; font-size: 15px; }

.rc-nav-toggle i.rc-angle {
    margin-left: auto;
    font-size: 11px;
    transition: transform 0.2s;
    color: var(--rc-text2);
}

.rc-nav-group.open .rc-nav-toggle { color: var(--rc-primary); font-weight: 600; }
.rc-nav-group.open .rc-nav-toggle i.rc-angle { transform: rotate(90deg); }

.rc-nav-sub {
    display: none;
    padding: 4px 0 6px 36px;
}

.rc-nav-group.open .rc-nav-sub { display: block; }

.rc-nav-sub a {
    display: block;
    color: var(--rc-text2);
    font-size: 13.5px;
    text-decoration: none;
    padding: 7px 10px;
    border-radius: 8px;
    transition: all 0.18s;
}

.rc-nav-sub a:hover { color: var(--rc-primary); background: var(--rc-bg); }
.rc-nav-sub a.active { color: var(--rc-primary); font-weight: 600; }

/* ================= Top header ================= */
.app-header,
.app-header.header {
    border-block-end: 1px solid var(--rc-border) !important;
    background: rgba(255, 255, 255, 0.94) !important;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    inset-inline-start: 260px !important;
    inset-inline-end: 0 !important;
    width: auto !important;
    padding-inline-start: 0 !important;
    padding-block-start: 0 !important;
    padding-block-end: 0 !important;
}

.rc-topbar {
    display: flex;
    align-items: center;
    width: 100%;
    height: 76px;
    padding: 0 1.25rem;
}

.rc-hamburger {
    background: none;
    border: 0;
    color: var(--rc-text);
    font-size: 20px;
    line-height: 1;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    display: none;
}

.rc-hamburger:hover { background: var(--rc-bg); color: var(--rc-primary); }

.rc-top-brand {
    display: none;
    align-items: center;
    text-decoration: none;
    color: var(--rc-text);
    font-weight: 800;
    font-size: 18px;
    margin-inline-start: 6px;
}

.rc-top-brand img { height: 40px; width: auto; }

.rc-top-right {
    margin-inline-start: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.rc-balance {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background: linear-gradient(135deg, #2563EB, #14B8A6);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 9px 16px;
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}

.rc-balance i { font-size: 14px; }

.rc-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 6px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--rc-text);
}

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

.rc-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563EB, #14B8A6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.rc-username { font-size: 14px; font-weight: 600; }

.rc-user i { font-size: 11px; color: var(--rc-text2); }

/* ================= Compact left status group (inside topbar) ================= */
.rc-top-left {
    display: flex;
    align-items: center;
    gap: 14px;
    width: auto;
    min-width: 0;
    margin-inline-start: 14px;
    height: 100%;
}

.rc-sb-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    min-width: 0;
}

.rc-sb-live .rc-sb-row + .rc-sb-row,
.rc-sb-balance .rc-sb-row + .rc-sb-row {
    margin-block-start: 1px;
}

.rc-sb-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.45;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.rc-sb-row i { font-size: 12px; }

.rc-sb-live-buyer { color: #0D9488; text-decoration: none; }
.rc-sb-live-buyer:hover { color: #0F766E; }
.rc-sb-live-seller { color: #DC2626; text-decoration: none; }
.rc-sb-live-seller:hover { color: #B91C1C; }

.rc-sb-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.12);
    animation: rcPulse 1.6s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes rcPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.rc-sb-balance .rc-sb-row small {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.35px;
    color: var(--rc-text2);
    min-width: 92px;
}

.rc-sb-balance .rc-sb-row b {
    font-size: 13.5px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.rc-sb-buyer-bal b { color: #0D9488; }
.rc-sb-seller-bal b { color: #DC2626; }

.rc-sb-div {
    width: 1px;
    background: var(--rc-border);
    margin: 7px 14px;
    flex-shrink: 0;
}

/* ================= Footer ================= */
.rc-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    padding: 1.25rem;
    font-size: 13px;
    color: var(--rc-text2);
    border-block-start: 1px solid var(--rc-border);
    background: var(--rc-card);
}

.rc-footer a {
    color: #016766;
    font-weight: 600;
    text-decoration: none;
    margin: 0 6px;
    transition: color 0.2s ease;
}

.rc-footer a:hover {
    color: #01504F;
    text-decoration: underline;
}

/* ================= Page header / breadcrumb ================= */
.page-header {
    background: transparent !important;
    padding: 0 !important;
    min-height: 0 !important;
    margin: 0 0 1.25rem !important;
    border: 0 !important;
}

.page-title {
    font-size: 22px !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    color: var(--rc-text) !important;
    text-transform: none !important;
}

.page-header .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 13px;
}

.page-header .breadcrumb a { color: var(--rc-primary); text-decoration: none; }
.page-header .breadcrumb .active { color: var(--rc-text2); }

/* ================= Cards ================= */
.card {
    border: 1px solid var(--rc-border) !important;
    border-radius: 14px !important;
    background: var(--rc-card) !important;
    box-shadow: var(--rc-shadow) !important;
}

.card .card-header {
    background: var(--rc-card) !important;
    border-block-end: 1px solid var(--rc-border) !important;
    border-radius: 14px 14px 0 0 !important;
}

.card-title { font-weight: 700 !important; color: var(--rc-text) !important; }

.card h6 { font-weight: 700; font-size: 13px; color: var(--rc-text2); letter-spacing: 0.2px; }

.card h3 { font-weight: 800; letter-spacing: -0.01em; }

/* ================= Buttons ================= */
.btn-primary {
    background: linear-gradient(135deg, #2563EB, #14B8A6) !important;
    border: 0 !important;
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
    border-radius: 10px;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.35);
}

.btn-brand {
    background: linear-gradient(135deg, #2563EB, #14B8A6) !important;
    border: 0 !important;
    color: #fff !important;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}

.btn-brand:hover { background: linear-gradient(135deg, #1D4ED8, #0D9488) !important; color: #fff !important; }

.btn-outline-success { border-radius: 10px; font-weight: 600; }
.btn-light { border-radius: 10px; }
.btn { border-radius: 10px; font-weight: 600; }

/* ================= Forms ================= */
.form-control,
.form-select {
    border: 1px solid var(--rc-border) !important;
    border-radius: 10px !important;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
}

.form-control:focus,
.form-select:focus {
    border-color: #2563EB !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

.form-label { font-weight: 600; font-size: 13px; color: var(--rc-text); }

/* ================= Tables ================= */
.table {
    color: var(--rc-text) !important;
    font-size: 13.5px;
}

.table thead th {
    background: #F1F5F9 !important;
    color: #475569;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-color: var(--rc-border) !important;
    white-space: nowrap;
}

.table td {
    border-color: #EEF2F7 !important;
    vertical-align: middle;
}

.table-hover tbody tr:hover { background: #F8FAFC !important; }

/* ================= Badges ================= */
.badge { border-radius: 999px; font-weight: 600; padding: 5px 11px; font-size: 12px; }

.badge.light-success, .badge.bg-success { background: var(--rc-soft-success) !important; color: var(--rc-success) !important; }
.badge.light-danger, .badge.bg-danger { background: var(--rc-soft-danger) !important; color: var(--rc-error) !important; }
.badge.light-warning, .badge.bg-warning { background: var(--rc-soft-warning) !important; color: #B45309 !important; }
.badge.light-info, .badge.bg-info { background: var(--rc-soft-info) !important; color: #0284C7 !important; }
.badge.light-secondary, .badge.bg-secondary { background: #F1F5F9 !important; color: var(--rc-text2) !important; }

/* ================= Modal ================= */
.modal-content {
    border: 1px solid var(--rc-border);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.modal-header { border-block-end: 1px solid var(--rc-border); }
.modal-footer { border-block-start: 1px solid var(--rc-border); }
.modal-title { font-weight: 700; }

/* ================= Dropdown ================= */
.dropdown-menu {
    border: 1px solid var(--rc-border) !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12) !important;
    padding: 6px !important;
}

.dropdown-item { border-radius: 8px; font-size: 14px; padding: 8px 12px; }
.dropdown-item:hover { background: var(--rc-bg); color: var(--rc-primary); }
.dropdown-item i { color: var(--rc-primary); }

/* ================= Progress ================= */
.progress { border-radius: 999px; background: #EEF2F7; height: 6px; }
.progress-bar { border-radius: 999px; }

/* ================= Misc ================= */
a { color: var(--rc-primary); }
.text-primary { color: var(--rc-primary) !important; }

#global-loader { z-index: 99999; }

.footer.footer { background: transparent; }

/* ================= Responsive ================= */
@media (max-width: 991.98px) {
    body.app .app-sidebar {
        inset-block-start: 0 !important;
        inset-inline-start: 0 !important;
        width: 260px !important;
        transform: translateX(-105%);
        transition: transform 300ms ease;
    }

    body.app.rc-sb-open .app-sidebar {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(15, 23, 42, 0.2) !important;
    }

    .rc-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.5);
        z-index: 1000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 250ms ease;
    }

    body.app.rc-sb-open .rc-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .app-header {
        inset-inline-start: 0 !important;
        width: 100% !important;
    }

    /* On mobile the topbar drops to 64px and Sash .header padding is removed,
       so the header box is 64px + 1px. Keep the logo box equal. */
    :root { --rc-header-h: calc(64px + 1px + var(--rc-statusbar-h)); }

    .app-header .rc-topbar { height: 64px; }

    .rc-hamburger { display: inline-flex; }

    .rc-top-brand { display: inline-flex; }

    .app-content { margin-inline-start: 0 !important; }

    .side-app { padding-block-start: calc(64px + var(--rc-statusbar-h) + 1px) !important; padding-inline-end: 1rem !important; padding-inline-start: 1rem !important; }

    .rc-balance span.rc-bal-label { display: none; }

    .rc-top-left { gap: 8px; margin-inline-start: 8px; }

    .rc-sb-div { margin: 7px 9px; }

    .rc-sb-balance .rc-sb-row small { min-width: 0; }
}

/* ================= Dark mode (RC components) ================= */
body.dark-mode {
    --rc-bg: #0B1120;
    --rc-card: #111827;
    --rc-text: #E5E7EB;
    --rc-text2: #94A3B8;
    --rc-border: #243049;
    --rc-soft-primary: rgba(37, 99, 235, 0.16);
    --rc-soft-success: rgba(22, 163, 74, 0.16);
    --rc-soft-danger: rgba(220, 38, 38, 0.16);
    --rc-soft-warning: rgba(180, 83, 9, 0.18);
    --rc-soft-info: rgba(2, 132, 199, 0.18);
    --rc-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 18px rgba(0, 0, 0, 0.35);
}

body.dark-mode .app-header {
    background: rgba(17, 24, 39, 0.94) !important;
    border-block-end-color: var(--rc-border) !important;
}

body.dark-mode .app-sidebar {
    background: var(--rc-card) !important;
    border-inline-end-color: var(--rc-border) !important;
}

body.dark-mode .table thead th {
    background: #182135 !important;
    color: #94A3B8;
}

body.dark-mode .table td { border-color: #1E293B !important; }
body.dark-mode .dropdown-item:hover { background: #182135; }
body.dark-mode .modal-content { background: var(--rc-card); color: var(--rc-text); }
body.dark-mode .modal-header,
body.dark-mode .modal-footer { border-color: var(--rc-border); }
body.dark-mode .rc-footer { border-block-start-color: var(--rc-border); }
body.dark-mode .rc-footer a { color: #2DD4BF; }
body.dark-mode .rc-footer a:hover { color: #5EEAD4; }
body.dark-mode .form-control,
body.dark-mode .form-select {
    background: #0B1120;
    color: var(--rc-text);
    border-color: var(--rc-border);
}
/* LIVE pages */
.live-topbar { display: flex; align-items: center; gap: 6px; padding: 8px 14px; background: #1E3A8A; color: #fff; border-radius: 6px 6px 0 0; font-size: 13px; margin-bottom: 0; }
.live-topbar a { color: #fff; }
.live-topbar .ms-auto { margin-left: auto; }
.live-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #f44336; animation: livepulse 1s ease-in-out infinite; }
@keyframes livepulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.8); } }
.row-new { animation: rowflash 2.5s ease-out; }
@keyframes rowflash { 0% { background-color: #ffeaa0; } 100% { background-color: transparent; } }

/* LIVE report table (admin style) */
.live-report-wrap table.table { font-size: 12px; }
.live-report-wrap table.table > tbody > tr > td { border-bottom: 1px solid #000 !important; }
.bg-success-bright { background: rgba(29, 196, 74, 0.2) !important; }
.bg-danger-bright { background: rgba(237, 56, 57, 0.2) !important; }
.bg-warning-bright { background: rgba(255, 255, 0, 0.3) !important; }
.bg-primary-bright { background: rgba(37, 83, 156, 0.3) !important; }

/* ===== Theme toggle button ===== */
.rc-theme-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--rc-border);
    background: var(--rc-card);
    color: var(--rc-text2);
    cursor: pointer;
    font-size: 15px;
    margin-right: 4px;
    transition: all 0.2s ease;
}
.rc-theme-btn:hover {
    color: #016766;
    border-color: #016766;
    background: rgba(1, 103, 102, 0.08);
}
body.dark-mode .rc-theme-btn:hover { color: #2DD4BF; border-color: #2DD4BF; background: rgba(45, 212, 191, 0.08); }

/* Compact summary cards - thead override */
.card.sum-card .table thead th {
    background: #F0FDFA !important;
    color: #016766;
    font-size: 11.5px;
    letter-spacing: 0.03em;
}
body.dark-mode .card.sum-card .table thead th {
    background: rgba(1, 103, 102, 0.25) !important;
    color: #5EEAD4;
}
