/* ===================================================================
 * BRL Dashboard – frontend theme
 * Inspired by the Cheragh dashboard (dark navy + gold accent + green pills)
 * Fully self-contained; overrides theme styling inside .brl-app only.
 * =================================================================== */

/* =============================================================
 * BRL User Dashboard — modern admin-style cards grid.
 * Typography: system-ui stack (zero external requests, GDPR-safe,
 * renders instantly vs. ~300ms Google Fonts round-trip).
 * ============================================================= */

/* ------------------------------- TOKENS ------------------------------- */
.brl-app {
    --bg:            #0b1424;
    --bg-elev:       #121d33;
    --bg-elev-2:     #17243d;
    --border:        #1f2d49;
    --border-soft:   #1a2740;
    --text:          #e6ecf5;
    --text-dim:      #8b97ad;
    --text-muted:    #5b6780;

    --accent:        #ffd24a;   /* gold */
    --accent-ink:    #1a1506;
    --success:       #22c55e;
    --success-soft:  #0f2a1b;
    --danger:        #ef4444;
    --warning:       #f59e0b;

    --radius:        18px;
    --radius-lg:     22px;
    --radius-pill:   999px;
    --shadow:        0 20px 40px -20px rgba(0,0,0,.55), 0 4px 14px -6px rgba(0,0,0,.4);

    --ff-sans:       system-ui, -apple-system, 'Segoe UI', 'Segoe UI Variable', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --ff-mono:       ui-monospace, 'SF Mono', 'Segoe UI Mono', 'Roboto Mono', Menlo, Consolas, monospace;

    font-family: var(--ff-sans);
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
    position: relative;
    overflow-x: hidden;
}

/* Reset minimums inside the app */
.brl-app *,
.brl-app *::before,
.brl-app *::after { box-sizing: border-box; }

.brl-app h1, .brl-app h2, .brl-app h3, .brl-app h4 {
    font-family: var(--ff-sans);
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    margin: 0;
}
.brl-app p { color: var(--text-dim); line-height: 1.6; }
.brl-app a { color: inherit; text-decoration: none; }
.brl-app button { font-family: inherit; cursor: pointer; }
.brl-app input, .brl-app select, .brl-app textarea {
    font-family: inherit;
    color: var(--text);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    width: 100%;
    outline: none;
    transition: border-color .15s, background .15s;
}
.brl-app input:focus, .brl-app select:focus, .brl-app textarea:focus {
    border-color: var(--accent);
    background: var(--bg-elev-2);
}
.brl-app textarea { resize: vertical; }

/* ============================== SIDEBAR ============================== */
.brl-sidebar {
    background: var(--bg);
    border-right: 1px solid var(--border-soft);
    padding: 30px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.brl-sidebar::-webkit-scrollbar { width: 4px; }
.brl-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.brl-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px 18px;
    border-bottom: 1px solid var(--border-soft);
}
.brl-brand img   { height: 40px; width: auto; }
.brl-brand-mark  {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, #ffab3d 100%);
    color: var(--accent-ink);
    font-weight: 800;
    display: grid; place-items: center;
    font-size: 15px;
    letter-spacing: -.5px;
}
.brl-brand-name {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -.3px;
}

.brl-nav { display: flex; flex-direction: column; gap: 2px; }

.brl-nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--text-dim);
    font-weight: 500;
    font-size: 14.5px;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    transition: all .18s;
    position: relative;
}
.brl-nav-link:hover {
    color: var(--text);
    background: var(--bg-elev);
}
.brl-nav-link.is-active {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    box-shadow: inset 3px 0 0 var(--accent);
}
.brl-nav-icon {
    width: 20px; height: 20px;
    display: inline-flex;
    flex-shrink: 0;
}
.brl-nav-icon svg { width: 100%; height: 100%; }
.brl-nav-label { flex: 1; }
.brl-nav-chevron {
    width: 16px; height: 16px;
    display: inline-flex;
    transition: transform .2s;
    opacity: .6;
}
.brl-nav-chevron svg { width: 100%; height: 100%; }

