:root{
  --bg:#f5f5f2;
  --card:#ffffff;
  --teal:#0f6e57;       /* 0.06,0.43,0.34 */
  --green:#1c9e75;      /* 0.11,0.62,0.46 */
  --cyan:#40a0a1;       /* 0.25,0.62,0.63 */
  --ink:#1a1a1a;
  --muted:#8c8c8c;
  --line:#dcdcd9;
  --chip:#eeede9;
  --danger:#cc3838;
  --radius:14px;
  --maxw:560px;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0}
body{
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  background:var(--bg);color:var(--ink);
  font-size:15px;line-height:1.4;
  padding-bottom:env(safe-area-inset-bottom);
}
.app{max-width:var(--maxw);margin:0 auto;padding:16px;min-height:100vh}
button{font-family:inherit;cursor:pointer;border:none;border-radius:10px;font-size:14px}
input,textarea,select{font-family:inherit;font-size:15px}
.hidden{display:none !important}
.section-label{font-size:11px;font-weight:700;letter-spacing:.04em;color:var(--muted);margin:14px 0 6px}
.section-label.teal{color:var(--teal)}

/* Header */
header{display:flex;align-items:center;gap:10px;height:48px;margin-bottom:10px}
header img.logo{width:28px;height:28px}
header h1{font-size:22px;margin:0;flex:1;font-weight:700;color:#262626}
.icon-btn{width:44px;height:44px;background:transparent;display:flex;align-items:center;justify-content:center;border-radius:12px}
.icon-btn img{width:26px;height:26px}

/* Search */
.search-field{background:var(--card);border-radius:10px;padding:0 14px;height:46px;display:flex;align-items:center;box-shadow:0 1px 2px rgba(0,0,0,.04)}
.search-field input{border:none;outline:none;background:transparent;width:100%;height:100%;color:var(--ink)}
.search-row{display:flex;gap:8px;margin-top:10px}
.tabs{flex:.55;background:var(--card);border-radius:10px;display:flex;overflow:hidden}
.tabs button{flex:1;background:transparent;color:var(--muted);font-weight:700;font-size:13px;height:42px;border-radius:0;border-bottom:2.5px solid transparent}
.tabs button.active{color:var(--teal);border-bottom-color:var(--teal)}
.btn-primary{background:var(--green);color:#fff;font-weight:700;height:42px;flex:.45;border-radius:10px}
.btn-primary:active{filter:brightness(.93)}

/* Filter chips bar */
.filter-bar{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px;min-height:0}
.chip{background:var(--chip);color:#4d4d4d;font-size:13px;font-weight:600;height:34px;padding:0 14px;border-radius:17px;display:inline-flex;align-items:center;gap:4px;border:none}
.chip.active{background:var(--teal);color:#fff}
.chip.preset{background:#e0f3ec;color:var(--teal)}
.chip-reset{background:transparent;color:var(--danger);font-size:12px;height:34px;padding:0 8px}

.divider{height:1px;background:var(--line);margin:12px 0}
.stats{text-align:center;font-size:12px;color:var(--muted);margin:6px 0}

/* Recipe-idea card */
.rotd{background:var(--card);border-radius:var(--radius);padding:14px;margin-top:6px;box-shadow:0 1px 3px rgba(0,0,0,.05)}
.rotd .r-title{font-size:16px;font-weight:700;color:var(--ink);background:transparent;text-align:left;padding:0;cursor:pointer}
.rotd .r-meta{font-size:11px;color:var(--muted);margin:4px 0}
.rotd .r-ing{font-size:12px;color:#4d4d4d;margin:4px 0 10px;min-height:18px}
.rotd .r-actions{display:flex;gap:8px}
.rotd .r-actions button{flex:1;height:36px;font-size:13px;font-weight:700;display:flex;align-items:center;justify-content:center;gap:6px}
.btn-teal{background:var(--teal);color:#fff}
.btn-green{background:var(--green);color:#fff}
.btn-teal img{width:18px;height:18px}

/* Bottom action buttons */
.bottom-actions{display:flex;gap:8px;margin-top:14px}
.bottom-actions button{flex:1;height:50px;font-size:14px;font-weight:700;display:flex;align-items:center;justify-content:center;gap:6px;border-radius:12px}
.btn-soft-teal{background:rgba(15,110,87,.12);color:var(--teal)}
.btn-soft-cyan{background:rgba(64,160,161,.12);color:var(--cyan)}
.btn-soft-teal img{width:20px;height:20px}

/* Search results dropdown */
.results{margin-top:8px;background:var(--card);border-radius:10px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,.08)}
.results button{display:block;width:100%;text-align:left;background:transparent;color:var(--ink);padding:14px 16px;border-radius:0;border-bottom:1px solid var(--line);font-size:15px}
.results button:last-child{border-bottom:none}
.results .empty{padding:14px 16px;color:var(--muted);font-size:14px}

/* Modal / overlay */
.overlay{position:fixed;inset:0;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center;z-index:50;padding:14px}
.overlay.full{padding:0;align-items:stretch}
.sheet{background:var(--bg);border-radius:16px;width:100%;max-width:var(--maxw);max-height:94vh;display:flex;flex-direction:column;overflow:hidden}
.overlay.full .sheet{border-radius:0;max-height:100vh;height:100vh}
.sheet-body{overflow-y:auto;padding:16px;-webkit-overflow-scrolling:touch}
.sheet-head{display:flex;align-items:center;gap:8px;padding:14px 16px 0}
.sheet-head h2{font-size:18px;margin:0;flex:1;font-weight:700}
.sheet-foot{padding:10px 16px calc(12px + env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:8px;border-top:1px solid var(--line);background:var(--bg)}
.btn-close{background:var(--chip);color:#4d4d4d;font-weight:700;height:50px;border-radius:10px}
.btn-block{height:50px;font-weight:700;border-radius:10px;font-size:15px}

/* Loading */
.spinner{position:fixed;inset:0;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center;color:#fff;font-size:18px;z-index:100}
.spin{width:34px;height:34px;border:3px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:rot .8s linear infinite;margin-right:12px}
@keyframes rot{to{transform:rotate(360deg)}}

/* Toast */
.toast{position:fixed;left:50%;bottom:30px;transform:translateX(-50%);background:#262626;color:#fff;padding:12px 18px;border-radius:10px;font-size:14px;z-index:200;max-width:90%;text-align:center;box-shadow:0 4px 14px rgba(0,0,0,.3)}

/* Detail view */
.detail-head{display:flex;align-items:center;gap:8px;margin-bottom:6px}
.detail-head h2{font-size:20px;margin:0;flex:1;font-weight:700}
.btn-edit{background:var(--green);color:#fff;font-weight:700;font-size:12px;padding:8px 12px;border-radius:8px}
.btn-del{background:#cc2e2e;color:#fff;font-weight:700;font-size:12px;padding:8px 12px;border-radius:8px}
.chips-row{display:flex;gap:6px;margin:4px 0}
.chips-row .col{flex:1;display:flex;flex-direction:column;gap:2px}
.chips-row .col .lbl{font-size:9px;font-weight:700;color:var(--muted)}
.chips-row .col .val{background:var(--card);border-radius:14px;padding:8px;font-size:11px;color:#595959;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cat-tags{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}
.cat-tag{background:rgba(15,110,87,.12);color:var(--teal);font-size:11px;font-weight:700;padding:4px 10px;border-radius:13px}
.nav-box{display:flex;flex-direction:column;gap:5px;margin:8px 0}
.nav-box .back{background:var(--chip);color:#404040;height:34px;font-size:12px;border-radius:8px}
.nav-row{display:flex;gap:8px;align-items:center}
.nav-row button{flex:.4;background:var(--teal);color:#fff;font-weight:700;height:36px;font-size:12px;border-radius:8px}
.nav-row button:disabled{opacity:.4}
.nav-row .pos{flex:.2;text-align:center;font-size:12px;color:var(--muted)}
.panel{background:var(--card);border-radius:12px;padding:12px;margin-bottom:6px}
.ing-table{width:100%;border-collapse:collapse}
.ing-table td{padding:6px 4px;font-size:14px;vertical-align:top;border-bottom:1px solid #f0f0ee}
.ing-table td.amt{width:34%;color:var(--teal);font-weight:600;white-space:pre-line}
.ing-table tr:last-child td{border-bottom:none}
.steps{counter-reset:step;margin:0;padding:0;list-style:none}
.steps li{position:relative;padding:6px 0 10px 30px;font-size:14px;white-space:pre-wrap}
.steps li::before{counter-increment:step;content:counter(step) ".";position:absolute;left:0;top:6px;color:var(--teal);font-weight:700}

/* Comments */
.comment{background:var(--card);border-radius:10px;padding:8px 10px;margin-bottom:8px}
.comment .meta{font-size:11px;font-weight:700;color:var(--teal);display:flex;justify-content:space-between;align-items:center}
.comment .meta .del{background:#d94d4d;color:#fff;font-size:10px;padding:3px 8px;border-radius:6px}
.comment .body{font-size:13px;color:#262626;margin-top:2px;white-space:pre-wrap}
.comment-input textarea{width:100%;height:70px;border:1px solid var(--line);border-radius:8px;padding:10px;resize:vertical;background:#fff}
.comment-hint{font-size:12px;color:var(--muted);margin-top:6px}

/* Forms (login / create) */
.input-row{display:flex;align-items:center;gap:10px;background:var(--card);border-radius:10px;padding:0 12px;height:48px;margin-bottom:8px}
.input-row img{width:24px;height:24px}
.input-row input{border:none;outline:none;background:transparent;flex:1;height:100%}
.field-label{font-size:9px;font-weight:700;color:var(--muted);margin:8px 0 2px}
.txt{width:100%;border:1px solid var(--line);border-radius:8px;padding:10px;background:#fdfdfc}
textarea.txt{resize:vertical}
.err{color:var(--danger);font-size:12px;min-height:16px;margin:2px 0}
.muted-note{font-size:11px;color:var(--muted);margin-bottom:6px}

/* Multi-select list */
.ms-list{flex:1;overflow-y:auto}
.ms-item{display:flex;align-items:center;gap:10px;padding:12px 6px;border-bottom:1px solid var(--line);font-size:15px}
.ms-item input{width:20px;height:20px;accent-color:var(--teal)}
.ms-item.disabled{opacity:.4}

/* Browse list */
.browse-list button{display:block;width:100%;text-align:left;background:var(--card);color:var(--ink);padding:14px 12px;border-radius:0;border-bottom:1px solid var(--line);font-size:14px}

/* Ingredient/step editor rows */
.ed-ing{display:flex;gap:6px;margin-bottom:6px;align-items:center}
.ed-ing input.amt{width:22%}
.ed-ing select.unit{width:26%}
.ed-ing input.name{flex:1}
.ed-ing .rm{background:var(--chip);color:var(--danger);width:34px;height:38px;border-radius:8px;font-size:18px;flex:none}
.ed-step{display:flex;gap:6px;margin-bottom:6px}
.ed-step .num{color:var(--teal);font-weight:700;padding-top:8px;width:18px}
.ed-step textarea{flex:1;height:60px}
.add-line{background:transparent;color:var(--teal);font-weight:600;height:40px;width:100%;text-align:left}
.editor-tabs{display:flex;background:var(--card);border-radius:12px 12px 0 0;overflow:hidden}
.editor-tabs button{flex:1;background:transparent;color:var(--muted);font-weight:700;height:36px;border-radius:0;border-bottom:2.5px solid transparent}
.editor-tabs button.active{color:var(--teal);border-bottom-color:var(--teal)}
.editor-panel{background:var(--card);border-radius:0 0 12px 12px;padding:10px}

/* install hint */
.install-bar{position:fixed;left:0;right:0;bottom:0;background:var(--teal);color:#fff;padding:12px 16px;display:flex;align-items:center;gap:12px;z-index:60}
.install-bar button{background:#fff;color:var(--teal);font-weight:700;padding:8px 14px;border-radius:8px}
.install-bar .x{background:transparent;color:#fff;font-size:20px;padding:4px 8px}
