/* ============================================================================
   barox ProductPub – projektspezifisches CSS
   Baut ausschliesslich auf den Tokens des Design-Systems auf.
   ========================================================================== */

body { background: var(--bg); }

.page { padding: 28px 20px 56px; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.topbar-title { margin-right: auto; color: var(--navy-20); font-weight: 500; }

.inline-form { display: inline; margin: 0; }

.linkbutton {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: var(--navy-20); font-weight: 500;
}
.linkbutton:hover { color: var(--amber); }

.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 0.88rem; }

.flash { margin-bottom: 14px; }
.alert-warning { background: #fdf6e3; border-left: 4px solid var(--warning); color: #6b5200; }

/* Meldungen enthalten teils mehrzeilige Hinweise samt Shell-Befehl.
   Zeilenumbrüche müssen erhalten bleiben, lange Pfade dürfen umbrechen. */
.alert { white-space: pre-line; overflow-wrap: anywhere; }
.alert code, .alert .cmd {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.88em;
}

/* -------------------------------- Struktur -------------------------------- */

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 22px;
}
.page-head h1 { margin-bottom: 6px; }
.page-head .lead { margin: 0; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px 26px;
  margin-bottom: 22px;
}
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel-tight { padding: 18px 20px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

.muted { color: var(--grey); }
.small { font-size: 0.86rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.86rem; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 12px; }

/* ------------------------------- Kennzahlen ------------------------------- */

.stat {
  background: var(--navy-10);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .value {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.5rem; color: var(--navy); line-height: 1.1;
}
.stat .label { font-size: 0.82rem; color: var(--grey); margin-top: 3px; }

/* -------------------------------- Tabellen -------------------------------- */

.table-wrap { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data th, table.data td {
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data th {
  font-weight: 700; color: var(--navy); background: var(--navy-10);
  position: sticky; top: 0; z-index: 1;
}
table.data tr:hover td { background: #fbfcfd; }
table.data td.right, table.data th.right { text-align: right; }

/* ------------------------------ Markierungen ------------------------------ */

.badge {
  display: inline-block; border-radius: 999px;
  padding: 2px 10px; font-size: 0.76rem; font-weight: 700;
  white-space: nowrap; line-height: 1.6;
}
.badge-ok      { background: #e8f3e9; color: #1d4a20; }
.badge-info    { background: var(--navy-10); color: var(--navy); }
.badge-warn    { background: #fdf6e3; color: #6b5200; }
.badge-neutral { background: #eef1f4; color: var(--grey); }
.badge-manual  { background: #ece7f6; color: #4527a0; }
.badge-muted   { background: transparent; color: var(--navy-40); }
.badge-amber   { background: var(--amber); color: var(--navy); }

/* -------------------------------- Schritte -------------------------------- */

.steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.step {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 16px 8px 10px; border-radius: 999px;
  background: var(--white); border: 1px solid var(--line);
  font-size: 0.88rem; color: var(--grey); text-decoration: none;
}
.step .n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--navy-10); color: var(--navy);
  font-weight: 700; font-size: 0.78rem;
}
.step.current { border-color: var(--navy); color: var(--navy); font-weight: 500; }
.step.current .n { background: var(--amber); color: var(--navy); }
.step.done .n { background: var(--success); color: #fff; }

/* ------------------------------ Formularteile ----------------------------- */

.field { margin-bottom: 16px; }
.field .hint { font-size: 0.82rem; color: var(--grey); margin-top: 4px; }

.dropzone {
  border: 2px dashed var(--navy-40); border-radius: var(--radius-lg);
  padding: 30px; text-align: center; background: var(--white);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.over { border-color: var(--amber); background: #fffaf0; }
.dropzone input[type="file"] { margin-top: 12px; }
.dropzone .filename { font-weight: 700; color: var(--navy); margin-top: 10px; }

/* ------------------------------ Vorlagenwahl ------------------------------ */

.reference-list { display: grid; gap: 12px; }
.reference {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 14px 18px; cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.reference:hover { border-color: var(--navy-40); box-shadow: var(--shadow); }
.reference input[type="radio"] { width: auto; accent-color: var(--amber); }
.reference.selected { border-color: var(--navy); box-shadow: var(--shadow); }
.reference .name { font-weight: 700; color: var(--navy); }
.reference .why { font-size: 0.84rem; color: var(--grey); margin-top: 2px; }
.reference .score {
  font-family: var(--font-display); font-weight: 700;
  color: var(--navy); font-size: 1.05rem;
}

/* -------------------------------- Entwurf --------------------------------- */

.group-head {
  display: flex; align-items: baseline; gap: 12px;
  margin: 26px 0 12px; padding-bottom: 8px;
  border-bottom: 2px solid var(--navy-20);
}
.group-head h2 { margin: 0; }
.group-head .count { font-size: 0.85rem; color: var(--grey); }

.fieldrow {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden;
}
.fieldrow > summary {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; cursor: pointer; list-style: none;
}
.fieldrow > summary::-webkit-details-marker { display: none; }
.fieldrow > summary::before {
  content: "▸"; color: var(--navy-40); font-size: 0.8rem; transition: transform 0.15s ease;
}
.fieldrow[open] > summary::before { transform: rotate(90deg); }
.fieldrow > summary:hover { background: #fbfcfd; }
.fieldrow .col-letter {
  font-family: ui-monospace, Consolas, monospace; font-size: 0.78rem;
  background: var(--navy-10); color: var(--navy);
  border-radius: 4px; padding: 2px 7px; font-weight: 700;
}
.fieldrow .col-name { font-weight: 700; color: var(--navy); }
.fieldrow .preview {
  flex: 1 1 260px; color: var(--grey); font-size: 0.87rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fieldrow .body { padding: 4px 18px 18px; border-top: 1px solid var(--line); }
.fieldrow.needs-review { border-left: 3px solid var(--amber); }

.fieldnote {
  background: var(--navy-10); border-radius: var(--radius);
  padding: 9px 12px; font-size: 0.84rem; color: var(--navy);
  margin: 12px 0;
}

.langgrid { display: grid; gap: 12px; }
.langfield label {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  flex-wrap: wrap;
}
.langfield .lang-code {
  font-family: ui-monospace, Consolas, monospace;
  text-transform: uppercase; font-size: 0.78rem;
  color: var(--grey); font-weight: 700; letter-spacing: 0.04em;
}
.langfield textarea {
  min-height: 64px; resize: vertical; font-size: 0.9rem; line-height: 1.5;
}
.langfield textarea.dirty { border-color: var(--amber); }
.langfield textarea.saved { border-color: var(--success); }

.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 12px 18px; margin-bottom: 18px;
  position: sticky; top: 96px; z-index: 20;
}
.filter-bar .spacer { flex: 1; }
.chip {
  border: 1px solid var(--navy-40); background: var(--white);
  border-radius: 999px; padding: 5px 14px; font-size: 0.85rem;
  cursor: pointer; color: var(--navy); font-family: inherit;
}
.chip.active { background: var(--navy); color: var(--white); border-color: var(--navy); }

/* --------------------------- Fortschritt Textanpassung -------------------- */

.llm-progress {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 14px 18px; margin-bottom: 18px;
}
.llm-bar-track {
  height: 6px; background: var(--navy-10);
  border-radius: 999px; overflow: hidden; margin-bottom: 10px;
}
.llm-bar {
  height: 100%; width: 0; background: var(--amber);
  border-radius: 999px; transition: width 0.25s ease;
}
.llm-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.llm-row .small { color: var(--grey); }

/* --------------------------- Plausibilitätsbefunde ------------------------ */

.findings-panel { border-left: 4px solid var(--amber); }

.findings { list-style: none; padding: 0; margin: 0; }
.findings li {
  display: grid; grid-template-columns: auto 1fr; gap: 12px;
  align-items: start; padding: 11px 0; border-bottom: 1px solid var(--line);
}
.findings li:last-child { border-bottom: 0; }

.finding-field {
  font-weight: 700; color: var(--navy); text-decoration: none;
  font-size: 0.92rem;
}
.finding-field:hover { color: var(--amber-dark); text-decoration: underline; }
.finding-problem { font-size: 0.9rem; color: var(--ink); margin-top: 2px; }
.finding-fix { font-size: 0.86rem; color: var(--grey); margin-top: 3px; }

.fieldnote.finding { background: #fdf6e3; color: #6b5200; }
.fieldnote.finding .finding-fix { color: #6b5200; opacity: 0.85; }

.fieldrow.has-finding { border-left: 3px solid var(--error); }

/* Beim Sprung aus der Befundliste das Ziel kurz hervorheben */
.fieldrow:target { box-shadow: 0 0 0 3px var(--amber), var(--shadow); }

/* --------------------------------- Ausgabe -------------------------------- */

.output-box {
  background: var(--navy); color: #cfe0ec;
  border-radius: var(--radius-lg); padding: 16px;
  font-family: ui-monospace, Consolas, monospace; font-size: 0.78rem;
  max-height: 260px; overflow: auto; white-space: pre; tab-size: 12;
}

.copy-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

.copied { color: var(--success); font-weight: 700; font-size: 0.9rem; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.checklist li:last-child { border-bottom: 0; }
.checklist .mark { flex: none; width: 20px; text-align: center; font-weight: 700; }
.checklist .ok   { color: var(--success); }
.checklist .no   { color: var(--error); }
.checklist .warn { color: var(--warning); }

/* -------------------------------- Anmeldung ------------------------------- */

.login-wrap { max-width: 460px; margin: 60px auto; }
.login-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 34px; text-align: center; }
.login-card img { height: 46px; margin-bottom: 22px; }
.login-card .btn { margin-top: 8px; }

/* ------------------------------- Responsive ------------------------------- */

@media (max-width: 720px) {
  .reference { grid-template-columns: auto 1fr; }
  .reference .score { grid-column: 2; text-align: right; }
  .filter-bar { position: static; }
}

/* Beispielhafte Hausregeln auf der Einstellungsseite */
.rule-example {
  background: var(--navy-10); color: var(--navy);
  border-radius: var(--radius); padding: 10px 12px; margin: 8px 0 0;
  font-size: 0.82rem; line-height: 1.5; white-space: pre-wrap;
  font-family: ui-monospace, Consolas, monospace;
}

/* ------------------------------- Unterlagen ------------------------------- */
/* Zu einem Produkt gehoeren mehrere Unterlagen. Die Liste zeigt, was gelesen
   wurde, welche Unterlage bei Widersprüchen gilt und wie viel jede beitrug. */

p.hint { font-size: 0.82rem; color: var(--grey); margin-top: 10px; }

.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 0.85rem; color: var(--navy);
  text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: var(--amber); }
.link-btn.danger { color: var(--error); }

.doc-list { display: grid; gap: 10px; margin: 12px 0 16px; }

.doc {
  border: 1px solid var(--navy-10);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--white);
}
.doc-empty { background: #fdf6e3; border-color: #e6d9a8; }

.doc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-name { font-weight: 700; color: var(--navy); overflow-wrap: anywhere; }
.doc-meta { margin-left: 4px; }
.doc-actions { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.doc-actions form { display: inline; margin: 0; }
.doc-note { color: #6b5200; margin: 6px 0 0; }
.doc details { margin-top: 8px; }

.doc-add { display: grid; gap: 10px; justify-items: start; }
.doc-add form { width: 100%; }
.doc-add .btn { margin-top: 10px; }

.dropzone-slim { padding: 14px 16px; text-align: left; }
.dropzone-slim p { margin: 0; }

.docs-panel > summary {
  cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
}
.docs-panel > summary::marker { color: var(--navy-40); }
