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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
    background-color: #FBF8F0;
    display: flex;
    flex-direction: column;
}

/* Header Bar */
.header-bar {
    background: #F8F4EC;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    height: 75px;
    display: flex;
    align-items: center;
    padding: 0 20px 0 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    gap: 15px;
    z-index: 1000;
}

.header-logo {
    width: 75px;
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-logo img {
    width: 75px;
    height: 75px;
    object-fit: cover;
}

.header-company-name {
    color: #1A1A1A;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 1px;
    flex-shrink: 0;
    margin-right: 20px;
}

.header-tagline {
    flex: 1;
    color: #6B6B6B;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-align: right;
    margin-right: 20px;
}

.header-links {
    display: flex;
    gap: 20px;
    flex-shrink: 0;
}

.header-link {
    color: white;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    padding: 8px 20px;
    border-radius: 6px;
    background-color: #4A8886;
    transition: background-color 0.2s;
    border: none;
}

.header-link:hover {
    background-color: #2D5F5D;
}

/* Main Container */
.container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Toolbar */
.toolbar {
    width: 380px;
    background-color: #F8F4EC;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: 0;
    flex-shrink: 0;
    overflow-y: auto;
}

.toolbar-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
}

.toolbar-section:last-child {
    border-right: none;
}

.tool-button-container {
    position: static;
}

.tool-button {
    background-color: #4A8886;
    color: white;
    border: none;
    padding: 12px 8px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-size: 11px;
    font-weight: 600;
    width: 100%;
}

.tool-button:hover {
    background-color: #5E9E9C;
    transform: translateY(-2px);
}

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

.tool-button svg {
    width: 24px;
    height: 24px;
}

/* Diets Dropdown */
.diets-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    min-width: 250px;
    max-height: 500px;
    z-index: 9999;
    /* ... rest of styles matching other dropdowns */
}

.diets-dropdown.show {
    display: block;
}

/* Fruits Dropdown */
.fruits-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    color: #333;
    min-width: 250px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 9999;
}

.fruits-dropdown.show {
    display: block;
}

.fruits-dropdown .dropdown-checkbox-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
    background-color: white;
}

.fruits-dropdown .dropdown-checkbox-item:last-child {
    border-bottom: none;
}

.fruits-dropdown .dropdown-checkbox-item:hover {
    background-color: rgba(45, 95, 93, 0.06);
}

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

.fruits-dropdown .dropdown-checkbox-item span {
    flex: 1;
    user-select: none;
}

.fruits-dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    background-color: #1A3938;
    color: white;
    border-radius: 6px 6px 0 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* Vegetables Dropdown */
.vegetables-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    color: #333;
    min-width: 250px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 9999;
}

.vegetables-dropdown.show {
    display: block;
}

.vegetables-dropdown .dropdown-checkbox-item {
    background-color: white;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.vegetables-dropdown .dropdown-checkbox-item:last-child {
    border-bottom: none;
}

.vegetables-dropdown .dropdown-checkbox-item:hover {
    background-color: rgba(45, 95, 93, 0.06);
}

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

.vegetables-dropdown .dropdown-checkbox-item span {
    flex: 1;
    user-select: none;
}

.vegetables-dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    background-color: #2D5F5D;
    color: white;
    border-radius: 6px 6px 0 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* Spices Dropdown */
.spices-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    color: #333;
    min-width: 250px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 9999;
}

.spices-dropdown.show {
    display: block;
}

.spices-dropdown .dropdown-checkbox-item {
    background-color: white;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.spices-dropdown .dropdown-checkbox-item:last-child {
    border-bottom: none;
}

.spices-dropdown .dropdown-checkbox-item:hover {
    background-color: rgba(45, 95, 93, 0.06);
}

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

.spices-dropdown .dropdown-checkbox-item span {
    flex: 1;
    user-select: none;
}

.spices-dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    background-color: #2D5F5D;
    color: white;
    border-radius: 6px 6px 0 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* Nuts Dropdown */
.nuts-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    color: #333;
    min-width: 250px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 9999;
}

.nuts-dropdown.show {
    display: block;
}

.nuts-dropdown .dropdown-checkbox-item {
    background-color: white;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.nuts-dropdown .dropdown-checkbox-item:last-child {
    border-bottom: none;
}

.nuts-dropdown .dropdown-checkbox-item:hover {
    background-color: rgba(45, 95, 93, 0.06);
}

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

.nuts-dropdown .dropdown-checkbox-item span {
    flex: 1;
    user-select: none;
}

.nuts-dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    background-color: #2D5F5D;
    color: white;
    border-radius: 6px 6px 0 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* Image Panel */
.image-panel {
    overflow: hidden;
}

.image-panel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.submit-area {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 10px;
    background-color: #F8F4EC;
    border-top: 1px solid #e0e0e0;
}

/* Main Content */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 183px;
    grid-template-rows: 1fr auto;
    overflow: hidden;
}

/* Output Window */
.output-window {
    overflow-y: auto;
    padding: 20px;
    background-color: #E5EDEB;
    min-width: 0;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: #6B6B6B;
}

.welcome-message h2 {
    margin-bottom: 10px;
    color: #1A3938;
}

.message {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
    max-width: 85%;
    animation: fadeIn 0.3s;
    position: relative;
}

.message-btn-bar {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.message.assistant:hover .message-btn-bar {
    opacity: 1;
    pointer-events: auto;
}

.message-action-btn {
    padding: 4px 8px;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 5px;
    cursor: pointer;
    color: #2D5F5D;
    font-size: 11px;
    font-family: Arial, sans-serif;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s, border-color 0.2s;
}

.message-action-btn:hover {
    background: #fff;
    border-color: rgba(45,95,93,0.3);
}

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

.message.user {
    background-color: #2D5F5D;
    color: white;
    margin-left: auto;
    text-align: right;
}

.message.assistant {
    background-color: white;
    color: #1A3938;
    border: 1px solid #e0e0e0;
    margin-right: auto;
}

.message-label {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 8px;
    opacity: 0.8;
}

.message-content {
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Input Container */
.input-container {
    display: flex;
    padding: 20px;
    background-color: #F8F4EC;
    border-top: 1px solid #e0e0e0;
    min-width: 0;
}

#prompt-input {
    flex: 1;
    min-width: 0;
    width: 100% !important;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s;
}

#prompt-input:focus {
    outline: none;
    border-color: #2D5F5D;
}

#submit-button {
    padding: 12px 24px;
    background-color: #4A8886;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

#submit-button:hover {
    background-color: #2D5F5D;
}

#submit-button:disabled {
    background-color: #A0A0A0;
    cursor: not-allowed;
}

/* Loading indicator */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Fats Dropdown */
.fats-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    color: #333;
    min-width: 250px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 9999;
}

.fats-dropdown.show {
    display: block;
}

.fats-dropdown a {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.fats-dropdown a:last-child {
    border-bottom: none;
}

.fats-dropdown a:hover {
    background-color: #2D5F5D;
    color: white;
}

.fats-dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    background-color: #2D5F5D;
    color: white;
    border-radius: 6px 6px 0 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* Oils Dropdown */
.oils-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    color: #333;
    min-width: 250px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 9999;
}

.oils-dropdown.show {
    display: block;
}

