/* ============================================================
   Autonomize OCR Arena — Design System
   Fixed header + sidebar, Autonomize design tokens
   ============================================================ */

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

button {
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    background: none;
    border: none;
    outline: none;
    padding: 0;
    margin: 0;
    color: inherit;
    cursor: pointer;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

[x-cloak] { display: none !important; }

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

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    will-change: transform;
    flex-shrink: 0;
}

.spinner-sm {
    width: 13px;
    height: 13px;
    border-width: 2px;
    border-color: rgba(255,255,255,0.25);
    border-top-color: #fff;
}

/* ---------- Token Aliases ---------- */
:root {
    --primary:        var(--gn-primary);
    --primary-dark:   var(--gn-primary-hover);
    --primary-light:  var(--gn-primary-light);
    --primary-xlight: #F5F3FF;

    --header-bg:     var(--gn-brand-deep);
    --header-height: 66px;
    --sidebar-width: 220px;

    --success:        var(--gn-success);
    --success-text:   var(--gn-success-text);
    --success-bg:     var(--gn-success-light);
    --success-bg-light: #ECFDF5;
    --success-border: #A7F3D0;

    --danger:        var(--gn-danger);
    --danger-text:   var(--gn-danger-text);
    --danger-bg:     var(--gn-danger-light);
    --danger-bg-light: #FEF2F2;
    --danger-border: #FECACA;

    --warning:        var(--gn-warning);
    --warning-text:   var(--gn-warning-text);
    --warning-bg:     var(--gn-warning-light);
    --warning-bg-light: #FFFBEB;
    --warning-border: #FDE68A;

    --info:        var(--gn-info);
    --info-text:   var(--gn-info-text);
    --info-bg:     var(--gn-info-light);
    --info-bg-light: #EFF6FF;
    --info-border: #BFDBFE;

    --text:           var(--gn-text-primary);
    --text-secondary: var(--gn-text-secondary);
    --text-muted:     var(--gn-text-muted);

    --bg-page:  #F4F6F9;
    --bg-card:  var(--gn-surface);
    --bg-hover: var(--gn-surface-alt);

    --border:      var(--gn-border);
    --border-dark: var(--gn-border-strong);

    --shadow-sm: var(--gn-shadow-sm);
    --shadow-md: var(--gn-shadow-md);

    --radius-sm:   var(--gn-radius);
    --radius:      var(--gn-radius-lg);
    --radius-lg:   var(--gn-radius-xl);
    --radius-pill: 20px;

    /* Code / JSON panel — used in dark JSON view */
    --code-bg:   #1f1934;
    --code-text: #f0e9ff;

    /* Layered shadows for modern depth */
    --elev-1: 0 1px 2px rgba(31,4,72,0.04);
    --elev-2: 0 4px 14px rgba(31,4,72,0.08);
    --elev-3: 0 12px 32px rgba(31,4,72,0.12);
    --focus-ring: 0 0 0 3px rgba(77,18,157,0.18);
}

/* ============================================================
   DARK MODE — flips token aliases. All app styles read from the
   aliased names (--text, --bg-card, --primary, etc) so this is the
   only place dark-mode overrides live.
   ============================================================ */
html[data-theme="dark"] {
    color-scheme: dark;

    --gn-surface:        #150933;
    --gn-surface-alt:    #1c0d40;
    --gn-surface-raised: #211050;
    --gn-border:         rgba(255,255,255,0.08);
    --gn-border-strong:  rgba(255,255,255,0.18);
    --gn-text-primary:   rgba(255,255,255,0.95);
    --gn-text-secondary: rgba(255,255,255,0.65);
    --gn-text-muted:     rgba(255,255,255,0.42);
    --gn-primary-light:  rgba(180,124,255,0.16);

    --bg-page:        #09031c;
    --bg-card:        #150933;
    --bg-hover:       #1f0e44;
    --primary:        #b47cff;
    --primary-dark:   #d7b8ff;
    --primary-light:  rgba(180,124,255,0.18);
    --primary-xlight: rgba(180,124,255,0.08);
    --border:         rgba(255,255,255,0.08);
    --border-dark:    rgba(255,255,255,0.18);
    --text:           rgba(255,255,255,0.95);
    --text-secondary: rgba(255,255,255,0.65);
    --text-muted:     rgba(255,255,255,0.42);

    --success-bg:      rgba(6,147,6,0.18);
    --success-bg-light: rgba(6,147,6,0.12);
    --success-text:    #6ee787;
    --danger-bg:       rgba(233,4,14,0.18);
    --danger-bg-light: rgba(233,4,14,0.12);
    --danger-text:     #ff8b91;
    --warning-bg:      rgba(178,116,32,0.20);
    --warning-bg-light: rgba(178,116,32,0.12);
    --warning-text:    #f0c674;
    --info-bg:         rgba(180,124,255,0.16);
    --info-bg-light:   rgba(180,124,255,0.08);
    --info-text:       #d7b8ff;

    --code-bg:   #0a041a;
    --code-text: #ddd1ff;

    --elev-1: 0 1px 2px rgba(0,0,0,0.35);
    --elev-2: 0 4px 14px rgba(0,0,0,0.45);
    --elev-3: 0 12px 32px rgba(0,0,0,0.55);
    --focus-ring: 0 0 0 3px rgba(180,124,255,0.28);

    --header-bg: #050213;
}

html[data-theme="dark"] body {
    background:
        radial-gradient(1200px 600px at 90% -20%, rgba(115,30,227,0.18), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(77,18,157,0.18), transparent 60%),
        var(--bg-page);
    background-attachment: fixed;
}

html[data-theme="dark"] .form-input,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .form-textarea {
    background: var(--bg-card);
    color: var(--text);
    border-color: var(--border);
}
html[data-theme="dark"] .form-input:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}
html[data-theme="dark"] .form-select option { background: var(--bg-card); color: var(--text); }

html[data-theme="dark"] .data-table thead { background: var(--bg-hover); }
html[data-theme="dark"] .data-table tbody tr:hover { background: var(--bg-hover); }
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .card,
html[data-theme="dark"] .model-card,
html[data-theme="dark"] .table-wrapper { background: var(--bg-card); }

html[data-theme="dark"] .btn-secondary {
    background: var(--bg-card);
    color: var(--primary);
    border-color: rgba(180,124,255,0.4);
}
html[data-theme="dark"] .btn-secondary:hover:not(:disabled) { background: var(--primary-xlight); }
html[data-theme="dark"] .btn-ghost { color: var(--text-secondary); border-color: var(--border-dark); }

