
:root {
    --primary-color: #78C2AD;
    --primary-light: #a8dccf;
    --primary-dark: #5a9f8a;
    --primary-contrast: #ffffff;
    --secondary-color: #6c757d;
    --success-color: #56cc9d;
    --warning-color: #ffce67;
    --danger-color: #ff7851;
    --info-color: #6cc3d5;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --body-bg: #f9f9f9;
    --card-bg: #ffffff;
    --text-color: #495057;
    --text-muted: #6c757d;
    --border-radius: 0.5rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --transition: all 0.2s ease-in-out;
    --font-size-base: clamp(1rem, 0.95rem + 0.25vw, 1.1rem);
    --font-size-heading: clamp(1.5rem, 1.3rem + 1vw, 2.2rem);
    --spacing: 1rem;
}

html, body {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: var(--body-bg);
    color: var(--text-color);
}

body {
    font-size: var(--font-size-base);
    padding-bottom: 100px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
}

h1, .h1 {
    font-size: var(--font-size-heading);
    font-weight: 700;
}

h3, .h3 {
    font-size: clamp(1.2rem, 1.1rem + 0.5vw, 1.6rem);
    font-weight: 600;
}

h5, .h5 {
    font-weight: 600;
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 1rem;
    backdrop-filter: blur(5px);
}

.loading-overlay.active {
    display: flex;
}

/* Foundation overrides and custom styles */
.grid-container {
    padding: 20px;
    max-width: 540px;
    margin: 0 auto;
}

#logo {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#logo h1 {
    font-family: 'Kalam', cursive;
    font-size: 1.8em;
    color: var(--primary-color);
    margin-bottom: 0;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#logo p {
    font-size: 0.8em;
    margin-top: 0;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.divider {
    position: relative;
    margin: 1.5rem 0;
}

.divider::before {
    content: "";
    position: absolute;
    top: 50%;
    width: 100%;
    height: 1px;
    background-color: rgba(0,0,0,0.1);
}

.divider span {
    position: relative;
    background-color: var(--body-bg);
    padding: 0 0.8rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Badge styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    margin-right: 0.4rem;
    margin-bottom: 0.4rem;
    font-weight: 600;
    box-shadow: 0 3px 6px rgba(0,0,0,0.08);
    transition: var(--transition);
}

.badge i {
    margin-right: 0.4rem;
}

.badge.primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--primary-contrast);
}

.badge.secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #495057 100%);
    color: white;
}

.badge.success {
    background: linear-gradient(135deg, var(--success-color) 0%, #3bae84 100%);
    color: white;
}

.badge.warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #ffc241 100%);
    color: var(--dark-color);
}

