/* ══════════════════════════════════════════════════════════════
   CircuitScope – Modern Clean Design System
   ══════════════════════════════════════════════════════════════ */

:root {
    --cs-primary: #2563eb;
    --cs-primary-hover: #1d4ed8;
    --cs-primary-light: #eff6ff;
    --cs-dark: #0f172a;
    --cs-gray-50: #f8fafc;
    --cs-gray-100: #f1f5f9;
    --cs-gray-200: #e2e8f0;
    --cs-gray-300: #cbd5e1;
    --cs-gray-500: #64748b;
    --cs-gray-700: #334155;
    --cs-gray-900: #0f172a;
    --cs-success: #10b981;
    --cs-warning: #f59e0b;
    --cs-danger: #ef4444;
    --cs-radius: 0.75rem;
    --cs-radius-sm: 0.5rem;
    --cs-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --cs-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --cs-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --cs-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --cs-transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Legacy dark-theme variable names mapped to the light palette so older
   inline-styled views (board detail, dashboard, etc.) render correctly. */
:root {
    --bg:  #ffffff;
    --bg2: #ffffff;
    --bg3: #f8fafc;
    --bg4: #f1f5f9;
    --surface: #ffffff;      /* card / panel surface — flipped by dark mode */
    --surface-2: #f8fafc;    /* sunken / subtle surface */
    --border: #e2e8f0;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --text:  #0f172a;
    --text2: #475569;
    --text3: #64748b;
    --accent: #2563eb;
    --blue:  #2563eb;
    --orange:#f59e0b;
    --purple:#7c3aed;
    --green: #10b981;
    --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.badge-verified { background: #d1fae5; color: #065f46; }
.info-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; font-size: 0.85rem; border-bottom: 1px solid var(--cs-gray-100); }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--cs-gray-500); }
.info-value { color: var(--cs-gray-900); font-weight: 500; text-align: right; }

/* ── Base ─────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--cs-gray-900);
    background: var(--surface);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    flex: 1;
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--cs-dark);
    letter-spacing: -0.025em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
    color: var(--cs-gray-700);
}

a {
    color: var(--cs-primary);
    text-decoration: none;
    transition: color var(--cs-transition);
}

a:hover {
    color: var(--cs-primary-hover);
}

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--cs-gray-200);
    padding: 0.75rem 0;
    backdrop-filter: blur(10px);
    z-index: 1030;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--cs-dark) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    color: var(--cs-primary);
    font-size: 1.4rem;
}

.nav-link {
    font-weight: 500;
    color: var(--cs-gray-700) !important;
    padding: 0.5rem 0.875rem !important;
    border-radius: var(--cs-radius-sm);
    transition: all var(--cs-transition);
    font-size: 0.875rem;
}

.nav-link:hover {
    color: var(--cs-primary) !important;
    background: var(--cs-primary-light);
}

.btn-register {
    background: var(--cs-primary) !important;
    color: #fff !important;
    padding: 0.5rem 1.25rem !important;
    border-radius: var(--cs-radius-sm);
    font-weight: 500;
    transition: all var(--cs-transition);
}

.btn-register:hover {
    background: var(--cs-primary-hover) !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: var(--cs-shadow-md);
}

.navbar-toggler {
    border: 1px solid var(--cs-gray-200);
    padding: 0.4rem 0.6rem;
    border-radius: var(--cs-radius-sm);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--cs-radius-sm);
    transition: all var(--cs-transition);
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--cs-shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--cs-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--cs-primary-hover);
}

.btn-success {
    background: var(--cs-success);
}

.btn-outline-secondary {
    border: 1px solid var(--cs-gray-300);
    color: var(--cs-gray-700);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--cs-gray-100);
    color: var(--cs-gray-900);
    border-color: var(--cs-gray-300);
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
    border: 1px solid var(--cs-gray-200);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-sm);
    transition: all var(--cs-transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--cs-shadow-md);
    border-color: var(--cs-gray-300);
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card-text {
    color: var(--cs-gray-500);
    font-size: 0.875rem;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-control,
.form-select {
    border: 1px solid var(--cs-gray-300);
    border-radius: var(--cs-radius-sm);
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    transition: all var(--cs-transition);
    background: var(--surface);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.form-label {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--cs-gray-700);
    margin-bottom: 0.375rem;
}

/* ── Tables ───────────────────────────────────────────────── */
.table {
    font-size: 0.875rem;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: var(--cs-gray-50);
    border-bottom: 2px solid var(--cs-gray-200);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cs-gray-500);
    padding: 0.875rem 1rem;
}

.table tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--cs-gray-100);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--cs-gray-50);
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.75em;
    border-radius: 9999px;
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
    border: none;
    border-radius: var(--cs-radius-sm);
    font-size: 0.875rem;
    padding: 1rem 1.25rem;
}

/* ── Dropdown ─────────────────────────────────────────────── */
.dropdown-menu {
    border: 1px solid var(--cs-gray-200);
    border-radius: var(--cs-radius-sm);
    box-shadow: var(--cs-shadow-lg);
    padding: 0.5rem;
    font-size: 0.875rem;
}

.dropdown-item {
    border-radius: var(--cs-radius-sm);
    padding: 0.5rem 0.75rem;
    transition: all var(--cs-transition);
}