.oils-dropdown .dropdown-checkbox-item {
    background-color: white;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.oils-dropdown .dropdown-checkbox-item:last-child {
    border-bottom: none;
}

.oils-dropdown .dropdown-checkbox-item:hover {
    background-color: rgba(45, 95, 93, 0.06);
}

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

.oils-dropdown .dropdown-checkbox-item span {
    flex: 1;
    user-select: none;
}

.oils-dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    background-color: #2D5F5D;
    color: white;
    border-radius: 6px 6px 0 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* Cereals Dropdown */
.cereals-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    color: #333;
    min-width: 250px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 9999;
}

.cereals-dropdown.show {
    display: block;
}

.cereals-dropdown .dropdown-checkbox-item {
    background-color: white;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.cereals-dropdown .dropdown-checkbox-item:last-child {
    border-bottom: none;
}

.cereals-dropdown .dropdown-checkbox-item:hover {
    background-color: rgba(45, 95, 93, 0.06);
}

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

.cereals-dropdown .dropdown-checkbox-item span {
    flex: 1;
    user-select: none;
}

.cereals-dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    background-color: #2D5F5D;
    color: white;
    border-radius: 6px 6px 0 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* Toolbar Title */
.toolbar-title {
    background-color: #2D5F5D;
    color: #FFFFFF;
    padding: 8px 6px;
    text-align: center;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 4px;
}

/* Disorders Dropdown */
.disorders-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    color: #333;
    min-width: 250px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 9999;
}

.disorders-dropdown.show {
    display: block;
}

.disorders-dropdown .dropdown-checkbox-item {
    background-color: white;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.disorders-dropdown .dropdown-checkbox-item:last-child {
    border-bottom: none;
}

.disorders-dropdown .dropdown-checkbox-item:hover {
    background-color: rgba(45, 95, 93, 0.06);
}

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

.disorders-dropdown .dropdown-checkbox-item span {
    flex: 1;
    user-select: none;
}

.disorders-dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    background-color: #2D5F5D;
    color: white;
    border-radius: 6px 6px 0 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* Allergies Dropdown */
.allergies-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    color: #333;
    min-width: 250px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 9999;
}

.allergies-dropdown.show {
    display: block;
}

.allergies-dropdown .dropdown-checkbox-item {
    background-color: white;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.allergies-dropdown .dropdown-checkbox-item:last-child {
    border-bottom: none;
}

.allergies-dropdown .dropdown-checkbox-item:hover {
    background-color: rgba(45, 95, 93, 0.06);
}

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

.allergies-dropdown .dropdown-checkbox-item span {
    flex: 1;
    user-select: none;
}

.allergies-dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    background-color: #2D5F5D;
    color: white;
    border-radius: 6px 6px 0 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* Page Container for Join/Login pages */
.page-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100vh - 75px);
    background: linear-gradient(135deg, #F0F4F3 0%, #E5EDEC 100%);
}

.page-content {
    background: white;
    padding: 60px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
    max-width: 600px;
}

.page-content h1 {
    color: #2D5F5D;
    margin-bottom: 20px;
    font-size: 32px;
}

.page-content p {
    color: #666;
    font-size: 18px;
    margin-bottom: 30px;
}

.back-link {
    color: #4A8886;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    padding: 10px 20px;
    border: 2px solid #4A8886;
    border-radius: 6px;
    display: inline-block;
    transition: all 0.3s ease;
}

.back-link:hover {
    background-color: #4A8886;
    color: white;
}

/* Authentication Forms */
.auth-form-container {
    background: white;
    padding: 50px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    max-width: 450px;
    width: 100%;
}

.auth-form-container h1 {
    color: #2D5F5D;
    margin-bottom: 10px;
    font-size: 32px;
    text-align: center;
}

.auth-subtitle {
    color: #666;
    font-size: 16px;
    margin-bottom: 30px;
    text-align: center;
}

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

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

.form-group label {
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #4A8886;
    box-shadow: 0 0 0 3px rgba(45, 95, 93, 0.1);
}

.auth-button {
    background-color: #4A8886;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 10px;
}

.auth-button:hover:not(:disabled) {
    background-color: #2D5F5D;
}

.auth-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-message {
    background-color: rgba(45, 95, 93, 0.06);
    color: #c62828;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    border-left: 4px solid #c62828;
}

.success-message {
    background-color: rgba(45, 95, 93, 0.06);
    color: #1A3938;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    border-left: 4px solid #1A3938;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 14px;
}

.auth-footer a {
    color: #4A8886;
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Header Username Display */
.header-username {
    color: #1A3938;
    font-size: 16px;
    font-weight: 500;
    padding: 8px 16px;
    background-color: rgba(45, 95, 93, 0.06);
    border-radius: 6px;
    border: 1px solid rgba(45, 95, 93, 0.2);
}

.header-account-link {
    color: #2D5F5D;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    padding: 7px 15px;
    border-radius: 6px;
    border: 1px solid rgba(45, 95, 93, 0.28);
    background: rgba(45, 95, 93, 0.05);
    font-family: Arial, sans-serif;
    transition: background 0.15s, border-color 0.15s;
}
.header-account-link:hover {
    background: rgba(45, 95, 93, 0.12);
    border-color: rgba(45, 95, 93, 0.5);
    color: #1A4746;
}

/* Cuisines Dropdown */
.cuisines-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    color: #333;
    min-width: 250px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 9999;
}

.cuisines-dropdown.show {
    display: block;
}

.cuisines-dropdown .dropdown-checkbox-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
    background-color: white;
}

.cuisines-dropdown .dropdown-checkbox-item:last-child {
    border-bottom: none;
}

.cuisines-dropdown .dropdown-checkbox-item:hover {
    background-color: rgba(45, 95, 93, 0.06);
}

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

.cuisines-dropdown .dropdown-checkbox-item span {
    flex: 1;
    user-select: none;
}

.cuisines-dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    background-color: #2D5F5D;
    color: white;
    border-radius: 6px 6px 0 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* Toolbar Label */
.toolbar-label {
    background-color: #FBF8F0;
    color: #1A3938;
    padding: 12px 6px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 6px;
    width: 100%;
}

/* Dropdown Close Button */
.dropdown-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.dropdown-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.dropdown-close-btn:active {
    transform: scale(0.95);
}

