:root{
  --bg:#F3F6EF; --surface:#FFFFFF; --ink:#1E2A1D; --muted:#5C6B58; --line:#D9E1D2;
  --herb:#2F6B3A; --herb-ink:#FFFFFF; --herb-soft:#E1EDDD;
  --saffron:#E3A21A; --saffron-soft:#FBEFD2; --danger:#B3402E;
  --shadow:0 10px 30px -18px rgba(30,60,30,.45);
  --display:"Bricolage Grotesque","Nunito Sans",system-ui,sans-serif;
  --body:"Nunito Sans",system-ui,-apple-system,"Segoe UI",sans-serif;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){
  :root{
    color-scheme:dark;
    --bg:#121712; --surface:#1B221B; --ink:#E8EEE3; --muted:#9CAA96; --line:#2E382D;
    --herb:#7FBF83; --herb-ink:#0F1A10; --herb-soft:#223323;
    --saffron:#F0B940; --saffron-soft:#3A2F14; --danger:#E77D6B;
    --shadow:0 10px 30px -18px rgba(0,0,0,.8);
  }
}
html[lang="ar"]{ --display:"Tajawal",system-ui,sans-serif; --body:"Tajawal",system-ui,sans-serif; }

*{box-sizing:border-box}
html,body{margin:0}
body{background:var(--bg);color:var(--ink);font-family:var(--body);font-size:18px;line-height:1.5;-webkit-text-size-adjust:100%}
h1,h2,.dish-name,.site-name{font-family:var(--display);text-wrap:balance;margin:0}
h1{font-size:1.7rem;font-weight:800;line-height:1.15}
h2{font-size:1.25rem;font-weight:800}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
a{color:var(--herb)}
:focus-visible{outline:3px solid var(--saffron);outline-offset:2px}
[hidden]{display:none!important}