.dropdown-item:hover {
    background: var(--cs-primary-light);
    color: var(--cs-primary);
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
    background: var(--cs-gray-50);
    border-top: 1px solid var(--cs-gray-200);
    padding: 1.5rem 0;
    margin-top: 3rem;
}

.site-footer p {
    font-size: 0.8125rem;
    color: var(--cs-gray-500);
}

.footer-link {
    font-size: 0.8125rem;
    color: var(--cs-gray-500);
    margin-left: 1.5rem;
    transition: color var(--cs-transition);
}

.footer-link:hover {
    color: var(--cs-primary);
}

/* ── AR Viewer ────────────────────────────────────────────── */
.ar-viewer-container {
    max-width: 100%;
    margin: 0 auto;
}

/* Always reserve the scrollbar so centered content doesn't shift between pages */
html { overflow-y: scroll; }

/* Wider app content area (less wasted horizontal space) */
.app-main { width: 100%; max-width: 1760px; margin: 0 auto; padding-left: 1rem; padding-right: 1rem; }
.navbar .app-main, .site-footer .app-main { padding-left: 1rem; padding-right: 1rem; }

.ai-status-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--cs-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.ai-status-banner.checking {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.ai-status-banner.connected {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.ai-status-banner.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.camera-wrapper video {
    background: var(--cs-gray-900);
    aspect-ratio: 16/9;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 0.375rem;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.camera-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.recognition-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
    animation: pulse-badge 2s infinite;
    transition: background 0.3s ease;
}

.recognition-badge.sending {
    background: rgba(37, 99, 235, 0.85);
    animation: none;
}

.recognition-badge.success {
    background: rgba(16, 185, 129, 0.85);
    animation: none;
}

.recognition-badge.error {
    background: rgba(239, 68, 68, 0.85);
    animation: none;
}

.status-log {
    text-align: center;
    padding: 0.25rem;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.recognition-panel {
    background: var(--cs-gray-50);
    border: 1px solid var(--cs-gray-200);
    border-radius: var(--cs-radius);
    padding: 1.5rem;
}

.recognition-item {
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--cs-gray-200);
    border-radius: var(--cs-radius-sm);
}

.recognition-component {
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--cs-gray-100);
    font-size: 0.875rem;
}

/* ── Board Cards Grid ─────────────────────────────────────── */
.board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.board-card {
    border: 1px solid var(--cs-gray-200);
    border-radius: var(--cs-radius);
    padding: 1.5rem;
    background: var(--surface);
    transition: all var(--cs-transition);
}

.board-card:hover {
    box-shadow: var(--cs-shadow-lg);
    border-color: var(--cs-primary);
    transform: translateY(-2px);
}

.board-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.board-card .meta {
    font-size: 0.8125rem;
    color: var(--cs-gray-500);
}

/* ── Utility ──────────────────────────────────────────────── */
.text-muted {
    color: var(--cs-gray-500) !important;
}

.section-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--cs-gray-200);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--cs-gray-500);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .board-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .navbar-brand {
        font-size: 1.1rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    .site-footer .text-md-end {
        text-align: left !important;
        margin-top: 0.75rem;
    }

    .footer-link {
        margin-left: 0;
        margin-right: 1.5rem;
    }

    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 0.9375rem;
    }
}

@media (max-width: 576px) {
    main.container {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }

    .table-responsive {
        font-size: 0.8125rem;
    }
}

/* ══════════════════════════════════════════════════════════════
   Application Components  (light theme, --cs-* tokens)
   ══════════════════════════════════════════════════════════════ */

