/* Memento AI Styles - Redesigned */
:root {
    --primary: #B08BBB;
    --primary-light: #D4B5DB;
    --accent: #C96B7C;
    --accent-hover: #B85A6B;
    --background: #FDF8F3; /* warm linen */
    --background-gradient-start: #FDF0E8; /* warm peach-linen */
    --background-gradient-end: #F5F0FF;  /* soft lavender cream */
    --text: #333333;
    --text-light: #666666;
    --text-lighter: #767676;
    --highlight: #FFDAB9;
    --white: #FFFFFF;
    --card-bg: #FFFFFF;
    --shadow-soft: 8px 8px 16px rgba(176, 139, 187, 0.15), -8px -8px 16px rgba(255, 255, 255, 0.9);
    --shadow-hover: 12px 12px 24px rgba(176, 139, 187, 0.2), -8px -8px 16px rgba(255, 255, 255, 0.95);
    --shadow-inset: inset 4px 4px 8px rgba(176, 139, 187, 0.1), inset -4px -4px 8px rgba(255, 255, 255, 0.9);
    --border-radius-sm: 16px;
    --border-radius-md: 24px;
    --border-radius-lg: 32px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* ── Warm Redesign Variables ── */
    /* Warm backgrounds */
    --bg-app: #FDF8F3;           /* warm linen — replaces cold white */
    --bg-card: #FFFFFF;
    --bg-card-warm: #FFFAF5;
    --bg-header: #FFFFFF;

    /* Mood color system — amber/sage/terracotta */
    --mood-great: #F59E0B;
    --mood-great-bg: #FFFBEB;
    --mood-great-text: #92400E;
    --mood-okay: #059669;
    --mood-okay-bg: #ECFDF5;
    --mood-okay-text: #065F46;
    --mood-hard: #DC6B3F;
    --mood-hard-bg: #FFF3EE;
    --mood-hard-text: #9A3412;

    /* Warm text */
    --text-primary: #2C1A0E;     /* warm near-black */
    --text-secondary: #6B4C38;   /* warm brown-gray */
    --text-light-warm: #9C7B68;
    --text-lighter-warm: #C4A898;

    /* Time-of-day theming variables (overridden by JS body classes) */
    --tod-bg: #FDF8F3;
    --tod-accent: #7C3AED;
    --tod-card-glow: rgba(124,58,237,0.06);
}

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

/* ── Minimum readable font size for content text (Fix 15) ── */
.field-note,
.settings-description,
.mode-description,
.toggle-description,
.memory-caption,
.detail-meta,
.detail-tags,
.summary-meta,
.profile-detail.last-updated,
.analysis-confidence,
.max-duration-note,
.action-btn .label,
.tag-label,
.timeline-time,
.analysis-time,
.analysis-flag,
.consent-text,
.invite-code-hint,
.invite-code-expiry,
.help-resource-detail,
.badge-label,
.user-email,
.user-added {
    font-size: 14px;
}

body {
    font-family: 'Nunito', 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 28px 20px;
    padding-bottom: 120px;
    min-height: 100vh;
}

/* Welcome Header - Curved with Gradient */
.welcome-header {
    background: linear-gradient(135deg, var(--background-gradient-start) 0%, var(--background-gradient-end) 100%);
    padding: 16px 20px;
    border-radius: var(--border-radius-lg);
    margin-bottom: 24px;
    box-shadow: var(--shadow-soft);
    color: var(--text);
    position: relative;
    overflow: hidden;
}

.welcome-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -10%;
    width: 120%;
    height: 100%;
    background: radial-gradient(circle, rgba(176, 139, 187, 0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.header-top-row {
    position: relative;
    z-index: 1;
    margin-bottom: 8px;
}

.header-patient-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.header-patient-info {
    flex: 1;
    min-width: 0;
}

.patient-display-name {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
    line-height: 1.2;
    word-wrap: break-word;
}

.subtext {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-lighter);
    position: relative;
    z-index: 1;
}

.header-patient-avatar {
    width: 144px;
    height: 144px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(176, 139, 187, 0.3);
}

.header-patient-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-initials {
    color: white;
    font-size: 48px;
    font-weight: 700;
    letter-spacing: 1px;
}

@media (max-width: 380px) {
    .patient-display-name {
        font-size: 22px;
    }
    .header-patient-avatar {
        width: 100px;
        height: 100px;
    }
    .avatar-initials {
        font-size: 36px;
    }
    .welcome-header {
        padding: 12px 14px;
    }
    .header-logo {
        width: 80px;
    }
}

/* Main Prompt Panel - Neumorphic */
.main-prompt-panel {
    background: var(--card-bg);
    padding: 28px;
    border-radius: var(--border-radius-md);
    margin-bottom: 32px;
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
}

.main-prompt-panel:hover {
    box-shadow: var(--shadow-hover);
}

.main-prompt-panel h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--primary);
}

.input-container {
    position: relative;
    margin-bottom: 16px;
}

.input-container textarea {
    width: 100%;
    padding: 18px 20px;
    padding-right: 70px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 15px;
    resize: none;
    transition: var(--transition);
    background-color: var(--card-bg);
    box-shadow: var(--shadow-inset);
    color: var(--text);
}

.input-container textarea:focus {
    outline: none;
    box-shadow: inset 2px 2px 6px rgba(176, 139, 187, 0.15), inset -2px -2px 6px rgba(255, 255, 255, 0.95);
}

.input-container textarea::placeholder {
    color: var(--text-lighter);
}

/* Microphone Button with Breathing Animation */
.mic-button {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
    color: var(--white);
}

.mic-button:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-50%) scale(1.05);
}

.mic-button:active {
    transform: translateY(-50%) scale(0.95);
    box-shadow: var(--shadow-inset);
}

/* Breathing animation for active recording */
.mic-button.recording {
    animation: breathe 2s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 179, 179, 0.7),
                    var(--shadow-soft);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(255, 179, 179, 0),
                    var(--shadow-hover);
    }
}

/* Submit Button - Neumorphic Pill */
.submit-button {
    width: 100%;
    padding: 16px;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: 50px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
    letter-spacing: 0.3px;
}

.submit-button:hover {
    background: var(--accent-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.submit-button:active {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

/* Quick Actions - Neumorphic Pills */
.quick-actions {
    margin-bottom: 32px;
}

.quick-actions h3 {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 18px;
    padding-left: 4px;
    color: var(--text);
}

.actions-scroll {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* Neumorphic Action Buttons */
.action-btn {
    background: var(--card-bg);
    border: none;
    padding: 20px 16px;
    border-radius: var(--border-radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
}

.action-btn:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.action-btn:active {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.action-btn .icon {
    font-size: 32px;
}

.action-btn .label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
}

/* Upcoming Appointments */
.appointments-section {
    background: var(--white);
    padding: 24px;
    border-radius: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px var(--shadow);
}

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

.section-header-row h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.add-appointment-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    line-height: 1;
}

.add-appointment-btn:hover {
    background: var(--primary-dark, #9A74A6);
    transform: scale(1.08);
}

.appointments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.appointment-card {
    background: var(--background);
    padding: 16px;
    border-radius: 14px;
    border-left: 4px solid var(--highlight);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    transition: box-shadow 0.2s;
}

.appointment-card:hover {
    box-shadow: 0 2px 12px var(--shadow);
}

.appointment-card.urgency-critical {
    border-left-color: var(--accent);
    background: rgba(201, 107, 124, 0.06);
}

.appointment-card.urgency-warning {
    border-left-color: #F5A623;
    background: rgba(245, 166, 35, 0.06);
}

.appt-main {
    display: flex;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.appt-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.appt-details {
    flex: 1;
    min-width: 0;
}

.appt-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    margin-bottom: 4px;
    word-wrap: break-word;
}

.appt-datetime {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.appt-location {
    font-size: 13px;
    color: var(--text-lighter);
    margin-bottom: 6px;
}

.appt-type-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
    text-transform: capitalize;
}

.appt-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.appt-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--white);
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    color: var(--text-light);
}

.appt-action-btn:hover {
    background: var(--background);
    color: var(--text);
}

.appointment-banner {
    background: var(--accent);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    animation: bannerPulse 2s ease-in-out infinite;
}

@keyframes bannerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.appt-empty-state {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-lighter);
}

.appt-empty-state p:first-child {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
}

.appt-empty-hint {
    font-size: 13px;
    color: var(--text-lighter);
    opacity: 0.7;
}

/* Recent Suggestions */
.recent-suggestions {
    background: var(--white);
    padding: 24px;
    border-radius: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px var(--shadow);
}

.recent-suggestions h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestion-card {
    background: var(--background);
    padding: 16px;
    border-radius: 14px;
    border-left: 4px solid var(--highlight);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.3s;
}

.suggestion-card:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px var(--shadow);
}

.suggestion-card.warning {
    border-left-color: var(--accent);
}

.suggestion-card.info {
    border-left-color: var(--primary);
}

.suggestion-card .emoji {
    font-size: 24px;
    flex-shrink: 0;
}

.suggestion-card .text {
    font-size: 14px;
    line-height: 1.5;
}

/* Bottom Navigation - Floating with Blur */
.bottom-nav {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 480px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-around;
    padding: 14px 8px;
    box-shadow: 0 8px 32px rgba(176, 139, 187, 0.2);
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 10px 10px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    color: var(--text-light);
    opacity: 0.7;
    min-width: 52px;
}

.nav-btn:hover {
    opacity: 0.9;
    background: rgba(176, 139, 187, 0.08);
    transform: translateY(-2px);
}

.nav-btn.active {
    opacity: 1;
    color: var(--accent);
    background: rgba(255, 179, 179, 0.15);
}

.nav-btn.active .nav-icon {
    animation: navPulse 0.3s ease-out;
}

@keyframes navPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

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

.nav-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    padding: 32px;
    border-radius: 24px;
    max-width: 400px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-content h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--primary);
}

.modal-content input[type="file"] {
    margin-bottom: 20px;
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--light-gray);
    border-radius: 12px;
    cursor: pointer;
}

.modal-content textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--light-gray);
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    resize: vertical;
    margin-bottom: 16px;
}

.modal-content textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.cancel-button {
    width: 100%;
    padding: 14px;
    background: var(--light-gray);
    color: var(--text);
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.3s;
}

.cancel-button:hover {
    background: #D1D5DB;
}

.recording-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

#recordingStatus {
    text-align: center;
    padding: 12px;
    border-radius: 12px;
    background: var(--background);
    font-size: 14px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Profile Pages Styles */
.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.back-button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s;
}

.back-button:hover {
    transform: translateX(-4px);
}

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

.header-signout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: none;
    border: 1.5px solid rgba(176, 139, 187, 0.3);
    border-radius: 20px;
    color: var(--text-light);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-signout-btn:hover {
    background: rgba(176, 139, 187, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.header-signout-btn svg {
    flex-shrink: 0;
}

html[data-theme="dark"] .header-signout-btn {
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-lighter);
}

html[data-theme="dark"] .header-signout-btn:hover {
    background: rgba(176, 139, 187, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

/* Profile Form Styles */
.profile-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-section {
    background: var(--white);
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 2px 8px var(--shadow);
}

.form-section h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 20px;
}

.profile-picture-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.picture-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--background);
    border: 3px dashed var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    overflow: hidden;
    transition: all 0.3s;
}

.picture-preview:hover {
    border-color: var(--primary);
}

.clickable-preview {
    cursor: pointer;
}

.clickable-preview:hover {
    border-color: var(--primary);
    background: rgba(176, 139, 187, 0.05);
    transform: scale(1.02);
}

.clickable-preview:active {
    transform: scale(0.98);
}

.placeholder-icon {
    font-size: 48px;
}

.secondary-button {
    padding: 12px 24px;
    background: var(--light-gray);
    color: var(--text);
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.secondary-button:hover {
    background: #D1D5DB;
}

.field-note {
    font-size: 13px;
    color: var(--text-lighter);
    text-align: center;
    margin: 0;
}

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

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.required {
    color: var(--accent);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group input[type="tel"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--light-gray);
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.3s;
    background-color: var(--background);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

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

.consent-section {
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    border: 2px solid var(--primary);
}

.consent-box h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
}

.consent-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 16px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 4px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 14px;
    line-height: 1.5;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Profile Overview Styles */
.profile-header-card {
    background: linear-gradient(135deg, var(--primary) 0%, #9BB5D6 100%);
    padding: 32px 24px;
    border-radius: 20px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px var(--shadow);
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-picture-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 3px solid var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    overflow: hidden;
    flex-shrink: 0;
}

.profile-info {
    flex: 1;
}

.profile-info h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.profile-detail {
    font-size: 14px;
    margin: 4px 0;
    opacity: 0.95;
}

.profile-detail.caring-since {
    margin-top: 12px;
    font-weight: 500;
}

.profile-detail.last-updated {
    font-size: 13px;
    opacity: 0.8;
}

.profile-card {
    background: var(--white);
    padding: 24px;
    border-radius: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px var(--shadow);
}

.profile-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

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

.link-button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    transition: all 0.3s;
}

.link-button:hover {
    color: #6A8CB6;
}

.address-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 16px;
}

.map-placeholder {
    background: var(--background);
    border-radius: 12px;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photos-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.photo-preview {
    aspect-ratio: 1;
    background: var(--background);
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: all 0.3s;
}

.photo-preview:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px var(--shadow);
}

.empty-state {
    text-align: center;
    color: var(--text-lighter);
    font-size: 14px;
    padding: 20px;
}

.voice-analysis-preview,
.timeline-entry-preview {
    background: var(--background);
    padding: 16px;
    border-radius: 12px;
}

.analysis-item,
.timeline-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analysis-text,
.timeline-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}

.analysis-time,
.timeline-time {
    font-size: 13px;
    color: var(--text-lighter);
}

.analysis-flag {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    margin-top: 4px;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px var(--shadow);
}

.action-button.primary {
    background: var(--accent);
    color: var(--white);
}

.action-button.primary:hover {
    background: #EF7A6A;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 138, 122, 0.4);
}

.action-button.secondary {
    background: var(--white);
    color: var(--text);
    border: 2px solid var(--light-gray);
}

.action-button.secondary:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.button-icon {
    font-size: 20px;
}

/* Responsive adjustments */
@media (max-width: 380px) {
    .app-container {
        padding: 16px;
    }

    .welcome-header h1 {
        font-size: 20px;
    }

    .action-btn {
        padding: 14px 12px;
    }

    .action-btn .icon {
        font-size: 24px;
    }

    .action-btn .label {
        font-size: 12px;
    }
    
    .profile-header-card {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-info h2 {
        font-size: 20px;
    }

    .nav-btn {
        min-width: 42px;
        padding: 8px 4px;
        gap: 4px;
    }

    .nav-label {
        font-size: 10px;
    }

    .nav-btn-help {
        min-width: 38px;
        padding: 8px 4px;
    }
}

/* Timeline Page Styles */
.timeline-header-card {
    background: var(--white);
    padding: 24px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px var(--shadow);
}

.timeline-header-card h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.timeline-summary {
    font-size: 14px;
    color: var(--text-lighter);
    margin: 0;
}

.timeline-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.timeline-actions .action-button {
    flex: 1;
}

/* Filter Controls Container */
/* View Controls Row (calendar + view toggle) */
.view-controls-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 10px;
}

/* Date Filter Banner */
.date-filter-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-light);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 10px 16px;
    margin-bottom: 10px;
}

.date-filter-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.date-filter-clear {
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.date-filter-clear:hover {
    background: var(--primary-dark, #9a72a5);
    transform: scale(1.02);
}

/* Filter Tabs Row */
.filter-tabs-row {
    margin-bottom: 16px;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.filter-tabs::-webkit-scrollbar {
    height: 4px;
}

.filter-tabs::-webkit-scrollbar-track {
    background: var(--light-gray);
    border-radius: 2px;
}

.filter-tabs::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}

.filter-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--white);
    border: 2px solid var(--light-gray);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
    flex-shrink: 0;
}

.filter-tab:hover {
    border-color: var(--primary);
    background: var(--background);
}

.filter-tab.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* View Controls */
.view-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.view-control-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--white);
    border: 2px solid var(--light-gray);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s;
}

.view-control-btn:hover {
    border-color: var(--primary);
    background: var(--background);
}

.view-control-btn .btn-icon {
    font-size: 16px;
}

.view-control-btn .btn-text {
    font-size: 14px;
}

.view-control-btn .dropdown-arrow {
    font-size: 10px;
    margin-left: 2px;
}

/* View Dropdown */
.view-dropdown {
    position: relative;
}

.view-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    z-index: 100;
}

.view-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.view-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s;
}

.view-option:first-child {
    border-radius: 12px 12px 0 0;
}

.view-option:last-child {
    border-radius: 0 0 12px 12px;
}

.view-option:hover {
    background: var(--background);
}

.view-option .check-icon {
    opacity: 0;
    color: var(--primary);
    font-weight: 700;
}

.view-option.active .check-icon {
    opacity: 1;
}

.tab-icon {
    font-size: 16px;
}

/* Timeline Entries - Detailed View */
.timeline-entries {
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
}

/* Detailed View (Option A) */
.timeline-entries.detailed-view {
    gap: 0;
}

.timeline-entries.detailed-view .timeline-entry {
    padding: 24px 0;
    cursor: pointer;
    transition: all 0.3s;
}

.timeline-entries.detailed-view .timeline-entry:hover {
    background: rgba(176, 139, 187, 0.03);
    padding-left: 12px;
    padding-right: 12px;
    margin-left: -12px;
    margin-right: -12px;
    border-radius: 12px;
}

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

.entry-date-time {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.entry-type-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.entry-type-badge.type-ai {
    background: rgba(139, 92, 246, 0.15);
    color: #7C3AED;
}

.entry-type-badge.type-flag {
    background: rgba(255, 138, 122, 0.15);
    color: #DC2626;
}

.entry-type-badge.type-voice {
    background: rgba(122, 156, 198, 0.15);
    color: #5A7CA0;
}

.entry-type-badge.type-photo {
    background: rgba(245, 210, 118, 0.15);
    color: #D4A017;
}

.entry-type-badge.type-note {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.entry-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 12px;
}

.entry-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.entry-flag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 138, 122, 0.15);
    color: #DC2626;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