html[data-theme="dark"] .bcol { background: var(--bg-card); box-shadow: var(--elev-1); }
html[data-theme="dark"] .bcol:hover { box-shadow: var(--elev-2); border-color: var(--border-dark); }
html[data-theme="dark"] .bcol-header { background: rgba(255,255,255,0.02); }
html[data-theme="dark"] .bcol-meta { background: rgba(255,255,255,0.02); }
html[data-theme="dark"] .bcol-tabs { background: var(--bg-card); }
html[data-theme="dark"] .bcol-doc-stage { background: rgba(255,255,255,0.03); }
html[data-theme="dark"] .bcol-doc-stage img { background: #fff; }
html[data-theme="dark"] .bcol-advanced { background: var(--primary-xlight); border-color: var(--primary-light); }
html[data-theme="dark"] .bcol-advanced-toggle { background: var(--bg-card); }
html[data-theme="dark"] .bcol-doc-drop:hover,
html[data-theme="dark"] .bcol-doc-drop.dragover { background: var(--primary-xlight); }
html[data-theme="dark"] .sample-menu { background: var(--bg-card); border-color: var(--border-dark); box-shadow: var(--elev-3); }
html[data-theme="dark"] .sample-menu-item:hover { background: var(--primary-xlight); }
html[data-theme="dark"] .sample-menu-thumb { background: #fff; }
html[data-theme="dark"] .filter-pill { background: var(--bg-card); color: var(--text-secondary); border-color: var(--border); }
html[data-theme="dark"] .filter-pill:hover { color: var(--text); border-color: var(--border-dark); }
html[data-theme="dark"] .filter-pill.active { background: var(--primary); color: #1a0a3a; border-color: var(--primary); }
html[data-theme="dark"] .badge-rank { background: var(--primary-light); color: var(--primary); }
html[data-theme="dark"] .badge-standard,
html[data-theme="dark"] .badge-tie { background: rgba(255,255,255,0.08); color: var(--text-secondary); }
html[data-theme="dark"] .badge-provider { background: rgba(255,255,255,0.06); color: var(--text-secondary); }

html[data-theme="dark"] .login-page {
    background:
        radial-gradient(800px 500px at 80% 10%, rgba(115,30,227,0.25), transparent 60%),
        radial-gradient(700px 400px at 10% 100%, rgba(180,124,255,0.18), transparent 60%),
        #09031c;
}
html[data-theme="dark"] .login-card { background: var(--bg-card); border-color: var(--border-dark); }
html[data-theme="dark"] .login-divider::before { background: var(--border-dark); }
html[data-theme="dark"] .login-divider-text { background: var(--bg-card); color: var(--text-muted); }
html[data-theme="dark"] .login-azure-btn { background: var(--bg-card); color: var(--text); border-color: var(--border-dark); }
html[data-theme="dark"] .login-azure-btn:hover { background: var(--bg-hover); }
html[data-theme="dark"] .login-input { background: var(--bg-page); color: var(--text); border-color: var(--border-dark); }

html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.28); }

body {
    font-family: var(--gn-font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background:
        radial-gradient(1100px 500px at 100% 0%, rgba(180,124,255,0.05), transparent 60%),
        radial-gradient(800px 400px at 0% 100%, rgba(77,18,157,0.03), transparent 60%),
        var(--bg-page);
    background-attachment: fixed;
    color: var(--text);
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* ---------- App Layout — top nav (no sidebar) ---------- */
.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: var(--header-bg);
    backdrop-filter: saturate(160%) blur(8px);
    -webkit-backdrop-filter: saturate(160%) blur(8px);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
    padding: 0 28px;
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    transition: opacity 0.15s;
}
.header-brand:hover { text-decoration: none; opacity: 0.85; }
.header-brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, #b47cff 0%, #731ee3 45%, #4d129d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.1), 0 6px 18px rgba(115,30,227,0.45);
}
.header-brand-name {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}
.header-brand-prefix {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    letter-spacing: 1.4px;
    text-transform: uppercase;
}
.header-brand-product {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: #fff;
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.header-nav-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    transition: all 0.18s ease;
    border: 1px solid transparent;
}
.header-nav-item svg, .header-nav-item i {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}
.header-nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
    text-decoration: none;
}
.header-nav-item.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(180,124,255,0.22), rgba(115,30,227,0.28));
    border-color: rgba(255,255,255,0.14);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}
.header-theme-toggle {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.75);
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: all 0.18s;
}
.header-theme-toggle:hover {
    color: #fff;
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);
}
.header-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 999px;
}
.header-user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #b47cff, #4d129d);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.header-user-name {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,0.92);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.header-logout {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: transparent;
    color: rgba(255,255,255,0.55);
    border: 1px solid rgba(255,255,255,0.1);
    text-decoration: none;
    transition: all 0.18s;
}
.header-logout:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.06);
    text-decoration: none;
}

