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

/* =========================================
   00. UTILITY CLASSES (Replaces inline HTML styles)
   ========================================= */
.hidden { display: none !important; }
.flex-center-gap { display: flex; align-items: center; gap: 8px; }
.justify-center { justify-content: center !important; }
.w-full-btn { 
    width: calc(100% - 48px) !important; 
    height: 60px !important; 
    justify-content: center !important; 
    border-radius: 30px !important; 
    margin: 0 24px 24px 24px !important; 
    padding: 0 !important; 
}
.w-full-btn-rounded { 
    height: 60px !important; 
    justify-content: center !important; 
    border-radius: 30px !important; 
    padding: 0 !important; 
}
.w-full-padded { 
    width: 100% !important; 
    border-radius: 20px !important; 
    padding: 12px !important; 
    height: auto !important; 
}
.mb-24 { margin-bottom: 24px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-10 { margin-top: 10px !important; }
.text-large { font-size: 22px !important; }
.font-bold { font-weight: 600 !important; }
.italic-gray { font-style: italic; color: #666; }
.text-green-large { color: #386641; font-size: 24px; }

/* =========================================
   01. RESETS & GLOBALS
   ========================================= */
* {
    font-family: 'Quicksand', sans-serif;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 48;
}

::selection {
    background-color: #386641; 
    color: white;
}

button {
    transition: transform 0.1s ease, background-color 0.2s ease;
}

button:active {
    transform: scale(0.99); 
}

/* =========================================
   02. BASE LAYOUT & BACKGROUND
   ========================================= */
body {
    background-color: #F8F3E6;
    background-image:
        linear-gradient(to right, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0,0,0,0.04) 1px, transparent 1px);
    background-size: 20px 20px;
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    overflow-y: scroll; 
    scrollbar-gutter: stable; 
}

.mobile-container {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    margin: 0 24px 24px 24px; 
}

/* =========================================
   03. PAGE TRANSITION ANIMATIONS
   ========================================= */
body {
    animation: fadeIn 0.4s ease-out forwards;
    opacity: 0; 
}

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

.fade-out {
    animation: fadeOut 0.3s ease-in forwards !important;
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-10px); } 
}

/* =========================================
   04. GLOBAL HEADER
   ========================================= */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background-color: transparent; 
    width: 100%;
    z-index: 100; 
    padding-top: 55px;
    padding-bottom: 25px;
    padding-left: 24px;
    padding-right: 24px;
    margin-bottom: 35px;
}

.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw; 
    height: 100%;
    background-color: transparent;
    z-index: -1; 
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.app-header.scrolled::before {
    background-color: #F8F3E6; 
    box-shadow: rgba(0, 0, 0, 0.08) 0px 1px 4px;
}

.app-header h1 {
    font-size: 28px;
    font-weight: 500;
    color: #333;
}

.spacer {
    width: 32px; 
}

.settings-btn, .back-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
}

