/**
 * OnlySecurity in-dashboard component kit (light variant).
 *
 * Used by:
 *   - themes/ksec-training/tutor[-v4]/dashboard/rewards.php
 *   - themes/ksec-training/tutor[-v4]/dashboard/referrals.php
 *   - themes/ksec-training/tutor[-v4]/dashboard/user-rank-widget.php
 *
 * Light surface with navy primary, gold for badge/achievement accents,
 * green for positive deltas. All values exposed as CSS variables so a
 * future Tutor v4 dark-mode toggle is a single selector swap, e.g.:
 *
 *   [data-tutor-theme="dark"] {
 *       --os-d-bg: #0d1b2e;
 *       --os-d-panel: #16243d;
 *       --os-d-border: rgba(255,255,255,0.08);
 *       --os-d-text: #e6edf6;
 *       --os-d-muted: #94a3b8;
 *       ...
 *   }
 */

.os-d,
.os-d-widget {
    --os-d-bg: #f7f8fb;
    --os-d-panel: #ffffff;
    --os-d-panel-2: #fafbfd;
    --os-d-border: #e5e7eb;
    --os-d-text: #1e293b;
    --os-d-muted: #64748b;
    --os-d-subtle: #94a3b8;
    --os-d-primary: #2F62AF;
    --os-d-primary-soft: rgba(47, 98, 175, 0.10);
    --os-d-gold: #fcb900;
    --os-d-gold-soft: rgba(252, 185, 0, 0.14);
    --os-d-up: #22c55e;
    --os-d-on-primary: #ffffff;
    --os-d-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);

    color: var(--os-d-text);
}

/* ─────────────────────────────── Dark ────────────────────────────────
 *
 * Keyed on Tutor's own `data-tutor-theme` attribute, NOT on
 * `@media (prefers-color-scheme: dark)`. Tutor v4 resolves the OS
 * preference into that attribute itself and also lets a member choose
 * light explicitly. Keying on the media query would override that
 * choice and force dark on someone who had asked for light.
 *
 * Only the tokens are redefined. Every component below consumes them,
 * so nothing else in this file needs a dark counterpart, which is what
 * keeps the two themes from drifting apart.
 *
 * Accent tints are LIGHTER in dark (0.10 vs 0.14) and the accents
 * themselves are raised. A mid accent on a tint of itself has almost no
 * separation: `#fcb900` on `rgba(252,185,0,.14)` measured 1.6:1 on the
 * live page. The pairs below were measured, not guessed.
 */
[data-tutor-theme="dark"] .os-d,
[data-tutor-theme="dark"] .os-d-widget {
    --os-d-bg: #161b26;
    --os-d-panel: #1c2333;
    --os-d-panel-2: #222a3c;
    --os-d-border: rgba(255, 255, 255, 0.10);
    --os-d-text: #e6edf6;
    --os-d-muted: #9fb0c6;
    --os-d-subtle: #8b9bb0;
    --os-d-primary: #96bdf2;
    --os-d-primary-soft: rgba(150, 189, 242, 0.10);
    --os-d-gold: #ffc93c;
    --os-d-gold-soft: rgba(255, 201, 60, 0.10);
    --os-d-up: #4ade80;
    /* The dark primary is a LIGHT blue, so a white label on it measured
     * 1.93:1. Anything using --os-d-primary as a BACKGROUND must take its
     * text colour from here, not from a literal #fff. */
    --os-d-on-primary: #10192b;
    --os-d-shadow: 0 1px 3px rgba(0, 0, 0, 0.40);
}

/* The theme's customizer emits a bare `h1 { color: #222 }` through h4,
 * site-wide and inline. On the dark dashboard that lands at 1.08:1.
 * Scoped by the dashboard wrapper so it beats a bare element selector
 * without needing !important. */
[data-tutor-theme="dark"] .os-d h1,
[data-tutor-theme="dark"] .os-d h2,
[data-tutor-theme="dark"] .os-d h3,
[data-tutor-theme="dark"] .os-d h4,
[data-tutor-theme="dark"] .os-d-widget h1,
[data-tutor-theme="dark"] .os-d-widget h2,
[data-tutor-theme="dark"] .os-d-widget h3,
[data-tutor-theme="dark"] .os-d-widget h4 {
    color: var(--os-d-text);
}

/* ─────────────────────────── Dashboard page ─────────────────────────── */

.os-d-head h1 {
    font-size: 28px;
    margin: 0 0 4px;
    letter-spacing: -0.01em;
    color: var(--os-d-text);
}
.os-d-head p {
    color: var(--os-d-muted);
    margin: 0 0 28px;
    font-size: 14px;
}

/* CSS-only tabs via hidden radios + sibling selectors */
.os-d-tabs-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.os-d-tabs-nav {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--os-d-border);
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.os-d-tab-label {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--os-d-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    user-select: none;
}
.os-d-tab-label:hover { color: var(--os-d-text); }
.os-d-tab-panel { display: none; }

