/* =====================================================================
   CMTI Admin - design system
   ---------------------------------------------------------------------
   Everything the admin area draws is expressed through the custom
   properties on :root below, so a value is defined once and the light
   theme is a re-declaration of the same names rather than a second
   stylesheet. Page-level <style> blocks are expected to use these
   variables too; a hard-coded #0e1526 in one page and a token in the
   next is what made the area look assembled rather than designed.
   ===================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --primary-soft: #a78bfa;
    --cyan: #22d3ee;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;

    --bg: #0b1020;
    --sidebar-bg: #0a0f1e;
    --card-bg: #111a30;
    --surface-2: #0e1526;
    --surface-3: #16203a;
    --input-bg: rgba(255, 255, 255, 0.05);
    --hover: rgba(148, 163, 184, 0.06);
    --track: rgba(148, 163, 184, 0.10);
    --chart-grid: rgba(148, 163, 184, 0.10);

    --text: #e2e8f0;
    --text-strong: #f1f5f9;
    --text-light: #94a3b8;

    --border: rgba(148, 163, 184, 0.16);
    --border-strong: rgba(148, 163, 184, 0.30);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 22px 50px rgba(0, 0, 0, 0.50);
    --shadow-accent: 0 14px 34px rgba(139, 92, 246, 0.18);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --sidebar-w: 268px;
    --sidebar-w-collapsed: 78px;
    --header-h: 62px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light theme. Same names, calmer values. Applied by admin.js before
   first paint from localStorage so the page never flashes dark first. */
[data-theme="light"] {
    --bg: #f2f5fa;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --surface-2: #ffffff;
    --surface-3: #f6f8fc;
    --input-bg: rgba(15, 23, 42, 0.03);
    --hover: rgba(15, 23, 42, 0.035);
    --track: rgba(15, 23, 42, 0.07);
    --chart-grid: rgba(15, 23, 42, 0.08);

    --text: #334155;
    --text-strong: #0f172a;
    --text-light: #64748b;

    --border: rgba(15, 23, 42, 0.10);
    --border-strong: rgba(15, 23, 42, 0.20);
    --shadow: 0 4px 18px rgba(15, 23, 42, 0.07);
    --shadow-lg: 0 20px 44px rgba(15, 23, 42, 0.13);
    --shadow-accent: 0 12px 28px rgba(124, 58, 237, 0.14);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(1000px 500px at 85% -10%, rgba(139, 92, 246, 0.10), transparent 60%), radial-gradient(800px 400px at -10% 40%, rgba(6, 182, 212, 0.07), transparent 55%);
}
[data-theme="light"]::before {
    background: radial-gradient(1000px 500px at 85% -10%, rgba(139, 92, 246, 0.14), transparent 60%), radial-gradient(800px 400px at -10% 40%, rgba(6, 182, 212, 0.10), transparent 55%);
}
body.sidebar-open { overflow: hidden; }

a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { color: var(--text-strong); line-height: 1.3; }
::selection { background: rgba(139, 92, 246, 0.35); }

/* Scrollbars, so a long table does not drag a bright browser default
   across a dark panel. */
* { scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, 0.35) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.28); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.45); background-clip: content-box; }

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    background: var(--card-bg);
    color: var(--text);
    white-space: nowrap;
    transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, #8b5cf6, #06b6d4); color: #fff; border-color: transparent; box-shadow: var(--shadow-accent); }
.btn-primary:hover { background: linear-gradient(135deg, #7c3aed, #22d3ee); color: #fff; }
.btn-success { background: var(--success); color: #06281d; border-color: transparent; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: rgba(139, 92, 246, 0.12); color: var(--primary-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-light); }
.btn-ghost:hover { background: var(--hover); color: var(--text); border-color: transparent; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; border-radius: 9px; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn i { font-size: 0.9em; }

/* Icon-only control used by the theme switch and the sidebar toggle. */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--hover); }
.icon-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.035), transparent);
}
.card-header h2 { font-size: 1.02rem; font-weight: 650; display: flex; align-items: center; gap: 0.6rem; }
.card-header h2 i { color: var(--cyan); font-size: 0.95rem; }
.card-header .sub { font-size: 0.78rem; color: var(--text-light); font-weight: 400; margin-top: 2px; }
.card-body { padding: 1.4rem; }
.card-head-group { display: flex; flex-direction: column; min-width: 0; }

