:root {
  color-scheme: light;
  --ba-ink: #1d2630;
  --ba-muted: #6b7784;
  --ba-line: #e3e8ec;
  --ba-bg: #f5f7f9;
  --ba-panel: #ffffff;
  --ba-blue: #1769e0;
  --ba-blue-soft: #eaf2ff;
  --ba-teal: #087d72;
  --ba-teal-soft: #e7f6f3;
  --ba-green: #16834b;
  --ba-green-soft: #eaf7ef;
  --ba-orange: #b85d0a;
  --ba-orange-soft: #fff3e5;
  --ba-red: #c23b35;
  --ba-red-soft: #fff0ee;
  --ba-radius: 8px;
  --ba-sidebar-width: 226px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ba-bg);
}

body {
  margin: 0;
  color: var(--ba-ink);
  background: var(--ba-bg);
  font: 14px/1.55 "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(23, 105, 224, 0.35);
  outline-offset: 2px;
}

.ba-shell {
  min-height: 100vh;
}

.ba-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--ba-sidebar-width);
  flex-direction: column;
  padding: 18px 12px 14px;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid var(--ba-line);
}

.ba-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 20px;
}

.ba-brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  flex: none;
  border-radius: 8px;
  color: #fff;
  background: var(--ba-blue);
  font-size: 17px;
  font-weight: 700;
}

.ba-brand div {
  display: grid;
  min-width: 0;
}

.ba-brand strong {
  font-size: 17px;
  line-height: 1.25;
}

.ba-brand small {
  margin-top: 2px;
  overflow: hidden;
  color: #8b959f;
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ba-back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 12px;
  padding: 8px 10px;
  border-radius: 6px;
  color: #64717d;
  font-size: 12px;
  text-decoration: none;
}

.ba-back-link:hover {
  color: var(--ba-blue);
  background: #f4f7fb;
}

.ba-back-link svg,
.ba-tab svg,
.ba-source-status svg,
.ba-icon-button svg,
.ba-button svg,
.ba-search-filter svg {
  width: 16px;
  height: 16px;
  flex: none;
  stroke-width: 1.8;
}

.ba-tabs {
  display: grid;
  gap: 3px;
}

.ba-tab {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 0;
  border-radius: 6px;
  color: #53606c;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.ba-tab:hover {
  color: var(--ba-ink);
  background: #f4f6f8;
}

.ba-tab.active {
  color: var(--ba-blue);
  background: var(--ba-blue-soft);
  font-weight: 600;
}

.ba-source-status {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-top: auto;
  padding: 11px 10px;
  border: 1px solid var(--ba-line);
  border-radius: 7px;
  color: #586571;
  background: #fafbfc;
  text-align: left;
  cursor: pointer;
}

.ba-source-status:hover {
  background: #f4f7f9;
}

.ba-source-status span:nth-child(2) {
  display: grid;
  min-width: 0;
}

.ba-source-status strong,
.ba-source-status small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ba-source-status strong {
  color: var(--ba-ink);
  font-size: 11px;
}

.ba-source-status small {
  margin-top: 2px;
  color: #8b959f;
  font-size: 10px;
}

.ba-source-status > svg {
  width: 13px;
  color: #a2abb3;
}

.ba-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aab3bc;
}

.ba-status-dot.ok {
  background: var(--ba-green);
  box-shadow: 0 0 0 3px var(--ba-green-soft);
}

.ba-status-dot.warn {
  background: var(--ba-orange);
  box-shadow: 0 0 0 3px var(--ba-orange-soft);
}

.ba-status-dot.error {
  background: var(--ba-red);
  box-shadow: 0 0 0 3px var(--ba-red-soft);
}

.ba-main {
  min-width: 0;
  margin-left: var(--ba-sidebar-width);
  padding: 0 24px 48px;
}

.ba-topbar {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 -24px 16px;
  padding: 11px 24px;
  background: #fff;
  border-bottom: 1px solid var(--ba-line);
}

.ba-eyebrow {
  margin: 0 0 3px;
  color: var(--ba-blue);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0;
}

