/* N8.1 — Babil Messaging notifications control center
 * NOTE: Perfex admin often uses a ~10px html rem root.
 * Prefer px/em inside .bn-page so typography stays readable.
 */

.bn-page {
  --bn-ink: #1c2430;
  --bn-muted: #5a6675;
  --bn-line: #dde3ea;
  --bn-soft: #f4f7f9;
  --bn-card: #fff;
  --bn-accent: #0b6e6e;
  --bn-accent-soft: rgba(11, 110, 110, 0.12);
  --bn-warn: #9a6700;
  --bn-warn-bg: #fff8e6;
  --bn-ok: #0b6b4f;
  --bn-ok-bg: #e7f6ef;
  --bn-bad: #a33;
  --bn-bad-bg: #f8eaea;
  --bn-radius: 10px;
  --bn-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  font-size: 15px;
  color: var(--bn-ink);
  line-height: 1.5;
}

.bn-page .content {
  padding-bottom: 28px;
}

/* Header */
.bn-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 14px;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--bn-line);
}

.bn-header__brand {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bn-accent);
}

.bn-header__title {
  margin: 4px 0 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--bn-ink);
}

.bn-header__intro {
  margin: 8px 0 0;
  max-width: 520px;
  color: var(--bn-muted);
  font-size: 14.5px;
  line-height: 1.45;
}

.bn-header__action .bn-save-btn {
  min-width: 140px;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
}

/* Status strip */
.bn-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.bn-status__item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 14px 16px;
  background: var(--bn-card);
  border: 1px solid var(--bn-line);
  border-radius: var(--bn-radius);
  box-shadow: var(--bn-shadow);
}

.bn-status__icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--bn-soft);
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.bn-status__label {
  font-size: 12.5px;
  color: var(--bn-muted);
  font-weight: 700;
  margin-bottom: 2px;
}

.bn-status__value {
  font-size: 16px;
  font-weight: 800;
  color: var(--bn-ink);
  line-height: 1.25;
}

.bn-status__item.is-on .bn-status__value,
.bn-status__item.is-ready .bn-status__value {
  color: var(--bn-ok);
}

.bn-status__item.is-off .bn-status__value,
.bn-status__item.is-not-ready .bn-status__value {
  color: var(--bn-warn);
}

/* Master panel */
.bn-panel {
  background: var(--bn-card);
  border: 1px solid var(--bn-line);
  border-radius: var(--bn-radius);
  box-shadow: var(--bn-shadow);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.bn-master__row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.bn-master__title {
  font-size: 16px;
  font-weight: 750;
  margin-bottom: 4px;
}

.bn-gateway-hints {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--bn-line);
  color: var(--bn-muted);
  font-size: 13px;
}

.bn-dot {
  opacity: 0.5;
}

.bn-state-pill {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 750;
}

.bn-state-pill--warn {
  background: var(--bn-warn-bg);
  color: var(--bn-warn);
}

/* Delivery window */
.bn-delivery {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--bn-line);
}

.bn-delivery__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.bn-delivery__head h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 750;
}

.bn-delivery__enable {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 14px;
}

.bn-time-pair {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 8px;
}

.bn-time-sep {
  padding-bottom: 10px;
  color: var(--bn-muted);
  font-weight: 750;
}

.bn-time-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 650;
  font-size: 13.5px;
  margin: 0;
}

.bn-time-field .form-control {
  width: 88px;
  max-width: 100%;
  height: 36px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.bn-time-field--inline {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.bn-time-field--inline .form-control {
  width: 78px;
}

/* Source grid */
.bn-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
  align-items: start;
}

.bn-card {
  background: var(--bn-card);
  border: 1px solid var(--bn-line);
  border-radius: var(--bn-radius);
  box-shadow: var(--bn-shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: opacity 0.2s ease;
}

.bn-card--dimmed {
  opacity: 0.68;
}

.bn-card--unavailable {
  background: var(--bn-soft);
}

.bn-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.bn-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.bn-card__title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 750;
  color: var(--bn-ink);
}

.bn-card__icon {
  font-size: 18px;
  line-height: 1;
}

.bn-card__desc {
  margin: 0 0 10px;
  color: var(--bn-muted);
  font-size: 13.5px;
  line-height: 1.45;
}

.bn-card__foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--bn-line);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bn-label {
  margin: 0 0 8px;
  font-weight: 750;
  font-size: 13.5px;
}

.bn-help {
  margin: 4px 0 0;
  color: var(--bn-muted);
  font-size: 13px;
  line-height: 1.45;
}

.bn-help--tight {
  margin-top: 2px;
}

.bn-meta {
  font-size: 13.5px;
  color: var(--bn-ink);
  line-height: 1.4;
}

.bn-meta--soft {
  color: var(--bn-muted);
  font-size: 13px;
}

.bn-meta__k {
  margin-inline-end: 4px;
}

.bn-callout {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bn-soft);
  border-inline-start: 3px solid var(--bn-accent);
  border-radius: 0 6px 6px 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--bn-ink);
}

[dir="rtl"] .bn-callout {
  border-radius: 6px 0 0 6px;
}

.bn-unavailable {
  padding: 14px;
  background: var(--bn-soft);
  border-radius: 8px;
  color: var(--bn-muted);
  font-weight: 700;
  text-align: center;
  font-size: 14px;
}

/* Toggle switch */
.bn-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}