/* 4 tabs supported, positional :nth-of-type matching */
.os-d-tabs-radio:nth-of-type(1):checked ~ .os-d-tabs-nav .os-d-tab-label:nth-of-type(1),
.os-d-tabs-radio:nth-of-type(2):checked ~ .os-d-tabs-nav .os-d-tab-label:nth-of-type(2),
.os-d-tabs-radio:nth-of-type(3):checked ~ .os-d-tabs-nav .os-d-tab-label:nth-of-type(3),
.os-d-tabs-radio:nth-of-type(4):checked ~ .os-d-tabs-nav .os-d-tab-label:nth-of-type(4) {
    color: var(--os-d-text);
    border-bottom-color: var(--os-d-primary);
}
.os-d-tabs-radio:nth-of-type(1):checked ~ .os-d-tab-panels .os-d-tab-panel:nth-of-type(1),
.os-d-tabs-radio:nth-of-type(2):checked ~ .os-d-tab-panels .os-d-tab-panel:nth-of-type(2),
.os-d-tabs-radio:nth-of-type(3):checked ~ .os-d-tab-panels .os-d-tab-panel:nth-of-type(3),
.os-d-tabs-radio:nth-of-type(4):checked ~ .os-d-tab-panels .os-d-tab-panel:nth-of-type(4) {
    display: block;
}

/* Section heading inside a tab */
.os-d-sec { margin: 0 0 16px; }
.os-d-sec h2 { font-size: 18px; margin: 0 0 4px; color: var(--os-d-text); }
.os-d-sec p  { color: var(--os-d-muted); font-size: 13px; margin: 0; }

/* Card */
.os-d-card {
    background: var(--os-d-panel);
    border: 1px solid var(--os-d-border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--os-d-shadow);
}

/* ─────────────────────────── Overview tab ─────────────────────────── */

.os-d-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.os-d-ov-head {
    color: var(--os-d-muted);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 12px;
}
.os-d-ov-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}
.os-d-ov-value small {
    font-size: 14px;
    font-weight: 500;
    color: var(--os-d-muted);
    margin-left: 4px;
}
.os-d-ov-meta {
    color: var(--os-d-muted);
    font-size: 13px;
    margin-top: 8px;
}
.os-d-ov-meta b { color: var(--os-d-text); }

.os-d-rank-pill {
    display: inline-block;
    padding: 4px 10px;
    background: var(--os-d-primary-soft);
    color: var(--os-d-primary);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.os-d-progress {
    background: var(--os-d-border);
    height: 6px;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 12px;
}
.os-d-progress-bar {
    background: var(--os-d-primary);
    height: 100%;
}
.os-d-progress-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    color: var(--os-d-muted);
    font-size: 12px;
}

/* Recent achievements list */
.os-d-recent ul { list-style: none; padding: 0; margin: 0; }
.os-d-recent li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--os-d-border);
    font-size: 14px;
}
.os-d-recent li:first-child { border-top: 0; padding-top: 0; }
.os-d-recent .ico {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--os-d-gold-soft);
    color: var(--os-d-gold);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 16px;
}
/* Real badge thumbnail used in place of the generic icon */
.os-d-recent .ico.ico-img {
    background: transparent;
    object-fit: cover;
    border: 1px solid var(--os-d-border);
}
.os-d-recent .body { flex: 1; min-width: 0; }
.os-d-recent .name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.os-d-recent .when { color: var(--os-d-muted); font-size: 12px; }
.os-d-recent .pts {
    color: var(--os-d-up);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.os-d-recent .empty { color: var(--os-d-muted); font-size: 13px; margin: 4px 0 0; }

.os-d-ov-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--os-d-panel);
    border: 1px solid var(--os-d-border);
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 13px;
    color: var(--os-d-muted);
    margin-top: 8px;
}
.os-d-ov-foot a {
    color: var(--os-d-primary);
    text-decoration: none;
    font-weight: 600;
}
.os-d-ov-foot a:hover { text-decoration: underline; }

/* Inline notification preferences accordion */
.os-d-notifications {
    background: var(--os-d-panel);
    border: 1px solid var(--os-d-border);
    border-radius: 10px;
    margin-top: 8px;
    overflow: hidden;
}
.os-d-notifications summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 18px;
    color: var(--os-d-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    user-select: none;
}
.os-d-notifications summary::-webkit-details-marker { display: none; }
.os-d-notifications summary b { color: var(--os-d-text); }
.os-d-notifications .chevron {
    color: var(--os-d-subtle);
    font-size: 14px;
    line-height: 1;
    transition: transform 0.15s ease;
}
.os-d-notifications[open] .chevron { transform: rotate(180deg); }
.os-d-notifications__body {
    padding: 0 18px 18px;
    border-top: 1px solid var(--os-d-border);
    padding-top: 16px;
}
/* Render [mycred_email_subscriptions] in our type style */
.os-d-notifications__body label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
    color: var(--os-d-text);
}
.os-d-notifications__body input[type="checkbox"] {
    accent-color: var(--os-d-primary);
}

/* ─────────────────────────── Ranks tab ─────────────────────────── */

