:root {
  --bg: #f5f6f8;
  --card-bg: #ffffff;
  --border: #e2e4e9;
  --text: #1c2129;
  --text-muted: #6b7280;
  --brand: #d0431e; /* couleur GS1 */
  --brand-dark: #a83417;
  --mn: #2563eb;
  --mn-bg: #eff6ff;
  --bs: #059669;
  --bs-bg: #ecfdf5;
  --both-bg: #f0fdf4;
  --both-border: #86efac;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

header {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  padding: 24px 20px;
}

header .inner {
  max-width: 900px;
  margin: 0 auto;
}

header h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

header p {
  margin: 0;
  opacity: 0.9;
  font-size: 14px;
}

.status-bar {
  max-width: 900px;
  margin: -18px auto 0;
  padding: 0 20px;
}

.status-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}

.status-card #conn-status {
  font-size: 13px;
  color: var(--text-muted);
}
.status-card #conn-status.connected::before {
  content: "● ";
  color: var(--bs);
}
.status-card #conn-status.error::before {
  content: "● ";
  color: #dc2626;
}
.status-card #conn-status.warn::before {
  content: "● ";
  color: #d97706;
}
.status-card #conn-status.warn {
  color: #92400e;
}

.progress-group {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.progress-item {
  min-width: 140px;
}

.progress-item .p-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.progress-item .p-bar {
  height: 8px;
  border-radius: 4px;
  background: #eceef1;
  overflow: hidden;
}

.progress-item .p-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-item.mn .p-fill { background: var(--mn); }
.progress-item.bs .p-fill { background: var(--bs); }
.progress-item.both .p-fill { background: #16a34a; }

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.section {
  margin-bottom: 28px;
}

.section h2 {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--brand-dark);
  border-bottom: 2px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.item-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: background 0.2s, border-color 0.2s;
}

.item-card.both-checked {
  background: var(--both-bg);
  border-color: var(--both-border);
}

.item-card.group-header {
  background: transparent;
  border: none;
  padding: 4px 4px 2px;
  margin-bottom: 4px;
}

.item-card .item-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.item-card .item-id {
  font-weight: 700;
  font-size: 13px;
  color: var(--brand-dark);
  flex-shrink: 0;
  min-width: 34px;
}

.item-card.subitem .item-id {
  color: var(--text-muted);
  font-weight: 600;
}

.item-card.subitem {
  margin-left: 20px;
  padding: 10px 14px;
}

.item-card .item-text {
  font-size: 14.5px;
}

.verifiers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 560px) {
  .verifiers { grid-template-columns: 1fr; }
}

.verifier-block {
  border-radius: 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
}

.verifier-block.mn { background: var(--mn-bg); }
.verifier-block.bs { background: var(--bs-bg); }

.verifier-block .v-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.verifier-block.mn .v-check { color: var(--mn); }
.verifier-block.bs .v-check { color: var(--bs); }

.verifier-block input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: currentColor;
}

.verifier-block textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12.5px;
  font-family: inherit;
  resize: vertical;
  min-height: 32px;
  background: #fff;
}

.verifier-block textarea::placeholder {
  color: #a3a9b3;
}

.group-title {
  font-weight: 600;
  font-size: 14px;
}

.fr-tooltip-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-self: flex-start;
}

.fr-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.fr-btn:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.fr-tooltip-wrap.open .fr-btn {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.fr-tooltip {
  display: none;
  position: absolute;
  top: 26px;
  right: 0;
  z-index: 20;
  width: 260px;
  max-width: 70vw;
  background: #1c2129;
  color: #fff;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.fr-tooltip-wrap.open .fr-tooltip {
  display: block;
}

@media (max-width: 560px) {
  .fr-tooltip {
    right: auto;
    left: 0;
  }
}

footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 20px;
}

.save-indicator {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 6px;
  opacity: 0;
  transition: opacity 0.3s;
}
.save-indicator.show { opacity: 1; }
