.cnbd-widget {
  border: 1px solid #e8ecf3;
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  background: #ffffff;
}

.cnbd-stale-notice {
  border: 1px solid #e8ecf3;
  background: #fffbeb;
  color: #92400e;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

.cnbd-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cnbd-card {
  border: 1px solid #e8ecf3;
  border-radius: 10px;
  padding: 12px;
  background: #f9fbff;
}

.cnbd-card__title {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
}

.cnbd-card__value {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #292b2d;
  line-height: 150%;
}

.cnbd-value-positive {
  color: #15803d;
}

.cnbd-value-negative {
  color: #b91c1c;
}

.cnbd-card__meta {
  margin: 6px 0 0;
  font-size: 0.95rem;
  color: #4b5563;
}

.cnbd-graph-placeholder {
  border: 1px dashed #e8ecf3;
  border-radius: 10px;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  background: #f9fafb;
  padding: 12px;
}

.cnbd-chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.cnbd-range-btn {
  border: 1px solid #e8ecf3;
  background: #ffffff;
  color: #111827;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
}

.cnbd-range-btn--active {
  background: #2563eb;
  color: #ffffff;
  border-color: #e8ecf3;
}

.cnbd-chart {
  position: relative;
  border: 1px dashed #e8ecf3;
  border-radius: 10px;
  min-height: 320px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  overflow: hidden;
}

.cnbd-chart__svg {
  width: 100%;
  height: 320px;
  display: block;
}

.cnbd-chart__line {
  fill: none;
  stroke: #2563eb;
  stroke-width: 2;
  transition: d 0.2s ease;
}

.cnbd-chart__cursor-point {
  fill: #2563eb;
  stroke: #ffffff;
  stroke-width: 1.5;
}

.cnbd-chart__area {
  fill: rgba(37, 99, 235, 0.18);
}

.cnbd-chart__grid-line {
  stroke: #e1e7f0;
  stroke-width: 1;
}

.cnbd-chart__zero-line {
  stroke: #9ca3af;
  stroke-width: 1;
}

.cnbd-chart__bar {
  transition: opacity 0.2s ease, height 0.2s ease, y 0.2s ease;
}

.cnbd-chart__bar:hover {
  opacity: 0.8;
}

.cnbd-chart__bar--positive {
  fill: #15803d;
}

.cnbd-chart__bar--negative {
  fill: #b91c1c;
}

.cnbd-chart__empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
}

.cnbd-chart__empty[hidden] {
  display: none !important;
}

.cnbd-chart-axis-right,
.cnbd-chart-axis-bottom {
  position: absolute;
  pointer-events: none;
}

.cnbd-chart-axis-left {
  position: absolute;
  top: 16px;
  left: 0;
  bottom: 28px;
  width: 44px;
  pointer-events: none;
}

.cnbd-chart-axis-right {
  top: 16px;
  right: 2px;
  bottom: 28px;
  width: 48px;
}

.cnbd-chart-axis-right--epochs {
  right: 0;
  width: 56px;
}

.cnbd-chart-axis-bottom {
  left: 36px;
  right: 48px;
  bottom: 4px;
  height: 20px;
}

.cnbd-chart-axis-bottom--epochs {
  left: 16px;
  right: 56px;
}

.cnbd-chart-axis-label {
  position: absolute;
  font-size: 11px;
  color: #6b7280;
  white-space: nowrap;
}

.cnbd-chart-tooltip {
  position: absolute;
  z-index: 4;
  background: #111827;
  color: #ffffff;
  font-size: 12px;
  border-radius: 6px;
  padding: 6px 8px;
  transform: none;
  pointer-events: none;
  width: fit-content;
  max-width: none;
  white-space: nowrap;
  overflow-wrap: normal;
  line-height: 1.3;
}

.cnbd-chart-note {
  margin: 8px 0 0;
  color: #92400e;
  font-size: 13px;
}

.cnbd-extremes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.cnbd-extremes__item {
  border: 1px solid #e8ecf3;
  border-radius: 10px;
  padding: 12px;
  background: #f9fbff;
}

.cnbd-extremes__label {
  display: block;
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
}

.cnbd-extremes__value {
  display: block;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #292b2d;
}

.cnbd-extremes__meta {
  display: block;
  margin: 6px 0 0;
  font-size: 0.95rem;
  color: #4b5563;
}

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

.cnbd-table-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.cnbd-table-controls__label {
  font-size: 13px;
  color: #374151;
}

.cnbd-table-controls__input {
  border: 1px solid #e8ecf3;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
}

.cnbd-table-controls__apply,
.cnbd-load-more,
.cnbd-collapse {
  border: 1px solid #e8ecf3;
  border-radius: 8px;
  background: #2563eb;
  color: #ffffff;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
}

.cnbd-table-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cnbd-table-end {
  font-size: 13px;
  color: #6b7280;
}

.cnbd-table-sentinel {
  width: 100%;
  height: 1px;
}

.cnbd-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e9eef0;
}

.cnbd-table th,
.cnbd-table td {
  border: none;
  text-align: left;
  padding: 10px 8px;
  font-size: 14px;
}

.cnbd-table tbody td:first-child {
  border-left: none;
}

.cnbd-table tbody td:last-child {
  border-right: none;
}

.cnbd-table th {
  border-top: 1px solid #e9eef0;
  border-bottom: 1px solid #e9eef0;
  background: #e4ecf8;
  font-weight: 500;
  font-size: 16px;
  color: #292b2d;
}

.cnbd-error {
  border: 1px solid #e8ecf3;
  border-radius: 8px;
  color: #b91c1c;
  background: #fef2f2;
  padding: 12px;
  margin: 12px 0;
}

.cnbd-widget a[href^="tel"],
.cnbd-widget a[x-apple-data-detectors],
.cnbd-widget a[href^="x-apple-data-detectors://"],
.cnbd-widget a[href^="sms"] {
  color: inherit !important;
  -webkit-text-fill-color: inherit !important;
  text-decoration: none !important;
  pointer-events: none;
  cursor: default;
}

@media (max-width: 900px) {
  .cnbd-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .cnbd-cards {
    grid-template-columns: 1fr;
  }

  .cnbd-extremes {
    grid-template-columns: 1fr;
  }

  .cnbd-graph-placeholder {
    min-height: 300px;
  }

  .cnbd-chart {
    min-height: 280px;
  }

  .cnbd-chart__svg {
    height: 280px;
  }

  .cnbd-chart-tooltip {
    font-size: 11px;
    padding: 5px 7px;
  }
}
