/* ============================================================================
   DMB Common — shared primitives used across every DMB admin page.
   Consumes --rw-* tokens from the global theme. No page-specific rules here;
   if a rule appears in only one file, move it to that page's stylesheet.
   ============================================================================ */

/* ────────────────────────────────────────────────────────────────────────────
   Page chrome
   ──────────────────────────────────────────────────────────────────────────── */
.dmb-page { padding: 20px 0; }

/* Header toolbar: left = count + badges, right = actions */
.dmb-page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}


.dmb-page-toolbar__left,
.dmb-page-toolbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dmb-page-toolbar__count {
  font-size: 13px;
  color: var(--rw-text-light);
}
.dmb-page-toolbar--wrap { flex-wrap: wrap; gap: 12px; }

/* Section titles (uppercase tracking) */
.dmb-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--rw-text-light);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dmb-section-title__sub {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  color: var(--rw-text-light);
}

/* Search input with icon */
.dmb-search { position: relative; }
.dmb-search input {
  font-size: 12px;
  padding: 6px 12px 6px 30px;
  border: 1px solid var(--rw-border);
  border-radius: 6px;
  width: 200px;
  background: var(--rw-input-bg);
  color: var(--rw-text);
}
.dmb-search input:focus {
  outline: none;
  border-color: var(--rw-primary);
  box-shadow: 0 0 0 3px var(--rw-shadow-sm);
}
.dmb-search > i {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--rw-text-light);
  font-size: 12px;
  pointer-events: none;
}

/* ────────────────────────────────────────────────────────────────────────────
   Buttons & icon affordances
   Naming rules:
     .dmb-icon-btn        — bare icon button (inline row actions)
     .dmb-icon-btn--muted — low-emphasis variant (e.g. kebab trigger)
     .dmb-icon-btn--danger — destructive row action
     .dmb-action-btn      — framed icon button (card corner actions)
     .dmb-btn-link        — text-style button with hover bg (in tables/bars)
   ──────────────────────────────────────────────────────────────────────────── */
.dmb-icon-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  color: var(--rw-primary);
  border-radius: 4px;
  transition: background 0.12s, color 0.12s;
}
.dmb-icon-btn:hover:not(:disabled) { background: var(--rw-primary-light); }
.dmb-icon-btn:disabled {
  color: var(--rw-border);
  cursor: not-allowed;
}
.dmb-icon-btn:focus-visible {
  outline: 2px solid var(--rw-primary);
  outline-offset: 2px;
}
.dmb-icon-btn--muted { color: var(--rw-text-light); }
.dmb-icon-btn--muted:hover:not(:disabled) { color: var(--rw-primary); }
.dmb-icon-btn--danger { color: var(--rw-danger); }
.dmb-icon-btn--danger:hover:not(:disabled) {
  background: rgba(220,38,38,0.08);
  color: var(--rw-danger);
}

.dmb-action-btn {
  width: 30px; height: 30px;
  border-radius: 6px;
  border: 1px solid var(--rw-border);
  background: var(--rw-card-bg);
  color: var(--rw-text-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.dmb-action-btn:hover {
  border-color: var(--rw-primary);
  color: var(--rw-primary);
  background: var(--rw-primary-light);
}
.dmb-action-btn:focus-visible {
  outline: 2px solid var(--rw-primary);
  outline-offset: 2px;
}
.dmb-action-btn--danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--rw-danger);
}
.dmb-action-btn--danger:hover {
  background: #fee2e2;
  border-color: var(--rw-danger);
  color: var(--rw-danger);
}
.dmb-action-btn i { font-size: 12px; }

.dmb-btn-link {
  background: transparent;
  border: none;
  color: var(--rw-primary);
  font-weight: 600;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  min-width: 44px;
  min-height: 32px;
}
.dmb-btn-link:hover:not(:disabled) { background: var(--rw-primary-light); }
.dmb-btn-link:focus-visible { outline: 2px solid var(--rw-primary); outline-offset: 2px; }
.dmb-btn-link:disabled { opacity: 0.5; cursor: not-allowed; }
.dmb-btn-link--danger { color: var(--rw-danger); }
.dmb-btn-link--danger:hover:not(:disabled) {
  background: rgba(220,38,38,0.08);
  color: var(--rw-danger);
}

/* Icon colour utilities (paired with status text — never alone) */
.dmb-icon-ok    { color: var(--rw-green); }
.dmb-icon-ok-lg { color: var(--rw-green); font-size: 28px; }