.app-main {
    padding-top: var(--header-height);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.main-content {
    padding: 24px 32px 24px;
    max-width: 100%;
    margin: 0;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* allow children to control overflow */
}
@media (max-width: 900px) {
    .main-content { padding: 20px 16px 24px; }
}
@media (max-width: 600px) {
    .main-content { padding: 16px 12px 20px; }
}

/* Playground takes the rest of the viewport so the board fills bottom + right */
.playground-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.page-header { margin-bottom: 20px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.page-header-text { flex: 1; }
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ---------- Stat Cards (KPIs) ---------- */
.stat-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 24px; }

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s;
}
.stat-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.stat-icon-purple { background: var(--primary-light); color: var(--primary); }
.stat-icon-yellow { background: var(--warning-bg); color: #D97706; }
.stat-icon-green { background: var(--success-bg-light); color: var(--success); }
.stat-icon-red { background: var(--danger-bg); color: var(--danger); }
.stat-icon-blue { background: var(--info-bg); color: var(--info); }
.stat-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
    color: var(--text);
}
.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ---------- Section Block & Cards ---------- */
.section-block { margin-bottom: 20px; }
.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* ---------- Data Tables ---------- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    background: white;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.data-table thead { background: var(--bg-page); }
.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr.clickable-row { cursor: pointer; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: 0.3px;
}
.badge-lg { padding: 3px 12px; font-size: 11px; font-weight: 700; }
.badge-approved, .badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-denied, .badge-failed { background: var(--danger-bg); color: var(--danger-text); }
.badge-pending { background: var(--warning-bg); color: var(--warning-text); }
.badge-in-progress { background: var(--primary-light); color: var(--primary); }
.badge-urgent { background: var(--danger-bg); color: var(--danger-text); }
.badge-high { background: var(--warning-bg); color: var(--warning-text); }
.badge-standard { background: #F3F4F6; color: #374151; }
.badge-tie { background: #F3F4F6; color: #374151; }
.badge-rank {
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    text-transform: none;
}
.badge-rank-1 { background: linear-gradient(135deg, #f7c97a, #e8af57); color: #4a2a05; }
.badge-rank-2 { background: linear-gradient(135deg, #d6dadf, #b5bcc4); color: #2c343d; }
.badge-rank-3 { background: linear-gradient(135deg, #d9a075, #b97a4e); color: #3a1f0a; }
.badge-provider { background: var(--bg-hover); color: var(--text-secondary); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 2px 6px rgba(77,18,157,0.25); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: white; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-secondary:hover:not(:disabled) { background: var(--primary-xlight); }
.btn-danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }
.btn-ghost { background: none; border: 1px solid var(--border-dark); color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.btn-sm { padding: 5px 11px; font-size: 11px; }
.btn-lg { padding: 11px 22px; font-size: 14px; border-radius: var(--radius); }
.btn-block { width: 100%; }

/* ---------- Tabs ---------- */
.tab-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
}
.tab-btn {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- Filter Pills ---------- */
.filter-pills {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.filter-pill {
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    background: white;
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    font-family: inherit;
    text-decoration: none;
}
.filter-pill:hover { border-color: var(--border-dark); color: var(--text); text-decoration: none; }
.filter-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 12px; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text);
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s;
}
.form-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}
.form-select:hover { border-color: var(--border-dark); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* ---------- File Drop ---------- */
.file-drop {
    border: 2px dashed var(--border-dark);
    border-radius: var(--radius-lg);
    padding: 36px 24px;
    text-align: center;
    background: white;
    cursor: pointer;
    transition: all 0.15s;
}
.file-drop:hover {
    border-color: var(--primary);
    background: var(--primary-xlight);
}
.file-drop.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.file-drop-icon {
    color: var(--primary);
    margin-bottom: 12px;
}
.file-drop-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.file-drop-sub { font-size: 12px; color: var(--text-secondary); }
.file-drop-input { display: none; }
.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--primary-xlight);
    border: 1px solid var(--primary-light);
    border-radius: var(--radius);
    margin-top: 12px;
    font-size: 12px;
}
.file-info .file-name { color: var(--primary); font-weight: 600; flex: 1; }
.file-info .file-size { color: var(--text-secondary); font-size: 11px; }

/* ---------- Flash Messages ---------- */
.flash-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    padding: 10px 20px;
    text-align: center;
    font-size: 13px;
}

/* ---------- Login Page ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gn-brand-deep), var(--gn-brand-dark));
}
.login-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    padding: 32px;
    width: 100%;
    max-width: 400px;
}
.login-header { text-align: center; margin-bottom: 24px; }
.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.login-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #731ee3, #4d129d);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.login-title { font-size: 22px; font-weight: 700; color: var(--text); }
.login-subtitle { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.login-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    margin-bottom: 16px;
    text-align: center;
}
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-field { display: flex; flex-direction: column; gap: 4px; }
.login-label { font-size: 12px; font-weight: 600; color: var(--text); }
.login-input {
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text);
    outline: none;
    font-family: inherit;
}
.login-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.login-submit-btn {
    padding: 11px;
    font-size: 14px;
    font-weight: 600;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}
.login-submit-btn:hover { background: var(--primary-dark); }
.login-divider {
    text-align: center;
    margin: 16px 0;
    position: relative;
}
.login-divider::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 50%;
    height: 1px;
    background: var(--border);
}
.login-divider-text {
    position: relative;
    background: white;
    padding: 0 12px;
    font-size: 11px;
    color: var(--text-muted);
}
.login-azure-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
}
.login-azure-btn:hover { background: var(--bg-hover); text-decoration: none; }
.login-hint {
    text-align: center;
    margin-top: 14px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ---------- RBAC ---------- */
.permission-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ============================================================
   Autonomize OCR Arena — page-specific styles
   ============================================================ */

/* ---------- Battle Page ---------- */
.battle-stage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 16px;
}
.battle-panel {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 480px;
}
.battle-panel-header {
    padding: 14px 18px;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.battle-panel-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.battle-panel-label .anon-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.battle-panel-meta { font-size: 11px; color: var(--text-muted); }
.battle-panel-body {
    flex: 1;
    padding: 16px 18px;
    overflow: auto;
    font-family: var(--gn-font-mono);
    font-size: 12px;
    line-height: 1.65;
    white-space: pre-wrap;
    color: var(--text);
    background: var(--gn-surface);
    min-height: 360px;
}
.battle-panel-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 36px 24px;
    font-family: var(--gn-font-sans);
    flex: 1;
}
.battle-vote-bar {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
}
.vote-btn {
    padding: 12px;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    background: white;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.vote-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--primary-xlight);
    color: var(--primary);
}
.vote-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.vote-btn.btn-tie:hover:not(:disabled) {
    border-color: var(--text-secondary);
    background: var(--bg-hover);
    color: var(--text);
}
.vote-btn.btn-both-bad:hover:not(:disabled) {
    border-color: var(--danger);
    background: var(--danger-bg);
    color: var(--danger-text);
}
.battle-result-banner {
    background: linear-gradient(135deg, var(--primary-xlight), var(--primary-light));
    border: 1px solid var(--primary-light);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.battle-result-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.battle-result-text { flex: 1; }
.battle-result-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.battle-result-sub { font-size: 12px; color: var(--text-secondary); }
.battle-reveal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
}
.battle-reveal-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.battle-reveal-card.winner { border-color: var(--success); background: var(--success-bg-light); }
.battle-reveal-name { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; display: flex; gap: 6px; align-items: center; }
.battle-reveal-meta { font-size: 11px; color: var(--text-secondary); display: flex; justify-content: space-between; margin-top: 6px; }
.elo-delta-up { color: var(--success); font-weight: 700; }
.elo-delta-down { color: var(--danger); font-weight: 700; }
.elo-delta-flat { color: var(--text-muted); font-weight: 600; }

/* ---------- Playground ---------- */
.model-pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.model-pick-card {
    border: 1.5px solid var(--border);
    background: white;
    border-radius: var(--radius);
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.model-pick-card:hover { border-color: var(--primary); }
.model-pick-card.selected {
    border-color: var(--primary);
    background: var(--primary-xlight);
}
.model-pick-name { font-size: 13px; font-weight: 600; color: var(--text); display: flex; justify-content: space-between; align-items: center; }
.model-pick-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.playground-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.pg-result {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.pg-result-header {
    padding: 12px 16px;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
}
.pg-result-name { font-size: 13px; font-weight: 700; color: var(--text); }
.pg-result-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; display: flex; gap: 10px; }
.pg-result-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--border); background: white; }
.pg-tab {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-family: inherit;
}
.pg-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.pg-tab:hover { color: var(--text); }
.pg-result-body {
    font-family: var(--gn-font-mono);
    font-size: 12px;
    line-height: 1.65;
    padding: 14px 16px;
    white-space: pre-wrap;
    overflow: auto;
    max-height: 360px;
}
.pg-result-body pre { white-space: pre-wrap; }
.pg-result-body.is-json { background: #1f1934; color: #f0e9ff; }
.pg-empty {
    grid-column: 1 / -1;
    background: white;
    border: 1px dashed var(--border-dark);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ---------- Leaderboard ---------- */
.leaderboard-row .rank-1 td { background: rgba(232, 175, 87, 0.06); }
.leaderboard-row td.elo-cell {
    font-family: var(--gn-font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
}
.leaderboard-row td.win-rate { color: var(--success); font-weight: 600; }

/* ---------- Models Catalog ---------- */
.model-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}
.model-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    box-shadow: var(--elev-1);
}
.model-card:hover {
    box-shadow: var(--elev-2);
    border-color: var(--border-dark);
    transform: translateY(-1px);
}
.model-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}
.model-card-name { font-size: 15px; font-weight: 700; color: var(--text); }
.model-card-provider { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.model-card-elo {
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    font-family: var(--gn-font-mono);
}
.model-card-desc { font-size: 12px; color: var(--text-secondary); margin: 8px 0 12px; line-height: 1.55; }
.model-card-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.model-card-stat { }
.model-card-stat-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }
.model-card-stat-value { font-size: 13px; font-weight: 600; color: var(--text); }
.model-card-formats { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

/* ============================================================
   Column Board — used by Battle + Playground
   ============================================================ */
.board-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.board-toolbar .spacer { flex: 1; }
.board-toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.board-toolbar-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
.board-toolbar .form-select {
    width: auto;
    min-width: 160px;
    padding: 7px 30px 7px 12px;
    font-size: 12px;
}

.board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    align-items: stretch;
    scroll-snap-type: x proximity;
    flex: 1;
    min-height: 560px;
    /* Cap the board height so each column scrolls internally instead of
       making the whole page grow when an output is long. */
    height: calc(100vh - 220px);
    max-height: calc(100vh - 220px);
}
@media (max-width: 900px) {
    .board { height: auto; max-height: none; min-height: 480px; }
    .bcol { min-width: 280px; }
}
.bcol {
    /* Equal flex share (flex: 1 1 0) — every column grows to fill horizontal
       space proportionally. min-width keeps them readable; horizontal scroll
       only kicks in when columns + gaps exceed the viewport. */
    flex: 1 1 0;
    min-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    scroll-snap-align: start;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(31,4,72,0.04);
}
.bcol:hover { border-color: var(--border-dark); box-shadow: 0 4px 18px rgba(31,4,72,0.08); }
.bcol:hover { border-color: var(--border-dark); }
.bcol.is-winner {
    border-color: var(--success);
    box-shadow: 0 0 0 1px var(--success), 0 4px 14px rgba(6,147,6,0.12);
}
.bcol.is-loser { opacity: 0.7; }

.bcol-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-page);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 50px;
}
.bcol-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
.bcol-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}
.bcol-icon-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.12s;
}
.bcol-icon-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border); }
.bcol-icon-btn.is-danger:hover { color: var(--danger-text); background: var(--danger-bg); border-color: var(--danger-border); }
/* Same click-reliability fix as the run icon — make sure any child SVG/icon
   never swallows the click before it reaches the <button>. */