.ba-topbar h1,
.ba-panel h2,
.ba-report-heading h2,
.ba-modal h2 {
  margin: 0;
  color: var(--ba-ink);
  font-size: 20px;
  font-weight: 600;
}

.ba-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ba-updated {
  margin-right: 3px;
  color: #8a949e;
  font-size: 11px;
}

.ba-icon-button {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--ba-line);
  border-radius: 6px;
  color: #5f6c77;
  background: #fff;
  cursor: pointer;
}

.ba-icon-button:hover {
  border-color: #c7d0d8;
  color: var(--ba-blue);
  background: #f8fafc;
}

.ba-filterbar {
  display: grid;
  grid-template-columns: repeat(9, minmax(104px, 1fr)) minmax(210px, 1.6fr) 32px;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--ba-line);
  border-radius: var(--ba-radius);
  background: #fff;
}

.ba-filterbar label {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: #7d8892;
  font-size: 10px;
  font-weight: 600;
}

.ba-filterbar input,
.ba-filterbar select,
.ba-settings-form input,
.ba-settings-form textarea,
.ba-filter-register input {
  width: 100%;
  min-width: 0;
  height: 31px;
  padding: 0 9px;
  border: 1px solid var(--ba-line);
  border-radius: 6px;
  color: #46535e;
  background: #fff;
  font-size: 12px;
}

.ba-filterbar input:focus,
.ba-filterbar select:focus,
.ba-settings-form input:focus,
.ba-settings-form textarea:focus,
.ba-filter-register input:focus {
  border-color: var(--ba-blue);
  box-shadow: 0 0 0 2px rgba(23, 105, 224, 0.09);
  outline: none;
}

.ba-search-filter {
  position: relative;
  display: flex !important;
  align-items: center;
  gap: 7px !important;
  height: 31px;
  padding: 0 9px;
  border: 1px solid var(--ba-line);
  border-radius: 6px;
  background: #fff;
}

.ba-search-filter svg {
  width: 14px;
  color: #98a2ab;
}

.ba-search-filter input {
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.ba-search-filter:focus-within {
  border-color: var(--ba-blue);
  box-shadow: 0 0 0 2px rgba(23, 105, 224, 0.09);
}

.ba-list-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px 0 12px;
}

.ba-local-search {
  width: min(460px, 100%);
}

.ba-heading-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.ba-filter-clear {
  display: grid;
  width: 32px;
  height: 31px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--ba-line);
  border-radius: 6px;
  color: #7f8b95;
  background: #fff;
  cursor: pointer;
}

.ba-filter-clear:hover {
  color: var(--ba-red);
  border-color: #f1c6c3;
  background: var(--ba-red-soft);
}

.ba-quality-bar {
  display: none;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #f0d7ba;
  border-radius: var(--ba-radius);
  color: #8a5518;
  background: #fffaf4;
  font-size: 12px;
}

.ba-quality-bar.visible {
  display: flex;
}

.ba-quality-bar strong {
  flex: none;
}

.ba-view {
  display: none;
  min-width: 0;
}

.ba-view.active {
  display: block;
}

.ba-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.ba-metric {
  position: relative;
  min-width: 0;
  min-height: 104px;
  padding: 14px 15px 12px;
  border: 1px solid var(--ba-line);
  border-radius: var(--ba-radius);
  background: #fff;
}

.ba-metric::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 8px 0 0 8px;
  background: #c7d0d8;
  content: "";
}

.ba-metric.blue::before {
  background: var(--ba-blue);
}

.ba-metric.teal::before {
  background: var(--ba-teal);
}

.ba-metric.orange::before {
  background: var(--ba-orange);
}

.ba-metric.red::before {
  background: var(--ba-red);
}