/* ────────────────────────────────────────────────────────────────────────────
   Chips, pills, pips — status indicators
   ──────────────────────────────────────────────────────────────────────────── */
.dmb-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.dmb-chip--warn    { background: rgba(244,152,109,0.15); color: var(--rw-warning, #d97706); }
.dmb-chip--danger  { background: rgba(220,38,38,0.10);  color: var(--rw-danger); }
.dmb-chip--success { background: rgba(22,163,74,0.10);  color: var(--rw-green); }

/* Lightweight list pill (smaller than dmb-chip) */
.dmb-pill {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  background: var(--rw-primary-light);
  color: var(--rw-primary);
}
.dmb-pill--success { background: rgba(22,163,74,0.10); color: var(--rw-green); }

/* Status chip — pill with stronger visual weight for table-cell status */
.dmb-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.dmb-status-chip--success { background: rgba(22,163,74,0.10); color: var(--rw-green); }
.dmb-status-chip--danger  { background: rgba(220,38,38,0.10); color: var(--rw-danger); }
.dmb-status-chip--muted   { background: var(--rw-bg);          color: var(--rw-text-light); }

/* Status pip (paired with text — never color alone) */
.dmb-pip {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 4px;
}
.dmb-pip--on  { background: var(--rw-green); }
.dmb-pip--off { background: var(--rw-danger); }

/* Compact inline status badge (legacy — used in screens table) */
.dmb-status {
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  display: inline-block;
}

/* Group chip used in screens table */
.dmb-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--rw-primary);
  background: var(--rw-primary-light);
  padding: 3px 8px;
  border-radius: 4px;
}
.dmb-group-chip > i { font-size: 9px; }

/* Circular intent icon (used in meta rows, modal headers) */
.dmb-icon-circle {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}
.dmb-icon-circle--primary { background: var(--rw-primary-light); color: var(--rw-primary); }
.dmb-icon-circle--success { background: rgba(22,163,74,0.10);    color: var(--rw-green); }
.dmb-icon-circle--neutral { background: var(--rw-bg);            color: var(--rw-text-light); }

/* ────────────────────────────────────────────────────────────────────────────
   Table
   ──────────────────────────────────────────────────────────────────────────── */
.dmb-data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--rw-card-bg);
}
.dmb-data-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--rw-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--rw-border);
  background: var(--rw-bg);
}
.dmb-data-table thead th.is-center { text-align: center; }
.dmb-data-table tbody td {
  padding: 14px 16px;
  font-size: 12px;
  color: var(--rw-text);
  vertical-align: top;
  border-bottom: 1px solid var(--rw-bg);
}
.dmb-data-table tbody td.is-center { text-align: center; }
.dmb-data-table tbody td.is-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
  font-size: 13px;
}
.dmb-data-table tbody tr { transition: background 0.12s; }
.dmb-data-table tbody tr:hover { background: var(--rw-bg); }
.dmb-data-table tbody tr.is-disabled { opacity: 0.5; }
.dmb-data-table tbody td .row-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--rw-text);
}
.dmb-data-table tbody td .row-meta {
  font-size: 10px;
  color: var(--rw-text-light);
  margin-top: 2px;
}

/* Cell helpers */
.dmb-td-empty { color: var(--rw-text-light); font-size: 12px; }
.dmb-td-meta  { font-size: 12px; color: var(--rw-text-light); }

/* ────────────────────────────────────────────────────────────────────────────
   Pagination
   ──────────────────────────────────────────────────────────────────────────── */
.dmb-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 0 4px;
}
.dmb-pagination__info { font-size: 12px; color: var(--rw-text-light); }

/* ────────────────────────────────────────────────────────────────────────────
   Card (generic container — use for wrapping tables, forms, grouped content).
   Do NOT use .dmb-empty-card as a generic wrapper — that's reserved for the
   icon + headline + message empty-state pattern below.
   ──────────────────────────────────────────────────────────────────────────── */
.dmb-card {
  background: var(--rw-card-bg);
  border: 1px solid var(--rw-border);
  border-radius: 8px;
  overflow: hidden;
}
.dmb-card--flush { padding: 0; }     /* for tables — table supplies its own padding */
.dmb-card--open  { overflow: visible; } /* for rows that need kebab menus / dropdowns to escape */

/* ────────────────────────────────────────────────────────────────────────────
   Empty card (full-page empty state inside a list view — icon + h4 + p + CTA)
   ──────────────────────────────────────────────────────────────────────────── */
