:root {
  --bg: #f3efe6;
  --ink: #1c1914;
  --muted: #6b6458;
  --line: #d8d0c0;
  --accent: #0f5c4c;
  --card: #fffdf8;
  --font: "Segoe UI", "PT Sans", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #e7f0ea 0, transparent 42%),
    linear-gradient(180deg, #f7f3ea, #efe8da);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
}
.brand { font-weight: 700; color: var(--ink); font-size: 1.05rem; }
.topbar nav { display: flex; gap: 1rem; flex: 1; flex-wrap: wrap; }
.nav-muted { color: var(--muted); }
.userbox { display: flex; gap: 0.75rem; align-items: center; }
.userbox button, button, .btn {
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  font: inherit;
}
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
h1 { margin: 0 0 0.5rem; font-size: 1.8rem; }
.lead { color: var(--muted); margin-top: 0; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.grid article, .auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
}
.muted { color: var(--muted); }
.auth-card { max-width: 380px; margin: 4rem auto; }
.stack { display: grid; gap: 0.9rem; }
label { display: grid; gap: 0.35rem; font-size: 0.92rem; }
input[type=text], input[type=password], input[type=search], select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: white;
}
.messages { list-style: none; padding: 0; }
.messages li { padding: 0.6rem 0.8rem; border-radius: 6px; background: #e7f0ea; margin-bottom: 0.5rem; }
.errorlist { color: #9b1c1c; margin: 0; padding-left: 1rem; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.data-table th { background: #f3eee3; font-size: 0.85rem; }
.form-wide { max-width: 720px; }
.row-actions { display: flex; gap: 1rem; align-items: center; }
.btn-link { color: var(--accent); }
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-family: ui-monospace, Consolas, monospace;
  background: white;
  width: 100%;
}
code { font-size: 0.92em; }
.notice {
  background: #fff4df;
  border: 1px solid #e6d2a8;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin: 1rem 0 1.5rem;
}
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
  margin: 1rem 0 1.25rem;
}
.stat { font-size: 1.8rem; font-weight: 700; margin: 0.2rem 0; }
.block { margin-top: 1.75rem; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 0.35rem 0.75rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
.breadcrumb { margin: 0 0 0.5rem; }
.html-preview {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  max-height: 280px;
  overflow: auto;
}
.code-block {
  background: #1c1914;
  color: #f3efe6;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  overflow: auto;
  font-size: 0.85rem;
}
.btn {
  display: inline-block;
  background: var(--accent);
  color: white !important;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  text-decoration: none !important;
}
.table-scroll { overflow: auto; max-width: 100%; }
a.btn:hover { opacity: 0.92; }

/* ---- мастер импорта: секции, режимы, автодополнение категории ---- */
.wizard { max-width: 780px; display: grid; gap: 1.25rem; }
.form-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.25rem 1.3rem;
  display: grid;
  gap: 0.9rem;
}
.form-section h2 {
  margin: 0;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 0.85rem;
}
.section-intro { margin: -0.3rem 0 0; font-size: 0.9rem; }
.field { display: grid; gap: 0.3rem; }
.field-label { font-weight: 600; font-size: 0.92rem; }
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.9rem;
}
.field input[type=text], .field input[type=file], .field select, .field textarea { width: 100%; }

.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}
.mode-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "radio title" ".  desc";
  gap: 0.25rem 0.6rem;
  cursor: pointer;
  background: #fffdf8;
}
.mode-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.mode-card input { grid-area: radio; margin-top: 0.2rem; }
.mode-title { grid-area: title; font-weight: 600; font-size: 0.92rem; }
.mode-desc { grid-area: desc; font-size: 0.85rem; line-height: 1.35; }

.combo { position: relative; }
.combo input[type=text] { width: 100%; }
.combo-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(28, 25, 20, 0.12);
  max-height: 300px;
  overflow: auto;
}
.combo-item {
  display: grid;
  gap: 0.1rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
}
.combo-item:hover, .combo-item.is-active { background: #e7f0ea; }
.combo-item small { font-size: 0.8rem; }
.combo-empty { padding: 0.5rem 0.6rem; font-size: 0.88rem; }
.combo-picked { color: var(--accent); font-size: 0.85rem; }

/* ---- вердикт по кандидату ---- */
.verdict {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.verdict-ok { background: #e2f0e6; color: #14532d; border-color: #b9dcc4; }
.verdict-no { background: #f4e6e6; color: #7f1d1d; border-color: #e0c2c2; }
.verdict-warn { background: #fdf0d5; color: #7c4a03; border-color: #ecd39b; }
.verdict-neutral { background: #ece7dc; color: var(--muted); border-color: var(--line); }
.verdict-error { background: #f6dede; color: #7f1d1d; border-color: #e3b8b8; }
.data-table td.reason { max-width: 420px; font-size: 0.88rem; color: var(--muted); }

/* ---- альтернативы категории на экране подтверждения пакета ---- */
.alt-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; align-items: center; }
.alt-chips .muted { font-size: 0.8rem; }
.chip {
  background: #ece7dc;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.chip:hover { background: #e7f0ea; border-color: var(--accent); }