/* ── Accents & small utilities ────────────────────────────── */
.accent        { color: var(--cs-primary); }
.text-green    { color: var(--cs-success); }
.text-orange   { color: var(--cs-warning); }
.text-purple   { color: #7c3aed; }
.text-blue     { color: var(--cs-primary); }
.btn-link-small{ font-size: 0.8125rem; font-weight: 500; color: var(--cs-primary); }
.btn-secondary { background: var(--cs-gray-100); color: var(--cs-gray-700); }
.btn-secondary:hover { background: var(--cs-gray-200); color: var(--cs-gray-900); }
.btn-sm        { padding: 0.4rem 0.75rem; font-size: 0.8125rem; }
.btn-full      { width: 100%; display: block; text-align: center; }
.page-head     { margin-bottom: 1.5rem; }
.page-head h1  { font-size: 1.5rem; }
.page-head-row { display: flex; justify-content: space-between; align-items: center;
                 gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }

/* ── Badges (Bootstrap 4 style names used in views) ───────── */
.badge-secondary { background: var(--cs-gray-100); color: var(--cs-gray-700); }
.badge-success   { background: #d1fae5; color: #065f46; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-info      { background: #dbeafe; color: #1e40af; }
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-modnote   { background: #ede9fe; color: #5b21b6; }

/* ── Role badges ──────────────────────────────────────────── */
.role-badge {
    display: inline-block; font-size: 0.7rem; font-weight: 600;
    padding: 0.2rem 0.6rem; border-radius: 9999px;
    background: var(--cs-primary-light); color: var(--cs-primary);
    letter-spacing: 0.02em;
}
.role-badge-muted, .role-member       { background: var(--cs-gray-100); color: var(--cs-gray-700); }
.role-contributor                     { background: #d1fae5; color: #065f46; }
.role-reviewer                        { background: #dbeafe; color: #1e40af; }
.role-moderator, .role-contentmoderator { background: #fef3c7; color: #92400e; }
.role-admin, .role-superadmin         { background: #fee2e2; color: #991b1b; }

/* ── Vote pills ───────────────────────────────────────────── */
.vote-pill    { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 9999px;
                font-size: 0.78rem; font-weight: 600; }
.vote-approve { background: #d1fae5; color: #065f46; }
.vote-reject  { background: #fee2e2; color: #991b1b; margin-left: 0.25rem; }

/* ── Empty states ─────────────────────────────────────────── */
.empty-state-sm { text-align: center; padding: 2rem; color: var(--cs-gray-500); }

/* ── Status tabs ──────────────────────────────────────────── */
.status-tabs { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.status-tab  { padding: 0.4rem 0.9rem; border-radius: 9999px; font-size: 0.85rem;
               color: var(--cs-gray-700); border: 1px solid var(--cs-gray-200);
               background: var(--surface); text-decoration: none; }
.status-tab:hover  { border-color: var(--cs-primary); color: var(--cs-primary); }
.status-tab.active { background: var(--cs-primary); border-color: var(--cs-primary); color: #fff; }
.filter-count { color: var(--cs-gray-500); font-size: 0.8rem; margin-left: auto; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination-bar { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.5rem; }
.btn-page   { padding: 0.4rem 0.9rem; border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius-sm);
              color: var(--cs-gray-700); background: var(--surface); text-decoration: none; font-size: 0.85rem; }
.btn-page:hover { border-color: var(--cs-primary); color: var(--cs-primary); }
.page-info  { color: var(--cs-gray-500); font-size: 0.85rem; }
.td-date    { color: var(--cs-gray-500); white-space: nowrap; }
.sub-title, .td-title a { font-weight: 600; color: var(--cs-dark); }

/* ── Admin layout ─────────────────────────────────────────── */
.admin-page { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; align-items: start; }
.admin-sidebar { background: var(--surface); border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius);
                 box-shadow: var(--cs-shadow-sm); overflow: hidden; position: sticky; top: 1rem; }
.admin-sidebar-header { padding: 1rem 1.25rem; font-weight: 700; color: var(--cs-dark);
                        border-bottom: 1px solid var(--cs-gray-200); display: flex; align-items: center; gap: 0.5rem; }
.admin-sidebar-header i { color: var(--cs-primary); }
.admin-nav { display: flex; flex-direction: column; padding: 0.5rem; }
.admin-nav-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.75rem;
                  border-radius: var(--cs-radius-sm); color: var(--cs-gray-700); text-decoration: none;
                  font-size: 0.875rem; font-weight: 500; transition: all var(--cs-transition); }
.admin-nav-item i { width: 18px; text-align: center; color: var(--cs-gray-500); }
.admin-nav-item:hover { background: var(--cs-gray-50); color: var(--cs-primary); }
.admin-nav-item.active { background: var(--cs-primary-light); color: var(--cs-primary); }
.admin-nav-item.active i { color: var(--cs-primary); }
.admin-main { min-width: 0; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.admin-page-title { font-size: 1.5rem; margin: 0; }
.admin-filter-bar { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap i { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--cs-gray-500); }
.search-input { padding-left: 2.25rem !important; }

/* ── Admin tables ─────────────────────────────────────────── */
.admin-table-wrap { background: var(--surface); border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius);
                    box-shadow: var(--cs-shadow-sm); overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.admin-table thead th { background: var(--cs-gray-50); text-align: left; padding: 0.75rem 1rem;
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--cs-gray-500);
    border-bottom: 1px solid var(--cs-gray-200); }
.admin-table tbody td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--cs-gray-100); vertical-align: middle; }
.admin-table tbody tr:hover { background: var(--cs-gray-50); }
.row-banned { opacity: 0.6; }

/* ── Stat cards (dashboard) ───────────────────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--surface); border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius);
             box-shadow: var(--cs-shadow-sm); padding: 1.25rem; }
.stat-card-icon { width: 40px; height: 40px; border-radius: var(--cs-radius-sm); display: flex;
    align-items: center; justify-content: center; font-size: 1.1rem; margin-bottom: 0.75rem;
    background: var(--cs-primary-light); color: var(--cs-primary); }
.stat-icon-blue   { background: #dbeafe; color: #1e40af; }
.stat-icon-orange { background: #fef3c7; color: #92400e; }
.stat-icon-green  { background: #d1fae5; color: #065f46; }
.stat-icon-purple { background: #ede9fe; color: #5b21b6; }
.stat-card-value { font-size: 1.6rem; font-weight: 700; color: var(--cs-dark); line-height: 1.1; }
.stat-card-label { font-size: 0.82rem; color: var(--cs-gray-500); }
.stat-card-sub   { font-size: 0.75rem; color: var(--cs-gray-500); margin-top: 0.25rem; }

/* ── Admin cards / grid ───────────────────────────────────── */
.admin-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; align-items: start; }
.admin-card { background: var(--surface); border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius);
              box-shadow: var(--cs-shadow-sm); padding: 1.25rem; }
.admin-card-wide { grid-column: 1 / -1; }
.admin-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.admin-card-header h3 { font-size: 1rem; margin: 0; }
.admin-activity-feed { display: flex; flex-direction: column; gap: 0.6rem; }
.activity-item { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cs-primary); flex-shrink: 0; }
.activity-action { font-weight: 600; color: var(--cs-gray-900); }
.activity-entity { color: var(--cs-gray-500); }
.activity-time { margin-left: auto; color: var(--cs-gray-500); font-size: 0.78rem; }
.user-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid var(--cs-gray-100); }
.user-row:last-child { border-bottom: none; }
.user-row-avatar, .user-cell-avatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    background: var(--cs-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.user-row-info { display: flex; flex-direction: column; min-width: 0; }
.user-row-info span { font-size: 0.78rem; color: var(--cs-gray-500); }
.user-row-date { margin-left: auto; font-size: 0.78rem; color: var(--cs-gray-500); }

/* ── Admin: user cells & actions ──────────────────────────── */
.user-cell { display: flex; align-items: center; gap: 0.6rem; }
.user-cell-info { display: flex; flex-direction: column; min-width: 0; }
.user-cell-email { font-size: 0.78rem; color: var(--cs-gray-500); }
.user-cell-username { font-size: 0.72rem; color: var(--cs-gray-400, #94a3b8); }
.rep-score { font-weight: 600; color: var(--cs-gray-700); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.25rem; }
.status-active { background: var(--cs-success); }
.status-banned { background: var(--cs-danger); }
.action-btns { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.btn-action, .btn-action-sm { display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem;
    padding: 0.3rem 0.6rem; border-radius: var(--cs-radius-sm); font-size: 0.78rem; font-weight: 500;
    border: 1px solid var(--cs-gray-200); background: var(--surface); color: var(--cs-gray-700); cursor: pointer; text-decoration: none; }
.btn-action:hover, .btn-action-sm:hover { border-color: var(--cs-primary); color: var(--cs-primary); }
.btn-action-danger  { border-color: #fca5a5; color: #b91c1c; }
.btn-action-success { border-color: #6ee7b7; color: #047857; }

/* ── Dashboard hero & cards ───────────────────────────────── */
.section-title { font-size: 1.25rem; margin: 0; }
.dash-hero { background: linear-gradient(135deg, var(--cs-primary-light), var(--surface)); border: 1px solid var(--cs-gray-200);
             border-radius: var(--cs-radius); padding: 2rem; margin-bottom: 1.5rem; }
.dash-hero-inner { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.dash-hero-text h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.dash-hero-actions { display: flex; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }
.dash-hero-stats { display: flex; gap: 1.5rem; }
.hero-stat { text-align: center; }
.hero-stat-val { display: block; font-size: 1.75rem; font-weight: 800; color: var(--cs-dark); }
.hero-stat-label { font-size: 0.78rem; color: var(--cs-gray-500); }
.welcome-banner { background: #d1fae5; border: 1px solid #6ee7b7; border-radius: var(--cs-radius-sm);
                  padding: 0.75rem 1rem; margin-bottom: 1.5rem; }
.welcome-banner-inner { display: flex; align-items: center; gap: 0.6rem; color: #065f46; font-size: 0.9rem; }
.dash-content { display: flex; flex-direction: column; gap: 1.5rem; }
.dash-section { }
.dash-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.dash-card { background: var(--surface); border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius);
             box-shadow: var(--cs-shadow-sm); padding: 1.25rem; }
.dash-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.dash-card-header h3 { font-size: 1rem; margin: 0; }
.queue-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0;
              border-bottom: 1px solid var(--cs-gray-100); text-decoration: none; color: inherit; }
.queue-item:last-child { border-bottom: none; }
.queue-title { flex: 1; font-weight: 500; color: var(--cs-gray-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.request-mini { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid var(--cs-gray-100); }
.request-mini:last-child { border-bottom: none; }
.request-mini-votes { font-weight: 700; color: var(--cs-primary); font-size: 0.85rem; min-width: 32px; }
.request-mini-name { font-size: 0.9rem; }

/* ── Board cards (thumb style used on dashboard) ──────────── */
.board-card-thumb { position: relative; aspect-ratio: 16/10; border-radius: var(--cs-radius-sm);
                    overflow: hidden; background: var(--cs-gray-100); margin-bottom: 0.75rem; }
.board-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.board-verified-badge { position: absolute; top: 0.5rem; right: 0.5rem; width: 22px; height: 22px;
    border-radius: 50%; background: var(--cs-success); color: #fff; display: flex; align-items: center;
    justify-content: center; font-size: 0.7rem; }
.board-overlay-badge { position: absolute; top: 0.5rem; left: 0.5rem; width: 22px; height: 22px;
    border-radius: 50%; background: #2563eb; color: #fff; display: flex; align-items: center;
    justify-content: center; font-size: 0.68rem; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.board-card-body { }
.board-card-name { font-size: 1rem; margin-bottom: 0.2rem; }
.board-card-mfg { font-size: 0.82rem; color: var(--cs-gray-500); }
.board-card-stats { display: flex; gap: 1rem; margin-top: 0.6rem; font-size: 0.78rem; color: var(--cs-gray-500); }

/* ── Review page ──────────────────────────────────────────── */
.review-header { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }
.btn-back { color: var(--cs-gray-500); text-decoration: none; font-size: 0.85rem; }
.review-title { font-size: 1.4rem; margin: 0; }
.review-meta { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--cs-gray-500); }
.review-layout { display: grid; grid-template-columns: 1fr 340px; gap: 1.5rem; align-items: start; }
.review-card { background: var(--surface); border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius);
               box-shadow: var(--cs-shadow-sm); margin-bottom: 1.25rem; overflow: hidden; }
.review-card-header { padding: 0.75rem 1rem; border-bottom: 1px solid var(--cs-gray-200);
                      font-weight: 600; color: var(--cs-dark); display: flex; align-items: center; gap: 0.5rem; }
.data-display, .data-raw { padding: 1rem; font-size: 0.85rem; }
.data-raw { background: var(--cs-gray-50); white-space: pre-wrap; word-break: break-word; }
.comments-thread { padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.no-comments { color: var(--cs-gray-500); font-size: 0.875rem; }
.comment { display: flex; gap: 0.6rem; }
.comment-modnote { background: #fffbeb; border-radius: var(--cs-radius-sm); padding: 0.5rem; }
.comment-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--cs-primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }
.comment-header { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.comment-date { color: var(--cs-gray-500); font-size: 0.75rem; }
.comment-text { margin: 0.2rem 0 0; font-size: 0.9rem; color: var(--cs-gray-700); }
.add-comment { padding: 1rem; border-top: 1px solid var(--cs-gray-200); }
.vote-progress { padding: 1rem; }
.vote-bar-wrap { display: flex; height: 8px; border-radius: 9999px; overflow: hidden; background: var(--cs-gray-100); }
.vote-bar-approve { background: var(--cs-success); }
.vote-bar-reject { background: var(--cs-danger); }
.vote-counts { display: flex; justify-content: space-between; margin-top: 0.5rem; font-size: 0.82rem; }
.vote-count-approve { color: #065f46; }
.vote-count-reject { color: #991b1b; }
.vote-required { text-align: center; color: var(--cs-gray-500); font-size: 0.78rem; margin-top: 0.25rem; }
.vote-list { padding: 0 1rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.vote-item { display: flex; gap: 0.6rem; }
.vote-item-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--cs-gray-200);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.75rem; flex-shrink: 0; }
.vote-type-label { font-size: 0.78rem; color: var(--cs-gray-500); margin-left: 0.4rem; }
.vote-comment { margin: 0.2rem 0 0; font-size: 0.85rem; color: var(--cs-gray-700); }
.already-voted { color: #065f46; font-weight: 500; }
.vote-buttons, .override-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn-vote { flex: 1; }
.detail-row { display: flex; justify-content: space-between; padding: 0.5rem 1rem; border-bottom: 1px solid var(--cs-gray-100); font-size: 0.85rem; }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--cs-gray-500); }
.detail-value { color: var(--cs-gray-900); font-weight: 500; }

/* ── Auth: Denied & Error ─────────────────────────────────── */
.auth-denied, .error-page { min-height: 55vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1.5rem; }
.auth-denied-card, .error-card { max-width: 480px; text-align: center; background: var(--surface);
    border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius); box-shadow: var(--cs-shadow-sm); padding: 2.5rem 2rem; }
.auth-denied-icon, .error-icon { font-size: 2.5rem; color: var(--cs-warning); margin-bottom: 1rem; }
.auth-denied-card h1, .error-card h1 { font-size: 1.5rem; margin-bottom: 0.75rem; }
.auth-denied-card p, .error-card p { color: var(--cs-gray-500); margin-bottom: 1.5rem; }
.auth-denied-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ── Profile ──────────────────────────────────────────────── */
.profile-page { max-width: 720px; margin: 0 auto; }
.profile-card { background: var(--surface); border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius);
                box-shadow: var(--cs-shadow-sm); padding: 2rem; }
.profile-head { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.5rem; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--cs-primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 800; flex-shrink: 0; }
.profile-head-info h1 { font-size: 1.5rem; margin: 0; }
.profile-email { color: var(--cs-gray-500); font-size: 0.9rem; margin: 0.15rem 0 0.5rem; }
.profile-roles { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem;
    border-top: 1px solid var(--cs-gray-200); border-bottom: 1px solid var(--cs-gray-200);
    padding: 1.25rem 0; margin-bottom: 1.5rem; }
.profile-stat { text-align: center; }
.profile-stat-val { display: block; font-size: 1.35rem; font-weight: 800; color: var(--cs-dark); }
.profile-stat-label { font-size: 0.75rem; color: var(--cs-gray-500); }
.profile-details { margin-bottom: 1.5rem; }
.profile-detail { color: var(--cs-gray-700); margin-bottom: 0.4rem; }
.profile-bio { color: var(--cs-gray-700); margin-top: 0.75rem; }
.profile-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ── 2FA setup ────────────────────────────────────────────── */
.setup-2fa { max-width: 760px; margin: 0 auto; }
.setup-card { background: var(--surface); border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius);
              box-shadow: var(--cs-shadow-sm); padding: 2rem; }
.setup-card h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1.5rem; align-items: start; }
.setup-qr { text-align: center; }
.setup-qr img { width: 200px; height: 200px; background: #fff; padding: 8px; border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius-sm); }
.manual-key { margin-top: 1rem; font-size: 0.85rem; }
.manual-key code { display: block; margin-top: 0.35rem; background: var(--cs-gray-50); border: 1px solid var(--cs-gray-200);
    padding: 0.5rem; border-radius: var(--cs-radius-sm); color: var(--cs-gray-900); word-break: break-all; }
.backup-codes { margin-top: 1.75rem; border-top: 1px solid var(--cs-gray-200); padding-top: 1.25rem; }
.codes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.5rem; margin-top: 0.5rem; }
.codes-grid code { background: var(--cs-gray-50); border: 1px solid var(--cs-gray-200); padding: 0.45rem;
    border-radius: var(--cs-radius-sm); text-align: center; color: var(--cs-gray-900); letter-spacing: 0.05em; }

/* ── Requests page ────────────────────────────────────────── */
.requests-layout { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
.request-row { display: flex; gap: 0.9rem; padding: 1rem; border: 1px solid var(--cs-gray-200);
    border-radius: var(--cs-radius); margin-bottom: 0.6rem; background: var(--surface); box-shadow: var(--cs-shadow-sm); }
.vote-form { margin: 0; }
.vote-btn { display: flex; flex-direction: column; align-items: center; gap: 0.1rem; min-width: 48px;
    padding: 0.4rem; border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius-sm);
    background: var(--surface); color: var(--cs-gray-500); cursor: pointer; }
.vote-btn.voted { background: var(--cs-primary-light); border-color: var(--cs-primary); color: var(--cs-primary); }
.vote-btn span { font-weight: 700; }
.request-body { flex: 1; }
.request-name { font-weight: 700; color: var(--cs-dark); }
.request-meta { font-size: 0.8rem; color: var(--cs-gray-500); display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.15rem; }
.request-desc { color: var(--cs-gray-700); margin: 0.5rem 0 0.25rem; font-size: 0.9rem; }
.request-link { font-size: 0.8rem; }
.side-card { background: var(--surface); border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius);
             box-shadow: var(--cs-shadow-sm); padding: 1.25rem; }
.side-card h5 { font-size: 1rem; margin-bottom: 0.75rem; }

/* ── My submissions / generic data table ──────────────────── */
.subs-table-wrap { background: var(--surface); border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius);
                   box-shadow: var(--cs-shadow-sm); overflow-x: auto; }
.subs-table { width: 100%; border-collapse: collapse; }
.subs-table th, .subs-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--cs-gray-100); }
.subs-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--cs-gray-500); background: var(--cs-gray-50); }

/* ── Submit board form ────────────────────────────────────── */
.submit-board-page { max-width: 820px; margin: 0 auto; }
.submit-form { background: var(--surface); border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius);
               box-shadow: var(--cs-shadow-sm); padding: 1.5rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: 0.6rem; }

/* ── Board edit: component cards ──────────────────────────── */
.comp-card { border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius); padding: 0.85rem; margin-bottom: 0.75rem; background: var(--cs-gray-50); }
.comp-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
.comp-card-title { font-weight: 700; font-size: 0.85rem; color: var(--cs-dark); }
.comp-remove { font-size: 0.8rem; color: var(--cs-danger); display: flex; align-items: center; gap: 0.3rem; margin: 0; cursor: pointer; }
.comp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.comp-grid > div { min-width: 0; }
.comp-grid label { font-size: 0.72rem; color: var(--cs-gray-500); display: block; margin-bottom: 0.15rem; }
.comp-card details summary { cursor: pointer; font-size: 0.8rem; color: var(--cs-primary); margin-top: 0.5rem; }
@media (max-width: 680px) { .comp-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── Settings ─────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.settings-card { background: var(--surface); border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius);
                 box-shadow: var(--cs-shadow-sm); padding: 1.25rem; }
