/* ============================================================
   Backoffice Blazor - Staff Dashboard Styles
   Mirrors the vanilla JS styles.css design language
   ============================================================ */

:root {
    --org-primary: #6D1D3A;
    --org-primary-dark: #501530;
    --org-primary-light: #8A2A4E;
    --org-secondary: #C8A951;
    --org-secondary-light: #E5D5A0;
    --bg-primary: #F8F9FA;
    --bg-card: #FFFFFF;
    --border-color: #E5E7EB;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 8px;
    --transition: all 0.2s ease;
}

/* ── App Shell ─────────────────────────────────────────── */
.bo-app {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    line-height: 1.5;
}

/* ── Sidebar ───────────────────────────────────────────── */
.bo-sidebar {
    width: 240px;
    background: var(--org-primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: width 0.2s ease;
}

.sidebar-collapsed .bo-sidebar { width: 60px; }
.sidebar-collapsed .bo-sidebar span,
.sidebar-collapsed .bo-sidebar .bo-sidebar-header p,
.sidebar-collapsed .bo-sidebar .bo-sidebar-user-info,
.sidebar-collapsed .bo-sidebar .bo-nav-badge-dev { display: none; }
.sidebar-collapsed .bo-sidebar .bo-sidebar-header h1 { font-size: 0; }
.sidebar-collapsed .bo-sidebar .bo-sidebar-header h1::first-letter { font-size: 16px; }

.bo-sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--org-primary-light);
}

.bo-sidebar-header h1 {
    font-size: 16px;
    font-weight: 600;
    color: var(--org-secondary);
}

.bo-sidebar-header .bo-org-name {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    margin-top: 2px;
}

.bo-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.bo-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.bo-nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.bo-nav-item.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-left-color: var(--org-secondary);
}

.bo-nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.bo-nav-badge-dev {
    font-size: 9px;
    background: rgba(255,255,255,0.2);
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: auto;
    letter-spacing: 0.5px;
}

/* Sidebar User */
.bo-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--org-primary-light);
    margin-top: auto;
}

.bo-sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--org-secondary);
    color: var(--org-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.bo-sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.bo-sidebar-user-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bo-sidebar-user-role {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    text-transform: capitalize;
}

.bo-sidebar-logout-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.bo-sidebar-logout-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.bo-sidebar-logout-btn svg { width: 16px; height: 16px; }

/* ── Main Content ──────────────────────────────────────── */
.bo-main {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.2s ease;
}

.sidebar-collapsed .bo-main { margin-left: 60px; }

.bo-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.bo-menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.bo-menu-toggle:hover { background: var(--bg-primary); color: var(--text-primary); }
.bo-menu-toggle svg { width: 20px; height: 20px; }

.bo-page-title {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

.bo-topbar-actions { display: flex; align-items: center; gap: 8px; }

.bo-env-badge {
    font-size: 10px;
    background: #dbeafe;
    color: #1d4ed8;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.bo-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ── Toast ─────────────────────────────────────────────── */
.bo-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius);
    color: #fff;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    animation: boToastIn 0.3s ease;
}

.bo-toast-success { background: #059669; }
.bo-toast-error { background: #dc2626; }
.bo-toast-warning { background: #d97706; }
.bo-toast-info { background: #2563eb; }

.bo-toast-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
}

@keyframes boToastIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ── Placeholder Tab ───────────────────────────────────── */
.bo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    color: var(--text-secondary);
}

.bo-placeholder-icon { color: var(--text-muted); margin-bottom: 16px; }
.bo-placeholder h3 { font-size: 18px; color: var(--text-primary); margin-bottom: 8px; }
.bo-placeholder p { font-size: 14px; max-width: 400px; margin-bottom: 16px; }

.bo-placeholder-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--org-primary);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}

.bo-placeholder-link:hover { background: var(--org-primary-dark); }

/* ── Chat Tab ──────────────────────────────────────────── */
.bo-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 130px);
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.bo-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bo-chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
}

.bo-chat-welcome-icon { color: var(--org-primary); opacity: 0.4; margin-bottom: 16px; }
.bo-chat-welcome h3 { font-size: 20px; color: var(--text-primary); margin-bottom: 8px; }
.bo-chat-welcome p { font-size: 14px; max-width: 400px; }

.bo-chat-message {
    max-width: 80%;
    animation: boMsgIn 0.2s ease;
}

.bo-chat-message.user { align-self: flex-end; }
.bo-chat-message.assistant { align-self: flex-start; }

.bo-chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.bo-chat-role { font-weight: 600; }

.bo-chat-message-body {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
}

