:root{
  --bg:#0b1020;
  --panel:#0f1630;
  --card:#111a38;
  --card2:#0e1733;
  --text:#e8ecff;
  --muted:#aab3e6;
  --line:rgba(255,255,255,.10);
  --brand:#7c5cff;
  --brand2:#2dd4bf;
  --danger:#ff5c7a;
  --warn:#fbbf24;
  --ok:#34d399;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --r:14px;
  --r2:18px;
  --pad:16px;
  --pad2:22px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

/* Light theme (toggle via html[data-theme="light"]) */
html[data-theme="light"]{
  --bg:#f5f7ff;
  --panel:#ffffff;
  --card:#ffffff;
  --card2:#f0f3ff;
  --text:#0b1020;
  --muted:#4a567a;
  --line:rgba(15,20,40,.12);
  --shadow: 0 10px 24px rgba(18,25,55,.12);
}
html[data-theme="light"] body{
  background: radial-gradient(1200px 700px at 20% 10%, rgba(124,92,255,.20), transparent 60%),
              radial-gradient(900px 600px at 80% 40%, rgba(45,212,191,.16), transparent 60%),
              var(--bg);
}
html[data-theme="light"] .card,
html[data-theme="light"] .recipe-card,
html[data-theme="light"] .plan-day,
html[data-theme="light"] .sidebar,
html[data-theme="light"] .recipe-info,
html[data-theme="light"] .recipe-ings,
html[data-theme="light"] .recipe-steps,
html[data-theme="light"] .servings-card{
  background:rgba(255,255,255,.78);
}
html[data-theme="light"] .sidebar{background:linear-gradient(180deg, rgba(255,255,255,.92), rgba(244,247,255,.92));}
html[data-theme="light"] .badge{background:rgba(15,20,40,.06); border-color:rgba(15,20,40,.10)}
html[data-theme="light"] .input{background:rgba(15,20,40,.04); border-color:rgba(15,20,40,.12); color:var(--text)}
html[data-theme="light"] .ns__btn{background:rgba(15,20,40,.04); border-color:rgba(15,20,40,.12)}
html[data-theme="light"] .ns__list{background:#fff; border-color:rgba(15,20,40,.16)}
html[data-theme="light"] .ns__opt:hover{background:rgba(124,92,255,.10)}
html[data-theme="light"] .toast{background:rgba(255,255,255,.92)}

/* Front header stays dark even in light mode → ensure readable (light) text/icons */
html[data-theme="light"] .front-top{color:rgba(245,248,255,.96)}
html[data-theme="light"] .front-top .front-brand__name{color:rgba(245,248,255,.96)}
html[data-theme="light"] .front-top .front-nav__link{color:rgba(223,231,255,.78)}
html[data-theme="light"] .front-top .front-nav__link:hover{color:rgba(245,248,255,.96)}
html[data-theme="light"] .front-top .icon-btn{
  color:rgba(245,248,255,.96);
  border-color:rgba(255,255,255,.16);
  background:rgba(255,255,255,.05);
}
html[data-theme="light"] .front-top .icon-btn:hover{background:rgba(255,255,255,.08)}

/* Make logout (ghost) button readable in light mode header */
html[data-theme="light"] .front-top .btn--ghost{
  color:rgba(245,248,255,.96);
  border-color:rgba(255,255,255,.18);
  background:rgba(255,255,255,.06);
}
html[data-theme="light"] .front-top .btn--ghost:hover{background:rgba(255,255,255,.10)}

/* Badge contrast tweaks in light mode */
html[data-theme="light"] .badge--brand{color:rgba(25,18,60,.92); background:rgba(124,92,255,.16); border-color:rgba(124,92,255,.30)}
html[data-theme="light"] .badge--tag{color:rgba(10,50,45,.92); background:rgba(45,212,191,.14); border-color:rgba(45,212,191,.28)}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  background: radial-gradient(1200px 700px at 20% 10%, rgba(124,92,255,.25), transparent 60%),
              radial-gradient(900px 600px at 80% 40%, rgba(45,212,191,.18), transparent 60%),
              var(--bg);
  color:var(--text);
}
a{color:inherit; text-decoration:none}
.app-shell{display:flex; min-height:100vh}
.sidebar{
  width:280px;
  background:linear-gradient(180deg, rgba(15,22,48,.95), rgba(9,13,28,.95));
  border-right:1px solid var(--line);
  padding:18px;
  position:sticky; top:0; height:100vh;
}
.brand{display:flex; gap:12px; align-items:center; margin-bottom:18px}
.brand__logo{font-size:28px; width:44px; height:44px; display:grid; place-items:center; background:rgba(124,92,255,.18); border:1px solid rgba(124,92,255,.35); border-radius:14px}
.brand__name{font-weight:800; letter-spacing:.2px}
.brand__sub{font-size:12px; color:var(--muted)}
.nav{display:flex; flex-direction:column; gap:6px; margin-top:8px}
.nav__link{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid transparent;
  color:var(--muted);
}
.nav__link:hover{background:rgba(255,255,255,.04); border-color:rgba(255,255,255,.06); color:var(--text)}
.nav__divider{height:1px; background:var(--line); margin:12px 0}
.nav__section{margin-top:10px; margin-bottom:4px; color:rgba(255,255,255,.45); font-size:12px; text-transform:uppercase; letter-spacing:.12em}
.sidebar__footer{margin-top:auto; padding-top:14px; border-top:1px solid var(--line)}
.me{margin-bottom:10px}
.me__name{font-weight:700}
.me__role{color:var(--muted); font-size:12px}

.main{flex:1; padding:18px 18px 40px}
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}
.topbar__left{display:flex; align-items:center; gap:12px}
.topbar__title{font-weight:800; font-size:16px; color:rgba(255,255,255,.92)}
.icon-btn{
  width:42px; height:42px; border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  cursor:pointer;
  display:grid;
  place-items:center;
  line-height:1;
  font-size:18px;
}
.icon-btn:hover{background:rgba(255,255,255,.06)}
.content{max-width:1080px}
.card{
  background:linear-gradient(180deg, rgba(17,26,56,.92), rgba(12,18,42,.92));
  border:1px solid rgba(255,255,255,.08);
  border-radius:var(--r2);
  box-shadow:var(--shadow);
  padding:var(--pad2);
}
.card + .card{margin-top:14px}
.grid{display:grid; gap:14px}
.grid--2{grid-template-columns: 1.2fr .8fr}
.grid--recipe-form{grid-template-columns: .95fr 1.05fr}
@media(max-width: 980px){ .grid--2{grid-template-columns:1fr} .sidebar{position:fixed; left:-320px; transition:.25s; z-index:50} body.sidebar-open .sidebar{left:0} body.sidebar-open .main{filter:blur(1px)} }