.settings-card h5 { font-size: 1rem; margin-bottom: 0.75rem; }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0;
      border-bottom: 1px solid var(--cs-gray-100); font-size: 0.9rem; }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--cs-gray-500); }
.kv b { color: var(--cs-gray-900); text-align: right; word-break: break-word; }

/* ── AI status cards ──────────────────────────────────────── */
.status-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.status-card { display: flex; gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--cs-gray-200);
               border-radius: var(--cs-radius); box-shadow: var(--cs-shadow-sm); padding: 1.25rem; }
.status-card.ok  { border-color: #6ee7b7; }
.status-card.bad { border-color: #fca5a5; }
.status-card-icon { font-size: 1.8rem; color: var(--cs-success); }
.status-card.bad .status-card-icon { color: var(--cs-danger); }
.status-card-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--cs-gray-500); }
.status-card-val { font-size: 1.4rem; font-weight: 800; color: var(--cs-dark); text-transform: capitalize; }
.status-card-sub { font-size: 0.82rem; color: var(--cs-gray-500); }
.info-note code, .alert code { color: var(--cs-primary); }

/* ── AR viewer candidate picker ───────────────────────────── */
.candidate-list { display: flex; flex-direction: column; gap: 0.6rem; }
.candidate-card { display: flex; align-items: center; gap: 0.75rem; border: 1px solid var(--cs-gray-200);
    border-radius: var(--cs-radius-sm); padding: 0.5rem 0.75rem; background: var(--surface); }
