/* ══════════════════════════════════════════════════════════════════
   AutoScholar Test Rig — Shared Styles
   Extracted from Tests/index.html for reuse by thin-client pages
   ══════════════════════════════════════════════════════════════════ */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: var(--ui-font-body); background: var(--ui-gray-100); }

/* Full-height flex column: header (auto) → app (flex:1) → log (auto) */
body { display: flex; flex-direction: column; }

.rig-header {
    background: var(--ui-gray-800); color: white;
    padding: 0.5rem 1.2rem;
    display: flex; align-items: center; gap: 0.75rem;
}
.rig-title { font-weight: 700; font-size: 1rem; }
.rig-version { font-size: var(--ui-text-xs); opacity: 0.6; }

#app { flex: 1; min-height: 0; }
#app .ui-tabs { height: 100%; display: flex; flex-direction: column; }
#app .ui-tabs-content { flex: 1; min-height: 0; overflow: auto; }
#app .ui-tabs-panel { height: 100%; }
#app .ui-tabs-panel > .ui-control-stage { height: 100%; }
#app .ui-control-stage-control { overflow-y: auto; }
#app .ui-control-stage-stage { overflow-y: auto; }

/* Event Log — flex-shrink: 0 keeps it at its natural height */
.rig-log {
    flex-shrink: 0;
    max-height: 8rem;
    background: var(--ui-gray-900); color: var(--ui-gray-300);
    padding: 0.4rem 0.75rem;
    overflow-y: auto;
    font-family: 'SF Mono', 'JetBrains Mono', monospace;
    font-size: var(--ui-text-xs); line-height: 1.5;
    border-top: 1px solid var(--ui-gray-700);
}
.log-entry { padding: 0.5px 0; }
.log-time { color: #6a9955; }
.log-event { color: #569cd6; }
.log-detail { color: #ce9178; }
.log-error { color: #f44747; }

/* Test rig — tight, compact admin styling */
#app .ui-btn { border-radius: 2px; }
#app .ui-input, #app .ui-select { border-radius: 2px; padding: 6px 8px; }
#app .ui-input-wrapper { margin-bottom: 0.5rem; }
#app .ui-control-stage-control { padding: 0.75rem; }
#app .ui-accordion-content { padding: 0.5rem 0.75rem; }
#app .ui-list-selector { border-radius: 2px; }
#app .ui-form { border-radius: 2px; }
#app .ui-form-group { margin-bottom: var(--ui-space-2); }
#app .ui-form-buttons { align-items: center; justify-content: flex-end; gap: var(--ui-space-2); }
.ui-modal { border-radius: 2px !important; }
.ui-modal .ui-btn { border-radius: 2px; }
.ui-modal .ui-input, .ui-modal .ui-select { border-radius: 2px; padding: 6px 8px; }
.ui-modal .ui-form-group { margin-bottom: var(--ui-space-2); }
.ui-modal .ui-form-buttons { align-items: center; justify-content: flex-end; gap: var(--ui-space-2); }
#app .ui-badge { border-radius: 2px; }
#app .ui-control-stage { border-radius: 4px; }

/* AutoScholar service plates — self-contained card */
.as-plate {
    padding: 0.75rem;
}
#app .as-plate .ui-control-stage-unified {
    box-shadow: 0 6px 24px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.10);
    border: none;
    border-radius: 12px;
    overflow: hidden;
}
.as-plate .ui-control-stage-unified .ui-control-stage-control {
    background: var(--ui-gray-800);
    color: var(--ui-white);
    width: 25%;
}
.as-plate .ui-control-stage-unified .ui-control-stage-stage {
    background: var(--ui-white);
    box-shadow: -2px 0 8px rgba(0,0,0,0.05);
}
.as-plate .ui-control-stage-unified .ui-control-stage-control .ui-input,
.as-plate .ui-control-stage-unified .ui-control-stage-control .ui-select {
    background: var(--ui-gray-700);
    color: var(--ui-white);
    border-color: var(--ui-gray-600);
}
.as-plate .ui-control-stage-unified .ui-control-stage-control label {
    color: var(--ui-gray-300);
}
/* Dark mode for control panel elements */
.as-plate .ui-control-stage-control .ui-control-stage-header {
    color: var(--ui-white);
}
.as-plate .ui-control-stage-control .ui-accordion-trigger {
    color: var(--ui-gray-200);
    border-color: var(--ui-gray-700);
}
.as-plate .ui-control-stage-control .ui-accordion-trigger:hover {
    color: var(--ui-white);
    background: rgba(255,255,255,0.05);
}
.as-plate .ui-control-stage-control .ui-active .ui-accordion-trigger {
    color: var(--ui-white);
}
.as-plate .ui-control-stage-control .ui-accordion-icon {
    color: var(--ui-gray-400);
}
.as-plate .ui-control-stage-control .ui-accordion-content {
    border-color: var(--ui-gray-700);
}
.as-plate .ui-control-stage-control .ui-accordion-item {
    border-color: var(--ui-gray-700);
}
.as-plate .ui-control-stage-control .ui-badge {
    opacity: 0.9;
}
.as-plate .ui-control-stage-control .ui-btn-ghost {
    color: var(--ui-gray-300);
}
.as-plate .ui-control-stage-control .ui-btn-ghost:hover {
    color: var(--ui-white);
    background: rgba(255,255,255,0.08);
}
/* Plate CS uses overflow:hidden for corner clipping; non-plate CS keeps default */

/* About documentation styling */
.as-stage-about { font-family: var(--ui-font-body); }
.as-stage-about h3 {
    border-bottom: 1px solid var(--ui-gray-200);
    padding-bottom: 0.4rem;
}
.as-stage-about p { margin-bottom: 0.6rem; }
.as-stage-about code {
    background: var(--ui-gray-100);
    padding: 0.1rem 0.35rem;
    border-radius: var(--ui-radius-sm);
    font-size: var(--ui-text-xs);
    font-family: var(--ui-font-mono);
}
.as-stage-about table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--ui-text-xs);
    margin: 0.5rem 0;
}
.as-stage-about th {
    text-align: left;
    font-weight: var(--ui-font-semibold);
    padding: 0.4rem 0.6rem;
    background: var(--ui-gray-50);
    border-bottom: 1px solid var(--ui-gray-200);
}
.as-stage-about td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid var(--ui-gray-100);
}

