* { box-sizing: border-box; }

:root {
  --ink: #1c2430;
  --muted: #5c6a7a;
  --line: #dde4ec;
  --paper: #f7f9fb;
  --accent: #0f6f5c;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

header, main {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

h1 { font-size: 1.4rem; margin: 0.5rem 0 0; }
.tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  vertical-align: middle;
}
.subtitle { color: var(--muted); margin: 0.25rem 0 0; }

section { margin-top: 1.5rem; }

form { display: flex; flex-direction: column; gap: 0.5rem; max-width: 34rem; }
#create-workspace-form { flex-direction: row; }
#create-workspace-form input { flex: 1; }

input, select, textarea {
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

button {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  align-self: flex-start;
}
#create-workspace-form button { align-self: auto; }
button:hover { filter: brightness(1.1); }

#workspace-list { list-style: none; padding: 0; }
#workspace-list li { margin: 0.35rem 0; }
#workspace-list a { color: var(--accent); font-weight: 600; text-decoration: none; }
#workspace-list a:hover { text-decoration: underline; }
#workspace-list .meta, .item-list .meta { color: var(--muted); font-size: 0.8rem; margin-left: 0.5rem; }

#back-link { color: var(--muted); text-decoration: none; font-size: 0.9rem; }

.drop-box {
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}
.drop-box h3 { margin-top: 0; }

.hint { color: var(--muted); font-size: 0.85rem; }

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.item-list { list-style: none; padding: 0; }
.item-list li {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0.5rem 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.item-list .source {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.count { color: var(--muted); font-weight: 400; font-size: 0.85rem; }

.error { color: #a03030; font-size: 0.9rem; }

/* Ask box + recipe rendering */

.ask-box {
  background: #fff;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}
.ask-box h3 { margin-top: 0; }
#ask-form { flex-direction: row; max-width: none; }
#ask-form input { flex: 1; }

.recipe-result { margin-top: 1rem; }
.recipe-rationale {
  color: var(--muted);
  font-style: italic;
  font-size: 0.9rem;
  border-left: 3px solid var(--accent);
  padding-left: 0.6rem;
}

.recipe-scroll { overflow-x: auto; }
.recipe-table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.recipe-table th, .recipe-table td {
  border: 1px solid var(--line);
  padding: 0.4rem 0.6rem;
  text-align: left;
  vertical-align: top;
}
.recipe-table th { background: var(--paper); }

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.75rem;
}
.recipe-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  background: var(--paper);
}
.recipe-card h4 { margin: 0.25rem 0; }

dl { margin: 0.25rem 0 0; font-size: 0.82rem; }
dt { color: var(--muted); float: left; clear: left; margin-right: 0.4rem; }
dt::after { content: ":"; }
dd { margin: 0 0 0.15rem 0; overflow: hidden; }

.recipe-maplist { display: flex; flex-direction: column; gap: 0.5rem; }
.recipe-maprow {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  background: var(--paper);
}

.recipe-noteboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.75rem;
}
.recipe-note {
  background: #fdf6d8;
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.08);
  font-size: 0.88rem;
}
.recipe-note.is-question { background: #e8f1fb; }
.note-title { font-weight: 600; margin: 0.2rem 0; }
.note-body { white-space: pre-wrap; }

.card-title { font-weight: 600; }
.card-fields { margin-top: 0.3rem; }