.cand-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: var(--cs-radius-sm); background: var(--cs-gray-100); }
.cand-body { flex: 1; min-width: 0; }
.cand-name { font-weight: 600; color: var(--cs-dark); }
.cand-mfg { font-size: 0.8rem; color: var(--cs-gray-500); }
.cand-meta { font-size: 0.78rem; color: var(--cs-gray-500); margin-top: 0.15rem; }
.cand-tag { text-transform: uppercase; letter-spacing: 0.03em; font-size: 0.7rem; }
.submit-panel { border-top: 1px solid var(--cs-gray-200); padding-top: 1rem; }
.confirm-area { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Responsive for app components ────────────────────────── */
@media (max-width: 900px) {
    .admin-page { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; }
    .admin-grid, .dash-two-col, .review-layout, .requests-layout, .setup-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .profile-stats { grid-template-columns: repeat(2, 1fr); }
    .dash-hero-inner { flex-direction: column; align-items: flex-start; }
}

/* ── Auth pages (login / register) ────────────────────────── */
.auth-page { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--cs-gray-200);
             border-radius: var(--cs-radius); box-shadow: var(--cs-shadow-md); padding: 2rem; }
.auth-card-wide { max-width: 560px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 0.75rem; }
.auth-title { font-size: 1.6rem; margin-bottom: 0.25rem; }
.auth-subtitle { color: var(--cs-gray-500); margin-bottom: 1.5rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.875rem; color: var(--cs-gray-500); }