.ba-metric span {
  display: block;
  overflow: hidden;
  color: #73808b;
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ba-metric strong {
  display: block;
  margin: 10px 0 5px;
  overflow: hidden;
  color: var(--ba-ink);
  font-family: "DM Mono", monospace;
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ba-metric small {
  display: block;
  overflow: hidden;
  color: #99a3ac;
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ba-metric.missing strong {
  color: #a36a2e;
  font-family: inherit;
  font-size: 18px;
}

.ba-split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 12px;
  margin-bottom: 12px;
}

.ba-split-chart {
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
}

.ba-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--ba-line);
  border-radius: var(--ba-radius);
  background: var(--ba-panel);
}

.ba-view > .ba-panel + .ba-panel,
.ba-view > .ba-panel + .ba-trend-panel {
  margin-top: 12px;
}

.ba-panel-heading {
  display: flex;
  min-height: 39px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ba-panel h2,
.ba-report-heading h2,
.ba-modal h2 {
  font-size: 16px;
}

.ba-panel-heading p,
.ba-report-heading > div > p:last-child {
  margin: 3px 0 0;
  color: #8a949e;
  font-size: 11px;
}

.ba-engine-badge,
.ba-count-label {
  flex: none;
  color: #84909a;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.ba-engine-badge {
  padding: 3px 7px;
  border-radius: 4px;
  color: var(--ba-teal);
  background: var(--ba-teal-soft);
}

.ba-action-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ba-action-list li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid #f0f2f4;
}

.ba-action-list li:first-child {
  border-top: 0;
  padding-top: 2px;
}

.ba-action-index {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: var(--ba-blue);
  background: var(--ba-blue-soft);
  font-family: "DM Mono", monospace;
  font-size: 10px;
  font-weight: 500;
}

.ba-action-list strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ba-ink);
  font-size: 12px;
}

.ba-action-list p {
  margin: 0;
  color: #76828d;
  font-size: 11px;
}

.ba-action-target {
  align-self: center;
  color: var(--ba-blue);
  font-size: 11px;
  white-space: nowrap;
}

.ba-comparison-list {
  display: grid;
  gap: 2px;
}

.ba-comparison-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 62px 62px 58px;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f2f4;
  font-size: 11px;
}

.ba-comparison-row:last-child {
  border-bottom: 0;
}

.ba-comparison-row > span:first-child {
  color: #63707b;
}

.ba-comparison-row b {
  color: var(--ba-ink);
  font-family: "DM Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  text-align: right;
}

.ba-comparison-delta {
  justify-self: end;
  font-family: "DM Mono", monospace;
  font-size: 10px;
}

.ba-comparison-delta.up {
  color: var(--ba-green);
}

.ba-comparison-delta.down {
  color: var(--ba-red);
}

.ba-comparison-delta.flat,
.ba-comparison-delta.missing {
  color: #a0a9b1;
}

.ba-source-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ba-source-item {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #edf0f2;
  border-radius: 6px;
  background: #fafbfc;
}