.brl-nav-group.is-open > .brl-nav-toggle .brl-nav-chevron { transform: rotate(180deg); }
.brl-nav-sub {
    display: none;
    flex-direction: column;
    padding: 4px 0 6px 42px;
    gap: 2px;
}
.brl-nav-group.is-open .brl-nav-sub { display: flex; }
.brl-nav-sublink {
    padding: 9px 12px;
    border-radius: 9px;
    color: var(--text-dim);
    font-size: 13.5px;
    transition: all .15s;
}
.brl-nav-sublink:hover { color: var(--text); background: var(--bg-elev); }

.brl-nav-logout {
    margin-top: auto;
    color: var(--text-muted);
}

/* ================================ MAIN ================================ */
.brl-main {
    padding: 26px 38px 60px;
    position: relative;
    z-index: 1;
    min-width: 0;
}

/* Topbar */
.brl-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
    position: relative;
    z-index: 2;
}
.brl-spacer { flex: 1; }

.brl-icon-btn {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: var(--bg-elev);
    border: 1px solid var(--border-soft);
    color: var(--text-dim);
    display: inline-grid;
    place-items: center;
    transition: all .18s;
}
.brl-icon-btn:hover { color: var(--text); border-color: var(--border); }
.brl-icon-btn svg { width: 18px; height: 18px; }

.brl-user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 6px 6px 18px;
    background: var(--bg-elev);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-pill);
}
.brl-hello { font-size: 14px; color: var(--text-dim); font-weight: 500; }
.brl-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff8a3d 0%, #ff6b6b 100%);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700;
    font-size: 14px;
}

/* Background decorative glyphs */
.brl-bg-deco {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}
.brl-bg-glyph {
    position: absolute;
    width: 480px; height: 480px;
    border-radius: 50%;
    background: radial-gradient(circle at center,
                color-mix(in srgb, var(--accent) 6%, transparent) 0%,
                transparent 60%);
    filter: blur(40px);
}
.brl-bg-glyph-1 { top: -120px;  right: -120px; }
.brl-bg-glyph-2 { bottom: -140px; left: 30%; width: 360px; height: 360px;
    background: radial-gradient(circle at center,
                rgba(34,197,94,.05) 0%, transparent 60%); }
.brl-bg-glyph-3 { top: 40%; left: -100px; width: 300px; height: 300px;
    background: radial-gradient(circle at center,
                rgba(99,102,241,.04) 0%, transparent 60%); }

.brl-content {
    position: relative;
    z-index: 1;
}

/* ============================ WELCOME BLOCK ============================ */
.brl-welcome {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 30px;
    align-items: end;
    margin-bottom: 34px;
}
.brl-eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 10px;
}
.brl-title {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -.8px;
    margin-bottom: 10px;
}
.brl-subtitle { color: var(--text-dim); max-width: 560px; margin: 0; }

.brl-mini-stats {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.brl-mini-stats-row { margin-bottom: 26px; }
.brl-mini-stat {
    background: var(--bg-elev);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 14px 20px;
    min-width: 150px;
}
.brl-mini-stat-accent {
    background: linear-gradient(135deg, var(--bg-elev), var(--bg-elev-2));
    border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 15%, transparent);
}
.brl-mini-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.brl-mini-value { font-size: 22px; font-weight: 700; }
.brl-mini-value small { color: var(--text-muted); font-size: 13px; font-weight: 500; }

/* =========================== FEATURE CARDS =========================== */
.brl-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 22px;
}

.brl-card {
    position: relative;
    background: var(--bg-elev);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 26px;
    overflow: hidden;
    transition: transform .22s, border-color .22s, box-shadow .22s;
    isolation: isolate;
}
.brl-card:hover {
    transform: translateY(-3px);
    border-color: var(--border);
    box-shadow: var(--shadow);
}

/* faded glyph watermark behind the card – matches the Cheragh vibe */
.brl-card-glyph {
    position: absolute;
    right: -30px; bottom: -40px;
    width: 220px; height: 220px;
    color: #1a2b47;
    opacity: .55;
    pointer-events: none;
    z-index: -1;
}
.brl-card-glyph svg { width: 100%; height: 100%; }
.brl-card-glyph-xl { width: 320px; height: 320px; right: -50px; bottom: -60px; }

.brl-card.is-locked { opacity: .82; }
.brl-card.is-locked::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.25) 100%);
    pointer-events: none;
}

