/* PsychScribe AI - Premium clinical documentation */

:root {
    --bg-primary: #F8FAF7;
    --bg-secondary: #FFFFFF;
    --surface: #FFFFFF;
    --card: #FFFFFF;
    --border: #E6ECEB;
    --accent: #A5D6D0;
    --accent-secondary: #B2E0D8;
    --accent-light: #E7F5F3;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --text: #0F172A;
    --text-muted: #6B7280;
    --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
    --glass: rgba(255, 255, 255, 0.7);
    --radius: 12px;
    --sidebar-width: 260px;
    --topbar-height: 56px;
    --bottomnav-height: 60px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ease: 0.25s ease;
    --theme-transition: 0.4s ease;
}

html[data-theme="light-a"] {
    --bg-primary: #F8FAF7;
    --bg-secondary: #FFFFFF;
    --surface: #FFFFFF;
    --card: #FFFFFF;
    --border: #E6ECEB;
    --accent: #A5D6D0;
    --accent-secondary: #B2E0D8;
    --accent-light: #E7F5F3;
    --text: #0F172A;
    --text-muted: #6B7280;
    --glass: rgba(255, 255, 255, 0.7);
}

html[data-theme="light-b"] {
    --bg-primary: #FAF8F4;
    --bg-secondary: #FFFFFF;
    --surface: #FFFFFF;
    --card: #FFFFFF;
    --border: #ECE7E1;
    --accent: #A5D6D0;
    --accent-secondary: #B2E0D8;
    --accent-light: #E9F6F2;
    --text: #1F2937;
    --text-muted: #6B7280;
    --glass: rgba(255, 255, 255, 0.75);
}

html[data-theme="dark"] {
    --bg-primary: #0A1428;
    --bg-secondary: #0F1B34;
    --surface: #0F1B34;
    --card: #0F1B34;
    --border: #1B2B4A;
    --accent: #67E8D8;
    --accent-secondary: #A5F3E0;
    --accent-light: rgba(103, 232, 216, 0.12);
    --text: #E2E8F0;
    --text-muted: #94A3B8;
    --glass: rgba(15, 27, 52, 0.7);
    --shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg-primary); color: var(--text); line-height: 1.5; height: 100vh; overflow: hidden; transition: background-color var(--theme-transition), color var(--theme-transition); }

.sidebar,
.topbar,
.bottom-nav,
.screen,
.card,
.btn,
.form-input,
.chip,
#modal-container .modal-card,
#modal-container .modal-overlay,
.toast {
    transition: background-color var(--theme-transition), color var(--theme-transition), border-color var(--theme-transition), box-shadow var(--theme-transition);
}

.app { display: flex; height: 100vh; min-width: 0; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--ease), opacity var(--ease);
}
.sidebar-brand { padding: 24px 16px 16px; }
.sidebar-logo-text { display: block; font-weight: 700; font-size: 18px; color: var(--text); }
.sidebar-logo-sub { font-size: 12px; color: var(--text-muted); }
.sidebar-divider { height: 1px; background: var(--border); margin: 0 16px; }
.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 12px 16px 6px; }
.sidebar-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px; margin: 0 8px; border: none; background: transparent; color: var(--text);
    font-size: 14px; text-align: left; border-radius: 8px; cursor: pointer; transition: background var(--ease);
    position: relative;
}
.sidebar-item i { width: 18px; text-align: center; color: var(--text-muted); }
.sidebar-item:hover { background: var(--accent-light); }
.sidebar-item.active { background: var(--accent-light); color: var(--accent); font-weight: 500; }
.sidebar-item.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; background: var(--accent); border-radius: 0 2px 2px 0; }
.sidebar-item.active i { color: var(--accent); }
.sidebar-item .badge { margin-left: auto; background: var(--accent); color: white; font-size: 11px; padding: 2px 6px; border-radius: 10px; }
.sidebar-spacer { flex: 1; min-height: 24px; }

/* Main wrapper - CRITICAL */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    position: relative;
    min-height: 0;
}

