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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    color: #1a1a1a;
    background: #f5f5f0;
    line-height: 1.5;
}

.container {
    max-width: 100%;
    padding: 1.5rem 2rem;
}

.container-narrow {
    max-width: 680px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.header h1 {
    font-size: 22px;
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #d0d0c8;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    text-decoration: none;
    transition: background 0.1s;
}

.btn:hover { background: #f0f0ea; }

.btn-primary {
    background: #1D9E75;
    border-color: #1D9E75;
    color: #fff;
}
.btn-primary:hover { background: #0F6E56; border-color: #0F6E56; }

.btn-secondary { background: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: #f0f0ea; }

.btn-danger { background: #fff; color: #A32D2D; border-color: #f09595; }
.btn-danger:hover { background: #FCEBEB; }

.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 1.2rem;
}

.stat-card {
    background: #fff;
    border: 1px solid #e8e8e0;
    border-radius: 8px;
    padding: 12px 16px;
}

.stat-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 500;
}

.stat-value.warning { color: #854F0B; }
.stat-value.danger  { color: #A32D2D; }

/* Alerts */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #EAF3DE;
    border: 1px solid #C0DD97;
    color: #3B6D11;
}

.alert-warning {
    background: #FAEEDA;
    border: 1px solid #FAC775;
    color: #854F0B;
}

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
}

/* Inputs */
.input {
    height: 36px;
    padding: 0 10px;
    border: 1px solid #d0d0c8;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    color: #1a1a1a;
    outline: none;
}

.input:focus { border-color: #1D9E75; box-shadow: 0 0 0 2px rgba(29,158,117,0.15); }

.filter-bar .input { flex: 1; min-width: 140px; }
.select { cursor: pointer; }

/* Table */
.table-wrap {
    background: #fff;
    border: 1px solid #e8e8e0;
    border-radius: 12px;
    overflow: hidden;
}

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

th {
    background: #f5f5f0;
    font-weight: 500;
    font-size: 12px;
    color: #888;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid #e8e8e0;
}

td {
    padding: 10px 14px;
    border-bottom: 1px solid #e8e8e0;
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafaf7; }

tr.row-warning td { background: #fffbf5; }
tr.row-danger  td { background: #fff8f8; }

.col-name { font-weight: 500; max-width: 200px; }
.actions  { white-space: nowrap; }
.muted    { color: #aaa; }

/* Quantity control */
.qty-ctrl {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-ctrl form { display: flex; }

.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid #d0d0c8;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1a1a;
}

.qty-btn:hover { background: #f0f0ea; }
.qty-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.qty-num {
    min-width: 30px;
    text-align: center;
    font-weight: 500;
}

.qty-num.warning { color: #854F0B; }
.qty-num.danger  { color: #A32D2D; }

/* Badges */
.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 20px;
    background: #f0f0ea;
    color: #5F5E5A;
}

.badge-danger  { background: #FCEBEB; color: #A32D2D; }
.badge-warning { background: #FAEEDA; color: #854F0B; }

.badge-dairy-alternatives { background: #E1F5EE; color: #0F6E56; }
.badge-protein             { background: #EEEDFE; color: #534AB7; }
.badge-grains-&-pasta      { background: #FAEEDA; color: #854F0B; }
.badge-snacks              { background: #FBEAF0; color: #993556; }
.badge-condiments          { background: #FAECE7; color: #993C1D; }
.badge-beverages           { background: #E6F1FB; color: #185FA5; }
.badge-frozen              { background: #E6F1FB; color: #185FA5; }
.badge-fresh-produce       { background: #EAF3DE; color: #3B6D11; }
.badge-other               { background: #F1EFE8; color: #5F5E5A; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #888;
    font-size: 14px;
}

.empty-state a { color: #1D9E75; text-decoration: none; }

/* Form card */
.card {
    background: #fff;
    border: 1px solid #e8e8e0;
    border-radius: 12px;
    padding: 1.5rem;
}

.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 4px;
    font-weight: 500;
}

.field .input { width: 100%; }

.field-error {
    display: block;
    color: #A32D2D;
    font-size: 12px;
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e8e8e0;
}

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    th, td { padding: 8px 10px; font-size: 13px; }
}

/* Language switcher */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-switcher {
    display: flex;
    border: 1px solid #d0d0c8;
    border-radius: 8px;
    overflow: hidden;
}

.lang-btn {
    padding: 0 12px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    color: #888;
    text-decoration: none;
    background: #fff;
    transition: background 0.1s, color 0.1s;
    border-right: 1px solid #d0d0c8;
}

.lang-btn:last-child { border-right: none; }
.lang-btn:hover { background: #f0f0ea; color: #1a1a1a; }
.lang-btn.active { background: #1D9E75; color: #fff; }

/* Login page */
.login-body {
    background: #f5f5f0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-wrap {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-header h1 {
    font-size: 26px;
    font-weight: 500;
    margin-bottom: 4px;
}

.login-tagline {
    font-size: 14px;
    color: #888;
}

.login-card {
    padding: 1.75rem;
}

.login-lang {
    justify-content: flex-end;
    margin-bottom: 1.2rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
}

/* Alert additions */
.alert-danger {
    background: #FCEBEB;
    border: 1px solid #f09595;
    color: #A32D2D;
}

/* Form section titles */
.form-section-title {
    font-size: 12px;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 1.25rem 0 0.75rem;
    padding-bottom: 6px;
    border-bottom: 0.5px solid #e8e8e0;
}

.form-section-title:first-child {
    margin-top: 0;
}

/* Role checkboxes */
.roles-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.role-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid #d0d0c8;
    border-radius: 8px;
    background: #fff;
    transition: background 0.1s, border-color 0.1s;
}

.role-checkbox:hover {
    background: #f5f5f0;
    border-color: #1D9E75;
}

.role-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #1D9E75;
    cursor: pointer;
}

/* Role badge in users table */
.badge-role {
    background: #EEEDFE;
    color: #534AB7;
    margin-right: 4px;
}

/* Field hint */
.field-hint {
    font-size: 12px;
    color: #aaa;
    font-weight: 400;
    margin-left: 4px;
}

/* Badge additions */
.badge-blue   { background: #E6F1FB; color: #185FA5; }
.badge-amber  { background: #FAEEDA; color: #854F0B; }

/* Alert danger (form errors) */
.alert-danger {
    background: #FCEBEB;
    border: 1px solid #f09595;
    color: #A32D2D;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 1rem;
}

/* Nav overflow on smaller screens */
.header-actions {
    flex-wrap: wrap;
    gap: 6px;
}

/* Items table inside forms */
.items-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 1rem; }
.items-table th, .items-table td { padding: 8px 10px; border-bottom: 1px solid #e8e8e0; text-align: left; }
.items-table th { font-size: 12px; color: #888; font-weight: 500; background: #f8f8f5; }
.remove-row { background: none; border: none; color: #A32D2D; cursor: pointer; font-size: 18px; padding: 0 4px; line-height: 1; }

/* Textarea input */
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }

/* File input */
input[type="file"].input { height: auto; padding: 6px 10px; cursor: pointer; }

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    gap: 0;
    background: #fff;
    border-bottom: 0.5px solid #e8e8e0;
    padding: 0 1.5rem;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.navbar-brand a {
    font-size: 16px;
    font-weight: 500;
    color: #1D9E75;
    text-decoration: none;
    margin-right: 1.5rem;
    white-space: nowrap;
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.nav-link {
    font-size: 13px;
    font-weight: 400;
    color: #555;
    text-decoration: none;
    padding: 0 12px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    border-bottom: 2px solid transparent;
    transition: color 0.1s, border-color 0.1s;
}

.nav-link:hover { color: #1a1a1a; }
.nav-link.active { color: #1D9E75; border-bottom-color: #1D9E75; font-weight: 500; }

.navbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

/* User info in navbar */
.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #555;
    padding: 0 8px;
    border-left: 0.5px solid #e8e8e0;
    height: 52px;
}

.user-name {
    font-weight: 500;
    color: #1a1a1a;
    white-space: nowrap;
}

/* Page title row (replaces old .header) */
.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1.5rem 0 1.2rem;
    gap: 1rem;
}

.page-title h1 {
    font-size: 20px;
    font-weight: 500;
}

/* Adjust container top padding since navbar is sticky */
.container { padding-top: 1.5rem; }