.bcol-icon-btn > * { pointer-events: none; }

.bcol-picker {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}
.bcol-picker-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bcol-picker .form-select { width: 100%; }

.bcol-meta {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-page);
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--gn-font-mono);
}

.bcol-tabs {
    display: flex;
    gap: 2px;
    padding: 0 10px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}
.bcol-tab {
    padding: 8px 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    font-family: inherit;
}
.bcol-tab:hover { color: var(--text); }
.bcol-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Wrapper that holds the tab panels (.bcol-body siblings). Must be a
   bounded flex container so the active panel can shrink + scroll instead
   of overflowing the column. */
.bcol-body-wrap {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.bcol-body-wrap > .bcol-body { flex: 1 1 auto; min-height: 0; }

.bcol-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px 18px;
    overflow-y: auto;
    overflow-x: auto;
    overflow-wrap: anywhere;
    font-family: var(--gn-font-mono);
    font-size: 12.5px;
    line-height: 1.7;
    white-space: pre-wrap;
    color: var(--text);
    background: var(--bg-card);
}
.bcol-body.is-json {
    background: var(--code-bg);
    color: var(--code-text);
}
.bcol-body.is-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-family: var(--gn-font-sans);
    text-align: center;
    padding: 32px 16px;
    gap: 8px;
}
.bcol-body.is-running {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-family: var(--gn-font-sans);
    gap: 10px;
}
.bcol-body.is-error {
    color: var(--danger-text);
    font-family: var(--gn-font-sans);
    font-size: 12px;
    padding: 16px;
    background: var(--danger-bg-light);
}

/* Document column (first column) — takes equal share like the model columns,
   just with a smaller min-width so it stays compact. */
.bcol-doc { flex: 1 1 0; min-width: 360px; }
.bcol-doc-drop {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-dark);
    border-radius: var(--radius);
    margin: 14px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-secondary);
    gap: 8px;
}
.bcol-doc-drop:hover, .bcol-doc-drop.dragover {
    border-color: var(--primary);
    background: var(--primary-xlight);
    color: var(--primary);
}
.bcol-doc-drop input { display: none; }
.bcol-doc-drop-title { font-size: 13px; font-weight: 600; color: var(--text); }
.bcol-doc-drop-sub { font-size: 11px; color: var(--text-muted); }
.bcol-doc-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 14px;
    gap: 10px;
}
.bcol-doc-thumb {
    flex: 1;
    background: var(--bg-page);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    overflow: hidden;
}
.bcol-doc-thumb img {
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}
.bcol-doc-thumb-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    padding: 24px;
}
.bcol-doc-meta {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    gap: 6px;
}
.bcol-doc-meta strong { color: var(--text); font-family: var(--gn-font-mono); font-weight: 600; }

/* Add-column placeholder */
.bcol-add {
    flex: 0 0 200px;
    min-width: 200px;
    background: transparent;
    border: 2px dashed var(--border-dark);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
    gap: 8px;
    min-height: 520px;
    font-size: 13px;
    font-weight: 600;
}
.bcol-add:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-xlight);
}

/* Vote bar (Battle only) */
.vote-strip {
    margin-top: 18px;
    background: linear-gradient(135deg, var(--primary-xlight), var(--primary-light));
    border: 1px solid var(--primary-light);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.vote-strip-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.vote-strip-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
}
.vote-choice {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius);
    background: white;
    border: 1.5px solid var(--border);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.vote-choice:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: white;
}
.vote-choice:disabled { opacity: 0.4; cursor: not-allowed; }
.vote-choice.is-tie:hover:not(:disabled) { border-color: var(--text-secondary); color: var(--text); }

.vote-result {
    margin-top: 14px;
    padding: 14px 18px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
}
.vote-result-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.vote-result-text { font-size: 13px; color: var(--text); flex: 1; }
.vote-result-text strong { color: var(--primary); }

/* ============================================================
   Playground v2 — sample picker, doc viewer, advanced options, run button
   ============================================================ */

/* Toolbar label */
.board-toolbar-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.form-select-sm {
    padding: 6px 28px 6px 10px;
    font-size: 12px;
    height: auto;
}

/* Sample documents dropdown */
.board-toolbar-group { position: relative; }
.sample-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 50;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 28px rgba(31, 4, 72, 0.12);
    min-width: 320px;
    max-height: 420px;
    overflow-y: auto;
    padding: 6px;
}
.sample-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.12s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.sample-menu-item:hover { background: var(--primary-xlight); }
.sample-menu-thumb {
    width: 38px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 3px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.sample-menu-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sample-menu-text { flex: 1; min-width: 0; }
.sample-menu-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sample-menu-sub {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sample-menu-tag {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    background: var(--primary-light);
    color: var(--primary);
    flex-shrink: 0;
}

/* Document column — viewer */
.bcol-doc-drop-or {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}
.bcol-doc-stage {
    flex: 1;
    background: var(--bg-page);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    overflow: auto;
    padding: 12px;
    position: relative;
}
.bcol-doc-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: white;
    transition: transform 0.18s ease;
    box-shadow: 0 2px 10px rgba(31, 4, 72, 0.08);
}
.bcol-doc-pdf {
    width: 100%;
    height: 100%;
    min-height: 360px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
}
.bcol-doc-actions {
    display: flex;
    gap: 8px;
}
.bcol-zoom-label {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--gn-font-mono);
    font-weight: 600;
    min-width: 32px;
    text-align: center;
}

/* Model column — pickers & advanced */
.bcol-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: block;
}
.bcol-picker { gap: 0; }
.bcol-picker .form-select,
.bcol-picker .form-textarea { width: 100%; }

.bcol-advanced-toggle {
    margin-top: 10px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    transition: all 0.12s;
}
.bcol-advanced-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.bcol-advanced {
    margin-top: 8px;
    padding: 10px;
    background: var(--primary-xlight);
    border-radius: var(--radius-sm);
    border: 1px solid var(--primary-light);
}
.bcol-advanced .bcol-label { margin-bottom: 4px; }