.os-d-ranks-ladder { display: flex; flex-direction: column; gap: 10px; }
.os-d-rank-row {
    background: var(--os-d-panel);
    border: 1px solid var(--os-d-border);
    border-radius: 10px;
    padding: 14px 18px;
    display: grid;
    grid-template-columns: 40px 1fr 110px 130px;
    align-items: center;
    gap: 16px;
}
.os-d-rank-row.me {
    border-color: var(--os-d-primary);
    background: var(--os-d-primary-soft);
}
.os-d-rank-row .num {
    font-size: 18px;
    font-weight: 700;
    color: var(--os-d-subtle);
    font-variant-numeric: tabular-nums;
}
.os-d-rank-row.unlocked .num { color: var(--os-d-up); }
.os-d-rank-row.current  .num { color: var(--os-d-primary); }
.os-d-rank-row .name { font-weight: 600; }
.os-d-rank-row .threshold { color: var(--os-d-muted); font-size: 13px; }
.os-d-rank-row .threshold b { color: var(--os-d-text); font-variant-numeric: tabular-nums; }
.os-d-rank-row .status {
    font-size: 12px;
    font-weight: 600;
    text-align: right;
}
.os-d-rank-row.unlocked .status { color: var(--os-d-up); }
.os-d-rank-row.current  .status { color: var(--os-d-primary); }
.os-d-rank-row.locked   .status { color: var(--os-d-subtle); }

/* ─────────────────────────── History tab ─────────────────────────── */

.os-d-history-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--os-d-panel);
    border: 1px solid var(--os-d-border);
    border-radius: 12px;
    overflow: hidden;
}
.os-d-history-table th,
.os-d-history-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--os-d-border);
    font-size: 14px;
}
.os-d-history-table thead th {
    background: var(--os-d-panel-2);
    font-weight: 600;
    color: var(--os-d-muted);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.os-d-history-table tbody tr:last-child td { border-bottom: 0; }
.os-d-history-table .amt {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.os-d-history-table .amt.up   { color: var(--os-d-up); }
.os-d-history-table .amt.down { color: #ef4444; }

/* Wrapper for the [mycred_history] shortcode if we choose to keep it */
.os-d-history-wrap { overflow-x: auto; }

/* Theme the [mycred_history] table to match our card kit */
.os-d-history-wrap .mycred-history-wrapper { background: transparent; }
.os-d-history-wrap form.form-inline { margin: 0; }
.os-d-history-wrap .mycred-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--os-d-panel);
    border: 1px solid var(--os-d-border);
    border-radius: 12px;
    overflow: hidden;
    font-size: 14px;
}
.os-d-history-wrap .mycred-table th,
.os-d-history-wrap .mycred-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--os-d-border);
    color: var(--os-d-text);
}
.os-d-history-wrap .mycred-table thead th {
    background: var(--os-d-panel-2);
    font-weight: 600;
    color: var(--os-d-muted);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--os-d-border);
}
.os-d-history-wrap .mycred-table tbody tr.alt td,
.os-d-history-wrap .mycred-table tbody tr:nth-child(even) td {
    background: var(--os-d-panel-2);
}
.os-d-history-wrap .mycred-table tbody tr:last-child td { border-bottom: 0; }
.os-d-history-wrap .mycred-table .column-creds {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--os-d-up);
    width: 100px;
}
.os-d-history-wrap .mycred-table .column-creds[data-raw^="-"] { color: #ef4444; }
.os-d-history-wrap .mycred-table .column-time {
    width: 300px;
    color: var(--os-d-muted);
    white-space: nowrap;
}

/* ─────────────────────── Badges tab ─────────────────────── */
/*
 * Theme the [onlysecurity_badge_tabs] shortcode output. The shortcode
 * emits its own .badge-tab-nav (categories) + .badge-card grid which
 * had ~120 lines of inline CSS in the old template; we drop the inline
 * and style here instead.
 */
.os-d .onlysecurity-badge-tabs {
    background: var(--os-d-panel);
    border: 1px solid var(--os-d-border);
    border-radius: 12px;
    padding: 4px;
    overflow: hidden;
}
.os-d .badge-tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 8px 8px 0;
    border-bottom: 1px solid var(--os-d-border);
}
.os-d .badge-tab-nav li {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--os-d-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    user-select: none;
    border-radius: 0;
    background: transparent;
}
.os-d .badge-tab-nav li:hover { color: var(--os-d-text); }
.os-d .badge-tab-nav li.active {
    color: var(--os-d-text);
    border-bottom-color: var(--os-d-primary);
    background: transparent;
}
.os-d .badge-tab-nav .badge-count {
    color: var(--os-d-subtle);
    font-weight: 500;
    margin-left: 4px;
}
.os-d .badge-tab-nav li.active .badge-count { color: var(--os-d-primary); }