/* Peer Correlation charts */
.pc-kpi-card {
    background: var(--ui-white);
    border: 1px solid var(--ui-gray-200);
    border-radius: 6px;
    padding: 0.75rem;
    flex: 1;
    min-width: 8rem;
}
.pc-peer-card {
    background: var(--ui-white);
    border: 1px solid var(--ui-gray-200);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    transition: box-shadow 0.15s;
}
.pc-peer-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.pc-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ui-gray-800);
    margin: 1.5rem 0 0.75rem 0;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--ui-gray-200);
}

/* Quick Polls */
.qp-kpi-card {
    background: var(--ui-white);
    border: 1px solid var(--ui-gray-200);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    flex: 1;
    min-width: 7rem;
}
.qp-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ui-gray-800);
    margin: 1.25rem 0 0.6rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--ui-gray-200);
}

/* Class Analytics dashboard */
.ca-kpi-card {
    background: var(--ui-white);
    border: 1px solid var(--ui-gray-200);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    flex: 1;
    min-width: 7rem;
}
.ca-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ui-gray-800);
    margin: 1.25rem 0 0.6rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--ui-gray-200);
}

/* Class Roster panel */
.cr-kpi-card {
    background: var(--ui-white);
    border: 1px solid var(--ui-gray-200);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    flex: 1;
    min-width: 7rem;
}
.cr-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ui-gray-800);
    margin: 1.25rem 0 0.6rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--ui-gray-200);
}

