/* ==========================================================================
   DARK AMBER OBSIDIAN — Design System
   Aesthetic: Bloomberg Terminal × Luxury Finance × Editorial
   Palette: Deep charcoal blacks, warm amber/gold, off-white linen
   Typography direction: Sharp, utilitarian, commanding
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Mono:ital,wght@0,400;0,500;1,400&family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,700;1,9..144,400&display=swap');

:root {
    /* ── Backgrounds ─────────────────────────────── */
    --bg-dark: #0c0a08;
    --bg-card: rgba(22, 19, 14, 0.82);
    --bg-card-solid: #181410;
    --bg-surface: #1e1a13;

    /* ── Borders ─────────────────────────────────── */
    --border-card: rgba(255, 200, 80, 0.08);
    --border-card-hover: rgba(255, 200, 80, 0.22);
    --border-hairline: rgba(255, 255, 255, 0.055);

    /* ── Typography ──────────────────────────────── */
    --text-primary: #f2ead8;
    --text-secondary: #a89e84;
    --text-muted: #5e5747;
    --text-inverse: #0c0a08;

    /* ── Brand / Accent ───────────────────────────── */
    --primary: #d4922a;
    --primary-light: #f0b84a;
    --primary-dark: #a8711a;
    --primary-gradient: linear-gradient(135deg, #c8841e 0%, #f0b84a 100%);

    --secondary-gradient: linear-gradient(135deg, #f0b84a, #e8784a);
    --accent-gradient: linear-gradient(135deg, #6e9e7a, #d4922a);

    /* ── Semantic: Safe / Green ───────────────────── */
    --safe: #6aab82;
    --safe-bg: rgba(106, 171, 130, 0.10);
    --safe-border: rgba(106, 171, 130, 0.28);
    --safe-glow: rgba(106, 171, 130, 0.18);

    /* ── Semantic: Borderline / Amber ─────────────── */
    --borderline: #e8a93a;
    --borderline-bg: rgba(232, 169, 58, 0.10);
    --borderline-border: rgba(232, 169, 58, 0.30);
    --borderline-glow: rgba(232, 169, 58, 0.18);

    /* ── Semantic: Danger ─────────────────────────── */
    --danger: #c05c4a;
    --danger-bg: rgba(192, 92, 74, 0.12);

    /* ── Radii ────────────────────────────────────── */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;

    /* ── Shadows ──────────────────────────────────── */
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 22px 56px rgba(0, 0, 0, 0.65);
    --shadow-glow: 0 0 40px rgba(212, 146, 42, 0.12);
    --shadow-glow-safe: 0 0 28px rgba(106, 171, 130, 0.20);
    --shadow-glow-borderline: 0 0 28px rgba(232, 169, 58, 0.20);

    /* ── Motion ───────────────────────────────────── */
    --transition: all 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.14s ease;
    --transition-bounce: all 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ── Typography Families ─────────────────────── */
    --font-display: 'Syne', 'Outfit', sans-serif;
    --font-body: 'Syne', 'Outfit', sans-serif;
    --font-mono: 'DM Mono', 'Fira Code', monospace;
    --font-serif: 'Fraunces', Georgia, serif;
}

/* ==========================================================================
   Light Theme Overrides — "Linen & Gold" editorial light mode
   ========================================================================== */
body.light-theme {
    --bg-dark: #f5f0e8;
    --bg-card: rgba(255, 252, 244, 0.90);
    --bg-card-solid: #fffcf4;
    --bg-surface: #eee8d8;

    --border-card: rgba(160, 130, 60, 0.13);
    --border-card-hover: rgba(160, 130, 60, 0.28);

    --text-primary: #120f04;
    --text-secondary: #3d3113;
    --text-muted: #625330;

    --primary: #73470b;
    --primary-light: #945c11;
    --primary-dark: #523205;
    --primary-gradient: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);

    --safe: #2e7d52;
    --safe-bg: rgba(46, 125, 82, 0.09);
    --safe-border: rgba(46, 125, 82, 0.26);
    --safe-glow: rgba(46, 125, 82, 0.13);

    --borderline: #9c5e03;
    --borderline-bg: rgba(156, 94, 3, 0.09);
    --borderline-border: rgba(156, 94, 3, 0.26);
    --borderline-glow: rgba(156, 94, 3, 0.13);

    --danger: #993d2c;
    --danger-bg: rgba(153, 61, 44, 0.10);

    --shadow-sm: 0 2px 10px rgba(80, 60, 20, 0.10);
    --shadow-md: 0 8px 24px rgba(80, 60, 20, 0.14);
    --shadow-lg: 0 20px 50px rgba(80, 60, 20, 0.18);
    --shadow-glow: 0 0 32px rgba(212, 146, 42, 0.10);
}

body.light-theme .bg-glow-1 {
    background: radial-gradient(circle, rgba(212, 146, 42, 0.28) 0%, rgba(212, 146, 42, 0) 70%);
    opacity: 0.55;
}

body.light-theme .bg-glow-2 {
    background: radial-gradient(circle, rgba(192, 92, 74, 0.18) 0%, rgba(192, 92, 74, 0) 70%);
    opacity: 0.40;
}

body.light-theme .bg-glow-3 {
    background: radial-gradient(circle, rgba(106, 171, 130, 0.14) 0%, rgba(106, 171, 130, 0) 70%);
    opacity: 0.30;
}

body.light-theme .app-header {
    background: rgba(255, 252, 244, 0.90);
}

body.light-theme .app-header h1 {
    background: linear-gradient(120deg, var(--text-primary) 30%, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-theme .results-header h2 {
    background: linear-gradient(90deg, var(--text-primary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-theme .form-input,
body.light-theme .form-select {
    background: rgba(255, 252, 244, 0.95);
    color: var(--text-primary);
}

body.light-theme .form-input::placeholder {
    color: var(--text-muted);
}

body.light-theme .form-input:focus,
body.light-theme .form-select:focus {
    background: #fffcf4;
}

body.light-theme .form-select option,
body.light-theme .page-size-select option {
    background-color: #fffcf4;
    color: var(--text-primary);
}

body.light-theme .dropdown-panel {
    background: #fffcf4;
    border-color: var(--border-card-hover);
}

body.light-theme .table-container {
    background: rgba(255, 252, 244, 0.5);
}

body.light-theme .results-table th {
    background: rgba(238, 232, 216, 0.98);
    color: var(--text-primary);
}

body.light-theme .results-table th.sortable:hover {
    background: rgba(212, 146, 42, 0.10);
}

body.light-theme .results-table tbody tr:hover {
    background: rgba(212, 146, 42, 0.04);
}

body.light-theme .results-table tbody tr.row-likely {
    background: rgba(46, 125, 82, 0.04);
}

body.light-theme .results-table tbody tr.row-likely:hover {
    background: rgba(46, 125, 82, 0.08);
}

body.light-theme .results-table tbody tr.row-borderline {
    background: rgba(196, 124, 16, 0.04);
}

body.light-theme .results-table tbody tr.row-borderline:hover {
    background: rgba(196, 124, 16, 0.08);
}

body.light-theme .results-table td strong {
    color: var(--text-primary);
}

body.light-theme .score-val {
    color: var(--text-primary);
}

body.light-theme .checkbox-custom {
    background: rgba(255, 252, 244, 0.95);
    border-color: rgba(160, 130, 60, 0.25);
}

body.light-theme .page-size-select {
    background: rgba(255, 252, 244, 0.95);
    color: var(--text-primary);
}

body.light-theme .btn-secondary {
    background: rgba(160, 130, 60, 0.07);
    color: var(--text-secondary);
    border-color: var(--border-card);
}

body.light-theme .btn-secondary:hover {
    background: rgba(160, 130, 60, 0.14);
    color: var(--text-primary);
}

body.light-theme .btn-nav {
    background: rgba(160, 130, 60, 0.07);
    color: var(--text-secondary);
}

body.light-theme .btn-nav:hover:not(:disabled) {
    background: rgba(212, 146, 42, 0.12);
    color: var(--text-primary);
}

body.light-theme .github-popup {
    background: rgba(255, 252, 244, 0.97);
}

body.light-theme .selected-tag {
    background: rgba(212, 146, 42, 0.10);
    border-color: rgba(212, 146, 42, 0.22);
}

/* Stat card numbers — dark, high-contrast colors for light bg */
body.light-theme .stat-card.likely .stat-num {
    color: #1e6640;
}

body.light-theme .stat-card.borderline .stat-num {
    color: #7c4902;
}

body.light-theme .stat-card.total .stat-num {
    color: #5a3608;
}

/* Stat card labels & description */
body.light-theme .stat-card h3 {
    color: var(--text-muted);
}

body.light-theme .stat-card .stat-desc {
    color: var(--text-muted);
}

/* Stat card icon — more visible on light bg */
body.light-theme .stat-icon-wrapper {
    opacity: 0.30;
}

body.light-theme .stat-card:hover .stat-icon-wrapper {
    opacity: 0.55;
}

/* Stat card active states */
body.light-theme .stat-card.likely.active {
    background: rgba(46, 125, 82, 0.07);
    border-color: rgba(46, 125, 82, 0.30);
    box-shadow: 0 8px 24px rgba(80, 60, 20, 0.10), 0 0 18px rgba(46, 125, 82, 0.14);
}

body.light-theme .stat-card.borderline.active {
    background: rgba(156, 94, 3, 0.07);
    border-color: rgba(156, 94, 3, 0.30);
    box-shadow: 0 8px 24px rgba(80, 60, 20, 0.10), 0 0 18px rgba(156, 94, 3, 0.14);
}

body.light-theme .stat-card.total.active {
    background: rgba(115, 71, 11, 0.07);
    border-color: rgba(115, 71, 11, 0.30);
    box-shadow: 0 8px 24px rgba(80, 60, 20, 0.10), 0 0 18px rgba(115, 71, 11, 0.14);
}

/* Stat card filter hint on hover */
body.light-theme .stat-card.active .stat-filter-hint {
    color: var(--primary);
}

body.light-theme ::-webkit-scrollbar-track {
    background: rgba(200, 190, 160, 0.18);
}

body.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(212, 146, 42, 0.28);
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 146, 42, 0.35) transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    /* Subtle grain texture overlay */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Background Ambient Blobs — warm amber / ember tones
   ========================================================================== */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(140px);
    z-index: 0;
    opacity: 0.45;
    pointer-events: none;
}

.bg-glow-1 {
    width: 640px;
    height: 640px;
    background: radial-gradient(circle, #a8601a 0%, rgba(168, 96, 26, 0) 70%);
    top: -180px;
    left: -180px;
    animation: floatA 24s infinite alternate ease-in-out;
}

.bg-glow-2 {
    width: 720px;
    height: 720px;
    background: radial-gradient(circle, #7a3a1a 0%, rgba(122, 58, 26, 0) 70%);
    bottom: -180px;
    right: -180px;
    animation: floatB 30s infinite alternate ease-in-out;
}

.bg-glow-3 {
    width: 460px;
    height: 460px;
    background: radial-gradient(circle, #1e4a2c 0%, rgba(30, 74, 44, 0) 70%);
    top: 45%;
    left: 45%;
    animation: floatC 20s infinite alternate ease-in-out;
    opacity: 0.22;
}

@keyframes floatA {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(55px, 45px) scale(1.10);
    }
}

@keyframes floatB {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(-45px, -35px) scale(1.07);
    }
}

@keyframes floatC {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1.18);
    }
}

/* ==========================================================================
   App Layout
   ========================================================================== */
.app-container {
    max-width: 1460px;
    margin: 0 auto;
    padding: 22px 18px 40px;
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   Header — editorial masthead treatment
   ========================================================================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 26px;
    background: rgba(14, 11, 7, 0.82);
    border: 1px solid var(--border-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px 26px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 200, 80, 0.05);
    position: relative;
    overflow: hidden;
}

/* Top accent bar — thin gold line */
.app-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-gradient);
}

/* Subtle corner mark — editorial flourish */
.app-header::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 180px;
    height: 100%;
    background: linear-gradient(to left, rgba(212, 146, 42, 0.04), transparent);
    pointer-events: none;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    font-size: 26px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: rgba(212, 146, 42, 0.10);
    border: 1px solid rgba(212, 146, 42, 0.22);
    border-radius: var(--radius-md);
    box-shadow: 0 0 22px rgba(212, 146, 42, 0.14);
    transition: var(--transition);
}