.os-d .badge-tab-content { display: none; padding: 20px; }
.os-d .badge-tab-content.active {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.os-d .badge-card {
    background: var(--os-d-panel-2);
    border: 1px solid var(--os-d-border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    transition: opacity 0.15s ease;
}
.os-d .badge-card.not-earned { opacity: 0.55; }
.os-d .badge-card.earned {
    background: var(--os-d-panel);
    border-color: rgba(252, 185, 0, 0.4);
    box-shadow: 0 1px 3px rgba(252, 185, 0, 0.12);
}
.os-d .badge-thumb {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--os-d-gold-soft);
    display: grid;
    place-items: center;
}
.os-d .badge-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.os-d .badge-text { flex: 1; min-width: 0; }
.os-d .badge-text h3 {
    font-size: 14px;
    margin: 0 0 4px;
    color: var(--os-d-text);
}
.os-d .badge-text > p {
    font-size: 13px;
    color: var(--os-d-muted);
    margin: 0 0 8px;
    line-height: 1.45;
}
.os-d .badge-text > p:empty { display: none; }
.os-d .badge-text h6 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--os-d-subtle);
    margin: 8px 0 4px;
    font-weight: 600;
}
.os-d .mycred-badge-requirements {
    list-style: disc;
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
    color: var(--os-d-muted);
    line-height: 1.5;
}

/* Share-this-badge CTA on earned cards. Funnels to the per-earned page
   (which carries its own FB/X/LinkedIn share row) rather than firing
   3 quick-share buttons from the gallery. v1.0.95+. */
.os-d .badge-share-wrapper { margin-top: 12px; }
.os-d .badge-share-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--os-d-primary-soft);
    color: var(--os-d-primary);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}
.os-d .badge-share-cta:hover {
    background: var(--os-d-primary);
    color: var(--os-d-on-primary);
}

/* Legacy social-icons strip, retained for any caller still emitting it. */
.os-d .mycred-social-wrapper {
    margin-top: 10px;
    font-size: 12px;
    color: var(--os-d-muted);
}
.os-d .mycred-social-wrapper strong { color: var(--os-d-text); margin-right: 6px; }
.os-d .mycred-social-icons {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 4px;
    border-radius: 4px;
    background: var(--os-d-primary-soft);
    vertical-align: middle;
}

/* ─────────────────────────── Referrals page ─────────────────────────── */

.os-d-program { }
.os-d-program-card h2 { font-size: 16px; margin: 0 0 12px; }
.os-d-program-card p  { color: var(--os-d-muted); margin: 0 0 14px; font-size: 14px; line-height: 1.55; }
.os-d-program-card ul { margin: 0; padding: 0; list-style: none; }
.os-d-program-card li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
    border-top: 1px solid var(--os-d-border);
    font-size: 14px;
}
.os-d-program-card li:first-child { border-top: 0; padding-top: 0; }
.os-d-program-card .badge {
    flex-shrink: 0;
    display: inline-block;
    background: var(--os-d-gold-soft);
    color: #8a5a00;
    border-radius: 8px;
    padding: 6px 10px;
    font-weight: 700;
    font-size: 12px;
    min-width: 64px;
    text-align: center;
}
.os-d-program-card .body b { font-weight: 600; }
.os-d-program-card .body p { color: var(--os-d-muted); margin: 2px 0 0; font-size: 13px; }

.os-d-link-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.os-d-link-field {
    flex: 1;
    min-width: 240px;
    background: var(--os-d-panel-2);
    border: 1px solid var(--os-d-border);
    border-radius: 8px;
    padding: 12px 14px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 13px;
    color: var(--os-d-text);
    word-break: break-all;
}
.os-d-link-field a { color: inherit; text-decoration: none; }
.os-d-copy-btn {
    background: var(--os-d-primary);
    color: var(--os-d-on-primary);
    border: 0;
    border-radius: 8px;
    padding: 12px 18px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}
.os-d-copy-btn:hover { filter: brightness(1.08); }