/* Animated Separator */
.entry-separator {
    height: 2px;
    background: linear-gradient(90deg, #8B6FA8 0%, #A688B8 50%, transparent 100%);
    margin-top: 24px;
    width: 0%;
    transition: width 0.6s ease-out;
}

.entry-separator.visible {
    width: 100%;
}

/* Compact View (Option D) */
.timeline-entries.compact-view {
    gap: 0;
}

.timeline-entries.compact-view .timeline-entry {
    cursor: pointer;
    transition: all 0.3s;
}

/* Collapsed state - single line */
.timeline-entries.compact-view .timeline-entry.compact-collapsed {
    padding: 12px 0;
}

.timeline-entries.compact-view .timeline-entry.compact-collapsed:hover {
    background: rgba(176, 139, 187, 0.03);
    padding-left: 12px;
    padding-right: 12px;
    margin-left: -12px;
    margin-right: -12px;
    border-radius: 12px;
}

.compact-collapsed-view {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.compact-collapsed .compact-expanded-view {
    display: none;
}

.compact-collapsed .entry-separator {
    display: none;
}

.compact-date {
    font-weight: 600;
    color: var(--text);
    min-width: 90px;
    flex-shrink: 0;
}

.compact-time {
    color: var(--text-lighter);
    min-width: 65px;
    flex-shrink: 0;
}

.compact-icon {
    font-size: 18px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
}

.compact-icon.type-ai {
    background: rgba(139, 92, 246, 0.15);
}

.compact-icon.type-flag {
    background: rgba(255, 138, 122, 0.15);
}

.compact-icon.type-voice {
    background: rgba(122, 156, 198, 0.15);
}

.compact-icon.type-photo {
    background: rgba(245, 210, 118, 0.15);
}

.compact-icon.type-note {
    background: rgba(16, 185, 129, 0.15);
}

.compact-preview {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.compact-flag {
    font-size: 16px;
    flex-shrink: 0;
}

.compact-expand {
    font-size: 18px;
    color: var(--text-lighter);
    flex-shrink: 0;
}

/* Expanded state - full content */
.timeline-entries.compact-view .timeline-entry.compact-expanded {
    padding: 16px 0;
}

.timeline-entries.compact-view .timeline-entry.compact-expanded:hover {
    background: rgba(176, 139, 187, 0.03);
    padding-left: 12px;
    padding-right: 12px;
    margin-left: -12px;
    margin-right: -12px;
    border-radius: 12px;
}

.compact-expanded .compact-collapsed-view {
    display: none;
}

.compact-expanded .compact-expanded-view {
    display: block;
}

.compact-expanded .entry-header {
    margin-bottom: 8px;
}

.compact-expanded .entry-content {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 8px;
}

.compact-expanded .entry-flags {
    margin-bottom: 8px;
}

.compact-expanded .entry-separator {
    margin-top: 16px;
}


/* Old card styles (deprecated but kept for compatibility) */
.timeline-card {
    background: var(--white);
    padding: 28px;
    border-radius: 20px;
    box-shadow: 0 2px 8px var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 6px solid var(--primary);
}

.timeline-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 8px 20px rgba(176, 139, 187, 0.2);
}

.timeline-card.tag-photo {
    border-left-color: #F5D276;
}

.timeline-card.tag-voice {
    border-left-color: #7A9CC6;
}

.timeline-card.tag-note {
    border-left-color: #10B981;
}

.timeline-card.tag-ai {
    border-left-color: #8B5CF6;
}

.timeline-card.tag-flag {
    border-left-color: #FF8A7A;
}

.timeline-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.timeline-date {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.date-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.time-text {
    font-size: 14px;
    color: var(--text-lighter);
    font-weight: 500;
}

.timeline-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.timeline-tag.tag-photo {
    background: rgba(245, 210, 118, 0.2);
    color: #D4A017;
}

.timeline-tag.tag-voice {
    background: rgba(122, 156, 198, 0.2);
    color: #5A7CA0;
}

.timeline-tag.tag-note {
    background: rgba(16, 185, 129, 0.2);
    color: #059669;
}

.timeline-tag.tag-ai {
    background: rgba(139, 92, 246, 0.2);
    color: #7C3AED;
}

.timeline-tag.tag-flag {
    background: rgba(255, 138, 122, 0.2);
    color: #DC2626;
}

.tag-icon {
    font-size: 16px;
}

.tag-label {
    font-size: 13px;
}

.timeline-card-content {
    margin-bottom: 20px;
    margin-top: 4px;
}

.preview-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
    margin: 0;
}

.flag-badge {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(255, 138, 122, 0.15);
    color: #DC2626;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    margin-top: 16px;
    border: 2px solid rgba(255, 138, 122, 0.3);
}

.timeline-card-footer {
    display: none;
}

.expand-hint {
    display: none;
}

/* Timeline Empty State */
.timeline-empty {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 2px 8px var(--shadow);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-subtext {
    font-size: 14px;
    color: var(--text-lighter);
}

/* Entry Detail Modal */
.modal-large {
    max-width: 500px;
}

.entry-detail {
    padding: 0;
}

.detail-header {
    margin-bottom: 20px;
}

.detail-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.detail-date {
    font-size: 14px;
    color: var(--text-lighter);
    margin: 0;
}

.detail-content {
    line-height: 1.7;
}

.detail-content p {
    margin-bottom: 12px;
}

.detail-text {
    font-size: 15px;
    color: var(--text);
    white-space: pre-wrap;
}

.detail-image {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 16px;
}

.detail-tags {
    font-size: 13px;
    color: var(--text-lighter);
    font-style: italic;
}

.detail-meta {
    font-size: 13px;
    color: var(--text-lighter);
}

.flag-notice {
    background: rgba(255, 138, 122, 0.2);
    color: #DC2626;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    margin: 16px 0;
}

.detail-recommendation {
    background: rgba(122, 156, 198, 0.2);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 16px;
}

/* Note Tags */
.note-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0;
}

.tag-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--background);
    border: 2px solid var(--light-gray);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.tag-checkbox:hover {
    border-color: var(--primary);
}

.tag-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.tag-checkbox span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

/* Summary Content */
.summary-content {
    min-height: 100px;
}

.summary-result {
    padding: 16px 0;
}

.summary-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 16px;
}

.summary-meta {
    font-size: 13px;
    color: var(--text-lighter);
    font-style: italic;
}

.error-text {
    color: #DC2626;
    font-size: 14px;
}

/* Timeline Responsive */
@media (max-width: 380px) {
    .timeline-actions {
        flex-direction: column;
    }
    
    .filter-tab {
        font-size: 12px;
        padding: 6px 10px;
    }

    .timeline-card {
        padding: 24px;
    }

    .date-text {
        font-size: 16px;
    }

    .timeline-tag {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* Memories Page Styles */
.memories-header-card {
    background: var(--white);
    padding: 24px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px var(--shadow);
}

.memories-header-card h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.memories-subtext {
    font-size: 14px;
    color: var(--text-lighter);
    margin: 0;
    line-height: 1.6;
}

.add-memory-section {
    margin-bottom: 24px;
}

/* Memories Grid */
.memories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.memory-card {
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow);
    cursor: pointer;
    transition: all 0.3s;
}

.memory-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px var(--shadow);
}

.memory-image {
    width: 100%;
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    background-color: var(--background);
    position: relative;
}

.memory-flag-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 138, 122, 0.95);
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.memory-info {
    padding: 12px;
}

.memory-year {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 6px;
}

.memory-caption {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text);
    margin: 0 0 8px 0;
}

.memory-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.key-memory-badge,
.ai-note-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.key-memory-badge {
    background: rgba(245, 210, 118, 0.3);
    color: #D4A017;
}

.ai-note-badge {
    background: rgba(139, 92, 246, 0.2);
    color: #7C3AED;
}

/* Memories Empty State */
.memories-empty {
    text-align: center;
    padding: 80px 20px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 2px 8px var(--shadow);
}

/* Upload Modal Styles */
.upload-preview {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--background);
    border: 2px dashed var(--light-gray);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-placeholder {
    text-align: center;
    color: var(--text-lighter);
}

.preview-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.upload-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Memory Detail */
.memory-detail {
    padding: 0;
}

.memory-detail-image {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.memory-detail-image img {
    width: 100%;
    display: block;
}

.memory-detail-info {
    padding: 0;
}

.memory-year-display {
    font-size: 15px;
    color: var(--primary);
    font-weight: 600;
    margin: 12px 0;
}

.memory-description {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    margin: 12px 0;
}

.key-memory-indicator {
    display: inline-block;
    padding: 8px 14px;
    background: rgba(245, 210, 118, 0.3);
    color: #D4A017;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    margin: 12px 0;
}

/* AI Analysis Section */
.ai-analysis-section {
    background: var(--background);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
}

.ai-analysis-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
}

.analysis-observations {
    margin-bottom: 16px;
}

.observation {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    margin: 8px 0;
}

.analysis-tone {
    font-size: 14px;
    color: var(--text);
    margin: 12px 0;
}

.analysis-flagged {
    background: rgba(255, 138, 122, 0.2);
    color: #DC2626;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    margin: 12px 0;
}

.analysis-suggestion {
    font-size: 14px;
    color: #666;
    font-style: italic;
    margin: 12px 0;
}

.analysis-confidence {
    font-size: 13px;
    color: var(--text-lighter);
    margin: 8px 0;
}

/* Analysis Progress/Result */
.analysis-progress {
    text-align: center;
    padding: 20px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.analysis-result {
    padding: 0;
}

.analysis-result h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
}

/* Memories Responsive */
@media (max-width: 480px) {
    .memories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 320px) {
    .memories-grid {
        grid-template-columns: 1fr;
    }
}

/* Voice Page Styles */
.voice-header-card {
    background: var(--white);
    padding: 24px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px var(--shadow);
}

.voice-header-card h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.voice-subtext {
    font-size: 14px;
    color: var(--text-lighter);
    margin: 0;
    line-height: 1.6;
}

/* Recording Section */
.recording-section {
    margin-bottom: 32px;
}

.recording-card {
    background: var(--white);
    padding: 32px 24px;
    border-radius: 20px;
    box-shadow: 0 2px 8px var(--shadow);
}

.recording-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 24px;
    text-align: center;
}

.recording-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.record-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 40px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(122, 156, 198, 0.3);
    min-width: 200px;
}

.record-button:hover {
    background: #6A8CB6;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(122, 156, 198, 0.4);
}

.record-button:active {
    transform: translateY(0);
}

.record-button.stop {
    background: var(--accent);
    box-shadow: 0 4px 12px rgba(255, 138, 122, 0.3);
}

.record-button.stop:hover {
    background: #EF7A6A;
}

.record-icon {
    font-size: 24px;
}

.recording-status {
    text-align: center;
    padding: 16px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recording-status p {
    font-size: 15px;
    color: var(--text);
    margin: 0;
}

.recording-active {
    color: var(--accent);
    font-weight: 600;
}

/* Waveform Display */
.waveform-display {
    padding: 24px;
    background: var(--background);
    border-radius: 16px;
    text-align: center;
}

.waveform-bars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 80px;
    margin-bottom: 16px;
}

.waveform-bars .bar {
    width: 6px;
    background: var(--primary);
    border-radius: 3px;
    height: 20px;
}

@keyframes waveform {
    0%, 100% {
        height: 20px;
    }
    50% {
        height: 60px;
    }
}

.recording-timer {
    font-size: 32px;
    font-weight: 600;
    color: var(--primary);
    margin: 16px 0 8px;
    font-variant-numeric: tabular-nums;
}

.max-duration-note {
    font-size: 13px;
    color: var(--text-lighter);
    margin: 0;
}

/* Voice Archive */
.voice-archive {
    margin-bottom: 24px;
}

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

.section-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.archive-count {
    font-size: 14px;
    color: var(--text-lighter);
}

.voice-archive-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.voice-entry-card {
    background: var(--white);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 2px 8px var(--shadow);
    cursor: pointer;
    transition: all 0.3s;
    border-left: 4px solid var(--primary);
}

.voice-entry-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.voice-entry-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.voice-type-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.voice-entry-info {
    flex: 1;
}

.voice-date {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 4px 0;
}

.voice-duration {
    font-size: 13px;
    color: var(--text-lighter);
    margin: 0;
}

.voice-entry-type {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.type-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    padding: 4px 12px;
    background: rgba(122, 156, 198, 0.15);
    border-radius: 8px;
}

.voice-flag-badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    padding: 4px 10px;
    background: rgba(255, 138, 122, 0.15);
    border-radius: 8px;
}

/* Voice Empty State */
.voice-empty {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 2px 8px var(--shadow);
}

/* Voice Detail */
.voice-detail {
    padding: 0;
}

.voice-detail-info {
    margin: 20px 0;
}

.voice-meta {
    font-size: 14px;
    color: var(--text);
    margin: 8px 0;
}

.voice-analysis-section {
    background: var(--background);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
}

.voice-analysis-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
}

.analysis-summary {
    margin-bottom: 16px;
}

.analysis-summary p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    margin: 0;
}

.analysis-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    margin: 16px 0;
}

.analysis-status.status-warning {
    background: rgba(255, 138, 122, 0.15);
}

.analysis-status.status-success {
    background: rgba(16, 185, 129, 0.15);
}

.status-icon {
    font-size: 20px;
}

.status-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.analysis-status.status-warning .status-text {
    color: #DC2626;
}

.analysis-status.status-success .status-text {
    color: #059669;
}

/* Analysis Results Modal */
.analysis-results {
    min-height: 100px;
    padding: 16px 0;
}

.analysis-result {
    padding: 0;
}

.timeline-prompt {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid var(--light-gray);
}

.timeline-prompt p {
    font-size: 15px;
    color: var(--text);
    margin-bottom: 16px;
    text-align: center;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

/* Voice Responsive */
@media (max-width: 380px) {
    .record-button {
        padding: 16px 32px;
        min-width: 180px;
        font-size: 15px;
    }
    
    .recording-card {
        padding: 24px 20px;
    }
    
    .voice-entry-card {
        padding: 16px;
    }
}

/* Settings Page Styles */
.settings-section {
    margin-bottom: 24px;
}

.settings-card {
    background: var(--white);
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 2px 8px var(--shadow);
}

.settings-card h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.settings-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 24px 0 16px;
}

.settings-description {
    font-size: 14px;
    color: var(--text-lighter);
    margin-bottom: 24px;
    line-height: 1.6;
}

.settings-select {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--light-gray);
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    background-color: var(--background);
    cursor: pointer;
    transition: border-color 0.3s;
}

.settings-select:focus {
    outline: none;
    border-color: var(--primary);
}

.save-button {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 16px;
}

.save-button:hover {
    background: #6A8CB6;
    transform: translateY(-2px);
}

/* Care Circle */
.primary-member-info {
    margin-bottom: 24px;
}

.member-badge {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #9BB5D6 100%);
    border-radius: 16px;
    color: var(--white);
}

.badge-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.badge-info {
    flex: 1;
}

.badge-label {
    font-size: 13px;
    opacity: 0.9;
    margin: 0 0 4px 0;
}

.badge-name {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.active-users-section h3,
.pending-invites-section h3 {
    margin-top: 0;
}

.active-users-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--background);
    border-radius: 12px;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-icon {
    font-size: 24px;
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 4px 0;
}

.user-email {
    font-size: 13px;
    color: var(--text-lighter);
    margin: 0 0 2px 0;
}

.user-added {
    font-size: 12px;
    color: var(--text-lighter);
    margin: 0;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-role {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
}

.user-role.role-full {
    background: rgba(122, 156, 198, 0.2);
    color: var(--primary);
}

.user-role.role-viewer {
    background: rgba(245, 210, 118, 0.2);
    color: #D4A017;
}

.user-role.role-pending {
    background: rgba(245, 158, 11, 0.2);
    color: #D97706;
}

.pending-card {
    border-left: 3px solid #F59E0B;
}

/* Invite code display */
.invite-code-display {
    margin-top: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #f0f7ff, #e8f4f8);
    border-radius: 16px;
    text-align: center;
}

.invite-code-label {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.invite-code-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--primary);
    padding: 16px;
    background: white;
    border-radius: 12px;
    margin: 12px 0;
    font-family: 'Courier New', monospace;
}

.invite-code-expiry {
    font-size: 13px;
    color: var(--text-lighter);
    margin-top: 8px;
}

.invite-code-hint {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 12px;
}

.invite-code-link {
    font-size: 12px;
    color: var(--primary);
    word-break: break-all;
    margin-top: 4px;
}

.icon-button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s;
}

.icon-button:hover {
    background: rgba(255, 138, 122, 0.15);
}

/* Notification Toggles */
.toggle-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--background);
    border-radius: 12px;
}

.toggle-info {
    flex: 1;
}

.toggle-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 4px 0;
}

.toggle-description {
    font-size: 13px;
    color: var(--text-lighter);
    margin: 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--light-gray);
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: var(--white);
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* AI Mode */
.ai-mode-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-mode-option {
    cursor: pointer;
}

.ai-mode-option input[type="radio"] {
    display: none;
}

.mode-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--background);
    border: 2px solid var(--light-gray);
    border-radius: 16px;
    transition: all 0.3s;
}

.ai-mode-option input[type="radio"]:checked + .mode-card {
    border-color: var(--primary);
    background: rgba(122, 156, 198, 0.1);
}

.mode-card:hover {
    border-color: var(--primary);
}

.mode-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.mode-info {
    flex: 1;
}

.mode-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 4px 0;
}

.mode-description {
    font-size: 14px;
    color: var(--text-lighter);
    margin: 0;
}

/* Data & Privacy */
.data-summary {
    margin-bottom: 24px;
}

.data-summary h3 {
    margin-top: 0;
}

.data-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.data-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 12px;
    background: var(--background);
    border-radius: 12px;
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.stat-label {
    font-size: 12px;
    color: var(--text-lighter);
    margin: 0;
}

.data-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.danger-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.danger-button:hover {
    background: #DC2626;
    transform: translateY(-2px);
}

/* Terms Modal */
.terms-content {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.terms-content h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
}

.terms-content h5 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 20px 0 8px;
}

.terms-content p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 16px;
}

.terms-content::-webkit-scrollbar {
    width: 6px;
}

.terms-content::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 3px;
}

.terms-content::-webkit-scrollbar-thumb {
    background: var(--light-gray);
    border-radius: 3px;
}

.terms-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-lighter);
}

/* Delete Modal */
.warning-text {
    font-size: 14px;
    color: var(--accent);
    line-height: 1.6;
    margin: 16px 0;
    padding: 12px;
    background: rgba(255, 138, 122, 0.1);
    border-radius: 8px;
}

.confirm-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 16px 0 8px;
}

#deleteConfirmInput {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--light-gray);
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    margin-bottom: 16px;
}

#deleteConfirmInput:focus {
    outline: none;
    border-color: var(--accent);
}

/* Settings Responsive */
@media (max-width: 480px) {
    .data-stats {
        grid-template-columns: 1fr;
    }
    
    .user-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .user-actions {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 380px) {
    .settings-card {
        padding: 20px;
    }
    
    .toggle-item {
        padding: 12px;
    }
}

/* Login Splash Screen */
.login-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.6s ease-out;
}

.login-splash.fade-out {
    opacity: 0;
}

.login-splash video {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
    background: #ffffff;
}

/* Login Page Styles */
.login-body {
    background: var(--background);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 20px 120px;
    font-family: 'Inter', 'SF Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.login-container {
    max-width: 440px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.logo-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.login-logo h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.login-subtext {
    font-size: 16px;
    color: var(--text-light);
    line-height: 1.6;
    margin: 0 auto;
    white-space: nowrap;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px 36px;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(176, 139, 187, 0.15);
    width: 100%;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.login-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.login-button {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #F9F5FC 0%, #F0E8F5 100%);
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text);
    box-shadow: 0 2px 8px rgba(176, 139, 187, 0.12);
    text-align: center;
    letter-spacing: 0.2px;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(176, 139, 187, 0.2);
    background: linear-gradient(135deg, #F5EBFC 0%, #EBE0F0 100%);
}

.login-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(176, 139, 187, 0.12);
}

.login-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.login-label {
    flex: 1;
    text-align: center;
}

.login-divider {
    margin: 28px 0;
    text-align: center;
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-divider::before,
.login-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 42%;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(176, 139, 187, 0.2), transparent);
}

.login-divider::before {
    left: 0;
}

.login-divider::after {
    right: 0;
}

