/* Bạc nhớ miền Bắc — mobile-first */
.bn-root {
  --bn-accent: #c0392b;
  --bn-accent-soft: #fdeceb;
  --bn-border: #e5e7eb;
  --bn-bg: #f8fafc;
  --bn-text: #1f2937;
  --bn-muted: #6b7280;
  --bn-radius: 12px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--bn-text);
  margin: 0.75rem 0 1.25rem;
  border: 1px solid var(--bn-border);
  border-radius: var(--bn-radius);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.bn-head {
  background: linear-gradient(135deg, var(--bn-accent), #7f1d1d);
  color: #fff;
  padding: 0.9rem 1rem;
}
.bn-h {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.bn-meta {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  opacity: 0.95;
}
.bn-panel {
  padding: 0.85rem 0.9rem;
  border-top: 1px solid var(--bn-border);
  background: #fff;
}
.bn-panel:nth-child(even) { background: var(--bn-bg); }
.bn-title {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--bn-accent);
  line-height: 1.3;
}
.bn-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}
.bn-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  min-height: 2.2rem;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--bn-border);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}
.bn-chip-dan { border-color: var(--bn-accent); color: var(--bn-accent); background: var(--bn-accent-soft); }
.bn-chip.bn-hit { background: #dcfce7; border-color: #16a34a; color: #166534; }
.bn-chip.bn-marked { background: #fef3c7; border-color: #d97706; color: #92400e; }

.bn-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.15rem;
  padding-bottom: 0.15rem;
}
.bn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  background: #fff;
  min-width: 0;
}
.bn-table th,
.bn-table td {
  border: 1px solid var(--bn-border);
  padding: 0.45rem 0.4rem;
  text-align: center;
  white-space: nowrap;
}
.bn-table th {
  background: #f3f4f6;
  font-weight: 600;
  font-size: 0.75rem;
  color: #374151;
}
.bn-pairs-table td:nth-child(1),
.bn-pairs-table td:nth-child(2),
.bn-gan td:nth-child(1) {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.bn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin: 0.45rem 0;
}
.bn-row-lookup {
  flex-wrap: nowrap;
}
.bn-row-lookup .bn-input,
.bn-row-lookup .bn-select {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}
.bn-row-lookup .bn-btn {
  flex: 0 0 auto;
}

.bn-btn {
  appearance: none;
  border: 1px solid var(--bn-border);
  background: #fff;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  color: inherit;
  line-height: 1.2;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.bn-btn-primary {
  background: var(--bn-accent);
  color: #fff;
  border-color: var(--bn-accent);
}
.bn-btn-ghost { background: transparent; }
.bn-btn-danger { color: #b91c1c; border-color: #fecaca; }
.bn-btn-sm {
  padding: 0.4rem 0.65rem;
  font-size: 0.78rem;
  min-height: 2.15rem;
  border-radius: 8px;
}

.bn-input,
.bn-select {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--bn-border);
  border-radius: 10px;
  font-size: 1rem;
  min-height: 2.5rem;
  background: #fff;
  box-sizing: border-box;
}
.bn-out {
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.35rem;
  padding: 0.55rem;
  border: 1px solid var(--bn-border);
  border-radius: 10px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.82rem;
  resize: vertical;
}
.bn-sr {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.bn-empty,
.bn-hint,
.bn-disclaimer {
  font-size: 0.8rem;
  color: var(--bn-muted);
  margin: 0.35rem 0 0;
  line-height: 1.45;
}
.bn-disclaimer {
  padding: 0.85rem 0.9rem 1rem;
  border-top: 1px solid var(--bn-border);
  background: #fff;
}
.bn-lookup-out .bn-table { margin-top: 0.5rem; }

/* Tip cards */
.bn-tip-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}
.bn-tip-card {
  border: 1px solid var(--bn-border);
  border-radius: 12px;
  background: #fff;
  padding: 0.7rem 0.75rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}
.bn-tip-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}
.bn-tip-rank {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--bn-muted);
  min-width: 1.6rem;
}
.bn-tip-num {
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--bn-accent);
  letter-spacing: 0.02em;
  line-height: 1;
  flex: 1;
}
.bn-tip-top .bn-btn { margin-left: auto; }
.bn-tip-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}
.bn-metric {
  background: var(--bn-bg);
  border-radius: 8px;
  padding: 0.4rem 0.35rem;
  text-align: center;
}
.bn-metric span {
  display: block;
  font-size: 0.68rem;
  color: var(--bn-muted);
  margin-bottom: 0.15rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.bn-metric b {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color: var(--bn-text);
}
.bn-tip-ev {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #4b5563;
  word-break: break-word;
}

.bn-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-top: 0.75rem;
}
.bn-actions .bn-btn { width: 100%; }
.bn-tips .bn-hint { margin-bottom: 0.65rem; }

@media (min-width: 640px) {
  .bn-h { font-size: 1.15rem; }
  .bn-panel { padding: 1rem 1.1rem; }
  .bn-tip-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }
  .bn-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .bn-table { font-size: 0.875rem; }
}

@media (min-width: 960px) {
  .bn-tip-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Compact pair/gan tables on very small screens */
@media (max-width: 420px) {
  .bn-col-date { display: none; }
  .bn-tip-metrics { gap: 0.25rem; }
  .bn-metric { padding: 0.35rem 0.2rem; }
  .bn-metric b { font-size: 0.88rem; }
  .bn-actions { grid-template-columns: 1fr; }
}