.bn-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.bn-toggle__ui {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #c5ced8;
  position: relative;
  transition: background 0.18s ease;
  display: block;
}

.bn-toggle__knob {
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}

.bn-toggle input:checked + .bn-toggle__ui {
  background: var(--bn-accent);
}

.bn-toggle input:checked + .bn-toggle__ui .bn-toggle__knob {
  transform: translateX(18px);
}

[dir="rtl"] .bn-toggle input:checked + .bn-toggle__ui .bn-toggle__knob {
  transform: translateX(-18px);
}

.bn-toggle--lg .bn-toggle__ui {
  width: 52px;
  height: 30px;
}

.bn-toggle--lg .bn-toggle__knob {
  width: 24px;
  height: 24px;
}

.bn-toggle--lg input:checked + .bn-toggle__ui .bn-toggle__knob {
  transform: translateX(22px);
}

[dir="rtl"] .bn-toggle--lg input:checked + .bn-toggle__ui .bn-toggle__knob {
  transform: translateX(-22px);
}

.bn-toggle input:focus-visible + .bn-toggle__ui {
  outline: 2px solid var(--bn-accent);
  outline-offset: 2px;
}

/* Event checkboxes */
.bn-events {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bn-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  cursor: pointer;
  font-weight: 650;
  font-size: 14.5px;
  color: var(--bn-ink);
}

.bn-check input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.bn-check__box {
  width: 18px;
  height: 18px;
  border: 2px solid #9aa7b5;
  border-radius: 4px;
  flex-shrink: 0;
  position: relative;
  background: #fff;
}

.bn-check input:checked + .bn-check__box {
  background: var(--bn-accent);
  border-color: var(--bn-accent);
}

.bn-check input:checked + .bn-check__box::after {
  content: '';
  position: absolute;
  inset-inline-start: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.bn-check--locked {
  cursor: default;
}

.bn-check--locked .bn-check__box {
  background: var(--bn-accent-soft);
  border-color: var(--bn-accent);
}

.bn-check--locked input:checked + .bn-check__box {
  background: var(--bn-accent);
}

.bn-check--d0 {
  margin-top: 8px;
}

.bn-badge {
  display: inline-block;
  margin-inline-start: 4px;
  padding: 2px 7px;
  font-size: 11.5px;
  font-weight: 750;
  color: var(--bn-accent);
  background: var(--bn-accent-soft);
  border-radius: 4px;
}

/* Day chips */
.bn-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.bn-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 6px 12px;
  border: 1px solid var(--bn-line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-weight: 650;
  font-size: 13.5px;
  color: var(--bn-muted);
  user-select: none;
}

.bn-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.bn-chip.is-on,
.bn-chip:has(input:checked) {
  background: var(--bn-accent-soft);
  border-color: rgba(11, 110, 110, 0.35);
  color: var(--bn-accent);
}

.bn-chip__x {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  opacity: 0.75;
}

.bn-notif-add-day {
  margin: 6px 0 8px;
}

.bn-add-day-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.bn-add-day-form[hidden] {
  display: none !important;
}

.bn-add-day-form .form-control {
  width: 72px;
}

/* Queue metrics */
.bn-panel--health .bn-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.bn-panel--health h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 750;
}

.bn-readonly {
  font-size: 12px;
  font-weight: 700;
  color: var(--bn-muted);
  background: var(--bn-soft);
  padding: 4px 10px;
  border-radius: 999px;
}

.bn-metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.bn-metric {
  text-align: center;
  padding: 12px 6px;
  background: var(--bn-soft);
  border-radius: 8px;
}

.bn-metric__n {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--bn-ink);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.bn-metric__l {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--bn-muted);
  line-height: 1.3;
}

.bn-metric--ok {
  background: var(--bn-ok-bg);
}

.bn-metric--ok .bn-metric__n {
  color: var(--bn-ok);
}

.bn-metric--bad {
  background: var(--bn-bad-bg);
}

.bn-metric--bad .bn-metric__n {
  color: var(--bn-bad);
}

/* Save bar */
.bn-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 14px 0 6px;
  background: linear-gradient(to top, #f1f3f5 55%, rgba(241, 243, 245, 0));
  display: flex;
  justify-content: flex-end;
}

.bn-save-btn--lg {
  min-width: 168px;
  font-weight: 750;
  font-size: 15px;
  padding: 12px 22px;
}

/* Responsive */
@media (max-width: 1100px) {
  .bn-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 991px) {
  .bn-grid {
    grid-template-columns: 1fr;
  }

  .bn-status {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .bn-header {
    flex-direction: column;
  }

  .bn-header__title {
    font-size: 22px;
  }

  .bn-header__action {
    width: 100%;
  }

  .bn-header__action .bn-save-btn {
    width: 100%;
  }

  .bn-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bn-actions {
    justify-content: stretch;
  }

  .bn-save-btn--lg {
    width: 100%;
  }
}

/* Permissions — true read-only settings mode */
.bn-page--readonly .bn-toggle,
.bn-page--readonly .bn-check,
.bn-page--readonly .bn-chip {
  pointer-events: none;
  opacity: 0.92;
}
.bn-page--readonly input[type=\"text\"],
.bn-page--readonly input[type=\"number\"],
.bn-page--readonly input[type=\"time\"] {
  background: #f5f5f5;
  cursor: not-allowed;
}
.bn-readonly-banner {
  font-size: 14px;
}

/* I3 inbound alerts card */
.bn-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.bn-row-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 14px;
  color: #334155;
}