.ba-source-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ba-source-item strong {
  overflow: hidden;
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ba-source-item p {
  margin: 5px 0 0;
  overflow: hidden;
  color: #8a949e;
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ba-source-chip,
.ba-status-chip,
.ba-level-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.ba-source-chip.ok,
.ba-status-chip.ok,
.ba-status-chip.ready,
.ba-status-chip.sent {
  color: var(--ba-green);
  background: var(--ba-green-soft);
}

.ba-source-chip.partial,
.ba-status-chip.partial,
.ba-status-chip.incomplete,
.ba-status-chip.pending {
  color: var(--ba-orange);
  background: var(--ba-orange-soft);
}

.ba-source-chip.error,
.ba-status-chip.error,
.ba-status-chip.failed {
  color: var(--ba-red);
  background: var(--ba-red-soft);
}

.ba-source-chip.missing,
.ba-status-chip.missing,
.ba-status-chip.not_collected {
  color: #697680;
  background: #eff2f4;
}

.ba-level-summary,
.ba-trend-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.ba-level-summary button,
.ba-trend-kpis article {
  display: grid;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid var(--ba-line);
  border-radius: var(--ba-radius);
  background: #fff;
  text-align: left;
}

.ba-level-summary button {
  cursor: pointer;
}

.ba-level-summary button:hover {
  border-color: #b9cde9;
  background: #f9fbff;
}

.ba-chat-quality {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.ba-chat-quality.good {
  color: var(--ba-green);
  background: var(--ba-green-soft);
}

.ba-chat-quality.watch {
  color: #8a5a10;
  background: #fff6df;
}

.ba-chat-quality.risk {
  color: var(--ba-red);
  background: var(--ba-red-soft);
}

.ba-service-area {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  margin-left: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.ba-service-area.in_scope {
  color: var(--ba-green);
  background: var(--ba-green-soft);
}

.ba-service-area.out_of_scope {
  color: var(--ba-red);
  background: var(--ba-red-soft);
}

.ba-service-area.needs_confirmation {
  color: #8a5a10;
  background: #fff6df;
}

.ba-level-summary span,
.ba-trend-kpis span {
  color: #78848e;
  font-size: 11px;
}

.ba-level-summary strong,
.ba-trend-kpis strong {
  margin: 5px 0 2px;
  color: var(--ba-ink);
  font-family: "DM Mono", monospace;
  font-size: 24px;
  font-weight: 500;
}

.ba-level-summary small,
.ba-trend-kpis small {
  color: #96a0a9;
  font-size: 10px;
}

.ba-level-score {
  display: inline-flex;
  width: fit-content;
  margin-top: 5px;
  padding: 1px 6px;
  border-radius: 4px;
  color: #52606c;
  background: #f0f3f6;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  white-space: nowrap;
}

.ba-level-reason {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 5px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ba-knowledge-intro,
.ba-knowledge-overview,
.ba-knowledge-section {
  border: 1px solid var(--ba-line);
  border-radius: var(--ba-radius);
  background: #fff;
}

.ba-knowledge-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
  padding: 18px 20px;
}

.ba-knowledge-intro h2,
.ba-knowledge-overview h2,
.ba-knowledge-section h2 {
  margin: 2px 0 7px;
  font-size: 18px;
}

.ba-knowledge-intro p:last-child,
.ba-knowledge-overview p,
.ba-knowledge-section-note,
.ba-knowledge-card p {
  margin: 0;
  color: var(--ba-muted);
  font-size: 12px;
}

.ba-knowledge-content {
  display: grid;
  gap: 12px;
}

.ba-knowledge-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 20px;
  padding: 20px;
}

.ba-knowledge-facts {
  display: grid;
  gap: 8px;
}

.ba-knowledge-facts article {
  padding: 10px 12px;
  border-left: 3px solid var(--ba-teal);
  background: #f7faf9;
}

.ba-knowledge-facts span {
  color: #78848e;
  font-size: 10px;
  font-weight: 600;
}

.ba-knowledge-facts p {
  margin-top: 3px;
  line-height: 1.65;
}

.ba-knowledge-section {
  padding: 18px 20px;
}

.ba-knowledge-section-note {
  margin: -3px 0 13px;
}

.ba-knowledge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.ba-knowledge-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid #e8edf0;
  border-radius: 6px;
  background: #fbfcfd;
}

.ba-knowledge-card h3 {
  margin: 0 0 5px;
  font-size: 13px;
}

.ba-knowledge-tag-list {
  padding-top: 2px;
}

.ba-knowledge-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 19px;
  color: #4e5c68;
  font-size: 12px;
}

.ba-level-rule-thresholds {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.ba-level-rule-thresholds article {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--ba-line);
  border-radius: 6px;
  background: #fbfcfd;
}

.ba-level-rule-thresholds strong {
  margin-top: 4px;
  font-size: 12px;
}

.ba-level-rule-thresholds span,
.ba-level-rule-thresholds p,
.ba-level-rule-list p {
  margin: 0;
  color: var(--ba-muted);
  font-size: 11px;
}

.ba-level-rule-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--ba-line);
  border-radius: 6px;
  background: var(--ba-line);
}

.ba-level-rule-list article {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) 80px minmax(0, 1.8fr);
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: #fff;
}