/* Action Menu Bar */
.action-menu-bar {
    background: #C4D8D6;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    padding: 0 20px;
    box-shadow: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.action-menu-title {
    font-size: 20px;
    font-weight: 700;
    color: #1A3938;
    letter-spacing: 0.3px;
    margin-right: 10px;
    white-space: nowrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background-color: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    color: #2D5F5D;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.action-btn:hover {
    background-color: rgba(45, 95, 93, 0.06);
    border-color: rgba(45, 95, 93, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

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

.action-btn svg {
    flex-shrink: 0;
}

.action-btn span {
    font-size: 14px;
}

/* Help overlay */
#nc-help-overlay,
#fl-help-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(20,40,40,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.nc-help-modal {
    background: #FAFAF8;
    border-radius: 12px;
    box-shadow: 0 16px 64px rgba(0,0,0,0.22);
    width: 100%;
    max-width: 860px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nc-help-header {
    background: #2D5F5D;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.nc-help-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nc-help-logo {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
}

.nc-help-brand {
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    letter-spacing: -0.02em;
}

.nc-help-subtitle {
    font-size: 11px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
    font-family: Arial, sans-serif;
    margin: 3px 0 0;
}

.nc-help-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s;
}
.nc-help-close:hover { color: #fff; }

.nc-help-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

.nc-help-nav {
    width: 190px;
    flex-shrink: 0;
    background: #F0F4F4;
    border-right: 1px solid rgba(0,0,0,0.07);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nc-help-nav-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 14px;
    font-family: Arial, sans-serif;
    color: #4A6A6A;
    cursor: pointer;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
}
.nc-help-nav-btn:hover { background: rgba(45,95,93,0.08); color: #2D5F5D; }
.nc-help-nav-btn.active { background: rgba(45,95,93,0.12); color: #1A3938; font-weight: 600; border-left: 3px solid #2D5F5D; }

.nc-help-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 36px 40px;
}

.nc-help-eyebrow {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #A0A0A0;
    font-family: Arial, sans-serif;
    margin: 0 0 8px;
}

.nc-help-section-title {
    font-size: 24px;
    font-weight: 700;
    color: #1A3938;
    margin: 0 0 10px;
    letter-spacing: -0.02em;
}

.nc-help-accent {
    width: 36px;
    height: 2px;
    background: #C8A882;
    margin-bottom: 18px;
}

.nc-help-lead {
    font-size: 15px;
    line-height: 1.75;
    color: #4A6060;
    font-family: Arial, sans-serif;
    margin-bottom: 28px;
}

/* Step-style for Getting Started */
.nc-help-steps { display: flex; flex-direction: column; gap: 18px; }
.nc-help-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.nc-help-step-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #2D5F5D;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}
.nc-help-step-title {
    font-size: 14px;
    font-weight: 600;
    color: #1A3938;
    margin: 0 0 4px;
    font-family: Arial, sans-serif;
}
.nc-help-step-body {
    font-size: 14px;
    line-height: 1.65;
    color: #5A6A6A;
    font-family: Arial, sans-serif;
    margin: 0;
}

/* Item-style for other sections */
.nc-help-items { display: flex; flex-direction: column; gap: 16px; }
.nc-help-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.07);
    border-radius: 8px;
}
.nc-help-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(45,95,93,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #2D5F5D;
}
.nc-help-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #1A3938;
    margin: 0 0 4px;
    font-family: Arial, sans-serif;
}
.nc-help-item-body {
    font-size: 13px;
    line-height: 1.65;
    color: #5A6A6A;
    font-family: Arial, sans-serif;
    margin: 0;
}

/* Support overlay */
#nc-support-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(20,40,40,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.nc-support-modal {
    background: #FAFAF8;
    border-radius: 12px;
    box-shadow: 0 16px 64px rgba(0,0,0,0.22);
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nc-support-header {
    background: #2D5F5D;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.nc-support-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 28px 28px 24px;
    gap: 18px;
    overflow-y: auto;
}

.nc-support-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nc-support-field--grow {
    flex: 1;
    min-height: 0;
}

.nc-support-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #7A9090;
    font-family: Arial, sans-serif;
}

.nc-support-input {
    padding: 10px 14px;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 7px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    color: #1A3938;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}
.nc-support-input:focus { border-color: #2D5F5D; }

.nc-support-input--readonly {
    background: #F4F8F8;
    color: #6A8080;
    cursor: default;
}

.nc-support-radios {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nc-support-radio {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-family: Arial, sans-serif;
    color: #3A5858;
    background: #fff;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}
.nc-support-radio:has(input:checked) {
    border-color: #2D5F5D;
    background: rgba(45,95,93,0.08);
    color: #1A3938;
    font-weight: 600;
}
.nc-support-radio input[type="radio"] {
    display: none;
}

.nc-support-textarea {
    flex: 1;
    min-height: 160px;
    padding: 12px 14px;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 7px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    color: #1A3938;
    background: #fff;
    resize: vertical;
    outline: none;
    line-height: 1.7;
    transition: border-color 0.15s;
}
.nc-support-textarea:focus { border-color: #2D5F5D; }
.nc-support-textarea::placeholder { color: #B0C0C0; }

.nc-support-status {
    padding: 10px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-family: Arial, sans-serif;
}
.nc-support-status--success {
    background: rgba(45,95,93,0.10);
    color: #1A3938;
    border: 1px solid rgba(45,95,93,0.25);
}
.nc-support-status--error {
    background: rgba(180,60,60,0.08);
    color: #7A2020;
    border: 1px solid rgba(180,60,60,0.22);
}

.nc-support-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.nc-support-cancel {
    padding: 10px 22px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 7px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    color: #5A7070;
    cursor: pointer;
    transition: background 0.15s;
}
.nc-support-cancel:hover { background: #F4F8F8; }

.nc-support-send {
    display: flex;
    align-items: center;
    padding: 10px 22px;
    background: #2D5F5D;
    border: none;
    border-radius: 7px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}
.nc-support-send:hover { background: #1A3938; }
.nc-support-send:disabled { opacity: 0.55; cursor: default; }

/* Tool switcher dropdown */
.tool-switcher-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 210px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.10);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
    z-index: 9999;
    overflow: hidden;
    padding: 4px 0;
}

.tool-switcher-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #2D5F5D;
    font-size: 14px;
    font-weight: 500;
    font-family: Arial, sans-serif;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
    /* reset button defaults */
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    box-sizing: border-box;
}

.tool-switcher-item:hover {
    background: rgba(45,95,93,0.07);
}

.tool-switcher-item--active {
    background: rgba(45,95,93,0.04);
    font-weight: 600;
}

.tool-switcher-divider {
    height: 1px;
    background: rgba(0,0,0,0.08);
    margin: 4px 0;
}

/* Recent items panel */
.recent-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 320px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.10);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
    z-index: 9999;
    overflow: hidden;
}

.recent-panel-header {
    background: #1A3938;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 10px 14px;
}

.recent-tabs {
    display: flex;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    background: #f6fafa;
}

.recent-tab {
    flex: 1;
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 500;
    color: #2D5F5D;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.recent-tab:hover {
    background: rgba(45,95,93,0.07);
}

.recent-tab.active {
    color: #1A3938;
    font-weight: 700;
    border-bottom: 2px solid #2D5F5D;
}

.recent-item-list {
    max-height: 260px;
    overflow-y: auto;
}

.recent-item {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background 0.15s;
}

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

.recent-item:hover {
    background: rgba(45,95,93,0.06);
}

.recent-item-main {
    flex: 1;
    padding: 10px 14px;
    cursor: pointer;
    min-width: 0;
}

.recent-item-title {
    font-size: 13px;
    font-weight: 500;
    color: #1A3938;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-item-date {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.recent-item-email-btn {
    flex-shrink: 0;
    padding: 8px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #888;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.recent-item-email-btn:hover {
    color: #2D5F5D;
}

.recent-item-email-btn:disabled {
    cursor: default;
}

.recent-empty {
    padding: 18px 14px;
    font-size: 13px;
    color: #999;
    text-align: center;
}

/* Meal and Course dropdowns */
.meal-dropdown,
.course-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    color: #333;
    min-width: 220px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 9999;
}

.meal-dropdown.show,
.course-dropdown.show {
    display: block;
}

/* Disabled state for Create Recipe button */
.tool-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: #ccc;
}

.tool-button:disabled:hover {
    background-color: #ccc;
    transform: none;
}

/* Meats & Fish Dropdown */
.meats-fish-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    color: #333;
    min-width: 250px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 9999;
}

