/* ============================================
   PNEUOMA Incident Capture & Containment
   Mobile-first admin tool styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-deep: #07080d;
    --bg-mid: #0d1117;
    --bg-surface: #151b23;
    --bg-elevated: #1c2430;
    --bg-card: #1a1f2e;
    --accent: #f59e0b;
    --accent-dim: rgba(245, 158, 11, 0.15);
    --accent-green: #10b981;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --text-primary: #e8eaed;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border: rgba(255,255,255,0.08);
    --border-light: rgba(255,255,255,0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-full: 9999px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 200ms ease;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100dvh;
}

a { color: inherit; text-decoration: none; }

/* ==================== TOP NAV ==================== */

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(7,8,13,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
}

.top-nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.top-nav-logo .logo-icon {
    font-size: 11px;
    opacity: 0.5;
}

.top-nav-badge {
    margin-left: auto;
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ==================== BOTTOM NAV ==================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(7,8,13,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding: 6px 8px;
    padding-bottom: max(6px, var(--safe-bottom));
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 12px;
    gap: 2px;
    border-radius: 12px;
    transition: var(--transition);
    color: var(--text-muted);
}

.nav-item.active { color: var(--text-primary); }
.nav-item:hover { color: var(--text-secondary); }

.nav-item svg { width: 22px; height: 22px; }
.nav-item span { font-size: 10px; font-weight: 600; letter-spacing: 0.3px; }

.nav-item.primary {
    margin-top: -20px;
}

.nav-item.primary .nav-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(245,158,11,0.3);
    transition: var(--transition);
}

.nav-item.primary .nav-icon-wrap svg { width: 24px; height: 24px; color: #000; }
.nav-item.primary.active .nav-icon-wrap { background: var(--accent); box-shadow: 0 4px 24px rgba(245,158,11,0.5); }
.nav-item.primary span { color: var(--accent); margin-top: 4px; }

/* ==================== PAGE LAYOUT ==================== */

.page { padding: 72px 16px 100px; max-width: 500px; margin: 0 auto; }

/* ==================== HEADER ==================== */

.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.page-header p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ==================== CTA CARD ==================== */

.cta-card {
    background: linear-gradient(135deg, var(--bg-elevated), var(--bg-surface));
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.cta-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.cta-card:active { transform: scale(0.99); }

.cta-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(245,158,11,0.25);
}

.cta-icon svg { width: 24px; height: 24px; color: #000; }
.cta-text h2 { font-size: 15px; font-weight: 700; }
.cta-text p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.cta-arrow { margin-left: auto; color: var(--text-muted); }
.cta-arrow svg { width: 18px; height: 18px; }

/* ==================== STATS GRID ==================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 20px 0;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 8px;
    text-align: center;
}

.stat-value { font-size: 22px; font-weight: 800; line-height: 1; }
.stat-value.blue { color: var(--accent-blue); }
.stat-value.purple { color: var(--accent-purple); }
.stat-value.red { color: var(--accent-red); }
.stat-label { font-size: 9px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* ==================== SECTION HEADER ==================== */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-header h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.section-header a { font-size: 12px; color: var(--accent); font-weight: 600; }

/* ==================== INCIDENT CARDS ==================== */

.incident-list { display: flex; flex-direction: column; gap: 10px; }

.incident-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    transition: var(--transition);
}

.incident-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.incident-card:active { transform: scale(0.99); }

.incident-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.incident-card-title { font-size: 14px; font-weight: 700; }
.incident-card-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.incident-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 10px;
}

.incident-card-footer { display: flex; align-items: center; justify-content: space-between; }

.incident-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.tag {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    letter-spacing: 0.3px;
}

.tag-student { background: rgba(255,255,255,0.06); color: var(--text-secondary); }

/* ==================== BADGES ==================== */

.badges { display: flex; gap: 6px; flex-shrink: 0; }