.screen {
    position: absolute;
    top: var(--topbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    visibility: hidden;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
    background: var(--bg-primary);
}
.screen.active {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0s;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 16px;
    flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 8px; }
.topbar-btn { width: 40px; height: 40px; border: none; background: transparent; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text); transition: background var(--ease); }
.topbar-btn:hover { background: #f3f4f6; }
.topbar-btn.hidden { display: none !important; }
.back-btn { display: none; }
.back-btn:not(.hidden) { display: flex !important; }
.topbar-title { font-size: 18px; font-weight: 600; flex: 1; min-width: 0; }
.topbar-center { flex: 0 1 400px; max-width: 400px; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 12px; color: var(--text-muted); font-size: 14px; pointer-events: none; }
.search-input { width: 100%; height: 40px; padding: 0 80px 0 40px; border: none; background: #f3f4f6; border-radius: 9999px; font-size: 14px; outline: none; }
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { background: #e5e7eb; }
.search-kbd { position: absolute; right: 10px; font-size: 11px; color: var(--text-muted); background: var(--bg-secondary); padding: 2px 6px; border-radius: 4px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn { position: relative; }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid var(--bg-secondary); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: white; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }

/* Hamburger - show on mobile only by default hide */
.hamburger { display: none; }

/* Screen inner */
.screen-inner { padding: 24px; max-width: 1200px; margin: 0 auto; }

/* Cards */
.card { background: var(--bg-secondary); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; transition: box-shadow var(--ease), transform var(--ease); }
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.section-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.section-gap { margin-bottom: 24px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 500; border: none; cursor: pointer; transition: transform 0.2s ease, background var(--ease); }
.btn:hover { transform: scale(1.02); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-secondary)); color: white; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-secondary { background: var(--bg-secondary); color: var(--accent); border: 1px solid var(--accent); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: #f3f4f6; }

/* Form */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: var(--bg-secondary); }
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }
textarea.form-input { min-height: 120px; resize: vertical; }

/* Bottom nav - hidden on desktop */
.bottom-nav {
    display: none;
    height: var(--bottomnav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    padding: 8px 0;
    align-items: center;
    justify-content: space-around;
}
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 16px; border: none; background: transparent; color: var(--text-muted); font-size: 10px; cursor: pointer; border-radius: 8px; transition: color var(--ease); }
.bottom-nav-item i { font-size: 20px; }
.bottom-nav-item:hover { color: var(--text); }
.bottom-nav-item.active { color: var(--accent); font-weight: 500; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--bg-secondary); border-radius: var(--radius); box-shadow: 0 4px 20px rgba(0,0,0,0.15); max-width: 360px; pointer-events: auto; animation: toastIn 0.3s ease; border-left: 4px solid var(--accent); }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Modal */
#modal-container { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
#modal-container .modal-overlay { pointer-events: auto; position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fadeIn 0.2s ease; }
#modal-container .modal-card { background: var(--bg-secondary); border-radius: 16px; max-width: 500px; width: 100%; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.2); animation: modalIn 0.25s ease; }
#modal-container .modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
#modal-container .modal-title { font-size: 18px; font-weight: 600; }
#modal-container .modal-close { width: 36px; height: 36px; border: none; background: transparent; border-radius: 8px; cursor: pointer; font-size: 20px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; }
#modal-container .modal-close:hover { background: var(--accent-light); color: var(--text); }