.os-d-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 16px 0;
}
.os-d-stat {
    background: var(--os-d-panel);
    border: 1px solid var(--os-d-border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--os-d-shadow);
}
.os-d-stat .label { color: var(--os-d-muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 8px; }
.os-d-stat .value { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.os-d-stat .value small { font-size: 13px; color: var(--os-d-muted); margin-left: 4px; font-weight: 500; }
.os-d-stat .meta { color: var(--os-d-muted); font-size: 13px; margin-top: 4px; }
.os-d-stat .meta b { color: var(--os-d-text); }

.os-d-leaderboard ul { list-style: none; margin: 0; padding: 0; }
.os-d-leaderboard li {
    display: grid;
    grid-template-columns: 32px 1fr 90px;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-top: 1px solid var(--os-d-border);
    font-size: 14px;
}
.os-d-leaderboard li:first-child { border-top: 0; padding-top: 0; }
.os-d-leaderboard li.me {
    background: var(--os-d-primary-soft);
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
}
.os-d-leaderboard .pos {
    font-weight: 700;
    color: var(--os-d-subtle);
    font-variant-numeric: tabular-nums;
}
.os-d-leaderboard .pos.top-1 { color: var(--os-d-gold); }
.os-d-leaderboard .name { font-weight: 600; }
.os-d-leaderboard .name .you {
    display: inline-block;
    background: var(--os-d-primary);
    color: var(--os-d-on-primary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}
.os-d-leaderboard .count {
    color: var(--os-d-text);
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.os-d-leaderboard .count small { color: var(--os-d-muted); font-weight: 500; }

/* ─────────────────────────── Rank widget ─────────────────────────── */

.os-d-widget {
    background: var(--os-d-panel);
    border: 1px solid var(--os-d-border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--os-d-shadow);
    color: var(--os-d-text);
}
.os-d-widget h3 {
    font-size: 14px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--os-d-muted);
    margin: 0 0 14px;
}
.os-d-widget-current {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--os-d-border);
    margin-bottom: 14px;
}
.os-d-widget-current .pill {
    flex-shrink: 0;
    background: var(--os-d-primary-soft);
    color: var(--os-d-primary);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 18px;
}
.os-d-widget-current .info { flex: 1; min-width: 0; }
.os-d-widget-current .label {
    font-size: 11px;
    color: var(--os-d-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 2px;
}
.os-d-widget-current .rank-name {
    font-size: 16px;
    font-weight: 700;
}
.os-d-widget-current .points {
    font-size: 13px;
    color: var(--os-d-muted);
    margin-top: 2px;
}
.os-d-widget-current .points b {
    color: var(--os-d-text);
    font-variant-numeric: tabular-nums;
}

.os-d-widget-next { margin-bottom: 14px; }
.os-d-widget-next .meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    margin-bottom: 6px;
}
.os-d-widget-next .meta-l { color: var(--os-d-muted); }
.os-d-widget-next .meta-r { color: var(--os-d-text); font-weight: 600; }
.os-d-widget-next .line {
    font-size: 12px;
    color: var(--os-d-muted);
    margin-top: 6px;
}
.os-d-widget-next .line b {
    color: var(--os-d-text);
    font-variant-numeric: tabular-nums;
}

.os-d-widget-ladder { margin: 0; padding: 0; list-style: none; }
.os-d-widget-ladder li {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid var(--os-d-border);
    font-size: 13px;
}
.os-d-widget-ladder li:first-child { border-top: 0; }
.os-d-widget-ladder .num {
    color: var(--os-d-subtle);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.os-d-widget-ladder li.unlocked .num  { color: var(--os-d-up); }
.os-d-widget-ladder li.current  .num  { color: var(--os-d-primary); }
.os-d-widget-ladder li.unlocked .name { color: var(--os-d-muted); }
.os-d-widget-ladder li.current  .name { font-weight: 700; }
.os-d-widget-ladder .thresh {
    color: var(--os-d-muted);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}

.os-d-widget-more {
    display: block;
    text-align: center;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--os-d-border);
    color: var(--os-d-primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.os-d-widget-more:hover { text-decoration: underline; }

/* ─────────────────────────── Responsive ─────────────────────────── */

@media (max-width: 760px) {
    .os-d-overview-grid { grid-template-columns: 1fr; }
    .os-d-stats { grid-template-columns: 1fr 1fr; }
    .os-d-stats > .os-d-stat:nth-child(3) { grid-column: 1 / -1; }
    .os-d-rank-row { grid-template-columns: 32px 1fr auto; }
    .os-d-rank-row .threshold { display: none; }
}

/* ─────────────────── Tutor v4 dashboard layout (KSEC) ───────────────────
 * v4's dashboard content column is capped narrow; widen it on large screens
 * so our KSEC dashboard pages (and the vendor ones) use the available space.
 * Targets Tutor v4 layout classes, not our .os-d kit, so it applies dashboard
 * wide (this stylesheet is auto-enqueued on all Tutor dashboard routes). */
@media (min-width: 1400px) {
    .tutor-dashboard-layout .tutor-dashboard-page {
        max-width: 90%;
    }
    /* The Account > Settings screen uses its own container, capped at 760px by
     * v4 core (.tutor-account-container). Widen it to match the rest of the
     * dashboard on large screens. */
    .tutor-account-container {
        max-width: 90%;
    }
}

/*
 * "Job-seeking" section header (os-skills-matching Dashboard_Section_Header).
 * Tutor v4's sidebar has no separator render path — it renders every nav item
 * as <li><a href>, so this labelled "separator" item would otherwise be a
 * clickable menu row linking to a dead /dashboard/os_jobseeking_separator/
 * page. Render it as a non-clickable section header instead: kill the link,
 * drop the (empty) icon slot, and style the label as a small muted uppercase
 * heading. The item's href is already '#', so nothing navigates.
 */
.tutor-dashboard-menu-os_jobseeking_separator > a {
    pointer-events: none;
    cursor: default;
    padding-top: 18px;
    padding-bottom: 4px;
}
.tutor-dashboard-menu-os_jobseeking_separator > a:hover,
.tutor-dashboard-menu-os_jobseeking_separator > a.active {
    background: none;
}
.tutor-dashboard-menu-os_jobseeking_separator > a svg {
    display: none;
}
.tutor-dashboard-menu-os_jobseeking_separator > a span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tutor-text-hints, #6b7280);
    opacity: 0.85;
}

/* Explore Courses clearance (UX O1).
 * Tutor places .tutor-see-all-courses absolutely at bottom:24px inside the
 * sidebar, and the nav above it only leaves 24px. Once our menu is taller
 * than the window the sidebar grows to the nav, and the link lands on top of
 * the last item. Reserve 24px offset + 38px link + 24px gap below the nav.
 * :has() keeps trainer views, which have no Explore Courses link, as they are. */
.tutor-dashboard-sidebar:has(.tutor-see-all-courses) .tutor-dashboard-sidebar-nav {
    padding-bottom: 86px;
}

/* Rewards launcher clearance on desktop (UX O12).
 * The myCred launcher is fixed bottom right (bottom 20px, z-index 99999) and
 * sat over the last content on every dashboard page. Below 576px it is swapped
 * for a bottom-nav tab (next block), so only wider screens need the room. */
@media (min-width: 576px) {
    .tutor-dashboard-layout .tutor-dashboard-page {
        padding-bottom: 96px;
    }
}

/* Course thumbnail placeholder (UX O13).
 * Tutor's card thumbnail is lazy loaded (EWWW swaps the source) into a
 * transparent 16:9 box, so the slot showed the page background until the
 * image arrived. Tutor's own surface token has a light and a dark value, so
 * this fills the box in both themes with no layout shift. */
.tutor-progress-card-thumbnail {
    background: var(--tutor-surface-l2, #ececed);
}

/* ───────── myCred loyalty widget on the mobile dashboard ─────────
 * The loyalty widget ("Rewards") is a site-wide fixed launcher, z-index:99999
 * (mycred/includes/loyalty-widget mounts into #mycred-loyalty-widget-root, whose
 * first child is the fixed wrapper; that wrapper's first child is the launcher row,
 * its second child the popup window when open). On the member dashboard below 576px
 * Tutor v4 renders its own fixed bottom nav (.tutor-dashboard-nav-mobile,
 * position:fixed; bottom:0; roughly 73px tall). Rather than let the floating launcher
 * fight that bar, we hide it on mobile and open the widget from an injected "Rewards"
 * bottom-nav tab instead (see onlysecurity-dashboard.js). This stylesheet only loads
 * on Tutor dashboard routes, so all of this stays scoped to the dashboard, and the
 * 576px breakpoint matches the width at which Tutor shows the bottom nav. */
@media (max-width: 575.98px) {
    /* Position the popup window, when open, above the bottom nav.
     * env(safe-area-inset-bottom) preserves the gap on notch devices. */
    #mycred-loyalty-widget-root > div {
        bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
    }
    /* Hide the floating launcher row (the fixed wrapper's first child). The popup
     * window is a separate child, so it still shows when opened; the row is kept in
     * the DOM so the "Rewards" tab's programmatic click keeps toggling the widget. */
    #mycred-loyalty-widget-root > div > div:first-child {
        display: none !important;
    }
    /* Tutor v4's mobile bottom nav renders the Profile tab avatar oversized (the
     * .tutor-avatar-20 size class is not constraining the photo), which shoves the
     * "Profile" label well below the other tab labels and unbalances the bar. Pin the
     * avatar to ~22px so it matches the sibling tab glyphs and every label aligns. */
    .tutor-dashboard-nav-mobile-icon .tutor-avatar,
    .tutor-dashboard-nav-mobile-icon .tutor-avatar-image {
        width: 22px !important;
        height: 22px !important;
        min-width: 22px !important;
        border-radius: 50% !important;
        object-fit: cover !important;
    }
}

/* ───────────────── Dark: Tutor chrome outside the .os-d scope ─────────────
 *
 * These two sit in Tutor's own sidebar and header, so the token block above
 * cannot reach them, but they render on EVERY dashboard page and both fail
 * AA in dark. Measured before: 3.90:1 and 3.79:1 against a 4.5 requirement.
 *
 * Scoped to the dark attribute only, so light mode keeps Tutor's own values
 * and we are not silently restyling the vendor in both themes.
 */
[data-tutor-theme="dark"] .tutor-dashboard-menu-os_jobseeking_separator > a span {
    color: #9fb0c6;
}
[data-tutor-theme="dark"] .tutor-dashboard-header-left .tutor-text-subdued {
    color: #9fb0c6;
}

/* Catch-all: dashboard pages with no KSEC wrapper.
 *
 * store-credit renders a bare `.tutor-dashboard-widget` with plain h2/h3,
 * which inherit the theme's site-wide `h1..h4 { color: #222 }` and land at
 * 1.08:1 on the dark shell. Scoped to Tutor's own page container so it
 * covers any future page too, and only in dark. Deliberately last in the
 * file so it loses to any component rule that sets its own colour. */
[data-tutor-theme="dark"] .tutor-dashboard-page h1,
[data-tutor-theme="dark"] .tutor-dashboard-page h2,
[data-tutor-theme="dark"] .tutor-dashboard-page h3,
[data-tutor-theme="dark"] .tutor-dashboard-page h4 {
    color: #e6edf6;
}

/* ─────────────────── Dashboard sidebar logo ────────────────────────────
 *
 * Replaces the raster wordmark Tutor pulls from the WP custom logo. That
 * asset is a light-background PNG, so on the dark shell it rendered as a
 * bright box, and it lazy-loads, so the top-left was empty on first paint.
 *
 * Done with masks rather than inline SVG because Tutor builds the <img>
 * inside `templates/dashboard/components/sidebar.php` with no filter and
 * no action to inject at. The alternative was overriding 121 lines of an
 * actively-developed vendor template, which is a worse thing to own.
 *
 * Two layers so the brand cyan survives: the mono layer is painted with
 * `currentColor` and follows the theme, the cyan layer is pinned to the
 * brand value. Both SVGs share one 1455x370 viewBox so they register
 * exactly on top of each other.
 *
 * The tagline and "Powered By KSEC" are deliberately absent. At the 41px
 * height this renders they were about 3px tall, which is illegible and a
 * large part of why the original read as mush.
 */
.tutor-dashboard-sidebar-logo img,
.tutor-dashboard-sidebar-logo .site-title {
    display: none !important;
}
.tutor-dashboard-sidebar-logo {
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    width: 161px;
    height: 41px;          /* 1455:370 */
    /* Vendor ships `padding: 16px 40px` here. The mask layers below are
     * `inset: 0`, so that padding would stretch the artwork across the
     * whole padded box and push it flush into the corner. Swapped for a
     * margin whose left matches the nav indent (16px). */
    padding: 0;
    margin: 18px 0 16px 16px;
    color: #101618;        /* light theme ink */
}
[data-tutor-theme="dark"] .tutor-dashboard-sidebar-logo {
    color: #e6edf6;
}
.tutor-dashboard-sidebar-logo::before,
.tutor-dashboard-sidebar-logo::after {
    content: "";
    position: absolute;
    inset: 0;
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    -webkit-mask-size: contain;
            mask-size: contain;
    -webkit-mask-position: left center;
            mask-position: left center;
}
.tutor-dashboard-sidebar-logo::before {
    background-color: currentColor;
    -webkit-mask-image: url("../img/onlysecurity-lockup-mono.svg");
            mask-image: url("../img/onlysecurity-lockup-mono.svg");
}
.tutor-dashboard-sidebar-logo::after {
    background-color: #0DC2E8;
    -webkit-mask-image: url("../img/onlysecurity-lockup-cyan.svg");
            mask-image: url("../img/onlysecurity-lockup-cyan.svg");
}

/* Native controls follow the theme.
 *
 * Unclassed <select>, checkboxes, radios and scrollbars are painted by the
 * browser, not by our kit, so they stayed light on the dark dashboard: the
 * for-hire digest select rendered white among dark fields. A contrast audit
 * will not flag it, because dark text on white passes; it is a consistency
 * break rather than a legibility one.
 *
 * `color-scheme` is the one-line way to tell the browser which set of
 * built-in colours to use. Scoped to the dark attribute so light is
 * untouched. */
[data-tutor-theme="dark"] {
    color-scheme: dark;
}

/* ...except the course builder, which is a LIGHT UI on every theme.
 *
 * The rule above sets color-scheme on the ROOT, so it reaches pages that are
 * not the dashboard. The builder paints its own surfaces light but leaves some
 * inputs unstyled, and those then take the browser's DARK control palette: the
 * course Title field rendered as a black box with rgb(65,69,79) text on
 * rgb(59,59,59), a contrast ratio of 1.17:1. A trainer on dark mode could not
 * read the title they were typing, on the primary authoring screen.
 *
 * Also hit `course_instructors` and the builder's search field. Introduced by
 * the dark-mode pass, not by Tutor. Re-check this if the builder ever gains a
 * genuine dark theme of its own. */
[data-tutor-theme="dark"] #tutor-course-builder {
    color-scheme: light;
}

/* Bare form controls on any dashboard page.
 *
 * `color-scheme: dark` above fixes checkboxes and scrollbars, but not a
 * control whose background is set explicitly by the theme, which is the
 * case for the unclassed <select> on for-hire. Catch-all so no field is
 * left white among dark ones, scoped to Tutor's page container and to
 * dark only. */
[data-tutor-theme="dark"] .tutor-dashboard-page select,
[data-tutor-theme="dark"] .tutor-dashboard-page textarea,
[data-tutor-theme="dark"] .tutor-dashboard-page input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]) {
    background-color: #1c2333;
    color: #e6edf6;
    border-color: rgba(255, 255, 255, 0.10);
}