.logo-icon:hover {
    background: rgba(212, 146, 42, 0.18);
    transform: rotate(-4deg) scale(1.06);
    box-shadow: 0 0 32px rgba(212, 146, 42, 0.28);
}

.app-header h1 {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.6px;
    background: linear-gradient(120deg, #f2ead8 25%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
    font-family: var(--font-display);
}

.app-header .subtitle {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-top: 3px;
    font-weight: 400;
    max-width: 480px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-mono);
    letter-spacing: 0.2px;
}

.header-badge {
    background: rgba(212, 146, 42, 0.08);
    border: 1px solid rgba(212, 146, 42, 0.22);
    color: var(--primary-light);
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 3px;
    /* sharper — editorial feel */
    white-space: nowrap;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.header-meta {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    font-size: 11px;
    flex-wrap: wrap;
    font-family: var(--font-mono);
}

.meta-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 3px 10px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.meta-label {
    color: var(--text-muted);
    font-weight: 500;
}

.meta-link {
    color: var(--primary-light);
    font-weight: 700;
    letter-spacing: 0.3px;
    text-decoration: none;
    transition: var(--transition-fast);
}

.meta-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.github-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-card);
    padding: 10px;
    border-radius: 50%;
    transition: var(--transition);
    text-decoration: none;
}