/* header */
.top{position:sticky;top:0;z-index:5;background:var(--bg);border-bottom:1px solid var(--line);padding-top:env(safe-area-inset-top,0px)}
.top-inner{max-width:760px;margin:0 auto;padding:12px 16px 6px;display:flex;justify-content:space-between;align-items:center;gap:12px}
.brand{display:flex;align-items:center;gap:10px;min-width:0}
.logo{width:36px;height:36px;border-radius:50%;background:var(--herb);box-shadow:inset 0 0 0 8px var(--herb),inset 0 0 0 20px var(--bg);flex:none}
.site-name{font-size:1.3rem;font-weight:800;line-height:1.1}
.date{font-size:.78rem;color:var(--muted);font-weight:700;letter-spacing:.04em}
.top-tools{display:flex;gap:6px;align-items:center;flex:none}
.who,.lang{border:2px solid var(--line);background:var(--surface);border-radius:999px;padding:6px 12px;font-size:.85rem;font-weight:700;min-height:38px;max-width:40vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tabs{max-width:760px;margin:0 auto;display:flex;gap:4px;padding:4px 12px 8px;overflow-x:auto;scrollbar-width:none}
.tabs::-webkit-scrollbar{display:none}
.tabs button{border:0;background:transparent;border-radius:999px;padding:8px 14px;font-weight:700;font-size:.95rem;color:var(--muted);white-space:nowrap;min-height:42px}
.tabs button[aria-selected="true"]{background:var(--herb);color:var(--herb-ink)}

.wrap{max-width:760px;margin:0 auto;padding-inline:16px;padding-block:20px 80px}
.panel{display:flex;flex-direction:column;gap:26px}
.block{display:flex;flex-direction:column;gap:12px}
.eyebrow,.lbl{font-size:.8rem;text-transform:uppercase;letter-spacing:.1em;color:var(--muted);font-weight:700}
html[lang="ar"] .eyebrow,html[lang="ar"] .lbl{letter-spacing:0;font-size:.95rem}
.note{font-size:.95rem;color:var(--muted);margin:0}
.hint{font-size:.85rem;color:var(--muted)}
.err{color:var(--danger);font-size:.9rem;margin:0;min-height:1.2em}

/* suggestion card */
.plate{background:var(--surface);border:1px solid var(--line);border-radius:22px;padding:26px 22px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:16px;position:relative;overflow:hidden}
.plate::before{content:"";position:absolute;inset-inline-end:-60px;top:-60px;width:180px;height:180px;border-radius:50%;background:var(--saffron-soft)}
.plate > *{position:relative}
.dish-name{font-size:clamp(2rem,7vw,3rem);font-weight:800;line-height:1.08;overflow-wrap:anywhere}
.dish-meta{display:flex;flex-wrap:wrap;gap:8px}
.pick-extra{display:flex;flex-direction:column;gap:6px;font-size:.95rem}
.pick-extra:empty{display:none}
.pill{display:inline-flex;align-items:center;gap:6px;padding:4px 12px;border-radius:999px;background:var(--herb-soft);color:var(--ink);font-size:.85rem;font-weight:700}
.pill.warm{background:var(--saffron-soft)}
.pill.req{background:var(--saffron);color:#231a05}
.actions{display:flex;flex-wrap:wrap;gap:10px}
.btn{border:0;border-radius:14px;padding:13px 20px;font-weight:700;font-size:1.02rem;min-height:50px;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;gap:6px}
.btn.small{min-height:46px;padding:10px 16px}
.btn-primary{background:var(--herb);color:var(--herb-ink)}
.btn-primary:hover{filter:brightness(1.08)}
.btn-primary:disabled{opacity:.5;cursor:default}
.btn-ghost{background:transparent;border:2px solid var(--line);color:var(--ink)}
.btn-ghost:hover{border-color:var(--herb)}
.shuffle .spin{animation:spin .5s ease;display:inline-block}
@keyframes spin{to{transform:rotate(360deg)}}
.flash{animation:pop .35s ease}
@keyframes pop{from{transform:scale(.96);opacity:.4}to{transform:none;opacity:1}}
.done{color:var(--herb);font-weight:700}

.banner{background:var(--saffron-soft);border-radius:16px;padding:14px 16px;display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap;font-size:.95rem}

/* chips */
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{border:2px solid var(--line);background:var(--surface);border-radius:999px;padding:7px 15px;font-weight:700;font-size:.95rem;min-height:44px}
.chip[aria-pressed="true"]{background:var(--herb);border-color:var(--herb);color:var(--herb-ink)}
.seg{display:flex;gap:4px;background:var(--surface);border:1px solid var(--line);padding:4px;border-radius:14px;align-self:flex-start;flex-wrap:wrap}
.seg button{border:0;background:transparent;padding:8px 14px;border-radius:10px;font-weight:700;font-size:.95rem;min-height:42px}
.seg button[aria-pressed="true"]{background:var(--herb);color:var(--herb-ink)}

/* lists */
.card-list{list-style:none;margin:0;padding:0;background:var(--surface);border:1px solid var(--line);border-radius:18px;overflow:hidden}
.card-list:empty{display:none}
.card-list > li{padding:14px 18px;border-top:1px solid var(--line)}
.card-list > li:first-child{border-top:0}
.row{display:grid;grid-template-columns:1fr auto;gap:4px 12px;align-items:center}
.row-main{min-width:0;display:flex;flex-direction:column;gap:2px}
.row-name{font-weight:700;overflow-wrap:anywhere}
.row-sub{font-size:.88rem;color:var(--muted);overflow-wrap:anywhere}
.row-tools{display:flex;gap:4px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.icon-btn{border:0;background:transparent;border-radius:10px;padding:8px 10px;color:var(--muted);font-weight:700;font-size:.9rem;min-height:40px;text-decoration:none;display:inline-flex;align-items:center}
.icon-btn:hover{background:var(--herb-soft);color:var(--ink)}
.icon-btn.del:hover,.icon-btn.danger{color:var(--danger)}
.icon-btn.hearted{color:#D0454C}
.empty{padding:18px;color:var(--muted);background:var(--surface);border:1px dashed var(--line);border-radius:18px;margin:0;font-size:.95rem}
.day{display:grid;grid-template-columns:5.5rem 1fr auto;gap:4px 12px;align-items:center}
.day.past{opacity:.55}
.day.is-today{background:var(--saffron-soft)}
.day-name{font-weight:800;font-family:var(--display);line-height:1.2}
.day-name small{display:block;font-family:var(--body);font-weight:600;color:var(--muted);font-size:.8rem}
.checklist li{display:flex;align-items:center;gap:12px}
.checklist input{width:24px;height:24px;accent-color:var(--herb);flex:none}
.checklist .done-item .row-name{text-decoration:line-through;color:var(--muted)}
.checklist label{display:flex;gap:12px;align-items:center;flex:1;min-width:0;cursor:pointer}

/* forms */
.inline-form,.stack{display:flex;flex-direction:column;gap:12px}
.inline-form{background:var(--surface);border:1px solid var(--line);border-radius:18px;padding:16px}
.inline-form .btn,.stack > .btn{align-self:flex-start}
.row-form{display:flex;gap:8px;flex-wrap:wrap}
.row-form input{flex:1 1 180px}
.field{display:flex;flex-direction:column;gap:6px}
.field label{font-weight:700;font-size:.95rem}
.checks{justify-content:flex-end;gap:10px}
input[type=text],input[type=url],select,textarea{width:100%;padding:11px 14px;border-radius:12px;border:2px solid var(--line);background:var(--bg);min-height:48px}
.search{background:var(--surface)!important}
textarea{min-height:140px;resize:vertical}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.check{display:flex;align-items:center;gap:10px;font-weight:600;font-size:.95rem}
.check input{width:22px;height:22px;accent-color:var(--herb)}
.add{background:var(--surface);border:1px solid var(--line);border-radius:18px;padding:18px;display:flex;flex-direction:column;gap:14px}
.list-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px;flex-wrap:wrap}
.count{color:var(--muted);font-size:.95rem;font-variant-numeric:tabular-nums}
.edit{display:flex;flex-direction:column;gap:12px;padding-top:12px}
.idea-why{font-size:.92rem;color:var(--muted);margin:2px 0 0}

.foot{font-size:.85rem;color:var(--muted);text-align:center;margin-top:36px}
.toast{position:fixed;left:50%;bottom:calc(20px + env(safe-area-inset-bottom,0px));transform:translate(-50%,20px);background:var(--ink);color:var(--bg);padding:12px 18px;border-radius:14px;font-weight:700;font-size:.95rem;opacity:0;pointer-events:none;transition:.25s;max-width:calc(100% - 32px);text-align:center;z-index:20}
.toast.show{opacity:1;transform:translate(-50%,0)}
.modal{position:fixed;inset:0;background:rgba(10,20,10,.45);display:flex;align-items:center;justify-content:center;padding:16px;z-index:30}
.modal-card{background:var(--surface);border-radius:20px;padding:22px;max-width:400px;width:100%;display:flex;flex-direction:column;gap:12px;box-shadow:var(--shadow)}

@media (max-width:520px){
  .grid2{grid-template-columns:1fr}
  .day{grid-template-columns:4.6rem 1fr}
  .day .row-tools{grid-column:1 / -1;justify-content:flex-start}
  .row{grid-template-columns:1fr}
  .row .row-tools{justify-content:flex-start;margin-inline-start:-10px}
}
@media (prefers-reduced-motion:reduce){.shuffle .spin,.flash{animation:none}.toast{transition:none}}
#leftovers:empty{display:none}

/* login */
body.locked .top, body.locked .wrap, body.locked .toast{display:none}
.login{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px 16px}
.login-card{width:100%;max-width:360px;display:flex;flex-direction:column;align-items:center;gap:14px;text-align:center}
.login-card .logo.big{width:64px;height:64px;box-shadow:inset 0 0 0 14px var(--herb),inset 0 0 0 36px var(--bg)}
.login-card input{text-align:center;font-size:1.6rem;letter-spacing:.4em;background:var(--surface)}
.login-card .btn{width:100%}
.login-card .err{min-height:1.4em}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.foot{display:flex;flex-direction:column;align-items:center;gap:4px}