.dmb-empty-card {
  background: var(--rw-card-bg);
  border: 1px solid var(--rw-border);
  border-radius: 8px;
  text-align: center;
  padding: 60px 24px;
}
.dmb-empty-card__icon {
  width: 56px; height: 56px;
  border-radius: 12px;
  background: var(--rw-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 24px;
  color: var(--rw-text-light);
}
.dmb-empty-card h4 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--rw-text);
}
.dmb-empty-card p {
  margin: 0;
  font-size: 13px;
  color: var(--rw-text-light);
}
.dmb-empty-card__cta { margin-top: 16px; }

/* Inline empty state inside a form field (e.g. ui-select with no options) */
.dmb-inline-empty {
  color: var(--rw-text-light);
  font-size: 12px;
  padding: 10px;
  font-style: italic;
  border: 1px dashed var(--rw-border);
  border-radius: 6px;
  text-align: center;
}

/* ────────────────────────────────────────────────────────────────────────────
   Form card (used by template create / screen-group edit)
   ──────────────────────────────────────────────────────────────────────────── */
.dmb-form-card {
  background: var(--rw-card-bg);
  border: 1px solid var(--rw-border);
  border-radius: 8px;
  overflow: hidden;
}
.dmb-form-card__header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--rw-border);
  display: flex;
  align-items: center;
  gap: 16px;
}
.dmb-form-card__back {
  color: var(--rw-text-light);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--rw-border);
  background: var(--rw-card-bg);
  transition: border-color 0.15s, color 0.15s;
}
.dmb-form-card__back:hover {
  border-color: var(--rw-primary);
  color: var(--rw-primary);
}
.dmb-form-card__title h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--rw-text);
}
.dmb-form-card__title p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--rw-text-light);
}
.dmb-form-card__body { padding: 24px; }
.dmb-form-card__footer {
  padding: 16px 24px;
  background: var(--rw-bg);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid var(--rw-border);
}

/* Field labels */
.dmb-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--rw-text);
  margin-bottom: 6px;
  display: block;
}
.dmb-field-label .required { color: var(--rw-danger); }
.dmb-field-label .optional { font-weight: 400; color: var(--rw-text-light); }
.dmb-field-label-sm {
  font-size: 10px;
  font-weight: 600;
  color: var(--rw-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}
.dmb-field-row { display: flex; gap: 16px; }

/* ────────────────────────────────────────────────────────────────────────────
   Modal / list helpers (used by publish-logs modal and other drawers)
   ──────────────────────────────────────────────────────────────────────────── */
.dmb-modal-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--rw-text-light);
}
.dmb-modal-state {
  text-align: center;
  padding: 60px 24px;
}
.dmb-list-row {
  border-bottom: 1px solid var(--rw-border);
  padding: 16px 24px;
  transition: background 0.12s;
}
.dmb-list-row:last-child { border-bottom: none; }
.dmb-list-row:hover { background: var(--rw-bg); }
.dmb-list-row:focus-visible {
  outline: 2px solid var(--rw-primary);
  outline-offset: 2px;
}

/* Inline meta row (timestamp, user, status counts) */
.dmb-meta-row {
  display: flex; align-items: center;
  gap: 16px; flex-wrap: wrap;
}
.dmb-meta-row span { font-size: 11px; color: var(--rw-text-light); }
.dmb-meta-row .dmb-meta--success { color: var(--rw-green); font-weight: 600; }
.dmb-meta-row .dmb-meta--danger  { color: var(--rw-danger); font-weight: 600; }
.dmb-meta-row .dmb-meta--warn    { color: var(--rw-warning-dark, var(--rw-warning)); font-weight: 600; }

/* Expandable details container inside a list row */
.dmb-row-detail {
  margin-top: 8px;
  border: 1px solid var(--rw-border);
  border-radius: 6px;
  overflow: hidden;
}
.dmb-row-detail-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; font-size: 11px;
  border-bottom: 1px solid var(--rw-border);
}
.dmb-row-detail-row:last-child { border-bottom: none; }
.dmb-row-detail-row .name { flex: 1; color: var(--rw-text); font-weight: 500; }
.dmb-row-detail-row .code { font-family: monospace; color: var(--rw-text-light); }

/* Card action row (used by template cards, screen group rows) */
.dmb-card-actions {
  display: flex;
  gap: 6px;
}

/* Kebab menu rules removed 2026-04-24 — Screen Groups was the last user and
   switched to inline Edit/Delete icon buttons. `cxm-kebab*` in cx-management
   still covers any non-Deployment reuse. Deployment page doesn't use kebabs. */

/* ────────────────────────────────────────────────────────────────────────────
   Skeletons (and reduced-motion)
   ──────────────────────────────────────────────────────────────────────────── */
