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

/* iOS PWA safe area support (for notch/home indicator) */
body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* ========================================
   CSS VARIABLES FOR THEMING
   ======================================== */
:root {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;

    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;

    --border-color: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);

    --accent-primary: #667eea;
    --accent-secondary: #764ba2;

    --success: #48bb78;
    --warning: #ed8936;
    --danger: #f56565;

    --timeline-bg: #ffffff;
    --timeline-line: #e2e8f0;
    --timeline-hour-bg: #f7fafc;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a202c;
        --bg-secondary: #2d3748;
        --bg-tertiary: #4a5568;

        --text-primary: #f7fafc;
        --text-secondary: #e2e8f0;
        --text-muted: #cbd5e0;

        --border-color: #4a5568;
        --shadow: rgba(0, 0, 0, 0.3);

        --accent-primary: #7c3aed;
        --accent-secondary: #9333ea;

        --success: #68d391;
        --warning: #f6ad55;
        --danger: #fc8181;

        --timeline-bg: #2d3748;
        --timeline-line: #4a5568;
        --timeline-hour-bg: #374151;

        /* Ensure cards/inputs contrast in dark mode */
        --card-bg: #2d3748;
        --card-border: #4a5568;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: var(--text-primary);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.events-section, .stats-section {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px var(--shadow);
    border: 1px solid var(--border-color);
}

/* Add Event Button */
.btn-add-event {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 20px 30px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow);
}

.btn-add-event:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--shadow);
}

.btn-add-event:active {
    transform: translateY(-1px);
}

.btn-add-event-icon {
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
}

.btn-add-event-text {
    line-height: 1;
}

/* Event Modal specific styles */
.modal-content-event {
    max-width: 500px;
}

.events-section h2, .stats-section h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

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

.section-header h2 {
    margin-bottom: 0;
}

