:root {
  --bg: #f7f7f5;
  --card-bg: #ffffff;
  --border: #e4e4e1;
  --text: #1c1c1a;
  --muted: #6a6a66;
  --accent: #2a5d8f;
  --warn: #b95a2f;
  --bar1: #2a5d8f;
  --bar2: #5d8aa8;
  --bar3: #8eb4cf;
  --cause-delivery: #2a5d8f;
  --cause-factory: #b95a2f;
  --cause-assembly: #4a7a3b;
  --cause-unclear: #7a6a66;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

body {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.dash-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.dash-header h1 {
  font-size: 1.6rem;
  margin: 0;
  font-weight: 600;
}

.dash-meta {
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

main { display: flex; flex-direction: column; gap: 40px; }

section { background: transparent; }

h2 {
  font-size: 1.2rem;
  margin: 0 0 12px;
  font-weight: 600;
}

h3 {
  font-size: 1rem;
  margin: 0 0 12px;
  font-weight: 600;
  color: var(--muted);
}

.muted { color: var(--muted); font-size: 0.9rem; margin: 8px 0 16px; }

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

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}

.card-label { color: var(--muted); font-size: 0.85rem; }
.card-value { font-size: 2rem; font-weight: 600; margin: 4px 0 6px; }
.card-sub { color: var(--muted); font-size: 0.85rem; }
.ratio-bar { height: 6px; background: #fee2e2; border-radius: 3px; overflow: hidden; margin-top: 8px; }
.ratio-bar-fill { display: block; height: 100%; background: #16a34a; transition: width .3s ease; width: 0%; }

.chart-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
}

.chart-wrap svg { display: block; width: 100%; height: auto; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 700px) {
  .two-col { grid-template-columns: 1fr; }
}

.info-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  font-size: 1rem;
}

.info-box .strong { font-weight: 600; }

.repeat-list {
  list-style: decimal;
  padding-left: 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px 12px 36px;
  margin: 0;
}

.repeat-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.repeat-list li:last-child { border-bottom: none; }
.repeat-list .ru-name { font-weight: 600; }
.repeat-list .ru-meta { color: var(--muted); font-size: 0.9rem; margin-left: 8px; }

.activity-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
}
.chip:hover { border-color: var(--muted); }
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.activity-meta { font-size: 0.85rem; }

.activity-feed {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 480px;
  overflow-y: auto;
}
.activity-feed li {
  display: grid;
  grid-template-columns: 80px 110px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.activity-feed li:last-child { border-bottom: none; }
.activity-feed .ts { color: var(--muted); font-variant-numeric: tabular-nums; }
.activity-feed .tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  background: #eef0f3;
  color: var(--text);
  text-align: center;
}
.activity-feed .tag.tag-NEEDS_OP { background: #f7d8d4; }
.activity-feed .tag.tag-SUMMARY  { background: #ececec; }
.activity-feed .tag.tag-POLL     { background: #d9e3ee; }
.activity-feed .tag.tag-ERROR    { background: #f1c39e; }
.activity-feed .tag.tag-AUTO     { background: #dde8d6; }
.activity-feed .tag.tag-CLASSIFY { background: #eaeaea; color: var(--muted); }
.activity-feed .tag.tag-OP       { background: #d6e2ed; }
.activity-feed .body { color: var(--text); }
.activity-feed .tg-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
}
.activity-feed .tg-link:hover { text-decoration: underline; }
.activity-empty {
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.opp-list {
  list-style: decimal;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px 12px 36px;
  margin: 0;
  max-height: 360px;
  overflow-y: auto;
}
.opp-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  justify-content: space-between;
}
.opp-list li:last-child { border-bottom: none; }
.opp-list .opp-text { flex: 1; }
.opp-list .opp-count {
  flex: 0 0 auto;
  background: var(--bar1);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.opp-list .opp-label {
  display: inline-block;
  margin-right: 8px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.theme-bar-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.theme-bar-row .label { flex: 0 0 200px; font-size: 0.9rem; }
.theme-bar-row .total { flex: 0 0 56px; text-align: right; color: var(--muted); font-size: 0.9rem; }
.theme-bar-row .bar-bg {
  flex: 1;
  height: 18px;
  background: var(--bg);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.theme-bar-row .bar-low {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--warn);
}
.theme-bar-row .bar-high {
  position: absolute;
  top: 0; bottom: 0;
  background: var(--bar1);
}

.dash-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 8px;
}
.legend .swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 2px;
  vertical-align: middle;
}

.axis-text { font-size: 11px; fill: var(--muted); }
.grid-line { stroke: var(--border); stroke-width: 1; }
.bar-low { fill: var(--bar1); }
.bar-mid { fill: var(--bar2); }
.bar-hi { fill: var(--bar3); }
.line-main { fill: none; stroke: var(--accent); stroke-width: 2; }
.line-dot { fill: var(--accent); }
.bar-delivery { fill: var(--cause-delivery); }
.bar-factory { fill: var(--cause-factory); }
.bar-assembly { fill: var(--cause-assembly); }
.bar-unclear { fill: var(--cause-unclear); }

.wb-status { margin-bottom: 24px; }
.wb-banner {
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wb-banner.is-fatal { border-left-color: var(--warn); background: #fff6f0; }
.wb-banner.is-ok { border-left-color: #4a7a3b; }
.wb-banner-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
}
.wb-banner-label { color: var(--muted); }
.wb-banner-state { font-weight: 600; }
.wb-banner-error { color: var(--warn); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
.wb-banner-counters b { font-variant-numeric: tabular-nums; }
.wb-banner-times { font-size: 13px; }

/* ---- top-level tabbar -------------------------------------------------- */
.tabbar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  padding: 0 24px;
  margin-top: 4px;
}
.tabbar-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 12px 18px;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabbar-btn.is-active {
  color: var(--text, #0f172a);
  font-weight: 600;
  border-bottom-color: var(--accent, #2563eb);
}
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.logout-form { display: inline; margin-left: 12px; }
.logout-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  padding: 4px 10px;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}
.logout-btn:hover { color: var(--text, #0f172a); }

/* ---- reviews filters --------------------------------------------------- */
.reviews-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin: 12px 0 8px;
}
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-label { color: var(--muted); font-size: 13px; }
.reviews-meta { margin-bottom: 12px; font-size: 13px; }

/* ---- review cards ------------------------------------------------------ */
.reviews-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.review-card {
  background: var(--card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 16px 18px;
  display: grid;
  gap: 10px;
}
.review-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  justify-content: space-between;
}
.review-head .stars { font-size: 16px; letter-spacing: 1px; color: #f59e0b; }
.review-head .stars.r-low { color: #dc2626; }
.review-head .product { font-weight: 600; }
.review-head .nm { color: var(--muted); font-size: 13px; }
.review-head .customer { color: var(--muted); }
.review-head .date { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.review-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border, #e2e8f0);
}
.review-status.s-new { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.review-status.s-replied { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.review-status.s-auto_responded { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.review-status.s-dismissed { background: #f3f4f6; color: #6b7280; border-color: #e5e7eb; }
.badge.b-auto { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }

/* ---- Automation section ------------------------------------------------ */
.automation-section { margin: 1rem 0 1.5rem; }
.automation-bar {
  display: flex; width: 100%; height: 14px; border-radius: 7px;
  overflow: hidden; background: #f1f5f9; margin-top: .75rem;
  border: 1px solid #e2e8f0;
}
.automation-bar .seg { display: block; height: 100%; transition: width .3s ease; }
.automation-bar .seg-auto { background: #8b5cf6; }
.automation-bar .seg-operator { background: #0ea5e9; }
.automation-bar .seg-other { background: #cbd5e1; }
.automation-legend {
  display: flex; gap: 1.25rem; margin-top: .5rem;
  font-size: .85rem; color: #475569; flex-wrap: wrap;
}
.automation-legend .sw {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-right: .35rem; vertical-align: middle;
}
.automation-legend .sw-auto { background: #8b5cf6; }
.automation-legend .sw-operator { background: #0ea5e9; }
.automation-legend .sw-other { background: #cbd5e1; }

.review-body .label { color: var(--muted); font-size: 13px; font-weight: 600; margin-right: 6px; }
.review-body p { margin: 4px 0; line-height: 1.4; white-space: pre-wrap; }
.review-pros .label { color: #047857; }
.review-cons .label { color: #b91c1c; }

.review-photos { display: flex; flex-wrap: wrap; gap: 6px; }
.review-photos img {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--border, #e2e8f0);
  cursor: zoom-in;
}
.video-thumb {
  appearance: none;
  display: inline-block;
  padding: 0;
  width: 72px; height: 72px;
  border-radius: 6px;
  border: 1px solid var(--border, #e2e8f0);
  background: #1e293b;
  color: #fff;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  font: inherit;
  vertical-align: top;
}
.video-thumb:focus-visible { outline: 2px solid var(--accent, #2563eb); outline-offset: 2px; }
.video-thumb-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.95);
}
.video-thumb-play::after {
  content: "";
  position: absolute;
  top: 50%; left: 56%;
  transform: translate(-50%, -50%);
  width: 0; height: 0;
  border-left: 10px solid #1e293b;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}

.review-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #475569;
  border: 1px solid #e5e7eb;
}
.badge.b-sent-pos { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge.b-sent-neg { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge.b-weird-hi { background: #fef3c7; color: #92400e; border-color: #fde68a; }

.reply-box { display: grid; gap: 8px; margin-top: 6px; }
.reply-box .label { color: var(--muted); font-size: 13px; }
.reply-box textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  padding: 8px 10px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
.reply-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.reply-actions button {
  appearance: none;
  font: inherit;
  border-radius: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border, #cbd5e1);
  background: #fff;
  cursor: pointer;
}
.reply-actions .btn-primary {
  background: var(--accent, #2563eb);
  color: #fff;
  border-color: var(--accent, #2563eb);
}
.reply-actions .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.reply-actions .btn-danger { color: #b91c1c; }
.reply-error { color: #b91c1c; font-size: 13px; }
.reply-ok { color: #047857; font-size: 13px; }

/* ---- lightbox ---------------------------------------------------------- */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.video-lightbox video {
  max-width: 100%; max-height: 100%;
  width: min(1080px, 96vw);
  background: #000;
  border-radius: 8px;
  outline: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.video-lightbox-spinner {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 48px; height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: video-spin 0.9s linear infinite;
  pointer-events: none;
}
.video-lightbox-spinner[hidden] { display: none; }
@keyframes video-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.video-lightbox-error {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  background: rgba(127, 29, 29, 0.9);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  max-width: 80vw;
  text-align: center;
}
.video-lightbox-error[hidden] { display: none; }
.lightbox-close {
  position: absolute; top: 16px; right: 24px;
  appearance: none; background: transparent; border: 0;
  color: #fff; font-size: 32px; cursor: pointer;
}

/* ---- login page -------------------------------------------------------- */
.login-body {
  min-height: 100vh; margin: 0;
  display: flex; align-items: center; justify-content: center;
  background: #f8fafc;
}
.login-card {
  background: #fff; border: 1px solid var(--border, #e2e8f0); border-radius: 12px;
  padding: 32px 36px; width: min(360px, 92vw);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.login-card h1 { margin: 0 0 4px; }
.login-form { display: grid; gap: 12px; margin-top: 18px; }
.login-form label { display: grid; gap: 4px; font-size: 14px; }
.login-form input {
  padding: 8px 10px; border: 1px solid var(--border, #cbd5e1); border-radius: 6px; font: inherit;
}
.login-form button {
  appearance: none; padding: 10px; border: 0; border-radius: 6px;
  background: var(--accent, #2563eb); color: #fff; font: inherit; cursor: pointer;
}
.login-error { color: #b91c1c; font-size: 13px; margin: 0; }

/* ───────── PDF "open documentation" button + modal ───────── */

.review-pdf-row { margin: 10px 0 6px; }
.btn-pdf {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  font: inherit; font-size: 13px;
  border: 1px solid var(--border, #cbd5e1); border-radius: 999px;
  background: #f1f5f9; color: #0f172a;
  transition: background 0.15s, border-color 0.15s;
}
.btn-pdf:hover { background: #e2e8f0; border-color: #94a3b8; }
.btn-pdf:focus-visible {
  outline: 2px solid var(--accent, #2563eb); outline-offset: 1px;
}

.pdf-modal {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
}
.pdf-modal[hidden] { display: none; }
.pdf-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.pdf-modal-window {
  position: relative;
  width: min(1100px, 92vw); height: min(88vh, 900px);
  background: #fff; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.pdf-modal-head {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: #f8fafc;
}
.pdf-modal-title {
  flex: 1; min-width: 0;
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pdf-modal-link {
  font-size: 13px; color: var(--accent, #2563eb); text-decoration: none;
}
.pdf-modal-link:hover { text-decoration: underline; }
.pdf-modal-close {
  appearance: none; cursor: pointer;
  width: 32px; height: 32px; padding: 0;
  border: 0; background: transparent;
  font: inherit; font-size: 22px; line-height: 1;
  color: #475569; border-radius: 6px;
}
.pdf-modal-close:hover { background: #e2e8f0; color: #0f172a; }
.pdf-modal-frame {
  flex: 1; width: 100%; border: 0; background: #1e293b;
}

body.is-modal-open { overflow: hidden; }

/* ─── Coverage tab ───────────────────────────────────────────────────────── */
.cov-head { margin-bottom: 1rem; }
.cov-summary {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin: .75rem 0 1rem;
}
.cov-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .6rem; border-radius: 999px;
  background: #f3f4f6; color: #374151;
  font-size: .82rem; line-height: 1;
}
.cov-chip b { font-weight: 600; }
.cov-chip.is-bad { background: #fee2e2; color: #991b1b; }
.cov-chip.is-warn { background: #fef3c7; color: #92400e; }
.cov-chip.is-good { background: #dcfce7; color: #166534; }
.cov-chip.is-loading { background: #f3f4f6; color: #6b7280; font-style: italic; }

.cov-filters {
  display: flex; flex-wrap: wrap; gap: .35rem;
  padding: .5rem 0; margin-bottom: .75rem;
  align-items: center;
}
.cov-filter {
  background: #fff; border: 1px solid #d1d5db; color: #374151;
  padding: .3rem .7rem; border-radius: 999px; font-size: .82rem;
  cursor: pointer; transition: all .12s ease;
}
.cov-filter:hover { border-color: #9ca3af; }
.cov-filter.is-active { background: #1f2937; color: #fff; border-color: #1f2937; }

.cov-search-wrap { margin-left: auto; }
.cov-search-wrap input {
  padding: .35rem .65rem; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: .85rem; min-width: 200px;
}

.cov-table-wrap { overflow-x: auto; border: 1px solid #e5e7eb; border-radius: 8px; }
.cov-table {
  width: 100%; border-collapse: collapse; background: #fff;
  font-size: .88rem;
}
.cov-table .cov-th {
  text-align: left; padding: .55rem .75rem;
  background: #f9fafb; border-bottom: 1px solid #e5e7eb;
  font-weight: 600; color: #374151; font-size: .82rem;
  position: sticky; top: 0; z-index: 1;
}
.cov-table .cov-th.sortable { cursor: pointer; user-select: none; }
.cov-table .cov-th.sortable:hover { background: #f3f4f6; }
.cov-table .cov-th[data-sort-active="asc"]::after { content: " ▲"; font-size: .7rem; color: #6b7280; }
.cov-table .cov-th[data-sort-active="desc"]::after { content: " ▼"; font-size: .7rem; color: #6b7280; }
.cov-table tbody td {
  padding: .55rem .75rem; border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}
.cov-table tbody tr:hover { background: #fafafa; }
.cov-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.cov-flag {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  font-size: .75rem; line-height: 1.4; white-space: nowrap;
  background: #f3f4f6; color: #374151;
}
.cov-flag.is-bad { background: #fee2e2; color: #991b1b; }
.cov-flag.is-warn { background: #fef3c7; color: #92400e; }
.cov-flag.is-good { background: #dcfce7; color: #166534; }
.cov-flag.is-ok { background: #e5e7eb; color: #4b5563; }

.cov-orphans { margin-top: 1.5rem; }
.cov-orphans h3 { margin-bottom: .5rem; font-size: 1rem; }
.cov-orphan-list { list-style: none; padding: 0; margin: 0; }
.cov-orphan-list li {
  display: flex; align-items: center; gap: .6rem;
  padding: .35rem 0; border-bottom: 1px solid #f3f4f6;
}

/* Autoreplies tab — bucket template editor. */
.autorep-head { margin-bottom: 1rem; }
.autorep-head code {
  background: #f1f5f9; padding: 1px 6px; border-radius: 4px;
  font-size: .9em;
}
.autorep-status { min-height: 1.5rem; margin: .5rem 0; font-size: .9rem; }
.autorep-status.is-info { color: #475569; }
.autorep-status.is-ok { color: #15803d; }
.autorep-status.is-error { color: #b91c1c; }
.autorep-form { display: block; }
.autorep-buckets {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1rem; margin-bottom: 1rem;
}
.autorep-bucket {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: .9rem 1rem; display: flex; flex-direction: column; gap: .5rem;
}
.autorep-label { font-weight: 600; color: #1f2937; }
.autorep-textarea {
  width: 100%; box-sizing: border-box; font-family: inherit; font-size: .95rem;
  line-height: 1.4; padding: .55rem .7rem; border: 1px solid #cbd5e1;
  border-radius: 6px; resize: vertical; min-height: 90px;
}
.autorep-textarea:focus { outline: 2px solid #6366f1; outline-offset: 1px; }
.autorep-default { font-size: .8rem; line-height: 1.4; }
.autorep-default span { color: #475569; font-style: normal; }
.link-btn {
  background: none; border: none; padding: 0; margin: 0;
  color: #2563eb; cursor: pointer; font: inherit; text-decoration: underline;
}
.link-btn:hover { color: #1d4ed8; }
.autorep-actions { display: flex; gap: .6rem; align-items: center; }
.autorep-actions .btn,
.autorep-actions .btn-primary {
  padding: .5rem 1rem; border-radius: 6px; border: 1px solid #cbd5e1;
  background: #f8fafc; cursor: pointer; font: inherit;
}
.autorep-actions .btn-primary {
  background: #2563eb; color: #fff; border-color: #2563eb;
}
.autorep-actions .btn-primary:hover { background: #1d4ed8; }
.autorep-actions .btn:hover { background: #e2e8f0; }
.autorep-actions .btn[disabled],
.autorep-actions .btn-primary[disabled] { opacity: .6; cursor: not-allowed; }

/* Footer link to system state (replaces the dedicated tab). */
.dash-footer-link {
  color: #2563eb; text-decoration: none; margin-left: .35rem;
}
.dash-footer-link::before { content: "· "; color: #94a3b8; margin-right: .2rem; }
.dash-footer-link:hover { text-decoration: underline; }

/* Inline link at the bottom of the KB browser to the coverage view. */
.kbb-footer-links {
  margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #e5e7eb;
  font-size: .9rem; color: #64748b;
}
.kbb-footer-links a {
  color: #2563eb; text-decoration: none;
}
.kbb-footer-links a:hover { text-decoration: underline; }
