:root {
  --bg: #f4f7f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #0f766e;
  --brand-dark: #0b5a54;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
a { color: var(--brand); }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: #0b3b37;
  color: white;
}
.topbar a { color: #d1fae5; margin-right: 1rem; text-decoration: none; }
.topbar a.active { color: white; font-weight: 700; }
.brand { font-weight: 800; letter-spacing: .02em; }
.user { opacity: .85; margin-right: 1rem; }
.container { max-width: 1100px; margin: 1.5rem auto; padding: 0 1rem 3rem; }
.footer { text-align: center; color: var(--muted); padding: 2rem; font-size: .9rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}
.card.narrow { max-width: 480px; margin: 2rem auto; }
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.row { display: flex; gap: 1rem; align-items: center; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: .85rem; }
label { display: grid; gap: .35rem; font-weight: 600; font-size: .92rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
input, select, textarea, button {
  font: inherit;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .7rem .8rem;
  background: white;
}
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: .7rem 1.1rem;
  background: var(--brand);
  color: white;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover { background: var(--brand-dark); }
.button.secondary, button.secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}
button.danger {
  background: #b91c1c;
  border-color: #b91c1c;
}
button.danger:hover { background: #991b1b; }
.inline { display: inline; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: .92rem; }
th, td { border-bottom: 1px solid var(--line); padding: .7rem .4rem; text-align: left; vertical-align: top; }
td.wrap, .wrap { word-break: break-all; }
pre.code {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 12px;
  overflow: auto;
  font-size: .85rem;
}
h1, h2 { margin: 0 0 .5rem; }
.small { font-size: .82rem; }
.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  background: #f3f4f6;
  color: var(--muted);
  white-space: nowrap;
}
.badge.catalog { background: #e0f2fe; color: #075985; }
.badge.ai { background: #ede9fe; color: #5b21b6; cursor: help; }
.badge.ai.low { background: #fef3c7; color: #92400e; }
.badge.manual { background: #dcfce7; color: #166534; }
.ai-panel {
  background: #faf5ff;
  border: 1px solid #ede9fe;
  border-radius: 12px;
  padding: .85rem 1rem;
  margin: .5rem 0 1rem;
}
.ai-panel p { margin: .5rem 0 0; }

.help-box {
  margin: .75rem 0 0;
  padding: .75rem 1rem;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  font-size: .9rem;
}
.help-box p { margin: .35rem 0; }
.help-box code { font-size: .85em; }