/* ---------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------- */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.8rem 1rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.table thead th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--surface-3);
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
}
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: none; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .sortable { cursor: pointer; user-select: none; }
.table .sortable:hover { color: var(--primary); }
.table .sortable::after { content: '\2195'; opacity: 0.28; margin-left: 6px; font-size: 0.9em; }
.table .sortable.asc::after { content: '\2191'; opacity: 1; color: var(--primary); }
.table .sortable.desc::after { content: '\2193'; opacity: 1; color: var(--primary); }
.row-hidden { display: none; }

/* ---------------------------------------------------------------------
   Badges / pills / chips
   --------------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 0.25rem 0.7rem; border-radius: 9999px; font-size: 0.72rem; font-weight: 600; text-transform: capitalize; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active, .badge-approved { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; }
.badge-revoked, .badge-rejected { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.badge-expired, .badge-pending { background: rgba(251, 191, 36, 0.15); color: #fcd34d; }
.badge-none { background: rgba(148, 163, 184, 0.15); color: var(--text-light); }
[data-theme="light"] .badge-active, [data-theme="light"] .badge-approved { color: #047857; }
[data-theme="light"] .badge-revoked, [data-theme="light"] .badge-rejected { color: #b91c1c; }
[data-theme="light"] .badge-expired, [data-theme="light"] .badge-pending { color: #b45309; }
.badge-no-dot::before { display: none; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.7rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
    background: var(--surface-3);
    color: var(--text-light);
    font-size: 0.74rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.chip b { color: var(--text-strong); font-weight: 700; }
.chip.accent { border-color: rgba(139, 92, 246, 0.35); background: rgba(139, 92, 246, 0.10); color: var(--primary-soft); }
.chip.ok { border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.10); color: #6ee7b7; }
.chip.warn { border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.10); color: #fcd34d; }
.chip.danger { border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.10); color: #fca5a5; }
[data-theme="light"] .chip.ok { color: #047857; }
[data-theme="light"] .chip.warn { color: #b45309; }
[data-theme="light"] .chip.danger { color: #b91c1c; }

/* Filter chips and small status tags shared by the certificate register,
   the enquiry list and anywhere else a row is filtered by status. They live
   here rather than in each page's <style> because the pages that used them
   without redefining them (certificates.php, enquiries.php) rendered four
   bare, unclickable-looking links where the stats should have been. */
.approval-stats { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1.05rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-light);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: transform 0.18s var(--ease), border-color 0.18s, box-shadow 0.18s, color 0.18s;
}
.stat-chip i { font-size: 0.95rem; color: var(--text-light); transition: color 0.18s; }
.stat-chip b { font-size: 1.25rem; font-weight: 750; color: var(--text-strong); line-height: 1; font-variant-numeric: tabular-nums; }
.stat-chip span { white-space: nowrap; }
.stat-chip:hover { transform: translateY(-2px); border-color: var(--primary); color: var(--text); box-shadow: var(--shadow-accent); }
.stat-chip:hover i { color: var(--primary-soft); }
.stat-chip.active { border-color: rgba(139, 92, 246, 0.5); background: linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(6, 182, 212, 0.07)); color: var(--text-strong); }
.stat-chip.active i { color: var(--primary-soft); }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.16rem 0.6rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: var(--surface-3);
    color: var(--text-light);
    white-space: nowrap;
}
.tag.red { border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.12); color: #fca5a5; }
.tag.gold { border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.12); color: #fcd34d; }
.tag.green { border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.12); color: #6ee7b7; }
.tag.blue { border-color: rgba(34, 211, 238, 0.35); background: rgba(34, 211, 238, 0.12); color: #67e8f9; }

.mono { font-family: Consolas, 'SF Mono', monospace; }
code { background: var(--hover); padding: 0.125rem 0.375rem; border-radius: 4px; font-size: 0.8rem; color: var(--text); }
.text-center { text-align: center; }
.danger-text { color: var(--danger) !important; font-weight: 700; }
.muted { color: var(--text-light); }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------------
   Forms / alerts
   --------------------------------------------------------------------- */
.alert { padding: 0.9rem 1.1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.875rem; display: flex; align-items: flex-start; gap: 0.6rem; }
.alert-error, .alert-danger { background: rgba(248, 113, 113, 0.12); color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.35); }
.alert-success { background: rgba(52, 211, 153, 0.12); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.35); }
[data-theme="light"] .alert-error, [data-theme="light"] .alert-danger { color: #b91c1c; }
[data-theme="light"] .alert-success { color: #047857; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; font-size: 0.875rem; margin-bottom: 0.375rem; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--input-bg);
    color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2); }
