:root {
  --ink: #17211d;
  --muted: #66716b;
  --forest: #18392f;
  --forest-2: #285746;
  --cream: #f7f4ed;
  --paper: #fffefb;
  --line: #dedfd8;
  --orange: #e66d3f;
  --orange-dark: #be4d27;
  --danger: #a33b2f;
  --shadow: 0 18px 45px rgba(24, 57, 47, .1);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; color: var(--ink); background: var(--cream); font-family: Manrope, system-ui, sans-serif; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, p { margin-top: 0; }
h1 { font: 400 clamp(2.25rem, 6vw, 4.6rem)/1.05 Prata, Georgia, serif; letter-spacing: -.035em; margin-bottom: .65rem; }
h2 { font: 400 1.55rem/1.2 Prata, Georgia, serif; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 .75rem; color: var(--orange-dark); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.topbar { height: 84px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(4vw, 24px); background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; color: var(--cream); background: var(--forest); border-radius: 50% 50% 48% 52% / 58% 45% 55% 42%; font: 400 .92rem Prata, serif; }
.brand-mark.large { width: 64px; height: 64px; margin: 0 auto 22px; font-size: 1.15rem; }
.brand strong, .brand small { display: block; line-height: 1.15; }
.brand strong { font: 400 1.08rem Prata, serif; }
.brand small { margin-top: 3px; color: var(--muted); font-size: .72rem; letter-spacing: .08em; }
.top-actions { display: flex; gap: 8px; }
.button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; transition: transform .15s, background .15s, color .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--orange); box-shadow: 0 8px 20px rgba(230,109,63,.2); }
.button-primary:hover { background: var(--orange-dark); }
.button-secondary { color: white; background: var(--forest); }
.button-ghost { color: var(--forest); background: transparent; }
.button.full { width: 100%; }