.meats-fish-dropdown.show {
    display: block;
}

.meats-fish-dropdown .dropdown-checkbox-item {
    background-color: white;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.meats-fish-dropdown .dropdown-checkbox-item:last-child {
    border-bottom: none;
}

.meats-fish-dropdown .dropdown-checkbox-item:hover {
    background-color: rgba(45, 95, 93, 0.06);
}

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

.meats-fish-dropdown .dropdown-checkbox-item span {
    flex: 1;
    user-select: none;
}

.meats-fish-dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    background-color: #2D5F5D;
    color: white;
    border-radius: 6px 6px 0 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* Health Objectives Dropdown */
.health-objectives-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    color: #333;
    min-width: 280px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 9999;
}

.health-objectives-dropdown.show {
    display: block;
}

.health-objectives-dropdown .dropdown-checkbox-item {
    background-color: white;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.health-objectives-dropdown .dropdown-checkbox-item:last-child {
    border-bottom: none;
}

.health-objectives-dropdown .dropdown-checkbox-item:hover {
    background-color: rgba(45, 95, 93, 0.06);
}

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

.health-objectives-dropdown .dropdown-checkbox-item span {
    flex: 1;
    user-select: none;
}

.health-objectives-dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    background-color: #4A8886;
    color: white;
    border-radius: 6px 6px 0 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* Three Column Toolbar Layout */
.toolbar-three-column {
    display: flex;
    gap: 0;
    background-color: #F8F4EC;
    min-height: 100vh;
    width: auto;
    overflow-y: auto;
}

.toolbar-column {
    display: flex;
    flex-direction: column;
    min-width: 120px;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
}

.toolbar-column:last-child {
    border-right: none;
}

.toolbar-column .toolbar-section {
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.toolbar-column .toolbar-section:last-child {
    border-bottom: none;
}

/* Dairy and Eggs Dropdown */
.dairy-eggs-dropdown {
    display: none;
    position: fixed;
    background-color: white;
    color: #333;
    min-width: 250px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 9999;
}

.dairy-eggs-dropdown.show {
    display: block;
}

.dairy-eggs-dropdown .dropdown-checkbox-item {
    background-color: white;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.dairy-eggs-dropdown .dropdown-checkbox-item:last-child {
    border-bottom: none;
}

.dairy-eggs-dropdown .dropdown-checkbox-item:hover {
    background-color: rgba(45, 95, 93, 0.06);
}

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

.dairy-eggs-dropdown .dropdown-checkbox-item span {
    flex: 1;
    user-select: none;
}

.dairy-eggs-dropdown-header {
    padding: 12px 16px;
    font-weight: 600;
    background-color: #2D5F5D;
    color: white;
    border-radius: 6px 6px 0 0;
    position: sticky;
    top: 0;
    z-index: 10000;
}

/* System Messages */
.message.system .message-content {
    background-color: rgba(45, 95, 93, 0.06);
    border-left: 4px solid #4A8886;
    color: #1A3938;
    font-size: 0.9em;
    padding: 8px 12px;
    font-style: italic;
}

/* Subscription Status Banner */
#subscription-banner {
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 999;
}

#subscription-banner.trial {
    background: linear-gradient(135deg, #4A8886 0%, #3D7472 100%);
    color: white;
}

#subscription-banner.trial-ending {
    background: linear-gradient(135deg, #D4A574 0%, #C8956A 100%);
    color: white;
}

#subscription-banner.expired {
    background: linear-gradient(135deg, #C85858 0%, #B04040 100%);
    color: white;
}

#subscription-banner.active {
    background: linear-gradient(135deg, #2D5F5D 0%, #1A3938 100%);
    color: white;
}

#subscription-banner a {
    color: white;
    text-decoration: underline;
    font-weight: 600;
    margin-left: 8px;
}

#subscription-banner a:hover {
    text-decoration: none;
}

#subscription-banner .banner-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 16px;
}

#subscription-banner .close-banner {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.2s;
}

#subscription-banner .close-banner:hover {
    background: rgba(255,255,255,0.3);
}

/* ── Inactivity Warning Modal ───────────────────────────────────────────── */
#idle-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

#idle-modal {
    background: white;
    border-radius: 10px;
    padding: 36px 40px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

#idle-modal-title {
    margin: 0 0 12px;
    font-size: 1.25rem;
    color: #2D5F5D;
}

#idle-modal-body {
    margin: 0 0 4px;
    color: #555;
    font-size: 0.95rem;
}

#idle-countdown-display {
    margin: 0 0 28px;
}

#idle-countdown {
    font-size: 2.2rem;
    font-weight: 700;
    color: #2D5F5D;
    letter-spacing: 2px;
}

#idle-stay-btn {
    background: linear-gradient(135deg, #1A3938 0%, #2D5F5D 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 32px;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

#idle-stay-btn:hover {
    opacity: 0.88;
}

/* ── Physical Profile Modal ─────────────────────────────────────────────── */
#physical-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

#physical-modal {
    background: white;
    border-radius: 10px;
    padding: 32px 36px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

#physical-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

#physical-modal-title {
    margin: 0;
    font-size: 1.2rem;
    color: #2D5F5D;
}

#physical-close-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: #888;
    cursor: pointer;
    padding: 0;
}

#physical-close-btn:hover {
    color: #333;
}

.physical-field {
    margin-bottom: 16px;
}

.physical-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}

.physical-field input,
.physical-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #333;
    transition: border-color 0.2s;
}

.physical-field input:focus,
.physical-field select:focus {
    outline: none;
    border-color: #2D5F5D;
    box-shadow: 0 0 0 3px rgba(45, 95, 93, 0.12);
}

.physical-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.physical-input-row input {
    width: auto;
    flex: 1;
}

.physical-unit {
    font-size: 0.85rem;
    color: #888;
    white-space: nowrap;
}

.physical-error {
    color: #2D5F5D;
    font-size: 0.875rem;
    margin-bottom: 14px;
    padding: 8px 12px;
    background: rgba(192, 57, 43, 0.08);
    border-radius: 6px;
}

#physical-save-btn {
    width: 100%;
    background: linear-gradient(135deg, #1A3938 0%, #2D5F5D 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 4px;
}

#physical-save-btn:hover {
    opacity: 0.88;
}

#physical-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Food Log ────────────────────────────────────────────────────────────── */

.fl-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

/* Week navigator */
.fl-week-nav {
    display: flex;
    flex-direction: column;
    margin-bottom: 28px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.07);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    overflow: hidden;
}

.fl-week-nav-main {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px 14px;
}

.fl-week-nav-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 20px 10px;
    border-top: 1px solid rgba(0,0,0,0.05);
    background: rgba(0,0,0,0.01);
}

.fl-week-center {
    text-align: center;
    flex: 1;
}

.fl-week-eyebrow {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #A0A0A0;
    font-family: Arial, sans-serif;
    margin-bottom: 4px;
}

.fl-week-label {
    font-size: 18px;
    font-weight: 600;
    color: #1A3938;
    letter-spacing: -0.01em;
}

.fl-week-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.10);
    background: #FAFAF8;
    color: #2D5F5D;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.fl-week-btn:hover {
    background: rgba(45,95,93,0.08);
    border-color: rgba(45,95,93,0.3);
}