.form-group small { display: block; font-size: 0.75rem; color: var(--text-light); margin-top: 0.25rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   Login
   --------------------------------------------------------------------- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(1000px 600px at 80% -10%, rgba(139, 92, 246, 0.25), transparent 60%), radial-gradient(900px 500px at 0% 110%, rgba(6, 182, 212, 0.2), transparent 55%), linear-gradient(150deg, #070b1a 0%, #111a30 100%);
}
[data-theme="light"] .login-page { background: radial-gradient(1000px 600px at 80% -10%, rgba(139, 92, 246, 0.20), transparent 60%), radial-gradient(900px 500px at 0% 110%, rgba(6, 182, 212, 0.16), transparent 55%), linear-gradient(150deg, #eef2fa 0%, #ffffff 100%); }
.login-container { width: 100%; max-width: 420px; padding: 1rem; }
.login-box { background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 2.5rem; }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-logo { width: 72px; height: 72px; border-radius: 16px; object-fit: contain; background: #fff; padding: 6px; margin-bottom: 1rem; }
.login-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-strong); }
.login-header p { color: var(--text-light); font-size: 0.875rem; }
.login-form .form-group { margin-bottom: 1.25rem; }
.login-footer { text-align: center; margin-top: 1.5rem; font-size: 0.75rem; color: var(--text-light); }

/* ---------------------------------------------------------------------
   App chrome: header + sidebar
   --------------------------------------------------------------------- */
.admin-header {
    background: var(--card-bg);
    background: color-mix(in srgb, var(--card-bg) 82%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    min-height: var(--header-h);
    padding: 0.6rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-left, .header-right { display: flex; align-items: center; gap: 0.85rem; }
.header-left { min-width: 0; }
.header-brand { display: flex; align-items: center; gap: 0.7rem; color: var(--text-strong); font-weight: 650; font-size: 0.95rem; }
.header-brand small { display: block; font-size: 0.68rem; font-weight: 500; color: var(--text-light); letter-spacing: 0.08em; text-transform: uppercase; }
.header-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: #fff; padding: 3px; flex-shrink: 0; }
.header-clock { font-size: 0.78rem; color: var(--text-light); font-variant-numeric: tabular-nums; white-space: nowrap; }
.header-clock b { color: var(--text-strong); font-weight: 600; }
.header-user { display: flex; align-items: center; gap: 0.55rem; font-size: 0.85rem; color: var(--text); }
.header-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 0.78rem; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    flex-shrink: 0;
}
.header-sep { width: 1px; height: 26px; background: var(--border); }
.sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; background: none; border: none; font-size: 1.15rem; cursor: pointer; color: var(--text); padding: 0.35rem; border-radius: 8px; }
.sidebar-toggle:hover { background: var(--hover); }
.nav-collapse-icon { display: none; }
@media (min-width: 861px) {
    .nav-open-icon { display: none; }
    .nav-collapse-icon { display: inline-block; }
    body.sidebar-collapsed .nav-collapse-icon { transform: rotate(180deg); }
}

.admin-layout { position: relative; z-index: 1; display: flex; min-height: calc(100vh - var(--header-h)); align-items: stretch; }
.admin-content { flex: 1; padding: 1.5rem; min-width: 0; }
.admin-content > h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.25rem; }

.admin-sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 1.1rem 0.8rem 1.4rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
    transition: width 0.25s var(--ease), transform 0.25s var(--ease);
}
.sidebar-brand { display: none; }
.sidebar-nav { list-style: none; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sidebar-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-light); padding: 0.9rem 0.75rem 0.4rem; font-weight: 700; }
.sidebar-nav li a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.62rem 0.75rem;
    color: var(--text-light);
    font-size: 0.87rem;
    font-weight: 500;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.sidebar-nav li a i { width: 20px; text-align: center; font-size: 0.95rem; flex-shrink: 0; }