.form-group { margin-bottom: 1rem; }
.form-row { display: flex; gap: 1rem; }
.form-row > * { flex: 1 1 0; min-width: 0; padding-left: 0; padding-right: 0; }
.form-hint { font-size: 0.75rem; color: var(--cs-gray-500); }
.form-label.required::after { content: " *"; color: var(--cs-danger); }
.link-muted { color: var(--cs-gray-500); }
.text-sm { font-size: 0.8rem; }

/* Two-factor pages */
/* ── Interactive board overlay (AR viewer) ────────────────── */
.bv-layout { display: flex; flex-direction: column; align-items: center; gap: 0; }
.bv-stage { width: 100%; max-width: 1100px; }
/* Resize the camera view while scanning (drag the bottom-right corner) */
.bv-layout:not(.bv-active) .camera-wrapper { resize: horizontal; overflow: auto; min-width: 340px; max-width: 100%; margin-left: auto; margin-right: auto; }
.bv-layout.bv-active { flex-direction: row; align-items: flex-start; gap: 0; max-width: 100%; margin: 0; --bv-stage-w: 64%; }
.bv-layout.bv-active .bv-stage { flex: 0 0 var(--bv-stage-w); max-width: none; min-width: 0; margin: 0; }
.bv-layout.bv-active .bv-panel { flex: 1 1 0; min-width: 240px; }
.bv-layout.dock-bottom { flex-direction: column; align-items: stretch; }
.bv-layout.dock-bottom .bv-stage { flex: none; width: 100%; max-width: 100%; }
.bv-layout.dock-bottom .bv-panel { width: 100%; margin-top: 1rem; }
.bv-layout.dock-float .bv-stage { flex: none; width: 100%; max-width: 100%; }