/* Trainer email choices card (templates/settings-trainer-emails.php).
 *
 * Native selects, coloured from Tutor's own theme variables so they follow
 * light and dark. tutor-form-control was tried first and rendered grey,
 * placeholder-coloured text on dark and stretched to the full card width.
 * Label left, select right on desktop; stacked at phone width. The select
 * width is ch-based so it does not depend on the card's container. */
#os-trainer-emails .os-tep-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--tutor-border-idle);
}
#os-trainer-emails .os-tep-row:last-of-type {
    border-bottom: 0;
}
#os-trainer-emails .os-tep-label {
    color: var(--tutor-text-primary);
    font-size: 14px;
    font-weight: 500;
    margin: 0;
}
#os-trainer-emails .os-tep-select {
    flex: 0 0 auto;
    width: 100%;
    max-width: 26ch;
    min-height: 40px;
    padding: 6px 12px;
    font-size: 14px;
    color: var(--tutor-text-primary);
    background-color: var(--tutor-surface-l1);
    /* Tutor's dark border-idle is about 1.2:1 on the card; mix from the text
     * colour so the control edge shows in both themes. */
    border: 1px solid var(--tutor-border-idle);
    border-color: color-mix(in srgb, var(--tutor-text-primary) 40%, transparent);
    border-radius: 8px;
}
#os-trainer-emails .os-tep-select:focus-visible {
    outline: 2px solid var(--tutor-border-brand-tertiary);
    outline-offset: 2px;
}
#os-trainer-emails .os-tep-select option {
    color: var(--tutor-text-primary);
    background-color: var(--tutor-surface-l1);
}
@media (max-width: 575px) {
    #os-trainer-emails .os-tep-row {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    #os-trainer-emails .os-tep-select {
        max-width: none;
    }
}