/* Inline hint for layout-only models (Azure DI) — no prompt/temp panel */
.bcol-no-prompt-hint {
    margin-top: 10px;
    padding: 8px 11px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
}
.bcol-no-prompt-hint i { color: var(--text-muted); }
.bcol-advanced .form-textarea {
    font-size: 11px;
    font-family: var(--gn-font-mono);
    padding: 6px 8px;
    line-height: 1.4;
}
.bcol-range {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.bcol-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 0 0 1px var(--primary);
}
.bcol-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 0 0 1px var(--primary);
}
.bcol-range-value {
    font-family: var(--gn-font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    min-width: 28px;
    text-align: right;
}

/* Green play-icon "Run" button in the column header — saves vertical space */
.bcol-run-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #16b56a, #069306);
    color: #ffffff;
    border: 1px solid rgba(6, 147, 6, 0.4);
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 2px 6px rgba(6, 147, 6, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    padding: 0;
    flex-shrink: 0;
}
.bcol-run-icon:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(6, 147, 6, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.bcol-run-icon:active:not(:disabled) {
    transform: scale(0.95);
}
.bcol-run-icon:disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
    border-color: var(--border);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.65;
}
.bcol-run-icon i { transform: translateX(0.5px); /* visually center the play triangle */ }

/* Make sure clicks always land on the <button>, not on a child SVG that may
   be rendered/replaced asynchronously by Lucide. */
.bcol-run-icon > * { pointer-events: none; }
.bcol-run-icon-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

html[data-theme="dark"] .bcol-run-icon {
    background: linear-gradient(135deg, #1ed079, #069306);
    border-color: rgba(110, 231, 135, 0.45);
    box-shadow: 0 2px 8px rgba(6, 147, 6, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
html[data-theme="dark"] .bcol-run-icon:disabled {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.08);
}

/* ============================================================
   Model icons + custom model dropdown
   ============================================================ */

/* Provider icon — used in dropdown, trigger button, and model cards */
.model-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 7px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-page);
    border: 1px solid var(--border);
    transition: border-color 0.15s ease;
}
.model-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.model-icon-lg {
    width: 44px;
    height: 44px;
    border-radius: 10px;
}

.model-card-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

/* Custom Alpine dropdown trigger */
.bcol-model-picker {
    position: relative;
}
.bcol-model-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 8px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-height: 48px;
}
.bcol-model-trigger:hover { border-color: var(--border-dark); }
.bcol-model-trigger.is-open,
.bcol-model-trigger:focus-visible {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
    outline: none;
}
.bcol-model-trigger.is-empty { color: var(--text-muted); }

.bcol-model-trigger-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.bcol-model-trigger-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
    flex: 1;
}
.bcol-model-trigger-placeholder {
    flex: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}
.bcol-model-trigger-text .model-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bcol-model-trigger-text .model-provider {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bcol-model-trigger-chevron {
    color: var(--text-muted);
    transition: transform 0.18s ease;
    flex-shrink: 0;
}
.bcol-model-trigger-chevron.is-flipped { transform: rotate(180deg); }

/* Dropdown menu */
.bcol-model-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 40;
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    box-shadow: var(--elev-3);
    padding: 6px;
    max-height: 360px;
    overflow-y: auto;
}
.bcol-model-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background 0.12s ease;
}
.bcol-model-option:hover { background: var(--primary-xlight); }
.bcol-model-option.is-selected {
    background: var(--primary-light);
}
.bcol-model-option-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}
.bcol-model-option-text .model-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.bcol-model-option-text .model-provider {
    font-size: 10.5px;
    color: var(--text-muted);
}
.model-elo {
    font-size: 11px;
    font-weight: 700;
    font-family: var(--gn-font-mono);
    color: var(--primary);
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    background: var(--primary-light);
    flex-shrink: 0;
}
.bcol-model-empty {
    padding: 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }


/* ============================================================
   Compare Mode — mode toggle, ground-truth column, diff renderer,
   score pills, save toast, history page
   ============================================================ */

/* ---------- Mode toggle (Free Run ↔ Compare Mode) ------------------------ */
.playground-mode-toggle { flex-shrink: 0; }
.mode-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 4px 4px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    transition: all 0.18s ease;
}
.mode-switch:hover { border-color: var(--border-dark); }
.mode-switch input { display: none; }
.mode-switch-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-right: 4px;
}
.mode-switch-track {
    width: 32px;
    height: 18px;
    background: var(--border-dark);
    border-radius: 999px;
    position: relative;
    transition: background 0.18s ease;
    flex-shrink: 0;
}
.mode-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: left 0.18s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.mode-switch.is-on .mode-switch-track { background: var(--primary); }
.mode-switch.is-on .mode-switch-thumb { left: 16px; }
.mode-switch.is-on .mode-switch-label { color: var(--primary); }

/* ---------- Ground-Truth column ------------------------------------------ */
.bcol-truth {
    flex: 0 1 380px;
    min-width: 320px;
    max-width: 460px;
    background: var(--bg-card);
    border: 1px solid var(--primary-light);
    box-shadow: 0 0 0 1px rgba(115,30,227,0.05), 0 2px 12px rgba(115,30,227,0.05);
}
.bcol-tag-truth {
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.bcol-truth-count {
    font-size: 10px;
    font-family: var(--gn-font-mono);
    color: var(--text-muted);
}
.bcol-truth-source {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}
.bcol-truth-source button {
    flex: 1;
    padding: 7px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.bcol-truth-source button:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}
.bcol-truth-source button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.bcol-truth-source button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.bcol-truth-textarea {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    font-family: var(--gn-font-mono);
    font-size: 12.5px;
    line-height: 1.65;
    padding: 16px 18px;
    resize: none;
    overflow: auto;
}
.bcol-truth-textarea:focus {
    border: none;
    box-shadow: inset 0 0 0 2px var(--primary-light);
}
.bcol-truth-judge {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.bcol-truth-judge-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.45;
}
.bcol-truth-judge-output {
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--bg-page);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-family: var(--gn-font-mono);
    font-size: 12px;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow: auto;
}
.bcol-truth-stored {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.bcol-truth-stored .bcol-truth-stored-text {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overflow-wrap: anywhere;
}
.bcol-truth-stored-label {
    font-size: 11px;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.bcol-truth-stored-text {
    margin: 0;
    font-family: var(--gn-font-mono);
    font-size: 12px;
    line-height: 1.65;
    color: var(--text);
    white-space: pre-wrap;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

/* ---------- Score pill bar (per model column) ---------------------------- */
.bcol-score-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(115,30,227,0.04), transparent);
}
.score-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-page);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    white-space: nowrap;
}
.score-pill strong {
    color: var(--text);
    font-weight: 700;
    font-family: var(--gn-font-mono);
}
.score-pill-cer {
    background: var(--primary-light);
    color: var(--primary);
    border-color: rgba(115,30,227,0.2);
}
.score-pill-cer strong { color: var(--primary); }
.score-pill-wer {
    background: var(--info-bg-light);
    color: var(--info-text);
    border-color: var(--info-border);
}
.score-pill-missed {
    background: var(--success-bg-light);
    color: var(--success-text);
    border-color: var(--success-border);
}
.score-pill-halluc {
    background: var(--danger-bg-light);
    color: var(--danger-text);
    border-color: var(--danger-border);
}
.score-pill-subs {
    background: var(--warning-bg-light);
    color: var(--warning-text);
    border-color: var(--warning-border);
}
.score-pill-judge {
    background: linear-gradient(135deg, rgba(115,30,227,0.10), rgba(80,12,170,0.16));
    color: var(--primary);
    border-color: rgba(115,30,227,0.28);
}
.score-pill-judge strong { color: var(--primary); }