.h1{font-size:22px; font-weight:900; margin:0 0 12px}
.muted{color:var(--muted)}
.row{display:flex; gap:12px; flex-wrap:wrap}
.row > *{flex:1}

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px;
  padding:10px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  cursor:pointer;
}
.btn:hover{background:rgba(255,255,255,.06)}
.btn--primary{
  background:linear-gradient(135deg, rgba(124,92,255,.95), rgba(45,212,191,.65));
  border:0;
  box-shadow: 0 12px 25px rgba(124,92,255,.18);
}
.btn--danger{background:rgba(255,92,122,.14); border-color:rgba(255,92,122,.35)}
.btn--ghost{background:transparent}
.btn--full{width:100%}

.table{width:100%; border-collapse:collapse}
.table th,.table td{padding:10px 8px; border-bottom:1px solid rgba(255,255,255,.08); vertical-align:top}
.table th{color:rgba(255,255,255,.75); font-weight:700; text-align:left; font-size:12px; text-transform:uppercase; letter-spacing:.12em}
.table tr:hover td{background:rgba(255,255,255,.02)}
.badge{display:inline-flex; padding:4px 10px; border-radius:999px; border:1px solid rgba(255,255,255,.10); font-size:12px; color:var(--muted)}
.badge--brand{border-color:rgba(124,92,255,.35); color:rgba(219,212,255,.95); background:rgba(124,92,255,.10)}
.badge--tag{border-color:rgba(45,212,191,.30); color:rgba(199,255,248,.95); background:rgba(45,212,191,.08)}

