:root {
  --blue: #1F3A6B;
  --blue-2: #2E5597;
  --blue-soft: #E6ECF6;
  --yellow: #F2C14E;
  --yellow-soft: #FDF3D6;
  --cream: #FBF8F1;
  --ink: #1C2333;
  --muted: #5B6476;
  --line: #E4DED0;
  --white: #FFFFFF;
  --red: #B3261E;
  --green: #2E7D4F;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(28,35,51,.06), 0 4px 14px rgba(28,35,51,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.55 Inter, system-ui, -apple-system, Segoe UI, sans-serif;
}
h1, h2, h3, .brand { font-family: Fraunces, Georgia, serif; font-weight: 700; line-height: 1.2; }
h1 { font-size: 1.9rem; margin: 1.2rem 0 .3rem; color: var(--blue); }
h2 { font-size: 1.3rem; margin: 1.6rem 0 .5rem; color: var(--blue); }
h3 { font-size: 1.05rem; margin: 0 0 .3rem; }
a { color: var(--blue-2); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* Header */
.top { background: var(--blue); color: var(--white); border-bottom: 4px solid var(--yellow); position: sticky; top: 0; z-index: 10; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { color: var(--white); text-decoration: none; font-size: 1.35rem; }
nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
nav a { color: #DCE5F5; text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 500; }
nav a.active { background: var(--yellow); color: var(--blue); }
nav a:hover:not(.active) { background: rgba(255,255,255,.1); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--yellow); color: var(--blue); font-size: .75rem; font-weight: 600; text-align: center; }
nav a.active .badge { background: var(--blue); color: var(--yellow); }

/* Buttons and inputs */
button, .button {
  font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--blue);
  background: var(--white); color: var(--blue); padding: 9px 16px; font-weight: 600; display: inline-block;
}
button:hover, .button:hover { background: var(--blue-soft); }
button.primary { background: var(--yellow); border-color: var(--yellow); color: var(--blue); }
button.primary:hover { background: #E9B336; }
button.blue { background: var(--blue); color: var(--white); }
button.blue:hover { background: var(--blue-2); }
button.danger { border-color: var(--red); color: var(--red); }
button.link { border: 0; background: none; color: #DCE5F5; font-weight: 500; padding: 8px 12px; }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], textarea, select {
  font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink);
}
input:focus, textarea:focus, select:focus, button:focus-visible, .drop:focus { outline: 3px solid var(--yellow); outline-offset: 1px; }
textarea { min-height: 140px; resize: vertical; }
.field { display: block; font-weight: 500; margin: 12px 0; }
.field input, .field textarea { margin-top: 6px; font-weight: 400; }

/* Cards */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.narrow { max-width: 440px; margin: 48px auto; }
#signin-form button { width: 100%; margin-top: 6px; }

/* Cookbook */
.search-row { margin: 20px 0 12px; }
.search-row input { font-size: 1.05rem; padding: 12px 16px; border-radius: 999px; border: 2px solid var(--blue-soft); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters select { width: auto; min-width: 150px; padding: 8px 10px; }
.chip { border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 6px 12px; font-size: .9rem; font-weight: 500; color: var(--ink); }
.chip.on { background: var(--blue); border-color: var(--blue); color: var(--white); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin: 12px 0 24px; }
.tile { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.tile:hover { border-color: var(--blue-2); }
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile .body { padding: 8px 10px 10px; }
  .tile h3 { font-size: .95rem; }
}
.tile .ph { aspect-ratio: 4/3; background: var(--blue-soft); display: flex; align-items: center; justify-content: center; color: var(--blue); font-family: Fraunces, serif; font-size: 2rem; }
.tile .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .body { padding: 12px 14px 14px; }
.tile .by { color: var(--muted); font-size: .88rem; }
.tile .flag { display: inline-block; margin-top: 6px; background: var(--yellow-soft); color: #7A5A00; border-radius: 6px; padding: 2px 8px; font-size: .8rem; font-weight: 600; }
.empty { color: var(--muted); padding: 24px 0; }

/* Add */
.drop { border: 2px dashed var(--blue-2); background: var(--white); border-radius: var(--radius); padding: 28px 16px; text-align: center; margin: 8px 0 16px; }
.drop.over { background: var(--yellow-soft); border-color: var(--yellow); }
.drop p { margin: 4px 0; }
.drop-buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.status-line { background: var(--blue-soft); color: var(--blue); border-radius: 10px; padding: 10px 14px; font-weight: 500; margin-bottom: 12px; }
.files { display: flex; flex-direction: column; gap: 6px; }
.file { display: flex; justify-content: space-between; gap: 12px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: .93rem; align-items: center; }
.file .name { overflow-wrap: anywhere; }
.file .st { white-space: nowrap; font-weight: 600; font-size: .85rem; }
.st.ok { color: var(--green); } .st.bad { color: var(--red); } .st.wait { color: var(--muted); } .st.busy { color: var(--blue-2); }

/* Recipe */
.recipe-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.recipe-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .93rem; margin: 6px 0 14px; }
.hero { width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--radius); display: block; margin: 8px 0 16px; }
.cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; }
.cols.review { grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .cols, .cols.review { grid-template-columns: 1fr; } }
.ing h3, .steps h3 { color: var(--blue); margin-top: 12px; }
.ing ul { padding-left: 1.1rem; margin: 6px 0; }
.ing li { margin: 4px 0; }
.steps ol { padding-left: 1.3rem; margin: 6px 0; }
.steps li { margin: 8px 0; }
.notes { background: var(--yellow-soft); border-left: 4px solid var(--yellow); padding: 10px 14px; border-radius: 8px; margin: 16px 0; white-space: pre-wrap; }
.flags { background: var(--yellow-soft); border: 1px solid var(--yellow); border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
.flags ul { margin: 4px 0 0; padding-left: 1.2rem; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.tag { background: var(--blue-soft); color: var(--blue); border-radius: 999px; padding: 3px 10px; font-size: .82rem; font-weight: 500; }
.originals img { width: 100%; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; display: block; background: var(--white); }
.originals { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; }
@media (max-width: 760px) { .originals { position: static; max-height: none; } }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.photos img { width: 110px; height: 82px; object-fit: cover; border-radius: 8px; border: 3px solid transparent; cursor: pointer; }
.photos img.primary { border-color: var(--yellow); }
.cat-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.cat-pick fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--white); }
.cat-pick legend { font-weight: 600; color: var(--blue); font-size: .9rem; }
.cat-pick label { display: block; font-size: .9rem; }
.serv { display: inline-flex; align-items: center; gap: 6px; }
.serv input { width: 70px; padding: 6px 8px; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--blue); color: var(--white); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); z-index: 50; max-width: calc(100% - 32px); }

@media print {
  .top, .actions, .originals, .search-row, .filters, nav { display: none !important; }
  body { background: #fff; }
  .cols { grid-template-columns: 1fr 1.4fr; }
}