/* Clear Week button */
.fl-clear-week-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    background: none;
    border: 1px solid rgba(139,58,58,0.3);
    border-radius: 6px;
    font-size: 12px;
    font-family: Arial, sans-serif;
    color: #8B3A3A;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.fl-clear-week-btn:hover {
    background: rgba(139,58,58,0.07);
    border-color: #8B3A3A;
}

/* Week-start day selector */
.fl-week-start-ctrl {
    display: flex;
    align-items: center;
    gap: 8px;
}
.fl-week-start-label {
    font-size: 12px;
    color: #7A9090;
    font-family: Arial, sans-serif;
    white-space: nowrap;
}
.fl-week-start-select {
    padding: 4px 8px;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 6px;
    font-size: 12px;
    font-family: Arial, sans-serif;
    color: #1A3938;
    background: #FAFAF8;
    cursor: pointer;
    outline: none;
}
.fl-week-start-select:focus { border-color: #2D5F5D; }

/* Clear Week confirmation modal */
#fl-clear-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}
.fl-clear-modal {
    background: #FAFAF8;
    border-radius: 12px;
    width: 380px;
    max-width: 92vw;
    padding: 28px 28px 22px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}
.fl-clear-title {
    font-size: 17px;
    font-weight: 700;
    color: #1A3938;
    margin-bottom: 10px;
    font-family: Arial, sans-serif;
}
.fl-clear-msg {
    font-size: 13px;
    color: #7A9090;
    line-height: 1.5;
    margin-bottom: 22px;
    font-family: Arial, sans-serif;
}
.fl-clear-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.fl-clear-confirm-btn {
    padding: 8px 18px;
    background: #8B3A3A;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    font-family: Arial, sans-serif;
    cursor: pointer;
    transition: background 0.15s;
}
.fl-clear-confirm-btn:hover { background: #6B2A2A; }
.fl-clear-confirm-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Day cards container */
.fl-days {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Day card */
.fl-day-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.07);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    transition: box-shadow 0.15s;
}
.fl-day-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.07);
}
.fl-day-card--today {
    border-color: rgba(45,95,93,0.35);
    box-shadow: 0 0 0 1px rgba(45,95,93,0.15), 0 4px 14px rgba(0,0,0,0.06);
}

/* Day card header */
.fl-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    background: #FAFAF8;
}
.fl-day-card--today .fl-day-header {
    background: rgba(45,95,93,0.05);
}

.fl-day-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.fl-day-name {
    font-size: 15px;
    font-weight: 700;
    color: #1A3938;
    font-family: Georgia, serif;
}
.fl-day-date {
    font-size: 13px;
    color: #7A9090;
    font-family: Arial, sans-serif;
}
.fl-today-badge {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    background: #2D5F5D;
    color: #fff;
    padding: 3px 10px;
    border-radius: 20px;
    font-family: Arial, sans-serif;
}

/* Entry list */
.fl-entry-list {
    min-height: 10px;
}

.fl-empty {
    padding: 14px 20px;
    font-size: 13px;
    color: #B0C0C0;
    font-family: Arial, sans-serif;
    font-style: italic;
}

.fl-entry-row {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    transition: background 0.12s, opacity 0.2s;
}
.fl-entry-row:last-child { border-bottom: none; }
.fl-entry-row:hover { background: rgba(45,95,93,0.03); }

.fl-entry-time {
    font-size: 13px;
    font-weight: 600;
    color: #2D5F5D;
    font-family: Arial, sans-serif;
    min-width: 54px;
    flex-shrink: 0;
}
.fl-entry-food {
    font-size: 14px;
    color: #1A3938;
    font-family: Arial, sans-serif;
    flex: 1;
    padding: 0 12px;
}
.fl-entry-amount {
    font-size: 13px;
    color: #7A9090;
    font-family: Arial, sans-serif;
    min-width: 90px;
    text-align: right;
    flex-shrink: 0;
    padding-right: 12px;
}
.fl-delete-btn {
    background: none;
    border: none;
    color: #C0CECE;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
}
.fl-delete-btn:hover { color: #8B3A3A; background: rgba(139,58,58,0.08); }

/* SR28 calorie display badge */
.fl-kcal-badge {
    font-size: 11px;
    color: #4A8886;
    background: rgba(74,136,134,0.1);
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
    font-family: Arial, sans-serif;
    white-space: nowrap;
}

/* All M/M Nutrients + All Phyto Nutrients buttons */
.fl-nutr-btn, .fl-phyto-btn {
    font-size: 11px;
    background: none;
    padding: 2px 8px;
    border-radius: 5px;
    flex-shrink: 0;
    font-family: Arial, sans-serif;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.fl-nutr-btn {
    color: #2D5F5D;
    border: 1px solid rgba(45,95,93,0.3);
}
.fl-nutr-btn:hover { background: rgba(45,95,93,0.07); border-color: #2D5F5D; }
.fl-phyto-btn {
    color: #6B5C2E;
    border: 1px solid rgba(107,92,46,0.3);
}
.fl-phyto-btn:hover { background: rgba(107,92,46,0.07); border-color: #6B5C2E; }

/* SR28 nutrient detail popup */
#fl-nutr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.fl-nutr-popup {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.fl-nutr-popup-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    flex-shrink: 0;
}
.fl-nutr-popup-food {
    font-size: 13px;
    font-weight: 600;
    color: #1A3938;
    font-family: Arial, sans-serif;
    margin: 0 0 3px;
}
.fl-nutr-popup-amount {
    font-size: 12px;
    color: #7A9090;
    font-family: Arial, sans-serif;
    margin: 0;
}
.fl-nutr-popup-body {
    overflow-y: auto;
    padding: 8px 20px 16px;
}
.fl-nutrient-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Arial, sans-serif;
    font-size: 12px;
}
.fl-nutrient-table tr:nth-child(even) { background: rgba(0,0,0,0.025); }
.fl-nutr-name {
    color: #2D5F5D;
    padding: 4px 10px 4px 0;
    width: 60%;
}
.fl-nutr-val {
    color: #1A3938;
    font-weight: 600;
    text-align: right;
    padding: 4px 6px;
    white-space: nowrap;
}
.fl-nutr-unit {
    color: #7A9090;
    padding: 4px 0 4px 2px;
    white-space: nowrap;
}

/* Phytochemical detail popup */
#fl-phyto-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.fl-phyto-popup {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.fl-phyto-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-family: Arial, sans-serif;
    font-size: 12px;
}
.fl-phyto-row:last-child { border-bottom: none; }
.fl-phyto-name { color: #6B5C2E; font-weight: 600; word-break: break-word; }
.fl-phyto-actions { color: #4A4A4A; }

/* Day macro summary bar */
/* ── Disorder coverage bar chart ─────────────────────────────────── */

/* Row wrapper: chart panel + day card */
.fl-day-row {
    display: flex;
    align-items: stretch;
    gap: 0;
}

/* Chart panel — left sidebar */
.fl-cov-panel {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: #FAFAF8;
    border: 1px solid rgba(0,0,0,0.07);
    border-right: none;
    border-radius: 10px 0 0 10px;
    padding: 14px 10px 12px 12px;
    overflow: visible;
    transition: box-shadow 0.15s;
}
.fl-cov-panel:empty {
    display: none;
}
/* No chart: restore card's full border-radius */
.fl-cov-panel:empty + .fl-day-card {
    border-radius: 10px;
}
/* Chart present: card loses left radius; row handles hover */
.fl-day-row .fl-day-card {
    flex: 1;
    min-width: 0;
    border-radius: 0 10px 10px 0;
    box-shadow: none;
    transition: box-shadow 0.15s;
}
.fl-day-row .fl-day-card:hover { box-shadow: none; }
.fl-day-row .fl-day-card--today { box-shadow: none; }
/* Row-level hover: both panel and card get shadow together */
.fl-day-row:hover .fl-cov-panel,
.fl-day-row:hover .fl-day-card {
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}
/* Today highlight on chart panel */
.fl-day-row:has(.fl-day-card--today) .fl-cov-panel {
    background: rgba(45,95,93,0.04);
    border-color: rgba(45,95,93,0.28);
}

/* Chart inner: y-axis + bars column */
.fl-cov-inner {
    display: flex;
    align-items: flex-start;
    gap: 5px;
}
.fl-cov-yaxis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 120px;
    padding-right: 3px;
    font-size: 8px;
    font-family: Arial, sans-serif;
    color: #aaa;
    flex-shrink: 0;
    text-align: right;
    line-height: 1;
}
.fl-cov-chart-cols {
    display: flex;
    flex-direction: column;
}

/* Bars area */
.fl-cov-bars {
    display: flex;
    align-items: flex-end;
    gap: 7px;
    height: 120px;
    position: relative;
    border-bottom: 1px solid rgba(0,0,0,0.10);
}
/* Gridlines at 25 / 50 / 75 / 100% */
.fl-cov-bars::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to top,
        transparent 0,
        transparent calc(25% - 1px),
        rgba(0,0,0,0.07) calc(25% - 1px),
        rgba(0,0,0,0.07) 25%
    );
    pointer-events: none;
}

