@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&family=Roboto:wght@300;400;500;700&display=swap');

/* Mobile app-like behavior */
html {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y;
}

:root {
    --primary-color: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --secondary-color: #34a853;
    --danger-color: #ea4335;
    --warning-color: #fbbc04;
    --success-color: #34a853;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-tertiary: #80868b;
    --text-muted: #666;
    --border-color: #dadce0;
    --border-light: #e0e0e0;
    --bg-light: #f0f0f0;
    --success-green: #0f9d58;
    --success-bg: #e6f4ea;
    --danger-red: #d93025;
    --danger-bg: #fce8e6;
    --warning-amber: #f9ab00;
    --shadow-sm: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
    --shadow: 0 1px 3px 0 rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
    --shadow-lg: 0 2px 6px 2px rgba(60,64,67,.3), 0 8px 16px 6px rgba(60,64,67,.15);
}

/* Utility classes */
.d-none { display: none; }
.d-block { display: block; }
.d-inline-block { display: inline-block; }
.flex-row-center { display: flex; align-items: center; gap: 8px; }

/* Manual weight indicator */
#manualWeightIndicator:not(.d-none) {
    display: flex;
}
.legend-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }
.connection-desc { color: var(--text-secondary); font-size: 13px; margin-bottom: 12px; }
.connection-status { color: var(--secondary-color); font-size: 13px; margin-bottom: 8px; }
.connection-last-sync { color: var(--text-secondary); font-size: 12px; margin-bottom: 12px; }
.connection-divider { border-top: 1px solid var(--border-color); padding-top: 20px; margin-top: 20px; }
.input-narrow { width: 80px; }
.section-hint { display: block; color: var(--text-secondary); font-size: 14px; margin-bottom: 12px; }
.radio-label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.radio-group { display: flex; gap: 12px; margin-bottom: 12px; }
.m-0 { margin: 0; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-12 { margin-top: 12px; }
.mt-32 { margin-top: 32px; }
.week-label { margin: 0; flex: 1;}
.forecast-canvas { max-height: 300px; margin-top: 16px; }
.chart-controls { display: flex; gap: 16px; align-items: center; }
.chart-container-300 { position: relative; height: 300px; }
.chart-container-400 { position: relative; height: 400px; }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
    width: 100%;
    overscroll-behavior-x: none;
    overscroll-behavior-y: contain;
    line-height: 1.5;
    font-size: 14px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Allow text selection in inputs and textareas only */
input, textarea, [contenteditable] {
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
}

/* Only disable text selection on mobile/touch devices */
@media (hover: none) and (pointer: coarse) {
    body {
        -webkit-user-select: none;
        -moz-user-select: none;
        user-select: none;
    }
    
    button, .tab-btn, .stat-card, .week-day, .btn-primary, .btn-secondary {
        -webkit-user-select: none;
        -moz-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Header */
header {
    background: var(--card-bg);
    padding: 16px 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 400;
    font-family: 'Google Sans', 'Roboto', sans-serif;
    letter-spacing: 0;
    margin: 0;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    height: 50px;
    width: auto;
}

.login-logo {
    max-width: 100%;
    height: auto;
    margin-bottom: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* User Menu Dropdown */
.user-menu {
    position: relative;
}

.user-menu-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.user-menu-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.dropdown-arrow {
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.user-menu-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 200px;
    padding: 8px 0;
    z-index: 1000;
}

.dropdown-item {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s ease;
}

.dropdown-item:hover {
    background: var(--primary-light);
}

.dropdown-item.logout {
    color: var(--danger-color);
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
    padding-top: 12px;
}

.dropdown-item.logout:hover {
    background: var(--danger-bg);
}

/* Bootstrap Icons - Ensure proper display */
.bi {
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(2px);
}

.modal.show {
    display: flex; /* Show when needed */
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--card-bg);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    font-family: 'Google Sans', 'Roboto', sans-serif;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

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

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Settings modal specific styles */
.settings-tabs {
    padding: 16px 24px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.settings-modal-body {
    max-height: 500px;
    overflow-y: auto;
}

.settings-tab-content {
    display: none;
}

.settings-tab-content[style*="display: block"] {
    display: block;
}

.activity-settings-table {
    width: 100%;
    border-collapse: collapse;
}

.activity-settings-table th,
.activity-settings-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.activity-settings-table th {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 13px;
}

.activity-settings-table td {
    color: var(--text-color);
}

.auto-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-style: italic;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--card-bg);
}

/* Logs Tab */
.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.logs-header h2 {
    font-size: 24px;
    font-weight: 400;
    font-family: 'Google Sans', 'Roboto', sans-serif;
    color: var(--text-primary);
}

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

.logs-table-container {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.logs-table thead {
    background: var(--primary-light);
}

.logs-table th {
    padding: 16px;
    text-align: center;
    font-weight: 500;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.logs-table td {
    padding: 16px;
    color: var(--text-secondary);
}

.logs-table tbody tr:hover {
    background: var(--bg-color);
}

.logs-table tbody tr:last-child td {
    border-bottom: none;
}

.logs-table .measurement-value {
    font-weight: 500;
    color: var(--text-primary);
}

.logs-table .measurement-empty {
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Hidden weight entry styling */
.weight-entry-hidden {
    color: #6c757d !important;
    opacity: 0.6;
    background-color: #f8f9fa;
}

.weight-entry-hidden:hover {
    background-color: #f8f9fa !important;
}

.weight-entry-hidden td {
    color: #6c757d !important;
}

.weight-entry-hidden .measurement-value {
    color: #6c757d !important;
}

/* Weekly divider in Health table */
.week-divider-row {
    background: transparent !important;
}

.week-divider-row:hover {
    background: transparent !important;
}

.week-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    border-top: 2px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    background: antiquewhite;
}

.week-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.week-stat {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
}

.photo-thumbnail {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.photo-thumbnail:hover {
    transform: scale(1.1);
}

.photo-thumbnail-container {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-loading {
    font-size: 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

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

.photo-error {
    font-size: 20px;
    cursor: help;
}

.photo-empty {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    opacity: 0.5;
}

.notes-preview {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-actions {
    display: flex;
    gap: 8px;
    justify-content: end;
}

.log-action-btn {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    font-size: 16px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.log-action-btn:hover {
    background: var(--bg-color);
}

.log-action-btn.edit:hover {
    background: #e8f0fe;
    color: var(--primary-color);
}

.log-action-btn.delete:hover {
    background: var(--danger-bg);
    color: var(--danger-color);
}

.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-secondary);
}

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

.empty-state h3 {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    margin-bottom: 24px;
}

/* Login Page */
.login-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 24px;
}

.login-card {
    background: var(--card-bg);
    padding: 48px 40px;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    border: 1px solid var(--border-color);
    text-align: center;
}

.login-card h1 {
    color: var(--text-primary);
    font-size: 32px;
    font-weight: 400;
    font-family: 'Google Sans', 'Roboto', sans-serif;
    margin-bottom: 12px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 40px;
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
    width: 100%;
    max-width: 320px;
}

.login-footer {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 24px;
    margin-bottom: 0;
}

/* Tabs Navigation */
.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding: 4px 0;
}

.tab-btn {
    padding: 10px 18px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Google Sans', 'Roboto', sans-serif;
    color: var(--text-secondary);
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    white-space: nowrap;
    position: relative;
}

.tab-btn:hover {
    background: rgba(26, 115, 232, 0.08);
    color: var(--primary-color);
}

.tab-btn.active {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 500;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Google Sans', 'Roboto', sans-serif;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    letter-spacing: 0.25px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 1px 3px 0 rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
}

.btn-primary:active {
    box-shadow: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.btn-sync {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 8px;
    font-size: 14px !important; 
    font-weight: 500 !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sync:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.btn-sync i {
    font-size: 16px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card, .insight-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    border: 1px solid var(--border-color);
}

.stat-card:hover, .insight-card:hover {
    box-shadow: var(--shadow);
    border-color: transparent;
}

.stat-card h3, .insight-card h3 {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: 0.8px;
    font-weight: 500;
}

.stat-value, .insight-value {
    font-size: 36px;
    font-weight: 400;
    color: var(--text-primary);
    font-family: 'Google Sans', 'Roboto', sans-serif;
    line-height: 1.2;
}

.stat-unit, .insight-unit {
    font-size: 14px;
    color: var(--text-secondary);
    margin-left: 4px;
    font-weight: 400;
}

.insight-change {
    font-size: 0.9rem;
    margin-top: 5px;
}

.insight-change.positive {
    color: var(--success-color);
}

.insight-change.negative {
    color: var(--danger-color);
}

/* Dashboard Chart */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}

.week-navigation {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.week-nav-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.week-nav-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.week-nav-btn:active {
    transform: scale(0.95);
}

.week-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.week-nav-btn:disabled:hover {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-secondary);
    transform: none;
}

/* Week Stats Grid */
.week-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.week-stats .stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.week-stats .stat-card-large {
    grid-column: 1 / -1;
}

.week-stats .stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.week-stats .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.week-stats .stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.week-stats .stat-value.success {
    color: var(--success-green);
}

.week-stats .stat-value.warning {
    color: var(--warning-amber);
}

.week-stats .stat-value.danger {
    color: var(--danger-red);
}

.week-stats .stat-value.neutral {
    color: var(--text-secondary);
}

.week-stats .stat-sublabel {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.stat-reference {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
    margin-bottom: 8px;
}

.status-tag {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

.status-tag.success {
    background: var(--success-bg);
    color: var(--success-green);
}

.status-tag.warning {
    background: #fef7e0;
    color: var(--warning-amber);
}

.status-tag.danger {
    background: var(--danger-bg);
    color: var(--danger-red);
}

.status-tag.neutral {
    background: #f1f3f4;
    color: var(--text-secondary);
}

/* Goal Indicator */
.goal-indicator {
    margin-top: 12px;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.progress-label-start,
.progress-label-end {
    font-weight: 500;
    font-size: 13px;
}

.progress-label-current {
    position: absolute;
    font-weight: 700;
    font-size: 15px;
    color: white;
    transform: translateX(-50%);
    top: -32px;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 10;
    /* Prevent going off screen */
    max-width: 120px;
    left: clamp(60px, var(--left-position, 50%), calc(100% - 42px)) !important;
}

.progress-label-current.success {
    background: var(--success-green);
}

.progress-label-current.warning {
    background: var(--warning-amber);
}

.progress-label-current.danger {
    background: var(--danger-red);
}

.progress-label-current.neutral {
    background: var(--text-tertiary);
}

.weekly-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
}

.weekly-progress-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

.progress-bar-container {
    position: relative;
    padding-top: 8px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e8eaed;
    border-radius: 4px;
    overflow: visible;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.progress-percent {
    font-size: 11px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.target-message {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 8px;
    text-align: center;
}

.progress-fill.success {
    background: linear-gradient(90deg, var(--success-green), var(--success-green));
}

.progress-fill.warning {
    background: linear-gradient(90deg, var(--warning-amber), var(--warning-amber));
}

.progress-fill.danger {
    background: linear-gradient(90deg, var(--danger-red), var(--danger-red));
}

.progress-fill.neutral {
    background: linear-gradient(90deg, #80868b, #80868b);
}

.progress-text {
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: right;
}

/* Daily Breakdown */
.daily-breakdown-container {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.daily-breakdown-container h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Daily Tasks Section */
.daily-tasks-container {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    position: relative;
}

.daily-tasks-container h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Tasks completion animation */
.tasks-completion-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 80px;
    z-index: 10;
    pointer-events: none;
    animation: thumbsUpAnimation 1.5s ease-out forwards;
}

@keyframes thumbsUpAnimation {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-30deg);
        opacity: 0;
    }
    30% {
        transform: translate(-50%, -50%) scale(1.2) rotate(10deg);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
    70% {
        transform: translate(-50%, -50%) scale(1.05) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8) rotate(0deg);
        opacity: 0;
    }
}

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

#tasksChevron {
    transition: transform 0.2s;
}

.daily-tasks-list {
    display: flex;
    flex-direction: column;
    /* gap: 12px; */
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: white;
    /* border: 1px solid var(--border-color); */
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.task-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

/* .task-item.completed {
    background: #f0f9f4;
    border-color: #8BC34A;
} */

.task-checkbox {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: var(--success-color);
    transition: all 0.2s ease;
}

.task-checkbox.checked {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.task-label {
    flex: 1;
    font-size: 14px;
}

.task-label strong {
    color: var(--text-primary);
}

.task-detail {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.task-status {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 12px;
}

.task-status.complete {
    background: var(--success-bg);
    color: var(--success-green);
}

.task-status.incomplete {
    background: #fef7e0;
    color: var(--warning-amber);
}

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

.day-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.day-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.day-card.today {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.day-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
}

.day-date {
    font-weight: 600;
    font-size: 16px;
    color: var(--primary-color);
}

.day-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
    justify-content: space-between;
}

.day-weight {
    font-size: 14px;
    text-align: center;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-weight strong {
    font-size: 18px;
    color: var(--text-color);
}

.day-weight .empty {
    color: #dadce0;
    font-size: 12px;
}

.weight-change {
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
}

.weight-change.weight-gain {
    color: var(--danger-red);
    background: var(--danger-bg);
}

.weight-change.weight-loss {
    color: var(--success-green);
    background: var(--success-bg);
}

.day-activities {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 70px;
    flex-grow: 1;
    padding: 8px 0;
}

.activity-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 8px;
    background: transparent;
    border-radius: 4px;
    font-size: 12px;
}

.activity-item.activity-planned {
    opacity: 0.4;
}

.activity-item.activity-planned .activity-icon,
.activity-item.activity-planned .activity-calories {
    color: #999;
}

.activity-item.activity-missed {
    opacity: 0.5;
    background: #fce8e8;
}

.activity-item.activity-missed .activity-icon,
.activity-item.activity-missed .activity-calories {
    color: var(--danger-red);
}

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

.activity-time {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 11px;
}

.activity-calories {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 11px;
}

.day-activities .empty {
    color: #dadce0;
    font-size: 11px;
    text-align: center;
    padding: 8px;
}

/* Day card collapse functionality */
.day-card-chevron {
    font-size: 14px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
    display: none; /* Hidden on desktop */
}

.day-card-summary {
    display: none; /* Hidden on desktop and when expanded */
    gap: 12px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    align-items: center;
    justify-content: center;
}

.summary-weight {
    color: var(--text-color);
}

.summary-net {
    padding: 4px 8px;
    border-radius: 4px;
    /* background: #f1f3f4; */
}

.summary-net.negative {
    /* background: var(--success-bg); */
    color: #137333;
}

.summary-net.positive {
    /* background: var(--danger-bg); */
    color: #c5221f;
}

/* Goal Forecast Section */
.forecast-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    margin-top: 24px;
    box-shadow: var(--shadow-sm);
}

.forecast-container h3 {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.forecast-content {
    background: var(--primary-light);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 20px;
}

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

.forecast-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.forecast-date {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

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

.forecast-stat {
    display: flex;
    flex-direction: column;
}

.forecast-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.forecast-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.forecast-message {
    text-align: center;
    padding: 32px 24px;
    color: var(--text-secondary);
    background: var(--bg-color);
    border-radius: 8px;
}

.forecast-message i {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.forecast-message p {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.forecast-message small {
    font-size: 12px;
    color: var(--text-tertiary);
}

.forecast-warning {
    /* background: #fef7e0; */
    /* border: 1px solid #f59e0b; */
    color: #92400e;
}

.forecast-warning i {
    color: #f59e0b;
}

.forecast-success {
    background: var(--success-bg);
    border: 1px solid #34a853;
    color: #1e7e34;
}

.forecast-success i {
    color: #34a853;
}

.forecast-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-color);
    color: #b71c1c;
}

.forecast-error i {
    color: var(--danger-color);
}

.forecast-stats-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.forecast-stat-compact {
    text-align: center;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
}

.forecast-stat-compact .forecast-stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.forecast-stat-compact .forecast-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Nutrition section in daily breakdown */
.day-nutrition {
    font-size: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--bg-light);
    min-height: 70px;
}

.day-nutrition .empty {
    color: #dadce0;
    font-size: 11px;
    text-align: center;
    padding: 8px;
}

.nutrition-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    background: var(--bg-color);
    border-radius: 6px;
    background-color: transparent;
}

.nutrition-calories {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.nutrition-chart-container {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.nutrition-pie-chart {
    max-width: 100%;
    max-height: 100%;
}

.nutrition-label {
    font-size: 14px;
    display: inline-flex;
    align-items: center;
}

.nutrition-label .bi {
    font-size: 16px;
}

.nutrition-value {
    color: var(--text-color);
    font-size: 14px;
}

.nutrition-value.calorie-over {
    color: #E57373;
    font-weight: 700;
}

.nutrition-value.calorie-under {
    color: #8BC34A;
    font-weight: 700;
}

/* Net calories section at bottom of day card */
.day-net-calories {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 4px;
    margin-top: 8px;
    border-top: 1px solid var(--bg-light);
    background: var(--bg-color);
    border-radius: 4px;
}

.net-calories-label {
    font-size: 10px;
    color: var(--text-secondary);
}

.net-calories-display {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.net-calories-value {
    font-size: 14px;
    font-weight: 700;
}

.net-calories-limit {
    font-size: 10px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.net-calories-value.positive {
    color: #E57373; /* Red for calorie surplus */
}

.net-calories-value.negative {
    color: var(--success-green); /* Green for calorie deficit */
}

.calorie-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 4px;
    font-weight: 600;
    line-height: 1;
}

.calorie-badge.over {
    background-color: #fce4ec;
    color: #E57373;
}

.calorie-badge.under {
    background-color: #e8f5e9;
    color: #8BC34A;
}

.nutrition-macros {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.macro {
    font-weight: 500;
    white-space: nowrap;
}

/* Nutrition Container - matching Activity page style */
.nutrition-container {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.nutrition-item {
    padding: 16px 24px;
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 20px;
    align-items: center;
    transition: background 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
}

.nutrition-item:hover {
    background: rgba(26, 115, 232, 0.04);
}

.nutrition-item:last-child {
    border-bottom: none;
}

.nutrition-expand-icon {
    color: var(--text-secondary);
    font-size: 12px;
    transition: transform 0.3s ease;
    cursor: pointer;
    display: inline-block;
}

.nutrition-item.expanded .nutrition-expand-icon {
    transform: rotate(90deg);
}

.nutrition-date {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    min-width: 120px;
}

.nutrition-macros-bar {
    flex: 1;
    height: 18px;
    background: var(--bg-light);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    min-width: 300px;
}

.macro-segment {
    height: 100%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.macro-label {
    color: white;
    font-size: 10px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.macro-segment.protein {
    background: #8BC34A;
}

.macro-segment.carbs {
    background: #4A90E2;
}

.macro-segment.fat {
    background: #E57373;
}

.nutrition-macros-legend {
    display: flex;
    gap: 16px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.macro-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.macro-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.macro-dot.protein {
    background: #8BC34A;
}

.macro-dot.carbs {
    background: #4A90E2;
}

.macro-dot.fat {
    background: #E57373;
}

.nutrition-calories {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 13px;
    text-align: right;
    min-width: 100px;
}

/* Meal Details Card */
.meal-details-card {
    padding: 16px 24px 24px 56px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
}

.meal-detail-item {
    padding: 16px;
    background: white;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.meal-detail-item:last-child {
    margin-bottom: 0;
}

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

.meal-detail-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.meal-detail-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meal-type {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
}

.meal-name {
    font-size: 12px;
    color: var(--text-secondary);
}

.meal-calories {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 14px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    font-size: 14px;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
}

/* Old nutrition table styles (hidden, kept for backward compatibility) */
.nutrition-table {
    width: 100%;
    table-layout: fixed;
}

.nutrition-table td {
    text-align: center;
}

.nutrition-table td:first-child {
    text-align: center;
}

.nutrition-table td:nth-child(2),
.nutrition-table td:nth-child(3),
.nutrition-table td:nth-child(4) {
    width: 20%;
}

.nutrition-table td:nth-child(5) {
    width: 20%;
}

.nutrition-table .nutrition-value {
    font-weight: 600;
    color: var(--text-color);
}

.nutrition-table .nutrition-pct {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Original weekly breakdown styles (kept for backward compatibility) */
.weekly-breakdown {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.weekly-breakdown h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

.day-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: var(--bg-color);
    border-radius: 6px;
    font-size: 14px;
}

.activity-name {
    font-weight: 500;
}

.activity-details {
    color: var(--text-secondary);
    font-size: 13px;
}

.day-empty {
    color: var(--text-secondary);
    font-size: 14px;
    font-style: italic;
}

.dashboard-chart {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    width: 100%;
}

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

.chart-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    font-family: 'Google Sans', 'Roboto', sans-serif;
}

.chart-toggle {
    display: inline-flex;
    gap: 0;
    background: var(--bg-color);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.cef-legend {
    margin-top: 16px;
    padding: 12px;
    background: var(--background-secondary);
    border-radius: 8px;
}

.cef-legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    font-size: 13px;
}

.toggle-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Google Sans', 'Roboto', sans-serif;
    color: var(--text-secondary);
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.toggle-btn.active {
    background: var(--card-bg);
    color: var(--primary-color);
    box-shadow: 0 1px 3px 0 rgba(60,64,67,.3), 0 1px 2px 0 rgba(60,64,67,.15);
}

.toggle-btn:hover:not(.active) {
    color: var(--text-primary);
}

/* Image Viewer Modal */
.image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.image-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 20px 20px;
}

.image-viewer-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

#viewerImage {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.7);
}

.image-loading-spinner {
    position: absolute;
    color: white;
    font-size: 18px;
    font-weight: 500;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 36px;
    cursor: pointer;
    padding: 0;
    width: 50px;
    height: 50px;
    line-height: 1;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2001;
}

.image-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .image-modal-content {
        padding: 70px 10px 10px 10px;
    }
    
    .image-modal-close {
        top: 10px;
        right: 10px;
        width: 44px;
        height: 44px;
        font-size: 32px;
    }
    
    #viewerImage {
        border-radius: 4px;
    }
    
    /* Modal improvements for mobile */
    .modal-content {
        width: 95%;
        max-width: none;
        border-radius: 12px 12px 0 0;
        /* align-self: flex-end; /*Slide up from bottom */
        height: 75%;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 20px;
        max-height: calc(90vh - 140px);
    }
    
    .modal-close {
        width: 40px;
        height: 40px;
        font-size: 28px;
    }
    
    .modal-footer {
        padding-top: 16px;
        margin-top: 16px;
    }
    
    /* Form improvements for mobile */
    .form-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .form-group label {
        font-size: 14px;
    }
    
    .form-group input,
    .form-group select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }
    
    /* Checkbox group mobile improvements */
    .checkbox-group {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }
    
    .checkbox-group label {
        padding: 10px 8px;
        font-size: 15px;
        min-height: 44px;
    }
    
    .checkbox-group input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
    
    /* Button improvements for mobile */
    .btn-primary,
    .btn-secondary {
        padding: 12px 24px;
        font-size: 15px;
        min-height: 44px; /* Apple's recommended touch target */
    }
}

.dashboard-chart h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Entry Form */
.entry-form {
    background: var(--card-bg);
    padding: 32px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    max-width: 600px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
}

.entry-form h2 {
    margin-bottom: 32px;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 400;
    font-family: 'Google Sans', 'Roboto', sans-serif;
}

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

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

.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
    width: 100%;
    max-width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
    min-height: 40px; /* Better touch target */
}

.checkbox-group label:hover {
    background: rgba(66, 133, 244, 0.05);
}

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

.measurements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
}

.photo-preview {
    margin-top: 16px;
    max-width: 300px;
}

.photo-preview img {
    width: 100%;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

/* Progress Controls */
.progress-controls {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-range label {
    font-weight: 500;
}

/* Chart Container */
.chart-container, .measurements-chart, .exercise-chart, .trend-analysis {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.chart-container canvas,
.measurements-chart canvas,
.exercise-chart canvas,
.trend-analysis canvas {
    max-height: 320px;
}

#dashboardChart {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 320px !important;
    max-height: 320px;
    z-index: 1;
}

#dashboardMeasurementsChart {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 320px !important;
    max-height: 320px;
    z-index: 2;
}

/* Photo Grid */
.recent-photos {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.recent-photos h2 {
    margin-bottom: 20px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.photo-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.photo-item:hover {
    transform: scale(1.05);
}

.photo-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.photo-item .photo-date {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px;
    font-size: 0.85rem;
}

/* Photo Comparison */
.photo-comparison {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: 30px;
}

.comparison-controls {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.comparison-controls > div {
    flex: 1;
    min-width: 200px;
}

.comparison-controls label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.comparison-controls select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.comparison-item {
    text-align: center;
}

.comparison-item h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.comparison-item img {
    width: 100%;
    max-width: 400px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.comparison-item p {
    margin-top: 10px;
    color: var(--text-secondary);
}

/* Exercise Tab */
.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

#syncStravaBtn {
    display: none;
    align-items: center;
    gap: 8px;
}

.activity-calendar {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

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

.activity-calendar h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    font-family: 'Google Sans', 'Roboto', sans-serif;
}

.calendar-navigation {
    display: flex;
    align-items: center;
    gap: 16px;
}

#calendarMonthLabel {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 120px;
    text-align: center;
}

.calendar-nav-btn {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.calendar-nav-btn:hover {
    background: var(--card-bg);
    border-color: #1a73e8;
    color: #1a73e8;
}

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

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: 8px;
    padding: 8px;
    font-size: 13px;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    border: 1px solid transparent;
}

.calendar-day.has-activity {
    background: rgba(26, 115, 232, 0.08);
    border-color: var(--primary-color);
    cursor: pointer;
}

.calendar-day.has-activity:hover {
    background: rgba(26, 115, 232, 0.12);
    box-shadow: var(--shadow-sm);
}

.calendar-day-number {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.calendar-day.today .calendar-day-number {
    color: var(--primary-color);
    font-weight: 600;
}

.calendar-day-icon {
    font-size: 20px;
}

.calendar-day.empty {
    background: transparent;
}

.calendar-weekday {
    text-align: center;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activities-container {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.activity-item {
    padding: 2px 24px;
    /* border-bottom: 0.5px solid var(--border-color); */
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 20px;
    align-items: center;
    transition: background 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    background-color: transparent;
}

.activity-item:hover {
    background: rgba(26, 115, 232, 0.04);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-expand-icon {
    color: var(--text-secondary);
    font-size: 12px;
    transition: transform 0.3s ease;
    cursor: pointer;
    display: inline-block;
}

.activity-item.expanded .activity-expand-icon {
    transform: rotate(90deg);
}

.activity-icon {
    font-size: 32px;
}

.activity-details h4 {
    margin-bottom: 6px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13px;
}

.activity-details p {
    font-size: 13px;
    color: var(--text-secondary);
}

.activity-stats-container {
    text-align: right;
}

.activity-stats {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.activity-stats .stat {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 13px;
}

.activity-stats-expanded {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.activity-stats div,
.activity-stats-expanded div {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* Analytics */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.trend-text {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 8px;
    line-height: 1.8;
}

.trend-text p {
    margin-bottom: 10px;
}

.trend-text strong {
    color: var(--primary-color);
}

.milestone-tracker {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: 30px;
}

.milestones-container {
    margin-top: 20px;
}

.milestone-item {
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.milestone-item.completed {
    background: #e8f5e9;
}

.milestone-icon {
    font-size: 2rem;
}

.milestone-icon.completed {
    color: var(--success-color);
}

.milestone-icon.pending {
    color: var(--text-secondary);
}

.milestone-info h4 {
    margin-bottom: 3px;
}

.milestone-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--bg-color);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

.toast {
    background: var(--card-bg);
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(60,64,67,.3), 0 2px 4px -1px rgba(60,64,67,.15);
    margin-bottom: 12px;
    min-width: 300px;
    animation: slideIn 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    border: 1px solid var(--border-color);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

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

.toast.info {
    border-left: 4px solid var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 20px;
    }
}

@media (max-width: 968px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    header {
        padding: 10px 16px;
        gap: 12px;
    }

    header h1 {
        font-size: 18px;
        margin: 0;
    }

    .header-logo {
        height: 35px;
    }

    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

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

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

    .progress-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .entry-form {
        padding: 20px;
    }

    .measurements-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .chart-header h2 {
        font-size: 16px;
        width: 100%;
    }
    
    .chart-header > div {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .chart-toggle {
        width: 100%;
        justify-content: space-between;
    }
    
    .toggle-btn {
        padding: 6px 12px;
        font-size: 12px;
        flex: 1;
    }
    
    .dashboard-chart {
        padding: 16px;
    }
    
    .dashboard-header {
        margin-bottom: 16px;
    }
    
    .activity-item {
        padding: 12px 16px;
        gap: 12px;
    }
    
    .activity-icon {
        font-size: 24px;
    }
    
    .logs-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .logs-header h2 {
        font-size: 18px;
    }
    
    .logs-actions {
        width: 100%;
        flex-direction: row;
        gap: 8px;
    }
    
    .logs-actions .btn-sync {
        flex-shrink: 0;
    }
    
    .logs-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .logs-table {
        font-size: 12px;
        min-width: 400px;
    }
    
    .logs-table th,
    .logs-table td {
        padding: 10px 6px;
    }
    
    /* Hide measurement columns on mobile */
    .logs-table th:nth-child(3),
    .logs-table th:nth-child(4),
    .logs-table th:nth-child(5),
    .logs-table th:nth-child(6),
    .logs-table th:nth-child(7),
    .logs-table td:nth-child(3),
    .logs-table td:nth-child(4),
    .logs-table td:nth-child(5),
    .logs-table td:nth-child(6),
    .logs-table td:nth-child(7) {
        display: none;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    header h1 {
        font-size: 18px;
    }

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

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

    .stat-card, .insight-card {
        padding: 16px;
    }

    /* .activity-item {
        flex-direction: column;
        align-items: flex-start;
    } */

    .activity-stats {
        width: 100%;
        justify-content: space-between;
    }
    
    .dashboard-chart {
        padding: 12px;
    }
    
    .chart-header h2 {
        font-size: 14px;
    }
    
    .toggle-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .logs-table {
        font-size: 11px;
        min-width: 350px;
    }
    
    .logs-table th,
    .logs-table td {
        padding: 8px 4px;
    }
    
    /* Nutrition table mobile layout */
    .nutrition-table {
        font-size: 11px;
        display: block;
        width: 100%;
        overflow: visible;
    }
    
    .nutrition-table thead {
        display: none;
    }
    
    .nutrition-table tbody {
        display: block;
        width: 100%;
    }
    
    .nutrition-table tbody tr {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        padding: 12px 8px;
        gap: 6px;
        width: 100%;
        overflow: visible;
        border-bottom: none;
    }
    
    .nutrition-table tbody tr + tr {
        border-top: none;
    }
    
    .nutrition-table tbody td {
        border-left: none !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        text-align: left !important;
    }
    
    /* Date */
    .nutrition-table tbody td:nth-child(1) {
        flex: 0 0 auto;
        font-weight: 600;
        font-size: 12px;
    }
    
    /* Macros - show only percentages */
    .nutrition-table tbody td:nth-child(2),
    .nutrition-table tbody td:nth-child(3),
    .nutrition-table tbody td:nth-child(4) {
        flex: 0 0 auto;
        font-size: 11px;
        white-space: nowrap;
    }
    
    .nutrition-table tbody td:nth-child(2) .nutrition-value,
    .nutrition-table tbody td:nth-child(3) .nutrition-value,
    .nutrition-table tbody td:nth-child(4) .nutrition-value {
        display: none !important;
    }
    
    .nutrition-table tbody td:nth-child(2) .nutrition-pct,
    .nutrition-table tbody td:nth-child(3) .nutrition-pct,
    .nutrition-table tbody td:nth-child(4) .nutrition-pct {
        display: inline !important;
        visibility: visible !important;
    }
    
    .nutrition-table tbody td:nth-child(2) .nutrition-pct::before {
        content: "P:";
        color: var(--text-muted);
        margin-right: 2px;
    }
    
    .nutrition-table tbody td:nth-child(3) .nutrition-pct::before {
        content: "C:";
        color: var(--text-muted);
        margin-right: 2px;
    }
    
    .nutrition-table tbody td:nth-child(4) .nutrition-pct::before {
        content: "F:";
        color: var(--text-muted);
        margin-right: 2px;
    }
    
    /* Calories on right */
    .nutrition-table tbody td:nth-child(5) {
        flex: 1;
        text-align: right !important;
        font-size: 14px;
        font-weight: 600;
        justify-content: flex-end;
    }
    
    .nutrition-table tbody td:nth-child(5) .calorie-over {
        color: #E57373 !important;
        font-weight: bold;
    }
    
    .nutrition-table tbody td:nth-child(5) .calorie-under {
        color: #8BC34A !important;
        font-weight: bold;
    }

    /* New nutrition-item mobile layout */
    .nutrition-item {
        padding: 12px 16px;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 8px 12px;
    }

    .nutrition-expand-icon {
        grid-row: 1;
        grid-column: 1;
    }

    .nutrition-date {
        grid-row: 1;
        grid-column: 2;
        font-size: 14px;
        min-width: auto;
    }

    .nutrition-macros-bar {
        grid-row: 2;
        grid-column: 1 / -1;
        min-width: auto;
        height: 24px;
    }

    .nutrition-calories {
        grid-row: 1;
        grid-column: 3;
        font-size: 14px;
        min-width: auto;
        text-align: right;
    }

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

    /* Meal details mobile adjustments */
    .meal-details-card {
        padding: 12px 16px 16px 40px;
    }

    .meal-detail-item {
        padding: 12px;
    }

    .meal-macros-text {
        font-size: 11px;
        gap: 8px;
    }
}

/* Activity filter tags */
.activity-filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.filter-tag {
    padding: 6px 14px;
    border: 1px solid #dadce0;
    border-radius: 16px;
    background: white;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-tag:hover {
    background: var(--bg-color);
    border-color: #4285f4;
}

.filter-tag.active {
    background: #4285f4;
    color: white;
    border-color: #4285f4;
}

/* Calendar planned day interactions */
.calendar-planned-day {
    transition: background 0.2s;
}

.calendar-planned-day:hover {
    background: rgba(66, 133, 244, 0.05);
    border-radius: 4px;
}

.calendar-skip-btn {
    background: rgba(234, 67, 53, 0.95);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
    transition: all 0.2s;
}

.calendar-skip-btn:hover {
    background: rgba(211, 56, 40, 1);
    transform: scale(1.1);
}

/* Planned Activities List Modal */
.modal-large {
    max-width: 800px;
    width: 90%;
}

#plannedActivitiesListContainer {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto;
    margin-bottom: 16px;
}

.planned-activities-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 600px; /* Prevent squishing on mobile */
}

.planned-activities-table thead {
    background: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 1;
}

.planned-activities-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-light);
    white-space: nowrap;
}

.planned-activities-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--bg-light);
    vertical-align: middle;
}

.planned-activities-table tr:hover {
    background: var(--bg-color);
}

.planned-activity-actions {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.btn-icon {
    padding: 8px 14px;
    font-size: 13px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    white-space: nowrap;
    min-height: 36px; /* Better touch target */
}

.btn-edit {
    background: #4285f4;
    color: white;
}

.btn-edit:hover {
    background: #3367d6;
}

.btn-delete {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-delete:hover {
    background: #d33828;
}

/* Activity Details Modal */
.activity-detail-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.activity-detail-icon {
    font-size: 48px;
}

.activity-detail-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
    width: 100%;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

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

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

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

.empty-state-text {
    font-size: 16px;
    margin-bottom: 8px;
}

/* Skip button for planned activities */
.skip-btn {
    background: transparent;
    border: none;
    color: var(--danger-color);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 4px;
    border-radius: 3px;
    transition: all 0.2s;
    min-width: 32px; /* Better touch target */
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.skip-btn:hover {
    background: rgba(234, 67, 53, 0.1);
}

/* Dashboard skip button - always visible, no opacity */
.dashboard-skip-btn {
    opacity: 1;
    font-size: 22px;
}

/* Disabled field styling */
input:disabled, select:disabled {
    background: #f5f5f5;
    color: #9e9e9e;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Undo toast styling */
.toast.undo-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.toast.undo-toast .undo-btn {
    background: transparent;
    border: 1px solid white;
    color: white;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
    min-height: 36px; /* Better touch target */
}

.toast.undo-toast .undo-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Mobile optimizations for new features */
@media (max-width: 768px) {
    .modal-large {
        width: 95%;
        max-width: none;
    }
    
    #plannedActivitiesListContainer {
        max-height: 60vh;
    }
    
    .planned-activities-table {
        font-size: 12px;
        min-width: 550px;
    }
    
    .planned-activities-table th,
    .planned-activities-table td {
        padding: 10px 6px;
    }
    
    .btn-icon {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 40px; /* Larger touch target on mobile */
    }
    
    .skip-btn {
        font-size: 20px;
        min-width: 36px;
        min-height: 36px;
        padding: 6px 10px;
    }
    
    /* Calendar skip button larger on mobile */
    .calendar-skip-btn {
        width: 32px;
        height: 32px;
        font-size: 22px;
    }
    
    .toast.undo-toast {
        font-size: 14px;
    }
    
    .toast.undo-toast .undo-btn {
        font-size: 14px;
        padding: 8px 18px;
        min-height: 40px;
    }
    
    /* Make modal content scrollable on small screens */
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-body {
        max-height: calc(90vh - 120px);
        overflow-y: auto;
    }
}

/* ===================================
   AI Food Logger Styles
   =================================== */

/* AI Food Logger Modal */
.ai-food-logger-modal {
    max-width: 650px;
}

/* Input Mode Toggle */
.input-mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.input-mode-toggle .mode-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.input-mode-toggle .mode-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.input-mode-toggle .mode-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Database Search Section */
.food-search-section {
    margin-bottom: 20px;
}

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

.search-input-container .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 18px;
}

.food-search-input {
    width: 100%;
    padding: 12px 40px 12px 40px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.2s;
}

.food-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    font-size: 18px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.clear-search-btn:hover {
    color: var(--text-primary);
}

/* Recent & Frequent Foods */
.recent-foods-section {
    margin-bottom: 24px;
}

.recent-foods-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recent-foods-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.food-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.food-card:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

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

.food-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
    flex: 1;
}

.food-card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.food-source-mini {
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: 500;
    white-space: nowrap;
}

.food-source-mini.source-openfoodfacts {
    background: #e8f5e9;
    color: #2e7d32;
}

.food-source-mini.source-usda {
    background: #fff3e0;
    color: #e65100;
}

.food-source-mini.source-cache,
.food-source-mini.source-database {
    background: #e3f2fd;
    color: #1565c0;
}

.frequent-badge {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.recent-badge {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Mini badges for search results */
.usage-badge {
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.frequent-badge-mini {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
}

.recent-badge-mini {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: white;
}

.food-card-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.food-calories {
    font-weight: 600;
    color: var(--primary-color);
}

.food-card-macros {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Search Results */
.search-results-section {
    margin-bottom: 20px;
}

.search-results-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.food-result-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.food-result-item:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.food-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.food-result-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
    flex: 1;
}

.food-result-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.food-result-source {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 500;
    white-space: nowrap;
}

.food-result-source.source-openfoodfacts {
    background: #e8f5e9;
    color: #2e7d32;
}

.food-result-source.source-usda {
    background: #fff3e0;
    color: #e65100;
}

.food-result-source.source-cache {
    background: #fff9e6;
    color: #f59e0b;
}

.food-result-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.food-result-calories {
    font-weight: 600;
    color: var(--primary-color);
}

.food-result-macros {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Source Badge in Results */
.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
}

.source-badge.source-ai {
    background: #e3f2fd;
    color: #1565c0;
}

.source-badge.source-openfoodfacts {
    background: #e8f5e9;
    color: #2e7d32;
}

.source-badge.source-usda {
    background: #fff3e0;
    color: #e65100;
}

.source-badge.source-cache {
    background: #fff9e6;
    color: #f59e0b;
}

.source-badge.source-database {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Serving Size Editor */
.serving-size-editor {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.serving-size-editor input {
    width: 80px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.serving-multiplier {
    font-size: 18px;
    color: var(--text-secondary);
    font-weight: 500;
}

.serving-unit {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Back Button */
.back-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.back-btn:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

/* Food Input Sections */
.food-input-section {
    margin-bottom: 28px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.food-input-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Audio Recording */
.textarea-with-voice {
    position: relative;
    margin-bottom: 8px;
}

.recording-btn-inline {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary-color);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    z-index: 1;
}

.recording-btn-inline:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.recording-btn-inline:active {
    transform: scale(0.95);
}

.recording-btn-inline.recording {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    animation: pulseScale 1.5s infinite;
}

@keyframes pulseScale {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(245, 87, 108, 0.6);
    }
}

.recording-btn-inline .bi {
    font-size: 18px;
}

.recording-countdown {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #f5576c;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Transcript Input */
.food-transcript {
    width: 100%;
    padding: 12px 52px 12px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s;
}

.food-transcript:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.food-transcript::placeholder {
    color: #bbb;
    opacity: 0.6;
}

/* Photo Upload */
.photo-input-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.food-photo-preview {
    margin-top: 12px;
}

.photo-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.photo-comparison-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border-light);
    background: white;
}

.photo-comparison-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.photo-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

/* Status Messages */
.input-status {
    min-height: 24px;
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

/* Analyze Button */
.analyze-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 24px;
}

.analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--text-secondary);
}

/* Nutrition Results */
.nutrition-results {
    padding: 0;
    background: transparent;
    border-radius: 0;
    border: none;
    animation: slideUp 0.3s ease-out;
}

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

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

.nutrition-form {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin-bottom: 16px;
}

.nutrition-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.nutrition-form .form-group {
    margin-bottom: 16px;
}

.nutrition-form .form-row .form-group {
    margin-bottom: 0;
}

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

.nutrition-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.nutrition-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.nutrition-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* AI Confidence Badge */
.ai-confidence {
    padding: 14px 0;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.ai-confidence strong {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
}

.ai-confidence small {
    font-size: 12px;
    opacity: 0.9;
}

/* Meal Items Breakdown */
.meal-items-section {
    margin: 20px 0;
}

.toggle-items-btn {
    width: 100%;
    padding: 12px;
    background: var(--bg-color);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s;
}

.toggle-items-btn:hover {
    background: #e9ecef;
    border-color: var(--primary-color);
}

.toggle-items-btn i {
    font-size: 18px;
    color: var(--primary-color);
    transition: transform 0.3s;
}

.toggle-items-btn.expanded i {
    transform: rotate(45deg);
}

.meal-items-container {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-color);
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

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

.meal-item-row {
    display: grid;
    grid-template-columns: 2fr 100px 40px;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--border-light);
}

.meal-item-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.meal-item-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

/* New portion input layout */
.meal-item-portion-input {
    display: flex;
    align-items: center;
    gap: 6px;
}

.meal-item-portion-size-input {
    width: 70px;
    padding: 6px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    background: white;
    text-align: center;
    transition: all 0.2s;
}

.meal-item-portion-size-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.meal-item-portion-unit {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Legacy support for old quantity input */
.meal-item-quantity-input {
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-color);
    transition: all 0.2s;
}

.meal-item-quantity-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.meal-item-calories-input {
    padding: 8px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    text-align: right;
    background: var(--bg-color);
    transition: all 0.2s;
    cursor: not-allowed;
}

.meal-item-calories-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.meal-item-cal-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: left;
}

.meal-item-quantity {
    font-size: 13px;
    color: var(--text-secondary);
}

.meal-item-calories {
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.modal-actions button {
    flex: 1;
    min-width: 120px;
}

/* Source Badges for Nutrition Table */
.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

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

.badge-fatsecret {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

/* Expandable Nutrition Table Rows */
.nutrition-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.nutrition-row:hover {
    background-color: var(--bg-color);
}

.nutrition-row.expanded {
    background-color: #f0f4ff;
}

.expand-arrow {
    display: inline-block;
    transition: transform 0.3s ease;
    margin-right: 8px;
}

.nutrition-row.expanded .expand-arrow {
    transform: rotate(90deg);
}

.meal-details {
    background: var(--bg-color);
    border-top: 1px solid var(--border-light);
}

.meal-details-content {
    padding: 16px 24px;
}

.meal-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 16px;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
}

.meal-item:last-child {
    margin-bottom: 0;
}

.meal-time {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    min-width: 60px;
}

.meal-info {
    flex: 1;
}

.meal-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.meal-macros {
    font-size: 12px;
    color: var(--text-muted);
}

.meal-photo-thumb {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid #ddd;
    transition: transform 0.2s;
}

.meal-photo-thumb:hover {
    transform: scale(1.1);
    border-color: #667eea;
}

.meal-actions {
    display: flex;
    gap: 8px;
}

.meal-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: var(--bg-light);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 16px;
}

.meal-action-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.meal-action-btn.delete-btn:hover {
    background: var(--danger-color);
}

.source-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 8px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .ai-food-logger-modal {
        max-width: 95vw;
    }

    .input-mode-toggle {
        gap: 6px;
        padding: 3px;
    }

    .input-mode-toggle .mode-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .recent-foods-list {
        grid-template-columns: 1fr;
    }

    .food-card {
        padding: 10px;
    }

    .search-results-list {
        max-height: 300px;
    }

    .serving-size-editor input {
        width: 60px;
    }

    .recording-btn-inline {
        width: 40px;
        height: 40px;
        top: 10px;
        right: 10px;
    }

    .recording-btn-inline .bi {
        font-size: 20px;
    }

    .photo-comparison {
        grid-template-columns: 1fr;
    }

    .nutrition-form .form-row {
        grid-template-columns: 1fr;
    }

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

    .modal-actions button {
        width: 100%;
    }

    .meal-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .meal-time {
        min-width: auto;
    }

    .meal-actions {
        justify-content: flex-end;
    }
}

/* Loading Animation for AI Model */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.loading-shimmer {
    background: linear-gradient(to right, var(--bg-light) 8%, var(--border-light) 18%, var(--bg-light) 33%);
    background-size: 1000px 100%;
    animation: shimmer 2s linear infinite;
}

/* Meal Breakdown Rows (integrated into main nutrition table) */
.meal-breakdown-row {
    display: none !important;
    background-color: #fafafa;
    transition: background-color 0.2s ease;
}

.meal-breakdown-row.visible {
    display: table-row !important;
}

.meal-breakdown-row.visible:hover {
    background-color: #f5f5f5;
}

.meal-breakdown-row td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #e8e8e8;
}

.meal-detail-cell {
    padding-left: 32px !important;
    overflow: hidden;
}

.meal-cell-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 350px;
}

.meal-name-sub {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 350px;
}

.meal-description-sub {
    font-size: 12px;
    color: var(--text-tertiary);
    font-style: italic;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meal-macro-cell {
    font-weight: 400;
    color: #202124;
}

.meal-macro-cell .nutrition-value {
    font-weight: 500;
}

.meal-breakdown-actions {
    display: inline-flex;
    gap: 4px;
    margin-left: 12px;
}

.meal-action-btn-icon {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.meal-action-btn-icon:hover {
    background: #e8e8e8;
}

.meal-action-btn-icon.edit:hover {
    color: var(--primary-color);
}

.meal-action-btn-icon.delete:hover {
    color: var(--danger-color);
}

.meal-action-btn-icon i {
    font-size: 14px;
}

.meal-source-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 3px;
    background: #e8f0fe;
    color: #1a73e8;
    margin-left: 6px;
    vertical-align: middle;
}

.meal-source-badge.fatsecret-badge {
    background: #fff3e0;
    color: #e65100;
}

.meal-photo-thumb-small {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    margin-top: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    cursor: pointer;
}

.fatsecret-note-row {
    display: none !important;
}

.fatsecret-note-row.visible {
    display: table-row !important;
}

.fatsecret-note-row td {
    padding: 0 !important;
}

.fatsecret-note {
    margin: 8px 16px 8px 32px;
    padding: 10px 12px;
    background: #fff3e0;
    border-left: 3px solid #ff9800;
    border-radius: 4px;
    font-size: 12px;
    color: #e65100;
}

/* Responsive adjustments for meal breakdown rows */
@media (max-width: 768px) {
    .meal-breakdown-row.visible {
        display: flex !important;
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 10px 8px;
        gap: 8px;
        width: 100%;
    }
    
    .meal-breakdown-row td {
        border-left: none !important;
        border-bottom: none !important;
        padding: 0 !important;
        width: auto !important;
    }
    
    /* Meal name column - full width */
    .meal-breakdown-row .meal-detail-cell {
        flex: 1 1 100%;
        padding-left: 0 !important;
        font-size: 12px;
        order: 1;
    }
    
    .meal-cell-content {
        gap: 4px;
        width: 100%;
    }
    
    .meal-cell-content > div:first-child {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-wrap: wrap;
    }
    
    .meal-name-sub {
        font-size: 12px;
        white-space: normal;
        line-height: 1.4;
        overflow: visible;
        text-overflow: clip;
        width: 100%;
    }
    
    .meal-description-sub {
        display: none;
    }
    
    .meal-photo-thumb-small {
        width: 32px;
        height: 32px;
        margin-top: 4px;
    }
    
    /* Hide protein, carbs, fat columns on mobile */
    .meal-breakdown-row td:nth-child(2),
    .meal-breakdown-row td:nth-child(3),
    .meal-breakdown-row td:nth-child(4) {
        display: none !important;
    }
    
    /* Calories and actions on right - same line as meal type */
    .meal-breakdown-row td:nth-child(5) {
        flex: 0 0 auto;
        text-align: right !important;
        font-size: 14px;
        font-weight: 600;
        display: flex !important;
        align-items: center;
        gap: 6px;
        order: 2;
        margin-left: auto;
    }
    
    .meal-breakdown-actions {
        display: inline-flex;
        flex-direction: row;
        gap: 4px;
    }
    
    .meal-action-btn-icon {
        padding: 5px;
    }
    
    .meal-action-btn-icon i {
        font-size: 14px;
    }
    
    .meal-source-badge {
        font-size: 9px;
        padding: 2px 5px;
    }
    
    .fatsecret-note-row.visible {
        display: flex !important;
        padding: 0 8px;
        width: 100%;
    }
    
    .fatsecret-note-row td {
        padding: 0 !important;
        width: 100%;
    }
    
    .fatsecret-note {
        margin: 8px 0 8px 16px;
        padding: 8px 10px;
        font-size: 10px;
    }
}

/* Collapsible day cards on mobile */
@media (max-width: 768px) {
    .daily-breakdown {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .day-card {
        transition: all 0.3s ease;
    }
    
    .day-card-chevron {
        display: block; /* Show on mobile */
    }
    
    .day-card.collapsed .day-card-chevron {
        transform: rotate(-90deg);
    }
    
    .day-card.expanded .day-card-chevron {
        transform: rotate(0deg);
    }
    
    .day-card.collapsed .day-content {
        display: none;
    }
    
    .day-card.collapsed .day-card-summary {
        display: flex;
    }
    
    .day-card.expanded .day-card-summary {
        display: none;
    }
    
    .day-card .day-header {
        cursor: pointer;
        user-select: none;
    }
    
    /* Make today card stand out even when collapsed */
    .day-card.today.collapsed {
        border-color: var(--primary-color);
        background: var(--primary-light);
    }
}