.event-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group-inline {
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group-inline label {
    min-width: 140px;
    margin: 0;
}

.form-group-inline select,
.form-group-inline input {
    flex: 1;
}

.form-group select, .form-group input {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-group select:focus, .form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Global fix for datetime-local to prevent overflow on all devices */
input[type="datetime-local"] {
    max-width: 100%;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

@media (prefers-color-scheme: dark) {
    input::placeholder {
        color: var(--text-muted);
        opacity: 0.6;
    }

    select option {
        background: var(--bg-secondary);
        color: var(--text-primary);
    }
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

button.success {
    background: var(--success) !important;
    color: white !important;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.btn-icon {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--shadow);
    color: var(--text-primary);
}

.btn-icon:hover {
    transform: scale(1.05);
}

body.dark-mode {
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-tertiary: #4a5568;
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #cbd5e0;
    --border-color: #4a5568;
    --shadow: rgba(0, 0, 0, 0.3);
    --accent-primary: #7c3aed;
    --accent-secondary: #9333ea;
    --success: #68d391;
    --warning: #f6ad55;
    --danger: #fc8181;
    --timeline-bg: #2d3748;
    --timeline-line: #4a5568;
    --timeline-hour-bg: #374151;
}

body.light-mode {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --success: #48bb78;
    --warning: #ed8936;
    --danger: #f56565;
    --timeline-bg: #ffffff;
    --timeline-line: #e2e8f0;
    --timeline-hour-bg: #f7fafc;
}

.events-list {
    max-height: 400px;
    overflow-y: auto;
}

.event-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
    min-height: 50px;
    box-shadow: 0 1px 3px var(--shadow);
}

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

.event-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.event-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.event-details {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.event-type {
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.event-time {
    font-size: 0.9rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.event-time::before {
    content: '•';
    margin-right: 8px;
    color: var(--border-color);
}

.event-user {
    font-size: 0.85rem;
    color: #38a169;
    font-weight: 600;
    white-space: nowrap;
}

.event-user::before {
    content: '•';
    margin-right: 8px;
    color: var(--border-color);
}

.event-amount {
    background: var(--accent-primary);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.event-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.event-actions button {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
}

.no-events {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    padding: 40px 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 25px 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px var(--shadow);
    border: 1px solid var(--border-color);
}

.stat-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    display: block;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Intelligence Section */
.intelligence-section {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px var(--shadow);
    border: 1px solid var(--border-color);
}

.intelligence-section h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.intelligence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.intelligence-container {
    min-height: 100px;
}

.intelligence-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px var(--shadow);
}

.intelligence-card h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.intel-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    gap: 10px;
}

.intel-row:last-child {
    border-bottom: none;
}

.intel-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.intel-value {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
    text-align: right;
    flex-grow: 1;
}

.intel-pattern {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--accent-primary);
}

.alert-badge {
    display: inline-block;
    background: #ef4444;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
}

.alert-text {
    color: #ef4444;
    font-weight: 600;
}

.percentage-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-left: 8px;
}

.percentage-badge.good {
    background: #10b981;
    color: white;
}

.percentage-badge.okay {
    background: #f59e0b;
    color: white;
}

.percentage-badge.alert {
    background: #ef4444;
    color: white;
}

/* Trend badges for week-over-week indicators */
.trend-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
    cursor: help;
}

.trend-badge.trend-positive {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.trend-badge.trend-negative {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.trend-badge.trend-stable {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

@media (prefers-color-scheme: dark) {
    .trend-badge.trend-positive {
        background: rgba(16, 185, 129, 0.25);
        color: #34d399;
    }

    .trend-badge.trend-negative {
        background: rgba(239, 68, 68, 0.25);
        color: #f87171;
    }

    .trend-badge.trend-stable {
        background: rgba(156, 163, 175, 0.25);
        color: #9ca3af;
    }
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px;
    font-style: italic;
    opacity: 0.7;
}

/* Smart Alerts */
.alerts-section {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px var(--shadow);
    border: 1px solid var(--border-color);
}

.alerts-section h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alerts-container {
    min-height: 60px;
}

.alerts-card {
    border-left: 4px solid #f59e0b;
}

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

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid;
}

.alert-critical {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: #ef4444;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: #f59e0b;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: #3b82f6;
}

.alert-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.alert-message {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Adaptive Parenting Coach */
.coach-insights {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.insights-card.coach-insight {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(102, 126, 234, 0.1) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    padding: 15px;
    position: relative;
}

.insights-card.coach-insight.insufficient_data {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(245, 158, 11, 0.1) 100%);
    border-color: rgba(245, 158, 11, 0.3);
}

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

.insight-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.confidence {
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.insight-description {
    color: var(--text-primary);
    margin: 8px 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.insight-recommendation {
    color: var(--accent-primary);
    font-weight: 600;
    margin: 8px 0 0 0;
    font-size: 0.9rem;
    padding: 8px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
    border-left: 3px solid var(--accent-primary);
}

.insight-data {
    color: var(--text-muted);
    margin: 8px 0 0 0;
    font-size: 0.8rem;
    font-style: italic;
}

/* AI Insights Styles */
.insights-card.coach-insight.ai-insight {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(124, 58, 237, 0.15) 100%);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 8px;
    padding: 15px;
    position: relative;
}

.ai-badge {
    background: linear-gradient(135deg, #7c3aed, #9333ea);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


.loading-insight {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
}

.loading-text {
    font-size: 0.9rem;
    margin-top: 8px;
    color: var(--text-muted);
}

.data-quality {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Filter Controls */
.filter-controls {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.filter-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.filter-row .filter-group {
    flex: 1;
    min-width: 250px;
    margin-bottom: 0;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 120px;
}

.filter-select, .date-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.filter-select:focus, .date-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.custom-range {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: end;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background: var(--accent-primary);
    color: white;
}

/* ========================================
   LOADING STATES
   ======================================== */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

button.loading {
    position: relative;
    color: transparent;
}

button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

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

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
}

@media (prefers-color-scheme: dark) {
    .loading-overlay {
        background: rgba(45, 55, 72, 0.8);
    }
}

.loading-overlay .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
}
/* Export Button */
.export-controls {
    display: flex;
    gap: 10px;
}

.btn-export {
    background: var(--success);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.btn-export:hover {
    background: #2f855a;
}

/* Inline Edit Form Styles */
.edit-type,
.edit-amount {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    margin-right: 10px;
}

.btn-save, .btn-cancel {
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 5px;
    transition: background-color 0.2s;
}

.btn-save {
    background: var(--success);
    color: white;
}

.btn-save:hover {
    background: #2f855a;
}

.btn-cancel {
    background: var(--danger);
    color: white;
}

.btn-cancel:hover {
    background: #c53030;
}

.edit-amount-group {
    display: inline-block;
    margin-right: 10px;
}

/* Sleep Tracking Styles */
.sleep-buttons {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.btn-sleep {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-fall-asleep {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-wake-up {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: white;
}

.btn-sleep:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-sleep:active {
    transform: translateY(0);
}

/* Diaper Tracking Styles */
.diaper-buttons {
    display: flex;
    gap: 10px;
    flex: 1;
}

.btn-diaper {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    background: white;
    color: #4a5568;
}

.btn-diaper:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: #cbd5e0;
}

.btn-diaper.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.btn-diaper:active {
    transform: translateY(0);
}

/* Edit Diaper Subtype Styles */
.edit-diaper-subtype-group {
    display: inline-block;
    margin-right: 10px;
}

.edit-diaper-subtype {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 2rem;
    }

    .tracker-section, .events-section, .stats-section {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group label {
        min-width: auto;
    }

    .custom-range {
        flex-direction: column;
        align-items: stretch;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-row .filter-group {
        min-width: auto;
    }
}

/* Timeline Chart Styles */
.timeline-section {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px var(--shadow);
    border: 1px solid var(--border-color);
}

.timeline-section h2 {
    color: var(--text-primary);
    margin-bottom: 25px;
    font-size: 1.5rem;
}

.timeline-chart {
    position: relative;
    background: var(--timeline-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px var(--shadow);
}

.timeline-hours {
    display: flex;
    justify-content: center;
    margin: 0 24px 15px 56px;
    border-bottom: 2px solid var(--timeline-line);
    padding-bottom: 8px;
}

.timeline-hours-labels {
    width: 100%;
    display: flex;
    justify-content: space-between;
}

.timeline-hour {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
}

.timeline-events {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.timeline-lane {
    display: grid;
    grid-template-columns: 56px 1fr;
    align-items: center;
    min-height: 60px;
    border-bottom: 1px solid var(--border-color);
    padding: 8px 0;
}

.timeline-lane:last-child {
    border-bottom: none;
}

.timeline-lane-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 1.1rem;
    color: var(--text-secondary);
    padding-left: 0;
}

.timeline-lane-track {
    position: relative;
    height: 40px;
    background: var(--timeline-hour-bg);
    border-radius: 20px;
    margin: 0 24px;
    padding: 0 24px;
}

.timeline-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    top: 50%;
    transform: translate(-50%, -50%);
}

.timeline-marker:hover {
    transform: translate(-50%, -50%) scale(1.5);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 10;
}

.timeline-marker.milk {
    background: #667eea;
}

.timeline-marker.diaper-pee {
    background: #4facfe;  /* Blue for pee */
}

.timeline-marker.diaper-poo {
    background: #8b6914;  /* Brown for poo */
}

.timeline-marker.diaper-both {
    background: linear-gradient(135deg, #4facfe 0%, #8b6914 100%);  /* Blue to brown gradient */
}

.timeline-marker.poo {
    background: #f093fb;  /* Legacy poo (shouldn't appear now) */
}

.timeline-marker.bath {
    background: #4facfe;
}

.timeline-marker.sleep {
    background: #43e97b;
}

/* Timeline Progress Bar Styles */
.timeline-progress-bar {
    position: absolute;
    height: 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.8;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.timeline-progress-bar:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 10;
}

.timeline-progress-bar.sleep {
    background: #43e97b;
}

.timeline-progress-bar.sleep.ongoing {
    background: linear-gradient(90deg, #43e97b, #38b2ac);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

.timeline-progress-bar .timeline-marker-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 20;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow);
}

.timeline-progress-bar:hover .timeline-marker-tooltip,
.timeline-progress-bar.show-tooltip .timeline-marker-tooltip {
    opacity: 1;
}

.timeline-progress-bar .timeline-marker-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--bg-secondary);
}

@media (max-width: 768px) {
    .timeline-progress-bar {
        height: 16px;
        border-radius: 8px;
    }

    .timeline-progress-bar .timeline-marker-tooltip {
        font-size: 0.75rem;
        padding: 8px 10px;
    }
}

/* Timeline Icon Marker Styles */
.timeline-icon-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    background: var(--bg-secondary);
    transition: all 0.2s ease;
}

.timeline-icon-marker:hover {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 10;
}

.timeline-icon {
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-icon-marker.milk {
    background: #667eea;
}

.timeline-icon-marker.diaper-pee {
    background: #4facfe;
}

.timeline-icon-marker.diaper-poo {
    background: #8b6914;
}

.timeline-icon-marker.diaper-both {
    background: linear-gradient(135deg, #4facfe 0%, #8b6914 100%);
}

.timeline-icon-marker.bath {
    background: #4facfe;
}

@media (max-width: 768px) {
    .timeline-icon-marker {
        width: 28px;
        height: 28px;
    }

    .timeline-icon {
        font-size: 14px;
    }
}

.timeline-marker-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 20;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow);
}

.timeline-marker:hover .timeline-marker-tooltip {
    opacity: 1;
}

.timeline-marker.show-tooltip .timeline-marker-tooltip {
    opacity: 1;
}

.timeline-marker-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--bg-secondary);
}

.timeline-empty {
    text-align: center;
    padding: 60px 20px;
    color: #cbd5e0;
    font-style: italic;
    font-size: 1rem;
}

@media (max-width: 768px) {
    .timeline-hours {
        margin: 0 16px 12px 56px;
    }

    .timeline-hour {
        font-size: 0.65rem;
    }

    .timeline-lane {
        grid-template-columns: 56px 1fr;
        min-height: 54px;
    }

    .timeline-lane-track {
        height: 32px;
        margin: 0 16px; /* Symmetric margins to match hours right margin */
        padding: 0 16px; /* Symmetric padding */
    }

    .timeline-marker {
        width: 10px;
        height: 10px;
    }

    .timeline-marker-tooltip {
        font-size: 0.75rem;
        padding: 8px 10px;
    }
}

/* ========================================
   MOBILE RESPONSIVENESS
   ======================================== */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .tracker-section, .events-section, .stats-section, .intelligence-section {
        padding: 15px;
    }

    .form-group-inline {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .form-group-inline label {
        min-width: auto;
        margin-bottom: 4px;
        font-weight: 600;
    }

    .form-group-inline select,
    .form-group-inline input {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
        box-sizing: border-box !important;
        padding: 8px 10px !important;
    }

    /* Specific fix for datetime-local input overflow */
    input[type="datetime-local"] {
        max-width: 100% !important;
        min-width: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        -webkit-appearance: none;
        appearance: none;
        font-size: 16px !important;
        padding: 8px 10px !important;
    }

    /* Ensure parent containers don't overflow */
    .form-group,
    .tracker-section {
        overflow: hidden;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    #eventType {
        width: 100%;
        font-size: 16px;
    }

    .diaper-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .btn-diaper {
        width: 100%;
        padding: 12px;
    }

    .event-item {
        padding: 12px;
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;
    }

    .event-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        flex: 1;
    }

    .event-type {
        font-size: 14px;
    }

    .event-time,
    .event-user {
        font-size: 12px;
    }

    .event-actions {
        flex-direction: column;
        gap: 6px;
        width: auto;
        align-items: flex-end;
    }

    .event-actions button {
        width: auto;
        min-width: 32px;
        height: 32px;
        padding: 6px;
        font-size: 18px;
    }

    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 18px;
    }

    .filter-row {
        flex-direction: column;
        gap: 12px;
    }

    .filter-controls select,
    .filter-controls input,
    .filter-controls button {
        width: 100%;
    }

    .timeline-chart {
        padding: 12px;
    }

    .timeline-hours {
        margin: 0 12px 12px 48px;
        border-bottom: 1px solid var(--border-color);
    }

    .timeline-hours-labels {
        width: 100%;
    }

    .timeline-lane {
        grid-template-columns: 48px 1fr;
        gap: 6px;
        min-height: 60px;
    }

    .timeline-lane-track {
        margin: 0 12px; /* Symmetric margins to match hours right margin */
        padding: 0 12px; /* Symmetric padding */
        height: 32px;
        width: auto;
    }

    .timeline-lane-label {
        padding-left: 0;
        font-size: 0.85rem;
    }

    .timeline-marker {
        width: 20px;
        height: 20px;
        transform: translateY(-50%);
    }

    .timeline-marker:hover {
        transform: translateY(-50%) scale(1.2);
    }

    .timeline-marker-tooltip {
        left: 50%;
        transform: translateX(-50%) translateY(-110%);
        white-space: nowrap;
        font-size: 11px;
        padding: 4px 8px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 28px;
    }

    .intelligence-section {
        padding: 20px;
    }

    .intelligence-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .intelligence-card {
        padding: 15px;
    }

    .intel-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        padding: 8px 0;
    }

    .intel-label {
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    .intel-value {
        text-align: right;
        font-size: 0.9rem;
        flex-grow: 1;
        overflow: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .intel-value .alert-badge,
    .intel-value .percentage-badge {
        margin-left: 6px;
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    .intel-pattern {
        font-size: 0.8rem;
        word-break: break-word;
    }
}

/* ========================================
   BABY PROFILE STYLES
   ======================================== */

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-text {
    flex: 1;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-profile {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--shadow);
}

.btn-profile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 10px 25px var(--shadow);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    margin: 0;
    color: var(--text-primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-modal:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

/* Profile Form Styles */
.profile-section {
    margin-bottom: 2rem;
}

.profile-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--accent-primary);
    padding-bottom: 0.5rem;
}

.profile-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.profile-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-info-item label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.profile-info-item .value {
    font-size: 1.1rem;
    color: var(--text-primary);
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.profile-form {
    display: grid;
    gap: 1rem;
}

.profile-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-form label {
    font-weight: 600;
    color: var(--text-secondary);
}

.profile-form input,
.profile-form textarea {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
}

.profile-form input:focus,
.profile-form textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Measurements Table */
.measurements-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.measurements-table th,
.measurements-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.measurements-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
}

.measurements-table tr:hover {
    background: var(--bg-tertiary);
}

.no-measurements {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-style: italic;
}

/* Action Buttons */
.profile-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-save {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-save:hover {
    background: #38a169;
}

.btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel:hover {
    background: var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        justify-content: flex-start;
    }

    .profile-info {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .profile-actions {
        flex-direction: column;
    }

    .measurements-table {
        font-size: 0.9rem;
    }

    .measurements-table th,
    .measurements-table td {
        padding: 0.5rem;
    }
}

/* ========================================
   ACTIVE SLEEP BANNER
   ======================================== */
.active-sleep-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 2px 20px rgba(102, 126, 234, 0.6);
    }
}

.sleep-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

.sleep-icon {
    font-size: 1.5rem;
    animation: zzz 1.5s ease-in-out infinite;
}

@keyframes zzz {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

.sleep-text {
    font-weight: 600;
    font-size: 1rem;
}

.sleep-duration {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 60px;
    text-align: center;
}

.sleep-started {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Adjust body padding when banner is shown */
body.has-sleep-banner {
    padding-top: 50px;
}

@media (max-width: 480px) {
    .active-sleep-banner {
        padding: 0.5rem;
    }

    .sleep-banner-content {
        gap: 0.5rem;
    }

    .sleep-text {
        font-size: 0.875rem;
    }

    .sleep-duration {
        font-size: 1rem;
    }

    .sleep-started {
        width: 100%;
        text-align: center;
        font-size: 0.75rem;
    }
}

/* Dark mode adjustments */
[data-theme="dark"] .active-sleep-banner {
    background: linear-gradient(135deg, #4c1d95 0%, #7c3aed 100%);
}

/* ========================================
   ERROR BANNER (persistent)
   ======================================== */
.error-banner {
    display: none;
    width: 100%;
    padding: 0.5rem 1rem;
    background: var(--danger);
    color: #fff;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 90vw;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    background: var(--bg-secondary);
    box-shadow: 0 4px 12px var(--shadow);
    border-left: 4px solid var(--accent-primary);
    animation: toast-in 0.3s ease-out;
    pointer-events: auto;
    max-width: 400px;
}

.toast.toast-success {
    border-left-color: var(--success);
}

.toast.toast-error {
    border-left-color: var(--danger);
}

.toast.toast-warning {
    border-left-color: var(--warning);
}

.toast.toast-out {
    animation: toast-out 0.3s ease-in forwards;
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@media (max-width: 480px) {
    .toast-container {
        left: 1rem;
        right: 1rem;
    }

    .toast {
        max-width: 100%;
    }
}

/* ========================================
   CONFIRMATION MODAL
   ======================================== */
.confirm-modal-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;
    animation: fade-in 0.2s ease-out;
}

.confirm-modal-overlay.confirm-modal-closing {
    animation: fade-out 0.2s ease-out forwards;
}

.confirm-modal {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px var(--shadow);
    animation: scale-in 0.2s ease-out;
}

.confirm-modal.confirm-modal-closing {
    animation: scale-out 0.2s ease-out forwards;
}

.confirm-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.confirm-modal-icon {
    font-size: 1.5rem;
}

.confirm-modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.confirm-modal-body {
    margin-bottom: 1.5rem;
}

.confirm-modal-body p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
    white-space: pre-line;
}

.confirm-modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.confirm-modal-footer button {
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    min-width: 100px;
}

.btn-confirm-cancel {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-confirm-cancel:hover {
    background: var(--border-color);
}

.btn-confirm-ok {
    background: var(--accent-primary);
    color: white;
}

.btn-confirm-ok:hover {
    filter: brightness(1.1);
}

.btn-confirm-warning {
    background: var(--warning, #f59e0b);
    color: white;
}

.btn-confirm-warning:hover {
    filter: brightness(1.1);
}

.btn-confirm-danger {
    background: var(--danger);
    color: white;
}

.btn-confirm-danger:hover {
    filter: brightness(1.1);
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scale-out {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* AI ask & action plans */
.ask-ai {
    margin-top: 16px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
}

.ask-ai h4 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.ask-ai .ask-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.ask-ai input {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.ask-answer {
    min-height: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.action-plans {
    margin-top: 12px;
}

.action-plans h4 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.plan-card {
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(102, 126, 234, 0.12) 100%);
}

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

.plan-title {
    font-weight: 600;
    color: var(--text-primary);
}

.plan-priority {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.plan-card ul {
    margin: 0;
    padding-left: 18px;
    color: var(--text-secondary);
}

.plan-card li {
    margin-bottom: 4px;
    line-height: 1.4;
}

.schedule-card {
    margin-top: 12px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
}

.schedule-card h4 {
    color: var(--text-primary);
    margin-bottom: 8px;
}