.ba-score-delta {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  font-weight: 600;
}

.ba-score-delta.positive {
  color: var(--ba-green);
}

.ba-score-delta.negative {
  color: var(--ba-red);
}

.ba-table-wrap {
  width: 100%;
  min-width: 0;
  overflow: auto;
  border: 1px solid #edf0f2;
  border-radius: 6px;
}

.ba-table-short {
  max-height: 430px;
}

.ba-table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  table-layout: fixed;
}

.ba-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 9px 11px;
  color: #56636e;
  background: #f7f9fa;
  border-bottom: 1px solid var(--ba-line);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.ba-table td {
  padding: 10px 11px;
  border-bottom: 1px solid #f0f2f4;
  color: #5d6974;
  font-size: 11px;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.ba-table tbody tr:last-child td {
  border-bottom: 0;
}

.ba-table tbody tr:hover td {
  background: #fbfcfd;
}

.ba-table td > strong,
.ba-cell-title {
  display: block;
  color: var(--ba-ink);
  font-size: 12px;
  font-weight: 600;
}

.ba-cell-sub {
  display: block;
  margin-top: 3px;
  color: #8e99a2;
  font-size: 10px;
}

.ba-ellipsis {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ba-empty-cell {
  padding: 34px 16px !important;
  color: #919ca5 !important;
  text-align: center;
}

.ba-text-button {
  padding: 0;
  border: 0;
  color: var(--ba-blue);
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ba-text-button:hover {
  color: #0e56bd;
}

.ba-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.ba-table-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  color: #66737f;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ba-table-action:hover {
  color: var(--ba-blue);
}

.ba-table-action.restore {
  color: var(--ba-green);
}

.ba-table-action svg {
  width: 13px;
  height: 13px;
}

.ba-row-excluded td {
  background: #fafbfc;
}

.ba-excluded-chip {
  display: inline-flex;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  color: #7b674e;
  background: #f4efe7;
  font-size: 9px;
  font-weight: 600;
  vertical-align: middle;
}

.ba-new-customer-chip {
  display: inline-flex;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  color: #0d5e56;
  background: #e6f5f3;
  font-size: 9px;
  font-weight: 700;
  vertical-align: middle;
}

.ba-filter-register {
  display: grid;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ba-line);
}

.ba-baseline-register {
  margin-top: 18px;
  padding-top: 18px;
  padding-bottom: 0;
  border-top: 1px solid var(--ba-line);
  border-bottom: 0;
}

.ba-baseline-register h3 {
  margin: 0;
  color: var(--ba-ink);
  font-size: 14px;
}

.ba-baseline-register form {
  display: grid;
  gap: 10px;
}

.ba-filter-register label {
  display: grid;
  gap: 5px;
  color: #6f7c87;
  font-size: 11px;
  font-weight: 600;
}

.ba-filter-register-actions {
  display: flex;
  justify-content: flex-end;
}

.ba-filter-register-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 10px;
}

.ba-filter-register-heading .ba-search-filter {
  width: min(420px, 100%);
}

.ba-level-chip.S {
  color: #9b3f00;
  background: #fff0df;
}

.ba-level-chip.A {
  color: var(--ba-red);
  background: var(--ba-red-soft);
}

.ba-level-chip.B {
  color: var(--ba-blue);
  background: var(--ba-blue-soft);
}

.ba-level-chip.C {
  color: #65727c;
  background: #eff2f4;
}

.ba-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ba-tag {
  display: inline-flex;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 4px;
  color: #52606b;
  background: #f1f4f6;
  font-size: 10px;
}

.ba-pagination {
  display: flex;
  min-height: 35px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 10px;
  color: #89939d;
  font-size: 10px;
}

.ba-pagination button {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--ba-line);
  border-radius: 5px;
  color: #596672;
  background: #fff;
  cursor: pointer;
}

.ba-pagination button:disabled {
  color: #c4cbd1;
  background: #f8f9fa;
  cursor: not-allowed;
}

