/* Direction : ardoise de bistrot. Fond ardoise, texte craie, accent vert-citron façon craie.
   Polices système uniquement : rien n'est chargé depuis un serveur tiers (RGPD). */
:root {
  --bg: #1b201d;
  --panel: #232924;
  --panel-2: #2b322d;
  --line: #3a433c;
  --chalk: #ecebe3;
  --muted: #9ba49d;
  --accent: #d6e46a;
  --accent-ink: #1b201d;
  --warn: #e9a07f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--chalk);
  font: 16px/1.55 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-family: var(--sans); }

button, input, textarea { font: inherit; color: inherit; }
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: .55rem 1rem;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: wait; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.secondary { background: transparent; border-color: var(--accent); color: var(--accent); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--chalk); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .55rem .75rem;
  width: 100%;
}
input::placeholder, textarea::placeholder { color: #6f7871; }

.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .9rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px dashed var(--line);
}
.brand {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-style: italic;
  color: var(--chalk);
  text-decoration: none;
  margin: 0;
}
.count { font-family: var(--mono); font-size: .8rem; color: var(--muted); margin-right: auto; }

.layout {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2.5rem);
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr);
}
.board {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 3vw, 2rem);
}
.hint { color: var(--muted); margin: 0 0 1rem; max-width: 60ch; }
.inline { display: flex; gap: .5rem; }
.inline input { flex: 1; }
.search { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px dashed var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

.chips { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.chips li {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 999px;
  padding: .15rem .3rem .15rem .8rem;
}
.chips button { border: 0; background: transparent; padding: .1rem .45rem; color: var(--muted); }
.chips button:hover { color: var(--warn); }

.status { color: var(--muted); font-family: var(--mono); font-size: .85rem; min-height: 1.3em; }
.results {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.card button.title {
  all: unset;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.25;
}
.card button.title:hover { color: var(--accent); }
.card button.title:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.card .meta { font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.tag-ok { color: var(--accent); }
.missing-list { font-size: .88rem; color: var(--warn); }

.chat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  max-height: 80vh;
}
.chat-head { display: flex; align-items: center; justify-content: space-between; }
.chat-head h2 { margin: 0; font-style: italic; }
.chat-log { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .6rem; }
.chat-log li { white-space: pre-wrap; padding: .6rem .8rem; border-radius: var(--radius); max-width: 92%; }
.chat-log .user { align-self: flex-end; background: var(--panel-2); }
.chat-log .assistant { align-self: flex-start; border-left: 2px solid var(--accent); padding-left: .9rem; }
.chat-log .error { color: var(--warn); }
.chat-form { display: flex; gap: .5rem; align-items: flex-end; }
.chat-form textarea { resize: vertical; }
.fine { font-size: .78rem; color: var(--muted); margin: 0; }

@media (min-width: 980px) {
  .layout.with-chat { grid-template-columns: minmax(0, 1fr) 360px; }
  .layout.with-chat .board, .layout.with-chat .results-wrap { grid-column: 1; }
  .layout.with-chat .chat { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 1rem; align-self: start; }
}

dialog.recipe {
  width: min(960px, 94vw);
  max-height: 90vh;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--chalk);
  padding: clamp(1rem, 3vw, 2rem);
}
dialog.recipe::backdrop { background: rgba(10, 12, 11, .75); }
.recipe-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.missing { color: var(--warn); margin: 0 0 1rem; }
.recipe-cols { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .recipe-cols { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); } }
.ingredients { padding-left: 1.1rem; }
.ingredients li { margin-bottom: .3rem; }
.steps { padding-left: 1.3rem; }
.steps li { margin-bottom: .7rem; }
.steps li::marker { font-family: var(--mono); color: var(--accent); }
.recipe-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line);
}

.foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 1.5rem 1rem; border-top: 1px dashed var(--line); }

.login-page { justify-content: center; align-items: center; }
.login { width: min(420px, 92vw); padding: 2rem; }
.login .brand { margin-bottom: 1.5rem; }
.login-form { display: grid; gap: .6rem; margin-top: 1.5rem; }
.login-form label { color: var(--muted); font-size: .9rem; }
.error { color: var(--warn); min-height: 1.4em; margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  .card { transition: border-color .15s; }
  .card:hover { border-color: var(--muted); }
}