.bv-splitter { flex: 0 0 12px; align-self: stretch; cursor: col-resize; position: relative; }
.bv-splitter::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--cs-gray-300); border-radius: 2px; }
.bv-splitter:hover::before { background: var(--cs-primary); }

.board-overlay { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; touch-action: none; cursor: grab; }
.board-overlay:active { cursor: grabbing; }
.bv-comp { cursor: pointer; }
.bv-comp .bv-shape { transition: fill 0.1s ease; }
.bv-label { fill: #fff; font-weight: 700; pointer-events: none; paint-order: stroke; stroke: rgba(0,0,0,0.65); stroke-width: 2px; }
.bv-controls { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; justify-content: center; margin-top: 0.75rem; }
.bv-ctrl { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--cs-gray-700); }
.bv-ctrl input[type=range] { width: 110px; }
#bv-bg-toggle.active { background: var(--cs-primary); color: #fff; }

.bv-panel { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--cs-gray-200);
            border-radius: var(--cs-radius); box-shadow: var(--cs-shadow-sm); overflow: hidden; }
.bv-panel-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
                padding: 0.4rem 0.5rem 0.4rem 0.75rem; border-bottom: 1px solid var(--cs-gray-200);
                background: var(--cs-gray-50); user-select: none; }
.bv-panel-title { font-weight: 700; font-size: 0.85rem; color: var(--cs-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bv-panel-tools { display: flex; gap: 0.1rem; flex-shrink: 0; }
.bv-tool { border: none; background: transparent; color: var(--cs-gray-500); padding: 0.25rem 0.4rem; border-radius: var(--cs-radius-sm); cursor: pointer; font-size: 0.85rem; }
.bv-tool:hover { background: var(--cs-gray-200); color: var(--cs-dark); }
.bv-tool.active { background: var(--cs-primary); color: #fff; }
.bv-panel-content { padding: 0.75rem; overflow: auto; flex: 1 1 auto; max-height: 76vh; }
.bv-panel.bv-float { position: fixed; z-index: 1055; box-shadow: var(--cs-shadow-lg); resize: both; }
.bv-panel.bv-float .bv-panel-bar { cursor: move; }
.bv-panel.bv-float .bv-panel-content { max-height: none; }

.bv-taskbar { position: fixed; bottom: 18px; right: 18px; z-index: 1055; display: inline-flex; align-items: center;
              gap: 0.4rem; background: var(--cs-primary); color: #fff; border: none; border-radius: 9999px;
              padding: 0.5rem 1rem; font-size: 0.85rem; font-weight: 600; box-shadow: var(--cs-shadow-md); cursor: pointer; }
.bv-taskbar:hover { background: var(--cs-primary-hover); }

.bv-list { max-height: 240px; overflow: auto; margin: 0.5rem 0; border: 1px solid var(--cs-gray-100); border-radius: var(--cs-radius-sm); }
.bv-li { display: flex; flex-direction: column; padding: 0.4rem 0.6rem; cursor: pointer; border-bottom: 1px solid var(--cs-gray-100); }
.bv-li:last-child { border-bottom: none; }
.bv-li:hover { background: var(--cs-gray-50); }
.bv-li.active { background: var(--cs-primary-light); }
.bv-li-ref { font-weight: 700; font-size: 0.85rem; color: var(--cs-dark); }
.bv-li-type { font-size: 0.74rem; color: var(--cs-gray-500); }
.bv-detail { border-top: 1px solid var(--cs-gray-200); padding-top: 0.75rem; margin-top: 0.5rem; }
.bv-detail-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.bv-ref { font-size: 1.2rem; font-weight: 800; color: var(--cs-dark); }
.bv-kv { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.85rem; padding: 0.25rem 0; border-bottom: 1px solid var(--cs-gray-100); }
.bv-kv span { color: var(--cs-gray-500); } .bv-kv b { text-align: right; word-break: break-word; }
.bv-desc { font-size: 0.85rem; margin: 0.5rem 0 0; }
.bv-links { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.6rem; }
.bv-ai-btn { margin-top: 0.6rem; }
.bv-ai { margin-top: 0.6rem; font-size: 0.85rem; }
.bv-ai-sub ul { margin: 0.2rem 0 0.4rem 1rem; }
@media (max-width: 900px) {
    .bv-layout.bv-active { flex-direction: column; align-items: stretch; --bv-stage-w: 100%; }
    .bv-layout.bv-active .bv-stage { flex: none; width: 100%; }
    .bv-layout.bv-active .bv-panel { width: 100%; }
    .bv-splitter { display: none !important; }
}

/* Two-factor pages */
.twofa-icon { text-align: center; font-size: 2rem; color: var(--cs-primary); margin-bottom: 0.5rem; }
.form-control-code { text-align: center; letter-spacing: 0.5em; font-size: 1.4rem; font-weight: 700; }

/* Password field with show/hide toggle */
.input-password-wrap { position: relative; }
.input-password-wrap .form-control { padding-right: 2.75rem; }
.btn-show-pw { position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; color: var(--cs-gray-500); cursor: pointer;
    padding: 0.35rem 0.5rem; line-height: 1; border-radius: var(--cs-radius-sm); }
.btn-show-pw:hover { color: var(--cs-primary); }

@media (max-width: 520px) {
    .form-row { flex-direction: column; gap: 0; }
}

/* ── Standalone board overlay viewer (web-based schematic viewer) ── */
.bv-viewer-layout { display: grid; grid-template-columns: 1fr 360px; gap: 1rem; align-items: start; }
.bv-viewer-stage { border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius); overflow: hidden; background: #0e1116; }
.bv-viewer-toolbar { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center;
    padding: 0.55rem 0.7rem; background: var(--cs-gray-50); border-bottom: 1px solid var(--cs-gray-200); }
.bv-viewer-toolbar .bv-tool-check { display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.82rem; color: var(--cs-gray-700); margin: 0 0.2rem; user-select: none; }
.bv-viewer-toolbar .bv-tool-sep { width: 1px; height: 20px; background: var(--cs-gray-200); margin: 0 0.2rem; }
.bv-viewer-toolbar .bv-side-count { margin-left: auto; font-size: 0.8rem; }
.bv-viewer-canvas { position: relative; }
.bv-viewer-canvas svg#bv-overlay { display: block; width: 100%; height: 72vh; background: #0e1116; touch-action: none; }
.bv-viewer-empty { position: absolute; inset: 0; display: none; flex-direction: column; gap: 0.6rem;
    align-items: center; justify-content: center; text-align: center; color: #9aa4b2; padding: 2rem; }
.bv-viewer-empty i { font-size: 2.4rem; opacity: 0.5; }
.bv-viewer-panel { border: 1px solid var(--cs-gray-200); border-radius: var(--cs-radius);
    background: var(--surface); padding: 0.85rem; max-height: 80vh; overflow: auto; }
@media (max-width: 900px) {
    .bv-viewer-layout { grid-template-columns: 1fr; }
    .bv-viewer-canvas svg#bv-overlay { height: 58vh; }
    .bv-viewer-panel { max-height: none; }
}