.input, select, textarea{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.03);
  color:var(--text);
  outline:none;
}

/* --- Prettier native selects (global) --- */
select{
  -webkit-appearance:none;
  -moz-appearance:none;
  appearance:none;
  padding-right:44px;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255,255,255,.75) 50%),
    linear-gradient(135deg, rgba(255,255,255,.75) 50%, transparent 50%),
    linear-gradient(to right, rgba(255,255,255,.08), rgba(255,255,255,.08));
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 12px) 18px,
    calc(100% - 38px) 50%;
  background-size:6px 6px, 6px 6px, 1px 58%;
  background-repeat:no-repeat;
}
select:focus{border-color:rgba(124,92,255,.55); box-shadow:0 0 0 4px rgba(124,92,255,.12)}
select option{background:#0b1220; color:#fff}

/* Replace native select with fully styled dropdown (JS-enhanced).
   Native <select> option styling is inconsistent across OS/browsers, so
   this gives us consistent look everywhere. */
select.ns-hidden{position:absolute !important; left:-99999px !important; width:1px !important; height:1px !important; opacity:0 !important}
.ns{position:relative}
.ns__btn{
  width:100%;
  padding:12px 44px 12px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.03);
  color:var(--text);
  text-align:left;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.ns__btn:focus{outline:none; border-color:rgba(124,92,255,.55); box-shadow:0 0 0 4px rgba(124,92,255,.12)}
.ns__caret{opacity:.85}
.ns__list{
  position:absolute;
  left:0; right:0;
  top:calc(100% + 8px);
  background:linear-gradient(180deg, rgba(17,26,56,.98), rgba(12,18,42,.98));
  border:1px solid rgba(255,255,255,.12);
  border-radius:16px;
  box-shadow:var(--shadow);
  padding:6px;
  z-index:40;
  display:none;
  max-height:320px;
  overflow:auto;
}
.ns.is-open .ns__list{display:block}
.ns__opt{
  width:100%;
  border:0;
  background:transparent;
  color:rgba(255,255,255,.92);
  padding:10px 10px;
  border-radius:12px;
  cursor:pointer;
  text-align:left;
}
.ns__opt:hover{background:rgba(255,255,255,.06)}
.ns__opt[aria-selected="true"]{background:rgba(124,92,255,.16); border:1px solid rgba(124,92,255,.28)}
.ns__opt:focus{outline:none; background:rgba(255,255,255,.07)}
textarea{min-height:110px; resize:vertical}
label{font-size:12px; color:rgba(255,255,255,.70); display:block; margin-bottom:6px}
.field{margin-bottom:12px}
.small{font-size:12px}
hr.sep{border:0; height:1px; background:rgba(255,255,255,.10); margin:16px 0}
.toast{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.04);
  margin-bottom:10px;
}
.toast--ok{border-color:rgba(52,211,153,.35); background:rgba(52,211,153,.10)}
.toast--err{border-color:rgba(255,92,122,.35); background:rgba(255,92,122,.10)}
.toast--warn{border-color:rgba(251,191,36,.35); background:rgba(251,191,36,.10)}

.login-wrap{max-width:430px; margin:8vh auto}
.kbd{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size:12px; padding:2px 6px; border-radius:8px; border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.03)}

.steps{display:flex; flex-direction:column; gap:10px}
.step{display:flex; gap:12px; align-items:flex-start}
.step__n{width:34px; height:34px; border-radius:999px; display:grid; place-items:center; background:rgba(124,92,255,.15); border:1px solid rgba(124,92,255,.35); font-weight:800}
.step__t{flex:1}
.ing-grid{display:grid; grid-template-columns: 2.8fr 1.8fr 1fr .9fr auto; gap:10px; align-items:end}
@media(max-width:900px){ .ing-grid{grid-template-columns:1fr 1fr; } }
.xbtn{width:40px; height:42px; border-radius:14px; border:1px solid rgba(255,255,255,.10); background:rgba(255,255,255,.03); cursor:pointer; color:var(--text)}
.xbtn:hover{background:rgba(255,255,255,.06)}