/* ---------- LLM-as-judge action + Issues tab ---------------------------- */
.bcol-judge-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 10px;
    border-bottom: 1px solid var(--border);
}
.bcol-judge-btn {
    background: var(--bg-card);
    border: 1px dashed rgba(115,30,227,0.35);
    color: var(--primary);
}
.bcol-judge-btn:hover:not(:disabled) {
    background: var(--primary-light);
    border-style: solid;
}
.bcol-judge-error {
    font-size: 11px;
    color: var(--danger-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bcol-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 5px;
    margin-left: 5px;
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    font-size: 9.5px;
    font-weight: 700;
    font-family: var(--gn-font-mono);
}

.bcol-body.is-judge,
.history-result-body.is-judge {
    padding: 14px;
    overflow-y: auto;
}
.history-result-body.is-judge {
    background: var(--bg-card);
    max-height: 440px;
}
.judge-summary-card {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 14px;
}
.judge-summary-scores {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.judge-score-tile {
    text-align: center;
    padding: 10px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.judge-score-tile-num {
    font-family: var(--gn-font-mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}
.judge-score-tile-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}
.judge-summary-text {
    margin-top: 12px;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-secondary);
}
.judge-meta {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    color: var(--text-muted);
    font-family: var(--gn-font-mono);
}

.judge-issues {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.judge-issue {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--bg-card);
}
.judge-issue-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.judge-issue-sev {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: var(--bg-page);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.judge-issue-sev-high {
    background: var(--danger-bg-light);
    color: var(--danger-text);
    border-color: var(--danger-border);
}
.judge-issue-sev-med {
    background: var(--warning-bg-light);
    color: var(--warning-text);
    border-color: var(--warning-border);
}
.judge-issue-sev-low {
    background: var(--info-bg-light);
    color: var(--info-text);
    border-color: var(--info-border);
}
.judge-issue-cat {
    font-size: 10.5px;
    color: var(--text-secondary);
    font-family: var(--gn-font-mono);
    text-transform: lowercase;
}
.judge-issue-desc {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text);
}
.judge-issue-diff {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 7px;
    font-size: 11.5px;
}
.judge-issue-diff > div {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.judge-issue-label {
    font-size: 9.5px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 60px;
}
.judge-issue-diff code {
    font-family: var(--gn-font-mono);
    background: var(--bg-page);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 11px;
    word-break: break-word;
}
.judge-no-issues {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px;
    font-size: 12.5px;
    color: var(--text-secondary);
    background: var(--success-bg-light);
    border: 1px solid var(--success-border);
    border-radius: 8px;
}

/* ---------- Inline diff highlighting ------------------------------------ */
.bcol-body.is-diff {
    font-family: var(--gn-font-mono);
    font-size: 12.5px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
}
.diff-seg { white-space: pre-wrap; }
.diff-equal { /* no styling */ }
.diff-delete {
    background: rgba(6,147,6,0.14);
    color: var(--success-text);
    text-decoration: underline;
    text-decoration-color: rgba(6,147,6,0.5);
    text-decoration-thickness: 2px;
    border-radius: 2px;
    padding: 0 1px;
}
.diff-insert {
    background: rgba(233,4,14,0.14);
    color: var(--danger-text);
    text-decoration: line-through;
    text-decoration-color: rgba(233,4,14,0.5);
    text-decoration-thickness: 2px;
    border-radius: 2px;
    padding: 0 1px;
}
.diff-replace {
    background: rgba(178,116,32,0.22);
    color: var(--warning-text);
    border-radius: 2px;
    padding: 0 1px;
    cursor: help;
}

.diff-legend {
    margin-top: 18px;
    padding: 10px 12px;
    border-top: 1px dashed var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--gn-font-sans);
    line-height: 1.4;
}
.diff-legend span { display: inline-flex; align-items: center; gap: 5px; }
.diff-equal-swatch, .diff-delete-swatch, .diff-insert-swatch, .diff-replace-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
    border: 1px solid var(--border);
}
.diff-equal-swatch { background: transparent; }
.diff-delete-swatch { background: rgba(6,147,6,0.3); border-color: var(--success); }
.diff-insert-swatch { background: rgba(233,4,14,0.3); border-color: var(--danger); }
.diff-replace-swatch { background: rgba(178,116,32,0.45); border-color: var(--warning); }

/* ---------- Save toast --------------------------------------------------- */
.pg-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 22px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(115,30,227,0.35);
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ---------- History pages ----------------------------------------------- */
.history-empty {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px dashed var(--border-dark);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.history-empty-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-top: 12px;
}
.history-empty-sub {
    font-size: 12px;
    color: var(--text-secondary);
    max-width: 480px;
}
.history-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.history-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
}
.history-summary-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 4px;
}
.history-summary-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    font-family: var(--gn-font-mono);
}
.history-ground-truth {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
    padding: 14px 18px;
    font-family: var(--gn-font-mono);
    font-size: 12px;
    line-height: 1.65;
    color: var(--text);
    white-space: pre-wrap;
    max-height: 240px;
    overflow: auto;
}
.history-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 16px;
}
.history-result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--elev-1);
}
.history-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.history-result-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.history-result-meta {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
    font-family: var(--gn-font-mono);
}
.history-result-meta .meta-sep { color: var(--border-dark); }
.history-result-meta .meta-missed { color: var(--success-text); }
.history-result-meta .meta-halluc { color: var(--danger-text); }
.history-result-meta .meta-subs   { color: var(--warning-text); }
.history-result-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}
.history-result-body {
    font-family: var(--gn-font-mono);
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg-page);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    max-height: 360px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.history-result-body.is-json { background: var(--code-bg); color: var(--code-text); }
.history-table .clickable-row { cursor: pointer; }
.history-table .clickable-row:hover { background: var(--bg-hover); }

/* ---------- Dark-mode tweaks for the new surfaces ------------------------ */
html[data-theme="dark"] .bcol-truth {
    background: var(--bg-card);
    border-color: rgba(180,124,255,0.28);
    box-shadow: 0 0 0 1px rgba(180,124,255,0.10), 0 2px 12px rgba(180,124,255,0.08);
}
html[data-theme="dark"] .mode-switch { background: var(--bg-card); }
html[data-theme="dark"] .diff-delete {
    background: rgba(110,231,135,0.20);
    text-decoration-color: rgba(110,231,135,0.7);
}
html[data-theme="dark"] .diff-insert {
    background: rgba(255,139,145,0.20);
    text-decoration-color: rgba(255,139,145,0.7);
}
html[data-theme="dark"] .diff-replace {
    background: rgba(240,198,116,0.25);
}
html[data-theme="dark"] .diff-delete-swatch { background: rgba(110,231,135,0.5); border-color: var(--success-text); }
html[data-theme="dark"] .diff-insert-swatch { background: rgba(255,139,145,0.5); border-color: var(--danger-text); }
html[data-theme="dark"] .diff-replace-swatch { background: rgba(240,198,116,0.6); border-color: var(--warning-text); }
html[data-theme="dark"] .pg-toast {
    background: var(--primary);
    color: #1a0a3a;
    box-shadow: 0 8px 28px rgba(180,124,255,0.35);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .battle-stage { grid-template-columns: 1fr; }
    .battle-vote-bar { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    .app-sidebar { display: none; }
    .app-main { margin-left: 0; }
    .sample-menu { left: -16px; min-width: 280px; }
    .playground-mode-toggle { margin-top: 8px; }
}

/* ============================================================ */
/* Playground v2 layout — sticky rail + responsive card grid    */
/* ============================================================ */

.pg-layout {
    display: grid;
    grid-template-columns: minmax(300px, 3fr) minmax(0, 7fr);
    gap: 16px;
    flex: 1;
    min-height: 0;
    align-items: stretch;
}

/* ---- Mode segmented control --------------------------------- */
.pg-mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.pg-mode-switch button {
    appearance: none;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
    display: grid;
    grid-template-areas:
        "icon name"
        ".    desc";
    grid-template-columns: 18px 1fr;
    column-gap: 8px;
    row-gap: 2px;
    font-family: inherit;
}
.pg-mode-switch button > i { grid-area: icon; color: var(--text-muted); }
.pg-mode-switch-name {
    grid-area: name;
    font-size: 13px; font-weight: 700;
    color: var(--text);
}
.pg-mode-switch-desc {
    grid-area: desc;
    font-size: 10.5px;
    color: var(--text-muted);
    line-height: 1.35;
}
.pg-mode-switch button:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.pg-mode-switch button:hover > i,
.pg-mode-switch button:hover .pg-mode-switch-desc { color: var(--primary); }
.pg-mode-switch button.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(115,30,227,0.25);
}
.pg-mode-switch button.active > i,
.pg-mode-switch button.active .pg-mode-switch-name,
.pg-mode-switch button.active .pg-mode-switch-desc {
    color: #fff;
}
.pg-mode-switch button.active .pg-mode-switch-desc { opacity: 0.85; }