.login-divider span {
    background: rgba(255, 255, 255, 0.95);
    padding: 0 20px;
    font-size: 13px;
    color: var(--text-lighter);
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.demo-button {
    width: 100%;
    padding: 14px 24px;
    background: rgba(245, 234, 240, 0.5);
    color: var(--text);
    border: 2px solid rgba(176, 139, 187, 0.15);
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.demo-button:hover {
    border-color: rgba(176, 139, 187, 0.3);
    background: rgba(245, 234, 240, 0.8);
    transform: translateY(-1px);
}

.demo-button:active {
    transform: translateY(0);
}

.demo-description {
    text-align: center;
    font-size: 13px;
    color: var(--text-lighter);
    line-height: 1.5;
    margin: 0;
}

/* ─── Demo Modal ─── */
.demo-modal-content {
    max-width: 440px;
    padding: 32px;
}

.demo-step {
    display: flex;
    flex-direction: column;
}

.demo-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.demo-modal-icon {
    font-size: 36px;
    display: block;
    margin-bottom: 10px;
}

.demo-modal-header h3 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.demo-modal-sub {
    font-size: 14px;
    color: var(--text-lighter);
    margin: 0;
    line-height: 1.5;
}

/* Portal cards */
.demo-portals {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.demo-portal-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    border-radius: 14px;
    border: 2px solid transparent;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    background: var(--bg-secondary, #f8f6f8);
}

.demo-portal-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
}

.demo-portal-card:active {
    transform: translateY(0);
}

.demo-portal-icon {
    font-size: 26px;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.demo-portal-body {
    flex: 1;
}

.demo-portal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}

.demo-portal-desc {
    font-size: 12.5px;
    color: var(--text-lighter);
    line-height: 1.45;
}

.demo-portal-arrow {
    font-size: 18px;
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity 0.2s, transform 0.2s;
}

.demo-portal-card:hover .demo-portal-arrow {
    opacity: 0.8;
    transform: translateX(3px);
}

/* User (Purple) */
.demo-portal-user {
    border-color: rgba(176, 139, 187, 0.25);
}
.demo-portal-user:hover {
    border-color: rgba(176, 139, 187, 0.55);
    background: rgba(245, 234, 248, 0.6);
}
.demo-portal-user .demo-portal-icon {
    background: rgba(176, 139, 187, 0.15);
}

/* Admin (Blue) */
.demo-portal-admin {
    border-color: rgba(37, 99, 235, 0.2);
}
.demo-portal-admin:hover {
    border-color: rgba(37, 99, 235, 0.45);
    background: rgba(239, 246, 255, 0.7);
}
.demo-portal-admin .demo-portal-icon {
    background: rgba(37, 99, 235, 0.1);
}

/* Medical (Teal) */
.demo-portal-medical {
    border-color: rgba(13, 148, 136, 0.2);
}
.demo-portal-medical:hover {
    border-color: rgba(13, 148, 136, 0.45);
    background: rgba(240, 253, 250, 0.7);
}
.demo-portal-medical .demo-portal-icon {
    background: rgba(13, 148, 136, 0.1);
}

/* Shake animation for wrong password */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}
.shake { animation: shake 0.45s ease; }

/* Dark mode for demo modal */
html[data-theme="dark"] .demo-portal-card {
    background: rgba(255,255,255,0.05);
}
html[data-theme="dark"] .demo-portal-user:hover  { background: rgba(176,139,187,0.12); }
html[data-theme="dark"] .demo-portal-admin:hover  { background: rgba(37,99,235,0.12); }
html[data-theme="dark"] .demo-portal-medical:hover { background: rgba(13,148,136,0.12); }

.login-footer {
    text-align: center;
    margin-top: 28px;
}

.login-footer p {
    font-size: 13px;
    color: var(--text-lighter);
    line-height: 1.6;
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.login-footer a:hover {
    color: #8B6FA8;
    text-decoration: underline;
}

/* --- Partnership Banners --- */

.partner-banner {
    text-align: center;
    margin: 20px 0 12px;
}

.partner-banner p {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-lighter, #999);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.partner-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.partner-logos img {
    height: 32px;
    width: auto;
    opacity: 0.55;
    filter: grayscale(40%);
    transition: all 0.3s;
}

.partner-logos img:hover {
    opacity: 0.9;
    filter: grayscale(0%);
}

.partner-footer {
    text-align: center;
    padding: 24px 16px 16px;
    margin-top: 16px;
    margin-bottom: 80px;
    border-top: 1px solid rgba(176, 139, 187, 0.15);
}

.partner-footer p {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-lighter, #999);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.partner-logos-large {
    gap: 24px;
}

.partner-logos-large img {
    height: 40px;
    opacity: 0.7;
}

.partner-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.partner-card span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light, #666);
}

.about-partners {
    text-align: center;
}

.about-partners .partner-logos {
    margin-top: 16px;
}

@media (prefers-color-scheme: dark) {
    .partner-logos img {
        filter: grayscale(40%) brightness(1.4);
    }
    .partner-logos img:hover {
        filter: grayscale(0%) brightness(1.4);
    }
    .partner-footer {
        border-top-color: rgba(255, 255, 255, 0.08);
    }
}

/* Manual dark mode override — partner logos */
html[data-theme="dark"] .partner-logos img {
    filter: grayscale(40%) brightness(1.4);
}
html[data-theme="dark"] .partner-logos img:hover {
    filter: grayscale(0%) brightness(1.4);
}
html[data-theme="dark"] .partner-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
}

/* ===== Account Profile Section ===== */
.account-profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--background);
    border-radius: 12px;
}

.account-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.account-avatar-initials {
    color: white;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}

.account-profile-summary {
    flex: 1;
    min-width: 0;
}

.account-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 2px;
}

.account-email {
    font-size: 14px;
    color: var(--text-lighter);
    margin: 0 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-plan-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
}

.account-plan-badge.premium {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #fff;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* ===== Subscription Plan Section ===== */
.plan-card {
    border: 2px solid var(--primary-light);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    background: var(--background);
}

.plan-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.plan-icon {
    font-size: 32px;
    line-height: 1;
}

.plan-title-row {
    flex: 1;
}

.plan-title-row h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.plan-price {
    font-size: 14px;
    color: var(--text-lighter);
    font-weight: 500;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.plan-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    padding: 6px 0;
    color: var(--text-primary);
}

.plan-feature.included .feature-icon {
    color: #4CAF50;
    font-weight: bold;
}

.plan-feature.locked {
    opacity: 0.55;
}

.plan-feature.locked .feature-icon {
    font-size: 13px;
}

.plan-upgrade-banner {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-light), var(--background));
    border-radius: 12px;
    margin-top: 8px;
}

.plan-upgrade-banner p {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--text-primary);
}

.upgrade-button {
    display: inline-block;
    padding: 12px 32px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.upgrade-button:hover {
    background: var(--accent);
    transform: translateY(-1px);
}

.plan-note {
    font-size: 12px !important;
    color: var(--text-lighter) !important;
    margin-top: 8px !important;
    font-style: italic;
}

@media print {
    .partner-footer {
        display: block;
        border-top: 1px solid #ddd;
    }
    .partner-logos img {
        opacity: 1;
        filter: none;
    }
}

/* Appointments — Dark Mode */
@media (prefers-color-scheme: dark) {
    .appointments-section {
        background: #1e1e30;
    }
    .appointment-card {
        background: #25253a;
    }
    .appointment-card.urgency-critical {
        background: rgba(201, 107, 124, 0.12);
    }
    .appointment-card.urgency-warning {
        background: rgba(245, 166, 35, 0.12);
    }
    .appt-action-btn {
        background: #1e1e30;
        color: var(--text-lighter);
    }
    .appt-action-btn:hover {
        background: #333350;
        color: #fff;
    }
    .appt-type-badge {
        background: rgba(176, 139, 187, 0.3);
        color: #d4b8df;
    }
}

/* Manual dark mode override — appointments */
html[data-theme="dark"] .appointments-section {
    background: #1e1e30;
}
html[data-theme="dark"] .appointment-card {
    background: #25253a;
}
html[data-theme="dark"] .appointment-card.urgency-critical {
    background: rgba(201, 107, 124, 0.12);
}
html[data-theme="dark"] .appointment-card.urgency-warning {
    background: rgba(245, 166, 35, 0.12);
}
html[data-theme="dark"] .appt-action-btn {
    background: #1e1e30;
    color: var(--text-lighter);
}
html[data-theme="dark"] .appt-action-btn:hover {
    background: #333350;
    color: #fff;
}
html[data-theme="dark"] .appt-type-badge {
    background: rgba(176, 139, 187, 0.3);
    color: #d4b8df;
}

/* Onboarding Page Styles */
.onboarding-body {
    background: var(--background);
    min-height: 100vh;
    padding: 20px;
}

.onboarding-container {
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 80px;
}

.onboarding-step {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease-out;
}

.onboarding-step.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: fadeInUp 0.4s ease-out;
}

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

.onboarding-icon {
    font-size: 80px;
    text-align: center;
    margin-bottom: 24px;
}

.onboarding-step h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    margin-bottom: 16px;
}

.onboarding-question {
    font-size: 18px;
    color: var(--text);
    text-align: center;
    margin-bottom: 40px;
    font-weight: 500;
}

.onboarding-text {
    font-size: 16px;
    color: #666;
    text-align: center;
    margin-bottom: 32px;
    line-height: 1.6;
}

.onboarding-subtext {
    font-size: 15px;
    color: var(--text-lighter);
    text-align: center;
    margin-bottom: 32px;
    line-height: 1.6;
}

.onboarding-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 400px;
    margin: 0 auto;
}

.onboarding-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 32px;
    border: none;
    border-radius: 16px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.onboarding-button.primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(122, 156, 198, 0.3);
}

.onboarding-button.primary:hover {
    background: #6A8CB6;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(122, 156, 198, 0.4);
}

.onboarding-button.secondary {
    background: var(--white);
    color: var(--text);
    border: 2px solid var(--light-gray);
}

.onboarding-button.secondary:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.button-icon {
    font-size: 20px;
}

.profile-form {
    background: var(--white);
    padding: 32px;
    border-radius: 24px;
    box-shadow: 0 4px 16px var(--shadow);
}

.profile-form .form-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 20px;
}

/* Progress Dots */
.progress-dots {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
}

.progress-dots .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--light-gray);
    transition: all 0.3s;
}

.progress-dots .dot.active {
    background: var(--primary);
    width: 32px;
    border-radius: 6px;
}

/* Loading Spinner */
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--light-gray);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Logo Styles */

/* Login Page Logo */
.login-logo-img {
    width: 140px;
    height: auto;
    margin: 0 auto 24px;
    display: block;
    animation: logoFadeIn 0.8s ease-out;
}

.admin-logo-img {
    width: 140px;
    height: auto;
    margin: 0 auto 24px;
    display: block;
    animation: logoFadeIn 0.8s ease-out;
}

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

/* Onboarding Logo */
.onboarding-logo {
    width: 100px;
    height: auto;
    margin: 0 auto 24px;
    display: block;
    animation: logoFadeIn 0.8s ease-out;
}

.onboarding-logo-small {
    width: 60px;
    height: auto;
    margin: 0 auto 20px;
    display: block;
    animation: logoFadeIn 0.6s ease-out;
}

/* Home Screen Header Logo */
.header-logo {
    width: 108px;
    height: auto;
    cursor: pointer;
    transition: opacity 0.3s;
    margin-bottom: 8px;
}

.header-logo:hover {
    opacity: 0.8;
}

.header-content {
    flex: 1;
}

/* Page Header Logo */
.page-header-logo {
    width: 48px;
    height: auto;
    position: absolute;
    left: 20px;
    top: 20px;
}

.page-header {
    position: relative;
    padding-left: 80px;
}

/* Logo Watermark */
.logo-watermark {
    position: fixed;
    bottom: 100px;
    right: 16px;
    width: 70px;
    height: 70px;
    background-image: url('logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.10;
    pointer-events: none;
    z-index: 1;
}

/* Calendar View */
.calendar-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1001;
}

.calendar-view.active {
    opacity: 1;
    visibility: visible;
}

.calendar-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.calendar-panel {
    position: absolute;
    background: var(--white);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transition: transform 0.3s ease-out;
}

/* Mobile Calendar (bottom sheet) */
@media (max-width: 768px) {
    .calendar-panel {
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 60vh;
        transform: translateY(100%);
    }
    
    .calendar-view.active .calendar-panel {
        transform: translateY(0);
    }
}

/* Desktop Calendar (sidebar) */
@media (min-width: 769px) {
    .calendar-panel {
        top: 0;
        right: 0;
        bottom: 0;
        width: 380px;
        border-radius: 24px 0 0 24px;
        transform: translateX(100%);
    }
    
    .calendar-view.active .calendar-panel {
        transform: translateX(0);
    }
}

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

.calendar-nav-btn {
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text);
}

.calendar-nav-btn:hover {
    background: var(--background);
}

.calendar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.calendar-controls {
    display: flex;
    gap: 8px;
    padding: 12px 24px;
    border-bottom: 2px solid var(--background);
}

.calendar-control-btn {
    padding: 8px 16px;
    background: var(--background);
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s;
}

.calendar-control-btn:hover {
    background: var(--primary);
    color: var(--white);
}

.calendar-close-btn {
    margin-left: auto;
}

.calendar-grid {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(60vh - 140px);
}

@media (min-width: 769px) {
    .calendar-grid {
        max-height: calc(100vh - 140px);
    }
}

/* Calendar Days Grid */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.calendar-weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-lighter);
    padding: 8px 4px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    background: var(--background);
}

.calendar-day:hover {
    background: var(--primary-light);
    transform: scale(1.05);
}

.calendar-day.today {
    background: var(--primary);
    color: var(--white);
}

.calendar-day.selected {
    background: var(--accent);
    color: var(--white);
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.has-entries {
    border: 2px solid var(--primary);
}

.calendar-day-number {
    font-size: 14px;
}

.calendar-day-dots {
    display: flex;
    gap: 2px;
    margin-top: 2px;
}

.calendar-day-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
}

.calendar-day-dot.type-ai {
    background: #8B5CF6;
}

.calendar-day-dot.type-flag {
    background: #FF8A7A;
}

.calendar-day-dot.type-voice {
    background: #7A9CC6;
}

.calendar-day-dot.type-photo {
    background: #F5D276;
}

.calendar-day-dot.type-note {
    background: #10B981;
}

/* Year View */
.calendar-year-view {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 20px;
}

.calendar-month-mini {
    background: var(--background);
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.calendar-month-mini:hover {
    background: var(--primary-light);
    transform: scale(1.02);
}

.calendar-month-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    text-align: center;
}

.calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-month-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border-radius: 4px;
}

.calendar-month-day.has-entries {
    background: var(--primary);
    color: var(--white);
}

.calendar-month-day.today {
    border: 2px solid var(--primary);
    font-weight: 700;
}

.calendar-month-day.empty {
    visibility: hidden;
}

/* Login/Onboarding Responsive */
@media (max-width: 480px) {
    .login-logo h1 {
        font-size: 24px;
    }

    .login-subtext {
        font-size: 14px;
    }

    .login-logo-img,
    .admin-logo-img {
        width: 120px;
    }

    .login-card {
        padding: 24px;
    }
    
    .onboarding-step h1 {
        font-size: 24px;
    }
    
    .onboarding-logo {
        width: 80px;
    }
    
    .onboarding-logo-small {
        width: 50px;
    }
    
    .profile-form {
        padding: 24px;
    }
    
    .header-logo {
        width: 60px;
    }
    
    .page-header-logo {
        width: 40px;
        left: 16px;
        top: 16px;
    }
    
    .page-header {
        padding-left: 68px;
    }
    
    .logo-watermark {
        width: 50px;
        height: 50px;
        opacity: 0.08;
        bottom: 90px;
    }
    
    .calendar-year-view {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Legal Pages (Privacy Policy, Terms, etc.) */
.legal-page {
    max-width: 720px;
    padding-bottom: 40px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.legal-page .page-header {
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(176, 139, 187, 0.2);
}

.legal-page .page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.legal-content {
    line-height: 1.8;
    color: var(--text);
}

.legal-content h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-top: 36px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(176, 139, 187, 0.15);
}

.legal-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-top: 24px;
    margin-bottom: 8px;
}

.legal-content p {
    margin-bottom: 14px;
    font-size: 15px;
    color: var(--text);
}

.legal-content ul {
    margin-bottom: 14px;
    padding-left: 24px;
}

.legal-content ul li {
    margin-bottom: 8px;
    font-size: 15px;
    color: var(--text);
    line-height: 1.7;
}

.legal-content a {
    color: var(--primary);
    text-decoration: underline;
    transition: var(--transition);
}

.legal-content a:hover {
    color: var(--accent-hover);
}

.legal-content strong {
    font-weight: 600;
}

.legal-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid rgba(176, 139, 187, 0.2);
    text-align: center;
}

.legal-footer p {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 4px;
}

/* Print styles for legal pages */
@media print {
    .legal-page {
        max-width: 100%;
        padding: 0;
    }

    .legal-page .page-header .back-button {
        display: none;
    }

    .legal-content {
        font-size: 12pt;
        line-height: 1.6;
    }

    .legal-content h2 {
        page-break-after: avoid;
    }

    .legal-content h3 {
        page-break-after: avoid;
    }

    .legal-footer {
        margin-top: 24px;
    }
}

@media (max-width: 380px) {
    .legal-page {
        padding: 16px;
        padding-bottom: 32px;
    }

    .legal-page .page-header h1 {
        font-size: 22px;
    }

    .legal-content h2 {
        font-size: 18px;
    }

    .legal-content p,
    .legal-content ul li {
        font-size: 14px;
    }
}

/* Legal highlight boxes */
.legal-content .highlight-box {
    background: #FEF3C7;
    border-left: 4px solid #F59E0B;
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
    margin: 16px 0;
}

.legal-content .highlight-box p {
    margin-bottom: 0;
    font-weight: 500;
}

.legal-content .highlight-box.danger {
    background: #FEE2E2;
    border-left-color: #EF4444;
}

/* Legal links in Settings */
.legal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.link-button {
    display: inline-block;
    padding: 10px 16px;
    background: var(--background);
    color: var(--primary);
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.link-button:hover {
    background: var(--primary-light);
}

/* ============================================
   CONSENT BANNER
   ============================================ */

.consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white, #ffffff);
    padding: 20px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 99999;
    animation: slideUpIn 0.3s ease-out;
    pointer-events: auto;
}

@keyframes slideUpIn {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes slideDownOut {
    from { transform: translateY(0); }
    to { transform: translateY(100%); }
}

.consent-banner-content {
    max-width: 480px;
    margin: 0 auto;
}

.consent-banner-content p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 12px;
}

.consent-banner-content a {
    color: var(--primary);
    text-decoration: underline;
}

.consent-banner-actions {
    display: flex;
    gap: 12px;
}

.consent-accept-btn {
    flex: 1;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    pointer-events: auto;
    transition: var(--transition);
}

.consent-accept-btn:hover {
    opacity: 0.9;
}

.consent-settings-btn {
    padding: 12px 20px;
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    pointer-events: auto;
    transition: var(--transition);
}

.consent-settings-btn:hover {
    background: var(--primary-light);
}

/* ============================================
   LOAD MORE BUTTON (Timeline pagination)
   ============================================ */