.badge.alert {
    background: linear-gradient(135deg, var(--danger-color) 0%, #ff5c2b 100%);
    color: white;
}

.badge.info {
    background: linear-gradient(135deg, var(--info-color) 0%, #4ab8ce 100%);
    color: white;
}

/* Compact item cards */
.item-card {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 0.5rem;
    list-style: none;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.item-header p {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.item-actions button {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 0.5rem;
    background: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.item-actions button.alert {
    color: var(--danger-color);
    border-color: rgba(255, 120, 81, 0.3);
}

.nutrition-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.nutrition-icons span {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.nutrition-icons i {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Button styles */
.button {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    box-shadow: var(--box-shadow);
    border: none;
}

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

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

.button.primary:hover, .button.primary:focus {
    background-color: var(--primary-dark);
}

.button.secondary {
    background-color: var(--secondary-color);
}

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

.button.alert {
    background-color: var(--danger-color);
}

.button.hollow {
    box-shadow: none;
    border: 1px solid rgba(0,0,0,0.15);
    background-color: transparent;
}

.button.hollow:hover {
    box-shadow: var(--box-shadow);
}

.button.hollow.primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.button.hollow.primary:hover {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

.button.hollow.secondary {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.button.hollow.success {
    border-color: var(--success-color);
    color: var(--success-color);
}

.button.hollow.alert {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.button.hollow.info {
    border-color: var(--info-color);
    color: var(--info-color);
}

/* Card styles */
.card {
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    border: none;
    box-shadow: var(--box-shadow);
    background-color: var(--card-bg);
    overflow: hidden;
}

.card-divider {
    background-color: rgba(0,0,0,0.02);
    padding: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.card-section {
    padding: 1.25rem;
}

/* Form styles */
input:not([type="radio"]):not([type="checkbox"]), select, textarea {
    border-radius: var(--border-radius);
    border: 1px solid rgba(0,0,0,0.15);
    padding: 0.75rem;
    transition: var(--transition);
    background-clip: padding-box; /* Prevents background from extending into border */
    -webkit-appearance: none; /* Removes default styling on iOS */
    -moz-appearance: none; /* Removes default styling on Firefox */
    appearance: none; /* Standard property for removing default styling */
}

input:not([type="radio"]):not([type="checkbox"]):focus, select:focus, textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(120, 194, 173, 0.25);
    outline: none; /* Removes default focus outline which can cause issues */
}

.input-group-field {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group-button .button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin: 0;
}

/* Success, info, warning, alert colors for callouts */
.callout {
    border-radius: var(--border-radius);
    border-left-width: 4px;
    box-shadow: var(--box-shadow);
}

.callout.success {
    background-color: rgba(86, 204, 157, 0.1);
    border-color: var(--success-color);
}

.callout.info {
    background-color: rgba(108, 195, 213, 0.1);
    border-color: var(--info-color);
}

.callout.warning {
    background-color: rgba(255, 206, 103, 0.1);
    border-color: var(--warning-color);
}

.callout.alert {
    background-color: rgba(255, 120, 81, 0.1);
    border-color: var(--danger-color);
}

/* Progress bar */
.progress {
    height: 0.75rem;
    border-radius: 1rem;
    background-color: rgba(0,0,0,0.05);
    margin: 0.5rem 0;
    overflow: hidden;
}

.progress-meter {
    border-radius: 1rem;
    transition: width 0.3s ease;
}

/* Table styles */
table {
    border-radius: var(--border-radius);
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin-bottom: 1rem;
    border: 1px solid rgba(0,0,0,0.05);
}

table thead {
    background-color: rgba(0,0,0,0.02);
}

table th, table td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

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

/* Reveal modal */
.reveal {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
    padding: 1.5rem;
}

/* Text colors */
.text-medium-gray {
    color: var(--text-muted);
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 0.2rem solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
}

/* Media queries */
@media (max-width: 768px) {
    input:not([type="radio"]):not([type="checkbox"]), select, textarea, button {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
        min-height: 44px; /* Apple's recommended minimum touch target size */
    }
    
    .button.large {
        padding: 0.75rem 1.25rem;
    }
    
    .input-group .button {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 576px) {
    .card {
        border-radius: 12px;
        margin-left: -12px;
        margin-right: -12px;
        width: calc(100% + 24px);
    }
    
    .grid-container {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .loading-overlay {
        background: rgba(255, 255, 255, 0.95);
    }
    
    table {
        font-size: 0.9rem;
    }
}

@media (max-width: 360px) {
    #logo h1 {
        font-size: 1.6em;
    }
    
    .button.large {
        padding: 0.5rem 1rem;
    }
}

/* Logo container */
.logo-container {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 3px 12px;
    transition: all 0.3s ease;
    position: relative;
}

#logo {
    margin-top: 5px;
    margin-bottom: 10px;
}

#logo h1 {
    font-size: 1.6em;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

#logo p {
    font-size: 0.75em;
}


@supports (padding: max(0px)) {
    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* Flash messages */
.flash-container {
    z-index: 9999;
}

.flash-container .callout {
    margin-bottom: 0.5rem;
    animation: slideDown 0.3s ease-out forwards;
    background-color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

/* Achievement Cards */
.achievement-card {
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(0,0,0,0.1);
  height: 100%;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.achievement-card.locked {
  opacity: 0.7;
  background: rgba(0,0,0,0.03);
}

/* Add spacing between grid cells */
.grid-x.grid-margin-x > .cell {
  margin-bottom: 1rem;
}

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

.achievement-emoji {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.achievement-details {
  width: 100%;
  overflow: hidden;
}

.achievement-details strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem;
}

.achievement-details small {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

/* Signup Page Enhancements */
@media screen and (max-width: 1023px) { /* Foundation large breakpoint */
    .signup-benefits {
        margin-top: 2.5rem;
        padding-top: 2rem;
        border-top: 1px solid rgba(0,0,0,0.1);
    }
}
@media screen and (min-width: 1024px) {
    .signup-benefits {
        padding-left: 2.5rem;
    }
}

.benefits-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0 0;
}
.benefits-list li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
    line-height: 1.5;
}
.benefits-list i {
    color: var(--success-color);
    margin-right: 0.85rem;
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 0.2rem;
}
.benefits-list strong {
    font-weight: 600;
    display: block;
    color: var(--text-color);
    margin-bottom: 0.1rem;
}
.partner-logo {
    max-height: 50px;
    filter: grayscale(100%);
    opacity: 0.7;
    transition: var(--transition);
}
.partner-logo:hover {
    filter: grayscale(0%);
    opacity: 1;
}

/* Utility classes */
.margin-top-1 { margin-top: var(--spacing); }
.margin-top-2 { margin-top: calc(var(--spacing) * 2); }
.margin-top-3 { margin-top: calc(var(--spacing) * 3); }
.margin-bottom-0 { margin-bottom: 0; }
.margin-bottom-1 { margin-bottom: var(--spacing); }
.margin-bottom-2 { margin-bottom: calc(var(--spacing) * 2); }

.text-medium-gray {
    color: var(--text-muted);
}

/* Health Score Badges */
.health-score-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.4rem;
    border-radius: 0.3rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2rem;
}

.health-score-A {
    background-color: rgba(86, 204, 157, 0.2);
    color: var(--success-color);
    border: 1px solid rgba(86, 204, 157, 0.3);
}

.health-score-B {
    background-color: rgba(255, 206, 103, 0.2);
    color: var(--warning-color);
    border: 1px solid rgba(255, 206, 103, 0.3);
}

.health-score-C {
    background-color: rgba(255, 120, 81, 0.2);
    color: var(--danger-color);
    border: 1px solid rgba(255, 120, 81, 0.3);
}

/* Compact Nutrition Display */
.nutrition-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-bottom: 0.75rem;
}

.nutrient-item-compact {
    display: flex;
    align-items: center;
    padding: 0.3rem 0.6rem;
    border-radius: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
    background-color: rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.05);
}

.nutrient-item-compact i {
    font-size: 0.9rem;
    margin-right: 0.3rem;
    line-height: 1; /* Ensure icon aligns well */
}

.nutrient-item-compact span {
    font-weight: 600;
    margin-right: 0.2rem;
}

.nutrient-item-compact small {
    font-size: 0.7rem;
    opacity: 0.8;
    text-transform: lowercase;
}

/* Specific colors for compact items */
.nutrient-item-compact.kcal { color: var(--primary-dark); border-color: rgba(120, 194, 173, 0.3); background-color: rgba(120, 194, 173, 0.1); }
.nutrient-item-compact.protein { color: #495057; border-color: rgba(108, 117, 125, 0.3); background-color: rgba(108, 117, 125, 0.1); }
.nutrient-item-compact.carbs { color: #b38f00; border-color: rgba(255, 206, 103, 0.4); background-color: rgba(255, 206, 103, 0.15); } /* Yellowish */
.nutrient-item-compact.fats { color: #3b8ea5; border-color: rgba(108, 195, 213, 0.4); background-color: rgba(108, 195, 213, 0.15); } /* Blue */
.nutrient-item-compact.sat-fats { color: #c85a37; border-color: rgba(255, 120, 81, 0.4); background-color: rgba(255, 120, 81, 0.15); } /* Orange/Red */
.nutrient-item-compact.sodium { color: #8a6d3b; border-color: rgba(138, 109, 59, 0.4); background-color: rgba(138, 109, 59, 0.1); } /* Brownish */

/* Nutrition Legend Styles */
.nutrition-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem; /* Vertical and horizontal gap */
}

.nutrient-legend-item {
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 0.3rem;
    border: 1px solid transparent;
}

.nutrient-legend-item i {
    margin-right: 0.3rem;
    font-size: 0.9rem;
}

/* Apply distinct colors to legend items */
.nutrient-legend-item.kcal { color: var(--primary-dark); border-color: rgba(120, 194, 173, 0.3); background-color: rgba(120, 194, 173, 0.1); }
.nutrient-legend-item.protein { color: #495057; border-color: rgba(108, 117, 125, 0.3); background-color: rgba(108, 117, 125, 0.1); }
.nutrient-legend-item.carbs { color: #b38f00; border-color: rgba(255, 206, 103, 0.4); background-color: rgba(255, 206, 103, 0.15); }
.nutrient-legend-item.fats { color: #3b8ea5; border-color: rgba(108, 195, 213, 0.4); background-color: rgba(108, 195, 213, 0.15); }
.nutrient-legend-item.sat-fats { color: #c85a37; border-color: rgba(255, 120, 81, 0.4); background-color: rgba(255, 120, 81, 0.15); }
.nutrient-legend-item.sodium { color: #8a6d3b; border-color: rgba(138, 109, 59, 0.4); background-color: rgba(138, 109, 59, 0.1); }

/* Weight Edit Button */
.weight-edit-button {
    margin: 0; 
    padding: 0.5rem 0.75rem; 
    display: flex; 
    align-items: center; 
    border-radius: 0.5rem; 
    border-color: rgba(0,0,0,0.15); 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); 
    white-space: nowrap;
    color: var(--primary-dark);
    border-color: rgba(120, 194, 173, 0.5);
    background-color: var(--primary-light);
}

.weight-edit-button:hover {
    background-color: rgba(120, 194, 173, 0.2);
    border-color: rgba(120, 194, 173, 0.7);
}


/* --- Styles moved from dashboard.html --- */

a.client-card-link, a.client-card-link:hover {
    color: inherit;
    text-decoration: none;
}

/* Card-based layout for clients */
.client-card {
    display: flex;
    flex-direction: column;
    height: 100%; /* For equalizer */
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.client-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1) !important;
}

.client-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.client-card-title strong {
    font-size: 1.1rem;
}

.client-card-body {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    flex-grow: 1; /* For equalizer */
}

.client-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    font-size: 0.9rem;
}
.client-stat + .client-stat {
     border-top: 1px solid #f1f1f1;
}

.stat-label {
    color: #555;
}
.stat-label .bi {
    color: #8a8a8a;
    font-size: 0.8rem;
}
.stat-value {
    font-weight: bold;
    display: flex;
    align-items: center;
    text-align: right;
}

.client-card-actions {
    padding-top: 0.5rem;
}

.day-row.non-interactive:hover {
    background-color: transparent;
    cursor: default;
}

/* Custom scrollbar for tables */
.table-scroll::-webkit-scrollbar {
    height: 8px;
}

.table-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.table-scroll::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Collapse functionality for activity table in client_detail.html */
.collapse {
    display: none;
}

.collapse.show {
    display: table-row; /* Use table-row for proper rendering in tables */
}

/* --- Client Detail Page Mobile Optimizations --- */

/* Sticky Mobile Action Bar */
@media screen and (max-width: 39.9375em) {
    body {
        /* Add padding to the bottom of the body to prevent content
           from being hidden behind the fixed action bar */
        padding-bottom: 80px;
    }
    
    .mobile-action-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(65px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: rgba(255, 255, 255, 0.95);
        border-top: 1px solid rgba(0,0,0,0.1);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
        backdrop-filter: blur(10px);
        display: flex;
        justify-content: space-around;
        align-items: flex-start;
        padding-top: 8px;
        z-index: 1000;
    }

    .mobile-action-bar .action-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        background: none;
        border: none;
        padding: 0 4px;
        font-size: 0.7rem;
        font-weight: 500;
        text-align: center;
        flex-grow: 1;
        transition: color 0.2s;
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-action-bar .action-item:hover, .mobile-action-bar .action-item:focus {
        color: var(--primary-color);
    }
    .mobile-action-bar .action-item i {
        font-size: 1.6rem;
        margin-bottom: 2px;
        line-height: 1;
    }
}

/* Bottom Sheet Style for "More Actions" */
.reveal.bottom {
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    margin: 0;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}
.reveal.bottom .menu a {
    padding: 1rem;
    font-size: 1rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
}
.reveal.bottom .menu a i {
    margin-right: 1rem;
    width: 20px;
    font-size: 1.2rem;
    display: inline-block;
    color: var(--text-muted);
}
.warning-text { color: var(--danger-color) !important; }
.warning-text i { color: var(--danger-color) !important; }

/* Responsive Activity Log */
.activity-log-container .activity-log-row {
    border-bottom: 1px solid #f0f0f0;
    padding: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.activity-log-container .activity-log-row:hover { background-color: #f8f9fa; }
.activity-log-container .activity-log-row:last-child { border-bottom: none; }

.activity-log-row.has-data .main-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.activity-log-row.has-data .main-info .date {
    flex-grow: 1;
    font-size: 1.1rem;
}
.activity-log-row.has-data .main-info .date .badge {
    vertical-align: middle;
    font-size: 0.65rem;
    padding: .2em .5em;
    line-height: 1;
}
.activity-log-row.has-data .main-info .kcal {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-dark);
}
.activity-log-row.has-data .main-info .kcal small {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}
.activity-log-row.has-data .expand-icon {
    font-size: 1rem;
    color: #b5b5b5;
    transition: transform 0.3s ease;
}
.activity-log-row.has-data[aria-expanded="true"] .expand-icon {
    transform: rotate(90deg);
}
.activity-log-row.has-data .nutrient-info {
    display: flex;
    justify-content: space-around;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}
.activity-log-row.has-data .nutrient-info > div {
    font-size: 0.9rem;
    color: var(--text-color);
}
.activity-log-row.has-data .nutrient-info > div span {
    font-weight: 500;
}
.activity-log-row.has-data .nutrient-info > div small {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
.activity-log-row.no-data {
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0.7;
    cursor: default;
}
.activity-log-row.no-data:hover { background-color: transparent; }

/* Activity Log Details */
.activity-log-details {
    background-color: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.activity-log-details .part-detail-row {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem 0.5rem 2.5rem; /* Keep left padding for indentation */
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 600px; /* Force horizontal scroll on narrow screens */
}
.activity-log-details .part-detail-row .part-name {
    flex: 0 0 100px;
}
.activity-log-details .part-detail-row .part-value {
    flex: 0 0 65px;
    text-align: right;
}
.activity-log-details .part-detail-row .part-value.actions {
    flex-basis: 20px;
}
.activity-log-details .part-detail-row:not(:last-child) { border-bottom: 1px dashed #e9e9e9; }

/* Desktop view for Activity Log */
@media screen and (min-width: 40em) {
    .activity-log-header {
        display: grid;
        grid-template-columns: 2fr repeat(5, 1fr) 0.5fr;
        gap: 1rem;
        padding: 0.5rem 1.25rem;
        font-weight: bold;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.5px;
        background-color: #f8f9fa;
        border-bottom: 1px solid rgba(0,0,0,0.1);
    }
    .activity-log-header .actions, .part-detail-row .actions { text-align: center; }

    .activity-log-row { padding: 0.5rem 1.25rem; }

    .activity-log-row.has-data { display: grid; grid-template-columns: 2fr repeat(5, 1fr) 0.5fr; gap: 1rem; align-items: center; }
    .activity-log-row.has-data .main-info, .activity-log-row.has-data .nutrient-info { display: contents; } /* Break out of flex and into grid */
    .activity-log-row.has-data .date { grid-column: 1; }
    .activity-log-row.has-data .kcal { grid-column: 2; text-align: right; }
    .activity-log-row.has-data .nutrient-info > div:nth-child(1) { grid-column: 3; text-align: right; }
    .activity-log-row.has-data .nutrient-info > div:nth-child(2) { grid-column: 4; text-align: right; }
    .activity-log-row.has-data .nutrient-info > div:nth-child(3) { grid-column: 5; text-align: right; }
    .activity-log-row.has-data .nutrient-info > div:nth-child(4) { grid-column: 6; text-align: right; }
    .activity-log-row.has-data .view-link { grid-column: 7; }
    
    .activity-log-row.has-data .nutrient-info > div small { display: none; }
    .activity-log-row.has-data .main-info .date strong { font-size: 1rem; }
    
    .activity-log-row.no-data { padding: 0.75rem 1.25rem; }

    .activity-log-details .part-detail-row {
        display: grid;
        grid-template-columns: 2fr repeat(5, 1fr) 0.5fr;
        gap: 1rem;
        align-items: center;
        padding: 0.5rem 1.25rem;
    }
    .activity-log-details .part-detail-row .part-name { grid-column: 1; padding-left: 1rem; }
    .activity-log-details .part-detail-row .part-value { text-align: right; }
}