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

:root {
    --size-m-font: 1rem;
    --size-m-py: 0.625rem;
    --size-m-px: 1.25rem;
    --size-m-height: 40px;
    --size-m-radius: 8px;

    --size-sm-font: 0.875rem;
    --size-sm-py: 0.375rem;
    --size-sm-px: 0.75rem;
    --size-sm-height: 32px;
    --size-sm-radius: 6px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

nav {
    display: flex;
    gap: 2rem;
}

nav a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

nav a:hover {
    color: #3498db;
}

main {
    width: 100%;
    margin: 2rem auto;
    padding: 0 1rem;
}

footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1rem;
    margin-top: 2rem;
}

a {
    text-decoration: none;
}

.container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.auth-form {
    max-width: 400px;
    margin: 2rem auto;
}

h1 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

h2 {
    color: #34495e;
    margin: 1.5rem 0 1rem;
}

.btn {
    padding: var(--size-m-py) var(--size-m-px);
    border: none;
    border-radius: var(--size-m-radius);
    cursor: pointer;
    font-size: var(--size-m-font);
    height: var(--size-m-height);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-sm {
    padding: var(--size-sm-py) var(--size-sm-px);
    font-size: var(--size-sm-font);
    height: var(--size-sm-height);
    border-radius: var(--size-sm-radius);
}

.btn-save {
    background-color: #27ae60;
    color: white;
}

.btn-save:hover {
    background-color: #1e8449;
}

.btn-translate {
    background-color: #e67e22;
    color: white;
}

.btn-translate:hover {
    background-color: #d35400;
}

.info-box {
    background-color: #ecf0f1;
    padding: 1rem;
    border-radius: 4px;
    border-left: 4px solid #3498db;
}

.results-table-container {
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
}

.results-table,
.nutrients-table,
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
}

.results-table th,
.results-table td,
.nutrients-table th,
.nutrients-table td,
.admin-table th,
.admin-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    border-right: 1px solid #dee2e6;
}

.results-table th,
.nutrients-table th,
.admin-table th {
    background-color: #343a40;
    color: #fff;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}

.results-table tr:hover,
.nutrients-table tr:hover,
.admin-table tr:hover {
    background-color: #f8f9fa;
}

.nutrients-table .highlight {
    background-color: #fff3cd;
    font-weight: 600;
}

.meta-info {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 1rem;
    align-items: center;
    margin-top: 1.5rem;
}

.pagination a {
    padding: var(--size-m-py) var(--size-m-px);
    background-color: #3498db;
    color: white;
    text-decoration: none;
    border-radius: var(--size-m-radius);
}

.pagination a:hover {
    background-color: #2980b9;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: var(--size-m-py) var(--size-m-px);
    border: 1px solid #ddd;
    border-radius: var(--size-m-radius);
    font-size: var(--size-m-font);
    height: var(--size-m-height);
    line-height: 1;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
}

.form-control-sm {
    width: auto;
    padding: var(--size-sm-py) var(--size-sm-px);
    border: 1px solid #ddd;
    border-radius: var(--size-sm-radius);
    font-size: var(--size-sm-font);
    height: var(--size-sm-height);
    line-height: 1;
}

.form-control-sm:focus {
    outline: none;
    border-color: #3498db;
}

.buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.admin-actions {
    margin-bottom: 1.5rem;
}

.translation-input {
    min-width: 200px;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid #f5c6cb;
}

@media (max-width: 768px) {

    .results-table,
    .nutrients-table,
    .admin-table {
        font-size: 0.875rem;
    }

    .buttons {
        flex-direction: column;
    }
}

.dropzone {
    border: 3px dashed #3498db;
    border-radius: 8px;
    padding: 4rem 2rem;
    text-align: center;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 2rem;
}

.dropzone.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.dropzone.dragover {
    background-color: #e8f4f8;
    border-color: #2980b9;
}

.dropzone-content {
    color: #2c3e50;
}

.dropzone-content svg {
    color: #3498db;
    margin-bottom: 1rem;
}

.dropzone-content p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.upload-progress {
    margin: 2rem 0;
}

.progress-bar-container {
    width: 100%;
    height: 24px;
    background-color: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    background-color: #3498db;
    transition: width 0.3s ease;
    border-radius: 12px;
}

.upload-status {
    text-align: center;
    color: #2c3e50;
    font-size: 1.1rem;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid #f5c6cb;
}

.project-info {
    background-color: #d4edda;
    padding: 1.5rem;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
    margin-top: 2rem;
}

.project-info h2 {
    color: #155724;
    margin: 0 0 1rem 0;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.project-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.project-meta span {
    color: #666;
}

.matching-progress {
    margin: 2rem 0;
    background-color: #fff3cd;
    padding: 1.5rem;
    border-radius: 4px;
    border: 1px solid #ffc107;
}

.matching-progress .progress-bar-container {
    margin-bottom: 0.5rem;
}

.matching-progress .progress-bar {
    background-color: #ffc107;
}

.matching-status {
    text-align: center;
    color: #856404;
    font-size: 1.1rem;
}

.action-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stats-bar {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.filter-bar {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    color: #2c3e50;
    font-weight: 500;
}

.filter-select {
    padding: var(--size-m-py) var(--size-m-px);
    border: 1px solid #ddd;
    border-radius: var(--size-m-radius);
    font-size: var(--size-m-font);
    height: var(--size-m-height);
    min-width: 150px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #666;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.stat-item.matched .stat-value {
    color: #28a745;
}

.stat-item.ambiguous .stat-value {
    color: #ffc107;
}

.stat-item.unmatched .stat-value {
    color: #dc3545;
}

.products-table-container {
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
}

.products-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
}

.products-table th,
.products-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    border-right: 1px solid #dee2e6;
}

.products-table th {
    background-color: #343a40;
    color: #fff;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-matched {
    background-color: #d4edda;
    color: #155724;
}

.status-ambiguous {
    background-color: #fff3cd;
    color: #856404;
}

.status-unmatched {
    background-color: #f8d7da;
    color: #721c24;
}

.status-web-enriched {
    background-color: #fff3cd;
    color: #856404;
}

.status-confirmed {
    background-color: #d1ecf1;
    color: #0c5460;
}

.text-muted {
    color: #6c757d;
    font-size: 0.75rem;
}

.text-success {
    color: #28a745;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5vh auto;
    padding: 2rem;
    border-radius: 8px;
    width: 80%;
    min-width: 320px;
    min-height: 80vh;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    color: #2c3e50;
}

.modal-body p {
    margin-bottom: 1rem;
    font-weight: 600;
}

.mt-3 {
    margin-top: 1rem;
}

.modal-divider {
    border-top: 1px solid #dee2e6;
    margin: 1.5rem 0;
}

@media (max-width: 768px) {
    .stats-bar {
        flex-direction: column;
        gap: 1rem;
    }

    .stat-item {
        flex-direction: row;
        gap: 0.5rem;
    }

    .products-table th,
    .products-table td {
        padding: 0.25rem;
    }
}

.projects-list-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #ddd;
}

.projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.project-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

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

.project-card h3 {
    color: #2c3e50;
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.project-date {
    color: #666;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4rem;
}

.projects-header h1 {
    margin: 0;
    color: #2c3e50;
}

.project-name-input {
    width: 100%;
    padding: var(--size-m-py) var(--size-m-px);
    border: 1px solid #ddd;
    border-radius: var(--size-m-radius);
    font-size: var(--size-m-font);
    height: var(--size-m-height);
    margin-bottom: 1.5rem;
    transition: border-color 0.3s;
}

.project-name-input:focus {
    outline: none;
    border-color: #3498db;
}

.required {
    color: #e74c3c;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #666;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

.nutrition-sources {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.nutrition-sources a {
    color: #3498db;
    font-size: 0.875rem;
    word-break: break-all;
}

.nutrition-sources a:hover {
    text-decoration: underline;
}

.clarify-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.clarify-section {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.clarify-section h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: #2c3e50;
}

.clarify-section p {
    margin: 0.5rem 0;
}

.clarify-section .form-group {
    margin-bottom: 0.5rem;
}

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

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

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.category-filters label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    cursor: pointer;
    white-space: nowrap;
    margin-left: 1rem;
}

.category-filters input[type="checkbox"] {
    margin: 0;
}

.inline-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #27ae60;
}

.form-group-checkbox label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-group-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #27ae60;
}

.btn-favorite {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #ccc;
    transition: color 0.2s;
    padding: 0;
}

.btn-favorite:hover {
    color: #f39c12;
}

.btn-favorite.active {
    color: #f39c12;
}

.user-info {
    margin-left: auto;
    padding-right: 1rem;
}

.admin-only {
    display: none;
}