.load-more-btn {
    width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    margin-top: 16px;
    transition: var(--transition);
}

.load-more-btn:hover {
    background: var(--primary);
    color: white;
}

/* ============================================
   MEMORY IMAGE LAZY LOADING
   ============================================ */

.memory-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

/* ============================================
   ACCESSIBILITY — Focus Indicators
   ============================================ */

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    z-index: 10000;
    font-weight: 600;
    border-radius: 0 0 8px 0;
    transition: top 0.2s;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.submit-button:focus-visible,
.action-btn:focus-visible,
.nav-btn:focus-visible,
.cancel-button:focus-visible,
.link-button:focus-visible,
.secondary-button:focus-visible,
.back-button:focus-visible,
.filter-tab:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Remove default outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
   SKELETON LOADING SCREENS
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, var(--background) 25%, var(--card-bg) 50%, var(--background) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 12px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    height: 120px;
    margin-bottom: 12px;
    border-radius: 16px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    width: 80%;
    border-radius: 8px;
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-text.medium {
    width: 60%;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.skeleton-grid-item {
    aspect-ratio: 1;
    border-radius: 16px;
}

/* ============================================
   FORCE LIGHT MODE OVERRIDE
   ============================================ */

/* Force light mode override */
html[data-theme="light"] {
    color-scheme: light;
}

/* ============================================
   DARK MODE (follows system preference)
   ============================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --primary: #C4A0CC;
        --primary-light: #D4B5DB;
        --accent: #E8959F;
        --accent-hover: #D4808A;
        --background: #1a1a2e;
        --background-gradient-start: #16213e;
        --background-gradient-end: #1a1a2e;
        --text: #e8e8e8;
        --text-light: #b0b0b0;
        --text-lighter: #a0a0a0;
        --highlight: #4a3f2e;
        --white: #25253a;
        --card-bg: #25253a;
        --light-gray: #3a3a50;
        --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.3);
        --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
        --shadow-inset: inset 2px 2px 6px rgba(0, 0, 0, 0.3), inset -2px -2px 6px rgba(60, 60, 80, 0.2);
        --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.4);
    }

    body {
        color-scheme: dark;
    }

    .modal-content {
        background: #25253a;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    }

    .bottom-nav {
        background: rgba(37, 37, 58, 0.92);
        border: 1px solid rgba(60, 60, 80, 0.4);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    }

    .nav-btn:hover {
        background: rgba(196, 160, 204, 0.1);
    }

    .nav-btn.active {
        background: rgba(255, 158, 158, 0.15);
    }

    img {
        opacity: 0.9;
    }

    .welcome-header {
        background: linear-gradient(135deg, #1e2a4a 0%, #25253a 100%);
    }

    .input-container textarea {
        background-color: #2a2a42;
    }

    .form-group input[type="text"],
    .form-group input[type="date"],
    .form-group input[type="datetime-local"],
    .form-group input[type="tel"],
    .form-group input[type="email"],
    .form-group input[type="password"],
    .form-group select,
    .form-group textarea {
        background-color: #2a2a42;
        border-color: #3a3a50;
        color: #e8e8e8;
    }

    .form-section,
    .settings-card {
        background: #25253a;
    }

    .consent-section {
        background: linear-gradient(135deg, #1e2a4a 0%, #25253a 100%);
        border-color: #C4A0CC;
    }

    .suggestion-card {
        background: #2a2a42;
    }

    /* Dark mode for legal pages */
    .legal-page {
        background: #1a1a2e;
    }

    .legal-content {
        background: #25253a;
        color: #e8e8e8;
    }

    /* Dark mode for consent banner */
    .consent-banner {
        background: #25253a;
        border: 1px solid #3a3a50;
    }

    /* Dark mode for admin pages */
    .admin-sidebar {
        background: #1e1e32;
    }

    .admin-card,
    .stat-card {
        background: #25253a;
    }

    .admin-table th {
        background: #2a2a42;
    }

    .admin-table tr:hover {
        background: #2a2a42;
    }

    /* Dark mode skeleton */
    .skeleton {
        background: linear-gradient(90deg, #2a2a42 25%, #35354e 50%, #2a2a42 75%);
        background-size: 200% 100%;
    }

    /* Dark mode for login page */
    .login-card {
        background: #25253a;
    }

    .auth-button {
        background: #2a2a42;
        border-color: #3a3a50;
        color: #e8e8e8;
    }

    .auth-button:hover {
        background: #35354e;
    }

    /* Dark scrollbars */
    ::-webkit-scrollbar-track {
        background: #1a1a2e;
    }

    ::-webkit-scrollbar-thumb {
        background: #3a3a50;
    }

    /* Fix loading overlay in dark mode */
    #loadingOverlay .loading-spinner + p {
        color: #e8e8e8 !important;
    }
}

/* Manual dark mode override */
html[data-theme="dark"] {
    --primary: #C4A0CC;
    --primary-light: #D4B5DB;
    --accent: #E8959F;
    --accent-hover: #D4808A;
    --background: #1a1a2e;
    --background-gradient-start: #16213e;
    --background-gradient-end: #1a1a2e;
    --text: #e8e8e8;
    --text-light: #b0b0b0;
    --text-lighter: #a0a0a0;
    --highlight: #4a3f2e;
    --white: #25253a;
    --card-bg: #25253a;
    --light-gray: #3a3a50;
    --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-inset: inset 2px 2px 6px rgba(0, 0, 0, 0.3), inset -2px -2px 6px rgba(60, 60, 80, 0.2);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
}

