:root {
  --bg: #fbfaf7; --panel: #ffffff; --ink: #23201c; --muted: #6b645b;
  --line: #e4dfd6; --accent: #8a4b2a; --accent-soft: #f4ece6;
  --warn: #8a6d1f; --warn-soft: #fdf6e0; --bad: #9a2b21; --bad-soft: #fbeceb;
  --good: #2f6b46; --radius: 10px;
  --shadow: 0 1px 2px rgba(35,32,28,.06), 0 6px 18px rgba(35,32,28,.05);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; font-weight: 600; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
button, input, select, textarea {
  font: inherit; color: inherit;
}
button {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .45em .9em; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--bad); }
button.link { background: none; border: none; color: var(--muted); text-decoration: underline; padding: 0; }
input, select, textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: .45em .6em; width: 100%;
}
textarea { min-height: 9em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88rem; }
label { display: block; font-size: .8rem; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); margin: .8em 0 .2em; }

.gate { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.gate-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; max-width: 24rem; width: 100%; box-shadow: var(--shadow); }
.gate-card button { width: 100%; margin-top: 1rem; background: var(--accent); border-color: var(--accent); color: #fff; }

.topbar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; padding: .8rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--panel); }
.topbar nav { display: flex; gap: .4rem; margin-right: auto; }
.brand { font-weight: 700; border: none; background: none; font-size: 1.15rem; padding: 0 .6rem 0 0; }
main { max-width: 62rem; margin: 0 auto; padding: 1.6rem 1.2rem 5rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-align: left; padding: 0; display: flex; flex-direction: column; box-shadow: var(--shadow); }
/* Media slot: no image ships in v1, but every card reserves the space and shows
   a generated placeholder tile, so an image is a later attachment not a redesign. */
.card .media { aspect-ratio: 16 / 9; display: grid; place-items: center; font-size: 2rem; color: #fff; letter-spacing: .1em; }
.card .body { padding: .8rem .9rem 1rem; }
.card h3 { margin-bottom: .25em; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.chip { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: .15em .6em; }
.chip.plain { background: #f1efe9; color: var(--muted); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1.2rem; box-shadow: var(--shadow); }
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar input { max-width: 22rem; }
.row { display: flex; gap: .8rem; flex-wrap: wrap; }
.row > * { flex: 1 1 10rem; }
.notice { border-radius: 8px; padding: .6em .8em; margin: .5em 0; border: 1px solid; }
.notice.warn { background: var(--warn-soft); border-color: #e6d59a; color: var(--warn); }
.notice.bad { background: var(--bad-soft); border-color: #eec4c0; color: var(--bad); }
.notice.info { background: var(--accent-soft); border-color: #e3d3c8; color: var(--accent); }
.error { color: var(--bad); }
ul.plain, ol.steps { padding-left: 1.2em; margin: 0 0 1em; }
ul.plain { list-style: none; padding-left: 0; }
ul.plain li { padding: .3em 0; border-bottom: 1px dotted var(--line); display: flex; gap: .5em; flex-wrap: wrap; }
ol.steps li { margin-bottom: .6em; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .35em .5em; border-bottom: 1px solid var(--line); }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; flex-wrap: wrap; }
.tabs button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; }
.tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .6em 1.1em; border-radius: 99px; box-shadow: var(--shadow); max-width: 90vw; }
.ing-row { display: grid; grid-template-columns: 4.5rem 5rem 1fr 1fr 2rem; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.ing-row.ref { grid-template-columns: 4.5rem 5rem 2fr 2rem; background: var(--accent-soft); padding: .3rem; border-radius: 8px; }
.ing-flags { display: flex; gap: .8rem; font-size: .8rem; color: var(--muted); }
.ing-flags label { display: inline-flex; align-items: center; gap: .3em; margin: 0; text-transform: none; letter-spacing: 0; font-size: .8rem; }
.ing-flags input { width: auto; }
.stack { display: flex; flex-direction: column; gap: .2rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; background: #f1efe9; padding: .1em .35em; border-radius: 4px; }