/* --- Frontend (browse) --- */
.front-shell{min-height:100vh; display:flex; flex-direction:column}
.front-top{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap;
  padding:14px 18px;
  background:linear-gradient(180deg, rgba(15,22,48,.92), rgba(9,13,28,.86));
  border-bottom:1px solid var(--line);
}
.front-brand{display:flex; align-items:center; gap:10px}
.front-brand__logo{width:42px; height:42px; display:grid; place-items:center; border-radius:14px; background:rgba(124,92,255,.18); border:1px solid rgba(124,92,255,.35); font-size:24px}
.front-brand__name{font-weight:900; letter-spacing:.2px}
.front-nav{display:flex; gap:8px; flex-wrap:wrap}
.front-nav__link{padding:10px 12px; border-radius:12px; border:1px solid transparent; color:var(--muted)}
.front-nav__link:hover{background:rgba(255,255,255,.04); border-color:rgba(255,255,255,.06); color:var(--text)}
.front-actions{display:flex; gap:10px; align-items:center}
.front-main{padding:18px; max-width:1200px; width:100%; margin:0 auto}

.front-hero{display:flex; align-items:flex-end; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:14px}
.front-filters{display:flex; gap:10px; align-items:end; flex-wrap:wrap}

.recipe-grid{
  display:grid;
  grid-template-columns: repeat( auto-fill, minmax(240px, 1fr) );
  gap:14px;
}
.recipe-card{
  border:1px solid var(--line);
  border-radius:18px;
  /* Allow plate PNG to pop outside the card on hover */
  overflow:visible;
  background:rgba(17,26,56,.75);
  box-shadow:var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
.recipe-card:hover{transform:translateY(-2px); border-color:rgba(255,255,255,.18)}
.recipe-card:hover{position:relative; z-index:5}
.recipe-card__img{
  height:210px;
  background:rgba(255,255,255,.04);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:14px; /* leave some air for transparent PNG plates */
  overflow:visible;
}
.recipe-card__img img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
  transform-origin:50% 55%;
  transition:transform .38s cubic-bezier(.2,.9,.2,1), filter .38s cubic-bezier(.2,.9,.2,1);
}
.recipe-card:hover .recipe-card__img img{
  /* More playful hover for plate PNGs */
  transform:translateY(-16px) scale(1.14) rotate(18deg);
  /* Softer shadow so it doesn't look too heavy */
  filter:drop-shadow(0 10px 14px rgba(0,0,0,.18));
}
.recipe-card__ph{height:100%; display:grid; place-items:center; color:rgba(255,255,255,.55)}
.recipe-card__body{padding:14px}
.recipe-card__title{font-weight:900; font-size:16px; line-height:1.25}
.recipe-card__meta{margin-top:10px; display:flex; gap:6px; flex-wrap:wrap}

/* --- Recipe detail layout --- */
.recipe-layout{display:grid; grid-template-columns: 1.05fr .95fr; gap:16px; align-items:start}
@media(max-width: 980px){ .recipe-layout{grid-template-columns:1fr} }
.recipe-col{display:flex; flex-direction:column; gap:16px; min-width:0}

.recipe-photo{
  border-radius:18px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  overflow:hidden;
  min-height:320px;
}
/* Leave more air around transparent PNG plates */
.recipe-photo img{
  width:100%; height:100%; object-fit:contain; display:block; padding:26px;
  /* Subtle entrance + float for "plate" feeling */
  animation: plateIn .55s cubic-bezier(.2,.9,.2,1) both, plateFloat 5.5s ease-in-out .65s infinite;
  will-change: transform, opacity;
}
.recipe-photo__ph{height:320px; display:grid; place-items:center; color:rgba(255,255,255,.55)}

@keyframes plateIn{
  from{opacity:0; transform:translateY(10px) scale(.96) rotate(-2deg)}
  to{opacity:1; transform:translateY(0) scale(1) rotate(0deg)}
}
@keyframes plateFloat{
  0%,100%{transform:translateY(0) rotate(0deg)}
  50%{transform:translateY(-4px) rotate(.7deg)}
}

@media (prefers-reduced-motion: reduce){
  .recipe-card, .recipe-card__img img, .recipe-photo img{animation:none !important; transition:none !important}
}

