/* ============================================================================
   BeeMatchr Platform Admin — design system (PA-4 restyle)
   A modern, cohesive admin theme layered over Bootstrap. Amber/honey accent to
   match the BeeMatchr / Pollen brand, dark slate sidebar, light card canvas.
   ============================================================================ */

:root {
    --accent:        #f5b301;   /* honey / pollen */
    --accent-strong: #d99a00;
    --accent-ink:    #3b2f00;

    --bg:        #f6f7f9;       /* app canvas */
    --panel:     #ffffff;       /* cards / panels */
    --ink:       #1f2937;       /* primary text */
    --muted:     #6b7280;       /* secondary text */
    --border:    #e5e7eb;
    --border-strong: #d6dae0;

    --sidebar-bg:   #1f2430;
    --sidebar-bg-2: #181c26;
    --sidebar-ink:  #c7cdd9;
    --sidebar-muted:#8b93a4;

    --ok:    #15803d;  --ok-bg:   #e7f6ec;
    --warn:  #a15c00;  --warn-bg: #fdf1dc;
    --danger:#b42318;  --danger-bg:#fdecea;
    --info:  #1d4ed8;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.10);
    --shadow-md: 0 4px 12px rgba(16,24,40,.08);
}

html, body {
    font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { color: var(--ink); }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- App shell -------------------------------------------------------- */
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 248px;
    flex: 0 0 248px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    color: var(--sidebar-ink);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
    height: 60px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 5;
}
.admin-topbar-brand { font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.admin-topbar-left { display: flex; align-items: center; gap: .6rem; }
.admin-topbar-user { display: flex; align-items: center; gap: 1rem; }
/* Mobile off-canvas nav: hidden on desktop; the burger + scrim appear only in the ≤720px media query.
   Open state is `body.admin-nav-open` (set by adminnav.js). */
.admin-nav-burger { display: none; background: transparent; border: 0; color: var(--muted); padding: 0; }
.admin-nav-scrim { display: none; }
.admin-user-name { font-weight: 600; color: var(--ink); }
.admin-user-name::before {
    content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--ok); margin-right: .5rem; vertical-align: middle;
}
.admin-signout-form { margin: 0; }
.admin-signout-btn {
    background: transparent; border: 1px solid var(--border-strong); color: var(--muted);
    border-radius: var(--radius-sm); padding: .35rem .8rem; font-size: .85rem; cursor: pointer;
}
.admin-signout-btn:hover { background: #f3f4f6; color: var(--ink); }

.admin-content { padding: 1.75rem; max-width: 1240px; width: 100%; }

.admin-auth-shell {
    min-height: 100vh; display: flex; align-items: flex-start; justify-content: center;
    background: linear-gradient(180deg, #fbfbfc 0%, var(--bg) 100%);
}

/* ---- Sidebar brand + nav --------------------------------------------- */
.admin-brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.15rem 1.25rem; color: #fff; font-weight: 700; font-size: 1.05rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.admin-brand .dot {
    width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
    display: inline-flex; align-items: center; justify-content: center; color: var(--accent-ink); font-weight: 800;
}
.admin-nav { display: flex; flex-direction: column; padding: .75rem .6rem; gap: .15rem; }
.admin-nav .nav-link {
    display: flex; align-items: center; gap: .7rem;
    color: var(--sidebar-ink); padding: .6rem .75rem; border-radius: var(--radius-sm);
    font-size: .92rem; line-height: 1; transition: background .12s, color .12s;
}
.admin-nav .nav-link svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.admin-nav .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.admin-nav .nav-link.active {
    background: rgba(245,179,1,.14); color: #fff;
    box-shadow: inset 3px 0 0 var(--accent);
}
.admin-nav .nav-link.active svg { opacity: 1; color: var(--accent); }
.admin-nav-heading {
    color: var(--sidebar-muted); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase;
    padding: 1rem .9rem .35rem;
}

/* ---- Page header ------------------------------------------------------ */
.page-head { margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; margin: 0 0 .2rem; }
.page-head .sub { color: var(--muted); margin: 0; }
.back-link { display: inline-block; color: var(--muted); margin-bottom: .9rem; font-size: .9rem; }

/* ---- Cards / panels --------------------------------------------------- */
.panel {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.25rem 1.35rem; margin-bottom: 1.25rem;
}
.panel h5 { font-size: 1rem; font-weight: 700; margin: 0 0 .75rem; }

/* ---- KPI cards -------------------------------------------------------- */
.kpi-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem;
}
.kpi-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.1rem 1.2rem; display: flex; gap: .9rem; align-items: flex-start;
}
.kpi-icon {
    width: 42px; height: 42px; border-radius: 10px; flex: 0 0 42px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent); color: var(--accent-ink);
}
.kpi-icon svg { width: 22px; height: 22px; }
.kpi-icon.alt { background: #eef2ff; color: #4338ca; }
.kpi-icon.teal { background: #e6f6f4; color: #0f766e; }
.kpi-icon.slate { background: #eef1f5; color: #334155; }
.kpi-body { min-width: 0; }
.kpi-value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.kpi-label { color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.kpi-sub { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.kpi-sub b { color: var(--ink); }

/* ---- Action queue cards ---------------------------------------------- */
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.action-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.1rem 1.2rem; text-decoration: none; color: inherit;
    display: block; transition: box-shadow .12s, transform .12s, border-color .12s;
}
.action-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; border-color: var(--border-strong); }
.action-card .count { font-size: 1.9rem; font-weight: 700; }
.action-card .count.zero { color: var(--muted); }
.action-card .label { color: var(--muted); font-size: .9rem; }
.action-card .go { color: var(--accent-strong); font-size: .82rem; margin-top: .5rem; display: inline-block; }
.action-card.attn { border-left: 3px solid var(--accent); }

/* ---- Growth pulse ----------------------------------------------------- */
.pulse-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.pulse-item { text-align: left; }
.pulse-item .v { font-size: 1.35rem; font-weight: 700; }
.pulse-item .l { color: var(--muted); font-size: .82rem; }

/* ---- Revenue chart ---------------------------------------------------- */
.chart-legend { display: flex; gap: 1.25rem; margin: .25rem 0 .9rem; font-size: .82rem; color: var(--muted); }
.chart-legend .key { display: inline-flex; align-items: center; gap: .4rem; }
.chart-legend .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.swatch.company { background: var(--accent); }
.swatch.candidate { background: #475569; }
.bar-company { fill: var(--accent); }
.bar-candidate { fill: #475569; }
/* candidate funnel lines */
.line-joined { stroke: var(--accent); stroke-width: 2; } .line-joined-dot { fill: var(--accent); }
.line-onboarded { stroke: #475569; stroke-width: 2; } .line-onboarded-dot { fill: #475569; }
.line-company { stroke: var(--accent); stroke-width: 2; } .line-company-dot { fill: var(--accent); }
.line-candidate { stroke: #475569; stroke-width: 2; } .line-candidate-dot { fill: #475569; }
.email-hit { fill: transparent; cursor: pointer; }
.email-hit:hover { fill: rgba(15, 23, 42, 0.05); }
.email-hit.sel { fill: rgba(15, 23, 42, 0.10); }
.line-real { stroke: #0f766e; stroke-width: 2; } .line-real-dot { fill: #0f766e; }
.chart-axis { stroke: var(--border-strong); stroke-width: 1; }
.chart-mlabel { fill: var(--muted); font-size: 12px; }
.chart-mlabel.sel { fill: var(--ink); font-weight: 700; }   /* email-health: highlight the drilled-into day */
.chart-vlabel { fill: var(--ink); font-size: 11px; font-weight: 600; }
/* revenue total-revenue trend line (rides above the grouped bars) + value gridlines + HKD scale */
.line-total { stroke: #0f766e; stroke-width: 2.5; } .line-total-dot { fill: #0f766e; }
.chart-grid { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.chart-glabel { fill: var(--muted); font-size: 10px; }
.chart-legend .swatch.total { height: 3px; background: #0f766e; }

/* ---- Tables ----------------------------------------------------------- */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel);
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table thead th {
    background: #fafbfc; color: var(--muted); font-weight: 600; font-size: .78rem;
    text-transform: uppercase; letter-spacing: .04em; padding: .7rem 1rem; text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table tbody td { padding: .8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .right { text-align: right; }

/* ---- Status pills ----------------------------------------------------- */
.pill { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 600; line-height: 1.4; }
.pill--success { background: var(--ok-bg); color: var(--ok); }
.pill--warn { background: var(--warn-bg); color: var(--warn); }
.pill--danger { background: var(--danger-bg); color: var(--danger); }
.pill--muted { background: #eef1f5; color: #475569; }

/* ---- Description lists ------------------------------------------------ */
.kv { display: grid; grid-template-columns: 180px 1fr; row-gap: .55rem; column-gap: 1rem; margin: 0; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; color: var(--ink); }

/* ---- Buttons (refine Bootstrap) -------------------------------------- */
.btn { border-radius: var(--radius-sm); font-weight: 600; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover, .btn-primary:focus { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn-success { background: var(--ok); border-color: var(--ok); }
.btn-success:hover { background: #126b34; border-color: #126b34; }
.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 .2rem rgba(245,179,1,.35);
}

/* ---- Forms ------------------------------------------------------------ */
.form-control, .form-select { border-radius: var(--radius-sm); border-color: var(--border-strong); }
.form-label { font-weight: 600; font-size: .85rem; color: var(--ink); }

/* ---- Auth card (login) ----------------------------------------------- */
.auth-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-md); padding: 2rem; width: 100%; max-width: 400px; margin-top: 12vh;
}
.auth-card h3 { font-size: 1.25rem; font-weight: 700; }
.auth-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: .25rem; }
.auth-brand .dot { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }

/* ---- Empty / alert states -------------------------------------------- */
.empty-state { background: var(--panel); border: 1px dashed var(--border-strong); border-radius: var(--radius);
    padding: 2rem; text-align: center; color: var(--muted); }
.alert { border-radius: var(--radius-sm); border: none; }
.alert-success { background: var(--ok-bg); color: var(--ok); }
.alert-warning { background: var(--warn-bg); color: var(--warn); }
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-info { background: #e8f0fe; color: var(--info); }

/* ---- Tabs + filter bar (audit log) ----------------------------------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.1rem; }
.tabs .tab {
    background: none; border: none; padding: .6rem 1rem; font-weight: 600; color: var(--muted);
    cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs .tab:hover { color: var(--ink); }
.tabs .tab.active { color: var(--accent-strong); border-bottom-color: var(--accent); }

.filter-bar { display: flex; flex-wrap: wrap; gap: .65rem; align-items: end; margin-bottom: 1rem; }
.filter-bar .f { display: flex; flex-direction: column; gap: .2rem; }
.filter-bar label { font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.filter-bar .form-control, .filter-bar .form-select { min-width: 160px; }
.result-count { color: var(--muted); font-size: .85rem; margin: .4rem 0 0; }
.load-more { text-align: center; margin-top: 1rem; }
.muted-cell { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---- Platform settings ------------------------------------------------ */
.setting-row {
    display: grid; grid-template-columns: 1fr 340px; gap: 1rem; align-items: center;
    padding: .95rem 0; border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-name { font-weight: 600; }
.setting-key { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.setting-edit { display: flex; gap: .5rem; }
.setting-edit .form-control, .setting-edit .form-select { flex: 1; }
.setting-status { grid-column: 1 / -1; font-size: .85rem; margin-top: -.25rem; }
.setting-status.ok { color: var(--ok); }
.setting-status.err { color: var(--danger); }
@media (max-width: 720px) { .setting-row { grid-template-columns: 1fr; } }

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 920px) {
    .kpi-grid, .pulse-grid { grid-template-columns: repeat(2, 1fr); }
    .action-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    /* Off-canvas sidebar: slide in from the left when the toggle is checked; tap the scrim (or a nav link) to close. */
    .admin-nav-burger {
        display: inline-flex; align-items: center; justify-content: center;
        cursor: pointer; color: var(--muted); padding: .25rem; margin-left: -.25rem;
    }
    .admin-nav-burger svg { width: 22px; height: 22px; }
    .admin-sidebar {
        position: fixed; top: 0; left: 0; height: 100vh; z-index: 50;
        transform: translateX(-100%); transition: transform .22s ease;
        box-shadow: 2px 0 18px rgba(0, 0, 0, .28);
    }
    body.admin-nav-open .admin-sidebar { transform: translateX(0); }
    body.admin-nav-open .admin-nav-scrim {
        display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .45);
    }
    .kv { grid-template-columns: 1fr; row-gap: .15rem; }
    .kv dt { margin-top: .5rem; }
}

/* ---- Blazor error UI (kept) ------------------------------------------ */
.blazor-error-boundary {
    background: #b32121; padding: 1rem 1rem 1rem 1rem; color: white; border-radius: var(--radius-sm);
}
.blazor-error-boundary::after { content: "An error has occurred." }
.validation-message { color: var(--danger); }