/* Bar track (background) */
.fl-cov-bar-bg {
    width: 22px;
    height: 100%;
    background: rgba(0,0,0,0.04);
    border-radius: 3px 3px 0 0;
    display: flex;
    align-items: flex-end;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    z-index: 1;
    cursor: default;
}
/* Bar fill */
.fl-cov-bar-fill {
    width: 100%;
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: height 0.35s ease;
}
.fl-cov-fill--0  { background: #9b3535; }
.fl-cov-fill--20 { background: #b06020; }
.fl-cov-fill--40 { background: #8a7a2a; }
.fl-cov-fill--60 { background: #2a7a52; }
.fl-cov-fill--80 { background: #1a6b8a; }

/* X-axis labels row */
.fl-cov-xlabels {
    display: flex;
    gap: 7px;
    padding-top: 5px;
    overflow: visible;
}
.fl-cov-label {
    width: 22px;
    flex-shrink: 0;
    font-size: 9px;
    font-family: Arial, sans-serif;
    color: #7A9090;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    text-align: left;
    white-space: nowrap;
    max-height: 100px;
    overflow: hidden;
    cursor: default;
    user-select: none;
    line-height: 22px;
}

.fl-day-macros {
    min-height: 0;
    overflow: hidden;
}
.fl-day-macros:empty { display: none; }
.fl-day-macros-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 20px;
    font-size: 11px;
    font-family: Arial, sans-serif;
    color: #7A9090;
    border-top: 1px solid rgba(0,0,0,0.04);
}
.fl-macros-label {
    color: #4A8886;
    font-weight: 600;
    flex-shrink: 0;
}
.fl-macro-val { white-space: nowrap; }
.fl-macro-val strong { color: #1A3938; }
.fl-macro-sep { opacity: 0.35; }

/* Card footer */
.fl-card-footer {
    display: flex;
    align-items: center;
    padding: 10px 20px 12px;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(0,0,0,0.05);
    background: #FAFAF8;
}

.fl-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #fff;
    border: 1px solid rgba(45,95,93,0.3);
    border-radius: 6px;
    font-size: 13px;
    font-family: Arial, sans-serif;
    color: #2D5F5D;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
}
.fl-add-btn:hover {
    background: rgba(45,95,93,0.07);
    border-color: #2D5F5D;
}

.fl-entry-count {
    margin-left: auto;
    font-size: 12px;
    color: #A0B0B0;
    font-family: Arial, sans-serif;
}

/* Inline add form */
.fl-inline-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}

.fl-input {
    padding: 7px 11px;
    border: 1px solid rgba(0,0,0,0.14);
    border-radius: 6px;
    font-size: 13px;
    font-family: Arial, sans-serif;
    color: #1A3938;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}
.fl-input:focus { border-color: #2D5F5D; }
.fl-input--error { border-color: #c85858 !important; background: rgba(200,88,88,0.04); }
.fl-form-error { font-size: 12px; color: #c85858; margin-top: 4px; display: none; }
.fl-form-error.visible { display: block; }
.fl-input--food  { flex: 1; min-width: 140px; }
.fl-input--amount { width: 120px; flex-shrink: 0; }
.fl-input--qty    { width: 64px; flex-shrink: 0; text-align: center; padding: 7px 6px; }
.fl-input:disabled { background: rgba(0,0,0,0.04); color: #999; cursor: not-allowed; }
.fl-serving-qty {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}
.fl-serving-label {
    font-size: 12px;
    color: #556;
    white-space: nowrap;
}

/* Food group filter select (visible during Refine) */
.fl-fgroup-select {
    flex: 1;
    min-width: 140px;
    max-width: 210px;
    font-size: 12px;
    padding: 7px 8px;
}

/* SR28 match banner */
.fl-match-banner {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(45,95,93,0.07);
    border: 1px solid rgba(45,95,93,0.22);
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 12px;
    color: #1A3938;
    margin-top: 2px;
}
.fl-match-banner-label {
    font-size: 11px;
    color: #7A9090;
    margin-bottom: 2px;
}
.fl-match-options { display: flex; flex-direction: column; gap: 3px; }
.fl-match-option {
    text-align: left;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(45,95,93,0.18);
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 12px;
    font-family: Arial, sans-serif;
    color: #1A3938;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    width: 100%;
}
.fl-match-option:hover { background: rgba(45,95,93,0.1); border-color: #2D5F5D; }
.fl-match-option--best {
    border-color: #2D5F5D;
    background: rgba(45,95,93,0.08);
    font-weight: 500;
}
.fl-match-option--best:hover { background: rgba(45,95,93,0.15); }
.fl-match-footer {
    display: flex;
    gap: 8px;
    margin-top: 3px;
    align-items: center;
}
.fl-match-skip-btn {
    padding: 4px 10px;
    background: none;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 5px;
    font-size: 12px;
    font-family: Arial, sans-serif;
    color: #7A9090;
    cursor: pointer;
    transition: background 0.15s;
}
.fl-match-skip-btn:hover { background: rgba(0,0,0,0.04); }
.fl-match-refine-btn {
    padding: 4px 6px;
    background: none;
    border: none;
    font-size: 12px;
    font-family: Arial, sans-serif;
    color: #2D5F5D;
    cursor: pointer;
    text-decoration: underline;
}

/* Source database badge on match-option buttons */
.fl-match-source {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 3px;
    padding: 1px 4px;
    margin-right: 5px;
    vertical-align: middle;
    flex-shrink: 0;
    line-height: 1.5;
}
.fl-match-source--sr28    { background: rgba(45,95,93,0.12);  color: #1e4e4c; }
.fl-match-source--fndds   { background: rgba(90,60,130,0.12); color: #4a2a7a; }
.fl-match-source--branded { background: rgba(180,120,40,0.12); color: #7a4c00; }
.fl-match-serving {
    font-size: 11px;
    color: #777;
    margin-left: 6px;
    font-style: italic;
}

/* 3-part time picker */
.fl-time-picker-wrap {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}
.fl-tp-h  { width: 52px; text-align: center; padding: 7px 6px; }
.fl-tp-m  { width: 52px; text-align: center; padding: 7px 6px; }
.fl-tp-p  { width: 62px; padding: 7px 4px; cursor: pointer; }
.fl-tp-sep { font-size: 15px; font-weight: 600; color: #7A9090; flex-shrink: 0; }

/* Inline row time editor (smaller variant) */
.fl-time-edit-wrap {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.fl-tp-h--sm  { width: 44px; text-align: center; padding: 4px 4px; font-size: 12px; }
.fl-tp-m--sm  { width: 44px; text-align: center; padding: 4px 4px; font-size: 12px; }
.fl-tp-p--sm  { width: 54px; padding: 4px 3px; font-size: 12px; cursor: pointer; }

.fl-save-btn--xs,
.fl-cancel-btn--xs {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 5px;
}
.fl-save-btn--xs  { background: #2D5F5D; color: #fff; border: none; cursor: pointer; }
.fl-save-btn--xs:hover { background: #1A3938; }
.fl-cancel-btn--xs { background: none; border: 1px solid rgba(0,0,0,0.12); color: #7A9090; cursor: pointer; }

/* Entry row actions (edit + delete) — always visible */
.fl-row-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    margin-left: 8px;
}

.fl-edit-btn {
    background: none;
    border: none;
    color: #7A9090;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
}
.fl-edit-btn:hover { color: #2D5F5D; background: rgba(45,95,93,0.08); }

/* Inline editing state for a full entry row */
.fl-entry-row--editing {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(45,95,93,0.03);
}

.fl-save-btn {
    padding: 7px 18px;
    background: #2D5F5D;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-family: Arial, sans-serif;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}
.fl-save-btn:hover { background: #1A3938; }

.fl-cancel-btn {
    padding: 7px 14px;
    background: none;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 6px;
    font-size: 13px;
    font-family: Arial, sans-serif;
    color: #7A9090;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}
.fl-cancel-btn:hover { background: rgba(0,0,0,0.04); }

/* Load Meal Plan button */
.fl-load-plan-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: none;
    border: 1px solid #C8A882;
    border-radius: 6px;
    font-size: 13px;
    font-family: Arial, sans-serif;
    color: #C8A882;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.fl-load-plan-btn:hover {
    background: rgba(200,168,130,0.1);
    color: #B08A5A;
    border-color: #B08A5A;
}

/* Plan load status (next to Load Meal Plan button) */
.fl-plan-status {
    font-size: 12px;
    color: #7A9090;
    font-family: Arial, sans-serif;
    flex-shrink: 0;
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}
.fl-plan-status--ok  { color: #2D5F5D; }
.fl-plan-status--err { color: #8B3A3A; }

/* From Plan button (per-day card, hidden until plan loaded) */
.fl-from-plan-btn {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: none;
    border: 1px solid #C8A882;
    border-radius: 6px;
    font-size: 12px;
    font-family: Arial, sans-serif;
    color: #C8A882;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.fl-from-plan-btn:hover {
    background: rgba(200,168,130,0.12);
    color: #B08A5A;
}

/* Day Plan Modal */
#fl-day-plan-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}
.fl-day-plan-modal {
    background: #FAFAF8;
    border-radius: 14px;
    width: 580px;
    max-width: 94vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 48px rgba(0,0,0,0.22);
    overflow: hidden;
}
.fl-day-plan-header {
    padding: 20px 24px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-shrink: 0;
}
.fl-plan-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #C8A882;
    margin-bottom: 4px;
}
.fl-plan-title {
    font-size: 17px;
    font-weight: 700;
    color: #1A3938;
    line-height: 1.3;
}
.fl-day-plan-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.fl-day-plan-footer {
    padding: 14px 24px 18px;
    border-top: 1px solid rgba(0,0,0,0.07);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* Plan entry rows inside the day modal */
.fl-plan-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 24px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background 0.12s;
}
.fl-plan-row:last-child { border-bottom: none; }
.fl-plan-row:hover { background: rgba(45,95,93,0.03); }
.fl-plan-check {
    width: 16px;
    height: 16px;
    accent-color: #2D5F5D;
    flex-shrink: 0;
    cursor: pointer;
    margin-top: 1px;
}
.fl-plan-row-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
    min-width: 0;
}
.fl-plan-row-name {
    font-size: 13px;
    color: #1A3938;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: Arial, sans-serif;
}
.fl-plan-row-amount {
    font-size: 11px;
    color: #C8A882;
    font-family: Arial, sans-serif;
}
.fl-plan-row-time {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

/* Modal footer action buttons */
.fl-plan-add-sel-btn {
    padding: 8px 16px;
    background: none;
    border: 1.5px solid #2D5F5D;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    font-family: Arial, sans-serif;
    color: #2D5F5D;
    cursor: pointer;
    transition: background 0.15s;
}
.fl-plan-add-sel-btn:hover { background: rgba(45,95,93,0.07); }
.fl-plan-add-all-btn {
    padding: 8px 18px;
    background: #2D5F5D;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    font-family: Arial, sans-serif;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}
.fl-plan-add-all-btn:hover { background: #1A3938; }
.fl-plan-add-all-btn:disabled,
.fl-plan-add-sel-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Food log page: allow normal document scrolling ───────────────────────── */
body.fl-body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    display: block;
}
body.fl-body .header-bar {
    position: sticky;
    top: 0;
    z-index: 600;
}
body.fl-body .action-menu-bar {
    position: sticky;
    top: 75px;
    z-index: 599;
}

/* Week nav sub-row layout (two groups: actions | prefs) */
.fl-week-nav-sub { flex-wrap: wrap; }
.fl-week-nav-sub-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.fl-week-nav-sub-prefs {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

/* Email Log button */
.fl-email-log-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: none;
    border: 1px solid rgba(45,95,93,0.35);
    border-radius: 6px;
    font-size: 12px;
    font-family: Arial, sans-serif;
    color: #2D5F5D;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.fl-email-log-btn:hover {
    background: rgba(45,95,93,0.06);
    border-color: #2D5F5D;
}

/* Save on clear checkbox label */
.fl-save-on-clear-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-family: Arial, sans-serif;
    color: #7A9090;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}
.fl-save-on-clear-chk {
    width: 14px;
    height: 14px;
    accent-color: #2D5F5D;
    cursor: pointer;
    flex-shrink: 0;
}

/* Email Log Modal */
#fl-email-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}
.fl-email-modal {
    background: #FAFAF8;
    border-radius: 14px;
    width: 460px;
    max-width: 94vw;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 48px rgba(0,0,0,0.22);
    overflow: hidden;
}
.fl-email-header {
    padding: 20px 24px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}
.fl-email-title {
    font-size: 17px;
    font-weight: 700;
    color: #1A3938;
    line-height: 1.3;
    margin: 0;
}
.fl-email-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.fl-email-desc {
    font-size: 13px;
    font-family: Arial, sans-serif;
    color: #7A9090;
    margin: 0;
    line-height: 1.6;
}
.fl-email-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.fl-email-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #A0A0A0;
    font-family: Arial, sans-serif;
}
.fl-email-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    font-size: 14px;
}
.fl-email-note {
    font-size: 12px;
    font-family: Arial, sans-serif;
    color: #A0A0A0;
    margin: 0;
    min-height: 16px;
}
.fl-email-note--ok  { color: #2D5F5D; }
.fl-email-note--err { color: #8B3A3A; }
.fl-email-footer {
    padding: 12px 24px 18px;
    border-top: 1px solid rgba(0,0,0,0.07);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}
.fl-email-send-btn {
    padding: 9px 20px;
    background: #2D5F5D;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    font-family: Arial, sans-serif;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}
.fl-email-send-btn:hover { background: #1A3938; }
.fl-email-send-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* History button */
.fl-history-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: none;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 6px;
    font-size: 12px;
    font-family: Arial, sans-serif;
    color: #6B6B6B;
    cursor: pointer;
    transition: background 0.15s;
}
.fl-history-btn:hover { background: rgba(0,0,0,0.04); }

.fl-print-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: none;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 6px;
    font-size: 12px;
    font-family: Arial, sans-serif;
    color: #6B6B6B;
    cursor: pointer;
    transition: background 0.15s;
}
.fl-print-btn:hover { background: rgba(0,0,0,0.04); }

.fl-ai-review-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    background: #2D5F5D;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-family: Arial, sans-serif;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}
.fl-ai-review-btn:hover { background: #1A3938; }

/* AI Review modal */
#fl-ai-review-overlay {
    position: fixed;
    inset: 0;
    z-index: 9100;
    background: rgba(20,40,40,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.fl-ai-review-modal {
    background: #FAFAF8;
    border-radius: 12px;
    box-shadow: 0 16px 64px rgba(0,0,0,0.22);
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.fl-ai-review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 22px 26px 16px;
    border-bottom: 1px solid rgba(45,95,93,0.12);
    background: #fff;
    flex-shrink: 0;
}
.fl-ai-review-title {
    font-size: 20px;
    font-weight: 600;
    color: #1A3938;
    margin-top: 2px;
}
.fl-ai-review-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 26px;
}
.fl-ai-review-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 48px 0;
}
.fl-ai-review-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(45,95,93,0.18);
    border-top-color: #2D5F5D;
    border-radius: 50%;
    animation: fl-spin 0.85s linear infinite;
}
@keyframes fl-spin { to { transform: rotate(360deg); } }
.fl-ai-review-loading-text {
    font-size: 14px;
    color: #888;
    font-family: Arial, sans-serif;
}
.fl-ai-review-content .fl-ai-h3 {
    font-size: 15px;
    font-weight: 700;
    color: #2D5F5D;
    margin: 22px 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(45,95,93,0.15);
    font-family: Arial, sans-serif;
}
.fl-ai-review-content .fl-ai-h3:first-child { margin-top: 0; }
.fl-ai-review-content .fl-ai-p {
    font-size: 14px;
    line-height: 1.7;
    color: #2A2A2A;
    margin: 0 0 10px;
}
.fl-ai-review-content .fl-ai-ul {
    margin: 0 0 12px 0;
    padding-left: 0;
    list-style: none;
}
.fl-ai-review-content .fl-ai-li {
    font-size: 14px;
    line-height: 1.65;
    color: #2A2A2A;
    padding: 3px 0 3px 18px;
    position: relative;
}
.fl-ai-review-content .fl-ai-li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 11px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #C8A882;
}
.fl-ai-review-error {
    color: #8B3A3A;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

/* Review mode: dim non-applicable controls */
.fl-week-nav--review .fl-clear-week-btn,
.fl-week-nav--review .fl-save-on-clear-label,
.fl-week-nav--review .fl-week-start-ctrl,
.fl-week-nav--review .fl-load-plan-btn,
.fl-week-nav--review .fl-week-btn,
.fl-week-nav--review .fl-history-btn {
    opacity: 0.28;
    pointer-events: none;
}
.fl-week-nav--review .fl-week-eyebrow {
    color: #C8A882;
}

/* Review banner */
.fl-review-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(45,95,93,0.06);
    border: 1px solid rgba(45,95,93,0.22);
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.fl-review-banner-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.fl-review-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    background: #2D5F5D;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: Arial, sans-serif;
    flex-shrink: 0;
}
.fl-review-info {
    font-size: 13px;
    color: #1A3938;
    font-family: Arial, sans-serif;
    font-weight: 500;
}
.fl-review-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    background: #2D5F5D;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-family: Arial, sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}
.fl-review-back-btn:hover { background: #1A3938; }

/* Review mode day card: logged/planned sections */
.fl-review-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #B0B0B0;
    padding: 7px 20px 3px;
    font-family: Arial, sans-serif;
}
.fl-planned-section {
    border-top: 1px dashed rgba(200,168,130,0.45);
    margin-top: 4px;
    padding-bottom: 6px;
}
.fl-planned-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}
.fl-planned-row:last-child { border-bottom: none; }
.fl-planned-time {
    font-size: 12px;
    color: #C8A882;
    font-family: Arial, sans-serif;
    white-space: nowrap;
    flex-shrink: 0;
    width: 68px;
}
.fl-planned-food {
    flex: 1;
    font-size: 13px;
    color: #8A9FA0;
    font-family: Arial, sans-serif;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.fl-planned-meal {
    font-size: 11px;
    color: #C8A882;
    font-family: Arial, sans-serif;
    flex-shrink: 0;
}

/* History Modal */
#fl-history-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}
.fl-history-modal {
    background: #FAFAF8;
    border-radius: 14px;
    width: 520px;
    max-width: 94vw;
    max-height: 72vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 48px rgba(0,0,0,0.22);
    overflow: hidden;
}
.fl-history-header {
    padding: 20px 24px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-shrink: 0;
}
.fl-history-title {
    font-size: 17px;
    font-weight: 700;
    color: #1A3938;
    margin: 0;
}
.fl-history-body {
    flex: 1;
    overflow-y: auto;
}
.fl-history-loading {
    padding: 20px 24px;
    font-size: 13px;
    color: #7A9090;
    font-family: Arial, sans-serif;
    font-style: italic;
}
.fl-hist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 24px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
    transition: background 0.12s;
    gap: 12px;
}
.fl-hist-item:last-child { border-bottom: none; }
.fl-hist-item:hover { background: rgba(45,95,93,0.04); }
.fl-hist-item-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}
.fl-hist-dates {
    font-size: 14px;
    font-weight: 600;
    color: #1A3938;
    font-family: Arial, sans-serif;
}
.fl-hist-meta {
    font-size: 12px;
    color: #7A9090;
    font-family: Arial, sans-serif;
}
.fl-hist-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    color: #B0B0B0;
}
.fl-hist-saved {
    font-size: 12px;
    color: #A0A0A0;
    font-family: Arial, sans-serif;
    white-space: nowrap;
}
