* { box-sizing: border-box; }
body {
    font-family: -apple-system, "Segoe UI", Arial, sans-serif;
    margin: 0; color: #1a1a1a; background: #fafafa;
}
nav {
    background: #1A3C34; padding: 14px 24px; display: flex; gap: 20px; align-items: center;
}
nav a { color: #fff; text-decoration: none; font-size: 0.95em; }
nav a.brand { font-weight: bold; font-size: 1.1em; margin-right: 20px; }
nav a:hover { text-decoration: underline; }
main { max-width: 1000px; margin: 0 auto; padding: 24px; }
h1 { margin-top: 0; }
.subtitle, .muted { color: #666; font-size: 0.9em; }
.empty { color: #888; font-style: italic; }

table { width: 100%; border-collapse: collapse; margin: 16px 0; background: #fff; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #e5e5e5; }
th { background: #f0f0f0; font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.5px; color: #555; }
tr.over-target { background: #fdecea; }
tfoot td { border-top: 2px solid #333; border-bottom: none; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.8em; margin-right: 4px; }
.badge-good { background: #d4edda; color: #155724; }
.badge-bad { background: #f8d7da; color: #721c24; }
.badge-neutral { background: #e2e3e5; color: #383d41; }
.badge-warn { background: #fff3cd; color: #856404; }

.button {
    display: inline-block; background: #1A3C34; color: #fff; padding: 10px 18px;
    border: none; border-radius: 6px; text-decoration: none; cursor: pointer; font-size: 0.95em; margin: 8px 0;
}
.button:hover { background: #14302a; }
.button-danger { background: #b02a37; }
.button-danger:hover { background: #8f232d; }
.link-danger { background: none; border: none; color: #b02a37; cursor: pointer; text-decoration: underline; padding: 0; }

.recipe-form label { display: block; margin-bottom: 14px; font-size: 0.9em; color: #333; }
.recipe-form input, .recipe-form select, .recipe-form textarea {
    display: block; width: 100%; margin-top: 4px; padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 1em;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }

.alert { padding: 12px 16px; border-radius: 6px; margin: 16px 0; }
.alert-warn { background: #fff3cd; color: #856404; }
.alert-error { background: #f8d7da; color: #721c24; }
.alert-good { background: #d4edda; color: #155724; }

.add-ingredient-box { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 16px; margin: 12px 0; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab-btn { padding: 8px 16px; border: 1px solid #ccc; background: #f0f0f0; cursor: pointer; border-radius: 4px; }
.tab-btn.active { background: #1A3C34; color: #fff; border-color: #1A3C34; }
.tab-panel label { display: block; margin-bottom: 10px; font-size: 0.9em; }
.tab-panel input, .tab-panel select { padding: 8px; border: 1px solid #ccc; border-radius: 4px; width: 100%; }

.search-results { max-height: 220px; overflow-y: auto; border: 1px solid #ddd; border-radius: 4px; margin-top: 4px; }
.result-row { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid #f0f0f0; }
.result-row:hover { background: #f0f7f5; }

.scale-box { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 16px; }
.scale-box label { display: block; margin-bottom: 10px; }
.scale-box input { width: 120px; padding: 6px; }

.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.filter-bar input[type="text"] { padding: 8px; border: 1px solid #ccc; border-radius: 4px; width: 240px; }
.filter-bar select { padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
th .sort-link { color: #333; text-decoration: none; }
th .sort-link:hover { text-decoration: underline; }
.dept-list { list-style: none; padding: 0; margin: 0 0 16px 0; }
.dept-list li { padding: 8px 12px; background: #f5f5f5; border-radius: 4px; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.dept-heading { margin-top: 28px; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 2px solid #1A3C34; color: #1A3C34; }
.dept-heading:first-of-type { margin-top: 12px; }
.price-alerts { background: #fff8f0; border: 1px solid #e8d5b8; border-radius: 8px; padding: 16px; margin-bottom: 20px; }
.price-alert-row { padding: 8px 0; border-bottom: 1px solid #f0e6d8; font-size: 0.92em; }
.price-alert-row:last-child { border-bottom: none; }

.review-layout { display: flex; gap: 20px; margin-top: 16px; align-items: flex-start; }
.review-file { flex: 0 0 45%; position: sticky; top: 16px; }
.review-file iframe { width: 100%; height: 85vh; border: 1px solid #ccc; border-radius: 6px; }
.review-items { flex: 1; min-width: 0; }
.review-row { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.review-row.unmatched { border-left: 4px solid #856404; }
.review-row-fields { display: grid; grid-template-columns: 1fr 2fr 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.review-row-fields label { font-size: 0.85em; color: #555; }
.review-row-fields input { display: block; width: 100%; padding: 6px; border: 1px solid #ccc; border-radius: 4px; margin-top: 2px; }
.match-box { margin: 10px 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; position: relative; }
.review-actions { display: flex; gap: 12px; margin: 24px 0; }

@media (max-width: 900px) {
    .review-layout { flex-direction: column; }
    .review-file { position: static; flex: 1 1 auto; }
    .review-file iframe { height: 50vh; }
}

.login-main { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-box { background: #fff; padding: 32px; border-radius: 10px; box-shadow: 0 2px 12px rgba(0,0,0,0.1); max-width: 380px; width: 100%; }
.login-box h1 { font-size: 1.3em; margin-top: 0; }
.login-box label { display: block; margin-bottom: 14px; font-size: 0.9em; }
.login-box input { display: block; width: 100%; margin-top: 4px; padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 1.1em; letter-spacing: 1px; }
.login-box .button { width: 100%; text-align: center; padding: 12px; font-size: 1em; }
.qr-code { display: block; margin: 16px auto; width: 220px; height: 220px; }
.logout-link { margin-left: auto; }
.logout-link .link-danger { color: #ffb3ba; text-decoration: none; font-size: 0.95em; }
.logout-link .link-danger:hover { text-decoration: underline; }