.sidebar-nav li a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-nav li a:hover { background: var(--hover); color: var(--text-strong); }
.sidebar-nav li a.active {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.18), rgba(139, 92, 246, 0.02));
    color: var(--text-strong);
    border-color: rgba(139, 92, 246, 0.28);
    font-weight: 600;
}
.sidebar-nav li a.active i { color: var(--primary-soft); }
.sidebar-badge {
    min-width: 20px; height: 20px; padding: 0 6px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9999px; font-size: 0.68rem; font-weight: 700;
    background: rgba(251, 191, 36, 0.18); color: #fcd34d;
    font-variant-numeric: tabular-nums;
}
[data-theme="light"] .sidebar-badge { color: #b45309; }
.sidebar-badge.zero { background: transparent; color: transparent; }
.sidebar-foot { padding: 0.9rem 0.75rem 0; border-top: 1px solid var(--border); font-size: 0.7rem; color: var(--text-light); display: flex; justify-content: space-between; gap: 0.5rem; }
.sidebar-foot b { color: var(--text); font-weight: 600; }

body.sidebar-collapsed .admin-sidebar { width: var(--sidebar-w-collapsed); padding-left: 0.6rem; padding-right: 0.6rem; }
body.sidebar-collapsed .sidebar-nav li a { justify-content: center; padding-left: 0; padding-right: 0; }
body.sidebar-collapsed .sidebar-nav li a span,
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-foot { display: none; }
body.sidebar-collapsed .sidebar-badge { position: absolute; margin: 0; transform: translate(14px, -12px); min-width: 16px; height: 16px; font-size: 0.6rem; padding: 0 4px; }

.sidebar-scrim { position: fixed; inset: 0; background: rgba(2, 6, 16, 0.6); z-index: 90; opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0.25s; }
body.sidebar-open .sidebar-scrim { opacity: 1; visibility: visible; }

/* ---------------------------------------------------------------------
   Page head
   --------------------------------------------------------------------- */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.page-head h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.2rem; display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.page-head h1 i { font-size: 1.3rem; color: var(--cyan); }
.page-sub { color: var(--text-light); font-size: 0.87rem; }
.page-sub b { color: var(--text); font-weight: 600; }
.page-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.page-actions .btn { padding: 0.6rem 1.05rem; }

/* ---------------------------------------------------------------------
   Attention strip - the "what needs you" row
   --------------------------------------------------------------------- */
.attention {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.9rem 1.15rem;
    margin-bottom: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(251, 191, 36, 0.28);
    background: linear-gradient(120deg, rgba(251, 191, 36, 0.12), rgba(251, 191, 36, 0.03) 60%);
}
.attention.clear { border-color: rgba(52, 211, 153, 0.28); background: linear-gradient(120deg, rgba(52, 211, 153, 0.12), rgba(52, 211, 153, 0.03) 60%); }
.attention-title { display: flex; align-items: center; gap: 0.6rem; font-weight: 650; font-size: 0.9rem; color: var(--text-strong); }
.attention-title i { color: var(--warning); }
.attention.clear .attention-title i { color: var(--success); }
.attention-items { display: flex; gap: 0.5rem; flex-wrap: wrap; flex: 1; }
.attention-link {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.4rem 0.8rem; border-radius: 9999px;
    border: 1px solid var(--border); background: var(--card-bg);
    color: var(--text); font-size: 0.8rem; font-weight: 600;
    transition: border-color 0.2s, transform 0.15s, color 0.2s;
}
.attention-link:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.attention-link b { color: var(--primary); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------
   KPI cards
   --------------------------------------------------------------------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi {
    position: relative;
    display: block;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.15rem 0.9rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    color: inherit;
    transition: transform 0.22s var(--ease), border-color 0.22s, box-shadow 0.22s;
}
a.kpi:hover { transform: translateY(-3px); border-color: rgba(139, 92, 246, 0.45); box-shadow: var(--shadow-accent); }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.7rem; }
.kpi-label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-light); font-weight: 650; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0; }
.stat-icon.blue { background: rgba(34, 211, 238, 0.15); color: var(--cyan); }
.stat-icon.green { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.stat-icon.orange { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.18); color: var(--primary-soft); }
.stat-icon.indigo { background: rgba(129, 140, 248, 0.16); color: #a5b4fc; }
.stat-icon.teal { background: rgba(45, 212, 191, 0.16); color: #2dd4bf; }
.stat-icon.rose { background: rgba(244, 114, 182, 0.16); color: #f472b6; }
.kpi-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; color: var(--text-strong); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi-value small { font-size: 0.95rem; font-weight: 600; color: var(--text-light); margin-left: 2px; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 0.45rem; min-height: 22px; }
.kpi-note { font-size: 0.75rem; color: var(--text-light); }
.kpi-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 0.74rem; font-weight: 700; padding: 2px 7px; border-radius: 9999px; white-space: nowrap; }
.kpi-delta.up { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; }
.kpi-delta.down { background: rgba(248, 113, 113, 0.14); color: #fca5a5; }
.kpi-delta.flat { background: var(--hover); color: var(--text-light); }
[data-theme="light"] .kpi-delta.up { color: #047857; }
[data-theme="light"] .kpi-delta.down { color: #b91c1c; }
.kpi-spark { display: block; width: 100%; height: 34px; margin-top: 0.55rem; overflow: visible; }
.kpi-spark polyline { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.kpi.alerting { border-color: rgba(251, 191, 36, 0.4); }
.kpi.alerting::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.12); }

/* Legacy stat-card, still used by a few pages. */
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow); display: flex; align-items: center; gap: 1rem; transition: transform 0.2s, border-color 0.2s; }
.stat-card:hover { transform: translateY(-3px); border-color: rgba(139, 92, 246, 0.4); }
.stat-link { display: flex; align-items: center; gap: 1rem; color: inherit; }
.stat-info { display: flex; flex-direction: column; }
.stat-number { font-size: 1.75rem; font-weight: 700; line-height: 1.2; color: var(--text-strong); }
.stat-label { font-size: 0.8rem; color: var(--text-light); }

/* ---------------------------------------------------------------------
   Charts
   --------------------------------------------------------------------- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.insight-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.chart-box { padding: 1.15rem 1.4rem 1.3rem; }
.bars { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; height: 236px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar-plot { position: relative; width: 100%; height: 168px; display: flex; align-items: flex-end; justify-content: center; }
.bar {
    position: relative;
    width: 100%;
    max-width: 44px;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    background: repeating-linear-gradient(to top, var(--chart-grid) 0 1px, transparent 1px 33.333%), var(--track);
}
.bar-fill { display: block; width: 100%; border-radius: 8px 8px 0 0; transition: height 0.6s var(--ease); min-height: 4px; }
.bar-val { font-size: 0.76rem; font-weight: 700; color: var(--text); margin-top: 7px; font-variant-numeric: tabular-nums; }
.bar-col.zero .bar-val { color: var(--text-light); opacity: 0.55; }
.bar-tick { font-size: 0.62rem; color: var(--text-light); margin-top: 3px; white-space: nowrap; }
.bar-col:nth-last-child(-n+4) .bar-tick { font-size: 0; }
.bar-col:nth-last-child(-n+4) .bar-tick::after { content: attr(data-short); font-size: 0.62rem; }
.bar-tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translate(-50%, 6px);
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    font-size: 0.72rem;
    line-height: 1.35;
    white-space: nowrap;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s, transform 0.18s;
    z-index: 5;
}
.bar-tip b { color: #fff; font-size: 0.85rem; }
.bar-col:hover .bar-tip, .bar-col:focus-within .bar-tip { opacity: 1; transform: translate(-50%, 0); }
.chart-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.9rem; font-size: 0.76rem; color: var(--text-light); }
.empty-note { color: var(--text-light); font-size: 0.85rem; margin-top: 1rem; padding: 0.9rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); text-align: center; background: var(--hover); }
.empty-state { text-align: center; padding: 2.2rem 1.2rem; }
.empty-state i { font-size: 2.2rem; opacity: 0.35; margin-bottom: 0.7rem; display: block; }
.empty-state p { color: var(--text-light); font-size: 0.87rem; }

/* Horizontal meters (categories, engagement mix). */
.meter-list { display: flex; flex-direction: column; gap: 0.9rem; }
.meter { display: flex; flex-direction: column; gap: 0.3rem; }
.meter-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; font-size: 0.82rem; }
.meter-head .k { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-head .v { color: var(--text-light); font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter-track { height: 7px; background: var(--track); border-radius: 99px; overflow: hidden; }
.meter-track > i { display: block; height: 100%; border-radius: 99px; transition: width 0.6s var(--ease); }

/* Ranked list (top courses). */
.rank-list { list-style: none; display: flex; flex-direction: column; }
.rank-item { display: flex; align-items: center; gap: 0.85rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.rank-item:last-child { border-bottom: none; }
.rank-num { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 0.72rem; font-weight: 800; background: var(--surface-3); color: var(--text-light); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.rank-item:nth-child(1) .rank-num { background: rgba(251, 191, 36, 0.18); color: #fcd34d; }
.rank-item:nth-child(2) .rank-num { background: rgba(203, 213, 225, 0.16); color: #cbd5e1; }
.rank-item:nth-child(3) .rank-num { background: rgba(251, 146, 60, 0.16); color: #fdba74; }
.rank-body { flex: 1; min-width: 0; }
.rank-body .t { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-body:hover .t { color: var(--primary); }
.rank-body .m { font-size: 0.72rem; color: var(--text-light); }
.rank-count { font-size: 0.95rem; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }

/* Progress ring (conic gradient; --p is the percentage 0-100). */
.ring { --p: 0; --ring: var(--primary); position: relative; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--ring) calc(var(--p) * 1%), var(--track) 0); flex-shrink: 0; }
.ring::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--card-bg); }
.ring > span { position: relative; z-index: 1; font-size: 0.82rem; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.ring.sm { width: 44px; height: 44px; }
.ring.sm::after { inset: 5px; }
.ring.sm > span { font-size: 0.72rem; }

/* ---------------------------------------------------------------------
   Funnel
   --------------------------------------------------------------------- */
.funnel { display: flex; flex-direction: column; gap: 0.55rem; }
.funnel-step { display: flex; align-items: center; gap: 0.8rem; }
.funnel-bar { flex: 1; height: 34px; border-radius: 8px; background: var(--track); overflow: hidden; position: relative; display: flex; align-items: center; }
.funnel-bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 8px; background: linear-gradient(90deg, rgba(139, 92, 246, 0.85), rgba(34, 211, 238, 0.75)); transition: width 0.6s var(--ease); }
.funnel-step .t { position: relative; z-index: 1; padding-left: 0.7rem; font-size: 0.8rem; color: #fff; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.funnel-step .v { width: 62px; text-align: right; font-size: 0.92rem; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.funnel-step .v small { display: block; font-size: 0.66rem; color: var(--text-light); font-weight: 500; }

/* ---------------------------------------------------------------------
   Table toolbar (search + filters)
   --------------------------------------------------------------------- */
.toolbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.85rem 1.4rem; border-bottom: 1px solid var(--border); background: var(--surface-3); }
.toolbar .grow { flex: 1; min-width: 200px; }
.search {
    position: relative;
    display: flex;
    align-items: center;
}
.search i { position: absolute; left: 0.7rem; color: var(--text-light); font-size: 0.8rem; pointer-events: none; }
.search input {
    width: 100%;
    padding: 0.5rem 0.8rem 0.5rem 2.1rem;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    font-size: 0.83rem;
    font-family: inherit;
}
.search input::placeholder { color: var(--text-light); opacity: 0.75; }
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18); }
.filters { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.filter-chip {
    padding: 0.42rem 0.8rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-light);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex; align-items: center; gap: 0.4rem;
    transition: all 0.18s;
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: rgba(139, 92, 246, 0.15); border-color: rgba(139, 92, 246, 0.45); color: var(--primary-soft); }
.filter-chip b { font-variant-numeric: tabular-nums; opacity: 0.8; }

.health-legend { display: flex; align-items: center; gap: 0.85rem; font-size: 0.78rem; color: var(--text-light); flex-wrap: wrap; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }
.legend-dot.ok { background: var(--success); box-shadow: 0 0 8px rgba(52, 211, 153, 0.6); }
.legend-dot.warn { background: var(--warning); box-shadow: 0 0 8px rgba(251, 191, 36, 0.6); }
.legend-dot.crit { background: var(--danger); box-shadow: 0 0 8px rgba(248, 113, 113, 0.6); }
.health-table td { vertical-align: middle; }
.course-link { color: var(--text); font-weight: 600; }
.course-link:hover { color: var(--primary); }
.health-chip { display: inline-flex; align-items: center; gap: 6px; padding: 0.28rem 0.7rem; border-radius: 9999px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.health-chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.health-ok { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; }
.health-warn { background: rgba(251, 191, 36, 0.14); color: #fcd34d; }
.health-crit { background: rgba(248, 113, 113, 0.16); color: #fca5a5; }
[data-theme="light"] .health-ok { color: #047857; }
[data-theme="light"] .health-warn { color: #b45309; }
[data-theme="light"] .health-crit { color: #b91c1c; }

/* ---------------------------------------------------------------------
   Activity timeline
   --------------------------------------------------------------------- */
.activity-list { list-style: none; padding: 0.35rem 1.4rem 1.1rem; display: grid; }
.activity-item { display: flex; align-items: flex-start; gap: 0.85rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); font-size: 0.855rem; }
.activity-item:last-child { border-bottom: none; }
.act-icon { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; }
.act-icon.blue { background: rgba(34, 211, 238, 0.15); color: var(--cyan); }
.act-icon.green { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.act-icon.orange { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.act-icon.purple { background: rgba(139, 92, 246, 0.18); color: var(--primary-soft); }
.act-icon.rose { background: rgba(244, 114, 182, 0.15); color: #f472b6; }
.act-body { flex: 1; color: var(--text); min-width: 0; }
.act-body b { color: var(--text-strong); font-weight: 650; }
.act-time { font-size: 0.72rem; color: var(--text-light); white-space: nowrap; margin-top: 3px; }

/* ---------------------------------------------------------------------
   Small shared pieces
   --------------------------------------------------------------------- */
.certificate-preview { margin-top: 1.5rem; padding: 1rem; border-radius: var(--radius); background: #1e1b4b; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); border: 1px solid rgba(139, 92, 246, 0.3); }

/* Light-theme corrections for the small status colours that page-level
   styles hard-code, so switching theme does not leave amber-on-white. */
[data-theme="light"] .stat-chip.active { border-color: #7c3aed; color: #5b21b6; background: linear-gradient(135deg, rgba(124, 58, 237, 0.10), rgba(6, 182, 212, 0.06)); }
[data-theme="light"] .stat-chip.active i { color: #7c3aed; }
[data-theme="light"] .tag { color: var(--text); }
[data-theme="light"] .tag.red { color: #b91c1c; }
[data-theme="light"] .tag.gold { color: #a8841c; }
[data-theme="light"] .tag.green { color: #047857; }
[data-theme="light"] .tag.blue { color: #0e7490; }
[data-theme="light"] .req-card .req-meta a { color: #0e7490; }
[data-theme="light"] .bar-tip { background: #1e293b; color: #e2e8f0; }

.stack { display: flex; flex-direction: column; gap: 0.5rem; }
.row-gap { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.skeleton { background: linear-gradient(90deg, var(--hover) 25%, var(--track) 37%, var(--hover) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.reveal { animation: riseIn 0.45s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */
@media (max-width: 1200px) {
    .insight-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 992px) {
    .dash-grid { grid-template-columns: 1fr; }
    .insight-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .sidebar-toggle { display: inline-flex; }
    .admin-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        height: 100vh;
        z-index: 95;
        width: var(--sidebar-w);
        transform: translateX(-102%);
        box-shadow: var(--shadow-lg);
        padding-top: 1.4rem;
    }
    body.sidebar-open .admin-sidebar { transform: none; }
    body.sidebar-collapsed .admin-sidebar { width: var(--sidebar-w); }
    body.sidebar-collapsed .sidebar-nav li a { justify-content: flex-start; padding-left: 0.75rem; padding-right: 0.75rem; }
    body.sidebar-collapsed .sidebar-nav li a span, body.sidebar-collapsed .sidebar-label, body.sidebar-collapsed .sidebar-foot { display: revert; }
    .admin-content { padding: 1.1rem; }
    .header-clock { display: none; }
    .page-head h1 { font-size: 1.35rem; }
}
@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
    .health-legend { gap: 0.6rem; }
    .activity-item { flex-wrap: wrap; }
    .act-time { width: 100%; padding-left: 44px; margin-top: 0; }
    .bar-plot { height: 128px; }
    .bars { height: 196px; }
    .kpi-value { font-size: 1.6rem; }
    .stat-icon { width: 38px; height: 38px; }
    .toolbar { padding: 0.75rem 1rem; }
    .card-header { padding: 0.95rem 1rem; }
    .card-body, .chart-box { padding: 1rem; }
    .attention { padding: 0.8rem 1rem; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .kpi-value { font-size: 1.45rem; }
    .kpi { padding: 0.85rem 0.9rem 0.75rem; }
    .kpi-top { margin-bottom: 0.5rem; }
    .stat-icon { width: 34px; height: 34px; font-size: 0.9rem; }
    .kpi-spark { height: 26px; }
    .bar-col:nth-last-child(-n+4) .bar-tick { font-size: 0.58rem; }
}

/* Print: the screen chrome is noise on paper, the numbers are not. */
@media print {
    body::before, .admin-sidebar, .admin-header, .sidebar-scrim, .toolbar, .page-actions, .kpi-spark { display: none !important; }
    body { background: #fff; color: #000; }
    .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
    .admin-content { padding: 0; }
}
/* ==================================================================
   Franchise network (dashboard section)

   Namespaced fr-net-* because the standalone partner pages already use
   fr-* for their own layout. The only shared piece is .fr-hint, which
   appears on both.
   ================================================================== */
.fr-hint { font-size: 0.78rem; opacity: 0.75; margin-top: 0.35rem; }
.fr-hint code { font-size: 0.74rem; padding: 0.1rem 0.35rem; border-radius: 5px; background: var(--track); }

.fr-net-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1px;
    background: var(--border);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.fr-net-stat { background: var(--card, #fff); padding: 0.95rem 1.25rem; display: flex; flex-direction: column; gap: 2px; }
.fr-net-stat .lbl { font-size: 0.7rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-light); }
.fr-net-stat b { font-size: 1.3rem; font-weight: 750; color: var(--text-strong); font-variant-numeric: tabular-nums; line-height: 1.2; }
.fr-net-stat .sub { font-size: 0.72rem; color: var(--text-light); }
.fr-net-stat.warn b { color: var(--warning); }

.fr-net-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1.5rem; padding: 1.25rem 1.4rem 1.4rem; }
.fr-net-grid h3 { margin: 0 0 0.75rem; font-size: 0.78rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-light); }
.fr-net-chart .bars { height: 132px; gap: 6px; }
.fr-net-chart .bar-plot { height: 86px; }
.fr-net-chart .empty-note { text-align: left; margin-top: 0.6rem; }

.fr-net-side { min-width: 0; }
.fr-net-side h3:not(:first-child) { margin-top: 1.4rem; }

.fr-rank { list-style: none; margin: 0; padding: 0; }
.fr-rank li { border-bottom: 1px solid var(--border); }
.fr-rank li:last-child { border-bottom: none; }
.fr-rank a { display: flex; align-items: baseline; gap: 0.5rem; padding: 0.5rem 0.35rem; border-radius: var(--radius-sm); color: inherit; text-decoration: none; transition: background 0.15s var(--ease); }
.fr-rank a:hover, .fr-rank a:focus-visible { background: var(--track); }
.fr-rank .nm { font-size: 0.855rem; font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-rank .code { font-size: 0.7rem; color: var(--text-light); font-variant-numeric: tabular-nums; }
.fr-rank .amt { margin-left: auto; font-size: 0.83rem; font-weight: 700; color: var(--primary-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fr-net-side .activity-list { list-style: none; margin: 0; padding: 0; }
.fr-net-side .activity-item:last-child { border-bottom: none; }

/* The chart and the ranking collapse together on narrow screens; the bar
   labels need the room, so the side panel drops first. */
@media (max-width: 900px) {
    .fr-net-grid { grid-template-columns: 1fr; gap: 1.1rem; }
    .fr-net-side h3:not(:first-child) { margin-top: 1.1rem; }
}