/* Gradebook panel */
.gb-kpi-card { background:var(--ui-white); border:1px solid var(--ui-gray-200); border-radius:6px; padding:0.6rem 0.75rem; flex:1; min-width:7rem; }
.gb-section-title { font-size:0.85rem; font-weight:700; color:var(--ui-gray-800); margin:1.25rem 0 0.6rem 0; padding-bottom:0.3rem; border-bottom:1px solid var(--ui-gray-200); }
.gb-grade-grid { width:100%; border-collapse:collapse; font-size:0.72rem; }
.gb-grade-grid th { background:var(--ui-gray-50); padding:0.4rem 0.5rem; font-weight:600; font-size:0.65rem; text-align:center; border-bottom:2px solid var(--ui-gray-200); position:sticky; top:0; z-index:1; }
.gb-grade-grid td { padding:0.3rem 0.4rem; text-align:center; border-bottom:1px solid var(--ui-gray-100); }
.gb-grade-grid tr:hover { background:var(--ui-primary-50); }
.gb-grade-cell { cursor:pointer; border-radius:3px; padding:0.15rem 0.3rem; transition:background 0.15s; min-width:2.5rem; display:inline-block; }
.gb-grade-cell:hover { background:var(--ui-primary-100); }
.gb-grade-cell.gb-fail { color:#dc2626; font-weight:600; }
.gb-grade-cell.gb-distinction { color:#059669; font-weight:600; }
.gb-assess-card { background:var(--ui-white); border:1px solid var(--ui-gray-200); border-radius:6px; padding:0.75rem; margin-bottom:0.5rem; }
.gb-assess-card:hover { box-shadow:0 2px 8px rgba(0,0,0,0.08); }
.gb-final-pass { background:#f0fdf4; }
.gb-final-fail { background:#fef2f2; }

/* Attendance & DP panel */
.at-kpi-card { background:var(--ui-white); border:1px solid var(--ui-gray-200); border-radius:6px; padding:0.6rem 0.75rem; flex:1; min-width:7rem; }
.at-section-title { font-size:0.85rem; font-weight:700; color:var(--ui-gray-800); margin:1.25rem 0 0.6rem 0; padding-bottom:0.3rem; border-bottom:1px solid var(--ui-gray-200); }
.at-session-card { background:var(--ui-white); border:1px solid var(--ui-gray-200); border-radius:6px; padding:0.6rem 0.75rem; margin-bottom:0.4rem; cursor:pointer; transition:box-shadow 0.15s; }
.at-session-card:hover { box-shadow:0 2px 8px rgba(0,0,0,0.08); }
.at-session-card.at-active { border-color:var(--ui-primary-400); background:var(--ui-primary-50); }
.at-mark-btn { width:28px; height:28px; border-radius:50%; border:2px solid var(--ui-gray-300); display:inline-flex; align-items:center; justify-content:center; cursor:pointer; font-size:0.65rem; transition:all 0.15s; background:var(--ui-white); }
.at-mark-btn.at-present { background:#dcfce7; border-color:#22c55e; color:#16a34a; }
.at-mark-btn.at-absent { background:#fef2f2; border-color:#ef4444; color:#dc2626; }
.at-mark-btn.at-late { background:#fffbeb; border-color:#f59e0b; color:#d97706; }
.at-mark-btn.at-excused { background:#eff6ff; border-color:#3b82f6; color:#2563eb; }
.at-dp-ok { background:#f0fdf4; }
.at-dp-risk { background:#fffbeb; }
.at-dp-excluded { background:#fef2f2; }
.at-attend-grid { width:100%; border-collapse:collapse; font-size:0.72rem; }
.at-attend-grid th { background:var(--ui-gray-50); padding:0.4rem 0.5rem; font-weight:600; font-size:0.65rem; text-align:center; border-bottom:2px solid var(--ui-gray-200); position:sticky; top:0; z-index:1; }
.at-attend-grid td { padding:0.3rem 0.4rem; text-align:center; border-bottom:1px solid var(--ui-gray-100); }
.at-attend-grid tr:hover { background:var(--ui-primary-50); }

/* Check-in mode */
.at-checkin-display { text-align:center; padding:2rem; }
.at-checkin-pin { font-size:3rem; font-weight:800; letter-spacing:0.5rem; color:var(--ui-primary-600); font-family:monospace; }
.at-checkin-label { font-size:0.85rem; color:var(--ui-gray-500); margin-top:0.5rem; }
.at-checkin-live { display:flex; gap:0.3rem; flex-wrap:wrap; margin-top:1rem; justify-content:center; }
.at-checkin-dot { width:10px; height:10px; border-radius:50%; background:var(--ui-gray-200); transition:background 0.3s; }
.at-checkin-dot.at-checked { background:#22c55e; }
.at-session-type-badge { display:inline-block; font-size:0.6rem; padding:1px 6px; border-radius:3px; font-weight:600; text-transform:uppercase; }
.at-session-type-badge.lecture { background:#dbeafe; color:#1d4ed8; }
.at-session-type-badge.tutorial { background:#fef3c7; color:#92400e; }
.at-session-type-badge.practical { background:#dcfce7; color:#166534; }

/* Historical Performance charts */
.hp-kpi-card {
    background: var(--ui-white);
    border: 1px solid var(--ui-gray-200);
    border-radius: 6px;
    padding: 0.75rem;
    flex: 1;
    min-width: 8rem;
}
.hp-year-card {
    background: var(--ui-white);
    border: 1px solid var(--ui-gray-200);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}
.hp-grade-bar {
    display: flex;
    height: 24px;
    border-radius: 3px;
    overflow: hidden;
}
.hp-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ui-gray-800);
    margin: 1.5rem 0 0.75rem 0;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--ui-gray-200);
}

/* User Management panel */
.um-kpi-card {
    background: var(--ui-white);
    border: 1px solid var(--ui-gray-200);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    flex: 1;
    min-width: 7rem;
    text-align: center;
}
.um-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ui-gray-800);
    margin: 1.25rem 0 0.6rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--ui-gray-200);
}

/* Role Configuration panel */
.rc-kpi-card {
    background: var(--ui-white);
    border: 1px solid var(--ui-gray-200);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    flex: 1;
    min-width: 7rem;
    text-align: center;
}
.rc-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ui-gray-800);
    margin: 1.25rem 0 0.6rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--ui-gray-200);
}

/* System Integrations panel */
.si-kpi-card {
    background: var(--ui-white);
    border: 1px solid var(--ui-gray-200);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    flex: 1;
    min-width: 7.5rem;
    text-align: center;
}
.si-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ui-gray-800);
    margin: 1.25rem 0 0.6rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--ui-gray-200);
}

/* Student Dashboard panel */
.sd-kpi-card { background:var(--ui-white); border:1px solid var(--ui-gray-200); border-radius:6px; padding:0.6rem 0.75rem; flex:1; min-width:7rem; }
.sd-section-title { font-size:0.85rem; font-weight:700; color:var(--ui-gray-800); margin:1.25rem 0 0.6rem 0; padding-bottom:0.3rem; border-bottom:1px solid var(--ui-gray-200); }

/* My Results panel */
.mr-kpi-card { background:var(--ui-white); border:1px solid var(--ui-gray-200); border-radius:6px; padding:0.6rem 0.75rem; flex:1; min-width:7rem; }
.mr-section-title { font-size:0.85rem; font-weight:700; color:var(--ui-gray-800); margin:1.25rem 0 0.6rem 0; padding-bottom:0.3rem; border-bottom:1px solid var(--ui-gray-200); }

/* Degree Progress panel */
.dp-kpi-card { background:var(--ui-white); border:1px solid var(--ui-gray-200); border-radius:6px; padding:0.6rem 0.75rem; flex:1; min-width:7rem; }
.dp-section-title { font-size:0.85rem; font-weight:700; color:var(--ui-gray-800); margin:1.25rem 0 0.6rem 0; padding-bottom:0.3rem; border-bottom:1px solid var(--ui-gray-200); }

/* Cum Laude panel */
.cl-kpi-card { background:var(--ui-white); border:1px solid var(--ui-gray-200); border-radius:6px; padding:0.6rem 0.75rem; flex:1; min-width:7rem; }
.cl-section-title { font-size:0.85rem; font-weight:700; color:var(--ui-gray-800); margin:1.25rem 0 0.6rem 0; padding-bottom:0.3rem; border-bottom:1px solid var(--ui-gray-200); }

/* Evidence Portfolio panel */
.ep-kpi-card { background:var(--ui-white); border:1px solid var(--ui-gray-200); border-radius:6px; padding:0.6rem 0.75rem; flex:1; min-width:7rem; }
.ep-section-title { font-size:0.85rem; font-weight:700; color:var(--ui-gray-800); margin:1.25rem 0 0.6rem 0; padding-bottom:0.3rem; border-bottom:1px solid var(--ui-gray-200); }

/* Study Diary panel */
.sd2-kpi-card { background:var(--ui-white); border:1px solid var(--ui-gray-200); border-radius:6px; padding:0.6rem 0.75rem; flex:1; min-width:7rem; }
.sd2-section-title { font-size:0.85rem; font-weight:700; color:var(--ui-gray-800); margin:1.25rem 0 0.6rem 0; padding-bottom:0.3rem; border-bottom:1px solid var(--ui-gray-200); }

/* Achievements panel */
.ach-kpi-card { background:var(--ui-white); border:1px solid var(--ui-gray-200); border-radius:6px; padding:0.6rem 0.75rem; flex:1; min-width:7rem; }
.ach-section-title { font-size:0.85rem; font-weight:700; color:var(--ui-gray-800); margin:1.25rem 0 0.6rem 0; padding-bottom:0.3rem; border-bottom:1px solid var(--ui-gray-200); }

/* Programme Overview panel */
.po-kpi-card { background:var(--ui-white); border:1px solid var(--ui-gray-200); border-radius:6px; padding:0.6rem 0.75rem; flex:1; min-width:7rem; }
.po-section-title { font-size:0.85rem; font-weight:700; color:var(--ui-gray-800); margin:1.25rem 0 0.6rem 0; padding-bottom:0.3rem; border-bottom:1px solid var(--ui-gray-200); }

/* ══════════════════════════════════════════════════════════════════
   AutoScholar Design Tokens & Utility Classes
   ══════════════════════════════════════════════════════════════════ */

:root {
    /* ── RBAC Level Colors (1-6) ─────────────────────────────────── */
    --as-level-1-bg:     #fef2f2;  --as-level-1-border: #fca5a5;  --as-level-1-text: #991b1b;
    --as-level-2-bg:     #fff7ed;  --as-level-2-border: #fdba74;  --as-level-2-text: #9a3412;
    --as-level-3-bg:     #fefce8;  --as-level-3-border: #fde047;  --as-level-3-text: #854d0e;
    --as-level-4-bg:     #f0fdf4;  --as-level-4-border: #86efac;  --as-level-4-text: #166534;
    --as-level-5-bg:     #eff6ff;  --as-level-5-border: #93c5fd;  --as-level-5-text: #1e40af;
    --as-level-6-bg:     #f8fafc;  --as-level-6-border: #cbd5e1;  --as-level-6-text: #475569;

    /* ── Permission Group Colors ──────────────────────────────────── */
    --as-perm-classroom:     #1a237e;
    --as-perm-student:       #00695c;
    --as-perm-programme:     #4a148c;
    --as-perm-casework:      #bf360c;
    --as-perm-accreditation: #1b5e20;
    --as-perm-executive:     #e65100;
    --as-perm-admin:         #263238;
    --as-perm-tools:         #37474f;
    --as-perm-advanced:      #311b92;

    /* ── Integration Colors ──────────────────────────────────────── */
    --as-integ-sis:       #1a237e;
    --as-integ-lms:       #f57c00;
    --as-integ-email:     #00695c;
    --as-integ-ldap:      #4a148c;
    --as-integ-docstore:  #bf360c;
    --as-integ-analytics: #311b92;

    /* ── Status Colors ───────────────────────────────────────────── */
    --as-status-connected-color:    #10b981;  --as-status-connected-bg:    #f0fdf4;  --as-status-connected-border:    #bbf7d0;
    --as-status-disconnected-color: #6b7280;  --as-status-disconnected-bg: #f9fafb;  --as-status-disconnected-border: #d1d5db;
    --as-status-error-color:        #ef4444;  --as-status-error-bg:        #fef2f2;  --as-status-error-border:        #fecaca;
    --as-status-testing-color:      #f59e0b;  --as-status-testing-bg:      #fffbeb;  --as-status-testing-border:      #fde68a;
    --as-status-configured-color:   #3b82f6;  --as-status-configured-bg:   #eff6ff;  --as-status-configured-border:   #bfdbfe;

    /* ── Brand ───────────────────────────────────────────────────── */
    --as-brand-navy:       #1a237e;
    --as-brand-gold:       #d4af37;
    --as-avatar-gradient:  linear-gradient(135deg, #667eea, #764ba2);

    /* ── Common UI ───────────────────────────────────────────────── */
    --as-muted:            #888;
    --as-text-body:        #333;
    --as-text-secondary:   #666;
    --as-text-tertiary:    #888;
    --as-text-faint:       #999;
    --as-border-light:     #e5e7eb;
    --as-border-subtle:    #f3f4f6;
    --as-bg-subtle:        #f8fafc;
    --as-bg-hover:         #f8fafc;
    --as-success-bg:       #f0fdf4;
    --as-success-text:     #065f46;
    --as-success-border:   #bbf7d0;
    --as-danger-bg:        #fef2f2;
    --as-danger-text:      #991b1b;
    --as-danger-border:    #fecaca;
    --as-warn-bg:          #fffbeb;
    --as-warn-text:        #92400e;
    --as-warn-border:      #fde68a;
}

/* ── Layout Atoms ────────────────────────────────────────────────── */
.as-truncate   { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-shrink-0   { flex-shrink: 0; }
.as-min-w-0    { min-width: 0; }
.as-flex-1     { flex: 1; }

/* ── Border Radius ───────────────────────────────────────────────── */
.as-rounded-sm   { border-radius: 3px; }
.as-rounded-md   { border-radius: 5px; }
.as-rounded-lg   { border-radius: 6px; }
.as-rounded-xl   { border-radius: 8px; }
.as-rounded-full { border-radius: 9999px; }

/* ── Hover Effects (replace JS onmouseenter/leave) ───────────────── */
.as-hover-row {
    transition: background 0.15s;
    cursor: pointer;
}
.as-hover-row:hover {
    background: var(--as-bg-hover);
}
.as-hover-card {
    transition: box-shadow 0.15s;
    cursor: pointer;
}
.as-hover-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ── Level Badge ─────────────────────────────────────────────────── */
.as-level-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}
.as-level-badge-sm { width: 22px; height: 22px; border-radius: 4px; font-size: 0.6rem; }
.as-level-badge-md { width: 28px; height: 28px; border-radius: 5px; font-size: 0.75rem; }
.as-level-badge-lg { width: 48px; height: 48px; border-radius: 8px; font-size: 1.5rem; }

/* ── Avatar ──────────────────────────────────────────────────────── */
.as-avatar {
    border-radius: 50%;
    background: var(--as-avatar-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    position: relative;
}
.as-avatar-sm { width: 24px; height: 24px; font-size: 0.5rem; }
.as-avatar-md { width: 28px; height: 28px; font-size: 0.6rem; }
.as-avatar-lg { width: 48px; height: 48px; font-size: 1.2rem; }

.as-avatar-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.3);
}

/* ── Integration Icon ────────────────────────────────────────────── */
.as-integ-icon {
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.as-integ-icon-sm { width: 24px; height: 24px; border-radius: 5px; }
.as-integ-icon-md { width: 28px; height: 28px; border-radius: 6px; }
.as-integ-icon-lg { width: 48px; height: 48px; border-radius: 10px; }

/* ── Status Pill ─────────────────────────────────────────────────── */
.as-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.4rem;
    border-radius: 12px;
    font-size: 0.55rem;
    font-weight: 600;
    border-width: 1px;
    border-style: solid;
}

/* ── Permission Chip ─────────────────────────────────────────────── */
.as-perm-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.55rem;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    border: 1px solid;
}

/* ── Progress Track/Fill ─────────────────────────────────────────── */
.as-progress-track {
    background: var(--as-border-light);
    border-radius: 3px;
    overflow: hidden;
}
.as-progress-track-sm { height: 3px; }
.as-progress-track-md { height: 6px; }
.as-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

/* ── Field Label / Input ─────────────────────────────────────────── */
.as-field-label {
    font-size: 0.6rem;
    color: var(--as-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.1rem;
}
.as-field-input {
    width: 100%;
    padding: 0.25rem 0.4rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.7rem;
    box-sizing: border-box;
    font-family: monospace;
}

/* ── Pre (code blocks) ───────────────────────────────────────────── */
.as-pre {
    font-size: 0.6rem;
    background: #f8f9fa;
    border: 1px solid var(--as-border-light);
    border-radius: 4px;
    padding: 0.5rem;
    max-height: 12rem;
    overflow: auto;
    color: var(--as-text-body);
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── Section Header ──────────────────────────────────────────────── */
.as-section-header {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ── Executive Insight panels ── */
.ex-kpi-card {
    background: var(--ui-white);
    border: 1px solid var(--ui-gray-200);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    flex: 1;
    min-width: 7rem;
}
.ex-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ui-gray-800);
    margin: 1.25rem 0 0.6rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--ui-gray-200);
}
.ex-category-card {
    background: var(--ui-white);
    border: 1px solid var(--ui-gray-200);
    border-radius: 6px;
    padding: 0.75rem;
}

/* ── Responsive: tablet ── */
@media (max-width: 768px) {
    .rig-header { padding: 0.4rem 0.75rem; }
}

/* ── Responsive: mobile ── */
@media (max-width: 640px) {
    .rig-log { max-height: 5rem; font-size: 0.65rem; }
}