/* ---- Left rail — stretches to match the main column's height */
.pg-rail {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    box-shadow: var(--elev-1);
    min-height: 0;
}
.pg-rail-section { display: flex; flex-direction: column; gap: 8px; }
/* Ground-truth section absorbs any extra rail height so the textarea
   stretches to match the right-side column. */
.pg-rail-truth { flex: 1 1 auto; min-height: 0; }
.pg-rail-section-head {
    display: flex; justify-content: space-between; align-items: center;
}
.pg-rail-section-title {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-muted);
}
.pg-rail-section-count {
    font-size: 10px; color: var(--text-muted);
    font-family: var(--gn-font-mono);
}

/* Empty-state drop zone */
.pg-doc-drop {
    border: 2px dashed var(--border-dark);
    border-radius: var(--radius);
    padding: 22px 14px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    cursor: pointer;
    color: var(--text-muted);
    text-align: center;
    transition: all 0.15s;
}
.pg-doc-drop:hover, .pg-doc-drop.dragover {
    border-color: var(--primary); color: var(--primary);
    background: var(--primary-light);
}
.pg-doc-drop-title { font-size: 12.5px; font-weight: 600; color: var(--text); }
.pg-doc-drop-sub { font-size: 10.5px; }
.pg-doc-drop input[type="file"] { display: none; }

/* Compact thumbnail after upload */
.pg-doc-mini { display: flex; flex-direction: column; gap: 6px; }
.pg-doc-mini-thumb {
    position: relative;
    width: 100%;
    height: 380px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-page);
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.12s;
}
.pg-doc-mini-thumb:hover { border-color: var(--primary); }
.pg-doc-mini-thumb iframe {
    width: 100%; height: 100%;
    border: none;
    /* PDFs stay interactive so the user can scroll between pages. */
}
.pg-doc-mini-img-btn {
    appearance: none;
    background: transparent; border: none; padding: 0;
    width: 100%; height: 100%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.pg-doc-mini-img-btn img {
    width: 100%; height: 100%; object-fit: contain;
}
.pg-doc-mini-fallback {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    color: var(--text-muted); font-size: 11px;
}
/* Corner "Expand" button — always clickable; needed for PDFs whose iframe
   captures pointer events for scrolling. */
.pg-doc-mini-expand {
    position: absolute; top: 6px; right: 6px;
    background: rgba(31,4,72,0.85); color: #fff;
    border: 1px solid rgba(255,255,255,0.15);
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 10px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 4px;
    cursor: pointer;
    opacity: 0.78; transition: opacity 0.15s, transform 0.12s;
    font-family: inherit;
    z-index: 2;
}
.pg-doc-mini-thumb:hover .pg-doc-mini-expand { opacity: 1; }
.pg-doc-mini-expand:hover { transform: translateY(-1px); opacity: 1; }
.pg-doc-mini-thumb.is-pdf .pg-doc-mini-expand { opacity: 0.92; }
.pg-doc-mini-meta {
    display: flex; justify-content: space-between; gap: 6px;
    font-size: 11px; color: var(--text-secondary);
}
.pg-doc-mini-name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.pg-doc-mini-size { font-family: var(--gn-font-mono); font-weight: 600; }
.pg-doc-mini-actions { display: flex; gap: 6px; }

/* Ground-truth textarea + readouts get bounded heights in the rail */
.pg-rail-truth .bcol-truth-textarea {
    flex: 1 1 auto;
    min-height: 280px;
    /* No upper cap — fills any extra rail height to match the right side. */
    border-radius: var(--radius); border: 1px solid var(--border); padding: 12px;
}
.pg-rail-truth .bcol-truth-textarea:focus { box-shadow: 0 0 0 2px var(--primary-light); }
.pg-rail-truth .bcol-truth-judge,
.pg-rail-truth .bcol-truth-stored {
    padding: 0;
}
.pg-rail-truth .bcol-truth-judge-output,
.pg-rail-truth .bcol-truth-stored-text {
    max-height: 360px;
}

/* Toolbar action group — replaces the old rail-bottom actions */
.pg-toolbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.pg-toolbar-actions .btn { white-space: nowrap; }

/* ---- Right side: ranking strip + grid ----------------------- */
.pg-main {
    display: flex; flex-direction: column; gap: 14px;
    min-height: 0; min-width: 0;
}

/* ---- Leaderboard — compact single-row cards ----------------- */
.pg-leaderboard {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px 12px;
}
.pg-leaderboard-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    padding: 0 2px;
}
.pg-leaderboard-title {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 700; color: var(--text);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.pg-leaderboard-title i { color: var(--primary); }
.pg-leaderboard-sub {
    font-size: 10.5px; color: var(--text-muted);
    font-family: var(--gn-font-mono);
}
/* Three-column grid of compact rank cards */
.pg-leaderboard-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

/* Vertical card: header (medal/name/latency) + stacked metric bars */
.pg-rank-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s, background 0.12s, box-shadow 0.12s;
    font-family: inherit;
    text-align: left;
    position: relative;
}
.pg-rank-card:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(115,30,227,0.10);
}
.pg-rank-card:hover .pg-rank-jump-hint { color: var(--primary); opacity: 1; }
.pg-rank-card:hover .pg-rank-jump-hint i { transform: translateX(2px); }

