/* =========================================================
   Global stylesheet — full
   ========================================================= */

:root {
    --brand: #1f4fd8;
    --brand-dark: #1437a0;
    --brand-light: #eaf0ff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e5e7eb;
    --bg: #f5f7fb;
    --card: #ffffff;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --sidebar-bg: #0b1220;
    --sidebar-bg-admin: #111827;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
    --shadow-md: 0 4px 12px rgba(15,23,42,.08);
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink); background: var(--bg);
    font-size: 15px; line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

.btn-primary { background-color: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background-color: var(--brand-dark); border-color: var(--brand-dark); }
.btn { border-radius: 8px; font-weight: 500; }

.btn-icon {
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; background: #f1f5f9; color: #334155;
    border: none; padding: 0;
}
.btn-icon:hover { background: #e2e8f0; color: #0f172a; }

.form-control, .form-select {
    border-radius: 8px; border-color: var(--line); padding: .55rem .75rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(31,79,216,.15);
}
.form-label { font-weight: 500; font-size: .875rem; color: #334155; }

.auth-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1000px 500px at 10% 10%, #eaf0ff 0%, transparent 60%),
        radial-gradient(800px 400px at 90% 90%, #e0f2fe 0%, transparent 60%),
        var(--bg);
}
.auth-card {
    background: var(--card); width: 100%; max-width: 440px;
    padding: 36px 32px; border-radius: var(--radius);
    box-shadow: var(--shadow-md); border: 1px solid var(--line);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font-weight: 700; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--brand); color: #fff; font-size: 15px; letter-spacing: 1px;
}
.brand-mark-dark { background: #0f172a; }
.brand-name { font-size: 1.05rem; color: var(--ink); }
.auth-title { font-size: 1.4rem; margin: 0 0 6px; font-weight: 700; }
.auth-subtitle { color: var(--muted); margin: 0 0 22px; font-size: .92rem; }
.auth-links { display: flex; justify-content: center; gap: 6px; font-size: .9rem; color: var(--muted); }
.alert { border-radius: 10px; font-size: .9rem; }

.demo-banner {
    background: #fef3c7; color: #78350f; text-align: center;
    font-size: .85rem; padding: 6px 12px; border-bottom: 1px solid #fde68a;
}

.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
    width: 240px; flex-shrink: 0; background: var(--sidebar-bg); color: #cbd5e1;
    display: flex; flex-direction: column; padding: 18px 0;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.app-sidebar-admin { background: var(--sidebar-bg-admin); }
.app-sidebar .brand {
    padding: 0 20px 18px; font-weight: 700; color: #fff;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 12px;
}
.side-nav { list-style: none; margin: 0; padding: 0; flex: 1; }
.side-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; color: #cbd5e1; font-size: .92rem;
    border-left: 3px solid transparent; transition: background .15s ease;
}
.side-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.side-nav a.active {
    background: rgba(31,79,216,.18); border-left-color: var(--brand); color: #fff;
}
.side-nav svg { flex-shrink: 0; opacity: .85; }
.side-footer { padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.08); margin-top: 12px; }
.side-logout { display: flex; align-items: center; gap: 8px; color: #94a3b8; font-size: .85rem; }
.side-logout:hover { color: #f87171; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 10px 20px; display: flex; align-items: center;
    justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 20;
}
.topbar-title {
    font-weight: 600; font-size: 1rem; flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-user {
    display: inline-flex; align-items: center; gap: 8px;
    background: #f8fafc; border: 1px solid var(--line); border-radius: 8px;
    padding: 4px 10px 4px 4px; font-size: .88rem; color: #334155;
}
.btn-user:hover { background: #eef2f7; color: #0f172a; }
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--brand); color: #fff; font-weight: 600; font-size: .85rem;
}
.avatar-dark { background: #0f172a; }
.notif-dot {
    position: absolute; top: 4px; right: 4px;
    min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 9px; background: var(--danger); color: #fff;
    font-size: .7rem; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.app-content { padding: 20px; flex: 1; }

.card {
    border-radius: var(--radius); border: 1px solid var(--line);
    box-shadow: var(--shadow-sm); background: #fff;
}
.card-header {
    background: #fff; border-bottom: 1px solid var(--line); font-weight: 600;
    padding: .85rem 1rem; display: flex; align-items: center;
    justify-content: space-between; gap: 10px;
    border-top-left-radius: var(--radius); border-top-right-radius: var(--radius);
}
.card-footer { border-top: 1px solid var(--line); }

.stat-tile {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow-sm); height: 100%;
}
.stat-tile .label {
    font-size: .78rem; text-transform: uppercase;
    color: var(--muted); letter-spacing: .04em;
}
.stat-tile .value { font-size: 1.4rem; font-weight: 700; margin-top: 6px; }
.stat-tile .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.stat-tile .stat-icon {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; background: var(--brand-light); color: var(--brand);
    margin-bottom: 10px;
}

.table { font-size: .9rem; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .85rem; vertical-align: middle; }
.table thead th {
    font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); border-bottom: 1px solid var(--line);
    font-weight: 600; background: #f9fafb;
}
.table-hover > tbody > tr:hover > * { background: #f9fafb; }
.badge { font-weight: 500; padding: .35em .6em; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

.landing { background: #fff; }
.landing-nav { border-bottom: 1px solid var(--line); background: #fff; }
.landing-hero {
    background:
        radial-gradient(800px 400px at 90% 10%, #eaf0ff 0%, transparent 60%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 40px 0 60px;
}
.landing-preview {
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-md); overflow: hidden;
}
.landing-preview-head {
    display: flex; align-items: center; padding: 10px 14px;
    background: #f8fafc; border-bottom: 1px solid var(--line);
}
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.dot-r { background: #ef4444; } .dot-y { background: #f59e0b; } .dot-g { background: #10b981; }
.landing-preview-body { padding: 16px 20px; }
.preview-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid #f1f5f9; font-size: .92rem;
}
.preview-row:last-child { border-bottom: none; }
.landing-features { background: #f8fafc; }
.feature-card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 24px; height: 100%; box-shadow: var(--shadow-sm);
}
.feature-icon {
    font-size: 1.8rem; margin-bottom: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; background: var(--brand-light); border-radius: 10px;
}
.landing-footer { border-top: 1px solid var(--line); background: #fff; }

.layout-admin .app-content { padding: 20px; }
.site-footer { background: #fff; border-top: 1px solid var(--line); margin-top: auto; }

.membership-badge {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 6px 12px; background: var(--brand-light); color: var(--brand);
    border-radius: 999px; font-weight: 600; font-size: .82rem;
    letter-spacing: .03em; text-transform: uppercase;
}
.mini-stat {
    background: #f8fafc; border: 1px solid var(--line);
    border-radius: 8px; padding: 10px 12px; height: 100%;
}
.mini-stat .label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mini-stat .value { font-size: 1rem; font-weight: 600; margin-top: 2px; }

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 14px 16px; border-bottom: 1px solid var(--line); position: relative;
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #f5f8ff; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; font-size: .92rem; }
.notif-message { color: var(--muted); font-size: .85rem; margin-top: 2px; word-break: break-word; }
.notif-mark {
    background: transparent; border: none; color: var(--brand);
    font-size: 1rem; padding: 0 4px; line-height: 1; cursor: pointer;
}
.notif-mark:hover { color: var(--brand-dark); }

.announcement { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.announcement:last-child { border-bottom: none; padding-bottom: 0; }
.announcement:first-child { padding-top: 0; }
.progress { background: #eef2f7; border-radius: 999px; }
.progress-bar { background: var(--brand); }

.category-tabs {
    display: flex; gap: 4px; flex-wrap: wrap;
    border-bottom: 1px solid var(--line); padding-bottom: 0;
}
.category-tab {
    padding: 8px 14px; border-radius: 8px 8px 0 0;
    font-size: .9rem; color: var(--muted); font-weight: 500;
    border-bottom: 2px solid transparent;
}
.category-tab:hover { color: var(--ink); text-decoration: none; }
.category-tab.active {
    color: var(--brand); border-bottom-color: var(--brand);
    background: linear-gradient(180deg, #fff 0%, var(--brand-light) 100%);
}
.live-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--success); font-weight: 500; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.85); } }

.markets-table tr { cursor: default; }
.markets-table tr td:first-child a { color: var(--ink); }
.markets-table tr td:first-child a:hover { color: var(--brand); }

.market-header .card-body { padding: 16px 20px; }
.market-price { font-size: 1.6rem; font-weight: 700; }
.market-price-sm { font-size: 1rem; font-weight: 600; }

.tf-tabs { display: flex; gap: 4px; }
.tf-tab {
    background: transparent; border: 1px solid var(--line);
    color: var(--muted); padding: 4px 10px;
    border-radius: 6px; font-size: .82rem; font-weight: 500; cursor: pointer;
}
.tf-tab:hover { color: var(--ink); border-color: #cbd5e1; }
.tf-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chart-container { width: 100%; height: 460px; position: relative; }
.chart-status { text-align: center; color: var(--muted); font-size: .85rem; padding: 8px 0; min-height: 20px; }
@media (max-width: 900px) { .chart-container { height: 340px; } }

.trade-panel .card-body { padding: 16px; }
.side-toggle { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.side-btn {
    flex: 1; padding: 10px 0; background: #fff; border: none;
    font-weight: 600; color: var(--muted); cursor: pointer; font-size: .9rem;
}
.side-btn:hover { background: #f8fafc; }
.side-btn.active.side-buy { background: var(--success); color: #fff; }
.side-btn.active.side-sell { background: var(--danger); color: #fff; }

.order-summary { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.summary-row { display: flex; justify-content: space-between; font-size: .85rem; padding: 4px 0; color: var(--muted); }
.summary-row .mono { color: var(--ink); font-weight: 500; }

/* KYC */
.kyc-status-icon {
    width: 48px; height: 48px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.4rem; font-weight: 700; color: #fff;
}
.kyc-status-approved { background: var(--success); }
.kyc-status-pending  { background: var(--warning); color: #78350f; }
.kyc-view dt { color: var(--muted); font-weight: 500; font-size: .85rem; }
.kyc-view dd { font-size: .92rem; }
.kyc-benefits { list-style: none; padding-left: 0; margin: 0 0 12px; }
.kyc-benefits li {
    position: relative; padding-left: 22px; margin-bottom: 10px; font-size: .9rem;
}
.kyc-benefits li::before {
    content: "✓"; position: absolute; left: 0; top: 0;
    color: var(--success); font-weight: 700;
}

/* Support */
.support-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-light); color: var(--brand); font-size: 1.1rem;
}
.ticket-thread { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.ticket-msg {
    background: #f8fafc; border: 1px solid var(--line);
    border-radius: 10px; padding: 12px 14px; max-width: 88%;
}
.ticket-msg-user { align-self: flex-start; }
.ticket-msg-admin { align-self: flex-end; background: #eef4ff; border-color: #cdddfa; }
.ticket-msg-head { margin-bottom: 8px; }
.ticket-msg-body { font-size: .92rem; line-height: 1.5; word-wrap: break-word; }
.ticket-msg-attach { margin-top: 10px; }
.ticket-msg-attach a {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .82rem; padding: 4px 10px;
    background: #fff; border: 1px solid var(--line); border-radius: 6px;
    color: var(--brand);
}
.ticket-msg-attach a:hover { background: var(--brand-light); text-decoration: none; }

.sidebar-toggle { display: none; }

@media (max-width: 900px) {
    .app-sidebar {
        position: fixed; top: 0; left: -260px; bottom: 0;
        z-index: 60; transition: left .25s ease; height: 100vh;
    }
    .app-sidebar.open { left: 0; }
    .sidebar-toggle { display: inline-flex; }
    .app-shell.sidebar-open::after {
        content: ""; position: fixed; inset: 0;
        background: rgba(15,23,42,.4); z-index: 55;
    }
    .app-content { padding: 14px; }
    .app-topbar { padding: 10px 14px; }
    .stat-tile .value { font-size: 1.2rem; }
    .market-price { font-size: 1.3rem; }
}

@media (max-width: 575px) {
    .auth-card { padding: 26px 20px; }
    .landing-hero { padding: 24px 0 40px; }
    .display-5 { font-size: 2rem; }
}

.text-muted { color: var(--muted) !important; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); font-size: .92rem; }
.empty-state .empty-icon { font-size: 2rem; display: block; margin-bottom: 8px; opacity: .5; }
/* ---------- Admin queue cards ---------- */
.queue-card {
    display: block;
    padding: 18px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    color: var(--ink);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: transform .12s ease, box-shadow .12s ease;
}
.queue-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--ink);
    text-decoration: none;
}
.queue-card .queue-num { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.queue-card .queue-label {
    font-size: .78rem; text-transform: uppercase;
    color: var(--muted); margin-top: 6px; letter-spacing: .05em;
}
.queue-warning  { border-left-color: var(--warning); }
.queue-danger   { border-left-color: var(--danger); }
.queue-info     { border-left-color: #0ea5e9; }
.queue-primary  { border-left-color: var(--brand); }

.kyc-docs { display: flex; flex-direction: column; gap: 10px; }
.kyc-doc {
    background: #f8fafc; border: 1px solid var(--line);
    border-radius: 8px; padding: 10px 12px;
}
.kyc-doc a { font-weight: 500; }