.recipe-info{border:1px solid var(--line); border-radius:18px; background:rgba(17,26,56,.75); padding:18px}

.recipe-ings, .recipe-steps{border:1px solid var(--line); border-radius:18px; background:rgba(17,26,56,.75); padding:18px}
.recipe-ings__head{display:flex; align-items:flex-end; justify-content:space-between; gap:12px; flex-wrap:wrap}
.servings-box{border:1px solid rgba(255,255,255,.08); background:rgba(255,255,255,.03); border-radius:16px; padding:12px; margin-top:12px}

/* Two small action cards under ingredients (servings + shopping, planning) */
.servings-grid{display:grid; grid-template-columns: 1fr 1fr; gap:12px; margin-top:12px}
@media(max-width:720px){ .servings-grid{grid-template-columns:1fr} }
.servings-card{border:1px solid rgba(255,255,255,.08); background:rgba(255,255,255,.03); border-radius:16px; padding:12px}

.ing-list{list-style:none; padding:0; margin:0}
.ing-section{padding:14px 0 6px; border-bottom:1px solid rgba(255,255,255,.06); margin-top:6px}
.ing-section span{display:inline-block; font-weight:900; letter-spacing:.02em; color:rgba(255,255,255,.92)}
.ing-item{display:grid; grid-template-columns: 120px 1fr; gap:12px; padding:10px 0; border-bottom:1px solid rgba(255,255,255,.06)}
.ing-item:last-child{border-bottom:none}
.ing-item__qty{font-variant-numeric: tabular-nums; display:flex; gap:6px; align-items:baseline}
.ing-item__qty span:first-child{font-weight:900}
.steps--big .step__t{font-size:16px; line-height:1.55}
.steps--big .step__n{min-width:34px; height:34px; border-radius:12px; font-weight:900}

.gallery{display:grid; grid-template-columns: repeat(4, 1fr); gap:12px}
.gallery__item{padding:0; border:1px solid rgba(255,255,255,.10); border-radius:16px; overflow:hidden; background:rgba(255,255,255,.03); cursor:pointer}
.gallery__item img{width:100%; height:240px; object-fit:cover; display:block}
@media(max-width:720px){
  .gallery{grid-template-columns: 1fr}
  .gallery__item img{height:210px}
}

.lightbox{position:fixed; inset:0; display:none; z-index:60}
.lightbox.is-open{display:block}
.lightbox__backdrop{position:absolute; inset:0; background:rgba(0,0,0,.72); z-index:1}
.lightbox__inner{position:absolute; inset:0; display:grid; place-items:center; padding:18px; z-index:2}
.lightbox__img{max-width:min(1100px, 92vw); max-height:86vh; border-radius:18px; border:1px solid rgba(255,255,255,.18); background:rgba(17,26,56,.6)}
.lightbox__close{position:fixed; top:16px; right:16px;; z-index:3}
.lightbox__nav{
  z-index:3;
  position:fixed;
  top:50%;
  transform:translateY(-50%);
  width:46px; height:46px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(17,26,56,.55);
  backdrop-filter: blur(6px);
  color:rgba(255,255,255,.92);
  cursor:pointer;
}
.lightbox__nav:hover{background:rgba(17,26,56,.75)}
.lightbox__nav--prev{left:16px}
.lightbox__nav--next{right:16px}

/* Planner (frontend) */
.plan-grid{display:grid; grid-template-columns: repeat(7, 1fr); gap:12px}
@media(max-width: 1100px){ .plan-grid{grid-template-columns: repeat(2, 1fr)} }
@media(max-width: 640px){ .plan-grid{grid-template-columns: 1fr} }

/* Desktop "accordion" hover: expand hovered day and gently shrink others */
@media(min-width: 1101px){
  .plan-grid{display:flex; gap:12px}
  .plan-day{flex:1 1 0; min-width:0; transition:flex .25s ease, transform .25s ease, box-shadow .25s ease}
  .plan-grid:hover .plan-day{flex:0.9 1 0}
  .plan-grid:hover .plan-day:hover{flex:1.8 1 0; transform:translateY(-2px)}
}