/* Header row inside the card */
.pg-rank-head {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

/* Tiny medal — number badge with gold/silver/bronze tint for top 3 */
.pg-rank-medal {
    width: 22px; height: 22px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-family: var(--gn-font-mono);
    font-size: 11px; font-weight: 800;
    color: var(--text-secondary);
}
.pg-rank-card.is-gold .pg-rank-medal {
    background: linear-gradient(135deg, #ffe187, #d4a01e);
    border-color: #b8860b; color: #5b3b07;
}
.pg-rank-card.is-silver .pg-rank-medal {
    background: linear-gradient(135deg, #f1f3f7, #b8c0cc);
    border-color: #8d96a3; color: #2c3340;
}
.pg-rank-card.is-bronze .pg-rank-medal {
    background: linear-gradient(135deg, #f0c9a0, #b87333);
    border-color: #8d5524; color: #3d2110;
}
.pg-rank-card.is-gold {
    background: linear-gradient(135deg, rgba(255,212,71,0.10), transparent);
    border-color: rgba(212,160,30,0.35);
}

/* Model identity */
.pg-rank-id {
    display: flex; flex-direction: column; gap: 1px;
    min-width: 0;
}
.pg-rank-name {
    font-size: 12.5px; font-weight: 700; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    line-height: 1.2;
}
.pg-rank-provider {
    font-size: 10px; color: var(--text-muted);
    font-family: var(--gn-font-mono);
    text-transform: lowercase;
    line-height: 1.2;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Stacked metric bars inside the card */
.pg-rank-metrics {
    display: flex; flex-direction: column; gap: 4px;
    min-width: 0;
}
.pg-rank-metric {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.pg-rank-metric-label {
    font-size: 9.5px; font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.pg-rank-bar-track {
    height: 5px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.pg-rank-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.35s cubic-bezier(.2,.7,.2,1);
    background: var(--primary);
}
.pg-rank-bar-fill-cer { background: linear-gradient(90deg, #731ee3, #c594ff); }
.pg-rank-bar-fill-wer { background: linear-gradient(90deg, #2563eb, #93c5fd); }
.pg-rank-bar-fill-judge { background: linear-gradient(90deg, #16a34a, #86efac); }
.pg-rank-metric-val {
    font-family: var(--gn-font-mono);
    font-size: 10.5px; font-weight: 700;
    color: var(--text);
    text-align: right;
    min-width: 38px;
}

.pg-rank-latency {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 10px; color: var(--text-secondary);
    font-family: var(--gn-font-mono);
    white-space: nowrap;
}

.pg-rank-jump-hint {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 10px; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    align-self: flex-end;
    opacity: 0.7;
    transition: color 0.15s, opacity 0.15s;
}
.pg-rank-jump-hint i { transition: transform 0.15s; }

/* Narrow main area → 2-column grid; very narrow → 1-column */
@media (max-width: 1180px) {
    .pg-leaderboard-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .pg-leaderboard-list { grid-template-columns: 1fr; }
}

/* Flash highlight when scrolled-to */
.pg-card.is-flash {
    animation: pgCardFlash 1.4s ease-out;
}
@keyframes pgCardFlash {
    0%   { box-shadow: 0 0 0 0 rgba(115,30,227,0.6); border-color: var(--primary); }
    50%  { box-shadow: 0 0 0 8px rgba(115,30,227,0.12); border-color: var(--primary); }
    100% { box-shadow: 0 0 0 0 rgba(115,30,227,0);    border-color: var(--border); }
}

/* Two-column max grid (wraps to extra rows; never wider than 2 across). */
.pg-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-content: start;
    min-width: 0;
}

/* Cards reuse .bcol styling; override the flex/min-width that the
   old horizontal-scroll board needed. */
.pg-card {
    flex: none;
    min-width: 0;
    min-height: 480px;
    max-height: calc(100vh - 220px);
}

/* ---- Document lightbox modal -------------------------------- */
.pg-doc-modal {
    position: fixed; inset: 0;
    background: rgba(15, 2, 39, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 28px;
}
.pg-doc-modal-frame {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0,0,0,0.4);
    width: min(1100px, 94vw);
    height: min(840px, 90vh);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.pg-doc-modal-head {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-page);
}
.pg-doc-modal-name {
    flex: 1; font-size: 13px; font-weight: 600; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pg-doc-modal-controls { display: inline-flex; gap: 6px; align-items: center; }
.pg-doc-modal-stage {
    flex: 1; min-height: 0;
    display: flex; align-items: center; justify-content: center;
    overflow: auto;
    background: var(--bg-page);
    padding: 16px;
}
.pg-doc-modal-stage img {
    max-width: 100%; max-height: 100%;
    transform-origin: center;
    transition: transform 0.18s;
}
.pg-doc-modal-stage iframe { width: 100%; height: 100%; border: none; }

/* Top-toolbar hint chip */
.pg-toolbar-hint {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; color: var(--text-muted);
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
}

/* Narrow viewports: rail stacks above grid */
@media (max-width: 1024px) {
    .pg-layout { grid-template-columns: 1fr; }
    .pg-rail { position: static; max-height: none; }
    .pg-grid { grid-template-columns: 1fr; }
    .pg-card { max-height: none; min-height: 420px; }
}

/* ---- "Pages to OCR" input (rail, PDF-only) ------------------ */
.pg-pages-input {
    display: flex; flex-direction: column; gap: 4px;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.pg-pages-input .form-input {
    font-family: var(--gn-font-mono);
    font-size: 12px;
    padding: 7px 10px;
}
.pg-pages-input-hint {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.45;
}
.pg-pages-input-hint code {
    font-family: var(--gn-font-mono);
    font-size: 10px;
    background: var(--bg-page);
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* "Reference for Page N" hint shown above the From-model readout when
   the run produced per-page references for a multi-page selection. */
.bcol-truth-judge-pagehint {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 10px;
    padding: 4px 9px;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(115,30,227,0.25);
    border-radius: 999px;
    font-size: 10.5px; font-weight: 600;
}
.bcol-truth-judge-pagehint strong { font-weight: 800; }

/* ---- Page slider (above leaderboard / grid) ----------------- */
.pg-page-slider {
    display: flex; align-items: stretch; gap: 10px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--elev-1);
}
.pg-page-arrow {
    flex-shrink: 0;
    width: 36px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all 0.12s;
}
.pg-page-arrow:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.pg-page-arrow:disabled { opacity: 0.4; cursor: not-allowed; }

.pg-page-slider-body {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 6px;
}
.pg-page-slider-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
}
.pg-page-slider-label {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; color: var(--text-secondary);
}
.pg-page-slider-label i { color: var(--primary); }
.pg-page-slider-label strong { color: var(--text); font-weight: 700; }
.pg-page-slider-counter {
    font-family: var(--gn-font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

/* The actual range input — styled across browsers */
.pg-page-slider-range {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary) var(--pg-slider-pct, 0%), var(--border) var(--pg-slider-pct, 0%));
    border-radius: 999px;
    outline: none;
    cursor: pointer;
}
.pg-page-slider-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px; height: 18px;
    background: var(--primary);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(115,30,227,0.35);
    cursor: pointer;
    transition: transform 0.12s;
}
.pg-page-slider-range::-webkit-slider-thumb:hover { transform: scale(1.12); }
.pg-page-slider-range::-moz-range-thumb {
    width: 18px; height: 18px;
    background: var(--primary);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(115,30,227,0.35);
    cursor: pointer;
}

.pg-page-slider-ticks {
    display: flex; gap: 4px;
    flex-wrap: wrap;
}
.pg-page-tick {
    min-width: 26px;
    padding: 2px 7px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-family: var(--gn-font-mono);
    font-size: 10.5px; font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.12s;
}
.pg-page-tick:hover { border-color: var(--primary); color: var(--primary); }
.pg-page-tick.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Empty-page placeholder inside a model card */
.bcol-body-page-missing {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 8px;
    padding: 36px 14px;
    font-family: var(--gn-font-sans);
    color: var(--text-muted);
    text-align: center;
    font-size: 12.5px;
}