.bo-chat-message.user .bo-chat-message-body {
    background: var(--org-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.bo-chat-message.assistant .bo-chat-message-body {
    background: #f3f4f6;
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

@keyframes boMsgIn {
    from { transform: translateY(8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Chat Input */
.bo-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.bo-chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.bo-chat-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 42px;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s;
}

.bo-chat-input:focus { border-color: var(--org-primary); }

.bo-chat-send-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: var(--radius);
    background: var(--org-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.bo-chat-send-btn:hover:not(:disabled) { background: var(--org-primary-dark); }
.bo-chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Typing indicator */
.bo-typing-indicator { display: flex; gap: 4px; padding: 4px 0; }
.bo-typing-indicator span {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: boTyping 1.4s infinite;
}
.bo-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.bo-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes boTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Markdown Styles (in chat) ─────────────────────────── */
.bo-chat-message-body .md-heading { margin: 8px 0 4px; }
.bo-chat-message-body .md-code-block { margin: 8px 0; }
.bo-chat-message-body .md-code-pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 12px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
}
.bo-chat-message-body .md-inline-code {
    background: rgba(0,0,0,0.06);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}
.bo-chat-message-body strong { font-weight: 600; }

/* ── Login Page (reuse student styles with overrides) ──── */
.bo-login-page .login-card .subtitle { color: var(--text-secondary); }
.bo-login-page .logo-big span { background: var(--org-primary); }

/* ── Shared Components ─────────────────────────────────── */
.bo-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.bo-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.bo-btn-primary { background: var(--org-primary); color: #fff; }
.bo-btn-primary:hover { background: var(--org-primary-dark); }
.bo-btn-secondary { background: #f3f4f6; color: var(--text-primary); border: 1px solid var(--border-color); }
.bo-btn-secondary:hover { background: #e5e7eb; }
.bo-btn-danger { background: #dc2626; color: #fff; }
.bo-btn-danger:hover { background: #b91c1c; }
.bo-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.bo-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
}

.bo-badge-success { background: #d1fae5; color: #065f46; }
.bo-badge-warning { background: #fef3c7; color: #92400e; }
.bo-badge-danger { background: #fee2e2; color: #991b1b; }
.bo-badge-info { background: #dbeafe; color: #1e40af; }
.bo-badge-primary { background: var(--org-primary, #6d1832); color: #fff; }

/* ── Form Grid ───────────────────────────────────────── */
.bo-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bo-form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--text-secondary); }
.bo-input { width: 100%; padding: 8px 12px; border: 1px solid var(--border-color, #e2e8f0); border-radius: 6px; font-size: 14px; box-sizing: border-box; }
.bo-input:focus { outline: none; border-color: var(--org-primary, #6d1832); box-shadow: 0 0 0 2px rgba(109,24,50,0.1); }
textarea.bo-input { resize: vertical; font-family: inherit; }

/* ── Template Grid ───────────────────────────────────── */
.bo-template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(480px, 1fr)); gap: 16px; }
.bo-template-card .bo-card-header { padding: 12px 16px; border-bottom: 1px solid var(--border-color, #e2e8f0); }
.bo-template-details { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.bo-template-detail { display: flex; gap: 8px; }
.bo-template-detail-label { font-weight: 600; color: var(--text-secondary); min-width: 120px; flex-shrink: 0; }
.bo-btn-sm { padding: 4px 12px; font-size: 12px; }
.bo-btn-secondary { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.bo-btn-secondary:hover { background: #e5e7eb; }

/* ── Flow Diagram ────────────────────────────────────── */
.bo-flow-step { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bo-flow-icon { font-size: 24px; }
.bo-flow-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.bo-flow-arrow { font-size: 20px; color: var(--text-secondary); }
.bo-flow-desc { font-size: 10px; color: #9ca3af; text-align: center; }

/* ── Category Grid ───────────────────────────────────── */
.bo-category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.bo-category-meta { display: flex; flex-direction: column; gap: 6px; }
.bo-category-meta-item { display: flex; gap: 8px; }
.bo-category-meta-label { font-weight: 600; color: var(--text-secondary); min-width: 110px; flex-shrink: 0; }

/* ── Advising ─────────────────────────────────────────── */
.bo-advising-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.bo-clickable { cursor: pointer; transition: box-shadow 0.15s; }
.bo-clickable:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.bo-stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.bo-stat-item { text-align: center; padding: 12px; background: #f9fafb; border-radius: 8px; }
.bo-stat-value { font-size: 24px; font-weight: 700; color: var(--text-primary); }
.bo-stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.bo-stat-danger { background: #fef2f2; }
.bo-stat-danger .bo-stat-value { color: #dc2626; }
.bo-stat-warning { background: #fffbeb; }
.bo-stat-warning .bo-stat-value { color: #d97706; }
.bo-analysis-section { margin-bottom: 12px; padding: 12px; background: #f9fafb; border-left: 3px solid var(--org-primary, #6d1832); border-radius: 0 6px 6px 0; }
.bo-analysis-section h6 { margin: 0 0 4px; font-size: 13px; color: var(--text-secondary); }
.bo-analysis-section p { margin: 0; font-size: 13px; white-space: pre-wrap; }

/* ── Table Styles ──────────────────────────────────────── */
.bo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.bo-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: #f9fafb;
    border-bottom: 2px solid var(--border-color);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bo-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.bo-table tr:hover { background: #f9fafb; }

/* ── Form Styles ───────────────────────────────────────── */
.bo-form-group { margin-bottom: 16px; }

.bo-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.bo-form-input,
.bo-form-select,
.bo-form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
    outline: none;
}

.bo-form-input:focus,
.bo-form-select:focus,
.bo-form-textarea:focus { border-color: var(--org-primary); }

.bo-form-textarea { min-height: 80px; resize: vertical; }

/* ── Modal Styles ──────────────────────────────────────── */
.bo-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: boFadeIn 0.2s ease;
}

.bo-modal {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.bo-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.bo-modal-header h3 { font-size: 16px; font-weight: 600; }

.bo-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
}

.bo-modal-close:hover { background: #f3f4f6; color: var(--text-primary); }

.bo-modal-body { padding: 20px; }

.bo-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
}

@keyframes boFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════
   Case Detail Slide-out Panel (Phase 9)
   ═══════════════════════════════════════════════════════════ */

.cd-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 9990;
    backdrop-filter: blur(2px);
}

.cd-panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 740px; max-width: 92vw;
    background: #fff;
    z-index: 9991;
    box-shadow: -6px 0 24px rgba(0,0,0,0.18);
    display: flex; flex-direction: column;
    animation: cd-slide-in 0.2s ease-out;
}

@keyframes cd-slide-in {
    from { transform: translateX(40px); opacity: 0.8; }
    to   { transform: translateX(0);    opacity: 1; }
}

.cd-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
}

.cd-close-btn {
    background: none; border: none;
    font-size: 20px; cursor: pointer; color: var(--text-muted);
    padding: 4px 8px; border-radius: 4px;
    transition: var(--transition);
}
.cd-close-btn:hover { background: #f1f5f9; color: var(--text-primary); }

.cd-body {
    flex: 1; overflow-y: auto;
    padding: 16px 20px;
}

/* Channel badges */
.cd-channel-badge {
    display: inline-block; padding: 2px 8px;
    border-radius: 4px; font-size: 10px; font-weight: 700;
    letter-spacing: 0.5px;
}
.cd-channel-badge.email { background: #dbeafe; color: #1d4ed8; }
.cd-channel-badge.chat  { background: #dcfce7; color: #15803d; }
.cd-channel-badge.escalation { background: #fee2e2; color: #dc2626; }

/* Status flow */
.cd-status-flow {
    display: flex; gap: 3px; margin-bottom: 16px;
}
.cd-status-step {
    flex: 1; text-align: center;
    padding: 8px 4px; border-radius: 4px;
    font-size: 10px; font-weight: 500;
    background: #f3f4f6; color: var(--text-muted);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.cd-step-icon { font-size: 11px; }
.cd-status-step.done { background: #f3e8ec; color: var(--org-primary); }
.cd-status-step.current { background: var(--org-primary); color: #fff; font-weight: 700; }

/* Action buttons */
.cd-actions {
    display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px;
}
.cd-action-btn {
    padding: 7px 16px; border: none; border-radius: 5px;
    font-size: 12px; font-weight: 600; cursor: pointer;
    transition: var(--transition);
}
.cd-action-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.cd-action-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.cd-action-btn.classify { background: #0891b2; color: #fff; }
.cd-action-btn.primary  { background: #3b82f6; color: #fff; }
.cd-action-btn.success  { background: #16a34a; color: #fff; }
.cd-action-btn.danger   { background: #dc2626; color: #fff; }
.cd-action-btn.warning  { background: #f97316; color: #fff; }
.cd-action-btn.secondary { background: #e5e7eb; color: #374151; }

/* Sections */
.cd-section {
    border: 1px solid var(--border-color);
    border-radius: 8px; margin-bottom: 14px;
    overflow: hidden;
}
.cd-section-header {
    padding: 10px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px; font-weight: 600;
    display: flex; justify-content: space-between; align-items: center;
}
.cd-section-header.ai     { background: #f0f9ff; }
.cd-section-header.chat   { background: #f0fdf4; }
.cd-section-header.email  { background: #f8fafc; }
.cd-section-header.draft  { background: #fefce8; }
.cd-section-header.response { background: #faf5ff; }
.cd-section-body {
    padding: 12px 16px;
    font-size: 12px;
}

/* Stat grids */
.cd-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cd-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

.cd-stat {
    padding: 8px; background: #f8fafc;
    border-radius: 6px;
}
.cd-stat-label { color: var(--text-muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.cd-stat-value { font-weight: 600; font-size: 12px; margin-top: 2px; }

/* Risk gauge */
.cd-risk-badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 4px; font-size: 11px;
    font-weight: 700; color: #fff;
}
.cd-risk-gauge { margin-top: 10px; }
.cd-risk-gauge-track {
    height: 8px; background: #e5e7eb;
    border-radius: 4px; overflow: hidden;
}
.cd-risk-gauge-fill {
    height: 100%; border-radius: 4px;
    transition: width 0.5s ease;
}
.cd-risk-gauge-labels {
    display: flex; justify-content: space-between;
    font-size: 9px; color: var(--text-muted);
    margin-top: 3px;
}
.cd-risk-factor { margin-bottom: 6px; }
.cd-risk-factor-header {
    display: flex; justify-content: space-between;
    font-size: 11px; margin-bottom: 2px;
}
.cd-risk-factor-bar {
    height: 5px; background: #e5e7eb;
    border-radius: 3px; overflow: hidden;
    margin-bottom: 2px;
}

/* Chat messages */
.cd-chat-msg {
    margin-bottom: 10px; padding: 8px 12px;
    border-radius: 8px; max-width: 90%;
}
.cd-chat-msg.user {
    background: #f0f0f0; align-self: flex-end;
    border-bottom-right-radius: 2px;
    margin-left: auto;
}
.cd-chat-msg.assistant {
    background: #f0f9ff; align-self: flex-start;
    border-bottom-left-radius: 2px;
}
.cd-chat-msg-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 4px;
}
.cd-chat-role {
    font-size: 10px; font-weight: 700;
    padding: 1px 6px; border-radius: 3px;
}
.cd-chat-role.user { background: #dbeafe; color: #1d4ed8; }
.cd-chat-role.ai   { background: #dcfce7; color: #15803d; }
.cd-chat-time { font-size: 9px; color: var(--text-muted); }
.cd-chat-msg-body {
    font-size: 12px; line-height: 1.5;
    white-space: pre-wrap; word-break: break-word;
}

/* Email parts */
.cd-email-meta {
    margin-bottom: 12px;
    line-height: 1.8;
}
.cd-email-label {
    color: var(--text-secondary); font-weight: 600;
    display: inline-block; min-width: 60px;
}
.cd-email-part {
    border: 1px solid var(--border-color);
    border-radius: 6px; margin-bottom: 8px;
    overflow: hidden;
}
.cd-email-part.main { border-color: #93c5fd; }
.cd-email-part-label {
    padding: 6px 12px; background: #f8fafc;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}
.cd-email-part.original .cd-email-part-label { background: #eff6ff; color: #1d4ed8; }
.cd-email-part.quoted_reply .cd-email-part-label { background: #f0fdf4; color: #15803d; }
.cd-email-part.forwarded .cd-email-part-label { background: #fefce8; color: #a16207; }
.cd-email-part.signature .cd-email-part-label { background: #f5f3ff; color: #7c3aed; }
.cd-email-part-content {
    padding: 10px 12px;
    white-space: pre-wrap; line-height: 1.5;
    max-height: 200px; overflow-y: auto;
    font-size: 12px;
}
.cd-email-body {
    padding: 12px; background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    white-space: pre-wrap; max-height: 300px;
    overflow-y: auto; line-height: 1.5;
}

/* Attachments */
.cd-attachment-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}
.cd-attachment-item:last-child { border-bottom: none; }
.cd-attachment-icon { font-size: 20px; }
.cd-attachment-info { flex: 1; }
.cd-attachment-name { font-weight: 600; font-size: 12px; }
.cd-attachment-meta { font-size: 10px; color: var(--text-muted); }
.cd-attachment-download {
    padding: 4px 10px; background: #3b82f6; color: #fff;
    border-radius: 4px; font-size: 11px; text-decoration: none;
    font-weight: 600;
}
.cd-attachment-download:hover { background: #2563eb; }

/* AI confidence badge */
.cd-conf-badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 4px; font-size: 11px;
    font-weight: 700; color: #fff;
}

/* AI Reasoning */
.cd-reasoning-block {
    margin-top: 10px; padding: 6px 0;
}
.cd-reasoning-label {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.3px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.cd-reasoning-text {
    font-size: 12px; line-height: 1.5;
    white-space: pre-wrap; color: var(--text-primary);
}

/* Tags */
.cd-tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.cd-tag {
    display: inline-block; padding: 2px 8px;
    border-radius: 4px; font-size: 10px; font-weight: 600;
}
.cd-tag.policy   { background: #dbeafe; color: #1d4ed8; }
.cd-tag.risk     { background: #fee2e2; color: #dc2626; }
.cd-tag.factor   { background: #dcfce7; color: #15803d; }
.cd-tag.calendar { background: #fef3c7; color: #a16207; }

/* Draft response */
.cd-copy-btn {
    padding: 4px 12px; background: var(--org-primary); color: #fff;
    border: none; border-radius: 4px;
    font-size: 11px; font-weight: 600; cursor: pointer;
    transition: var(--transition);
}
.cd-copy-btn:hover { background: var(--org-primary-dark); }
.cd-draft-subject {
    padding: 8px; background: #f8fafc;
    border-radius: 6px; margin-bottom: 8px;
    font-size: 12px;
}
.cd-draft-body {
    padding: 12px; background: #fffbeb;
    border: 1px solid #fde68a; border-radius: 6px;
    white-space: pre-wrap; line-height: 1.6;
    max-height: 250px; overflow-y: auto;
    font-size: 12px;
}

/* Response editor */
.cd-field-label {
    display: block; font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.3px;
    color: var(--text-secondary); margin-bottom: 4px;
}
.cd-input {
    width: 100%; padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px; font-size: 12px;
    transition: var(--transition);
    box-sizing: border-box;
}
.cd-input:focus { border-color: var(--org-primary); outline: none; box-shadow: 0 0 0 2px rgba(122,27,62,0.1); }
.cd-textarea {
    width: 100%; padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px; font-size: 12px;
    resize: vertical; font-family: inherit;
    transition: var(--transition);
    box-sizing: border-box;
}
.cd-textarea:focus { border-color: var(--org-primary); outline: none; box-shadow: 0 0 0 2px rgba(122,27,62,0.1); }

/* Activity timeline */
.cd-timeline {
    position: relative;
    padding: 8px 0 8px 28px;
}
.cd-timeline::before {
    content: '';
    position: absolute; left: 18px; top: 0; bottom: 0;
    width: 2px; background: #e5e7eb;
}
.cd-tl-entry {
    display: flex; gap: 10px;
    padding: 8px 16px 8px 0;
    position: relative;
}
.cd-tl-icon {
    width: 22px; height: 22px;
    border-radius: 50%;
    position: absolute; left: -23px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700;
    border: 2px solid #fff;
    z-index: 1;
}
.cd-tl-icon::after {
    font-size: 10px;
}
.cd-tl-icon.created    { background: #dbeafe; color: #1d4ed8; }
.cd-tl-icon.created::after    { content: '+'; }
.cd-tl-icon.classified { background: #e0f2fe; color: #0891b2; }
.cd-tl-icon.classified::after { content: 'AI'; font-size: 7px; }
.cd-tl-icon.claimed    { background: #dbeafe; color: #3b82f6; }
.cd-tl-icon.claimed::after    { content: '~'; }
.cd-tl-icon.approved   { background: #dcfce7; color: #16a34a; }
.cd-tl-icon.approved::after   { content: '\2713'; }
.cd-tl-icon.sent       { background: #dbeafe; color: #2563eb; }
.cd-tl-icon.sent::after       { content: '\2192'; }
.cd-tl-icon.closed     { background: #f3f4f6; color: #6b7280; }
.cd-tl-icon.closed::after     { content: '\25A0'; }
.cd-tl-icon.rejected   { background: #fee2e2; color: #dc2626; }
.cd-tl-icon.rejected::after   { content: '\2717'; }
.cd-tl-icon.escalated  { background: #ffedd5; color: #f97316; }
.cd-tl-icon.escalated::after  { content: '!'; }
.cd-tl-icon.reopened   { background: #fef3c7; color: #a16207; }
.cd-tl-icon.reopened::after   { content: '\21BB'; }
.cd-tl-icon.edited     { background: #faf5ff; color: #7c3aed; }
.cd-tl-icon.edited::after     { content: '\270E'; }
.cd-tl-icon.note       { background: #fefce8; color: #a16207; }
.cd-tl-icon.note::after       { content: '\270D'; }
.cd-tl-icon.status     { background: #e0f2fe; color: #0891b2; }
.cd-tl-icon.status::after     { content: '\2699'; }
.cd-tl-icon.assigned   { background: #e0e7ff; color: #4338ca; }
.cd-tl-icon.assigned::after   { content: '\2192'; }
.cd-tl-icon.default    { background: #f3f4f6; color: #6b7280; }
.cd-tl-icon.default::after    { content: '\2022'; }

.cd-tl-content { flex: 1; min-width: 0; }
.cd-tl-header {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px;
}
.cd-tl-time { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.cd-tl-performer { font-size: 10px; color: var(--text-secondary); }
.cd-tl-details {
    font-size: 11px; color: var(--text-secondary);
    margin-top: 2px; line-height: 1.4;
}

/* Workflow info bar */
.cd-workflow-info {
    display: flex; gap: 12px; flex-wrap: wrap;
    padding: 8px 12px; margin-bottom: 14px;
    background: #f8fafc; border: 1px solid var(--border-color);
    border-radius: 6px; font-size: 11px; color: var(--text-secondary);
}

/* Governance warning */
.cd-gov-warning {
    padding: 8px 12px; margin-bottom: 14px;
    background: #fef3c7; border: 1px solid #fde68a;
    border-radius: 6px; font-size: 11px; color: #92400e;
    border-left: 4px solid #f59e0b;
}

/* Dialog overlay & dialog box */
.cd-dialog-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9995;
    display: flex; align-items: center; justify-content: center;
}
.cd-dialog {
    background: #fff; border-radius: 10px;
    padding: 20px 24px; width: 420px; max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    z-index: 9996;
}
.cd-dialog-title {
    font-size: 16px; font-weight: 700;
    margin-bottom: 8px;
}
.cd-dialog-actions {
    display: flex; gap: 8px; justify-content: flex-end;
    margin-top: 12px;
}

/* ═══════════════════════════════════════════════════════
   AI Diagnostics Tab
   ═══════════════════════════════════════════════════════ */
.diag-tabs {
    display: flex; gap: 2px; flex-wrap: wrap;
    background: #f1f5f9; border-radius: 8px;
    padding: 4px; margin-bottom: 20px;
}
.diag-tab {
    padding: 8px 14px; border: none; background: transparent;
    font-size: 12px; font-weight: 500; color: #64748b;
    border-radius: 6px; cursor: pointer; transition: all 0.15s;
    white-space: nowrap;
}
.diag-tab:hover { background: #e2e8f0; color: #1e293b; }
.diag-tab.active { background: #fff; color: #1e293b; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.diag-tab-icon { font-size: 13px; }
.diag-content { min-height: 400px; }

/* Filter bar */
.diag-filter-bar {
    display: flex; gap: 8px; align-items: center;
    margin-bottom: 16px; flex-wrap: wrap;
}
.diag-action-bar {
    display: flex; gap: 8px; align-items: center;
    margin-bottom: 16px; flex-wrap: wrap;
}
.diag-select {
    padding: 6px 10px; border: 1px solid #d1d5db;
    border-radius: 6px; font-size: 12px; background: #fff;
}
.diag-btn {
    padding: 7px 16px; border: none; border-radius: 6px;
    font-size: 12px; font-weight: 600; cursor: pointer;
}
.diag-btn.primary { background: #1e40af; color: #fff; }
.diag-btn.primary:hover { background: #1e3a8a; }
.diag-btn.primary:disabled { background: #93c5fd; cursor: not-allowed; }
.diag-btn.secondary { background: #e2e8f0; color: #475569; }
.diag-btn.secondary:hover { background: #cbd5e1; }
.diag-table-info { font-size: 11px; color: #64748b; margin-bottom: 8px; }

/* KPI row */
.diag-kpi-row {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px; margin-bottom: 16px;
}
.diag-kpi {
    background: #fff; border: 1px solid #e2e8f0;
    border-left: 4px solid #3b82f6;
    border-radius: 8px; padding: 14px 16px;
}
.diag-kpi-label { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }
.diag-kpi-value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.diag-kpi.sm { padding: 10px 12px; }
.diag-kpi-value.sm { font-size: 18px; }

/* Clickable rows */
.diag-clickable { cursor: pointer; }
.diag-clickable:hover { background: #f0f9ff !important; }

/* Badges */
.diag-badge {
    display: inline-block; padding: 2px 8px;
    border-radius: 4px; font-size: 10px; font-weight: 600;
}
.diag-badge.info { background: #dbeafe; color: #1d4ed8; }
.diag-badge.success { background: #dcfce7; color: #15803d; }
.diag-badge.danger { background: #fee2e2; color: #dc2626; }
.diag-badge.muted { background: #f1f5f9; color: #64748b; }

.diag-op-badge {
    display: inline-block; padding: 2px 8px;
    background: #f3e8ff; color: #7c3aed;
    border-radius: 4px; font-size: 10px; font-weight: 600;
}
.diag-status-dot { font-weight: 700; }
.diag-status-dot.ok { color: #22c55e; }
.diag-status-dot.fail { color: #dc2626; }

/* Confidence bar */
.diag-conf-bar {
    width: 80px; height: 6px; background: #e2e8f0;
    border-radius: 3px; overflow: hidden; display: inline-block;
    vertical-align: middle; margin-right: 4px;
}
.diag-conf-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }

/* Pagination */
.diag-pagination {
    display: flex; align-items: center; justify-content: center;
    margin-top: 12px; gap: 4px;
}
.diag-page-btn {
    padding: 4px 12px; border: 1px solid #d1d5db;
    background: #fff; border-radius: 4px; cursor: pointer;
    font-size: 14px;
}
.diag-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.diag-page-btn:hover:not(:disabled) { background: #f1f5f9; }

/* Loading & empty */
.diag-loading { text-align: center; padding: 40px; color: #64748b; font-size: 13px; }
.diag-empty { text-align: center; padding: 40px; color: #94a3b8; font-size: 13px; }

/* Modal */
.diag-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 9995; display: flex; align-items: center; justify-content: center;
}
.diag-modal.wide { width: 900px; }
.diag-modal {
    background: #fff; border-radius: 12px;
    width: 720px; max-width: 90vw; max-height: 85vh;
    display: flex; flex-direction: column;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}
.diag-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid #e2e8f0;
}
.diag-modal-header h3 { margin: 0; font-size: 15px; font-weight: 700; }
.diag-modal-body {
    padding: 20px; overflow-y: auto; flex: 1;
}

/* Key-value grid */
.diag-kv-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 8px 16px; margin-bottom: 16px;
}
.diag-kv-grid.c3 { grid-template-columns: 1fr 1fr 1fr; }
.diag-kv-grid.c4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.diag-kv-label { font-size: 10px; color: #64748b; text-transform: uppercase; display: block; }
.diag-kv-value { font-size: 13px; font-weight: 600; }

/* Pre/details */
.diag-pre {
    background: #1e293b; color: #e2e8f0;
    padding: 12px; border-radius: 6px;
    font-size: 11px; line-height: 1.5;
    overflow-x: auto; white-space: pre-wrap; word-break: break-all;
    max-height: 300px;
}
.diag-details { margin-top: 12px; }
.diag-details summary {
    cursor: pointer; font-size: 13px; font-weight: 600;
    padding: 8px 0; color: #1e40af;
}
.diag-error-box {
    background: #fef2f2; border: 1px solid #fecaca;
    border-radius: 6px; padding: 10px 12px;
    font-size: 12px; color: #dc2626; margin-bottom: 12px;
}

/* Health gauge */
.diag-health-result {
    display: flex; gap: 24px; margin-top: 16px;
    align-items: flex-start;
}
.diag-health-gauge { flex: 0 0 120px; }
.diag-health-details { flex: 1; }
.diag-circular-chart { display: block; max-width: 120px; }
.diag-circle-bg {
    fill: none; stroke: #e2e8f0; stroke-width: 3.8;
}
.diag-circle-fg {
    fill: none; stroke-width: 3.8;
    stroke-linecap: round;
    transform: rotate(-90deg); transform-origin: 50% 50%;
    transition: stroke-dasharray 0.6s ease;
}
.diag-circle-text {
    font-size: 10px; font-weight: 700;
    text-anchor: middle; dominant-baseline: central;
}

/* Findings */
.diag-finding {
    padding: 8px 12px; margin-bottom: 6px;
    border-left: 3px solid #64748b;
    background: #f8fafc; border-radius: 0 6px 6px 0;
}
.diag-rec {
    padding: 6px 0; font-size: 12px; color: #475569;
    border-bottom: 1px solid #f1f5f9;
}

/* Chat thread in modal */
.diag-chat-thread {
    max-height: 400px; overflow-y: auto;
    margin-top: 12px;
}
.diag-chat-msg {
    padding: 8px 12px; margin-bottom: 6px;
    border-radius: 8px; font-size: 12px;
}
.diag-chat-msg.user { background: #dbeafe; margin-left: 40px; }
.diag-chat-msg.assistant { background: #f0fdf4; margin-right: 40px; }
.diag-chat-msg.system { background: #fef3c7; margin-right: 40px; font-style: italic; }
.diag-chat-role { font-size: 10px; font-weight: 700; text-transform: uppercase; color: #64748b; margin-bottom: 2px; }
.diag-chat-text { line-height: 1.5; }
.diag-chat-time { font-size: 10px; color: #94a3b8; margin-top: 2px; text-align: right; }

/* Bar charts */
.diag-bar-bg { width: 100%; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; margin-top: 2px; }
.diag-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.diag-bar-fill.purple { background: #7c3aed; }
.diag-bar-fill.green { background: #22c55e; }
.diag-bar-fill.blue { background: #3b82f6; }

/* Daily bar chart */
.diag-daily-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 0 4px; }
.diag-daily-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.diag-daily-bar { width: 100%; min-width: 12px; background: linear-gradient(to top, #3b82f6, #60a5fa); border-radius: 3px 3px 0 0; transition: height 0.3s; min-height: 2px; }
.diag-daily-label { font-size: 9px; color: #94a3b8; margin-top: 4px; }

/* Flow steps */
.diag-flow-steps { display: flex; gap: 0; margin: 16px 0; overflow-x: auto; }
.diag-flow-step { flex: 1; text-align: center; padding: 8px; position: relative; min-width: 100px; }
.diag-flow-step::after { content: ''; position: absolute; top: 16px; right: 0; width: 50%; height: 2px; background: #e2e8f0; }
.diag-flow-step::before { content: ''; position: absolute; top: 16px; left: 0; width: 50%; height: 2px; background: #e2e8f0; }
.diag-flow-step:first-child::before { display: none; }
.diag-flow-step:last-child::after { display: none; }
.diag-flow-step.done::after, .diag-flow-step.done::before { background: #22c55e; }
.diag-flow-dot { width: 12px; height: 12px; border-radius: 50%; background: #e2e8f0; margin: 0 auto 6px; position: relative; z-index: 1; }
.diag-flow-step.done .diag-flow-dot { background: #22c55e; }
.diag-flow-label { font-size: 10px; font-weight: 600; }
.diag-flow-detail { font-size: 9px; color: #64748b; margin-top: 2px; }

/* Info box */
.diag-info-box {
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px;
    padding: 10px 12px; font-size: 12px; color: #1e40af; margin: 8px 0;
}

/* Bulk action bar */
.bulk-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; background: #eff6ff; border-bottom: 2px solid #3b82f6;
    font-size: 12px; color: #1e40af;
}

/* Cross-tab links */
.cd-link { color: #1e40af; cursor: pointer; text-decoration: none; }
.cd-link:hover { text-decoration: underline; color: #1d4ed8; }

/* ═══ Settings Tab ═══ */
.settings-section { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 20px 24px; }
.settings-section-title { font-size: 14px; font-weight: 700; color: #1e293b; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid #f1f5f9; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 16px; }
.settings-field { display: flex; flex-direction: column; gap: 4px; }
.settings-field.full { grid-column: 1 / -1; }
.settings-field label { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.3px; }
.settings-input {
    padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 13px; background: #fff; transition: border-color 0.15s;
}
.settings-input:focus { border-color: #3b82f6; outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }
.settings-color-row { display: flex; gap: 8px; align-items: center; }
.settings-color-row input[type=color] { width: 40px; height: 34px; border: 1px solid #d1d5db; border-radius: 6px; cursor: pointer; padding: 2px; }
.settings-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.settings-toggle input[type=checkbox] { width: 16px; height: 16px; accent-color: #3b82f6; }
.settings-save-bar { display: flex; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid #f1f5f9; }
.perm-cell { text-align: center; font-weight: 600; color: #94a3b8; }
.perm-cell.perm-on { color: #22c55e; }
.settings-perm-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    font-size: 13px; padding: 8px 0;
}
.settings-perm-grid label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.settings-perm-grid input[type=checkbox] { width: 16px; height: 16px; accent-color: #3b82f6; }
.diag-badge.warning { background: #fef3c7; color: #92400e; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
    .bo-sidebar {
        position: fixed; left: -220px; top: 0; z-index: 1000;
        height: 100vh; width: 220px;
        transition: left 0.3s ease;
    }
    .bo-app:not(.sidebar-collapsed) .bo-sidebar { left: 0; }
    .sidebar-collapsed .bo-sidebar { left: -220px; }
    .bo-main { margin-left: 0; }
    .bo-content { padding: 12px; }
    .bo-table { font-size: 13px; }
    .bo-table th, .bo-table td { padding: 6px 8px; }
    /* Overlay when sidebar open */
    .bo-app:not(.sidebar-collapsed)::after {
        content: ''; position: fixed; inset: 0; background: rgba(0,0,0,0.3);
        z-index: 999;
    }
}
