:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #2c2520;
  --muted: #7a6f66;
  --accent: #b8562f;
  --accent-dark: #8f3f20;
  --border: #e4ddd3;
  --warn: #d9534f;
  --ok: #2e7d32;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
header.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: white;
  flex-wrap: wrap;
  gap: .5rem;
}
header.topbar a, header.topbar .who, header.topbar .linkish {
  color: white;
  text-decoration: none;
  margin-left: 0.9rem;
  font-size: 0.95rem;
}
header.topbar .brand {
  font-weight: bold;
  font-size: 1.1rem;
  margin-left: 0;
}
header.topbar a:hover { text-decoration: underline; }
.linkish { background: none; border: none; cursor: pointer; padding: 0; font: inherit; }
main {
  max-width: 820px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}
footer {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}
h1 { font-size: 1.8rem; margin: 0.2rem 0 0.6rem; }
h2 { font-size: 1.25rem; margin: 1.4rem 0 0.4rem; border-bottom: 1px solid var(--border); padding-bottom: 0.2rem; }
.flash {
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}
.flash-ok { background: #e8f5e9; color: var(--ok); border: 1px solid #c8e6c9; }
.flash-error { background: #fdecea; color: var(--warn); border: 1px solid #f5c2c0; }

/* login */
.login-card {
  max-width: 360px;
  margin: 3rem auto;
  background: var(--card);
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
  border: 1px solid var(--border);
}
.login-card label { display: block; margin: 0.8rem 0; }
.login-card input {
  width: 100%; padding: 0.55rem; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff;
}
button, .button, .button-secondary {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.55rem 1rem;
  font-size: 1rem;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
button:hover, .button:hover { background: var(--accent-dark); }
.button-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--border);
}
button.danger { background: var(--warn); }
button.danger:hover { background: #a02a27; }

/* list */
.searchbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.searchbar input[type=search] {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}
.searchbar .clear {
  align-self: center;
  color: var(--muted);
}
.recipe-list { list-style: none; padding: 0; margin: 0; counter-reset: recipe; }
.recipe-list .num {
  display: inline-block;
  min-width: 1.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-right: 0.25rem;
}
.recipe-list li {
  background: var(--card);
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.7rem;
}
.recipe-list .title {
  font-size: 1.15rem;
  font-weight: bold;
  text-decoration: none;
  color: var(--accent-dark);
}
.recipe-list .title:hover { text-decoration: underline; }
.recipe-list .by { color: var(--muted); margin-left: 0.5rem; font-size: 0.9rem; }
.tag {
  display: inline-block;
  background: #f1ece2;
  color: var(--muted);
  padding: 0.05rem 0.5rem;
  margin-left: 0.4rem;
  font-size: 0.8rem;
  border-radius: 10px;
}
.missing-badge {
  display: inline-block;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  border-radius: 10px;
  padding: 0.05rem 0.5rem;
  font-size: 0.8rem;
  margin-left: 0.4rem;
}
.desc { color: var(--muted); margin: 0.4rem 0 0; }

/* recipe view */
.recipe { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.25rem 1.5rem; }
.meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.6rem; }
.meta span + span::before { content: " · "; }
.missing-banner {
  background: #fff3cd;
  border: 1px solid #ffeeba;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  color: #856404;
  margin: 0.5rem 0;
}
.pill-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.8rem 0; }
.pill {
  background: #f6efe4;
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.95rem;
}
.pill ul { margin: 0.2rem 0 0 1rem; padding: 0; }
.ingredients, .instructions { padding-left: 1.25rem; }
.ingredients li, .instructions li { margin: 0.2rem 0; }
.source { color: var(--muted); }
.actions { margin-top: 1.2rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
form.inline { display: inline; }
.muted { color: var(--muted); }

/* edit form */
.recipe-form label { display: block; margin: 0.9rem 0 0.3rem; font-weight: 600; }
.recipe-form label small { font-weight: normal; color: var(--muted); }
.recipe-form input, .recipe-form textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  background: #fff;
  font-family: Georgia, serif;
}
.recipe-form textarea { resize: vertical; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
@media (max-width: 540px) {
  .two-col { grid-template-columns: 1fr; }
}
.hint { color: var(--muted); font-size: 0.9rem; }
.updated { font-size: 0.85rem; }
.empty { text-align: center; color: var(--muted); background: transparent; border: none; }

/* upload */
.upload-form .dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  gap: 0.5rem;
  text-align: center;
}
.upload-form .dropzone.drag {
  border-color: var(--accent);
  background: #fff6ed;
}
.upload-form .big { font-size: 1.05rem; font-weight: 600; }
.upload-form .hint { color: var(--muted); font-size: 0.9rem; }
.upload-form button { margin-top: 0.9rem; }
.upload-list { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.upload-list li {
  padding: 0.35rem 0.6rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
}
.upload-list.muted li { color: var(--muted); }
.picked { margin-top: 0.6rem; }
