:root {
  color-scheme: light dark;
  --bg: #14151a;
  --bg-elevated: #1d1f27;
  --border: #2c2f3a;
  --text: #e7e8ec;
  --text-muted: #9a9db0;
  --accent: #d4a24e;
  --ok: #5fb87a;
  --warn: #e0a34e;
  --danger: #e06767;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

header.topbar a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
}
header.topbar a:hover, header.topbar a.active { color: var(--accent); }
header.topbar .brand { font-weight: 700; color: var(--accent); font-size: 1.1rem; margin-right: 1rem; }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

h1, h2, h3 { font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; margin-top: 2rem; }

a { color: var(--accent); }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 500; }

.item-icon { width: 32px; height: 32px; vertical-align: middle; border-radius: 4px; background: #0b0c0f; }

form.inline { display: inline; }
.form-row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.6rem; flex-wrap: wrap; }
input, select, textarea, button {
  font-family: inherit;
  font-size: 0.92rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
}
button { cursor: pointer; background: var(--accent); color: #1a1305; border: none; font-weight: 600; }
button.secondary { background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); }
button:hover { opacity: 0.9; }

.item-picker { position: relative; }
.item-picker-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 6px;
  max-height: 260px; overflow-y: auto; margin-top: 2px;
}
.item-picker-results div { padding: 0.4rem 0.6rem; cursor: pointer; }
.item-picker-results div:hover { background: var(--border); }

details.recipe-node { margin-left: 1rem; border-left: 2px solid var(--border); padding-left: 0.75rem; margin-top: 0.3rem; }
details.recipe-node > summary { cursor: pointer; list-style: none; }
details.recipe-node > summary::-webkit-details-marker { display: none; }

.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge-buy { background: rgba(95,184,122,0.15); color: var(--ok); }
.badge-craft { background: rgba(212,162,78,0.18); color: var(--accent); }
.badge-stock { background: rgba(154,157,176,0.18); color: var(--text-muted); }
.badge-unknown { background: rgba(224,103,103,0.18); color: var(--danger); }

.muted { color: var(--text-muted); font-size: 0.85rem; }
.flash { padding: 0.6rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.flash-ok { background: rgba(95,184,122,0.15); color: var(--ok); }
.flash-error { background: rgba(224,103,103,0.15); color: var(--danger); }