#waveform-canvas { background: var(--bg-primary) !important; }
#modal-container .modal-body { padding: 24px; overflow-y: auto; flex: 1; }
#modal-container .modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* Wellness monitoring */
.wellness-section { margin-top: 16px; }
.wellness-toggle { cursor: pointer; font-weight: 600; }
.alert-banner { padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.alert-banner .alert-text { font-size: 13px; font-weight: 600; }
.alert-banner.emergency { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.4); animation: pulseRed 1.6s ease-in-out infinite; }
.alert-banner.urgent { background: rgba(249, 115, 22, 0.12); border: 1px solid rgba(249, 115, 22, 0.4); }
.alert-banner.high { background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.4); }
.alert-banner.medium { background: rgba(59, 130, 246, 0.12); border: 1px solid rgba(59, 130, 246, 0.4); }
.alert-banner.positive { background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.4); }
.alert-list { margin-top: 8px; display: grid; gap: 8px; }
.alert-item { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.score-ring { width: 120px; height: 120px; margin: 8px auto; position: relative; }
.score-ring svg { transform: rotate(-90deg); }
.score-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; font-weight: 700; }
.score-center .score { font-size: 28px; }
.score-center .grade { font-size: 12px; color: var(--text-muted); }
.dimension-row { display: flex; align-items: center; gap: 10px; font-size: 12px; margin: 6px 0; }
.dimension-bar { flex: 1; height: 8px; background: var(--accent-light); border-radius: 999px; overflow: hidden; }
.dimension-bar span { display: block; height: 100%; width: 0; transition: width 0.8s ease; }
.trend-actions { display: flex; gap: 8px; margin-bottom: 8px; }
.trend-actions .btn { padding: 6px 10px; font-size: 12px; }
.clinical-summary { font-size: 12.5px; line-height: 1.6; background: var(--accent-light); padding: 10px; border-radius: 10px; }
.compliance-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; background: var(--accent-light); font-size: 12px; font-weight: 600; }
.patient-alert-badge { background: #EF4444; color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 999px; margin-left: 8px; animation: pulseRed 1.6s ease-in-out infinite; }
.alert-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(6px); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 24px; }
.alert-modal-card { background: var(--bg-secondary); border-radius: 16px; padding: 20px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.alert-card { border-radius: 12px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--border); }
.alert-card.emergency { border-color: #EF4444; box-shadow: 0 0 20px rgba(239,68,68,0.35); animation: pulseRed 1.6s ease-in-out infinite; }
@keyframes pulseRed { 0%,100% { box-shadow: 0 0 0 rgba(239,68,68,0.0); } 50% { box-shadow: 0 0 18px rgba(239,68,68,0.35); } }

.wellness-mini { margin-left: auto; }
.wellness-mini .score-ring { text-align: center; }
.wellness-mini .ring-text { font-size: 8px; font-weight: 700; fill: var(--text); }
.wellness-mini p { margin: 4px 0 0; font-size: 10px; color: var(--text-muted); }

/* Consult steps */
.consult-steps { display: flex; align-items: center; gap: 0; margin-bottom: 24px; flex-wrap: wrap; }
.consult-step { display: flex; align-items: center; gap: 8px; }
.consult-step-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--text-muted); transition: all var(--ease); }
.consult-step.active .consult-step-dot { background: var(--accent); border-color: var(--accent); color: white; }
.consult-step.done .consult-step-dot { background: var(--success); border-color: var(--success); color: white; font-size: 0; }
.consult-step.done .consult-step-dot::after { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 12px; color: white; }
.consult-step-line { width: 24px; height: 2px; background: var(--border); }
.step-panel { display: none; }
.step-panel.active { display: block; }