.ba-pagination button svg {
  width: 14px;
  height: 14px;
}

.ba-chart {
  display: block;
  width: 100%;
  height: 260px;
}

.ba-chart-tall {
  height: 360px;
}

.ba-chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: #7f8a94;
  font-size: 10px;
}

.ba-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ba-chart-legend i {
  display: inline-block;
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: var(--ba-blue);
}

.ba-chart-legend i.message {
  background: var(--ba-teal);
}

.ba-chart-legend i.repeat {
  background: var(--ba-orange);
}

.ba-report-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 16px 18px;
  border: 1px solid var(--ba-line);
  border-radius: var(--ba-radius);
  background: #fff;
}

.ba-report-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ba-button {
  display: inline-flex;
  height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--ba-blue);
  border-radius: 6px;
  color: #fff;
  background: var(--ba-blue);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.ba-button:hover {
  border-color: #0c58c4;
  background: #0c58c4;
}

.ba-button.secondary {
  border-color: var(--ba-line);
  color: #56636f;
  background: #fff;
}

.ba-button.secondary:hover {
  border-color: #c6d0d8;
  background: #f8fafb;
}

.ba-report-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.ba-report-list {
  display: grid;
  max-height: 750px;
  gap: 6px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--ba-line);
  border-radius: var(--ba-radius);
  background: #fff;
}

.ba-report-list button {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 11px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.ba-report-list button:hover {
  background: #f7f9fb;
}

.ba-report-list button.active {
  border-color: #bfd4f2;
  background: var(--ba-blue-soft);
}

.ba-report-list strong {
  overflow: hidden;
  color: var(--ba-ink);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ba-report-list span,
.ba-report-list small {
  color: #89939c;
  font-size: 10px;
}

.ba-report-list .ba-report-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ba-report-sheet {
  min-height: 540px;
  padding: 24px 26px;
  border: 1px solid var(--ba-line);
  border-radius: var(--ba-radius);
  background: #fff;
}

.ba-report-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ba-line);
}

.ba-report-sheet h2 {
  margin: 0;
  color: var(--ba-ink);
  font-size: 24px;
  font-weight: 600;
}

.ba-report-sheet-meta {
  margin: 6px 0 0;
  color: #89949d;
  font-size: 10px;
}

.ba-report-summary {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-left: 3px solid var(--ba-blue);
  background: #f7faff;
}

.ba-report-summary p {
  margin: 0 0 4px;
  color: #4d5a65;
  font-size: 12px;
}

.ba-report-section {
  margin-top: 22px;
}

.ba-report-section h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
  color: var(--ba-ink);
  font-size: 14px;
  font-weight: 600;
}

.ba-report-section h3::before {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--ba-blue);
  content: "";
}

.ba-report-section ul,
.ba-report-section ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
  color: #56636e;
  font-size: 12px;
}

.ba-report-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ba-report-kpis div {
  padding: 10px;
  border: 1px solid #edf0f2;
  border-radius: 6px;
  background: #fafbfc;
}

.ba-report-kpis span {
  display: block;
  color: #89949d;
  font-size: 10px;
}

.ba-report-kpis strong {
  display: block;
  margin-top: 4px;
  color: var(--ba-ink);
  font-family: "DM Mono", monospace;
  font-size: 18px;
  font-weight: 500;
}

.ba-empty-state {
  display: grid;
  min-height: 360px;
  place-items: center;
  padding: 40px 20px;
  color: #8e99a2;
  text-align: center;
}

.ba-empty-state div {
  display: grid;
  justify-items: center;
  gap: 7px;
}

.ba-empty-state svg {
  width: 30px;
  height: 30px;
  color: #b1bac2;
}

.ba-empty-state strong {
  color: #596672;
  font-size: 14px;
}

.ba-empty-state p {
  max-width: 380px;
  margin: 0;
  font-size: 11px;
}

.ba-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22, 30, 38, 0.34);
}

.ba-modal-backdrop[hidden] {
  display: none;
}

.ba-modal {
  display: flex;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--ba-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 50px rgba(22, 30, 38, 0.2);
}