.github-link:hover {
    color: var(--primary-light);
    background: rgba(212, 146, 42, 0.12);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 0 22px rgba(212, 146, 42, 0.25);
}

.github-link svg {
    display: block;
}

/* Theme Toggle */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-card);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    font-size: 17px;
    transition: var(--transition-bounce);
    flex-shrink: 0;
    overflow: hidden;
}

.theme-toggle-btn:hover {
    background: rgba(212, 146, 42, 0.14);
    border-color: var(--primary);
    transform: translateY(-2px) rotate(18deg);
    box-shadow: 0 0 22px rgba(212, 146, 42, 0.25);
}

.theme-toggle-btn:active {
    transform: scale(0.9) rotate(0deg);
}

#theme-toggle-icon {
    display: block;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    line-height: 1;
}

body.light-theme .theme-toggle-btn {
    background: rgba(160, 130, 60, 0.08);
    border-color: rgba(160, 130, 60, 0.2);
}

body.light-theme .theme-toggle-btn:hover {
    background: rgba(212, 146, 42, 0.14);
    border-color: var(--primary);
    box-shadow: 0 0 16px rgba(212, 146, 42, 0.18);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 330px 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow-md);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: var(--border-card-hover);
}

/* ==========================================================================
   Controls Panel
   ========================================================================== */