/* Contrast pass, 2026-10-27 (docs: onlysecurity/_local/ux-light-dark-audit).
 *
 * Tutor v4's dark theme does not override its own text tokens, so
 * --tutor-text-subdued (#73767d) measured 3.42:1 on the dark shell and is
 * used for dates, durations, labels and empty states across a dozen routes
 * (about 90 failures). Setting the tokens once here repairs every Tutor
 * screen that reads them, rather than chasing each class.
 * `html:root` raises specificity above Tutor's own `:root[data-tutor-theme]`
 * block regardless of stylesheet order.
 * Values measured on #1f242f and #333741: #9fb0c6 5.9:1, #9aa7ba 5.6:1,
 * #4ade80 and #ff8f85 above 6:1.
 */
html:root[data-tutor-theme="dark"] {
    --tutor-text-subdued: #9fb0c6;
    --tutor-text-disabled: #9aa7ba;
    --tutor-text-success: #4ade80;
    --tutor-text-critical: #ff8f85;
}
html[data-tutor-theme="dark"] .tutor-badge[class*="badge-h"] {
    color: #ff7ad0;
}
html[data-tutor-theme="dark"] .os-rr-sub,
html[data-tutor-theme="dark"] .os-cp-dash .os-cp-sub:not(.os-cp-panel .os-cp-sub) {
    color: #9fb0c6;
}