.brl-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.brl-card-icon {
    width: 22px; height: 22px;
    color: var(--text-muted);
    display: inline-flex;
}
.brl-card-icon svg { width: 100%; height: 100%; }

.brl-card-title {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.3px;
    margin: 0 0 10px;
}
.brl-card-desc {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.6;
    margin: 0 0 22px;
    min-height: 66px;
}

/* -------- Active / Locked badge (matches green pill in screenshot) -------- */
.brl-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .2px;
}
.brl-badge-active {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid color-mix(in srgb, var(--success) 40%, transparent);
}
.brl-badge-active .brl-dot {
    width: 8px; height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 30%, transparent);
}
.brl-badge-locked {
    background: #1f1915;
    color: var(--warning);
    border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
}
.brl-badge-locked .brl-dot {
    width: 8px; height: 8px;
    background: var(--warning);
    border-radius: 50%;
}
.brl-badge-pending,
.brl-badge-approved,
.brl-badge-paid,
.brl-badge-rejected,
.brl-badge-open,
.brl-badge-answered,
.brl-badge-closed,
.brl-badge-inactive,
.brl-badge-high,
.brl-badge-normal,
.brl-badge-low {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid transparent;
}
.brl-badge-pending   { background: #241c0a; color: var(--warning); border-color: #3b2e0f; }
.brl-badge-approved  { background: #0f1e3a; color: #7ab7ff;        border-color: #1c3566; }
.brl-badge-paid      { background: var(--success-soft); color: var(--success); border-color: #144d2a; }
.brl-badge-rejected,
.brl-badge-closed    { background: #2a1314; color: #ff8080;        border-color: #4b1d1f; }
.brl-badge-open      { background: #0f1e3a; color: #7ab7ff;        border-color: #1c3566; }
.brl-badge-answered  { background: var(--success-soft); color: var(--success); border-color: #144d2a; }
.brl-badge-inactive  { background: #1a1f2a; color: var(--text-muted); }
.brl-badge-high      { background: #2a1314; color: #ff8080; }
.brl-badge-normal    { background: #1f2a41; color: #90a4c9; }
.brl-badge-low       { background: #1a1f2a; color: var(--text-muted); }

/* -------- White pill button (matches Cheragh main action button) -------- */
.brl-pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px 22px;
    background: #fff;
    color: #0b1424 !important;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: -.1px;
    transition: transform .15s, box-shadow .15s, background .15s;
    text-decoration: none;
}
/* Force dark color on ALL children — defeats any theme/global styles
   that might color spans, svgs, strong, etc. white-on-white. */
.brl-pill-btn,
.brl-pill-btn *,
.brl-pill-btn span,
.brl-pill-btn svg,
.brl-pill-btn strong,
.brl-pill-btn i {
    color: #0b1424 !important;
    fill: none !important;
    stroke: #0b1424 !important;
}
.brl-pill-btn:hover {
    transform: translateY(-1px);
    background: #f5f7fb;
    box-shadow: 0 10px 28px -10px rgba(255,255,255,.2);
}
.brl-pill-btn svg { width: 17px; height: 17px; }

.brl-pill-btn-primary,
.brl-pill-btn-primary * {
    background: var(--accent);
    color: var(--accent-ink) !important;
    stroke: var(--accent-ink) !important;
}
.brl-pill-btn-primary { background: var(--accent); }
.brl-pill-btn-primary:hover { background: #ffe07a; }

.brl-pill-btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
}
.brl-pill-btn-ghost:hover { background: var(--bg-elev-2); color: var(--text); }

.brl-pill-btn + .brl-pill-btn { margin-top: 10px; }

/* ============================ PAGE HEAD ============================ */
.brl-page-head { margin-bottom: 28px; }
.brl-crumb {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 10px;
    display: inline-block;
    transition: color .15s;
}
.brl-crumb:hover { color: var(--accent); }

/* ============================ HERO FEATURE CARD ============================ */
.brl-card-hero {
    padding: 40px 38px;
    min-height: 320px;
}
.brl-hero-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.5px;
    margin: 0 0 14px;
}
.brl-hero-desc {
    font-size: 15px;
    color: var(--text-dim);
    max-width: 620px;
    margin: 0 0 26px;
}
.brl-hero-actions { max-width: 340px; }
.brl-lock-note {
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.brl-lock-note p { margin: 0 0 14px; }

/* ============================ BROKERS GRID ============================ */
.brl-brokers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}
.brl-broker-card { padding: 24px; }
.brl-broker-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-soft);
}
.brl-broker-logo {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: #fff;
    padding: 6px;
    object-fit: contain;
}
.brl-broker-logo-placeholder {
    background: linear-gradient(135deg, var(--accent), #ff9800);
    color: var(--accent-ink);
    display: grid; place-items: center;
    font-weight: 800;
    font-size: 20px;
}
.brl-broker-name {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 2px;
}

.brl-def {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 0;
}
.brl-def > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}
.brl-def dt {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
}
.brl-def dd {
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    margin: 0;
}

/* ============================ TABLES (frontend) ============================ */
.brl-card-flat {
    background: var(--bg-elev);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 22px;
}
.brl-card-flat h3 {
    font-size: 16px;
    margin: 0 0 18px;
    letter-spacing: -.2px;
}
.brl-table-wrap { overflow-x: auto; }
.brl-ftable {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.brl-ftable th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .6px;
}
.brl-ftable td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text);
}
.brl-ftable tr:last-child td { border-bottom: none; }
.brl-ftable tr:hover td { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.brl-mono { font-family: var(--ff-mono); font-size: 12.5px; color: var(--text-dim); }
.brl-muted { color: var(--text-muted); font-size: 13px; }

/* ============================ SETTINGS FORM ============================ */
.brl-fgrid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}
.brl-ffield label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 6px;
}
.brl-actions-row {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.brl-actions-row .brl-pill-btn { width: auto; min-width: 180px; }

/* ============================ EMPTY / NOTICES ============================ */
.brl-empty-card {
    background: var(--bg-elev);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 60px 30px;
    text-align: center;
}
.brl-notice {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
    color: var(--text-dim);
    margin-bottom: 18px;
}
.brl-notice-success {
    background: var(--success-soft);
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 30%, transparent);
}

/* ============================ SPLIT LAYOUT ============================ */
.brl-split {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 22px;
}

/* ============================ TICKET LIST ============================ */
.brl-ticket-list {
    list-style: none;
    padding: 0; margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.brl-ticket-list a {
    display: block;
    padding: 16px;
    background: var(--bg-elev-2);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    transition: all .15s;
}
.brl-ticket-list a:hover { border-color: var(--border); transform: translateX(2px); }
.brl-ticket-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.brl-ticket-id {
    font-family: var(--ff-mono);
    font-size: 12px;
    color: var(--text-muted);
}
.brl-ticket-subject { font-weight: 600; margin-bottom: 4px; }

/* ============================ CHAT ============================ */
.brl-chat {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px 0 20px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 20px;
}
.brl-msg {
    padding: 16px 18px;
    border-radius: 16px;
    max-width: 78%;
    position: relative;
}
.brl-msg-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    margin-bottom: 8px;
}
.brl-msg-head strong { font-weight: 600; }
.brl-msg-body { font-size: 14px; line-height: 1.6; }
.brl-msg-body p { margin: 0 0 8px; color: var(--text); }
.brl-msg-body p:last-child { margin: 0; }
.brl-msg-self {
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-elev));
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
    align-self: flex-end;
}
.brl-msg-admin {
    background: var(--bg-elev-2);
    border: 1px solid var(--border-soft);
    align-self: flex-start;
}
.brl-reply textarea { margin-bottom: 14px; }

/* ============================ LOGIN GATE ============================ */
.brl-login-gate {
    max-width: 480px;
    margin: 80px auto;
    padding: 40px;
    background: var(--bg-elev, #121d33);
    border: 1px solid var(--border, #1f2d49);
    border-radius: 22px;
    text-align: center;
    font-family: var(--ff-sans, system-ui, -apple-system, sans-serif);
    color: #e6ecf5;
}
.brl-login-gate h2 { font-size: 24px; margin: 0 0 10px; color: inherit; }
.brl-login-gate p  { color: #8b97ad; margin: 0 0 22px; }
.brl-btn {
    display: inline-block;
    padding: 12px 26px;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
}
.brl-btn-primary { background: #ffd24a; color: #1a1506; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 1100px) {
    .brl-welcome   { grid-template-columns: 1fr; }
    .brl-split     { grid-template-columns: 1fr; }
    .brl-fgrid     { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .brl-app { grid-template-columns: 1fr; }
    .brl-sidebar {
        position: fixed;
        z-index: 60;
        top: 0; left: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform .25s;
    }
    .brl-app[data-sidebar="open"] .brl-sidebar { transform: translateX(0); }
    .brl-main { padding: 20px; }
    .brl-title { font-size: 26px; }
    .brl-cards-grid { grid-template-columns: 1fr; }
}

/* ============================ LIGHT THEME ============================ */
.brl-app[data-theme="light"] {
    --bg:            #f5f7fb;
    --bg-elev:       #ffffff;
    --bg-elev-2:     #eef2f8;
    --border:        #d7dde9;
    --border-soft:   #e7ecf4;
    --text:          #0b1424;
    --text-dim:      #4b5773;
    --text-muted:    #8593ae;
    --success-soft:  #e8f8ee;
}
.brl-app[data-theme="light"] .brl-card-glyph { color: #d7dde9; opacity: .6; }
.brl-app[data-theme="light"] .brl-pill-btn   { background: #0b1424; color: #fff; }
.brl-app[data-theme="light"] .brl-pill-btn:hover { background: #1a2642; }
.brl-app[data-theme="light"] .brl-nav-link.is-active {
    color: #8a6a00;
    background: #fff5d4;
    box-shadow: inset 3px 0 0 var(--accent);
}

/* =============================================================
 * LICENSE BOX — shown on protected feature pages (mm-expert, etc.)
 * ============================================================= */
.brl-license-box {
    margin-top: 24px;
    padding: 28px;
    background: var(--panel, #121d33);
    border: 1px solid var(--border, #1f2d49);
    border-radius: 18px;
}
.brl-license-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.brl-license-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim, #8b97ad);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
}
.brl-license-sub {
    font-size: 13px;
    color: var(--text-muted, #5b6780);
}

.brl-license-key-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 20px;
}
.brl-license-key {
    flex: 1;
    padding: 16px 20px;
    background: var(--bg-3, #152445);
    border: 1px solid var(--border, #1f2d49);
    border-radius: 12px;
    color: var(--accent, #FFD76A);
    font-family: var(--ff-mono, ui-monospace, monospace);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-align: center;
    user-select: all;
}

.brl-license-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 22px;
}
.brl-license-meta-item {
    padding: 14px 16px;
    background: var(--bg-3, #152445);
    border-radius: 10px;
}
.brl-license-meta-label {
    font-size: 11px;
    color: var(--text-muted, #5b6780);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 4px;
}
.brl-license-meta-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text, #e6ecf5);
}

.brl-license-accounts {
    margin: 24px 0;
    padding: 18px;
    background: var(--bg-3, #152445);
    border-radius: 12px;
}
.brl-license-accounts-head {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim, #8b97ad);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 12px;
}
.brl-license-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.brl-license-table th {
    text-align: left;
    padding: 10px 12px;
    color: var(--text-muted, #5b6780);
    font-weight: 500;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-bottom: 1px solid var(--border-soft, #1a2740);
}
.brl-license-table td {
    padding: 12px;
    color: var(--text, #e6ecf5);
    border-bottom: 1px solid var(--border-soft, #1a2740);
}
.brl-license-table tr:last-child td { border-bottom: none; }

.brl-license-empty {
    padding: 16px 18px;
    background: rgba(33, 150, 243, .08);
    border: 1px solid rgba(33, 150, 243, .2);
    border-radius: 10px;
    color: var(--text-dim, #8b97ad);
    font-size: 13.5px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.brl-license-help {
    padding: 16px 18px;
    background: var(--bg-3, #152445);
    border-left: 3px solid var(--accent, #FFD76A);
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--text-dim, #8b97ad);
}
.brl-license-help strong { color: var(--text, #e6ecf5); display: block; margin-bottom: 6px; }
.brl-license-help code {
    background: rgba(255, 215, 106, .1);
    color: var(--accent, #FFD76A);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12.5px;
}

@media (max-width: 640px) {
    .brl-license-meta { grid-template-columns: 1fr; }
    .brl-license-key-row { flex-direction: column; }
}

/* =============================================================
 * SETUP GUIDE — 4-step wizard at /dashboard/?view=setup
 * ============================================================= */
.brl-setup-progress {
    background: var(--panel, #121d33);
    border: 1px solid var(--border, #1f2d49);
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 20px;
}
.brl-setup-progress-bar {
    height: 8px;
    background: var(--bg-3, #152445);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 10px;
}
.brl-setup-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    border-radius: 999px;
    transition: width .35s cubic-bezier(.4,0,.2,1);
}
.brl-setup-progress-text {
    font-size: 13px;
    color: var(--text-dim, #8b97ad);
    font-weight: 500;
}

/* Step card */
.brl-setup-step {
    background: var(--panel, #121d33);
    border: 1px solid var(--border, #1f2d49);
    border-radius: 16px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: border-color .2s;
}
.brl-setup-step.is-done {
    border-color: rgba(34, 197, 94, .35);
}
.brl-setup-step.is-done .brl-setup-step-num {
    background: #22c55e;
    color: #fff;
}
.brl-setup-step-head {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-soft, #1a2740);
}
.brl-setup-step-num {
    width: 40px; height: 40px;
    background: var(--bg-3, #152445);
    color: var(--accent, #FFD76A);
    border-radius: 50%;
    display: grid; place-items: center;
    font-weight: 700;
    font-size: 18px;
    transition: all .25s;
}
.brl-setup-step-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text, #e6ecf5);
    margin: 0 0 3px;
}
.brl-setup-step-desc {
    font-size: 13.5px;
    color: var(--text-dim, #8b97ad);
    margin: 0;
}
.brl-setup-step-check {
    background: transparent;
    border: 2px solid var(--border, #1f2d49);
    width: 38px; height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: grid; place-items: center;
    color: transparent;
    transition: all .2s;
}
.brl-setup-step-check:hover {
    border-color: var(--accent, #FFD76A);
}
.brl-setup-step-check.is-checked {
    background: #22c55e;
    border-color: #22c55e;
    color: #fff;
}
.brl-setup-step-body {
    padding: 22px 24px 24px;
}

.brl-setup-steps-list {
    margin: 12px 0 0;
    padding-left: 22px;
    color: var(--text-dim, #8b97ad);
    font-size: 14px;
    line-height: 1.8;
}
.brl-setup-steps-list strong { color: var(--text, #e6ecf5); }
.brl-setup-steps-list code {
    background: var(--bg-3, #152445);
    color: var(--accent, #FFD76A);
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 12.5px;
    font-family: var(--ff-mono, ui-monospace, monospace);
}

/* Copy-row (big URL/key + copy button) */
.brl-setup-copyrow {
    margin-bottom: 20px;
}
.brl-setup-copyrow-label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-dim, #8b97ad);
    font-weight: 600;
    margin-bottom: 8px;
}
.brl-setup-copyrow-inner {
    display: flex;
    gap: 10px;
    align-items: stretch;
}
.brl-setup-url {
    flex: 1;
    padding: 14px 18px;
    background: var(--bg-3, #152445);
    border: 1px solid var(--border, #1f2d49);
    border-radius: 10px;
    color: #7dd3fc;
    font-family: var(--ff-mono, ui-monospace, monospace);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .5px;
    text-align: center;
    user-select: all;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.brl-setup-url-key {
    color: var(--accent, #FFD76A);
    font-weight: 600;
    letter-spacing: 1.2px;
    font-size: 16px;
}
.brl-setup-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    background: var(--accent, #FFD76A);
    color: #0b1424;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all .15s;
    white-space: nowrap;
}
.brl-setup-copy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 215, 106, .25);
}
.brl-setup-copy-btn.is-copied {
    background: #22c55e;
    color: #fff;
}

/* Visual guide mock */
.brl-setup-visual {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 18px 0;
    padding: 20px;
    background: var(--bg-3, #152445);
    border-radius: 12px;
    flex-wrap: wrap;
    justify-content: center;
}
.brl-setup-mt5 {
    background: #2b3a4a;
    border: 1px solid #3d4d5f;
    border-radius: 8px;
    min-width: 220px;
    max-width: 260px;
    flex: 1;
    overflow: hidden;
    font-size: 12px;
}
.brl-setup-mt5-menu, .brl-setup-mt5-tabs {
    display: flex;
    gap: 10px;
    padding: 8px 12px;
    background: #1f2e3e;
    color: #a0b0c0;
    font-size: 11.5px;
    border-bottom: 1px solid #3d4d5f;
}
.brl-setup-mt5-body {
    padding: 14px;
    color: #d0d8e0;
    min-height: 80px;
}
.brl-setup-mt5-dropdown {
    background: #1a252f;
    border-radius: 4px;
    border: 1px solid #3d4d5f;
    overflow: hidden;
}
.brl-setup-mt5-dropitem {
    padding: 6px 12px;
    font-size: 11.5px;
    border-bottom: 1px solid #2b3a4a;
}
.brl-setup-mt5-dropitem:last-child { border-bottom: none; }
.brl-setup-mt5-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 11.5px;
}
.brl-setup-checkbox {
    color: #22c55e;
    font-size: 14px;
}
.brl-setup-mt5-inputbox {
    background: #1a252f;
    border: 1px solid #3d4d5f;
    border-radius: 4px;
    padding: 6px 10px;
    color: #7dd3fc;
    font-family: var(--ff-mono, ui-monospace, monospace);
    font-size: 11px;
}
.brl-setup-highlight {
    background: rgba(255, 215, 106, .2);
    color: var(--accent, #FFD76A) !important;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}
.brl-setup-arrow {
    font-size: 26px;
    color: var(--accent, #FFD76A);
    font-weight: 300;
}

/* Hints */
.brl-setup-hint {
    margin-top: 16px;
    padding: 14px 18px;
    background: var(--bg-3, #152445);
    border-left: 3px solid var(--accent, #FFD76A);
    border-radius: 6px;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--text-dim, #8b97ad);
}
.brl-setup-hint strong { color: var(--text, #e6ecf5); display: block; margin-bottom: 4px; }
.brl-setup-hint code {
    background: rgba(255, 215, 106, .1);
    color: var(--accent, #FFD76A);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12.5px;
}
.brl-setup-hint ol, .brl-setup-hint ul { margin: 6px 0 0; }
.brl-setup-hint-warn {
    background: rgba(251, 191, 36, .08);
    border-left-color: #fbbf24;
}
.brl-setup-hint-success {
    background: rgba(34, 197, 94, .08);
    border-left-color: #22c55e;
}

/* Done banner */
.brl-setup-done {
    margin-top: 24px;
    padding: 32px;
    background: linear-gradient(135deg, rgba(34, 197, 94, .1), rgba(74, 222, 128, .08));
    border: 1px solid rgba(34, 197, 94, .3);
    border-radius: 18px;
    text-align: center;
}
.brl-setup-done-icon { font-size: 48px; margin-bottom: 8px; }
.brl-setup-done h2 { margin: 0 0 6px; color: var(--text, #e6ecf5); font-size: 22px; }
.brl-setup-done p { color: var(--text-dim, #8b97ad); margin: 0; }

@media (max-width: 640px) {
    .brl-setup-step-head { grid-template-columns: 40px 1fr auto; padding: 16px; gap: 12px; }
    .brl-setup-step-body { padding: 18px 16px; }
    .brl-setup-copyrow-inner { flex-direction: column; }
    .brl-setup-visual { flex-direction: column; }
    .brl-setup-arrow { transform: rotate(90deg); }
}

/* =============================================================
 * FULL-PAGE FIX — when dashboard shortcode renders inside a page,
 * the theme's <body>/<main>/<footer> often leave empty corners.
 * We force the body background to match the app so there are no
 * white gaps when the app height is shorter than viewport.
 * ============================================================= */
body.page-brl-dashboard,
body:has(.brl-app) {
    background: #0b1424 !important;
    margin: 0;
}
body:has(.brl-app) .entry-content,
body:has(.brl-app) .site-main,
body:has(.brl-app) main,
body:has(.brl-app) .content-area {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    background: #0b1424;
}

/* Make sure the app itself stretches to at least full viewport */
.brl-app {
    min-height: 100vh;
    width: 100%;
}

/* If the theme wraps the shortcode in a narrow container, break out */
.brl-app-wrap {
    position: relative;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    background: #0b1424;
}