.ba-modal-wide {
  width: min(980px, calc(100vw - 32px));
}

.ba-modal-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 17px;
  border-bottom: 1px solid var(--ba-line);
}

.ba-modal-header h2 {
  font-size: 16px;
}

.ba-modal-body {
  min-height: 0;
  overflow-y: auto;
  padding: 17px;
}

.ba-timeline-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.ba-timeline-summary div {
  padding: 10px;
  border: 1px solid #edf0f2;
  border-radius: 6px;
  background: #fafbfc;
}

.ba-timeline-summary span {
  display: block;
  color: #8b969f;
  font-size: 10px;
}

.ba-timeline-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--ba-ink);
  font-size: 12px;
}

.ba-timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ba-timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 104px 18px minmax(0, 1fr);
  gap: 8px;
  padding-bottom: 15px;
}

.ba-timeline time {
  padding-top: 2px;
  color: #8c979f;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  text-align: right;
}

.ba-timeline-marker {
  position: relative;
  display: flex;
  justify-content: center;
}

.ba-timeline-marker::before {
  position: absolute;
  top: 7px;
  bottom: -22px;
  width: 1px;
  background: #e1e6ea;
  content: "";
}

.ba-timeline li:last-child .ba-timeline-marker::before {
  display: none;
}

.ba-timeline-marker i {
  position: relative;
  z-index: 1;
  display: block;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--ba-blue);
  box-shadow: 0 0 0 1px #bfd3ef;
}

.ba-timeline-item {
  min-width: 0;
  padding: 0 0 2px;
}

.ba-timeline-item strong {
  display: block;
  color: var(--ba-ink);
  font-size: 12px;
}

.ba-timeline-item p {
  margin: 4px 0 0;
  color: #697580;
  font-size: 11px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ba-employee-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.ba-employee-summary div {
  padding: 10px;
  border: 1px solid #edf0f2;
  border-radius: 6px;
  background: #fafbfc;
}

.ba-employee-summary span {
  display: block;
  color: #89949d;
  font-size: 10px;
}

.ba-employee-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--ba-ink);
  font-family: "DM Mono", monospace;
  font-size: 18px;
  font-weight: 500;
}

.ba-employee-history {
  margin-top: 18px;
}

.ba-employee-history h3 {
  margin: 0 0 8px;
  color: var(--ba-ink);
  font-size: 13px;
}

.ba-settings-form {
  display: grid;
  gap: 13px;
}

.ba-auth-modal {
  width: min(420px, calc(100vw - 32px));
}

.ba-auth-form {
  gap: 10px;
}

.ba-auth-form textarea {
  min-height: 96px;
  padding: 8px 9px;
  resize: vertical;
}

.ba-form-error {
  min-height: 18px;
  margin: 0;
  color: var(--ba-red);
  font-size: 11px;
}

.ba-settings-form label {
  display: grid;
  gap: 6px;
  color: #66737e;
  font-size: 11px;
  font-weight: 600;
}

.ba-settings-form textarea {
  height: auto;
  min-height: 88px;
  padding: 8px 9px;
  resize: vertical;
}

.ba-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ba-form-note {
  margin: 0;
  padding: 10px 11px;
  border-radius: 6px;
  color: #7b663f;
  background: #fffaf0;
  font-size: 11px;
}

.ba-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 3px;
}

.ba-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 120;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 13px;
  border-radius: 7px;
  color: #fff;
  background: #23303a;
  box-shadow: 0 8px 24px rgba(20, 28, 35, 0.2);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.ba-toast.visible {
  opacity: 1;
  transform: none;
}

.ba-loading {
  opacity: 0.55;
  pointer-events: none;
}