.plan-day.is-focus{outline:2px solid rgba(124,92,255,.38)}
.plan-day.is-pulse{box-shadow:0 0 0 6px rgba(124,92,255,.16), var(--shadow)}
.plan-day{
  border:1px solid var(--line);
  border-radius:18px;
  background:rgba(17,26,56,.75);
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  min-height:180px;
}
.plan-day__head{display:flex; justify-content:space-between; gap:10px; align-items:flex-start}
.plan-day__title{font-weight:900}
.plan-day__date{color:var(--muted); font-size:12px}
.plan-slot{display:flex; flex-direction:column; gap:6px}
.plan-item{display:flex; justify-content:space-between; gap:8px; align-items:center; flex-wrap:nowrap; font-size:13px}
.plan-item__main{display:flex; align-items:center; gap:8px; min-width:0; flex:1}
.plan-item__remove{margin:0; flex:0 0 auto}
.plan-add{margin-top:auto; padding-top:10px; border-top:1px solid rgba(255,255,255,.08)}
.plan-add form{display:grid; gap:8px}

/* --- Admin niceties --- */
.tag-picker{display:flex; flex-direction:column; gap:10px}
.tag-picker__list{display:flex; flex-wrap:wrap; gap:8px; max-height:220px; overflow:auto; padding:6px; border:1px solid rgba(255,255,255,.08); border-radius:16px; background:rgba(255,255,255,.02)}
.tag-chip{display:inline-flex; align-items:center; gap:8px; padding:8px 10px; border-radius:999px; border:1px solid rgba(255,255,255,.10); background:rgba(255,255,255,.03); cursor:pointer; user-select:none}
.tag-chip input{accent-color: var(--brand)}
.photo-thumb{position:relative; width:220px; max-width:100%; margin-top:10px; border-radius:16px; border:1px solid rgba(255,255,255,.10); background:rgba(255,255,255,.03); overflow:hidden}
.photo-thumb img{width:100%; display:block; object-fit:cover}
.xbtn--corner{position:absolute; top:8px; right:8px; width:34px; height:34px; border-radius:12px}
.gallery-admin{display:grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap:10px; margin-top:12px}
.gallery-admin__item{position:relative; border-radius:16px; overflow:hidden; border:1px solid rgba(255,255,255,.10); background:rgba(255,255,255,.03)}
.gallery-admin__item img{width:100%; height:110px; object-fit:cover; display:block}

@media (max-width: 920px){
  .recipe-hero{grid-template-columns:1fr}
  .recipe-body{grid-template-columns:1fr}
  .recipe-hero__photo{min-height:240px}
}

.step__t textarea{min-height:92px; resize:vertical}


.btn--sm{padding:8px 10px; border-radius:12px; font-size:13px; line-height:1.1}
.icon-btn--sm{width:30px; height:30px; border-radius:12px; font-size:16px}
.icon-btn--xs{
  width:20px;
  height:20px;
  border-radius:8px;
  font-size:14px;
  border:0;
  background:transparent;
}
.icon-btn--xs:hover{background:rgba(255,255,255,.08)}
.icon-btn--xs{
  width:20px;
  height:20px;
  border-radius:10px;
  font-size:14px;
  border:0;
  background:transparent;
}
.icon-btn--xs:hover{background:rgba(255,255,255,.08)}