html[data-theme="dark"] .modal-content {
    background: #25253a;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .bottom-nav {
    background: rgba(37, 37, 58, 0.92);
    border: 1px solid rgba(60, 60, 80, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .nav-btn:hover {
    background: rgba(196, 160, 204, 0.1);
}

html[data-theme="dark"] .nav-btn.active {
    background: rgba(255, 158, 158, 0.15);
}

html[data-theme="dark"] img {
    opacity: 0.9;
}

html[data-theme="dark"] .welcome-header {
    background: linear-gradient(135deg, #1e2a4a 0%, #25253a 100%);
}

html[data-theme="dark"] .input-container textarea {
    background-color: #2a2a42;
}

html[data-theme="dark"] .form-group input[type="text"],
html[data-theme="dark"] .form-group input[type="date"],
html[data-theme="dark"] .form-group input[type="datetime-local"],
html[data-theme="dark"] .form-group input[type="tel"],
html[data-theme="dark"] .form-group input[type="email"],
html[data-theme="dark"] .form-group input[type="password"],
html[data-theme="dark"] .form-group select,
html[data-theme="dark"] .form-group textarea {
    background-color: #2a2a42;
    border-color: #3a3a50;
    color: #e8e8e8;
}

html[data-theme="dark"] .form-section,
html[data-theme="dark"] .settings-card {
    background: #25253a;
}

html[data-theme="dark"] .consent-section {
    background: linear-gradient(135deg, #1e2a4a 0%, #25253a 100%);
    border-color: #C4A0CC;
}

html[data-theme="dark"] .suggestion-card {
    background: #2a2a42;
}

html[data-theme="dark"] .legal-page {
    background: #1a1a2e;
}

html[data-theme="dark"] .legal-content {
    background: #25253a;
    color: #e8e8e8;
}

html[data-theme="dark"] .consent-banner {
    background: #25253a;
    border: 1px solid #3a3a50;
}

html[data-theme="dark"] .admin-sidebar {
    background: #1e1e32;
}

html[data-theme="dark"] .admin-card,
html[data-theme="dark"] .stat-card {
    background: #25253a;
}

html[data-theme="dark"] .admin-table th {
    background: #2a2a42;
}

html[data-theme="dark"] .admin-table tr:hover {
    background: #2a2a42;
}

html[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #2a2a42 25%, #35354e 50%, #2a2a42 75%);
    background-size: 200% 100%;
}

html[data-theme="dark"] .login-card {
    background: #25253a;
}

html[data-theme="dark"] .auth-button {
    background: #2a2a42;
    border-color: #3a3a50;
    color: #e8e8e8;
}

html[data-theme="dark"] .auth-button:hover {
    background: #35354e;
}

html[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #1a1a2e;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #3a3a50;
}

html[data-theme="dark"] #loadingOverlay .loading-spinner + p {
    color: #e8e8e8 !important;
}

/* ============================================
   CHAT UI STYLES
   ============================================ */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 400px;
    background: var(--card-bg);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    margin-bottom: 32px;
    transition: height 0.35s ease;
}

.chat-container.collapsed {
    height: auto;
}

.chat-container.collapsed .chat-messages {
    display: none;
}

.chat-container.collapsed .chat-input-area {
    display: none;
}

.chat-container.collapsed .chat-expand-btn {
    display: flex;
}

.chat-expand-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px;
    border: none;
    background: transparent;
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-expand-btn:hover {
    background: rgba(176, 139, 187, 0.06);
}

.chat-expand-btn .expand-arrow {
    font-size: 14px;
    transition: transform 0.3s;
}

.chat-container:not(.collapsed) .chat-expand-btn {
    display: flex;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-lighter);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.chat-container:not(.collapsed) .chat-expand-btn .expand-arrow {
    transform: rotate(180deg);
}

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

.chat-bubble {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
    word-break: break-word;
    animation: bubbleIn 0.3s ease-out;
}

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

.chat-bubble.user {
    background: var(--primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

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

.chat-bubble .timestamp {
    font-size: 12px;
    opacity: 0.6;
    margin-top: 6px;
    display: block;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--light-gray);
    background: var(--card-bg);
    align-items: flex-end;
}

.chat-input-area textarea {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 20px;
    font-family: inherit;
    font-size: 15px;
    resize: none;
    background: var(--background);
    color: var(--text);
    max-height: 100px;
    min-height: 44px;
}

.chat-input-area textarea:focus {
    outline: none;
}

.chat-input-area textarea::placeholder {
    color: var(--text-lighter);
}

.chat-send-btn {
    background: var(--accent);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-loading {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    align-self: flex-start;
}

.chat-loading .dot {
    width: 8px;
    height: 8px;
    background: var(--text-lighter);
    border-radius: 50%;
    animation: chatDots 1.4s infinite both;
}

.chat-loading .dot:nth-child(2) { animation-delay: 0.2s; }
.chat-loading .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatDots {
    0%, 80%, 100% { transform: scale(0.4); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ============================================
   TRENDS / 30-DAY INSIGHTS
   ============================================ */

.trends-section {
    margin-bottom: 32px;
}

.trends-section h3 {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 18px;
    padding-left: 4px;
    color: var(--text);
}

.trends-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.trend-card {
    background: var(--card-bg);
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition);
}

.trend-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.trend-card .trend-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.trend-card .trend-info {
    flex: 1;
}

.trend-card .trend-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.trend-card .trend-status {
    font-size: 13px;
    color: var(--text-light);
}

.trend-card .trend-direction {
    font-size: 22px;
    flex-shrink: 0;
}

.trend-card.improving { border-left: 4px solid #10B981; }
.trend-card.stable { border-left: 4px solid var(--primary); }
.trend-card.declining { border-left: 4px solid #EF4444; }

/* ============================================
   WEEKLY REPORT
   ============================================ */

.report-modal .report-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--light-gray);
}

.report-modal .report-header h3 {
    color: var(--primary);
    font-size: 22px;
    margin-bottom: 4px;
}

.report-modal .report-header .report-dates {
    font-size: 14px;
    color: var(--text-light);
}

.report-section {
    margin-bottom: 20px;
}

.report-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 10px;
}

.report-section ul {
    list-style: none;
    padding: 0;
}

.report-section ul li {
    padding: 8px 0;
    border-bottom: 1px solid var(--light-gray);
    font-size: 14px;
    line-height: 1.5;
}

.report-section ul li:last-child {
    border-bottom: none;
}

.report-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.report-metric {
    background: var(--background);
    padding: 16px;
    border-radius: 12px;
    text-align: center;
}

.report-metric .metric-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.report-metric .metric-label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.print-report-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 8px;
}

.print-report-btn:hover {
    opacity: 0.9;
}

@media print {
    .bottom-nav,
    .print-report-btn,
    .cancel-button {
        display: none !important;
    }

    .modal {
        position: static;
        background: none;
    }

    .modal-content {
        box-shadow: none;
        max-width: 100%;
    }
}

/* ============================================
   OFFLINE BANNER
   ============================================ */

.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #F59E0B;
    color: #1a1a2e;
    text-align: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-banner.visible {
    transform: translateY(0);
}

@media (prefers-color-scheme: dark) {
    .offline-banner {
        background: #D97706;
        color: white;
    }
}

/* Manual dark mode override — offline banner */
html[data-theme="dark"] .offline-banner {
    background: #D97706;
    color: white;
}

/* --- Inline Form Validation --- */

.field-error {
    color: #EF4444;
    font-size: 13px;
    margin-top: 4px;
    display: none;
}

.field-error.visible {
    display: block;
}

.input-error {
    border-color: #EF4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
}

/* --- Confirm Dialog --- */

.confirm-dialog-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

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

.confirm-dialog {
    background: var(--card-bg, #fff);
    border-radius: 20px;
    padding: 28px 24px;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.confirm-dialog-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text, #333);
    margin-bottom: 8px;
}

.confirm-dialog-message {
    font-size: 15px;
    color: var(--text-light, #666);
    line-height: 1.5;
    margin-bottom: 24px;
}

.confirm-dialog-actions {
    display: flex;
    gap: 12px;
}

.confirm-dialog-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-dialog-btn.cancel {
    background: var(--background, #FDF8F3);
    color: var(--text-light, #666);
}

.confirm-dialog-btn.cancel:hover {
    background: #e0d4e6;
}

.confirm-dialog-btn.confirm {
    background: var(--primary, #B08BBB);
    color: white;
}

.confirm-dialog-btn.confirm:hover {
    background: #9a77a5;
}

.confirm-dialog-btn.confirm.danger {
    background: #EF4444;
}

.confirm-dialog-btn.confirm.danger:hover {
    background: #DC2626;
}

@media (prefers-color-scheme: dark) {
    .confirm-dialog {
        background: #25253a;
    }
    .confirm-dialog-btn.cancel {
        background: #333350;
        color: #b0b0b0;
    }
    .confirm-dialog-btn.cancel:hover {
        background: #3d3d5a;
    }
}

/* Manual dark mode override — confirm dialog */
html[data-theme="dark"] .confirm-dialog {
    background: #25253a;
}
html[data-theme="dark"] .confirm-dialog-btn.cancel {
    background: #333350;
    color: #b0b0b0;
}
html[data-theme="dark"] .confirm-dialog-btn.cancel:hover {
    background: #3d3d5a;
}

/* --- Font Size Scaling --- */

html {
    --font-scale: 1;
}

html.font-large {
    --font-scale: 1.2;
}

html.font-xlarge {
    --font-scale: 1.4;
}

html.font-large body,
html.font-xlarge body {
    font-size: calc(16px * var(--font-scale));
    line-height: 1.7;
}

html.font-large h1,
html.font-xlarge h1 {
    font-size: calc(24px * var(--font-scale));
}

html.font-large h2,
html.font-xlarge h2 {
    font-size: calc(20px * var(--font-scale));
}

html.font-large h3,
html.font-xlarge h3 {
    font-size: calc(18px * var(--font-scale));
}

html.font-large .nav-label,
html.font-xlarge .nav-label {
    font-size: calc(12px * var(--font-scale));
}

html.font-large .chat-bubble,
html.font-xlarge .chat-bubble {
    font-size: calc(15px * var(--font-scale));
}

html.font-large .settings-description,
html.font-xlarge .settings-description {
    font-size: calc(14px * var(--font-scale));
}

html.font-large input,
html.font-large select,
html.font-large textarea,
html.font-xlarge input,
html.font-xlarge select,
html.font-xlarge textarea {
    font-size: calc(16px * var(--font-scale));
}

html.font-large .mode-label,
html.font-xlarge .mode-label {
    font-size: calc(16px * var(--font-scale));
}

html.font-large .mode-description,
html.font-xlarge .mode-description {
    font-size: calc(13px * var(--font-scale));
}

html.font-large .suggestion-card .text,
html.font-xlarge .suggestion-card .text {
    font-size: calc(14px * var(--font-scale));
}

html.font-large .toggle-label,
html.font-xlarge .toggle-label {
    font-size: calc(16px * var(--font-scale));
}

html.font-large .toggle-description,
html.font-xlarge .toggle-description {
    font-size: calc(13px * var(--font-scale));
}

/* Font size preview text in settings */
.font-size-preview {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--background);
    border-radius: 12px;
    font-size: calc(14px * var(--font-scale, 1));
    color: var(--text-light);
    text-align: center;
}

/* --- Emergency Help Nav Button --- */

.nav-btn-logout {
    color: var(--text-lighter, #999) !important;
    opacity: 0.75 !important;
}

.nav-btn-logout:hover {
    opacity: 1 !important;
    color: #e05252 !important;
    background: rgba(224, 82, 82, 0.08) !important;
}

.nav-btn-logout:hover .nav-icon,
.nav-btn-logout:hover .nav-label {
    color: #e05252 !important;
}

/* On mobile bottom nav — hide logout (it's in settings header) */
.nav-btn-logout {
    display: none;
}

/* Desktop sidebar — show it */
@media (min-width: 768px) {
    .nav-btn-logout {
        display: flex;
    }
}

.nav-btn-help {
    color: var(--accent, #C96B7C) !important;
    opacity: 0.85 !important;
    min-width: 52px;
    padding: 10px 8px;
}

.nav-btn-help:hover {
    opacity: 1 !important;
    background: rgba(201, 107, 124, 0.1);
}

.nav-btn-help .nav-icon {
    color: var(--accent, #C96B7C);
}

.nav-btn-help .nav-label {
    font-size: 10px;
    color: var(--accent, #C96B7C);
}

.help-resources-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
}

.help-resources-modal.active {
    display: flex;
}

.help-resources-content {
    background: var(--card-bg, #fff);
    border-radius: 20px;
    padding: 28px 24px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.help-resources-content h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text, #333);
    margin-bottom: 16px;
    text-align: center;
}

.help-resource-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    margin-bottom: 10px;
    background: var(--background, #FDF8F3);
    border-radius: 14px;
    text-decoration: none;
    color: var(--text, #333);
    transition: all 0.2s;
}

.help-resource-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.help-resource-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.help-resource-info {
    flex: 1;
}

.help-resource-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.help-resource-detail {
    font-size: 13px;
    color: var(--text-light, #666);
}

.help-resources-close {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    background: transparent;
    border: 2px solid var(--background, #FDF8F3);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-light, #666);
    cursor: pointer;
    transition: all 0.2s;
}

.help-resources-close:hover {
    background: var(--background, #FDF8F3);
}

@media (prefers-color-scheme: dark) {
    .help-resources-content {
        background: #25253a;
    }
    .help-resource-item {
        background: #333350;
    }
    .help-resource-item:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    .help-resources-close {
        border-color: #333350;
        color: #b0b0b0;
    }
    .help-resources-close:hover {
        background: #333350;
    }
}

/* Manual dark mode override — help resources */
html[data-theme="dark"] .help-resources-content {
    background: #25253a;
}
html[data-theme="dark"] .help-resource-item {
    background: #333350;
}
html[data-theme="dark"] .help-resource-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
html[data-theme="dark"] .help-resources-close {
    border-color: #333350;
    color: #b0b0b0;
}
html[data-theme="dark"] .help-resources-close:hover {
    background: #333350;
}

/* ── Settings Tabs ── */
.settings-tabs {
    display: flex;
    gap: 4px;
    background: var(--background, #FDF8F3);
    border-radius: 14px;
    padding: 4px;
    margin: 0 16px 16px;
}

.settings-tab-btn {
    flex: 1;
    padding: 10px 8px;
    border: none;
    border-radius: 11px;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light, #666);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.settings-tab-btn.active {
    background: var(--card-bg, #FFFFFF);
    color: var(--primary, #B08BBB);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
}

@media (prefers-color-scheme: dark) {
    .settings-tabs {
        background: #25253a;
    }
    .settings-tab-btn.active {
        background: #333350;
        color: var(--primary, #B08BBB);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    }
}

/* Manual dark mode override — settings tabs */
html[data-theme="dark"] .settings-tabs {
    background: #25253a;
}
html[data-theme="dark"] .settings-tab-btn.active {
    background: #333350;
    color: var(--primary, #B08BBB);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* ── Settings: Patient Profile Picture ── */
.settings-profile-picture {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 0;
}

.settings-avatar-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 8px;
}

.settings-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--primary, #B08BBB);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(176, 139, 187, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background-size: cover;
    background-position: center;
}

.settings-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(176, 139, 187, 0.4);
}

.settings-avatar .placeholder-icon {
    font-size: 40px;
    color: white;
}

.settings-avatar-edit-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--card-bg, #fff);
    border: 2px solid var(--primary, #B08BBB);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: background 0.2s ease;
    padding: 0;
}

.settings-avatar-edit-btn:hover {
    background: var(--background-gradient-start, #F5EAF0);
}

.settings-avatar-hint {
    font-size: 13px;
    color: var(--text-lighter, #888);
    text-align: center;
}

@media (prefers-color-scheme: dark) {
    .settings-avatar-edit-btn {
        background: #333350;
        border-color: var(--primary, #B08BBB);
    }
    .settings-avatar-edit-btn:hover {
        background: #3e3e5a;
    }
}

/* Manual dark mode override — settings avatar */
html[data-theme="dark"] .settings-avatar-edit-btn {
    background: #333350;
    border-color: var(--primary, #B08BBB);
}
html[data-theme="dark"] .settings-avatar-edit-btn:hover {
    background: #3e3e5a;
}

/* ── Onboarding Sub-steps ── */
.substep {
    display: none;
}

.substep.active {
    display: block;
    animation: fadeInUp 0.3s ease;
}

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

.substep-progress {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary, #B08BBB);
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.substep-nav {
    display: flex;
    gap: 12px;
}

.substep-nav .secondary-button {
    flex: 0 0 auto;
    min-width: 80px;
}

.substep-nav .submit-button {
    flex: 1;
}

.onboarding-reassurance {
    font-size: 13px;
    color: var(--text-light, #666);
    text-align: center;
    margin: 12px 0 4px;
    font-style: italic;
}

/* ── App Tour Overlay ── */
.tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 11000;
    pointer-events: none;
}

.tour-overlay.active {
    pointer-events: auto;
}

.tour-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 11000;
    transition: opacity 0.3s;
}

.tour-highlight {
    position: absolute;
    z-index: 11001;
    border-radius: 16px;
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.55);
    transition: all 0.35s ease;
    pointer-events: none;
}

.tour-tooltip {
    position: absolute;
    z-index: 11002;
    background: var(--card-bg, #FFFFFF);
    border-radius: 16px;
    padding: 20px;
    max-width: 300px;
    width: calc(100vw - 48px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    animation: fadeInUp 0.3s ease;
}

.tour-tooltip-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark, #2D2D3A);
    margin-bottom: 6px;
}

.tour-tooltip-text {
    font-size: 14px;
    color: var(--text-light, #666);
    line-height: 1.5;
    margin-bottom: 16px;
}

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

.tour-dots {
    display: flex;
    gap: 6px;
}

.tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--background, #FDF8F3);
    transition: background 0.2s;
}

.tour-dot.active {
    background: var(--primary, #B08BBB);
}

.tour-next-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 10px;
    background: var(--primary, #B08BBB);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.tour-next-btn:hover {
    opacity: 0.9;
}

.tour-skip {
    font-size: 13px;
    color: var(--text-lighter, #767676);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
}

.tour-skip:hover {
    color: var(--text-dark, #2D2D3A);
}

@media (prefers-color-scheme: dark) {
    .tour-tooltip {
        background: #25253a;
    }
    .tour-dot {
        background: #333350;
    }
}

/* Manual dark mode override — tour tooltip */
html[data-theme="dark"] .tour-tooltip {
    background: #25253a;
}
html[data-theme="dark"] .tour-dot {
    background: #333350;
}

/* ── Fix 17: Tablet Layout (768px+) ── */
@media (min-width: 768px) {
    .app-container {
        max-width: 720px;
        padding: 32px 32px 120px;
    }

    .bottom-nav {
        max-width: 600px;
    }

    .chat-container {
        height: 500px;
    }

    .actions-scroll {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }

    .data-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .settings-tabs {
        max-width: 480px;
        margin-left: auto;
        margin-right: auto;
    }

    /* Two-column layout for memory grid on tablets */
    .memories-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .trends-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Fix 18: Dashboard Loading Skeletons ── */
.dashboard-skeleton {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.skeleton-chat {
    height: 300px;
    border-radius: var(--border-radius-md);
}

.skeleton-actions {
    display: flex;
    gap: 12px;
}

.skeleton-action-item {
    flex: 1;
    height: 56px;
    border-radius: 16px;
}

.skeleton-suggestions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-suggestion {
    height: 72px;
    border-radius: 16px;
}

.skeleton-trends {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.skeleton-trend {
    height: 100px;
    border-radius: 16px;
}

/* ── Fix 22: Focus-Visible Styles ── */
:focus-visible {
    outline: 3px solid var(--primary, #B08BBB);
    outline-offset: 2px;
    border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
.nav-btn:focus-visible {
    outline: 3px solid var(--primary, #B08BBB);
    outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--primary, #B08BBB);
    outline-offset: 0;
    border-color: var(--primary, #B08BBB);
}

.settings-tab-btn:focus-visible {
    outline: 3px solid var(--primary, #B08BBB);
    outline-offset: -2px;
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
   GETTING STARTED CARD
   ============================================ */
.getting-started-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-sm);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-soft);
    border-left: 4px solid var(--primary);
}

.getting-started-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.getting-started-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.getting-started-dismiss {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-lighter);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.getting-started-desc {
    font-size: 13px;
    color: var(--text-lighter);
    margin: 0 0 14px;
}

.getting-started-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.getting-started-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--background);
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
}

.getting-started-step:hover {
    background: var(--primary-light);
    transform: translateX(4px);
}

.getting-started-step.completed {
    opacity: 0.5;
}

.gs-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.gs-text {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.gs-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--text-lighter);
    flex-shrink: 0;
}

.getting-started-step.completed .gs-check {
    border-color: var(--primary);
    background: var(--primary);
    position: relative;
}

.getting-started-step.completed .gs-check::after {
    content: '✓';
    color: white;
    font-size: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ============================================
   FLOATING AI CHAT BUTTON
   ============================================ */
.floating-chat-btn {
    display: none; /* hidden on dashboard (index.html has its own chat) */
    position: fixed;
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 90;
    font-size: 24px;
    transition: var(--transition);
    align-items: center;
    justify-content: center;
}

.floating-chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

.floating-chat-btn.visible {
    display: flex;
}

@media (min-width: 1024px) {
    .floating-chat-btn {
        bottom: 32px;
        right: 32px;
    }
}

/* ============================================
   SIDEBAR PATIENT INFO (desktop only)
   ============================================ */
.sidebar-patient-info {
    display: none;
}

@media (min-width: 1024px) {
    .sidebar-patient-info {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 16px 12px;
        margin-bottom: 16px;
        border-bottom: 1px solid rgba(176, 139, 187, 0.15);
    }

    .sidebar-avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: var(--primary-light);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        font-weight: 600;
        color: var(--text);
        flex-shrink: 0;
        overflow: hidden;
    }

    .sidebar-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .sidebar-patient-name {
        font-size: 14px;
        font-weight: 600;
        color: var(--text);
        line-height: 1.3;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sidebar-patient-sub {
        font-size: 11px;
        color: var(--text-lighter);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ============================================
   DESKTOP LAYOUT (1024px+) — Sidebar Navigation
   ============================================ */
@media (min-width: 1024px) {

    /* Bottom nav becomes fixed left sidebar */
    .bottom-nav {
        position: fixed;
        bottom: auto;
        left: 0;
        top: 0;
        transform: none;
        width: 220px;
        max-width: 220px;
        height: 100vh;
        flex-direction: column;
        justify-content: flex-start;
        padding: 28px 12px 24px;
        gap: 4px;
        border-radius: 0;
        border: none;
        border-right: 1px solid rgba(176, 139, 187, 0.12);
        box-shadow: 2px 0 20px rgba(124, 58, 237, 0.06);
        background: #ffffff;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        z-index: 100;
        overflow-y: auto;
    }

    /* Nav buttons: icon beside label (row layout) */
    .nav-btn {
        flex-direction: row;
        justify-content: flex-start;
        gap: 10px;
        padding: 11px 14px;
        min-width: unset;
        width: 100%;
        border-radius: 10px;
        opacity: 1;
        font-size: 14px;
        font-weight: 500;
        color: #6B7280;
        transition: background 0.15s ease, color 0.15s ease;
    }

    .nav-btn:hover {
        background: rgba(124, 58, 237, 0.06);
        color: #7C3AED;
        opacity: 1;
        transform: none;
    }

    .nav-btn.active {
        background: rgba(124, 58, 237, 0.10);
        color: #7C3AED;
        font-weight: 600;
    }

    .nav-label {
        font-size: 14px;
    }

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

    /* Sidebar logo area — space for patient info injected by JS */
    .sidebar-patient-info {
        margin-bottom: 12px;
        padding-bottom: 16px;
        border-bottom: 1px solid rgba(176, 139, 187, 0.12);
        width: 100%;
    }

    /* Push body content past the fixed 220px sidebar */
    body:not(.login-body):not(.onboarding-body) {
        padding-left: 220px;
    }

    /* Main content: sits after sidebar, max readable width */
    .app-container {
        max-width: 860px;
        margin-left: 0;
        margin-right: auto;
        padding: 40px 48px 60px 40px;
    }

    /* Login, onboarding pages — no sidebar, keep centered */
    .login-body {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .onboarding-body {
        display: block;
    }

    .login-body .app-container,
    .onboarding-body .app-container {
        margin-left: auto;
        margin-right: auto;
    }

    /* Dashboard: 2-column trends + suggestions */
    .trends-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .suggestions-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    /* Memories: 4-column grid */
    .memories-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Settings: wider tabs */
    .settings-tabs {
        max-width: 600px;
    }

    /* Chat: taller */
    .chat-container {
        height: 550px;
    }

    /* Calendar panel: wider */
    .calendar-panel {
        width: 420px;
    }

    /* Data stats: 3 columns */
    .data-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Modals: wider on desktop */
    .modal-content {
        max-width: 560px;
    }

    /* Profile header: bigger avatar */
    .profile-avatar {
        width: 120px;
        height: 120px;
    }
}

/* Desktop dark mode sidebar */
@media (min-width: 1024px) {
    html[data-theme="dark"] .bottom-nav {
        background: rgba(37, 37, 58, 0.95);
        border-right: 1px solid rgba(60, 60, 80, 0.4);
        box-shadow: 2px 0 16px rgba(0, 0, 0, 0.3);
    }
}

@media (prefers-color-scheme: dark) {
    @media (min-width: 1024px) {
        :root .bottom-nav {
            background: rgba(37, 37, 58, 0.95);
            border-right: 1px solid rgba(60, 60, 80, 0.4);
            box-shadow: 2px 0 16px rgba(0, 0, 0, 0.3);
        }
    }
}

/* ═══════════════════════════════════════════════════════════
   GLOBAL CHAT WIDGET (chatWidget.js)
   ═══════════════════════════════════════════════════════════ */

.cw-widget {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 9999;
    pointer-events: none;
}

/* ── FAB (floating action button) ───────────── */

.cw-fab {
    pointer-events: auto;
    position: fixed;
    bottom: 88px;
    right: 20px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary, #B08BBB), var(--accent, #9B6BA0));
    color: white;
    border: none;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    transition: transform 0.25s, opacity 0.25s, box-shadow 0.25s;
    animation: cwFabPulse 3s ease-in-out infinite;
}

@keyframes cwFabPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(0,0,0,0.18); }
    50% { box-shadow: 0 4px 24px rgba(176,139,187,0.45); }
}

.cw-fab:hover {
    transform: scale(1.1);
}

.cw-fab:active {
    transform: scale(0.95);
}

.cw-fab-hidden {
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
}

.cw-fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #E07A5F;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* ── Chat Box ───────────────────────────────── */

.cw-box {
    pointer-events: auto;
    position: fixed;
    bottom: 88px;
    right: 16px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 480px;
    max-height: calc(100vh - 140px);
    background: var(--card-bg, #fff);
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    border: 1px solid var(--light-gray, #e8e0ec);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cw-box.cw-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ── Header ────────────────────────────────── */

.cw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--primary, #B08BBB), var(--accent, #9B6BA0));
    color: #fff;
    flex-shrink: 0;
}

.cw-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cw-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.cw-avatar-img {
    /* Fill the circle. The logo PNG is a transparent pinwheel with
       generous internal padding, so scaling to ~130 % of the container
       pushes the petals out to the visible edge without clipping them. */
    width: 130%;
    height: 130%;
    object-fit: contain;
    display: block;
}

.cw-title {
    font-size: 15px;
    font-weight: 700;
    display: block;
    line-height: 1.2;
}

.cw-status {
    font-size: 11px;
    opacity: 0.8;
    display: block;
}

.cw-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.cw-close:hover {
    background: rgba(255,255,255,0.35);
}

/* ── Messages ──────────────────────────────── */

.cw-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light, #D3BDE0) transparent;
}

.cw-messages::-webkit-scrollbar {
    width: 4px;
}
.cw-messages::-webkit-scrollbar-thumb {
    background: var(--primary-light, #D3BDE0);
    border-radius: 4px;
}

.cw-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: cwBubbleIn 0.25s ease;
}

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

.cw-user {
    align-self: flex-end;
    background: var(--primary, #B08BBB);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.cw-assistant {
    align-self: flex-start;
    background: var(--background, #FAF5FF);
    color: var(--text-primary);
    border: 1px solid var(--light-gray, #e8e0ec);
    border-bottom-left-radius: 4px;
}

.cw-bubble-text {
    word-wrap: break-word;
}

.cw-time {
    display: block;
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
}

/* ── Typing indicator ──────────────────────── */

.cw-typing {
    display: flex;
    gap: 5px;
    padding: 10px 14px;
    align-self: flex-start;
}

.cw-typing span {
    width: 8px;
    height: 8px;
    background: var(--primary-light, #D3BDE0);
    border-radius: 50%;
    animation: cwDot 1.2s ease-in-out infinite;
}

.cw-typing span:nth-child(2) { animation-delay: 0.2s; }
.cw-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cwDot {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── Input area ────────────────────────────── */

.cw-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--light-gray, #e8e0ec);
    flex-shrink: 0;
    background: var(--card-bg, #fff);
}

.cw-input-area textarea {
    flex: 1;
    border: 1.5px solid var(--light-gray, #e8e0ec);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    background: var(--background, #FAF5FF);
    color: var(--text-primary);
    max-height: 80px;
    transition: border-color 0.2s;
}

.cw-input-area textarea:focus {
    border-color: var(--primary, #B08BBB);
}

.cw-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary, #B08BBB);
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}

.cw-send-btn:hover {
    background: var(--accent, #9B6BA0);
}

.cw-send-btn:active {
    transform: scale(0.92);
}

.cw-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Desktop adjustments ───────────────────── */

@media (min-width: 1024px) {
    .cw-fab {
        bottom: 32px;
        right: 32px;
    }
    .cw-box {
        bottom: 32px;
        right: 24px;
        width: 380px;
        height: 520px;
    }
}

/* ── Dark Mode ─────────────────────────────── */

html[data-theme="dark"] .cw-box {
    background: #1e1e30;
    border-color: #3a3a50;
}

html[data-theme="dark"] .cw-assistant {
    background: #2a2a42;
    border-color: #3a3a50;
}

html[data-theme="dark"] .cw-input-area {
    background: #1e1e30;
    border-color: #3a3a50;
}

html[data-theme="dark"] .cw-input-area textarea {
    background: #2a2a42;
    border-color: #3a3a50;
    color: #e8e8e8;
}

/* ═══════════════════════════════════════════════════════════
   JOURNAL TIMELINE FORMAT (from Lab Concept E)
   ═══════════════════════════════════════════════════════════ */

.concept-letter-e {
    background: linear-gradient(135deg, #8B9BA0, #6B7B80);
    box-shadow: 0 2px 8px rgba(139,155,160,0.3);
}

/* ── Filter bar ────────────────────────────── */

.je-filters {
    display: flex;
    gap: 6px;
    padding: 12px 18px 10px;
    background: var(--background, #FAF5FF);
    border-bottom: none;
}

.je-filter {
    padding: 8px 16px;
    border: none;
    background: var(--background, #FAF5FF);
    color: var(--text-secondary, #999);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s;
    letter-spacing: 0.2px;
    box-shadow: var(--shadow-soft, 4px 4px 8px rgba(176,139,187,0.1), -4px -4px 8px rgba(255,255,255,0.7));
}

.je-filter:hover {
    color: var(--text-primary);
    box-shadow: var(--shadow-hover, 6px 6px 12px rgba(176,139,187,0.15), -4px -4px 8px rgba(255,255,255,0.8));
}

.je-filter.active {
    color: #fff;
    background: var(--primary, #B08BBB);
    box-shadow: var(--shadow-inset, inset 2px 2px 4px rgba(0,0,0,0.1), inset -2px -2px 4px rgba(255,255,255,0.1));
}

/* ── Stream ────────────────────────────────── */

.je-stream {
    padding: 8px 18px 18px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light, #D3BDE0) transparent;
    background: var(--background, #FAF5FF);
}

/* Inside lab panels, constrain height */
.lab-panel .je-stream {
    max-height: 600px;
    border-radius: 0 0 20px 20px;
}

.je-stream::-webkit-scrollbar { width: 3px; }
.je-stream::-webkit-scrollbar-thumb {
    background: var(--primary-light, #D3BDE0);
    border-radius: 3px;
}

.je-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary, #999);
    font-size: 14px;
}

/* ── Day group ─────────────────────────────── */

.je-day {
    opacity: 0;
    animation: jeFadeIn 0.4s ease forwards;
}

.je-day + .je-day {
    margin-top: 4px;
}

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

.je-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    margin-bottom: 6px;
    position: sticky;
    top: 0;
    background: var(--background, #FAF5FF);
    border-radius: 12px;
    z-index: 2;
    box-shadow: var(--shadow-inset, inset 3px 3px 6px rgba(176,139,187,0.08), inset -3px -3px 6px rgba(255,255,255,0.8));
}

.je-day-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.je-mood-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.je-mood-good    { background: #7BC67E; }
.je-mood-neutral { background: #D4C78A; }
.je-mood-concern { background: #D4766A; }

.je-day-date {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.je-flag-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #D4766A;
    flex-shrink: 0;
}

.je-day-count {
    font-size: 11px;
    color: var(--text-secondary, #aaa);
    font-weight: 500;
    min-width: 18px;
    text-align: center;
}

/* ── Entry row ─────────────────────────────── */

.je-entry {
    display: flex;
    gap: 14px;
    padding: 12px 14px;
    margin-bottom: 8px;
    opacity: 0;
    animation: jeFadeIn 0.35s ease forwards;
    background: var(--card-bg, #fff);
    border-radius: 16px;
    box-shadow: var(--shadow-soft, 6px 6px 12px rgba(176,139,187,0.12), -6px -6px 12px rgba(255,255,255,0.8));
    transition: box-shadow 0.2s, transform 0.2s;
}

.je-entry:hover {
    box-shadow: var(--shadow-hover, 8px 8px 16px rgba(176,139,187,0.18), -6px -6px 12px rgba(255,255,255,0.9));
    transform: translateY(-1px);
}

.je-entry + .je-entry {
    /* gap handled by margin-bottom */
}

/* Flagged entry — left accent + slightly tinted */
.je-entry-flagged {
    border-left: 3px solid #D4766A;
}

.je-entry-flagged .je-content {
    padding-left: 8px;
}

/* ── Time rail (left column) ───────────────── */

.je-time-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 52px;
    min-width: 52px;
    padding-top: 2px;
}

.je-time {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary, #aaa);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.je-type-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin: 6px 0 4px;
    flex-shrink: 0;
}

.je-rail-line {
    width: 1px;
    flex: 1;
    min-height: 16px;
    background: var(--light-gray, #e0dce4);
}

/* ── Content (right column) ────────────────── */

.je-content {
    flex: 1;
    min-width: 0;
    padding-bottom: 4px;
}

.je-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.je-type-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.je-flag-badge {
    font-size: 10px;
    font-weight: 600;
    color: #D4766A;
    background: rgba(212,118,106,0.1);
    padding: 1px 7px;
    border-radius: 4px;
    letter-spacing: 0.2px;
}

/* THE STAR — the actual content */
.je-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0;
    /* Elegant serif option — uncomment to try:
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 14.5px;
    */
}

.je-tags {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.je-tag {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary, #aaa);
    background: var(--background, #FAF5FF);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.2px;
}

/* ── Dark mode (Journal) ─────────────────────────────── */

html[data-theme="dark"] .je-filters {
    background: #1a1a2e;
}

html[data-theme="dark"] .je-filter {
    background: #252540;
    box-shadow: 3px 3px 6px rgba(0,0,0,0.3), -3px -3px 6px rgba(50,50,70,0.2);
}

html[data-theme="dark"] .je-filter.active {
    background: var(--primary, #B08BBB);
    color: #fff;
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.2), inset -2px -2px 4px rgba(255,255,255,0.05);
}

html[data-theme="dark"] .je-day-header {
    background: #252540;
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.2), inset -2px -2px 4px rgba(50,50,70,0.15);
}

html[data-theme="dark"] .je-entry {
    background: #1e1e30;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.3), -3px -3px 8px rgba(50,50,70,0.15);
}

html[data-theme="dark"] .je-entry:hover {
    box-shadow: 5px 5px 12px rgba(0,0,0,0.35), -3px -3px 8px rgba(50,50,70,0.2);
}

html[data-theme="dark"] .je-rail-line {
    background: #3a3a50;
}

html[data-theme="dark"] .je-tag {
    background: #2a2a42;
}

html[data-theme="dark"] .je-entry-flagged {
    border-left-color: #D4766A;
}

html[data-theme="dark"] .je-stream {
    background: #1a1a2e;
}

html[data-theme="dark"] .je-page-header,
html[data-theme="dark"] .je-week-strip,
html[data-theme="dark"] .je-cal-toggle {
    background: #1a1a2e;
}

html[data-theme="dark"] .je-calendar {
    background: #252540;
    box-shadow: 4px 4px 10px rgba(0,0,0,0.3), -4px -4px 10px rgba(50,50,70,0.1);
}

html[data-theme="dark"] .je-ws-day {
    background: #252540;
    box-shadow: 3px 3px 6px rgba(0,0,0,0.3), -3px -3px 6px rgba(50,50,70,0.15);
}

html[data-theme="dark"] .je-ws-today {
    background: #2a2a42;
}

html[data-theme="dark"] .je-cal-day {
    background: #252540;
}

html[data-theme="dark"] .je-cal-pad {
    background: transparent;
}

/* ── Full Page Chrome ──────────────────────── */

/* ── Page header ───────────────────────────── */

.je-page-header {
    padding: 14px 18px 8px;
    background: var(--background, #FAF5FF);
}

.je-page-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.je-page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.3px;
}

.je-page-subtitle {
    font-size: 12px;
    color: var(--text-secondary, #aaa);
    font-weight: 500;
}

.je-page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.je-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    border: none;
    background: var(--background, #FAF5FF);
    color: var(--text-secondary, #999);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-soft, 5px 5px 10px rgba(176,139,187,0.12), -5px -5px 10px rgba(255,255,255,0.8));
}

.je-action-btn:hover {
    color: var(--primary, #B08BBB);
    box-shadow: var(--shadow-hover, 7px 7px 14px rgba(176,139,187,0.18), -5px -5px 10px rgba(255,255,255,0.9));
    transform: translateY(-1px);
}

.je-action-btn:active {
    box-shadow: var(--shadow-inset, inset 3px 3px 6px rgba(176,139,187,0.12), inset -3px -3px 6px rgba(255,255,255,0.7));
    transform: translateY(0);
}

.je-action-btn.je-action-primary {
    background: var(--primary, #B08BBB);
    color: #fff;
    box-shadow: 4px 4px 10px rgba(176,139,187,0.3), -4px -4px 10px rgba(255,255,255,0.6);
}

.je-action-btn.je-action-primary:hover {
    box-shadow: 6px 6px 14px rgba(176,139,187,0.4), -4px -4px 10px rgba(255,255,255,0.7);
}

/* ── Week-at-a-glance strip ────────────────── */

.je-week-strip {
    display: flex;
    gap: 6px;
    padding: 8px 18px 12px;
    justify-content: space-between;
    background: var(--background, #FAF5FF);
}

.je-ws-day {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 0 6px;
    border: none;
    background: var(--background, #FAF5FF);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    box-shadow: var(--shadow-soft, 4px 4px 8px rgba(176,139,187,0.1), -4px -4px 8px rgba(255,255,255,0.7));
}

.je-ws-day:hover {
    box-shadow: var(--shadow-hover, 6px 6px 12px rgba(176,139,187,0.15), -4px -4px 8px rgba(255,255,255,0.8));
    transform: translateY(-1px);
}

.je-ws-today {
    background: var(--card-bg, #fff);
    box-shadow: var(--shadow-soft, 5px 5px 10px rgba(176,139,187,0.12), -5px -5px 10px rgba(255,255,255,0.8));
}

.je-ws-selected {
    background: var(--primary, #B08BBB) !important;
    box-shadow: var(--shadow-inset, inset 3px 3px 6px rgba(0,0,0,0.12), inset -3px -3px 6px rgba(255,255,255,0.15)) !important;
}

.je-ws-selected .je-ws-name,
.je-ws-selected .je-ws-num,
.je-ws-selected .je-ws-count {
    color: #fff !important;
}

.je-ws-name {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary, #aaa);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.je-ws-num {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.je-ws-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 2px;
}

.je-ws-good    { background: #7BC67E; }
.je-ws-neutral { background: #D4C78A; }
.je-ws-concern { background: #D4766A; }
.je-ws-empty   { background: transparent; }

.je-ws-count {
    font-size: 9px;
    color: var(--text-secondary, #bbb);
    font-weight: 600;
}

/* ── Calendar toggle + inline calendar ─────── */

.je-cal-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px 8px;
    background: var(--background, #FAF5FF);
}

.je-cal-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #999);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.2s;
}

.je-cal-btn:hover {
    color: var(--primary, #B08BBB);
}

.je-cal-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.je-date-showing {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary, #B08BBB);
}

.je-clear-date {
    font-size: 11px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #999);
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.je-clear-date:hover {
    color: var(--primary);
}

/* ── Calendar grid ─────────────────────────── */

.je-calendar {
    margin: 0 18px 12px;
    padding: 12px;
    background: var(--card-bg, #fff);
    border-radius: 16px;
    box-shadow: var(--shadow-soft, 4px 4px 10px rgba(176,139,187,0.12), -4px -4px 10px rgba(255,255,255,0.8));
    animation: jeFadeIn 0.2s ease;
}

.je-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.je-cal-month {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.je-cal-nav {
    width: 30px;
    height: 30px;
    border: none;
    background: var(--background, #FAF5FF);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-soft, 3px 3px 6px rgba(176,139,187,0.1), -3px -3px 6px rgba(255,255,255,0.6));
}

.je-cal-nav:hover {
    box-shadow: var(--shadow-hover, 5px 5px 10px rgba(176,139,187,0.15), -3px -3px 6px rgba(255,255,255,0.7));
    color: var(--primary, #B08BBB);
}

.je-cal-nav:active {
    box-shadow: var(--shadow-inset, inset 2px 2px 4px rgba(176,139,187,0.1), inset -2px -2px 4px rgba(255,255,255,0.7));
}

.je-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}

.je-cal-wd {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary, #bbb);
    text-transform: uppercase;
    padding: 2px 0;
}

.je-cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.je-cal-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
    border: none;
    background: var(--background, #FAF5FF);
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    min-height: 34px;
    transition: all 0.15s;
    position: relative;
}

.je-cal-day:hover {
    box-shadow: var(--shadow-soft, 3px 3px 6px rgba(176,139,187,0.1), -3px -3px 6px rgba(255,255,255,0.6));
    transform: translateY(-1px);
}

.je-cal-pad {
    cursor: default;
    background: transparent;
    box-shadow: none !important;
}

.je-cal-today {
    font-weight: 700;
    background: var(--card-bg, #fff);
    box-shadow: var(--shadow-soft, 4px 4px 8px rgba(176,139,187,0.1), -4px -4px 8px rgba(255,255,255,0.7));
}

.je-cal-selected {
    background: var(--primary, #B08BBB) !important;
    color: #fff !important;
    box-shadow: var(--shadow-inset, inset 2px 2px 4px rgba(0,0,0,0.1), inset -2px -2px 4px rgba(255,255,255,0.1)) !important;
}

.je-cal-has {
    font-weight: 600;
}

.je-cal-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    margin-top: 1px;
}

/* ── Dark mode (Full Page Chrome) ───────────────────── */

html[data-theme="dark"] .je-action-btn {
    background: #252540;
    color: #aaa;
    box-shadow: 3px 3px 6px rgba(0,0,0,0.3), -3px -3px 6px rgba(50,50,70,0.15);
}

html[data-theme="dark"] .je-action-btn.je-action-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 3px 3px 8px rgba(176,139,187,0.25), -3px -3px 6px rgba(50,50,70,0.15);
}

html[data-theme="dark"] .je-ws-today {
    background: #2a2a42;
}

html[data-theme="dark"] .je-cal-day:hover {
    box-shadow: 2px 2px 4px rgba(0,0,0,0.2), -2px -2px 4px rgba(50,50,70,0.1);
}

html[data-theme="dark"] .je-cal-today {
    background: #2a2a42;
    box-shadow: 3px 3px 6px rgba(0,0,0,0.25), -3px -3px 6px rgba(50,50,70,0.12);
}

html[data-theme="dark"] .je-cal-nav {
    background: #252540;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.25), -2px -2px 4px rgba(50,50,70,0.1);
}

html[data-theme="dark"] .je-cal-nav:hover {
    box-shadow: 3px 3px 6px rgba(0,0,0,0.3), -2px -2px 4px rgba(50,50,70,0.15);
}

/* ── AI Summary Panel ──────────────────────── */

.je-summary-panel {
    margin: 0 18px 8px;
    background: linear-gradient(135deg, rgba(176,139,187,0.06), rgba(155,107,160,0.1));
    border: 1.5px solid rgba(176,139,187,0.2);
    border-radius: 16px;
    padding: 14px 16px;
    animation: jeFadeIn 0.3s ease;
}

.je-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.je-summary-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.je-summary-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.je-summary-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary, #B08BBB);
}

.je-summary-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    font-size: 18px;
    color: var(--text-secondary, #999);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.je-summary-close:hover {
    background: rgba(0,0,0,0.05);
}

/* ── Range bar ─────── */

.je-summary-range-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.je-summary-range {
    padding: 6px 14px;
    border: none;
    background: var(--card-bg, #fff);
    color: var(--text-secondary, #999);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
    box-shadow: var(--shadow-soft, 3px 3px 6px rgba(176,139,187,0.08), -3px -3px 6px rgba(255,255,255,0.6));
}

.je-summary-range:hover {
    color: var(--text-primary);
}

.je-summary-range.active {
    background: var(--primary, #B08BBB);
    color: #fff;
    box-shadow: var(--shadow-inset, inset 2px 2px 4px rgba(0,0,0,0.1), inset -2px -2px 4px rgba(255,255,255,0.1));
}

/* ── Summary content ─── */

.je-summary-content {
    min-height: 40px;
}

.je-summary-period {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #999);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.je-summary-stats {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.je-summary-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    background: var(--card-bg, #fff);
    border-radius: 12px;
    box-shadow: var(--shadow-soft, 3px 3px 6px rgba(176,139,187,0.08), -3px -3px 6px rgba(255,255,255,0.6));
}

.je-stat-num {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.je-stat-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary, #aaa);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.je-stat-good .je-stat-num { color: #7BC67E; }
.je-stat-concern .je-stat-num { color: #D4766A; }

.je-summary-trend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding: 8px 12px;
    background: var(--card-bg, #fff);
    border-radius: 10px;
    box-shadow: var(--shadow-inset, inset 2px 2px 4px rgba(176,139,187,0.06), inset -2px -2px 4px rgba(255,255,255,0.6));
}

.je-summary-narrative {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.je-summary-hint {
    font-size: 13px;
    color: var(--text-secondary, #999);
    text-align: center;
    padding: 12px 0;
}

.je-summary-moments {
    margin-bottom: 10px;
}

.je-summary-moments h5 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary, #999);
    margin: 0 0 6px;
}

.je-summary-moment {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: 4px;
}

.je-summary-moment.concern {
    background: rgba(212,118,106,0.08);
    border-left: 2px solid #D4766A;
}

.je-summary-moment.good {
    background: rgba(123,198,126,0.08);
    border-left: 2px solid #7BC67E;
}

/* ── Calendar Mode Toggle + Range Styles ───── */

.je-cal-mode-toggle {
    display: flex;
    gap: 2px;
    background: var(--background, #FAF5FF);
    border-radius: 8px;
    padding: 2px;
    box-shadow: var(--shadow-inset, inset 2px 2px 4px rgba(176,139,187,0.06), inset -2px -2px 4px rgba(255,255,255,0.6));
}

.je-cal-mode {
    padding: 4px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #999);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.je-cal-mode.active {
    background: var(--card-bg, #fff);
    color: var(--text-primary);
    box-shadow: var(--shadow-soft, 2px 2px 4px rgba(176,139,187,0.08), -2px -2px 4px rgba(255,255,255,0.6));
}

.je-cal-range-hint {
    font-size: 11px;
    color: var(--primary, #B08BBB);
    font-weight: 500;
    padding: 4px 18px 2px;
    background: var(--background, #FAF5FF);
    font-style: italic;
}

/* Calendar range highlight */
.je-cal-in-range {
    background: rgba(176,139,187,0.15) !important;
    color: var(--text-primary) !important;
}

.je-cal-range-start {
    background: var(--primary, #B08BBB) !important;
    color: #fff !important;
    border-radius: 10px 4px 4px 10px;
}

.je-cal-range-end {
    background: var(--primary, #B08BBB) !important;
    color: #fff !important;
    border-radius: 4px 10px 10px 4px;
}

.je-cal-range-start.je-cal-range-end {
    border-radius: 10px;
}

/* ── Dark mode (Summary + Calendar Range) ─────── */

html[data-theme="dark"] .je-summary-panel {
    background: linear-gradient(135deg, rgba(176,139,187,0.08), rgba(155,107,160,0.12));
    border-color: rgba(176,139,187,0.2);
}

html[data-theme="dark"] .je-summary-range {
    background: #252540;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.25), -2px -2px 4px rgba(50,50,70,0.1);
}

html[data-theme="dark"] .je-summary-stat {
    background: #252540;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.25), -2px -2px 4px rgba(50,50,70,0.1);
}

html[data-theme="dark"] .je-summary-trend {
    background: #252540;
}

html[data-theme="dark"] .je-cal-mode-toggle {
    background: #1a1a2e;
}

html[data-theme="dark"] .je-cal-mode.active {
    background: #2a2a42;
}

html[data-theme="dark"] .je-cal-in-range {
    background: rgba(176,139,187,0.2) !important;
}

html[data-theme="dark"] .je-cal-range-hint {
    background: #1a1a2e;
}

/* ============================================
   ACTIVITY RIBBON (30-day bar chart)
   ============================================ */

.activity-ribbon-section {
    padding: 12px 16px 4px;
    margin-bottom: 4px;
}

.activity-ribbon-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ar-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.ar-view-all {
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.activity-ribbon {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 40px;
    padding-bottom: 0;
}

.ar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    min-width: 0;
    height: 100%;
    position: relative;
}

.ar-col[data-has-entries="true"] {
    cursor: pointer;
}

.ar-bar {
    width: 100%;
    max-width: 16px;
    border-radius: 3px 3px 2px 2px;
    transition: transform 0.15s ease, opacity 0.15s ease;
    min-height: 4px;
}

.ar-col:hover .ar-bar {
    transform: scaleY(1.15);
    opacity: 0.8;
}

.ar-c-empty { background: var(--border-color); opacity: 0.5; height: 4px; }
.ar-c-note  { background: var(--primary); }
.ar-c-voice { background: #7A9CC6; }
.ar-c-photo { background: #7BC87B; }
.ar-c-flag  { background: #FF8A7A; }

.ar-day-lbl {
    font-size: 8px;
    color: var(--text-lighter);
    white-space: nowrap;
    position: absolute;
    bottom: -13px;
    left: 50%;
    transform: translateX(-50%);
    line-height: 1;
}

.ar-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding-bottom: 4px;
}

.ar-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-lighter);
}

.ar-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
}

/* ============================================
   RECENT ACTIVITY WIDGET
   ============================================ */

.recent-activity-section {
    margin-bottom: 24px;
}

.section-link-all {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.recent-activity-widget {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.raw-entry-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    color: inherit;
    border: none;
    width: 100%;
    text-align: left;
}

.raw-entry-card:hover {
    transform: translateX(3px);
    box-shadow: var(--shadow-hover);
}

.raw-entry-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: 10px;
}

.raw-entry-body {
    flex: 1;
    min-width: 0;
}

.raw-entry-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.raw-entry-meta {
    font-size: 11px;
    color: var(--text-lighter);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.raw-entry-type-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    text-transform: capitalize;
}

.raw-entry-flag-badge {
    font-size: 11px;
    flex-shrink: 0;
}

.raw-entry-empty {
    font-size: 13px;
    color: var(--text-lighter);
    text-align: center;
    padding: 16px 0;
}

/* Dark mode */
html[data-theme="dark"] .raw-entry-card {
    background: var(--card-bg);
}

html[data-theme="dark"] .raw-entry-icon {
    background: rgba(176, 139, 187, 0.15);
}

html[data-theme="dark"] .raw-entry-type-badge {
    background: rgba(176, 139, 187, 0.15);
}

/* ============================================
   CARE FOCUS AREAS
   ============================================ */

.focus-areas-section {
    margin-bottom: 28px;
}

.focus-areas-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.focus-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 12px 10px 10px;
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    border: none;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-align: left;
    position: relative;
    width: 100%;
}

.focus-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.focus-card-icon {
    font-size: 20px;
    line-height: 1;
    margin-bottom: 2px;
}

.focus-card-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.2;
}

.focus-card-count {
    font-size: 10px;
    color: var(--text-lighter);
    font-variant-numeric: tabular-nums;
}

.focus-card-alert {
    position: absolute;
    top: 6px;
    right: 7px;
    font-size: 10px;
    color: #FF8A7A;
    line-height: 1;
}

.focus-inactive .focus-card-icon {
    filter: grayscale(1);
    opacity: 0.4;
}

.focus-inactive .focus-card-name {
    color: var(--text-lighter);
}

.focus-inactive {
    border-left-color: var(--border-color);
    opacity: 0.85;
}

.focus-active {
    border-left-color: var(--primary);
}

.focus-flagged {
    border-left-color: #FF8A7A;
}

/* Tag filter badge pill on timeline filter bar */
.je-filter-tag-badge {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    font-weight: 600;
}

/* Dark mode */
html[data-theme="dark"] .focus-card {
    background: var(--card-bg);
}

html[data-theme="dark"] .focus-inactive .focus-card-name {
    color: var(--text-lighter);
}

/* ════════════════════════════════════════
   VOICE PAGE — REDESIGNED
════════════════════════════════════════ */

/* Outer section */
.voice-record-section {
    padding: 12px 18px 4px;
}

/* Recording card */
.voice-record-panel {
    background: var(--card-bg);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    padding: 24px 20px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* ── Stats row ── */
.voice-stats-row {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: center;
    margin-bottom: 2px;
}

.voice-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.voice-stat-divider {
    width: 1px;
    height: 30px;
    background: var(--border-color, rgba(176,139,187,0.2));
    flex-shrink: 0;
}

.vs-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.vs-flagged-col .vs-num {
    color: #FF6B8A;
}

.vs-label {
    font-size: 11px;
    color: var(--text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Mic button area ── */
.voice-mic-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
}

/* Pulse ring */
.voice-pulse-ring {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2.5px solid var(--primary);
    opacity: 0;
    pointer-events: none;
    transform: scale(1);
}

.voice-pulse-ring.active {
    animation: pulse-record 1.5s ease-out infinite;
}

@keyframes pulse-record {
    0%   { transform: scale(1);    opacity: 0.7; }
    100% { transform: scale(1.65); opacity: 0;   }
}

/* Circular mic button */
.voice-mic-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 20px rgba(176, 139, 187, 0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    z-index: 1;
}

.voice-mic-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 28px rgba(176, 139, 187, 0.55);
}

.voice-mic-btn:active {
    transform: scale(0.95);
}

/* Stop button variant */
.voice-mic-stop {
    background: #FF6B8A;
    box-shadow: 0 6px 20px rgba(255, 107, 138, 0.45);
}

.voice-mic-stop:hover {
    box-shadow: 0 8px 28px rgba(255, 107, 138, 0.55);
}

/* Status text */
.voice-record-status {
    text-align: center;
    color: var(--text-lighter);
    font-size: 14px;
    min-height: 22px;
}

.voice-record-status .recording-active {
    color: #FF6B8A;
    font-weight: 600;
    font-size: 14px;
}

/* Waveform container */
.voice-waveform {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.voice-waveform .waveform-bars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 40px;
}

.voice-waveform .waveform-bars .bar {
    width: 4px;
    min-height: 4px;
    background: var(--primary);
    border-radius: 2px;
    height: 12px;
}

/* Timer row */
.voice-timer-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-timer-row .recording-timer {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.voice-timer-row .max-duration-note {
    font-size: 12px;
    color: var(--text-lighter);
}

/* Override old voice archive padding now that section has no inline style */
.voice-archive {
    padding: 0 18px 18px;
}

/* ── Voice Entry Cards (ve-card) ── */
.ve-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 14px;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    animation: jeFadeIn 0.25s ease;
}

.ve-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.ve-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: var(--primary-light);
}

.ve-icon-flag { background: #FFE5EA; }
.ve-icon-ai   { background: #E8EEFF; }
.ve-icon-mic  { background: var(--primary-light); }

.ve-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ve-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ve-date {
    font-size: 13px;
    color: var(--text-lighter);
}

.ve-duration {
    font-size: 12px;
    color: var(--text-lighter);
    white-space: nowrap;
    background: var(--background);
    border-radius: 6px;
    padding: 1px 6px;
}

.ve-preview {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ve-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.ve-type-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ve-ai     { background: #E8EEFF; color: #4A6CF7; }
.ve-manual { background: var(--primary-light); color: var(--primary); }

.ve-flag-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: #FFE5EA;
    color: #C0392B;
}

.ve-chevron {
    font-size: 22px;
    color: var(--text-lighter);
    flex-shrink: 0;
    margin-left: 2px;
    line-height: 1;
}

/* ── Dark mode for voice redesign ── */
html[data-theme="dark"] .voice-record-panel { background: var(--card-bg); }
html[data-theme="dark"] .ve-card            { background: var(--card-bg); }
html[data-theme="dark"] .ve-duration        { background: rgba(255,255,255,0.06); }
html[data-theme="dark"] .ve-icon-ai         { background: rgba(74, 108, 247, 0.15); }
html[data-theme="dark"] .ve-ai              { background: rgba(74, 108, 247, 0.15); color: #8BA4F7; }
html[data-theme="dark"] .ve-icon-flag       { background: rgba(255, 107, 138, 0.15); }
html[data-theme="dark"] .ve-flag-badge      { background: rgba(255, 107, 138, 0.15); color: #FF8FAA; }

/* ════════════════════════════════════════
   ACTIVITY RIBBON — REDESIGNED
════════════════════════════════════════ */

/* Section wrapper — no background, just spacing */
.activity-ribbon-section {
    padding: 0 18px;
    margin-bottom: 16px;
}

/* Card container matching app design language */
.ar-card {
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    padding: 16px 16px 14px;
}

/* Title row */
.activity-ribbon-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ar-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
}

.ar-view-all {
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* Chart area with subtle inner background */
.ar-chart-wrap {
    background: var(--background);
    border-radius: 12px;
    padding: 10px 8px 20px;
    margin-bottom: 12px;
    position: relative;
    overflow: visible;
}

/* Bar ribbon */
.activity-ribbon {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 40px;
    background: none;
    padding-bottom: 0;
}

.ar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    min-width: 0;
    height: 100%;
    position: relative;
    cursor: default;
}

.ar-col[data-has-entries="true"] {
    cursor: pointer;
}

.ar-bar {
    width: 100%;
    max-width: 14px;
    border-radius: 3px 3px 1px 1px;
    transition: transform 0.15s ease, opacity 0.15s ease;
    transform-origin: bottom center;
    min-height: 3px;
}

.ar-col:hover .ar-bar {
    transform: scaleY(1.12);
    opacity: 0.75;
}

/* Bar colors — harmonised with app palette */
.ar-c-empty { background: var(--primary-light, #D4B5DB); opacity: 0.2; height: 4px !important; }
.ar-c-note  { background: var(--primary); opacity: 1; }
.ar-c-voice { background: #8BAED4; opacity: 1; }
.ar-c-photo { background: #82C5A0; opacity: 1; }
.ar-c-flag  { background: #FF8A7A; opacity: 1; }

/* Day axis labels */
.ar-day-lbl {
    font-size: 8px;
    color: var(--text-lighter);
    white-space: nowrap;
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    line-height: 1;
    opacity: 0.65;
}

/* Legend row */
.ar-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.ar-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-lighter);
    font-weight: 500;
}

.ar-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
    flex-shrink: 0;
}

/* Dark mode */
html[data-theme="dark"] .ar-card       { background: var(--card-bg); }
html[data-theme="dark"] .ar-chart-wrap { background: rgba(255,255,255,0.04); }
html[data-theme="dark"] .ar-c-empty    { background: rgba(255,255,255,0.12); opacity: 1; }

/* ════════════════════════════════════════
   SHARED SORT + FILTER BAR
   (Timeline, Memories, Voice)
════════════════════════════════════════ */

/* Row: filter pills left (scrollable) + sort toggle right (fixed) */
.je-filters-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px 12px;
}

/* When inside a bar, the pills take remaining space */
.je-filters-bar .je-filters {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Sort toggle — two connected pill buttons */
.je-sort-toggle {
    display: flex;
    align-items: center;
    background: var(--background);
    border-radius: 20px;
    padding: 2px;
    flex-shrink: 0;
    border: 1px solid var(--border-color, rgba(176,139,187,0.18));
}

.je-sort-btn {
    padding: 4px 10px;
    border-radius: 18px;
    border: none;
    background: transparent;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-lighter);
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    line-height: 1.5;
}

.je-sort-btn.active {
    background: var(--card-bg);
    color: var(--primary);
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(176,139,187,0.2);
}

html[data-theme="dark"] .je-sort-toggle     { border-color: rgba(255,255,255,0.1); }
html[data-theme="dark"] .je-sort-btn.active { background: var(--card-bg); box-shadow: none; }

/* ════════════════════════════════════════
   DAILY CHECK-IN WIDGET
════════════════════════════════════════ */
.checkin-section { padding: 12px 18px 0; }
.checkin-card { background: var(--card-bg); border-radius: 18px; padding: 16px 18px; box-shadow: 4px 4px 12px rgba(176,139,187,0.12), -4px -4px 12px rgba(255,255,255,0.8); animation: jeFadeIn 0.3s ease; }
.checkin-label { font-size: 14px; font-weight: 600; color: var(--text-dark); margin: 0 0 12px; }
.checkin-options { display: flex; gap: 8px; }
.checkin-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border: 2px solid transparent; border-radius: 14px; background: var(--background); cursor: pointer; transition: all 0.2s; font-size: 12px; font-weight: 500; color: var(--text-dark); }
.checkin-btn:hover { border-color: var(--primary-light); }
.checkin-btn.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary); font-weight: 700; }
.checkin-emoji { font-size: 22px; }
.checkin-good.selected { border-color: #7BC87B; background: #E8F8E8; color: #4A9B4A; }
.checkin-hard.selected { border-color: #FF8A7A; background: #FFECE9; color: #C0392B; }
.checkin-note-area { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.checkin-note { border: 1px solid var(--border-color, rgba(176,139,187,0.2)); border-radius: 12px; padding: 10px 12px; font-size: 13px; resize: none; min-height: 60px; background: var(--background); color: var(--text-dark); font-family: inherit; }
.checkin-save-btn { background: var(--primary); color: #fff; border: none; border-radius: 12px; padding: 10px; font-size: 13px; font-weight: 600; cursor: pointer; transition: opacity 0.2s; }
.checkin-save-btn:hover { opacity: 0.85; }
.checkin-done { text-align: center; font-size: 15px; font-weight: 600; color: var(--primary); padding: 8px 0; margin: 0; }

/* ════════════════════════════════════════
   WEEKLY DIGEST WIDGET
════════════════════════════════════════ */
.weekly-digest-section { padding: 0 18px 12px; }
.digest-card { background: linear-gradient(135deg, var(--primary-light, #D4B5DB) 0%, var(--card-bg, #fff) 60%); border-radius: 18px; padding: 16px 18px; box-shadow: 4px 4px 12px rgba(176,139,187,0.15), -4px -4px 12px rgba(255,255,255,0.8); animation: jeFadeIn 0.3s ease; }
.digest-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.digest-title { font-size: 14px; font-weight: 700; color: var(--text-dark); flex: 1; line-height: 1.3; }
.digest-dismiss { background: none; border: none; font-size: 14px; color: var(--text-lighter); cursor: pointer; padding: 0 0 0 8px; line-height: 1; }
.digest-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.digest-stat { font-size: 12px; background: rgba(255,255,255,0.7); color: var(--text-dark); padding: 4px 10px; border-radius: 20px; font-weight: 500; }
.digest-stat-flag { background: #FFECE9; color: #C0392B; }
.digest-share-btn { background: var(--primary); color: #fff; border: none; border-radius: 12px; padding: 8px 16px; font-size: 12px; font-weight: 600; cursor: pointer; transition: opacity 0.2s; width: 100%; }
.digest-share-btn:hover { opacity: 0.85; }

/* ════════════════════════════════════════
   CAREGIVER WELLBEING WIDGET
════════════════════════════════════════ */
.wellbeing-section { padding: 0 18px 12px; }
.wellbeing-card { background: var(--card-bg); border-radius: 18px; padding: 16px 18px; box-shadow: 4px 4px 12px rgba(176,139,187,0.12), -4px -4px 12px rgba(255,255,255,0.8); animation: jeFadeIn 0.3s ease; border-left: 3px solid var(--accent, #C96B7C); }
.wellbeing-title { font-size: 14px; font-weight: 700; color: var(--text-dark); margin: 0 0 14px; }
.wellbeing-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.wellbeing-label { font-size: 12px; color: var(--text-lighter); white-space: nowrap; min-width: 90px; }
.wellbeing-emojis { display: flex; gap: 6px; }
.wb-emoji { background: none; border: 2px solid transparent; border-radius: 10px; padding: 4px 6px; font-size: 20px; cursor: pointer; transition: all 0.15s; }
.wb-emoji:hover { border-color: var(--primary-light); transform: scale(1.1); }
.wb-emoji.selected { border-color: var(--primary); background: var(--primary-light); transform: scale(1.1); }
.wellbeing-note { width: 100%; border: 1px solid var(--border-color, rgba(176,139,187,0.2)); border-radius: 12px; padding: 10px 12px; font-size: 13px; resize: none; min-height: 56px; background: var(--background); color: var(--text-dark); font-family: inherit; margin: 8px 0; box-sizing: border-box; }
.wellbeing-save-btn { background: var(--accent, #C96B7C); color: #fff; border: none; border-radius: 12px; padding: 10px; font-size: 13px; font-weight: 600; cursor: pointer; width: 100%; transition: opacity 0.2s; }
.wellbeing-save-btn:hover { opacity: 0.85; }
.wellbeing-done p { text-align: center; font-size: 15px; font-weight: 600; color: var(--accent, #C96B7C); padding: 8px 0; margin: 0; }
.wellbeing-trend { border-left-color: var(--primary); }
.wb-trend-row { display: flex; gap: 12px; justify-content: center; padding: 4px 0; }
.wb-trend-dot { font-size: 22px; }

/* ════════════════════════════════════════
   ONBOARDING CARE PRIORITIES
════════════════════════════════════════ */
.priorities-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; justify-content: center; }
.priority-chip { background: var(--background); border: 2px solid var(--border-color, rgba(176,139,187,0.2)); border-radius: 20px; padding: 8px 16px; font-size: 13px; font-weight: 500; color: var(--text-dark); cursor: pointer; transition: all 0.18s; }
.priority-chip:hover { border-color: var(--primary-light); }
.priority-chip.selected { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 700; }

/* ════════════════════════════════════════
   AUTHOR ATTRIBUTION CHIP (Feature 5)
════════════════════════════════════════ */
.je-author-chip {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    background: var(--background);
    border: 1px solid var(--border-color, rgba(176,139,187,0.2));
    border-radius: 12px;
    font-size: 11px;
    color: var(--text-medium);
    letter-spacing: 0.01em;
    line-height: 1.6;
}
@media (prefers-color-scheme: dark) {
    .je-author-chip { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); color: var(--text-medium); }
}

/* ═══════════════════════════════════════════════════════════════
   MEMENTO AI — UX OVERHAUL ADDITIONS
   ═══════════════════════════════════════════════════════════════ */

/* ── Global page entrance animation ── */
.app-container { animation: pageEnter 0.4s ease-out both; }
@keyframes pageEnter { from { opacity:0; } to { opacity:1; } }

/* ── Button press micro-interaction ── */
.nav-btn, .je-action-btn, .action-btn, .submit-button, .login-button, .demo-button,
.memories-empty-cta, .checkin-emoji-btn {
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.nav-btn:active, .je-action-btn:active, .action-btn:active,
.submit-button:active, .login-button:active, .demo-button:active,
.memories-empty-cta:active, .checkin-emoji-btn:active { transform: scale(0.95); }

/* ── Animated avatar gradient ── */
@keyframes avatarPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124,58,237,0.35); }
  50%       { box-shadow: 0 0 0 14px rgba(124,58,237,0); }
}
.avatar-pulse { animation: avatarPulse 3s ease-in-out infinite; }
.avatar-gradient {
  background: linear-gradient(135deg, #7C3AED 0%, #B08BBB 50%, #A78BFA 100%) !important;
  background-size: 200% 200% !important;
  animation: avatarShift 6s ease infinite, avatarPulse 3s ease-in-out infinite;
}
@keyframes avatarShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Caregiver greeting strip ── */
.caregiver-greeting {
  font-size: 13px; color: var(--text-light, #9CA3AF);
  font-weight: 500; letter-spacing: 0.01em; margin: 0;
}
.caregiver-greeting strong { color: var(--primary, #7C3AED); }

/* ── Memory Spark card ── */
.memory-spark-card {
  margin: 12px 16px;
  background: linear-gradient(135deg, #7C3AED 0%, #5B21B6 100%);
  border-radius: 20px; padding: 18px 20px; color: #fff;
  position: relative; overflow: hidden; cursor: default;
  animation: pageEnter 0.5s ease-out 0.15s both;
}
.memory-spark-card::before {
  content: ''; position: absolute; top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.07); border-radius: 50%;
}
.memory-spark-card::after {
  content: ''; position: absolute; bottom: -20px; left: -10px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.04); border-radius: 50%;
}
.spark-emoji { font-size: 24px; margin-bottom: 6px; display: block; position: relative; z-index: 1; }
.spark-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em;
  opacity: 0.65; margin-bottom: 5px; position: relative; z-index: 1;
}
.spark-value { font-size: 16px; font-weight: 700; line-height: 1.35; position: relative; z-index: 1; }
.spark-sub { font-size: 12px; opacity: 0.75; margin-top: 5px; line-height: 1.4; position: relative; z-index: 1; }

/* ── AI Chat invitation card ── */
.chat-invite-card {
  margin: 12px 16px; background: var(--card-bg, #fff);
  border: 1.5px solid rgba(124,58,237,0.18); border-radius: 20px;
  padding: 16px 18px; cursor: pointer; transition: all 0.2s ease;
  animation: pageEnter 0.5s ease-out 0.25s both;
}
.chat-invite-card:hover { border-color: rgba(124,58,237,0.45); box-shadow: 0 6px 24px rgba(124,58,237,0.12); }
.chat-invite-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.chat-invite-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #7C3AED, #A78BFA);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  animation: avatarPulse 3s ease-in-out infinite;
}
.chat-invite-name { font-weight: 600; font-size: 14px; color: var(--text-dark, #1F2937); }
.chat-invite-sub { font-size: 12px; color: var(--text-light, #9CA3AF); margin-top: 1px; }
.chat-invite-prompt {
  background: var(--bg-soft, #F9FAFB); border-radius: 12px;
  padding: 10px 14px; font-size: 13px; color: var(--text-medium, #6B7280);
  font-style: italic; border-left: 3px solid rgba(124,58,237,0.28);
  min-height: 38px;
}

/* Blinking cursor on rotating prompt */
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* ── Enhanced daily check-in ── */
.checkin-emoji-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-top: 12px;
}
.checkin-emoji-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px; padding: 12px 4px;
  background: var(--bg-soft, #F9FAFB); border: 2px solid transparent;
  border-radius: 16px; cursor: pointer; transition: all 0.2s ease;
  font-size: 11px; font-weight: 500; color: var(--text-medium, #6B7280);
  font-family: inherit;
}
.checkin-emoji-btn .cem-emoji { font-size: 26px; line-height: 1; }
.checkin-emoji-btn:hover { border-color: var(--primary,#7C3AED); background: rgba(124,58,237,0.05); transform: translateY(-2px); }
.checkin-emoji-btn.selected { border-color: var(--primary,#7C3AED); background: rgba(124,58,237,0.08); }
.checkin-response {
  margin-top: 12px; padding: 12px 14px;
  background: linear-gradient(135deg, rgba(124,58,237,0.05), rgba(167,139,250,0.06));
  border-radius: 14px; border-left: 3px solid var(--primary,#7C3AED);
  font-size: 13px; color: var(--text-dark,#1F2937); line-height: 1.5;
  animation: pageEnter 0.3s ease-out both;
}

/* ── Getting Started progress ring ── */
.gs-header-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: nowrap; }
.gs-progress-ring { position: relative; display: inline-flex; flex-shrink: 0; }
.gs-progress-ring svg { transform: rotate(-90deg); }
.gs-progress-ring .ring-bg   { fill: none; stroke: #E5E7EB; stroke-width: 4; }
.gs-progress-ring .ring-fill { fill: none; stroke: var(--primary,#7C3AED); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 0.7s ease; }
.gs-progress-count {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 11px; font-weight: 700; color: var(--primary,#7C3AED); white-space: nowrap;
}
.gs-ring-title { flex: 1; }
.gs-ring-title h3 { margin: 0 0 2px; font-size: 15px; }
.gs-ring-title p { margin: 0; font-size: 12px; color: var(--text-light,#9CA3AF); }

/* ── Confetti particles ── */
.confetti-particle {
  position: fixed; pointer-events: none; z-index: 9999;
  animation: confettiFall 1.6s ease-out forwards;
}
@keyframes confettiFall {
  0%   { opacity: 1; transform: translateY(-10px) rotate(0deg); }
  100% { opacity: 0; transform: translateY(95vh) rotate(720deg) scale(0.3); }
}

/* ── Timeline entry color borders ── */
.je-entry[data-type="note"]     { border-left: 4px solid #7C3AED !important; }
.je-entry[data-type="voice"]    { border-left: 4px solid #2563EB !important; }
.je-entry[data-type="photo"], .je-entry[data-type="memory"] { border-left: 4px solid #059669 !important; }
.je-entry[data-type="ai_insight"], .je-entry[data-type="ai-insight"] { border-left: 4px solid #F59E0B !important; }
.je-entry.ai-flagged { border-left-color: #F59E0B !important; }

/* Soften "Flagged" badge to amber */
.je-flag {
  background: rgba(245,158,11,0.12) !important; color: #B45309 !important;
  border: 1px solid rgba(245,158,11,0.3) !important; border-radius: 20px !important;
  font-size: 11px !important; padding: 3px 10px !important; font-weight: 600 !important;
}

/* ── Memories masonry grid ── */
.memories-masonry { columns: 2; column-gap: 10px; padding: 8px 16px 100px !important; }
.memories-masonry .memory-card,
.memories-masonry > div[class*="memory"],
.memories-masonry > a {
  break-inside: avoid; margin-bottom: 10px; border-radius: 16px;
  overflow: hidden; position: relative; display: block; cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: pageEnter 0.4s ease-out both;
}
.memories-masonry img { width: 100%; display: block; border-radius: 16px; }

/* Empty state — animated frames */
.memories-empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 32px; text-align: center;
}
.memories-empty-frames { position: relative; width: 120px; height: 90px; margin-bottom: 28px; }
.empty-frame {
  position: absolute; width: 60px; height: 70px;
  border: 2px solid rgba(124,58,237,0.22); border-radius: 8px;
  background: rgba(124,58,237,0.04);
}
.empty-frame:nth-child(1) { top:0; left:0;  animation: frameFloat1 3s ease-in-out infinite; }
.empty-frame:nth-child(2) { top:10px; left:30px; animation: frameFloat2 3s ease-in-out 0.5s infinite; }
.empty-frame:nth-child(3) { top:0; left:60px;  animation: frameFloat3 3s ease-in-out 1s infinite; }
@keyframes frameFloat1 { 0%,100%{transform:rotate(-8deg) translateY(0)} 50%{transform:rotate(-8deg) translateY(-5px)} }
@keyframes frameFloat2 { 0%,100%{transform:rotate(3deg)  translateY(0)} 50%{transform:rotate(3deg)  translateY(-4px)} }
@keyframes frameFloat3 { 0%,100%{transform:rotate(10deg) translateY(0)} 50%{transform:rotate(10deg) translateY(-6px)} }
.memories-empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text-dark,#1F2937); margin-bottom: 8px; }
.memories-empty-state p  { font-size: 14px; color: var(--text-light,#9CA3AF); line-height: 1.5; margin-bottom: 24px; max-width: 240px; }
.memories-empty-cta {
  background: var(--primary,#7C3AED); color: #fff; border: none;
  border-radius: 14px; padding: 13px 28px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease; font-family: inherit;
}
.memories-empty-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(124,58,237,0.35); }

/* ── Timeline empty state ── */
.timeline-empty-state { display: flex; flex-direction: column; align-items: center; padding: 60px 32px; text-align: center; }
.timeline-empty-icon { font-size: 56px; margin-bottom: 16px; animation: floatIcon 3s ease-in-out infinite; }
@keyframes floatIcon { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-8px);} }
.timeline-empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text-dark,#1F2937); margin-bottom: 8px; }
.timeline-empty-state p  { font-size: 14px; color: var(--text-light,#9CA3AF); line-height: 1.5; max-width: 240px; }

/* ── Voice ambient rings ── */
.voice-mic-area { position: relative; display: flex; justify-content: center; align-items: center; width: 160px; height: 160px; margin: 0 auto; }
.voice-ambient-rings { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 0; }
.ambient-ring {
  position: absolute; border-radius: 50%;
  border: 1.5px solid rgba(124,58,237,0.2);
  animation: ambientExpand 3s ease-out infinite;
}
.ambient-ring:nth-child(1) { width:88px;  height:88px;  animation-delay:0s;   }
.ambient-ring:nth-child(2) { width:110px; height:110px; animation-delay:0.6s; }
.ambient-ring:nth-child(3) { width:132px; height:132px; animation-delay:1.2s; }
.ambient-ring:nth-child(4) { width:155px; height:155px; animation-delay:1.8s; }
@keyframes ambientExpand {
  0%   { opacity: 0.7; transform: scale(0.88); }
  100% { opacity: 0;   transform: scale(1.08); }
}
.recording-active .ambient-ring { border-color: rgba(239,68,68,0.45); animation-duration: 1s; }
.recording-active .voice-mic-btn { background: #EF4444 !important; animation: micPulse 0.9s ease-in-out infinite; }
@keyframes micPulse { 0%,100%{box-shadow:0 0 0 0 rgba(239,68,68,0.4);} 50%{box-shadow:0 0 0 18px rgba(239,68,68,0);} }

/* ── Streak banner ── */
.streak-banner {
  margin: 0 16px 12px; background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  border-radius: 16px; padding: 12px 16px; display: flex; align-items: center;
  gap: 12px; animation: pageEnter 0.4s ease-out 0.1s both;
}
.streak-fire { font-size: 28px; animation: firePulse 1.5s ease-in-out infinite; flex-shrink: 0; }
@keyframes firePulse { 0%,100%{transform:scale(1) rotate(-3deg);} 50%{transform:scale(1.15) rotate(3deg);} }
.streak-text strong { font-size: 14px; font-weight: 700; color: #92400E; display: block; }
.streak-text span   { font-size: 12px; color: #B45309; line-height: 1.4; display: block; margin-top: 1px; }

/* ── Heatmap color intensity by count ── */
.ar-bar { transition: height 0.3s ease; }

/* ── FAB scroll hide ── */
.chat-fab { transition: transform 0.3s ease, opacity 0.3s ease; }
.chat-fab.fab-hidden { transform: translateY(80px) scale(0.8); opacity: 0; pointer-events: none; }

/* ── Settings appearance compact toggle ── */
.appearance-toggle-row { display: flex; gap: 8px; margin-top: 12px; }
.appearance-toggle-btn {
  flex: 1; padding: 10px 6px; border: 2px solid #E5E7EB; border-radius: 12px;
  background: #fff; cursor: pointer; text-align: center; transition: all 0.2s ease;
  font-size: 13px; font-weight: 500; color: var(--text-medium,#6B7280); font-family: inherit;
}
.at-icon { font-size: 18px; display: block; margin-bottom: 4px; }
.appearance-toggle-btn.active { border-color: var(--primary,#7C3AED); background: rgba(124,58,237,0.06); color: var(--primary,#7C3AED); }
.appearance-toggle-btn:hover:not(.active) { border-color: #D1D5DB; background: #F9FAFB; }

/* ── Login — animated orbs ── */
.login-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.orb {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(124,58,237,0.1), rgba(167,139,250,0.03));
  animation: orbFloat linear infinite;
}
.orb:nth-child(1) { width:180px; height:180px; top:5%;  left:10%; animation-duration:18s; }
.orb:nth-child(2) { width:120px; height:120px; top:25%; right:8%; animation-duration:24s; animation-delay:3s; }
.orb:nth-child(3) { width:200px; height:200px; bottom:18%; left:5%; animation-duration:20s; animation-delay:6s; }
.orb:nth-child(4) { width:80px;  height:80px;  bottom:8%; right:18%; animation-duration:15s; animation-delay:1s; }
@keyframes orbFloat {
  0%  { transform:translate(0,0) scale(1);    opacity:0.6; }
  25% { transform:translate(15px,-20px) scale(1.05); opacity:0.8; }
  50% { transform:translate(-10px,15px) scale(0.95); opacity:0.5; }
  75% { transform:translate(20px,10px) scale(1.02);  opacity:0.7; }
  100%{ transform:translate(0,0) scale(1);    opacity:0.6; }
}

/* Login — emotional headline */
.login-emotional-headline {
  font-size: 14px; color: var(--text-light,#9CA3AF);
  text-align: center; margin: 6px 0 2px; font-style: italic;
  line-height: 1.55; animation: pageEnter 0.6s ease-out 0.2s both;
}

/* Login — provider icon buttons */
.login-button-inner { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.login-btn-icon { width: 20px; height: 20px; flex-shrink: 0; }
.login-btn-label { font-weight: 600; font-size: 15px; }
.login-button-google { background: #fff !important; border: 1.5px solid #E5E7EB !important; color: #374151 !important; }
.login-button-apple  { background: #111 !important; color: #fff !important; }
.login-button-email  { background: var(--primary,#7C3AED) !important; color: #fff !important; }

/* Login — demo card */
.demo-button-card {
  display: flex !important; align-items: center !important; gap: 14px !important;
  background: linear-gradient(135deg, rgba(124,58,237,0.07), rgba(167,139,250,0.1)) !important;
  border: 1.5px dashed rgba(124,58,237,0.4) !important;
  border-radius: 16px !important; padding: 14px 18px !important;
  cursor: pointer; width: 100%; text-align: left;
  transition: all 0.2s ease;
}
.demo-button-card:hover { border-color: rgba(124,58,237,0.65) !important; background: rgba(124,58,237,0.1) !important; }
.demo-btn-icon { font-size: 26px; flex-shrink: 0; }
.demo-btn-text { flex: 1; }
.demo-btn-title { font-weight: 700; font-size: 14px; color: var(--primary,#7C3AED); display: block; }
.demo-btn-sub   { font-size: 12px; color: var(--text-light,#9CA3AF); margin-top: 2px; display: block; }

/* ── Quick-add strip (Timeline) ── */
.quick-add-strip { display: flex; gap: 8px; padding: 8px 16px 4px; overflow-x: auto; scrollbar-width: none; }
.quick-add-strip::-webkit-scrollbar { display: none; }
.quick-add-pill {
  flex-shrink: 0; display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: none; border-radius: 20px;
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: transform 0.1s ease;
}
.quick-add-pill:active { transform: scale(0.95); }
.qap-note    { background: #EDE9FE; color: #7C3AED; }
.qap-voice   { background: #DBEAFE; color: #2563EB; }
.qap-photo   { background: #D1FAE5; color: #059669; }
.qap-report  { background: #FEF3C7; color: #92400E; }

/* ── Entry animation on load ── */
.je-entry { animation: entrySlideIn 0.3s ease-out both; }

/* ============================================================
   MEMENTO AI — WARM REDESIGN ADDITIONS
   ============================================================ */

/* Patient name gets a humanist serif — feels like a real person */
.patient-name,
#patientAlias,
.header-patient-name,
.patient-header h1,
.patient-header .name {
  font-family: 'Georgia', 'Palatino Linotype', serif;
  letter-spacing: -0.02em;
}

/* Time-of-day body classes */
body.tod-morning {
  --tod-bg: #FFF8EF;
  --tod-accent: #F59E0B;
  --tod-card-glow: rgba(245,158,11,0.08);
}
body.tod-afternoon {
  --tod-bg: #FDF8F3;
  --tod-accent: #7C3AED;
  --tod-card-glow: rgba(124,58,237,0.06);
}
body.tod-evening {
  --tod-bg: #F5F0FF;
  --tod-accent: #6D28D9;
  --tod-card-glow: rgba(109,40,217,0.1);
}
body.tod-night {
  --tod-bg: #1E1535;
  --tod-accent: #A78BFA;
  --bg-card: #2D2050;
  --text-primary: #F3EEFF;
  --text-secondary: #C4B5FD;
  --tod-card-glow: rgba(167,139,250,0.15);
}

/* Memo AI Character card */
.memo-character-card {
  background: linear-gradient(135deg, #EDE9FE, #FDF8F3);
  border: 1.5px solid rgba(124,58,237,0.15);
  border-radius: 20px;
  padding: 18px 16px;
  margin: 0 16px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  overflow: hidden;
}
.memo-character-card::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  background: radial-gradient(circle, rgba(167,139,250,0.25), transparent 70%);
  pointer-events: none;
}
.memo-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7C3AED, #A78BFA);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(124,58,237,0.35);
  animation: memoFloat 3s ease-in-out infinite;
}
.memo-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary, #7C3AED);
  margin-bottom: 4px;
}
.memo-message {
  font-size: 14px;
  color: var(--text-primary, #2C1A0E);
  line-height: 1.5;
  font-style: italic;
}
.memo-sub {
  font-size: 12px;
  color: var(--text-light-warm, #9C7B68);
  margin-top: 6px;
}
@keyframes memoFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-4px) rotate(2deg); }
}

/* Time-of-day greeting banner */
.tod-greeting-banner {
  background: linear-gradient(135deg, var(--tod-bg, #FDF8F3), var(--bg-card, #fff));
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: 10px 16px 8px;
  font-size: 13px;
  color: var(--text-secondary, #6B4C38);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tod-greeting-banner .tod-icon { font-size: 18px; }
.tod-greeting-banner strong { color: var(--text-primary, #2C1A0E); }

/* Warm mood feedback overlay */
.mood-glow-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.5s ease;
  border-radius: 0;
}
.mood-glow-overlay.show { opacity: 1; animation: glowFade 1.5s ease-out forwards; }
.mood-glow-great { background: radial-gradient(ellipse at 50% 30%, rgba(245,158,11,0.18), transparent 70%); }
.mood-glow-okay  { background: radial-gradient(ellipse at 50% 30%, rgba(5,150,105,0.15), transparent 70%); }
.mood-glow-hard  { background: radial-gradient(ellipse at 50% 30%, rgba(220,107,63,0.15), transparent 70%); }
@keyframes glowFade { 0% { opacity:1; } 60% { opacity:1; } 100% { opacity:0; } }

/* Page transition */
.page-enter {
  animation: pageSlideIn 0.35s ease-out both;
}
@keyframes pageSlideIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Memory Tree */
.memory-tree-container {
  position: relative;
  width: 100%;
  min-height: 580px;
  overflow: hidden;
  background: var(--bg-app, #FDF8F3);
}
.memory-tree-svg-bg {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 520px;
  opacity: 0.18;
  pointer-events: none;
}
.tree-leaf-card {
  position: absolute;
  width: 88px;
  padding: 8px;
  border-radius: 14px 14px 14px 0;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border-left: 3px solid var(--leaf-color, #7C3AED);
}
.tree-leaf-card:hover, .tree-leaf-card:active {
  transform: scale(1.08) rotate(2deg);
  box-shadow: 0 6px 20px rgba(0,0,0,0.16);
  z-index: 10;
}
.tree-leaf-date {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-lighter-warm, #C4A898);
  margin-bottom: 3px;
}
.tree-leaf-preview {
  font-size: 10px;
  color: var(--text-secondary, #6B4C38);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.tree-leaf-icon {
  font-size: 14px;
  margin-bottom: 3px;
  display: block;
}
.tree-leaf-card.type-note    { --leaf-color: #7C3AED; }
.tree-leaf-card.type-voice   { --leaf-color: #3B82F6; }
.tree-leaf-card.type-memory  { --leaf-color: #10B981; }
.tree-leaf-card.type-checkin { --leaf-color: #F59E0B; }
.tree-leaf-card.type-flagged { --leaf-color: #DC6B3F; }

/* Tree empty state */
.tree-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  gap: 12px;
}
.tree-empty-icon {
  font-size: 52px;
  animation: floatIcon 3s ease-in-out infinite;
}

/* Tree expanded entry panel */
.tree-entry-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 20px;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.15);
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 70vh;
  overflow-y: auto;
}
.tree-entry-panel.open { transform: translateY(0); }
.tree-panel-handle {
  width: 36px; height: 4px;
  background: #E5E7EB;
  border-radius: 2px;
  margin: 0 auto 16px;
}
.tree-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 199;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.tree-panel-overlay.open { opacity: 1; pointer-events: all; }

/* Mood checkin buttons — warm palette */
.checkin-emoji-btn.good  { --mood-bg: var(--mood-great-bg, #FFFBEB); --mood-border: var(--mood-great, #F59E0B); }
.checkin-emoji-btn.okay  { --mood-bg: var(--mood-okay-bg, #ECFDF5); --mood-border: var(--mood-okay, #059669); }
.checkin-emoji-btn.hard  { --mood-bg: var(--mood-hard-bg, #FFF3EE); --mood-border: var(--mood-hard, #DC6B3F); }
@keyframes entrySlideIn { from{opacity:0;transform:translateY(6px);} to{opacity:1;transform:translateY(0);} }
