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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
}

.container {
    max-width: 1200px;
    width: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 24px 32px 40px;
    height: fit-content;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #e74c3c;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.header h1 {
    font-size: 24px;
    color: #2c3e50;
}

.header h1 span {
    color: #e74c3c;
}

.header .subtitle {
    color: #7f8c8d;
    font-size: 14px;
}

/* Menu */
.menu {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 0 4px;
}

.menu a {
    padding: 8px 18px;
    background: #ecf0f1;
    color: #2c3e50;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.menu a:hover {
    background: #d5dbdb;
    transform: translateY(-1px);
}

.menu a.active {
    background: #2c3e50;
    color: white;
}

/* Cards */
.card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 16px;
}

/* Forms */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 14px;
    align-items: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
    flex: 1 1 180px;
    min-width: 140px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #34495e;
    margin-bottom: 4px;
}

.form-group input,
.form-group select {
    padding: 8px 12px;
    border: 1px solid #d5dbdb;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s;
    width: 100%;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2c3e50;
}

.form-group .hint {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 2px;
}

.btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: #2c3e50;
    color: white;
}

.btn-primary:hover {
    background: #1a252f;
}

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

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

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

.btn-danger:hover {
    background: #c0392b;
}

.btn-outline {
    background: transparent;
    color: #2c3e50;
    border: 1px solid #bdc3c7;
}

.btn-outline:hover {
    background: #ecf0f1;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

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

table th {
    background: #2c3e50;
    color: white;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
}

table td {
    padding: 10px 14px;
    border-bottom: 1px solid #ecf0f1;
}

table tr:hover td {
    background: #f8f9fa;
}

/* Messages */
.message {
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-weight: 500;
    display: none;
}

.message.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.badge-kg {
    background: #3498db;
}

.badge-g {
    background: #1abc9c;
}

.badge-piece {
    background: #e67e22;
}

.badge-meter {
    background: #9b59b6;
}

.badge-weight {
    background: #2c3e50;
}

/* Stats row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px 20px;
    border-left: 4px solid #2c3e50;
}

.stat-card .number {
    font-size: 22px;
    font-weight: 700;
    color: #2c3e50;
}

.stat-card .label {
    font-size: 13px;
    color: #7f8c8d;
}

/* Ingredient rows (dynamic) */
.ingredient-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: white;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #ecf0f1;
}

.ingredient-row select,
.ingredient-row input {
    flex: 1 1 140px;
    min-width: 100px;
    padding: 6px 10px;
    border: 1px solid #d5dbdb;
    border-radius: 6px;
}

.ingredient-row .remove-btn {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
}

.ingredient-row .remove-btn:hover {
    color: #c0392b;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 16px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-group {
        flex: 1 1 100%;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* utility */
.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-16 {
    margin-bottom: 16px;
}

.flex {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.gap-8 {
    gap: 8px;
}