/* Planner compact overrides */
.plan-item{justify-content:space-between; align-items:center}
.plan-item a{flex:1; min-width:0}
.plan-item b{display:inline-block; max-width:100%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.plan-slot .badge{font-size:12px; padding:6px 10px; border-radius:999px}
.plan-add__toggle{width:100%}
.plan-add__panel{margin-top:10px}

/* Lightbox click fix */
.lightbox__inner{pointer-events:none}
.lightbox__img{pointer-events:auto}
.lightbox__nav,.lightbox__close{pointer-events:auto}

/* Shopping list: mobile-friendly layout */
.shopping-cards{display:none}
.shopping-table{display:table}

.shopping-card__top{display:flex; align-items:flex-start; justify-content:space-between; gap:10px}
.shopping-card__title{display:flex; align-items:flex-start; gap:10px; min-width:0}
.shopping-name{font-weight:800; font-size:16px; line-height:1.2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:42vw}
.shopping-check{padding:8px 10px; border-radius:12px}
.shopping-del{padding:6px 8px; border-radius:12px}

.shopping-card__meta{display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:12px}
.shopping-card__meta .strong{font-weight:800}
.shopping-note{grid-column:1 / -1}

.shopping-card.is-checked{opacity:.78}

@media (max-width: 760px){
  .shopping-cards{display:block}
  .shopping-table{display:none}
  .shopping-actions{width:100%}
  .shopping-actions .btn{flex:1; min-width:0}
  .shopping-name{max-width:60vw}
  /* keep add form usable */
  .card form[style*="/shopping_add.php"] .field{flex:1 1 100%; min-width:0}
}


.recipe-back{margin:10px 0 14px}
.back-link{display:inline-flex; gap:8px; align-items:center; color:var(--text); text-decoration:none; font-weight:700; opacity:.9}
.back-link:hover{opacity:1; text-decoration:underline}

.recipe-photo img{transition:transform .45s cubic-bezier(.2,.9,.2,1), filter .45s cubic-bezier(.2,.9,.2,1)}
.recipe-photo:hover img{transform:translateY(-4px) rotate(2deg) scale(1.01); filter:drop-shadow(0 14px 18px rgba(0,0,0,.18))}

/* Autocomplete */
.ac{position:relative}
.ac__list{
  position:absolute; left:0; right:0; top:calc(100% + 6px);
  background:rgba(10,14,28,.92);
  border:1px solid rgba(255,255,255,.14);
  border-radius:14px;
  padding:6px;
  box-shadow:0 18px 40px rgba(0,0,0,.35);
  z-index:50;
  max-height:220px;
  overflow:auto;
}
html[data-theme="light"] .ac__list{background:rgba(255,255,255,.96); border-color:rgba(15,20,40,.14); box-shadow:0 18px 40px rgba(0,0,0,.12)}
.ac__opt{
  padding:10px 10px;
  border-radius:10px;
  cursor:pointer;
  color:var(--text);
  display:flex; gap:10px; align-items:center;
}
.ac__opt:hover{background:rgba(124,92,255,.16)}
.ac__hint{opacity:.7; font-size:12px}


/* Admin: use full width */
.is-admin .content{max-width:none; width:100%}


/* File upload boxes */
.filebox{display:block; border:1px dashed rgba(127,127,127,.35); border-radius:16px; padding:14px; cursor:pointer; background:rgba(255,255,255,.04)}
.filebox:hover{border-color:rgba(127,127,127,.6)}
.filebox__input{position:absolute; opacity:0; width:1px; height:1px; overflow:hidden}
.filebox__inner{display:flex; flex-direction:column; gap:4px}
.filebox__title{font-weight:700}
.filebox__hint{font-size:12px; opacity:.75}
.filebox__filename{font-size:12px; opacity:.85}

/* Ingredient picker (input + hidden id) */
.ingpick{min-width:0}
.ingpick__name{width:100%}

.input--sm{padding:8px 10px; font-size:14px}
.btn--sm{padding:8px 10px; font-size:14px}


/* Admin icon buttons + modal helpers */
.iconbtn{
  width:32px;height:32px;border-radius:10px;
  border:1px solid var(--border);
  background:var(--card);
  color:var(--text);
  display:inline-flex;align-items:center;justify-content:center;
  cursor:pointer;
}
.iconbtn:hover{filter:brightness(1.05);}
.iconbtn--danger{border-color:rgba(255,80,80,.35); color:#ff6b6b;}
.pill{display:inline-flex;align-items:center; padding:2px 10px; border-radius:999px; font-size:12px; border:1px solid var(--border); background:rgba(255,255,255,.04);}
.pill--ok{border-color:rgba(80,200,140,.35);}
.pill--muted{opacity:.7;}
.modal{border:0; padding:0; background:transparent;}
.modal::backdrop{background:rgba(0,0,0,.45); backdrop-filter: blur(6px);}
.modal__card{
  width:min(520px, calc(100vw - 32px));
  border-radius:18px;
  background:var(--card);
  border:1px solid var(--border);
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
  padding:18px;
}
.modal__actions{display:flex; gap:10px; justify-content:flex-end; margin-top:16px;}