/* Review stars: dark amber passes on white, so dark gets its own lighter one. */
html[data-tutor-theme="dark"] .os-rr-stars {
    color: #fbbf24;
}

/* Light: the two greys that fail on the white shell. */
.tutor-dashboard-menu-os_jobseeking_separator > a span {
    color: #5f6672;
}
.tutor-dashboard-header-left .tutor-text-subdued {
    color: #5f6672;
}

/* Light-mode amber text. The "+50 pts" chips measured 1.6:1 (#fcb900 on its own tint) and the home Avg. rating
 * value 1.84:1 (Tutor's --tutor-text-exception4). Dark keeps the brighter gold, which passes there. */
html[data-tutor-theme="dark"] .os-d-program-card .badge {
    color: var(--os-d-gold);
}
html:root:not([data-tutor-theme="dark"]) {
    --tutor-text-exception4: #b54708;
    --tutor-text-subdued: #666b75;
    --tutor-text-success: #1a7a30;
    --tutor-text-critical: #b42318;
    --tutor-text-disabled: #6b7280;
}
html:root:not([data-tutor-theme="dark"]) .tutor-badge[class*="badge-h"] {
    color: #c2007f;
}

/* "Job-seeking" menu divider: the base rule sets #6b7280 at 0.85 opacity (4.07:1). Light only, dark has its own value. */
html:root:not([data-tutor-theme="dark"]) .tutor-dashboard-menu-os_jobseeking_separator > a span {
    color: #4b5563;
    opacity: 1;
}

/* Light mode contrast, wave 3. Light only: dark keeps its own variable values.
   Notifications chevron 2.56:1, referrals rank numbers 2.23:1 and 1.74:1, "referrals" label 4.13:1. */
html:root:not([data-tutor-theme="dark"]) .os-d-notifications .chevron {
    color: #64748b;
}
html:root:not([data-tutor-theme="dark"]) .os-d-leaderboard .pos {
    color: #5b6a80;
}
html:root:not([data-tutor-theme="dark"]) .os-d-leaderboard .pos.top-1 {
    color: #946200;
}
html:root:not([data-tutor-theme="dark"]) .os-d-leaderboard .count small {
    color: #5b6a80;
}
