:root{--bg: #f2f2f7;--card: #ffffff;--text: #1c1c1e;--text-sub: #6e6e73;--green: #34c759;--green-dk: #248a3d;--red: #ff3b30;--border: #e5e5ea;--tab-h: 56px;--safe-bot: env(safe-area-inset-bottom, 0px)}*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,system-ui,sans-serif;font-size:16px;background:var(--bg);color:var(--text);min-height:100dvh;overflow-x:hidden}#app{display:flex;flex-direction:column;min-height:100dvh;max-width:480px;margin:0 auto}.user-switcher{display:flex;gap:.5rem;padding:.75rem 1rem .5rem;background:var(--card);border-bottom:1px solid var(--border)}.user-chip{padding:.4rem 1rem;border-radius:999px;border:1.5px solid var(--border);background:transparent;color:var(--text);font-size:.9rem;cursor:pointer;min-height:44px;display:flex;align-items:center}.user-chip.active{background:var(--green);border-color:var(--green);color:#fff;font-weight:600}.screen{display:none;flex:1;overflow-y:auto;padding-bottom:calc(var(--tab-h) + var(--safe-bot) + 1rem)}.screen.active{display:flex;flex-direction:column}.screen-content{padding:1rem;display:flex;flex-direction:column;gap:1rem}.card{background:var(--card);border-radius:12px;padding:1rem;display:flex;flex-direction:column;gap:.75rem}.card h2{font-size:1.1rem}.card h3{font-size:.95rem;color:var(--text-sub);display:flex;justify-content:space-between;align-items:baseline}.since{font-size:.8rem}.profile-row{display:flex;justify-content:space-between;font-size:.9rem;padding:.3rem 0;border-bottom:1px solid var(--border)}.profile-row:last-child{border-bottom:none}.profile-row span:first-child{color:var(--text-sub)}.body-log-add{display:flex;gap:.5rem;align-items:center}.body-log-add input{flex:1;padding:.5rem .75rem;border:1.5px solid var(--border);border-radius:8px;font-size:1rem;background:var(--bg);color:var(--text);min-height:44px}.body-log-list{display:flex;flex-direction:column;gap:.25rem}.body-log-row{display:flex;justify-content:space-between;align-items:center;padding:.4rem 0;border-bottom:1px solid var(--border);font-size:.9rem}.body-log-row:last-child{border-bottom:none}.btn-primary{background:var(--green);color:#fff;border:none;border-radius:8px;padding:.5rem 1rem;font-size:.95rem;font-weight:600;cursor:pointer;min-height:44px}.btn-primary:active{background:var(--green-dk)}.btn-secondary{background:transparent;color:var(--green-dk);border:1.5px solid var(--green);border-radius:8px;padding:.5rem 1rem;font-size:.9rem;cursor:pointer;min-height:44px}.btn-delete{background:none;border:none;color:var(--red);font-size:1.2rem;cursor:pointer;padding:0 .5rem;min-height:44px;min-width:44px;display:flex;align-items:center;justify-content:center}.empty-state{color:var(--text-sub);font-size:.9rem;padding:1rem 0}.lib-header{display:flex;align-items:center;justify-content:space-between;padding:1rem 1rem 0;gap:.5rem}.lib-segment{display:flex;border:1.5px solid var(--border);border-radius:8px;overflow:hidden}.lib-seg-btn{flex:1;padding:.5rem 1rem;border:none;background:transparent;cursor:pointer;font-size:.9rem;min-height:44px;color:var(--text)}.lib-seg-btn.active{background:var(--green);color:#fff;font-weight:600}.lib-add-btn{flex-shrink:0}.lib-search-wrap{padding:.75rem 1rem 0}.lib-search{width:100%;padding:.5rem .75rem;border:1.5px solid var(--border);border-radius:8px;font-size:1rem;background:var(--bg);color:var(--text);min-height:44px}.lib-list{padding:0 1rem;display:flex;flex-direction:column;margin-top:.75rem}.food-row{border-bottom:1px solid var(--border)}.food-row:last-child{border-bottom:none}.food-row-main{display:flex;justify-content:space-between;align-items:center;padding:.65rem 0;cursor:pointer;min-height:52px;gap:.5rem}.food-row-info{flex:1;min-width:0}.food-row-name{font-size:.95rem;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.food-row-meta{font-size:.8rem;color:var(--text-sub);margin-top:2px}.food-row.archived .food-row-name{color:var(--text-sub)}.food-row-actions{display:flex;gap:.25rem;flex-shrink:0}.food-row-detail{padding:.25rem 0 .75rem;display:flex;flex-direction:column;gap:.75rem}.detail-qty-wrap{background:var(--bg);border-radius:8px;padding:.75rem}.btn-sm{padding:.3rem .75rem;font-size:.85rem;min-height:36px}.lib-arch-toggle{width:100%;padding:1rem 0 .5rem;background:none;border:none;color:var(--text-sub);font-size:.85rem;cursor:pointer;text-align:center}.qty-control{display:flex;flex-direction:column;gap:.5rem}.qty-row{display:flex;align-items:center;gap:.5rem}.qty-slider{flex:1;height:4px;accent-color:var(--green);cursor:pointer}.qty-number{width:64px;padding:.3rem .4rem;border:1.5px solid var(--border);border-radius:6px;font-size:.95rem;text-align:center;background:var(--card);color:var(--text);min-height:36px}.qty-number-piece{width:52px}.qty-unit{font-size:.85rem;color:var(--text-sub);min-width:28px}.qty-chips{display:flex;flex-wrap:wrap;gap:.4rem}.qty-chip{padding:.3rem .6rem;border:1.5px solid var(--border);border-radius:999px;font-size:.8rem;background:transparent;cursor:pointer;color:var(--text);min-height:36px}.qty-chip.active{background:var(--green);border-color:var(--green);color:#fff}.qty-stepper-row{justify-content:flex-start;gap:.75rem}.qty-step-btn{width:40px;height:40px;border-radius:50%;border:1.5px solid var(--green);background:transparent;color:var(--green-dk);font-size:1.3rem;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}.qty-unit-toggle{background:none;border:none;color:var(--green-dk);font-size:.8rem;cursor:pointer;padding:0;text-decoration:underline;text-align:left}.qty-macros{display:flex;gap:.75rem;font-size:.85rem;color:var(--text-sub);flex-wrap:wrap}.qty-macros span{white-space:nowrap}.food-form{display:flex;flex-direction:column}.form-header{display:flex;align-items:center;gap:.75rem;padding:.5rem 1rem;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--bg);z-index:10}.btn-back{background:none;border:none;color:var(--green-dk);font-size:.95rem;cursor:pointer;padding:.25rem 0;min-height:44px}.form-header h2{font-size:1rem;font-weight:600}.food-form-body{display:flex;flex-direction:column;gap:.75rem;padding:1rem 1rem 2rem}.form-field{display:flex;flex-direction:column;gap:.3rem}.form-field label{font-size:.85rem;color:var(--text-sub);font-weight:500}.form-input,.form-select{padding:.5rem .75rem;border:1.5px solid var(--border);border-radius:8px;font-size:1rem;background:var(--card);color:var(--text);min-height:44px;width:100%}.form-hint{font-size:.75rem;color:var(--text-sub)}.btn-save-food{margin-top:.5rem;width:100%}.macro-warning{background:#fff3cd;border:1px solid #ffc107;border-radius:8px;padding:.65rem .75rem;font-size:.85rem;color:#856404;line-height:1.4}.macro-warning.hidden{display:none}.stub-screen{display:flex;flex-direction:column;align-items:center;justify-content:center;height:60vh;gap:.5rem}.stub-screen h2{color:var(--text-sub)}.stub-screen p{font-size:.85rem;color:var(--text-sub)}#tab-bar{position:fixed;bottom:0;left:50%;transform:translate(-50%);width:100%;max-width:480px;height:calc(var(--tab-h) + var(--safe-bot));padding-bottom:var(--safe-bot);background:var(--card);border-top:1px solid var(--border);display:flex;z-index:100}.tab{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;border:none;background:transparent;color:var(--text-sub);font-size:.7rem;cursor:pointer;min-height:var(--tab-h)}.tab.active{color:var(--green-dk);font-weight:600}.tab-icon{font-size:1.3rem}#undo-banner{position:fixed;bottom:calc(var(--tab-h) + var(--safe-bot) + .5rem);left:50%;transform:translate(-50%);background:#333;color:#fff;border-radius:10px;padding:.65rem 1rem;display:flex;align-items:center;gap:1rem;z-index:200;font-size:.9rem;min-width:min(320px,90vw);box-shadow:0 4px 16px #0003}#undo-banner.hidden{display:none}.undo-btn{background:none;border:none;color:var(--green);font-weight:700;font-size:.9rem;cursor:pointer;padding:.25rem 0;min-height:44px}