.settings-btn .material-symbols-rounded { font-size: 44px; }
.back-btn .material-symbols-rounded { font-size: 36px; }
.icon-lock { color: #386641; font-size: 32px; }

/* =========================================
   05. HOME PAGE
   ========================================= */
.greeting-section { margin-bottom: 50px; }
.greeting-section h2 { font-size: 30px; font-weight: 600; color: #333; margin-bottom: 10px; }
.greeting-section p { font-size: 24px; color: #444; }

.btn-primary {
    width: 100%; height: 170px; background-color: #386641; color: white; border: none;
    border-radius: 20px; padding: 20px; display: flex; justify-content: space-between;
    align-items: center; cursor: pointer; margin-bottom: 20px; text-align: left;
    transition: background-color 0.2s ease;
}

.btn-primary:hover { background-color: #223d27; }
.btn-primary h3 { font-size: 28px; font-weight: 600; margin-bottom: 4px; }
.btn-primary p { font-size: 20px; color: #d7e0d9; }
.btn-primary .material-symbols-rounded { padding-right: 10px; font-size: 60px; }

.secondary-actions { display: flex; gap: 16px; width: 100%; }
.btn-secondary {
    flex: 1; min-width: 0; word-wrap: break-word; overflow: hidden;
    background-color: #FCFAF5; min-height: 170px; border-radius: 20px;
    padding: 20px; display: flex; flex-direction: column; align-items: flex-start;
    cursor: pointer; text-align: left; transition: background-color 0.2s ease;
}

.btn-secondary h3 { font-size: 24px; font-weight: 600; line-height: 1.2; width: 100%; hyphens: auto; }
.btn-secondary .material-symbols-rounded { font-size: 60px; margin-bottom: 24px; }
.btn-past { border: 2.5px solid #333; color: #333; }
.btn-past:hover { background-color: #F5E9CC; }
.btn-emergency { border: 2.5px solid #BC4749; color: #BC4749; }
.btn-emergency:hover { background-color: #F5E9CC; }

/* =========================================
   06. EMERGENCY PROTOCOLS PAGE
   ========================================= */
.warning-banner { background-color: #F3E0E2; padding: 24px; border-radius: 16px; margin-bottom: 24px; border: 1px solid rgba(188, 71, 73, 0.35); }
.warning-banner p { font-size: 20px; color: #333; line-height: 1.4; font-weight: 500; }
.btn-danger { width: 100%; background-color: #BC4749; color: white; border: none; border-radius: 20px; padding: 24px; display: flex; align-items: center; gap: 20px; cursor: pointer; margin-bottom: 24px; text-align: left; }
.btn-danger-text h3 { font-size: 24px; font-weight: 600; margin-bottom: 6px; }
.btn-danger-text p { font-weight: 500; font-size: 16px; color: #F0D5D6; }
.btn-danger .material-symbols-rounded { font-size: 40px; }
.support-card { background-color: #FCFAF5; border-radius: 20px; padding: 24px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 12px; }
.support-card h3 { font-size: 20px; font-weight: 600; color: #333; }
.support-card p { font-size: 20px; color: #555; line-height: 1.4; margin-bottom: 12px; }
.btn-card-action { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; background-color: #555; color: #fff; border: none; border-radius: 16px; padding: 18px; font-size: 22px; font-weight: 600; cursor: pointer; transition: background-color 0.2s ease; }
.btn-card-action:hover { background-color: #386641; }

/* =========================================
   07. SETTINGS PAGE
   ========================================= */
.settings-group { margin-bottom: 30px; }
.settings-title { font-size: 22px; font-weight: 600; color: #333; margin-bottom: 12px; }
.settings-card { background-color: #FCFAF5; border-radius: 20px; padding: 0 20px; display: flex; flex-direction: column; border: 1px solid transparent; }
.settings-row { display: flex; justify-content: space-between; align-items: center; padding: 20px 0; font-size: 20px; color: #333; }
.settings-divider { height: 1px; background-color: #F8F3E6; width: 100%; }
.size-selector { display: flex; gap: 8px; align-items: center; font-size: 20px; color: #333; }
.size-selector button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; width: 44px; height: 44px; display: flex; justify-content: center; align-items: center; border-radius: 50%; }
.size-selector button.active { background-color: #4A8446; color: white; }
.voice-selector { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.voice-selector .material-symbols-rounded { font-size: 28px; }
.btn-icon-green { background-color: #444; color: white; border: none; border-radius: 20px; width: 60px; height: 36px; display: flex; justify-content: center; align-items: center; cursor: pointer; }
.btn-delete { width: 100%; background-color: #BC4749; color: white; border: none; border-radius: 50px; padding: 20px; font-size: 22px; font-weight: 500; cursor: pointer; margin-top: 10px; margin-bottom: 40px; transition: background-color 0.2s ease; }
.btn-delete:hover { background-color: #92383a; }
.toggle-switch { position: relative; display: inline-block; width: 52px; height: 30px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #E8DCC4; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 22px; width: 22px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
input:checked + .slider { background-color: #4A8446; }
input:checked + .slider:before { transform: translateX(22px); }
.settings-dropdown { background-color: transparent; border: none; color: #386641; font-family: inherit; font-size: 16px; font-weight: 600; text-align: right; outline: none; cursor: pointer; }
body.high-contrast .settings-dropdown { color: #FFFFFF; }
body.high-contrast .settings-dropdown option { color: #000000; }

/* =========================================
   08. PAST SUMMARIES PAGE
   ========================================= */
.security-card { display: block !important; background-color: #F2EFE8 !important; padding: 20px !important; border-radius: 16px !important; margin-bottom: 24px !important; border: 1px solid #E8DCC4 !important; }
.security-card p { font-size: 18px !important; color: #555 !important; line-height: 1.5 !important; display: block !important; }
.summary-list { display: flex; flex-direction: column; gap: 16px; }
.summary-card { background-color: #FCFAF5; border-radius: 20px; padding: 20px; transition: background-color 0.2s ease; }
.summary-header { cursor: pointer; display: flex; flex-direction: column; gap: 12px; }
.summary-meta { display: flex; justify-content: space-between; align-items: center; }
.tag-green { background-color: #5B9B43; color: white; font-size: 14px; font-weight: 600; padding: 6px 12px; border-radius: 20px; }
.summary-date { font-size: 14px; color: #666; text-transform: uppercase; font-weight: 500; }
.summary-title-row { display: flex; justify-content: space-between; align-items: center; }
.summary-title-row h3 { font-size: 20px; font-weight: 600; color: #333; }
.expand-icon { font-size: 32px; color: #333; transition: transform 0.2s ease; }
.summary-content { display: none; margin-top: 16px; padding-top: 16px; border-top: 1px solid #E8DCC4; }
.summary-content p { font-size: 16px; color: #444; margin-bottom: 12px; line-height: 1.4; }
.summary-content strong { color: #333; }
.summary-card.expanded .summary-content { display: block; animation: fadeIn 0.3s ease-in-out; }
.btn-outline-danger { width: 100%; background: transparent; color: #BC4749; border: 1.5px solid #BC4749; border-radius: 50px; padding: 16px; font-size: 16px; font-weight: 500; cursor: pointer; margin-top: 12px; transition: background-color 0.2s ease, transform 0.1s ease; }
.btn-outline-danger:hover { background-color: #F9EBEB; }

/* =========================================
   09. CHAT INTERFACE
   ========================================= */
body.chat-layout, body.fixed-page { position: fixed; top: 0; bottom: 0; left: 0; right: 0; height: 100%; min-height: 100%; overflow: hidden; }
body.chat-layout .mobile-container { height: 100%; display: flex; flex-direction: column; }
body.chat-layout .app-header { position: relative; z-index: 100; flex-shrink: 0; margin-bottom: 0; padding-bottom: 15px; transition: background-color 0.3s ease, box-shadow 0.3s ease; }
body.chat-layout .app-header.scrolled { background-color: #F8F3E6; box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.05); }
body.chat-layout .app-header::before { display: block; }
.chat-area { flex: 1; overflow-y: auto; display: flex; flex-direction: column; padding-top: 10px; margin: 0 24px; }
.chat-history { display: flex; flex-direction: column; gap: 12px; padding-bottom: 20px; }
.chat-input-wrapper { position: static; flex-shrink: 0; padding: 10px 24px 24px 24px; background: transparent; margin: 0; }
.chat-input-wrapper::before { display: none; }
.message { padding: 14px 18px; border-radius: 20px; font-size: 18px; max-width: 85%; line-height: 1.4; word-wrap: break-word; }
.ai-message { background-color: #F2EFE8; color: #333; align-self: flex-start; border-bottom-left-radius: 4px; }
.user-message { background-color: #386641; color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.system-message { background-color: #FCFAF5; border: 1px solid #E8DCC4; color: #333; align-self: stretch; max-width: 100%; }
.quick-replies { display: flex; gap: 10px; margin-bottom: 12px; width: 100%; }
.quick-replies::-webkit-scrollbar { display: none; } 
.btn-quick-reply { flex: 1; background-color: #F5E9CC; color: #444; border: none; padding: 12px 8px; border-radius: 50px; font-size: 15px; font-weight: 600; text-align: center; cursor: pointer; line-height: 1.2; }
.input-box { display: flex; align-items: flex-end; background-color: white; border-radius: 33px; padding: 10px 10px 10px 20px; border: 1px solid transparent; transition: border-color 0.2s ease; }
#chatInput { margin: 0; margin-bottom: 6px; }
.input-box:focus-within { border-color: #386641; }
.input-box textarea { flex: 1; border: none; outline: none; font-size: 18px; background: transparent; color: #333; resize: none; overflow-y: auto; max-height: 130px; padding: 2px 0; line-height: 1.4; font-family: inherit; }
.btn-mic { background: transparent; border: none; color: #666; padding: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.btn-send { background-color: #386641; color: white; border: none; border-radius: 50%; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; margin-left: 8px; }
.btn-send .material-symbols-rounded { font-size: 24px; }
.btn-mic.recording { background-color: rgba(188, 71, 73, 0.1); border-radius: 50%; animation: pulse-mic 1.5s infinite; color: #BC4749 !important; }
@keyframes pulse-mic { 0% { box-shadow: 0 0 0 0 rgba(188, 71, 73, 0.4); } 70% { box-shadow: 0 0 0 15px rgba(188, 71, 73, 0); } 100% { box-shadow: 0 0 0 0 rgba(188, 71, 73, 0); } }
.ai-message-row { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.btn-speaker { background: transparent; border: none; color: #A0A0A0; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 8px; border-radius: 50%; transition: color 0.3s ease, background-color 0.2s ease, transform 0.1s ease; }
.btn-speaker.active-speaker { color: #386641; }
.btn-speaker:hover { background-color: #EBF2EC; }
.dynamic-options-container { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; margin-bottom: 16px; }
.btn-pill { background-color: #EBF2EC; color: #386641; border: 1px solid transparent; padding: 12px 20px; border-radius: 50px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.btn-pill:hover { background-color: #386641; color: white; }

/* =========================================
   10. REVIEW & SUCCESS PAGES
   ========================================= */
.review-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; margin-bottom: 24px; padding-bottom: 0 !important; /* Removes the old sticky padding */}
.review-intro { flex-shrink: 0; margin-bottom: 20px; }
.review-intro p { font-size: 20px; color: #444; line-height: 1.4; }
.text-green { color: #386641; }
.intake-card { background-color: #FCFAF5; border-radius: 20px; padding: 24px; border: 1px solid transparent; flex-grow: 1 !important; /* THIS IS THE MAGIC SPONGE - It expands to fill all empty space */overflow-y: auto; min-height: 0; margin-bottom: 20px; /* Adds breathing room between the card and the buttons */}
.intake-header { text-align: center; margin-bottom: 24px; }
.intake-header h3 { font-size: 20px; font-weight: 700; color: #333; margin-bottom: 4px; }
.intake-header p { font-size: 18px; color: #444; }
.intake-body h4 { font-size: 18px; font-weight: 700; color: #333; margin-bottom: 12px; }
.intake-list { list-style-type: disc; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.intake-list li { font-size: 18px; color: #444; line-height: 1.4; }
.intake-list strong { color: #333; }
.review-actions { position: relative !important; transform: none !important; left: auto !important; bottom: auto !important; width: 100% !important; flex-shrink: 0;display: flex; flex-direction: column; gap: 16px; }
.btn-action-light { width: 100%; background-color: #F2EFE8; border: 1px solid transparent; border-radius: 50px; padding: 17px; font-size: 20px; font-weight: 600; cursor: pointer; text-align: center; }
.btn-red-text { color: #BC4749; }
.btn-green-text { color: #386641; }
.success-main { flex: 1; display: flex; flex-direction: column; justify-content: space-between; margin-bottom: 24px; }
.success-center-content { flex: 1; display: flex; flex-direction: column; justify-content: flex-start; align-items: center; text-align: left; padding: 0 16px 0 16px; }
.success-description { font-size: 24px; color: #444; line-height: 1.5; margin-bottom: 0; }
.illustration-placeholder { margin-bottom: 20px; margin-top: 60px; }
.illustration-placeholder .icon-doc { font-size: 160px; color: #386642; }
.success-bottom-action { flex-shrink: 0; width: 100%; }

/* =========================================
   11. ACCESSIBILITY OVERRIDES
   ========================================= */
body.high-contrast { background-color: #121212 !important; background-image: linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px), linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px) !important; }
body.high-contrast .app-header { background-color: transparent !important; }
body.high-contrast .app-header.scrolled { background-color: #121212 !important; box-shadow: 0 4px 12px rgba(255, 255, 255, 0.05) !important; }
body.high-contrast .app-header.scrolled::before, body.high-contrast.chat-layout .app-header.scrolled { background-color: #121212 !important; box-shadow: 0 4px 12px rgba(255, 255, 255, 0.05) !important; }
body.high-contrast .icon-lock { color: #5B9B43 !important; }
body.high-contrast .settings-card, body.high-contrast .btn-secondary, body.high-contrast .support-card, body.high-contrast .summary-card { background-color: #1E1E1E !important; border: 1px solid #444; }
body.high-contrast h1, body.high-contrast h2, body.high-contrast .settings-title { color: #FFFFFF !important; }
body.high-contrast h3 { color: #E8E8E8 !important; }
body.high-contrast p, body.high-contrast .settings-row > span, body.high-contrast .settings-key-header > span, body.high-contrast .size-selector button, body.high-contrast .voice-selector span { color: #B3B3B3 !important; }
body.high-contrast .settings-btn, body.high-contrast .back-btn { color: #FFFFFF !important; }
body.high-contrast .btn-past, body.high-contrast .btn-past h3, body.high-contrast .btn-past span { color: #E0E0E0 !important; border-color: #E0E0E0 !important; }
body.high-contrast .btn-emergency, body.high-contrast .btn-emergency h3, body.high-contrast .btn-emergency span { color: #E56B6F !important; border-color: #E56B6F !important; }
body.high-contrast .btn-secondary:hover, body.high-contrast .btn-past:hover, body.high-contrast .btn-emergency:hover { background-color: #2A2A2A !important; }
body.high-contrast .warning-banner { background-color: #2D1A1C !important; border: 1px solid #8A3335 !important; }
body.high-contrast .warning-banner p { color: #F3E0E2 !important; }
body.high-contrast .settings-divider { height: 1px; background-color: #333; width: 100%; }
body.high-contrast .slider { background-color: #333 !important; }
body.high-contrast input:checked + .slider { background-color: #386641 !important; }
body.high-contrast .security-card { background-color: #2A2A2A !important; border: 1px solid #444 !important; }
body.high-contrast .security-card p { color: #E8E8E8 !important; }
body.high-contrast .summary-content { border-top-color: #444; }
body.high-contrast .summary-date { color: #A0A0A0 !important; }
body.high-contrast .expand-icon { color: #FFFFFF !important; }
body.high-contrast .summary-content strong { color: #FFFFFF !important; }
body.high-contrast .btn-outline-danger:hover { background-color: #3A2020 !important; }
body.high-contrast .chat-input-wrapper, body.high-contrast .chat-input-wrapper::before { background-color: transparent !important; }
body.high-contrast .ai-message { background-color: #1E1E1E !important; color: #FFFFFF !important; border: 1px solid #444; }
body.high-contrast .system-message { background-color: #1E1E1E !important; border-color: #666 !important; color: #E8E8E8 !important; }
body.high-contrast .system-message strong { color: #FFFFFF !important; }
body.high-contrast .btn-chat-choice { border-color: #5A9053 !important; color: #5A9053 !important; }
body.high-contrast .btn-chat-choice:hover { background-color: #1A2E1C !important; }
body.high-contrast .btn-quick-reply { background-color: #1E1E1E !important; color: #E8E8E8 !important; border: 1px solid #444; }
body.high-contrast .input-box { background-color: #1E1E1E !important; border: 1px solid #444 !important; }
body.high-contrast .input-box:focus-within { border-color: #5B9B43 !important; }
body.high-contrast .input-box textarea { color: #FFFFFF !important; }
body.high-contrast .input-box textarea::placeholder { color: #888 !important; }
body.high-contrast .btn-mic { color: #A0A0A0 !important; }
body.high-contrast .text-green { color: #5B9B43 !important; }
body.high-contrast .intake-card { background-color: #1E1E1E !important; border-color: #444 !important; }
body.high-contrast .intake-header p { color: #B3B3B3 !important; }
body.high-contrast .intake-header h3, body.high-contrast .intake-body h4, body.high-contrast .intake-list strong { color: #FFFFFF !important; }
body.high-contrast .intake-list li { color: #E8E8E8 !important; }
body.high-contrast .btn-action-light { background-color: #1E1E1E !important; border: 1px solid #444; }
body.high-contrast .btn-red-text { color: #E56B6F !important; }
body.high-contrast .btn-green-text { color: #5B9B43 !important; }
body.high-contrast .success-title { color: #FFFFFF !important; }
body.high-contrast .btn-speaker { color: #666 !important; }
body.high-contrast .btn-speaker.active-speaker { color: #5B9B43 !important; }
body.high-contrast .btn-pill { background-color: #1E1E1E; color: #5B9B43; border: 1px solid #5B9B43; }
body.high-contrast .btn-pill:hover { background-color: #5B9B43; color: #121212; }

/* =========================================
   12. DYNAMIC TEXT SIZING
   ========================================= */
body.text-size-S h1 { font-size: clamp(20px, 4vw, 24px) !important; }
body.text-size-S h2 { font-size: clamp(22px, 4.5vw, 26px) !important; }
body.text-size-S h3 { font-size: clamp(16px, 3.5vw, 20px) !important; }
body.text-size-S p, body.text-size-S span:not(.material-symbols-rounded):not(.slider), body.text-size-S li, body.text-size-S label, body.text-size-S strong, body.text-size-S button, body.text-size-S .message, body.text-size-S .btn-chat-choice, body.text-size-S .btn-quick-reply, body.text-size-S .input-box textarea { font-size: clamp(16px, 3vw, 18px) !important; }
body.text-size-L h1 { font-size: clamp(28px, 6vw, 36px) !important; }
body.text-size-L h2 { font-size: clamp(30px, 6.5vw, 40px) !important; }
body.text-size-L h3 { font-size: clamp(24px, 5vw, 32px) !important; }
body.text-size-L p, body.text-size-L span:not(.material-symbols-rounded):not(.slider), body.text-size-L li, body.text-size-L label, body.text-size-L strong, body.text-size-L button, body.text-size-L .message, body.text-size-L .btn-chat-choice, body.text-size-L .btn-quick-reply, body.text-size-L .input-box textarea { font-size: clamp(20px, 4.5vw, 24px) !important; }

/* =========================================
   13. MODAL COMPONENT (Light Mode Default)
   ========================================= */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.4) !important; display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 24px; }
.modal-box { background: #fcfbf9 !important; border: 1px solid #e5e5e5 !important; border-radius: 20px; padding: 24px; width: 100%; max-width: 340px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.08); }
.modal-box h3 { font-size: 24px; color: #2d2d2d !important; margin-bottom: 12px; }
.modal-box p { font-size: 16px; color: #666666 !important; margin-bottom: 24px; line-height: 1.5; }
.modal-buttons { display: flex; flex-direction: column; gap: 12px; }
.modal-btn { padding: 16px; border-radius: 12px; font-size: 18px; font-weight: 600; border: none; cursor: pointer; text-align: center; width: 100%; box-sizing: border-box; }
.modal-btn-danger { background-color: #BC4749 !important; color: white !important; }
.modal-btn-outline { background-color: transparent !important; border: 2px solid #e0e0e0 !important; color: #2d2d2d !important; }
.modal-btn-primary { background-color: #386641 !important; color: white !important; }
/* 
@media (prefers-color-scheme: dark) {
    .modal-overlay { background: rgba(0, 0, 0, 0.85) !important; }
    .modal-box { background: #1c1c1c !important; border-color: #333 !important; }
    .modal-box h3 { color: #ffffff !important; }
    .modal-box p { color: #aaaaaa !important; }
    .modal-btn-outline { border-color: #555 !important; color: #ffffff !important; }
} */
 body.high-contrast .modal-overlay { 
    background: rgba(0, 0, 0, 0.85) !important; 
}

body.high-contrast .modal-box { 
    background: #1E1E1E !important; 
    border-color: #444 !important; 
}

body.high-contrast .modal-box h3 { 
    color: #FFFFFF !important; 
}

body.high-contrast .modal-box p { 
    color: #B3B3B3 !important; 
}

body.high-contrast .modal-btn-outline { 
    border-color: #555 !important; 
    color: #FFFFFF !important; 
}

/* =========================================
   14. VOICE UI — NEW ADDITIONS
   =========================================
   Voice Mode Button (header, replaces spacer on right)
   Mic button states: idle, recording, processing
   Voice overlay with waveform animation
   Speaker button improvements
   ========================================= */

/* -- Voice Mode Toggle Button -- */
.voice-mode-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.voice-mode-btn .material-symbols-rounded { font-size: 28px; }
.voice-mode-btn:hover { background-color: rgba(56, 102, 65, 0.1); color: #386641; }
.voice-mode-btn.voice-mode-active {
    background-color: #386641;
    color: white;
    box-shadow: 0 0 0 4px rgba(56, 102, 65, 0.2);
}

/* -- Mic button upgraded states -- */
.btn-mic {
    background: transparent;
    border: none;
    color: #666;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.btn-mic .material-symbols-rounded { font-size: 26px; }
.btn-mic:hover { color: #386641; background-color: rgba(56, 102, 65, 0.08); }

/* Recording state: pulsing red ring */
.btn-mic.recording {
    color: #BC4749 !important;
    background-color: rgba(188, 71, 73, 0.1);
    animation: pulse-mic 1.5s infinite;
}

/* Processing state: spinning animation */
.btn-mic.processing {
    color: #F0A500 !important;
    animation: spin-mic 1.2s linear infinite;
}

@keyframes pulse-mic {
    0%   { box-shadow: 0 0 0 0 rgba(188, 71, 73, 0.5); }
    70%  { box-shadow: 0 0 0 14px rgba(188, 71, 73, 0); }
    100% { box-shadow: 0 0 0 0 rgba(188, 71, 73, 0); }
}
@keyframes spin-mic {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* -- Voice Overlay (shown during voice-to-voice mode) -- */
.voice-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 28px 24px;
    background: rgba(248, 243, 230, 0.97);
    border-radius: 24px 24px 0 0;
    backdrop-filter: blur(8px);
}

/* -- Animated Waveform Bars -- */
.voice-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 52px;
}

.voice-waveform .bar {
    display: inline-block;
    width: 5px;
    height: 8px;
    background-color: #C8D8CA;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

/* When recording, bars animate with staggered heights */
.voice-waveform.active .bar {
    background-color: #386641;
    animation: wave-bar 1.2s ease-in-out infinite;
}
.voice-waveform.active .bar:nth-child(1) { animation-delay: 0.0s; }
.voice-waveform.active .bar:nth-child(2) { animation-delay: 0.1s; }
.voice-waveform.active .bar:nth-child(3) { animation-delay: 0.2s; }
.voice-waveform.active .bar:nth-child(4) { animation-delay: 0.3s; }
.voice-waveform.active .bar:nth-child(5) { animation-delay: 0.2s; }
.voice-waveform.active .bar:nth-child(6) { animation-delay: 0.1s; }
.voice-waveform.active .bar:nth-child(7) { animation-delay: 0.05s; }
.voice-waveform.active .bar:nth-child(8) { animation-delay: 0.0s; }

@keyframes wave-bar {
    0%, 100% { transform: scaleY(1);   opacity: 0.7; }
    50%       { transform: scaleY(5.5); opacity: 1.0; }
}

.voice-state-label {
    font-size: 18px;
    font-weight: 600;
    color: #386641;
    letter-spacing: 0.01em;
}

.btn-exit-voice {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1.5px solid #CCC;
    color: #666;
    border-radius: 50px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.btn-exit-voice:hover { border-color: #BC4749; color: #BC4749; }
.btn-exit-voice .material-symbols-rounded { font-size: 20px; }

/* -- Speaker Button Improvements -- */
.btn-speaker {
    background: transparent;
    border: none;
    color: #C0C0C0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: color 0.25s ease, background-color 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
}
.btn-speaker:hover { background-color: #EBF2EC; color: #386641; }
.btn-speaker.active-speaker {
    color: #386641;
    background-color: rgba(56, 102, 65, 0.1);
    animation: speaker-pulse 2s ease-in-out infinite;
}
@keyframes speaker-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(56, 102, 65, 0.3); }
    50%       { box-shadow: 0 0 0 8px rgba(56, 102, 65, 0); }
}

/* -- Settings page additions -- */
.settings-row-column {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}
.settings-key-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.settings-badge {
    background-color: #EBF2EC;
    color: #386641;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}
.settings-sub {
    font-size: 14px !important;
    color: #666 !important;
    line-height: 1.4 !important;
    margin: 0 !important;
}
.settings-key-input {
    width: 100%;
    background-color: #F8F3E6;
    border: 1.5px solid #E8DCC4;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    color: #333;
    outline: none;
    transition: border-color 0.2s ease;
}
.settings-key-input:focus { border-color: #386641; }
.settings-key-input::placeholder { color: #AAA; }

/* -- High Contrast overrides for new elements -- */
body.high-contrast .voice-mode-btn { color: #CCCCCC; }
body.high-contrast .voice-mode-btn.voice-mode-active { background-color: #4A8446; }
body.high-contrast .voice-overlay { background: rgba(18, 18, 18, 0.97); }
body.high-contrast .voice-waveform .bar { background-color: #444; }
body.high-contrast .voice-waveform.active .bar { background-color: #5B9B43; }
body.high-contrast .voice-state-label { color: #5B9B43; }
body.high-contrast .settings-key-input { background-color: #1E1E1E; border-color: #444; color: #FFFFFF; }
body.high-contrast .settings-badge { background-color: #1A2E1C; color: #5B9B43; }

body.high-contrast .settings-sub { color: #777 !important; }

/* =========================================
   15. VOICE ORB — Full-screen voice mode UI
   Design: minimal, premium, ChatGPT-voice-inspired but distinct.
   Central animated orb with breathing/listening/speaking states.
   State is driven by data-state attribute on #voiceOrb.
   ========================================= */

/* ---- Full-screen overlay ---- */
.voice-orb-screen {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: #F8F3E6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 60px 32px 48px;
    animation: orbFadeIn 0.35s ease forwards;
}

.voice-orb-screen.hidden {
    display: none;
}

@keyframes orbFadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}

/* ---- Top: AI response text ---- */
.orb-response-area {
    width: 100%;
    max-width: 480px;
    min-height: 80px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.orb-response-text {
    font-size: 20px;
    line-height: 1.55;
    color: #333;
    text-align: center;
    font-weight: 500;
    transition: opacity 0.4s ease;
}

/* ---- Center: Orb ---- */
.orb-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.orb-container {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ripple rings — shown in listening/speaking state */
.orb-ring {
    position: absolute;
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid rgba(56, 102, 65, 0.15);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.orb-ring-1 { width: 120px; height: 120px; }
.orb-ring-2 { width: 148px; height: 148px; }
.orb-ring-3 { width: 176px; height: 176px; }

/* Core orb */
.orb-core {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #386641;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    transition: transform 0.4s ease, background 0.4s ease, box-shadow 0.4s ease;
    box-shadow: 0 8px 32px rgba(56, 102, 65, 0.25);
}

.orb-inner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    transition: transform 0.4s ease, opacity 0.4s ease;
}

/* ---- STATE: idle — gentle breathing ---- */
#voiceOrb[data-state="idle"] .orb-core {
    animation: orbBreathe 3.5s ease-in-out infinite;
}
#voiceOrb[data-state="idle"] .orb-ring { opacity: 0; }

@keyframes orbBreathe {
    0%, 100% { transform: scale(1);    box-shadow: 0 8px 32px rgba(56,102,65,0.22); }
    50%       { transform: scale(1.07); box-shadow: 0 12px 44px rgba(56,102,65,0.35); }
}

/* ---- STATE: listening — pulse rings, faster orb ---- */
#voiceOrb[data-state="listening"] .orb-core {
    background: #2e5535;
    box-shadow: 0 8px 40px rgba(56,102,65,0.4);
    animation: orbListenPulse 1.4s ease-in-out infinite;
}
#voiceOrb[data-state="listening"] .orb-ring-1 {
    opacity: 1;
    animation: ringPulse 1.4s ease-out infinite 0s;
}
#voiceOrb[data-state="listening"] .orb-ring-2 {
    opacity: 1;
    animation: ringPulse 1.4s ease-out infinite 0.28s;
}
#voiceOrb[data-state="listening"] .orb-ring-3 {
    opacity: 1;
    animation: ringPulse 1.4s ease-out infinite 0.56s;
}

@keyframes orbListenPulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.06); }
}

@keyframes ringPulse {
    0%   { transform: scale(0.85); opacity: 0.5; }
    80%  { transform: scale(1.1);  opacity: 0; }
    100% { opacity: 0; }
}

/* ---- STATE: processing — spin inner dot ---- */
#voiceOrb[data-state="processing"] .orb-core {
    background: #5a7a3a;
    animation: none;
    /* Must be relative so the absolutely-positioned dot is anchored to this circle */
    position: relative;
    overflow: visible;
}
#voiceOrb[data-state="processing"] .orb-inner {
    /* Take the dot out of flow and center it on the orb's midpoint */
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;   /* shift back by half its own size to truly center */
    border-radius: 50%;
    background: rgba(255,255,255,0.75);
    /*
     * Correct orbit transform order:
     * 1. rotate()     — spins the coordinate system around the orb center
     * 2. translateX() — moves the dot outward along the now-rotated X axis
     * transform-origin must stay "center" (default) so rotation pivots on
     * the dot's own center, which is already placed at the orb center.
     */
    transform-origin: center;
    animation: orbSpinDot 1s linear infinite;
    transition: none;
}
#voiceOrb[data-state="processing"] .orb-ring { opacity: 0; }

@keyframes orbSpinDot {
    from { transform: rotate(0deg)   translateX(28px); }
    to   { transform: rotate(360deg) translateX(28px); }
}

/* ---- STATE: speaking — warm color, wave rings ---- */
#voiceOrb[data-state="speaking"] .orb-core {
    background: #386641;
    animation: orbSpeakWave 0.8s ease-in-out infinite;
}
#voiceOrb[data-state="speaking"] .orb-ring-1 {
    opacity: 1;
    border-color: rgba(56,102,65,0.3);
    animation: ringWave 0.8s ease-out infinite 0s;
}
#voiceOrb[data-state="speaking"] .orb-ring-2 {
    opacity: 1;
    border-color: rgba(56,102,65,0.2);
    animation: ringWave 0.8s ease-out infinite 0.16s;
}
#voiceOrb[data-state="speaking"] .orb-ring-3 {
    opacity: 1;
    border-color: rgba(56,102,65,0.12);
    animation: ringWave 0.8s ease-out infinite 0.32s;
}

@keyframes orbSpeakWave {
    0%, 100% { transform: scale(1); }
    33%       { transform: scale(1.08); }
    66%       { transform: scale(0.97); }
}

@keyframes ringWave {
    0%   { transform: scale(0.9); opacity: 0.6; }
    100% { transform: scale(1.2); opacity: 0; }
}

/* ---- State label ---- */
.orb-state-label {
    font-size: 16px;
    font-weight: 600;
    color: #386641;
    letter-spacing: 0.03em;
    min-height: 24px;
    transition: opacity 0.3s ease;
}

/* ---- Bottom: transcript ---- */
.orb-transcript-area {
    width: 100%;
    max-width: 480px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orb-transcript-text {
    font-size: 17px;
    color: #888;
    text-align: center;
    font-style: italic;
    line-height: 1.5;
    transition: opacity 0.3s ease;
}

/* ---- Controls ---- */
.orb-controls {
    display: flex;
    justify-content: center;
}

.orb-close-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0,0,0,0.07);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    color: #555;
}
.orb-close-btn:hover { background: rgba(0,0,0,0.12); }
.orb-close-btn:active { transform: scale(0.95); }
.orb-close-btn .material-symbols-rounded { font-size: 26px; }

/* ---- Voice mode header button (updated icon) ---- */
.voice-mode-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}
.voice-mode-btn .material-symbols-rounded { font-size: 28px; }
.voice-mode-btn:hover { background: rgba(56,102,65,0.1); color: #386641; }
.voice-mode-btn.voice-mode-active {
    background: #386641;
    color: white;
    box-shadow: 0 0 0 4px rgba(56,102,65,0.18);
}

/* ---- High contrast overrides ---- */
body.high-contrast .voice-orb-screen {
    background: #121212;
}
body.high-contrast .orb-response-text { color: #E8E8E8; }
body.high-contrast .orb-transcript-text { color: #777; }
body.high-contrast .orb-state-label { color: #5B9B43; }
body.high-contrast .orb-core { background: #2a6032; }
body.high-contrast .orb-close-btn { background: rgba(255,255,255,0.08); color: #CCC; }
body.high-contrast .voice-mode-btn { color: #CCC; }
body.high-contrast .voice-mode-btn.voice-mode-active { background: #2a6032; }

/* =========================================
   ELEVENLABS KEY — saved state UI
   ========================================= */
.settings-key-saved-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #F8F3E6;
    border: 1.5px solid #E8DCC4;
    border-radius: 12px;
    padding: 12px 16px;
    width: 100%;
    box-sizing: border-box;
}
.settings-key-masked {
    font-size: 18px;
    color: #888;
    letter-spacing: 2px;
    flex: 1;
}
.settings-key-edit-btn {
    background: none;
    border: none;
    color: #386641;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}
.settings-key-edit-btn:hover { background: rgba(56,102,65,0.08); }

/* High contrast overrides */
body.high-contrast .settings-key-saved-row {
    background-color: #1E1E1E;
    border-color: #444;
}
body.high-contrast .settings-key-masked { color: #666; }
body.high-contrast .settings-key-edit-btn { color: #5B9B43; }

/* =========================================
   INLINE MIC — green pulse when transcribing to input
   ========================================= */
.btn-mic.recording-input {
    color: #386641 !important;
    background-color: rgba(56, 102, 65, 0.1) !important;
    border-radius: 50%;
    animation: pulse-mic-green 1.5s infinite;
}
@keyframes pulse-mic-green {
    0%   { box-shadow: 0 0 0 0 rgba(56, 102, 65, 0.45); }
    70%  { box-shadow: 0 0 0 14px rgba(56, 102, 65, 0); }
    100% { box-shadow: 0 0 0 0 rgba(56, 102, 65, 0); }
}
 
/* =========================================
   MODE SWITCH DIVIDER — subtle "back to texting"
   ========================================= */
.mode-switch-divider {
    text-align: center;
    font-size: 12px;
    color: #C0B8A8;
    letter-spacing: 0.04em;
    margin: 10px 0 6px;
    user-select: none;
    pointer-events: none;
}
body.high-contrast .mode-switch-divider { color: #555; }
 
/* =========================================
   MUTE BUTTON — red tint when active
   ========================================= */
.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
#muteToggleBtn.muted {
    color: #BC4749 !important;
    background-color: rgba(188, 71, 73, 0.1);
    border-radius: 50%;
}

/* =========================================
   20. SCREENING-COMPLETE PAGE (handoff hub)
   ========================================= */
.complete-hero {
    text-align: center;
    padding: 28px 16px 24px;
}
.complete-hero h2 { font-size: 26px; color: #2c2c2c; margin: 18px 0 8px; }
.complete-hero p  { font-size: 16px; color: #666; line-height: 1.5; max-width: 480px; margin: 0 auto; }

/* Draw-on checkmark */
.checkmark {
    width: 96px; height: 96px;
    border-radius: 50%;
    display: block;
    margin: 0 auto;
    stroke-width: 3;
    stroke: #fff;
    stroke-miterlimit: 10;
    box-shadow: inset 0 0 0 #386641;
    animation: checkFill 0.4s ease-in-out 0.4s forwards, checkScale 0.3s ease-in-out 0.9s both;
}
.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke: #386641;
    stroke-width: 3;
    animation: checkStroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}
.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke-width: 4;
    stroke-linecap: round;
    animation: checkStroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.7s forwards;
}
@keyframes checkStroke { 100% { stroke-dashoffset: 0; } }
@keyframes checkScale  { 0%, 100% { transform: none; } 50% { transform: scale3d(1.08, 1.08, 1); } }
@keyframes checkFill   { 100% { box-shadow: inset 0 0 0 60px #386641; } }

.record-chip { padding: 18px 20px; margin-bottom: 20px; }
.record-chip-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.record-chip h3 { font-size: 18px; color: #2c2c2c; }

.qr-card { display: flex; flex-direction: column; align-items: center; padding: 24px 20px; }
.qr-box {
    background: #fff;
    padding: 14px;
    border-radius: 16px;
    border: 2px solid #38664122;
    display: inline-block;
}
.qr-box img { display: block; }
.qr-hint { font-size: 14px; color: #666; line-height: 1.5; text-align: center; margin-top: 16px; max-width: 420px; }

/* Share option rows */
.share-row {
    display: flex; align-items: center; gap: 16px;
    width: 100%;
    background: none; border: none;
    padding: 16px 4px;
    cursor: pointer;
    text-align: left;
    border-radius: 12px;
}
.share-row:hover { background: rgba(56, 102, 65, 0.06); }
.share-row:disabled { opacity: 0.4; cursor: default; }
.share-row .material-symbols-rounded { font-size: 26px; color: #386641; }
.share-row-text h4 { font-size: 16px; color: #2c2c2c; margin-bottom: 2px; }
.share-row-text p  { font-size: 13.5px; color: #666; }

/* =========================================
   21. CHAT POLISH — message entrances & typing dots
   ========================================= */
.message { animation: msgIn 0.28s ease-out both; }
@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.typing-indicator {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 14px 18px;
}
.typing-indicator .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #38664188;
    animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-indicator .dot:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* =========================================
   22. STAGGERED PAGE ENTRANCES (non-chat pages)
   ========================================= */
body:not(.chat-layout) main > * {
    animation: riseIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
body:not(.chat-layout) main > *:nth-child(1) { animation-delay: 0.05s; }
body:not(.chat-layout) main > *:nth-child(2) { animation-delay: 0.12s; }
body:not(.chat-layout) main > *:nth-child(3) { animation-delay: 0.19s; }
body:not(.chat-layout) main > *:nth-child(4) { animation-delay: 0.26s; }
body:not(.chat-layout) main > *:nth-child(5) { animation-delay: 0.33s; }
body:not(.chat-layout) main > *:nth-child(n+6) { animation-delay: 0.4s; }
@keyframes riseIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Card & button touch feedback */
.summary-card, .support-card, .settings-card { transition: transform 0.15s ease, box-shadow 0.2s ease; }
.summary-card:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.06); }
.btn-primary, .btn-secondary, .btn-danger { transition: transform 0.12s ease, filter 0.2s ease; }
.btn-primary:hover, .btn-secondary:hover, .btn-danger:hover { filter: brightness(1.04); }
.btn-primary:active, .btn-secondary:active, .btn-danger:active { transform: scale(0.98); }

/* Per-record actions on Past Summaries */
.summary-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.summary-actions button {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1.5px solid #38664144;
    background: none; color: #386641;
    font-weight: 600; font-size: 14px;
    padding: 9px 16px; border-radius: 20px;
    cursor: pointer;
}
.summary-actions button:hover { background: rgba(56, 102, 65, 0.08); }
.summary-actions .material-symbols-rounded { font-size: 18px; }

/* Emergency page: call buttons are real links now */
a.btn-card-action, a.btn-danger { text-decoration: none; }

/* Respect reduced-motion everywhere */
@media (prefers-reduced-motion: reduce) {
    body:not(.chat-layout) main > *,
    .message, .checkmark, .checkmark-circle, .checkmark-check,
    .typing-indicator .dot {
        animation: none !important;
    }
    .checkmark { box-shadow: inset 0 0 0 60px #386641; }
    .checkmark-circle, .checkmark-check { stroke-dashoffset: 0; }
}

/* =========================================
   23. WELCOME SETUP (first-run key screen)
   ========================================= */
.welcome-box { text-align: center; max-width: 420px; }
.welcome-icon { font-size: 52px; color: #386641; display: block; margin: 0 auto 10px; }
.welcome-box h3 { font-size: 24px; margin-bottom: 10px; }
.welcome-box p { font-size: 15px; color: #666; line-height: 1.55; margin-bottom: 18px; }
.welcome-box .settings-key-input { width: 100%; }
.welcome-link {
    display: block; margin-top: 14px;
    color: #386641; font-weight: 600; font-size: 14px;
    text-decoration: none;
}
.welcome-link:hover { text-decoration: underline; }
.welcome-back {
    background: none; border: none; cursor: pointer;
    margin-top: 16px; color: #767676; font-size: 14px; font-weight: 500;
}
.welcome-back:hover { color: #386641; }

/* =========================================
   24. ACCESSIBILITY — focus visibility & RTL
   ========================================= */
button:focus-visible, a:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid #386641;
    outline-offset: 2px;
    border-radius: 4px;
}
body.high-contrast button:focus-visible, body.high-contrast a:focus-visible,
body.high-contrast input:focus-visible, body.high-contrast textarea:focus-visible,
body.high-contrast select:focus-visible, body.high-contrast [tabindex]:focus-visible {
    outline-color: #A7C957;
}

/* Keyboard-focusable accordion headers */
.summary-header { cursor: pointer; }

/* RTL: flip directional paddings that matter; flex layouts mirror automatically */
[dir="rtl"] .back-btn .material-symbols-rounded { transform: scaleX(-1); }