.library-shell, .form-shell, .detail-shell { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 64px 0 80px; }
.library-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.library-heading h1 { margin-bottom: .45rem; }
.library-heading .muted { margin: 0; }
.round-add { width: 64px; height: 64px; display: grid; place-items: center; color: white; background: var(--orange); border-radius: 50%; font-size: 2rem; box-shadow: 0 12px 30px rgba(230,109,63,.24); }
.searchbar { height: 58px; display: flex; align-items: center; gap: 12px; padding: 0 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 6px 20px rgba(24,57,47,.05); }
.searchbar:focus-within { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(40,87,70,.12); }
.searchbar svg { width: 22px; fill: none; stroke: var(--muted); stroke-width: 2; }
.searchbar input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 1rem; color: var(--ink); }
.clear-search { font-size: 1.6rem; color: var(--muted); }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 18px 0 28px; scrollbar-width: none; }
.chip { flex: 0 0 auto; padding: 9px 15px; border: 1px solid var(--line); border-radius: 999px; color: #4f5c56; background: var(--paper); font-size: .9rem; font-weight: 700; }
.chip.active { border-color: var(--forest); color: white; background: var(--forest); }
.recipe-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.recipe-card { min-width: 0; background: var(--paper); border: 1px solid rgba(222,223,216,.85); border-radius: var(--radius); overflow: hidden; box-shadow: 0 8px 28px rgba(24,57,47,.05); transition: transform .2s, box-shadow .2s; }
.recipe-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-media { display: block; height: 250px; position: relative; overflow: hidden; background: #dbe1d6; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.recipe-card:hover .card-media img { transform: scale(1.025); }
.image-fallback { width: 100%; height: 100%; display: grid; place-content: center; text-align: center; color: var(--forest); background: linear-gradient(145deg, #dbe6d9, #f0e9d8); }
.image-fallback span { font: 400 5.5rem/1 Prata, serif; opacity: .72; }
.image-fallback small { margin-top: 8px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.time-badge { position: absolute; left: 14px; bottom: 14px; padding: 7px 11px; background: rgba(255,254,251,.92); backdrop-filter: blur(8px); border-radius: 999px; font-size: .78rem; font-weight: 800; }
.card-body { padding: 21px; }
.card-title-row { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.card-title-row h2 { margin-bottom: 10px; }
.card-body > p { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--muted); font-size: .9rem; margin-bottom: 18px; }
.heart { border: 0; background: transparent; color: #a4aaa6; font-size: 1.45rem; padding: 0 3px; }
.heart.active { color: var(--orange); }
.card-meta { color: var(--forest-2); font-size: .78rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.empty-state { padding: 80px 24px; text-align: center; background: var(--paper); border: 1px dashed #c9ccc4; border-radius: var(--radius); }
.empty-icon { width: 66px; height: 66px; margin: 0 auto 22px; display: grid; place-items: center; border-radius: 50%; color: var(--orange); background: #fae8df; font-size: 1.8rem; }
.empty-state p { max-width: 520px; margin: 0 auto 24px; color: var(--muted); }

.back-link { display: inline-block; margin-bottom: 30px; color: var(--forest); font-weight: 800; }
.form-heading { margin-bottom: 32px; }
.form-heading h1 { font-size: clamp(2.2rem, 5vw, 3.7rem); }
.import-panel { padding: 24px; background: #e7eee9; border: 1px solid #cddbd2; border-radius: var(--radius); }
.import-copy { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.import-copy strong, .import-copy small { display: block; }
.import-copy small { margin-top: 2px; color: var(--muted); }
.import-icon { width: 42px; height: 42px; display: grid; place-items: center; background: var(--forest); color: white; border-radius: 12px; font-size: 1.3rem; }
.import-controls { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.import-controls input { min-width: 0; height: 48px; padding: 0 14px; border: 1px solid #bfcfc4; border-radius: 12px; background: var(--paper); outline: none; }
.import-status { margin: 12px 0 0; min-height: 22px; color: var(--muted); font-size: .88rem; }
.import-status.success { color: #246b4b; }
.import-status.error { color: var(--danger); }
.or-divider { text-align: center; border-bottom: 1px solid var(--line); height: 42px; margin-bottom: 40px; }
.or-divider span { position: relative; top: 29px; padding: 0 14px; background: var(--cream); color: var(--muted); font-size: .82rem; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 28px; align-items: start; }
.form-main, .form-side { padding: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.form-side { position: sticky; top: 108px; }
.field { display: block; margin-bottom: 24px; }
.field:last-child { margin-bottom: 0; }
.field > span { display: block; margin-bottom: 8px; font-weight: 800; }
.field > small { display: block; margin: -5px 0 8px; color: var(--muted); font-size: .78rem; }
.field input:not([type=checkbox]), .field textarea { width: 100%; padding: 13px 14px; color: var(--ink); background: #fbfaf7; border: 1px solid var(--line); border-radius: 12px; outline: none; }
.field textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.field input:focus, .field textarea:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(40,87,70,.1); }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.photo-drop { min-height: 230px; display: grid; place-items: center; overflow: hidden; background: #f1efe8; border: 1.5px dashed #b9bdb5; border-radius: 16px; cursor: pointer; text-align: center; }
.photo-drop img { width: 100%; height: 260px; object-fit: cover; }
.photo-drop span { padding: 28px 14px; }
.photo-drop b, .photo-drop strong, .photo-drop small { display: block; }
.photo-drop b { font-size: 2rem; color: var(--orange); }
.photo-drop small { margin-top: 5px; color: var(--muted); }
.check-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: .85rem; }
.sticky-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; padding: 18px 22px; position: sticky; bottom: 14px; z-index: 10; background: rgba(255,254,251,.92); border: 1px solid var(--line); backdrop-filter: blur(12px); border-radius: 16px; box-shadow: 0 10px 28px rgba(24,57,47,.1); }

.detail-topline { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.detail-actions { display: flex; gap: 8px; }
.detail-actions form { display: contents; }
.recipe-hero { min-height: 520px; display: grid; grid-template-columns: 1.08fr .92fr; overflow: hidden; background: var(--forest); border-radius: 30px; box-shadow: var(--shadow); }
.recipe-hero img { width: 100%; height: 100%; max-height: 620px; object-fit: cover; }
.hero-copy { padding: clamp(34px, 6vw, 76px); align-self: center; color: white; }
.hero-copy .eyebrow { color: #f4a17e; }
.hero-copy h1 { font-size: clamp(2.4rem, 5vw, 4.8rem); }
.hero-copy .lead { color: #d6e0db; font-size: 1.05rem; }
.recipe-hero.without-image { grid-template-columns: 1fr; min-height: 400px; }
.facts { display: flex; flex-wrap: wrap; gap: 25px; margin-top: 36px; padding-top: 26px; border-top: 1px solid rgba(255,255,255,.18); }
.facts small, .facts strong { display: block; }
.facts small { color: #aac0b6; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.facts strong { margin-top: 4px; }
.recipe-content { display: grid; grid-template-columns: .75fr 1.25fr; gap: 28px; margin-top: 30px; align-items: start; }
.ingredients-panel, .steps-panel { padding: 34px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.ingredients-panel { position: sticky; top: 108px; }
.ingredients-panel h2, .steps-panel h2 { margin-bottom: 26px; }
.ingredients-panel ul, .steps-panel ol { list-style: none; padding: 0; margin: 0; }
.ingredients-panel li { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid #ecece6; }
.ingredient-check { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 2px; border: 2px solid #b5bcb7; border-radius: 6px; }
.steps-panel li { display: grid; grid-template-columns: 42px 1fr; gap: 16px; padding-bottom: 26px; }
.steps-panel li > span { width: 42px; height: 42px; display: grid; place-items: center; color: white; background: var(--orange); border-radius: 50%; font-weight: 800; }
.steps-panel li p { padding-top: 7px; margin-bottom: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tags span { padding: 7px 10px; background: #eef1ec; border-radius: 8px; color: var(--forest-2); font-size: .8rem; font-weight: 700; }
.source-link { display: inline-block; margin-top: 28px; color: var(--orange-dark); font-weight: 800; }
.danger-zone { display: flex; justify-content: flex-end; padding-top: 28px; }
.text-danger { border: 0; background: transparent; color: var(--danger); font-weight: 700; }

.login-shell { min-height: calc(100vh - 84px); display: grid; place-items: center; padding: 28px; }
.login-card { width: min(430px, 100%); padding: 42px; background: var(--paper); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); text-align: center; }
.login-card h1 { font-size: 2.5rem; }
.login-card .field { text-align: left; margin-top: 28px; }
.toast-stack { position: fixed; z-index: 50; top: 96px; right: 20px; }
.toast { padding: 12px 18px; color: white; background: var(--forest); border-radius: 12px; box-shadow: var(--shadow); font-weight: 700; }
.toast.error { background: var(--danger); }

@media (max-width: 920px) {
  .recipe-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .recipe-content { grid-template-columns: 1fr; }
  .form-side, .ingredients-panel { position: static; }
  .recipe-hero { grid-template-columns: 1fr; }
  .recipe-hero img { height: 380px; }
}

@media (max-width: 620px) {
  .topbar { height: 72px; padding: 0 16px; }
  .brand small, .desktop-only { display: none; }
  .button { min-height: 42px; padding: 0 14px; }
  .library-shell, .form-shell, .detail-shell { width: min(100% - 28px, 1240px); padding: 36px 0 60px; }
  .library-heading { align-items: center; margin-bottom: 24px; }
  .round-add { width: 52px; height: 52px; }
  .recipe-grid { grid-template-columns: 1fr; gap: 16px; }
  .card-media { height: 225px; }
  .import-panel, .form-main, .form-side, .ingredients-panel, .steps-panel { padding: 20px; border-radius: 18px; }
  .import-controls { grid-template-columns: 1fr; }
  .two-fields { grid-template-columns: 1fr; gap: 0; }
  .sticky-actions { bottom: 8px; padding: 10px; }
  .sticky-actions .button { flex: 1; }
  .detail-topline { align-items: center; }
  .detail-actions .button-ghost { display: none; }
  .recipe-hero { min-height: 0; border-radius: 22px; }
  .recipe-hero img { height: 270px; }
  .hero-copy { padding: 30px 24px 34px; }
  .hero-copy h1 { font-size: 2.55rem; }
  .facts { gap: 18px; }
  .login-card { padding: 30px 22px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