/* Chips */
.chip { display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 9999px; font-size: 13px; font-weight: 500; border: 1px solid var(--border); background: var(--bg-secondary); cursor: pointer; transition: all var(--ease); }
.chip:hover { background: #f3f4f6; }
.chip.active { background: var(--accent); border-color: var(--accent); color: white; }

/* Follow-up sections */
.fu-section { margin-bottom: 24px; }
.fu-section-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.fu-section.overdue .fu-section-title { color: var(--danger); }
.fu-section.today .fu-section-title { color: var(--accent); }
.fu-section.upcoming .fu-section-title { color: var(--success); }
.fu-card { background: var(--bg-secondary); border-radius: var(--radius); padding: 16px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: pointer; transition: box-shadow var(--ease); border-left: 4px solid var(--border); }
.fu-card.overdue { border-left-color: var(--danger); }
.fu-card.today { border-left-color: var(--accent); }
.fu-card.upcoming { border-left-color: var(--success); }
.fu-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.fu-card-actions { display: flex; gap: 8px; margin-top: 12px; }
.fu-card-actions .btn { padding: 6px 12px; font-size: 13px; }

/* Patient initial circle */
.patient-initial { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; color: white; flex-shrink: 0; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; }
tr:hover td { background: #f9fafb; }

/* Scale */
.scale-card { background: var(--bg-secondary); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); transition: box-shadow var(--ease); }
.scale-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.scale-question { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.scale-question:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-group label { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 12px; border-radius: 8px; }
.radio-group label:hover { background: #f9fafb; }
.radio-group input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Drug card */
.drug-card { background: var(--bg-secondary); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.drug-card-header { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.drug-card-details { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); display: none; }
.drug-card.expanded .drug-card-details { display: block; }
.drug-class-badge { font-size: 11px; padding: 4px 8px; border-radius: 6px; background: var(--accent-light); color: var(--accent); }

/* Stats */
.stat-card { background: var(--bg-secondary); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Theme toggle */
.theme-toggle { position: relative; }
.theme-toggle:hover::after {
    content: "Switch Theme";
    position: absolute;
    top: 42px;
    right: 0;
    background: var(--bg-secondary);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: var(--shadow);
}

/* Flashcards premium */
.flashcard-card,
.flashcard-premium-card {
    background: linear-gradient(135deg, rgba(165, 214, 208, 0.35), rgba(178, 224, 216, 0.35));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
    animation: flashcardIn 0.6s ease, flashcardPulse 6s ease-in-out infinite;
    backdrop-filter: blur(6px);
}
.flashcard-card h5 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.flashcard-card .flashcard-tip { font-size: 12px; color: var(--text-muted); margin-top: 10px; }
.flashcard-send-btn {
    background: linear-gradient(135deg, #6EE7E5, #B2E0D8);
    color: #0F172A;
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 600;
    box-shadow: 0 8px 18px rgba(16, 24, 40, 0.12);
}
.flashcard-premium-card {
    background: linear-gradient(135deg, rgba(165, 214, 208, 0.35), rgba(178, 224, 216, 0.35));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
    animation: flashcardIn 0.6s ease, flashcardPulse 6s ease-in-out infinite;
    backdrop-filter: blur(6px);
}
.flashcard-premium-body {
    display: grid;
    gap: 12px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    font-size: 13px;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 12px;
    animation: flashcardIn 0.6s ease, flashcardPulse 6s ease-in-out infinite;
}
.flashcard-lesson {
    background: linear-gradient(135deg, rgba(165, 214, 208, 0.28), rgba(178, 224, 216, 0.25));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.08);
}
.flashcard-lesson-title {
    font-weight: 700;
    font-size: 13.5px;
    margin-bottom: 6px;
}
.flashcard-lesson-lines { font-size: 12.5px; }
.flashcard-lesson-tip { margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.flashcard-modal .modal-card {
    background: var(--glass);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 60px rgba(16, 24, 40, 0.18);
    animation: flashcardIn 0.6s ease, flashcardPulse 6s ease-in-out infinite;
}
.flashcard-modal .modal-body { padding: 24px; }

.flashcard-modal .modal-card {
    background: var(--glass);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 60px rgba(16, 24, 40, 0.18);
    animation: flashcardIn 0.6s ease;
}
.flashcard-modal .modal-body { padding: 24px; }

.post-transcription {
    margin: 16px 0;
    animation: flashcardIn 0.5s ease;
}
.summary-scroll {
    display: grid;
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    gap: 12px;
    overflow-x: auto;
}
.summary-skeleton {
    height: 140px;
    border-radius: 14px;
    background: linear-gradient(90deg, rgba(255,255,255,0.3), rgba(165,214,208,0.2), rgba(255,255,255,0.3));
    background-size: 300px 100%;
    animation: shimmer 1.8s infinite;
}

@keyframes flashcardIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes flashcardPulse { 0%, 100% { box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08); } 50% { box-shadow: 0 16px 36px rgba(16, 24, 40, 0.14); } }
@keyframes shimmer { 0% { background-position: 0 0; } 100% { background-position: 300px 0; } }

/* Wellness monitoring */
.wellness-section { margin-top: 20px; }
.wellness-section summary { cursor: pointer; font-weight: 600; color: var(--text); }
.alert-banner { padding: 10px 12px; border-radius: 12px; color: white; font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.alert-banner.emergency { background: #EF4444; animation: pulseAlert 1.2s ease-in-out infinite; }
.alert-banner.urgent { background: #F97316; }
.alert-banner.high { background: #F59E0B; }
.alert-banner.medium { background: #3B82F6; }
.alert-banner.positive { background: #10B981; }
.alert-list { margin-top: 8px; display: none; }
.alert-item { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-size: 12px; display: flex; justify-content: space-between; gap: 8px; }
.alert-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge-alert { background: #EF4444; color: white; border-radius: 999px; font-size: 11px; padding: 2px 6px; margin-left: 6px; animation: pulseBadge 1.4s ease-in-out infinite; }

.score-ring { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ring-wrap { width: 120px; height: 120px; position: relative; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; font-weight: 700; }
.ring-score { font-size: 28px; }
.ring-grade { font-size: 12px; color: var(--text-muted); }
.ring-empty { animation: pulseBadge 1.5s ease-in-out infinite; color: var(--text-muted); }

.dimension-bar { display: flex; align-items: center; gap: 8px; font-size: 12px; margin: 6px 0; }
.dimension-bar .bar { flex: 1; height: 8px; background: var(--accent-light); border-radius: 999px; overflow: hidden; }
.dimension-bar .fill { height: 100%; width: 0; transition: width 0.8s ease; }
.dimension-bar .pct { width: 38px; text-align: right; color: var(--text-muted); }

.wellness-graph { margin-top: 12px; }
.trend-toggle { display: flex; gap: 6px; margin-bottom: 8px; }
.trend-toggle .chip { padding: 6px 10px; }

.clinical-summary { margin-top: 12px; font-size: 12px; line-height: 1.6; }
.clinical-summary .trend { font-weight: 600; }
.clinical-summary .strengths { color: #10B981; }
.clinical-summary .concerns { color: #F59E0B; }
.clinical-summary .suggestion { color: #3B82F6; }

.compliance-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-light); border-radius: 999px; padding: 6px 10px; font-size: 12px; margin-top: 10px; }

.alert-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(6px); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 24px; }
.alert-modal { max-width: 520px; width: 100%; background: var(--bg-secondary); border-radius: 18px; padding: 20px; box-shadow: 0 30px 80px rgba(0,0,0,0.3); }
.alert-card { border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.alert-card.emergency { border-color: #EF4444; box-shadow: 0 0 12px rgba(239,68,68,0.5); animation: pulseAlert 1.2s ease-in-out infinite; }

@keyframes pulseAlert { 0%,100% { transform: scale(1); } 50% { transform: scale(1.02); } }
@keyframes pulseBadge { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .hamburger { display: flex !important; }
    .topbar-center { display: none; }
    .main-wrapper { padding-bottom: var(--bottomnav-height); }
    .bottom-nav { display: flex; }
    .screen { bottom: var(--bottomnav-height); }
}
@media (min-width: 769px) {
    .back-btn:not(.hidden) { display: flex !important; }
}

/* Print - use visibility for .screen, not display */
@media print {
    .sidebar, .topbar, .bottom-nav, .btn, .toast-container, #modal-container .modal-overlay { display: none !important; }
    .main-wrapper { position: static !important; }
    .screen { position: static !important; transform: none !important; pointer-events: auto !important; }
    .screen.active { visibility: visible !important; opacity: 1 !important; }
    .screen:not(.active) { visibility: hidden !important; opacity: 0 !important; height: 0 !important; overflow: hidden !important; }
}

.hidden { display: none !important; }
