* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       background:#f1f5f9; color:#0f172a; line-height:1.5; padding:2rem; }
header { text-align:center; margin-bottom:2rem; }
header h1 { font-size:2rem; } header p { color:#475569; }
main { display:grid; grid-template-columns:1.6fr 1fr; gap:1.5rem; max-width:1350px; margin:0 auto; }
#ingredients-col { display:flex; flex-direction:column; gap:1rem; }
.category, aside { background:#fff; border-radius:12px; padding:1.25rem; box-shadow:0 2px 8px rgba(15,23,42,.06); }
.category h2 { font-size:1.1rem; margin-bottom:.75rem; display:flex; align-items:center; gap:.6rem; flex-wrap:wrap; }
.hint { font-size:.85rem; color:#64748b; margin-bottom:.75rem; }

.group-limit {
    display: inline-block; font-size: .72rem; font-weight: 500; color: #475569;
    background: #f1f5f9; border: 1px solid #e2e8f0; padding: .18rem .55rem;
    border-radius: 999px; white-space: nowrap;
}
.group-limit.ok     { background: #ecfdf5; border-color: #0f766e55; color: #0f766e; }
.group-limit.warn   { background: #fffbeb; border-color: #f59e0b55; color: #b45309; }
.group-limit.over   { background: #fef2f2; border-color: #dc262655; color: #b91c1c; }

.size-box { border: 2px solid #0f766e33; background: #f0fdfa; }
.size-box h2 { color:#0f766e; }

.size-bar {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed #0f766e33;
    gap: .8rem; flex-wrap: wrap; font-size: .9rem; color: #0f766e;
}
.norm-btn {
    background: #0f766e; color: #fff; border: none;
    padding: .55rem 1.1rem; border-radius: 8px; cursor: pointer;
    font-size: .9rem; font-weight: 600;
}
.norm-btn:hover { filter: brightness(.92); }
.norm-btn:active { transform: scale(.97); }

.items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
    gap: .4rem;
}
.item {
    display: grid;
    grid-template-columns: 20px 1fr 70px 80px;
    align-items: center; gap: .45rem;
    padding: .45rem .65rem;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
    transition: background .12s, border-color .12s;
    user-select: none;
}
.item:hover { background: #f1f5f9; border-color: #cbd5e1; }
.item.checked { background: #ecfdf5; border-color: #0f766e; }
.item.limit-flash { animation: flashLimit .5s ease; }
@keyframes flashLimit { 0% { background: #fee2e2; border-color: #dc2626; } 100% { background: #ecfdf5; border-color: #0f766e; } }
.item.autofill-flash { animation: flashAutoFill .7s ease; }
@keyframes flashAutoFill { 0% { background: #dbeafe; border-color: #3b82f6; box-shadow: 0 0 0 3px #bfdbfe; } 100% { background: #ecfdf5; border-color: #0f766e; box-shadow: none; } }
.item .cb { width: 18px; height: 18px; cursor: pointer; accent-color: #0f766e; }
.item .item-name { font-size: .85rem; line-height: 1.25; cursor: pointer;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item.checked .item-name { font-weight: 600; color: #0f766e; }
.item .pct, .item .grams {
    width: 100%; padding: .3rem .4rem;
    border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: .8rem; text-align: right; background: #fff;
}
.item .pct:disabled, .item .grams:disabled { opacity: .35; background: #f1f5f9; cursor: not-allowed; }
.item .pct:focus, .item .grams:focus { outline: 2px solid #0f766e; }
.item .pct::placeholder, .item .grams::placeholder { color: #94a3b8; font-size: .7rem; }
.item .pct.autofilled, .item .grams.autofilled { background: #eff6ff; border-color: #93c5fd; }

#size-items { display: flex; flex-direction: column; gap: .4rem; }
.size-item {
    display: flex; align-items: center; gap: .55rem;
    padding: .55rem .7rem; background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 8px; cursor: pointer; user-select: none;
    width: fit-content; min-width: 260px;
}
.size-item:hover { background: #f1f5f9; border-color: #cbd5e1; }
.size-item input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: #0f766e; }
.size-item .item-name { font-size: .92rem; }

aside { position:sticky; top:1rem; height:fit-content; }
aside h2 { margin-bottom:1rem; }
.result-grid { display:flex; flex-direction:column; gap:.5rem; }
.result-grid div { display:flex; justify-content:space-between; font-size:.93rem; }
.result-grid hr { border:none; border-top:1px solid #e2e8f0; margin:.35rem 0; }
.price-total { font-size:1.1rem; color:#0f766e; margin-top:.5rem; }
#breakdown { margin-top:1rem; font-size:.85rem; color:#475569; }
#breakdown h3 { font-size:.95rem; margin-bottom:.35rem; color:#0f172a; }
#breakdown table { width:100%; border-collapse:collapse; }
#breakdown td { padding:.2rem 0; border-bottom:1px dashed #e2e8f0; }
#breakdown td:last-child { text-align:right; }
#debug {
    margin-top:.75rem; padding:.4rem .5rem;
    font-family: ui-monospace, Consolas, monospace;
    font-size: .7rem; color:#94a3b8;
    background:#f8fafc; border:1px solid #e2e8f0; border-radius:6px;
    white-space: pre-wrap; word-break: break-word;
}
footer { text-align:center; margin-top:2rem; }
footer a { color:#64748b; text-decoration:none; } footer a:hover { text-decoration:underline; }
@media (max-width:900px) { main { grid-template-columns:1fr; } aside { position:static; } }