@media (max-width: 1500px) {
  .ba-filterbar {
    grid-template-columns: repeat(4, minmax(120px, 1fr)) minmax(210px, 1.5fr) 32px;
  }

  .ba-metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .ba-source-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  :root {
    --ba-sidebar-width: 206px;
  }

  .ba-main {
    padding-right: 18px;
    padding-left: 18px;
  }

  .ba-topbar {
    margin-right: -18px;
    margin-left: -18px;
    padding-right: 18px;
    padding-left: 18px;
  }

  .ba-metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ba-split,
  .ba-split-chart {
    grid-template-columns: 1fr;
  }

  .ba-knowledge-overview {
    grid-template-columns: 1fr;
  }

  .ba-knowledge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ba-report-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  :root {
    --ba-sidebar-width: 184px;
  }

  .ba-brand {
    padding-right: 4px;
    padding-left: 4px;
  }

  .ba-brand small {
    display: none;
  }

  .ba-tab {
    gap: 8px;
    padding-right: 8px;
    padding-left: 8px;
    font-size: 12px;
  }

  .ba-filterbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ba-search-filter {
    grid-column: span 2;
  }

  .ba-level-summary,
  .ba-trend-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ba-level-rule-thresholds {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ba-report-layout {
    grid-template-columns: 1fr;
  }

  .ba-report-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(210px, 1fr);
    max-height: none;
    overflow-x: auto;
  }

  .ba-employee-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  :root {
    --ba-sidebar-width: 0px;
  }

  .ba-sidebar {
    position: static;
    width: auto;
    padding: 10px 12px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--ba-line);
  }

  .ba-brand {
    padding-bottom: 10px;
  }

  .ba-back-link {
    position: absolute;
    top: 12px;
    right: 12px;
    margin: 0;
  }

  .ba-back-link span {
    display: none;
  }

  .ba-tabs {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding: 1px 0 6px;
    scrollbar-width: none;
  }

  .ba-tabs::-webkit-scrollbar {
    display: none;
  }

  .ba-tab {
    width: auto;
    flex: none;
    padding: 7px 9px;
    white-space: nowrap;
  }

  .ba-tab svg {
    display: none;
  }

  .ba-source-status {
    display: none;
  }

  .ba-main {
    margin-left: 0;
    padding: 0 12px 36px;
  }

  .ba-topbar {
    min-height: 62px;
    margin: 0 -12px 10px;
    padding: 9px 12px;
  }

  .ba-topbar h1 {
    font-size: 19px;
  }

  .ba-updated {
    display: none;
  }

  .ba-filterbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px;
  }

  .ba-search-filter {
    grid-column: span 2;
  }

  .ba-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ba-metric {
    min-height: 96px;
    padding: 12px;
  }

  .ba-metric strong {
    font-size: 25px;
  }

  .ba-split {
    gap: 10px;
  }

  .ba-panel {
    padding: 13px;
  }

  .ba-panel-heading {
    flex-wrap: wrap;
  }

  .ba-heading-actions {
    width: 100%;
    justify-content: space-between;
  }

  .ba-local-search {
    width: 100%;
  }

  .ba-knowledge-intro,
  .ba-knowledge-section {
    padding: 14px;
  }

  .ba-knowledge-grid,
  .ba-level-rule-thresholds {
    grid-template-columns: 1fr;
  }

  .ba-level-rule-list article {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .ba-level-rule-list article p {
    grid-column: 1 / -1;
  }

  .ba-source-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ba-chart {
    height: 220px;
  }

  .ba-chart-tall {
    height: 300px;
  }

  .ba-report-heading {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .ba-report-actions {
    width: 100%;
  }

  .ba-report-actions .ba-button {
    flex: 1;
  }

  .ba-report-sheet {
    min-height: 420px;
    padding: 18px 15px;
  }

  .ba-report-sheet h2 {
    font-size: 20px;
  }

  .ba-report-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .ba-modal-backdrop {
    padding: 8px;
  }

  .ba-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .ba-timeline-summary,
  .ba-employee-summary {
    grid-template-columns: 1fr 1fr;
  }

  .ba-timeline li {
    grid-template-columns: 76px 16px minmax(0, 1fr);
    gap: 6px;
  }

  .ba-timeline time {
    font-size: 9px;
  }

  .ba-form-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