.user-management-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-inline {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-inline .form-control {
    flex: 1;
    min-width: 150px;
}

.user-group {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-group h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.role-select {
    padding: var(--size-sm-py) var(--size-sm-px);
    border: 1px solid #ddd;
    border-radius: var(--size-sm-radius);
    font-size: var(--size-sm-font);
    height: var(--size-sm-height);
    cursor: pointer;
}

.btn-delete {
    background-color: #dc3545;
    color: white;
    border: none;
}

.btn-delete:hover {
    background-color: #c82333;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    white-space: nowrap;
}

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

.dish-ingredients-table {
    margin: 1.5rem 0;
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
}

.nutrition-totals {
    background-color: #d4edda;
    padding: 1.5rem;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
    margin: 1.5rem 0;
}

.nutrition-totals h3 {
    color: #155724;
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
}

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

.totals-grid div {
    color: #155724;
    font-size: 0.95rem;
}

.favorite-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #ccc;
    transition: color 0.2s;
    padding: 0;
}

.favorite-btn:hover {
    color: #f39c12;
}

.favorite-btn.active {
    color: #f39c12;
}

.name-warning {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: #f8d7da;
    border-radius: 4px;
    font-weight: 500;
}

.ingredient-search {
    position: relative;
}

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

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.menu-header h1 {
    margin: 0;
}

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

.menu-stats-bar {
    background-color: #e7f3ff;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

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

.stat-label {
    font-weight: 500;
    color: #495057;
}

.stat-value {
    font-weight: 600;
    color: #0056b3;
}

.stat-target {
    color: #6c757d;
}

.week-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.week-tab {
    padding: var(--size-m-py) var(--size-m-px);
    border: 1px solid #dee2e6;
    background-color: #fff;
    cursor: pointer;
    border-radius: var(--size-m-radius);
    transition: all 0.2s;
}

.week-tab:hover {
    background-color: #f8f9fa;
}

.week-tab.active {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}

.menu-table-container {
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
}

.menu-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
}

.menu-table th {
    background-color: #343a40;
    color: #fff;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
    border-right: 1px solid #dee2e6;
}

.menu-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #dee2e6;
    border-right: 1px solid #dee2e6;
}

.menu-day-cell {
    background-color: #f8f9fa;
    font-weight: 600;
    vertical-align: middle;
}

.menu-meal-cell {
    background-color: #e9ecef;
    font-weight: 500;
    vertical-align: middle;
}

.menu-course-cell {
    font-weight: 500;
}

.menu-item-cell {
    min-width: 200px;
    cursor: pointer;
}

.menu-item-cell:hover {
    background-color: #f0f7ff;
}

.menu-item-cell--empty {
    color: #adb5bd;
    font-style: italic;
}

.nutrition-cell {
    text-align: right;
    font-family: monospace;
    font-size: 0.95rem;
}

.menu-totals-row {
    background-color: #d4edda;
    font-weight: 600;
}

.menu-totals-row td {
    border-bottom: 2px solid #c3e6cb;
}

[class^="day-total-"] {
    text-align: right;
    font-family: monospace;
    font-size: 0.95rem;
}

.loading-cell {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.project-select-section,
.project-upload-section {
    margin-bottom: 1rem;
}

.radio-group {
    display: flex;
    gap: 1.5rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    margin: 0;
}

.upload-progress {
    margin-top: 1rem;
}

.upload-progress .progress-bar {
    height: 20px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.upload-progress .progress-fill {
    height: 100%;
    background-color: #28a745;
    width: 0%;
    transition: width 0.3s;
}

.upload-progress .progress-text {
    font-size: 0.9rem;
    color: #495057;
    text-align: center;
}

.editor-item-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.editor-item-name {
    flex: 1;
    font-weight: 500;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0 0 4px 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1001;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.search-result-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.search-result-item:hover {
    background-color: #e7f3ff;
}

.search-group-label {
    padding: 0.4rem 0.75rem;
    font-size: 0.8em;
    font-weight: 600;
    color: #6c757d;
    background-color: #f8f9fa;
    text-transform: uppercase;
}

.inline-select {
    padding: var(--size-sm-py) var(--size-sm-px);
    border: 1px solid #ced4da;
    border-radius: var(--size-sm-radius);
    font-size: var(--size-sm-font);
    height: var(--size-sm-height);
    background-color: #fff;
    color: #495057;
    cursor: pointer;
    min-width: 110px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.inline-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.15);
}

.inline-select:disabled {
    background-color: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
    opacity: 0.7;
}

.inline-select:hover:not(:disabled) {
    border-color: #3498db;
}

#courseTypeSelect:disabled {
    background-color: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
    opacity: 0.7;
}

.product-row--incomplete {
    background-color: #fff8e1;
    cursor: pointer;
}

.product-row--incomplete:hover {
    background-color: #ffecb3;
}

.product-row--incomplete {
    background-color: #fff8e1;
    cursor: pointer;
}

.product-row--incomplete:hover {
    background-color: #ffecb3;
}