.controls-panel {
    padding: 24px 22px;
    position: sticky;
    top: 18px;
}

.panel-title {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--primary-light);
    border-bottom: 1px solid var(--border-card);
    padding-bottom: 14px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
}

.panel-title::before {
    content: "⚙";
    font-size: 13px;
}

.form-group {
    margin-bottom: 18px;
    position: relative;
}

.form-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    font-family: var(--font-mono);
}

.score-helper {
    font-size: 10.5px;
    color: var(--text-muted);
    text-transform: none;
    font-weight: 400;
    letter-spacing: 0;
    font-family: var(--font-body);
}

.badge-val {
    background: var(--primary-gradient);
    color: var(--text-inverse);
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 2px;
    letter-spacing: 0.3px;
    text-transform: none;
    font-family: var(--font-mono);
}

/* Inputs */
.input-wrapper,
.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 13px;
    font-size: 14px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.form-input,
.form-select {
    width: 100%;
    background: rgba(10, 8, 4, 0.75);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
    padding: 11px 14px;
    font-size: 13.5px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    transition: var(--transition);
}

.form-input {
    padding-left: 42px;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(212, 146, 42, 0.16);
    background: rgba(10, 8, 4, 0.92);
}

.form-input:hover,
.form-select:hover {
    border-color: rgba(212, 146, 42, 0.22);
}

.select-wrapper::after {
    content: "▼";
    font-size: 8px;
    color: var(--text-muted);
    position: absolute;
    right: 14px;
    pointer-events: none;
}

.form-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 38px;
    cursor: pointer;
}

.form-select option {
    background-color: #181410;
    color: var(--text-primary);
}

/* Range Slider — gold thumb */
.form-range {
    width: 100%;
    height: 3px;
    background: rgba(255, 200, 80, 0.12);
    outline: none;
    border-radius: 10px;
    appearance: none;
    margin: 10px 0 7px;
    cursor: pointer;
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    cursor: pointer;
    box-shadow: 0 0 14px rgba(212, 146, 42, 0.65);
    transition: var(--transition-bounce);
    border: 2px solid rgba(255, 240, 180, 0.3);
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.22);
}

.range-helper {
    font-size: 10.5px;
    color: var(--text-muted);
    line-height: 1.48;
    display: block;
    font-family: var(--font-mono);
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-top: 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    user-select: none;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: var(--transition);
}

.checkbox-label:hover {
    background: rgba(212, 146, 42, 0.05);
    border-color: rgba(212, 146, 42, 0.14);
}