.badge {
    font-size: 9px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-low { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-medium { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-high { background: rgba(249,115,22,0.15); color: #fb923c; }
.badge-critical { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-open { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-in-progress { background: rgba(139,92,246,0.15); color: #a78bfa; }
.badge-resolved { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-closed { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* ==================== VOICE RECORDER ==================== */

.recorder-section { display: flex; flex-direction: column; align-items: center; padding: 40px 0 24px; }

.record-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 8px 32px rgba(245,158,11,0.3);
    position: relative;
}

.record-btn svg { width: 44px; height: 44px; color: #000; }
.record-btn:hover { transform: scale(1.05); box-shadow: 0 8px 40px rgba(245,158,11,0.4); }
.record-btn:active { transform: scale(0.97); }
.record-btn:disabled { background: var(--bg-elevated); box-shadow: none; cursor: not-allowed; }
.record-btn:disabled svg { color: var(--text-muted); }

.record-btn.recording {
    background: var(--accent-red);
    box-shadow: 0 0 0 0 rgba(239,68,68,0.4);
    animation: pulse-rec 1.5s ease-in-out infinite;
}

@keyframes pulse-rec {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
    50% { box-shadow: 0 0 0 20px rgba(239,68,68,0); }
}

.record-btn.recording svg { color: #fff; }

.record-timer {
    font-size: 28px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--accent-red);
    margin-top: 16px;
}

.record-hint { font-size: 13px; color: var(--text-muted); margin-top: 8px; }

/* ==================== PROCESSING STATE ==================== */

.processing-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 0;
}

.spinner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}

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

.processing-label { font-size: 14px; font-weight: 600; margin-top: 20px; }
.processing-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ==================== FORM ==================== */

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

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-textarea { resize: none; min-height: 80px; }
.form-select { appearance: none; cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Severity Selector */
.severity-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

.severity-btn {
    padding: 10px 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.severity-btn.active-low { background: rgba(16,185,129,0.15); color: #34d399; border-color: rgba(16,185,129,0.3); }
.severity-btn.active-medium { background: rgba(245,158,11,0.15); color: #fbbf24; border-color: rgba(245,158,11,0.3); }
.severity-btn.active-high { background: rgba(249,115,22,0.15); color: #fb923c; border-color: rgba(249,115,22,0.3); }
.severity-btn.active-critical { background: rgba(239,68,68,0.15); color: #f87171; border-color: rgba(239,68,68,0.3); }

/* Tag Input */
.tag-input-wrap { display: flex; gap: 8px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 4px 6px 4px 10px;
    border-radius: var(--radius-full);
}

.tag-remove {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.08);
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.tag-remove:hover { background: rgba(239,68,68,0.2); color: var(--accent-red); }

.tag-add-btn {
    padding: 10px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.tag-add-btn:hover { border-color: var(--accent); color: var(--text-primary); }

/* Transcript Banner */
.transcript-banner {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 20px;
}

.transcript-banner .label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.transcript-banner .text { font-size: 13px; color: var(--text-secondary); font-style: italic; line-height: 1.5; }

/* ==================== BUTTONS ==================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { filter: brightness(1.1); }

.btn-dark { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); }
.btn-dark:hover { border-color: var(--border-light); }

.btn-danger { background: rgba(239,68,68,0.12); color: var(--accent-red); border: 1px solid rgba(239,68,68,0.2); }

.btn-amber { background: var(--accent); color: #000; }

.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn-sm { padding: 10px 16px; font-size: 13px; }

/* ==================== DETAIL VIEW ==================== */

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.detail-field { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.detail-field:last-child { border-bottom: none; }
.detail-field .label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.detail-field .value { font-size: 14px; color: var(--text-primary); line-height: 1.5; }

.comms-status { display: flex; flex-direction: column; gap: 8px; }

.comm-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.comm-dot { width: 8px; height: 8px; border-radius: 50%; }
.comm-dot.done { background: var(--accent-green); }
.comm-dot.pending { background: var(--text-muted); }

/* ==================== TEMPLATE MODAL ==================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal {
    background: var(--bg-mid);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 { font-size: 16px; font-weight: 700; }

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--border); }

.modal-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.modal-tab.active { color: var(--accent); }
.modal-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

.modal-content { flex: 1; overflow-y: auto; padding: 16px; }
.modal-content pre {
    font-family: var(--font);
    font-size: 13px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    line-height: 1.6;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    padding: 14px;
}

.modal-actions { padding: 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; }

/* ==================== FILTER BAR ==================== */

.filter-bar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.filter-row { display: flex; gap: 8px; }

/* ==================== REPORT BUILDER ==================== */

.report-incident {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.report-incident.selected { background: var(--accent-dim); border-color: rgba(245,158,11,0.3); }

.report-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    transition: var(--transition);
}

.report-incident.selected .report-checkbox {
    background: var(--accent);
    border-color: var(--accent);
}

.report-info { flex: 1; min-width: 0; }
.report-info .title { font-size: 13px; font-weight: 700; }
.report-info .meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.report-info .desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ==================== DIVIDER ==================== */

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
}

.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { font-size: 12px; color: var(--text-muted); font-weight: 600; }

/* ==================== EMPTY STATE ==================== */

.empty-state { text-align: center; padding: 48px 16px; }
.empty-icon { width: 56px; height: 56px; background: var(--bg-elevated); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.empty-icon svg { width: 24px; height: 24px; color: var(--text-muted); }
.empty-state h3 { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.empty-state p { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ==================== ALERT ==================== */

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-error { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.alert-info { background: rgba(59,130,246,0.1); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }

/* ==================== TIPS ==================== */

.tips-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-top: 24px;
}

.tips-box .tips-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.tips-box li { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; list-style: none; padding-left: 12px; position: relative; }
.tips-box li::before { content: '•'; position: absolute; left: 0; color: var(--accent); }

/* ==================== LOADING ==================== */

.loading { display: flex; align-items: center; justify-content: center; padding: 48px; }

/* ==================== BACK BUTTON ==================== */

.back-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    margin-right: 12px;
    flex-shrink: 0;
    transition: var(--transition);
}

.back-btn:hover { border-color: var(--border-light); color: var(--text-primary); }
.back-btn svg { width: 16px; height: 16px; }

.header-with-back { display: flex; align-items: center; margin-bottom: 24px; }

/* ==================== UTILITY ==================== */

/* ==================== STUDENT IDENTITY TAGS ==================== */

.student-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 5px 6px 5px 8px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.student-tag:hover { background: rgba(255,255,255,0.1); }
.student-tag.editing { border-color: var(--accent); background: var(--accent-dim); }

.student-tag .s-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    flex-shrink: 0;
    font-weight: 700;
}

.student-tag .s-icon.alias { background: rgba(59,130,246,0.2); color: #60a5fa; }
.student-tag .s-icon.real { background: rgba(245,158,11,0.2); color: #fbbf24; }
.student-tag .s-icon.initials { background: rgba(139,92,246,0.2); color: #a78bfa; }
.student-tag .s-icon.custom { background: rgba(16,185,129,0.2); color: #34d399; }

.student-editor {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.student-editor .editor-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.student-editor .editor-label strong {
    color: var(--text-secondary);
}

.editor-modes {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
}

.mode-btn:hover { border-color: var(--border-light); color: var(--text-secondary); }
.mode-btn.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(245,158,11,0.3); }

.anonymize-notice {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.anonymize-notice svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ==================== AI REFINE CHAT ==================== */

.ai-chat-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-mid);
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
    z-index: 150;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.ai-chat-panel.open { transform: translateY(0); }

.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 180px;
}

.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.chat-msg.assistant {
    background: var(--bg-elevated);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-msg.user {
    background: var(--accent);
    color: #000;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-msg.system {
    background: rgba(59,130,246,0.1);
    color: var(--accent-blue);
    font-size: 11px;
    text-align: center;
    align-self: center;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
}

.ai-chat-input {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    padding-bottom: max(12px, var(--safe-bottom));
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.ai-chat-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 149;
}

.btn-refine {
    background: linear-gradient(135deg, var(--bg-elevated), var(--bg-surface));
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-refine:hover { border-color: var(--accent); }
.btn-refine svg { color: var(--accent); flex-shrink: 0; }

/* ==================== UTILITY ==================== */

.hidden { display: none !important; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.gap-10 { gap: 10px; }
.text-center { text-align: center; }