.dmb-skel-row {
  height: 40px;
  background: linear-gradient(90deg, var(--rw-bg) 0%, var(--rw-border) 50%, var(--rw-bg) 100%);
  background-size: 200% 100%;
  border-radius: 6px;
  margin-bottom: 10px;
  animation: dmb-pulse 1.4s ease-in-out infinite;
}
.dmb-skel-row:last-child { margin-bottom: 0; }
@keyframes dmb-pulse {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .dmb-skel-row,
  .dmb-kpi__skeleton { animation: none; }
  .dmb-kpi__progress-fill { transition: none; }
}

/* ────────────────────────────────────────────────────────────────────────────
   DmbConfirm — branded confirmation modal (used by DmbConfirm.open)

   One template, three tones. Visual parity with the cxm-confirm template so
   destructive actions across DMB look identical. Replaces the older
   $ngBootbox.confirm() inline-HTML approach.
   ──────────────────────────────────────────────────────────────────────────── */
.dmb-confirm-window .modal-dialog { max-width: 540px; margin: 8vh auto; }
.dmb-confirm-window .modal-content {
  border-radius: 14px;
  border: none;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(4, 9, 17, 0.26);
}
.dmb-confirm {
  position: relative;
  background: #fff;
  font-family: inherit;
}
.dmb-confirm__close {
  position: absolute;
  top: 14px; right: 14px;
  width: 28px; height: 28px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: #9DA2AA;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.dmb-confirm__close:hover { background: #F3F5F8; color: #373C44; }
.dmb-confirm__body { padding: 22px 24px 10px; }
.dmb-confirm__head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.dmb-confirm__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  font-size: 16px;
  flex-shrink: 0;
}
.dmb-confirm[data-tone="danger"]  .dmb-confirm__icon { background: rgba(231, 76, 60, 0.10); color: #e74c3c; }
.dmb-confirm[data-tone="warning"] .dmb-confirm__icon { background: rgba(243, 156, 18, 0.12); color: #d97706; }
.dmb-confirm[data-tone="primary"] .dmb-confirm__icon { background: rgba(79, 106, 232, 0.10); color: #4f6ae8; }
.dmb-confirm__title {
  font-size: 16px; font-weight: 700; color: #1F242B;
  margin: 0; line-height: 1.3;
  letter-spacing: -0.2px;
}
.dmb-confirm__msg {
  margin: 0;
  font-size: 13px;
  color: #6A6F77;
  line-height: 1.55;
}
.dmb-confirm__msg strong, .dmb-confirm__msg b { color: #1F242B; font-weight: 700; }
.dmb-confirm__warning {
  display: flex; align-items: flex-start; gap: 9px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  background: rgba(231, 76, 60, 0.055);
  border: 1px solid rgba(231, 76, 60, 0.15);
  color: #9a3b2e;
}
.dmb-confirm[data-tone="warning"] .dmb-confirm__warning {
  background: rgba(243, 156, 18, 0.10);
  border-color: rgba(243, 156, 18, 0.25);
  color: #8b5a08;
}
.dmb-confirm__warning > .fa { flex-shrink: 0; font-size: 13px; margin-top: 1px; }
.dmb-confirm__foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 24px 22px;
}
.dmb-confirm__btn {
  flex: 0 0 auto; min-width: 100px; height: 40px;
  padding: 0 18px;
  border-radius: 9px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.dmb-confirm__btn--ghost {
  background: #fff;
  border-color: #E7EAEE;
  color: #6A6F77;
}
.dmb-confirm__btn--ghost:hover { background: #F9FAFB; color: #373C44; border-color: #D5D9E0; }
.dmb-confirm[data-tone="danger"]  .dmb-confirm__btn--cta { background: #e74c3c; color: #fff; }
.dmb-confirm[data-tone="danger"]  .dmb-confirm__btn--cta:hover { background: #c0392b; }
.dmb-confirm[data-tone="warning"] .dmb-confirm__btn--cta { background: #d97706; color: #fff; }
.dmb-confirm[data-tone="warning"] .dmb-confirm__btn--cta:hover { background: #b45309; }
.dmb-confirm[data-tone="primary"] .dmb-confirm__btn--cta { background: #4f6ae8; color: #fff; }
.dmb-confirm[data-tone="primary"] .dmb-confirm__btn--cta:hover { background: #3d56cf; }
.dmb-confirm__btn--cta:focus-visible { box-shadow: 0 0 0 3px rgba(79, 106, 232, 0.25); }