.checkbox-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkbox-custom {
    height: 17px;
    width: 17px;
    flex-shrink: 0;
    background: rgba(10, 8, 4, 0.75);
    border: 1.5px solid var(--border-card);
    border-radius: 3px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.checkbox-label:hover .checkbox-custom {
    border-color: var(--primary-light);
}

.checkbox-label input:checked~.checkbox-custom {
    background: var(--primary-gradient);
    border-color: transparent;
    box-shadow: 0 0 9px rgba(212, 146, 42, 0.42);
}

.checkbox-custom::after {
    content: "✓";
    font-size: 10px;
    color: var(--text-inverse);
    font-weight: 800;
    display: none;
}

.checkbox-label input:checked~.checkbox-custom::after {
    display: block;
}

.checkbox-text {
    font-size: 13px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.checkbox-label input:checked~.checkbox-text {
    color: var(--text-primary);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 11px 18px;
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    font-family: var(--font-body);
    transition: var(--transition);
    text-align: center;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border: 1px solid var(--border-card);
    margin-top: 6px;
    letter-spacing: 0.8px;
    font-size: 11.5px;
    font-family: var(--font-mono);
}

.btn-secondary:hover {
    background: rgba(212, 146, 42, 0.07);
    color: var(--text-primary);
    border-color: rgba(212, 146, 42, 0.2);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Export */
.btn-export {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(106, 171, 130, 0.09);
    border: 1px solid rgba(106, 171, 130, 0.24);
    color: var(--safe);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-mono);
    transition: var(--transition);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.btn-export:hover {
    background: rgba(106, 171, 130, 0.18);
    border-color: rgba(106, 171, 130, 0.48);
    color: #d4f5e2;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(106, 171, 130, 0.18);
}

/* ==========================================================================
   Stats Cards
   ========================================================================== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .stats-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

.stat-card {
    padding: 20px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    transition: var(--transition-bounce);
    border-radius: var(--radius-lg);
}

/* Thin top accent */
.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: transparent;
    transition: background 0.3s ease;
    border-radius: inherit;
}

.stat-card:hover::after {
    background: rgba(255, 255, 255, 0.02);
}

.stat-card.likely::before {
    background: linear-gradient(90deg, var(--safe), #9addb8);
}

.stat-card.borderline::before {
    background: linear-gradient(90deg, var(--borderline), #f5d175);
}

.stat-card.total::before {
    background: var(--primary-gradient);
}

.stat-card:hover {
    transform: translateY(-4px);
}

/* Active filter */
.stat-card.active {
    transform: translateY(-5px);
}

.stat-card.likely.active {
    border-color: var(--safe-border);
    box-shadow: var(--shadow-md), var(--shadow-glow-safe);
    background: rgba(106, 171, 130, 0.07);
}

.stat-card.borderline.active {
    border-color: var(--borderline-border);
    box-shadow: var(--shadow-md), var(--shadow-glow-borderline);
    background: rgba(232, 169, 58, 0.07);
}

.stat-card.total.active {
    border-color: rgba(212, 146, 42, 0.30);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    background: rgba(212, 146, 42, 0.07);
}

.stat-info {
    position: relative;
    z-index: 1;
}

.stat-card h3 {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-family: var(--font-mono);
}

.stat-card .stat-num {
    font-size: 40px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 6px 0 3px;
    line-height: 1;
    transition: color 0.3s ease;
    font-family: var(--font-display);
    /* Tabular numerals */
    font-variant-numeric: tabular-nums;
}

.stat-card.likely .stat-num {
    color: #c6eed8;
}

.stat-card.borderline .stat-num {
    color: #faeabf;
}

.stat-card.total .stat-num {
    color: #fde5b2;
}

.stat-card .stat-desc {
    font-size: 10.5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.stat-icon-wrapper {
    font-size: 38px;
    opacity: 0.18;
    transition: var(--transition-bounce);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.stat-card:hover .stat-icon-wrapper {
    opacity: 0.45;
    transform: scale(1.12) rotate(7deg);
}

.stat-filter-hint {
    position: absolute;
    bottom: 6px;
    right: 10px;
    font-size: 8.5px;
    color: var(--text-muted);
    opacity: 0;
    transition: var(--transition);
    z-index: 1;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: var(--font-mono);
}

.stat-card:hover .stat-filter-hint {
    opacity: 1;
}

.stat-card.active .stat-filter-hint {
    opacity: 1;
    color: var(--primary-light);
}

/* ==========================================================================
   Results Area
   ========================================================================== */
.results-card {
    padding: 22px 22px 18px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-card);
    padding-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

.results-header h2 {
    font-size: 15px;
    font-weight: 800;
    background: linear-gradient(90deg, var(--text-primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: var(--font-display);
    letter-spacing: -0.3px;
}

.results-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.results-count-label {
    font-size: 11.5px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* ==========================================================================
   Table
   ========================================================================== */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-card);
    background: rgba(10, 8, 4, 0.38);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 760px;
}

.results-table th,
.results-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 200, 80, 0.04);
}

.results-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.results-table th {
    background: rgba(12, 10, 6, 0.95);
    backdrop-filter: blur(8px);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    user-select: none;
    white-space: nowrap;
    font-family: var(--font-mono);
}

.results-table th.sortable {
    cursor: pointer;
    transition: var(--transition);
}

.results-table th.sortable:hover {
    background: rgba(212, 146, 42, 0.12);
    color: var(--primary-light);
}

.sort-icon::after {
    content: " ↕";
    font-size: 9px;
    opacity: 0.28;
}

.results-table th.asc .sort-icon::after {
    content: " ▲";
    opacity: 1;
    color: var(--primary-light);
}

.results-table th.desc .sort-icon::after {
    content: " ▼";
    opacity: 1;
    color: var(--primary-light);
}

.results-table tbody tr {
    transition: background 0.16s ease;
}

.results-table tbody tr:last-child td {
    border-bottom: none;
}

.results-table tbody tr:hover {
    background: rgba(255, 200, 80, 0.025);
}

.results-table tbody tr.row-likely {
    background: rgba(106, 171, 130, 0.030);
}

.results-table tbody tr.row-likely:hover {
    background: rgba(106, 171, 130, 0.060);
}

.results-table tbody tr.row-borderline {
    background: rgba(232, 169, 58, 0.025);
}

.results-table tbody tr.row-borderline:hover {
    background: rgba(232, 169, 58, 0.055);
}

.results-table td {
    line-height: 1.5;
}

.results-table td strong {
    color: var(--text-primary);
    font-weight: 600;
}

.institute-name {
    max-width: 220px;
}

.program-info {
    max-width: 200px;
}

.program-group-tag {
    font-size: 10px;
    color: var(--text-muted);
    display: block;
    margin-top: 3px;
    font-style: italic;
    font-family: var(--font-mono);
}

.text-center {
    text-align: center;
}

/* Score Gap Badge */
.score-gap {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 3px;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.score-gap.gap-safe {
    background: var(--safe-bg);
    color: var(--safe);
    border: 1px solid var(--safe-border);
}

.score-gap.gap-borderline {
    background: var(--borderline-bg);
    color: var(--borderline);
    border: 1px solid var(--borderline-border);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 9px;
    font-size: 10.5px;
    font-weight: 700;
    border-radius: 3px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.badge-likely {
    background: var(--safe-bg);
    color: var(--safe);
    border: 1px solid var(--safe-border);
}

.badge-borderline {
    background: var(--borderline-bg);
    color: var(--borderline);
    border: 1px solid var(--borderline-border);
}

/* Empty State */
.empty-state {
    padding: 56px 20px !important;
}

.empty-state-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 380px;
    margin: 0 auto;
    gap: 0;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.55;
    display: block;
    animation: pulse 3.2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.55;
    }

    50% {
        transform: scale(1.07);
        opacity: 0.80;
    }
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-family: var(--font-display);
}

.empty-state p {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.font-semibold {
    font-weight: 600;
    color: var(--text-primary);
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    border-top: 1px solid var(--border-card);
    padding-top: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

.pagination-container.hidden {
    display: none;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-size-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.page-size-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.page-size-select-wrapper::after {
    content: "▼";
    font-size: 7px;
    color: var(--text-muted);
    position: absolute;
    right: 11px;
    pointer-events: none;
}

.page-size-select {
    background: rgba(10, 8, 4, 0.75);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
    padding: 6px 28px 6px 11px;
    font-size: 12px;
    border-radius: var(--radius-xs);
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
}

.page-size-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(212, 146, 42, 0.16);
}

.page-size-select option {
    background-color: #181410;
    color: var(--text-primary);
}

.pagination-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-nav {
    width: auto;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
    padding: 6px 15px;
    font-size: 11.5px;
    font-weight: 700;
    border-radius: var(--radius-xs);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.btn-nav:hover:not(:disabled) {
    background: rgba(212, 146, 42, 0.12);
    border-color: var(--primary);
    color: var(--primary-light);
    transform: translateY(-1px);
}

.btn-nav:disabled {
    opacity: 0.28;
    cursor: not-allowed;
}

.page-indicator {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 90px;
    text-align: center;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Multi-Select Branch Dropdown
   ========================================================================== */
.dropdown-panel {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #141008;
    border: 1px solid var(--border-card-hover);
    border-radius: var(--radius-md);
    z-index: 200;
    box-shadow: var(--shadow-lg);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: dropIn 0.16s ease;
}

@keyframes dropIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-panel.hidden {
    display: none;
}

.dropdown-actions {
    display: flex;
    justify-content: space-between;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(255, 200, 80, 0.05);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-light);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    padding: 3px 7px;
    border-radius: var(--radius-xs);
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-family: var(--font-mono);
}

.btn-link:hover {
    background: rgba(212, 146, 42, 0.14);
    color: var(--text-primary);
}

.checkbox-list-scroll {
    max-height: 210px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 4px;
}

.branch-checkbox-item {
    display: flex;
    align-items: center;
    padding: 7px 8px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background 0.14s ease;
}

.branch-checkbox-item:hover {
    background: rgba(255, 200, 80, 0.04);
}

.branch-checkbox-item input[type="checkbox"] {
    margin-right: 9px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.branch-checkbox-item .checkbox-label-text {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.branch-checkbox-item input[type="checkbox"]:checked~.checkbox-label-text {
    color: var(--text-primary);
    font-weight: 600;
}

/* Selected Tags */
.selected-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 9px;
    max-height: 110px;
    overflow-y: auto;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(212, 146, 42, 0.10);
    border: 1px solid rgba(212, 146, 42, 0.24);
    color: var(--primary-light);
    font-size: 10.5px;
    font-weight: 600;
    padding: 3px 7px 3px 10px;
    border-radius: 3px;
    transition: var(--transition);
    max-width: 220px;
    font-family: var(--font-mono);
}

.selected-tag span:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selected-tag:hover {
    background: rgba(212, 146, 42, 0.20);
    border-color: rgba(212, 146, 42, 0.48);
}

.tag-close {
    background: none;
    border: none;
    color: var(--primary-light);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: var(--transition);
    line-height: 1;
}

.tag-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* ==========================================================================
   GitHub Follow Popup
   ========================================================================== */
.github-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 1, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.github-popup-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.github-popup-overlay.hidden {
    display: none;
}

.github-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -44%) scale(0.93);
    width: 360px;
    background: rgba(18, 14, 8, 0.97);
    border: 1px solid rgba(255, 200, 80, 0.12);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    padding: 26px 24px 22px;
    z-index: 1000;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
    opacity: 0;
    pointer-events: none;
}

.github-popup.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.github-popup.hidden {
    display: none;
}

.github-popup-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--text-muted);
    font-size: 17px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.github-popup-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.11);
    transform: rotate(90deg);
}

.github-popup-content {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.github-popup-icon {
    color: var(--text-inverse);
    background: var(--primary-gradient);
    padding: 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 22px rgba(212, 146, 42, 0.32);
}

.github-popup-text h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-family: var(--font-display);
}

.github-popup-text p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.github-popup-actions {
    display: flex;
}

.btn-github-follow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: var(--primary-gradient);
    color: var(--text-inverse);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    box-shadow: 0 4px 18px rgba(212, 146, 42, 0.32);
    font-family: var(--font-body);
    letter-spacing: 0.4px;
}

.btn-github-follow:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(212, 146, 42, 0.48), 0 0 15px rgba(232, 120, 74, 0.28);
}

.btn-badge {
    font-size: 14px;
}

/* ==========================================================================
   Loading Spinner
   ========================================================================== */
.loading-row td {
    padding: 60px 20px !important;
    text-align: center;
}

.spinner {
    width: 38px;
    height: 38px;
    border: 2.5px solid rgba(212, 146, 42, 0.12);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin: 0 auto 14px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Scrollbars
   ========================================================================== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(212, 146, 42, 0.28);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
    .controls-panel {
        position: static;
    }

    .app-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .app-header .subtitle {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 14px 12px 30px;
    }

    .app-header {
        padding: 14px 16px;
        border-radius: var(--radius-lg);
    }

    .app-header h1 {
        font-size: 18px;
    }

    .header-badge {
        font-size: 10.5px;
        padding: 4px 11px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card .stat-num {
        font-size: 28px;
    }

    .stat-icon-wrapper {
        font-size: 26px;
    }

    .results-card,
    .controls-panel {
        padding: 16px 14px;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .github-popup {
        width: calc(100% - 28px);
    }

    .pagination-container {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .header-meta {
        gap: 6px;
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-table tbody tr {
    animation: fadeInRow 0.22s ease forwards;
}

/* Score value in table */
.score-val {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* Divider */
.section-divider {
    height: 1px;
    background: var(--border-card);
    margin: 16px 0;
}

/* ==========================================================================
   Tolerance Controller Component
   ========================================================================== */
.tolerance-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.tolerance-stepper {
    display: flex;
    align-items: center;
    background: rgba(22, 19, 14, 0.45);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    overflow: hidden;
    height: 40px;
    transition: var(--transition);
}

body.light-theme .tolerance-stepper {
    background: rgba(255, 252, 244, 0.85);
    border-color: var(--border-card);
}

.tolerance-stepper:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 12px rgba(212, 146, 42, 0.15);
}

.stepper-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    width: 44px;
    height: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    user-select: none;
    font-family: var(--font-mono);
}

.stepper-btn:hover {
    background: rgba(212, 146, 42, 0.12);
    color: var(--primary-light);
}

.stepper-btn:active {
    background: rgba(212, 146, 42, 0.22);
}

.stepper-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    text-align: center;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tolerance-presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.preset-btn {
    background: rgba(22, 19, 14, 0.35);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    padding: 7px 4px;
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: center;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

body.light-theme .preset-btn {
    background: rgba(255, 252, 244, 0.75);
}

.preset-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary-light);
    background: rgba(212, 146, 42, 0.04);
}

.preset-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: var(--text-inverse);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(212, 146, 42, 0.22);
}

body.light-theme .preset-btn.active {
    color: #fff;
}

/* ==========================================================================
   LinkedIn Suggestion Card Component (Bottom-Left)
   ========================================================================== */
.linkedin-card {
    position: fixed;
    bottom: 24px;
    right: 24px;
    left: auto;
    width: 320px;
    background: rgba(18, 14, 8, 0.95);
    border: 1px solid rgba(255, 200, 80, 0.12);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65), var(--shadow-glow);
    padding: 20px 18px 16px;
    z-index: 999;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
}

body.light-theme .linkedin-card {
    background: rgba(255, 252, 244, 0.96);
    border-color: var(--border-card);
    box-shadow: 0 12px 36px rgba(80, 60, 20, 0.18), var(--shadow-glow);
}

.linkedin-card.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.linkedin-card.hidden {
    display: none;
}

.linkedin-card-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--text-muted);
    font-size: 15px;
    cursor: pointer;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-fast);
}

body.light-theme .linkedin-card-close-btn {
    background: rgba(160, 130, 60, 0.06);
    border-color: rgba(160, 130, 60, 0.15);
}

.linkedin-card-close-btn:hover {
    color: var(--primary-light);
    background: rgba(212, 146, 42, 0.12);
}

.linkedin-card-content {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.linkedin-card-icon {
    color: #fff;
    background: #0077b5;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 119, 181, 0.3);
}

.linkedin-card-text h3 {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-family: var(--font-display);
    letter-spacing: -0.2px;
}

.linkedin-card-text p {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.linkedin-card-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-linkedin-connect {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: linear-gradient(135deg, #0077b5 0%, #00a0dc 100%);
    color: #fff;
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 700;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 119, 181, 0.25);
    font-family: var(--font-body);
}

.btn-linkedin-connect:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 119, 181, 0.38);
}

.btn-linkedin-connect:active {
    transform: translateY(0);
}

/* WhatsApp share button */
.btn-whatsapp-share {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: linear-gradient(135deg, #25d366 0%, #128c4e 100%);
    color: #fff;
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 700;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.25);
    font-family: var(--font-body);
    border: none;
    cursor: pointer;
}

.btn-whatsapp-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.40);
}

.btn-whatsapp-share:active {
    transform: translateY(0);
}

@media (max-width: 480px) {
    .linkedin-card {
        width: calc(100% - 28px);
        right: 14px;
        left: auto;
        bottom: 14px;
    }
}