/* ==========================================================================
   Recon UI: app shell + design layer on top of Bootstrap 5.3.
   Brand colors are fed into Bootstrap's own CSS variables, so every BS5
   component is on-brand. The "legacy markup" section styles the few
   classes older pages still use.
   ========================================================================== */

:root {
  --rx-brand: #2f8a3e;
  --rx-brand-600: #277534;
  --rx-brand-50: #ecf6ee;
  --rx-brand-100: #d5ecd9;

  --rx-bg: #f5f6f8;
  --rx-surface: #ffffff;
  --rx-border: #e5e7eb;
  --rx-border-strong: #d1d5db;

  --rx-text: #111827;
  --rx-text-2: #4b5563;
  --rx-muted: #6b7280;

  /* status: always paired with a label/icon, never color alone */
  --rx-good: #0b8a0b;      --rx-good-bg: #e7f6e7;
  --rx-warn: #a86a00;      --rx-warn-bg: #fff4d6;
  --rx-serious: #b8501f;   --rx-serious-bg: #fdebe3;
  --rx-critical: #c23030;  --rx-critical-bg: #fbe7e7;
  --rx-neutral: #4b5563;   --rx-neutral-bg: #eef0f3;
  --rx-info: #1d5fd1;      --rx-info-bg: #e6efff;

  --rx-radius: 10px;
  --rx-radius-sm: 6px;
  --rx-shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --rx-shadow-lg: 0 8px 24px rgba(16, 24, 40, .12);
  --rx-sidebar-w: 248px;
  --rx-topbar-h: 60px;
  --rx-font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Bootstrap 5 theme ---------- */
:root, [data-bs-theme=light] {
  --bs-primary: #2f8a3e;            --bs-primary-rgb: 47, 138, 62;
  --bs-success: #2f8a3e;            --bs-success-rgb: 47, 138, 62;
  --bs-danger: #c23030;             --bs-danger-rgb: 194, 48, 48;
  --bs-warning: #f5b301;            --bs-warning-rgb: 245, 179, 1;
  --bs-info: #1d5fd1;               --bs-info-rgb: 29, 95, 209;
  --bs-primary-text-emphasis: #1f5c29;
  --bs-primary-bg-subtle: #ecf6ee;  --bs-primary-border-subtle: #b9dcbf;
  --bs-success-text-emphasis: #135c13;
  --bs-success-bg-subtle: #e7f6e7;  --bs-success-border-subtle: #c6e9c6;
  --bs-body-font-family: var(--rx-font);
  --bs-body-font-size: 14px;
  --bs-body-color: #111827;         --bs-body-color-rgb: 17, 24, 39;
  --bs-body-bg: #ffffff;            --bs-body-bg-rgb: 255, 255, 255;  /* inputs, modals, dropdowns */
  --bs-tertiary-bg: #f9fafb;
  --bs-secondary-color: #6b7280;
  --bs-border-color: #e5e7eb;
  --bs-border-radius: 8px;          --bs-border-radius-lg: 10px; --bs-border-radius-sm: 6px;
  --bs-link-color: #277534;         --bs-link-color-rgb: 39, 117, 52;
  --bs-link-hover-color: #2f8a3e;   --bs-link-hover-color-rgb: 47, 138, 62;
  --bs-focus-ring-color: rgba(47, 138, 62, .25);
}
body { -webkit-font-smoothing: antialiased; background: var(--rx-bg); }  /* page canvas */
a { text-decoration: none; }
a:not(.btn):not(.rx-nav-link):not(.rx-stat):not(.rx-chip):not(.dropdown-item):not(.nav-link):not(.page-link):hover { text-decoration: underline; }
.btn-primary, .btn-success {
  --bs-btn-bg: var(--rx-brand); --bs-btn-border-color: var(--rx-brand);
  --bs-btn-hover-bg: var(--rx-brand-600); --bs-btn-hover-border-color: var(--rx-brand-600);
  --bs-btn-active-bg: #1f5c29; --bs-btn-active-border-color: #1f5c29;
  --bs-btn-disabled-bg: var(--rx-brand); --bs-btn-disabled-border-color: var(--rx-brand);
  --bs-btn-focus-shadow-rgb: 47, 138, 62;
}
.btn-outline-primary, .btn-outline-success {
  --bs-btn-color: var(--rx-brand-600); --bs-btn-border-color: var(--rx-brand);
  --bs-btn-hover-bg: var(--rx-brand); --bs-btn-hover-border-color: var(--rx-brand);
  --bs-btn-active-bg: var(--rx-brand-600); --bs-btn-active-border-color: var(--rx-brand-600);
}
.form-check-input:checked { background-color: var(--rx-brand); border-color: var(--rx-brand); }
.page-link { color: var(--rx-brand-600); }
.active > .page-link, .page-link.active { background-color: var(--rx-brand); border-color: var(--rx-brand); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--rx-brand); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--rx-brand); }

/* ---------- shell ---------- */
.rx-shell { display: flex; min-height: 100vh; }

.rx-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--rx-sidebar-w); z-index: 1030;
  background: var(--rx-surface); border-right: 1px solid var(--rx-border);
  display: flex; flex-direction: column; transition: transform .2s ease;
}
.rx-brand {
  height: var(--rx-topbar-h); display: flex; align-items: center; gap: 10px;
  padding: 0 18px; border-bottom: 1px solid var(--rx-border); text-decoration: none !important;
}
.rx-brand img { width: 30px; height: 30px; object-fit: contain; }
.rx-brand-name { font-weight: 700; color: var(--rx-text); font-size: 15px; line-height: 1.1; }
.rx-brand-sub { display: block; font-size: 11px; font-weight: 500; color: var(--rx-muted); }

.rx-nav { flex: 1; overflow-y: auto; padding: 10px 10px 24px; }
.rx-nav-section {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--rx-muted); padding: 16px 10px 6px;
}
.rx-nav-item { display: flex; align-items: center; border-radius: var(--rx-radius-sm); margin: 1px 0; }
.rx-nav-link {
  flex: 1; display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  color: var(--rx-text-2) !important; text-decoration: none !important; font-weight: 500; border-radius: var(--rx-radius-sm);
}
.rx-nav-link i { width: 18px; text-align: center; color: var(--rx-muted); font-size: 14px; }
.rx-nav-item:hover { background: var(--rx-bg); }
.rx-nav-item.active { background: var(--rx-brand-50); }
.rx-nav-item.active .rx-nav-link { color: var(--rx-brand-600) !important; font-weight: 600; }
.rx-nav-item.active .rx-nav-link i { color: var(--rx-brand); }
.rx-nav-add {
  width: 28px; height: 28px; margin-right: 4px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  color: var(--rx-muted) !important; opacity: 0; text-decoration: none !important;
}
.rx-nav-item:hover .rx-nav-add, .rx-nav-add:focus { opacity: 1; }
.rx-nav-add:hover { background: var(--rx-brand-100); color: var(--rx-brand-600) !important; }

.rx-sidebar-user {
  border-top: 1px solid var(--rx-border); padding: 12px 16px; display: flex; align-items: center; gap: 10px;
}
.rx-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--rx-brand-100); color: var(--rx-brand-600);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none;
  text-transform: uppercase;
}
.rx-user-name { font-weight: 600; font-size: 13px; color: var(--rx-text); line-height: 1.2; }
.rx-user-role { font-size: 12px; color: var(--rx-muted); }

.rx-main { flex: 1; margin-left: var(--rx-sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.rx-topbar {
  position: sticky; top: 0; z-index: 1020; height: var(--rx-topbar-h);
  background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--rx-border); display: flex; align-items: center; gap: 12px; padding: 0 24px;
}
.rx-menu-btn { display: none; border: 0; background: none; font-size: 18px; color: var(--rx-text-2); padding: 6px; }
.rx-search { position: relative; flex: 1; max-width: 520px; }
.rx-search input {
  width: 100%; height: 38px; border: 1px solid var(--rx-border); border-radius: 8px; background: var(--rx-bg);
  padding: 0 64px 0 36px; font-size: 14px; color: var(--rx-text); outline: none; transition: border-color .15s, background .15s;
}
.rx-search input:focus { background: #fff; border-color: var(--rx-brand); box-shadow: 0 0 0 3px var(--rx-brand-100); }
.rx-search .fa-search { position: absolute; left: 12px; top: 12px; color: var(--rx-muted); font-size: 13px; }
.rx-kbd {
  position: absolute; right: 10px; top: 9px; font-size: 11px; color: var(--rx-muted);
  border: 1px solid var(--rx-border-strong); border-radius: 4px; padding: 1px 6px; background: #fff;
}
.rx-top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.rx-icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: var(--rx-text-2) !important; background: none; border: 0; text-decoration: none !important;
}
.rx-icon-btn:hover { background: var(--rx-bg); }
.rx-icon-btn::after { display: none !important; }
.rx-dot {
  position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--rx-critical); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.rx-dropdown { width: 340px; padding: 0; border: 1px solid var(--rx-border); border-radius: var(--rx-radius); box-shadow: var(--rx-shadow-lg); overflow: hidden; }
.rx-dropdown-head { padding: 12px 16px; font-weight: 600; border-bottom: 1px solid var(--rx-border); }
.rx-dropdown-body { max-height: 340px; overflow-y: auto; }
.rx-dropdown-item { display: flex; gap: 10px; padding: 10px 16px; color: var(--rx-text) !important; text-decoration: none !important; border-bottom: 1px solid var(--rx-border); }
.rx-dropdown-item:hover { background: var(--rx-bg); }
.rx-dropdown-item small { display: block; color: var(--rx-muted); }
.rx-dropdown-empty { padding: 20px 16px; text-align: center; color: var(--rx-muted); }
.rx-dropdown-foot { display: block; padding: 10px 16px; text-align: center; font-weight: 500; }
.rx-user-btn { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 22px; border: 1px solid var(--rx-border); background: #fff; }
.rx-user-btn::after { display: none !important; }

.rx-content { padding: 24px; flex: 1; }
.rx-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.rx-page-title { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.01em; color: var(--rx-text); }
.rx-page-sub { color: var(--rx-muted); margin: 4px 0 0; font-size: 14px; }
.rx-crumbs { font-size: 13px; color: var(--rx-muted); margin-bottom: 6px; }
.rx-crumbs a { color: var(--rx-muted); }
.rx-footer { padding: 16px 24px; color: var(--rx-muted); font-size: 12px; border-top: 1px solid var(--rx-border); display: flex; justify-content: space-between; }

.rx-backdrop { display: none; }
@media (max-width: 991px) {
  .rx-sidebar { transform: translateX(-100%); box-shadow: var(--rx-shadow-lg); }
  .rx-shell.nav-open .rx-sidebar { transform: none; }
  .rx-shell.nav-open .rx-backdrop { display: block; position: fixed; inset: 0; background: rgba(17,24,39,.35); z-index: 1025; }
  .rx-main { margin-left: 0; }
  .rx-menu-btn { display: block; }
  .rx-kbd { display: none; }
  .rx-content { padding: 16px; }
}

/* ---------- older page wrappers inside the shell ---------- */
.rx-content > .content, .rx-content .content { margin-top: 0 !important; padding: 0 !important; min-height: 0 !important; }
.rx-content .page-inner { padding: 0 !important; }
.rx-has-title .page-header { display: none !important; }  /* title is shown by the shell instead */
.rx-content .page-header { margin-bottom: 16px; }
.rx-content .page-title { font-size: 20px; font-weight: 700; }

/* ---------- cards ---------- */
.card, .rx-card {
  background: var(--rx-surface) !important; border: 1px solid var(--rx-border) !important; border-radius: var(--rx-radius) !important;
  box-shadow: var(--rx-shadow) !important; margin-bottom: 20px;
}
.card .card-header, .rx-card-head {
  background: transparent !important; border-bottom: 1px solid var(--rx-border) !important; padding: 14px 18px !important;
}
.card .card-title, .rx-card-title { font-size: 15px !important; font-weight: 600 !important; color: var(--rx-text) !important; margin: 0; }
.card .card-body, .rx-card-body { padding: 18px !important; }
.rx-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@media (max-width: 575px) { .rx-card-head > form, .rx-card-head > form .form-control { width: 100%; } }
.rx-card-head .rx-card-sub { color: var(--rx-muted); font-size: 12px; margin-top: 2px; }
.card-round { border-radius: var(--rx-radius) !important; }

/* ---------- buttons ---------- */
.btn { border-radius: 8px !important; font-weight: 500 !important; font-size: 13px !important; padding: 7px 14px; box-shadow: none !important; }
.btn-sm, .btn-xs { padding: 4px 10px !important; font-size: 12px !important; }
.btn-primary, .btn-success, .btn-default[style*="398f3c"] {
  background: var(--rx-brand) !important; border-color: var(--rx-brand) !important; color: #fff !important;
}
.btn-primary:hover, .btn-success:hover { background: var(--rx-brand-600) !important; border-color: var(--rx-brand-600) !important; }
.btn-secondary, .btn-light, .rx-btn-ghost {
  background: #fff !important; border: 1px solid var(--rx-border-strong) !important; color: var(--rx-text) !important;
}
.btn-secondary:hover, .btn-light:hover, .rx-btn-ghost:hover { background: var(--rx-bg) !important; }
.btn-danger { background: var(--rx-critical) !important; border-color: var(--rx-critical) !important; }
.btn-warning { background: #f5b301 !important; border-color: #f5b301 !important; color: #1f2933 !important; }
.btn-info { background: var(--rx-info) !important; border-color: var(--rx-info) !important; }
.btn-group > .btn { background: #fff !important; color: var(--rx-text) !important; border: 1px solid var(--rx-border-strong) !important; }
.btn-group > .btn:hover { background: var(--rx-bg) !important; }
/* the legacy row-action groups use dropdown-item styled buttons */
.btn-group .dropdown-item.btn { width: auto; margin-right: 4px !important; }

/* ---------- forms ---------- */
/* radius comes from --bs-border-radius so input groups keep their joined corners */
.form-control, .form-select {
  border-color: var(--rx-border-strong); font-size: 14px; padding-top: 8px; padding-bottom: 8px; color: var(--rx-text);
}
.form-control-sm, .form-select-sm { font-size: 13px; padding-top: 4px; padding-bottom: 4px; }
.input-group-text { font-size: 13px; color: var(--rx-text-2); background: #f9fafb; border-color: var(--rx-border-strong); }
.form-control:focus, .form-select:focus { border-color: var(--rx-brand); box-shadow: 0 0 0 3px var(--rx-brand-100); }
.form-group label, .form-label { font-weight: 500 !important; color: var(--rx-text-2) !important; font-size: 13px !important; }
.form-group { margin-bottom: 12px; }

/* ---------- tables (incl. bootstrap-table) ---------- */
.table { color: var(--rx-text) !important; margin-bottom: 0; }
.table thead th, .bootstrap-table .fixed-table-container .table thead th {
  background: #f9fafb !important; color: var(--rx-muted) !important; font-size: 12px !important; font-weight: 600 !important;
  text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--rx-border) !important; border-top: 0 !important;
  padding: 10px 12px !important; white-space: nowrap;
}
.table td, .table th { border-top: 1px solid var(--rx-border) !important; padding: 10px 12px !important; vertical-align: middle !important; font-size: 13px; }
.table-striped tbody tr:nth-of-type(odd) { background: transparent !important; }
.table-hover tbody tr:hover, .rx-table tbody tr:hover { background: #fafbfc !important; }
.bootstrap-table .fixed-table-container { border: 1px solid var(--rx-border) !important; border-radius: 8px; overflow: hidden; }
.bootstrap-table .fixed-table-container .table td, .bootstrap-table .fixed-table-container .table th { border-left: 0 !important; border-right: 0 !important; }
.fixed-table-toolbar .search input { min-width: 220px; }
.table-responsive { border-radius: 8px; }
.rx-table td.num, .rx-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- modals, alerts, badges ---------- */
.modal-content { border: 0 !important; border-radius: 12px !important; box-shadow: var(--rx-shadow-lg) !important; }
.modal-header { border-bottom: 1px solid var(--rx-border) !important; padding: 16px 20px !important; }
.modal-title { font-weight: 600 !important; font-size: 16px !important; }
.modal-footer { border-top: 1px solid var(--rx-border) !important; }
.alert { border-radius: 8px !important; border: 1px solid transparent; box-shadow: none !important; font-size: 14px; }
.alert-success { background: var(--rx-good-bg) !important; color: #135c13 !important; border-color: #c6e9c6 !important; }
.alert-danger, .alert-error { background: var(--rx-critical-bg) !important; color: #8f1f1f !important; border-color: #f3c7c7 !important; }
.alert-warning { background: var(--rx-warn-bg) !important; color: #7a4d00 !important; border-color: #f6dea0 !important; }
.alert-info { background: var(--rx-info-bg) !important; color: #173f8a !important; border-color: #c8d9fb !important; }
.badge { font-weight: 600; border-radius: 999px; padding: 4px 9px; font-size: 11px; }

/* status pill: dot + label (identity never by color alone) */
.rx-status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.rx-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.rx-status.good { color: var(--rx-good); background: var(--rx-good-bg); }
.rx-status.warn { color: var(--rx-warn); background: var(--rx-warn-bg); }
.rx-status.serious { color: var(--rx-serious); background: var(--rx-serious-bg); }
.rx-status.critical { color: var(--rx-critical); background: var(--rx-critical-bg); }
.rx-status.neutral { color: var(--rx-neutral); background: var(--rx-neutral-bg); }
.rx-status.info { color: var(--rx-info); background: var(--rx-info-bg); }

/* ---------- stat tiles ---------- */
.rx-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
@media (max-width: 1199px) { .rx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575px) { .rx-stats { grid-template-columns: 1fr; } }
.rx-stat { background: var(--rx-surface); border: 1px solid var(--rx-border); border-radius: var(--rx-radius); padding: 16px 18px; box-shadow: var(--rx-shadow); text-decoration: none !important; display: block; }
a.rx-stat:hover { border-color: var(--rx-border-strong); }
.rx-stat-label { color: var(--rx-muted); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.rx-stat-label i { color: var(--rx-muted); }
.rx-stat-value { font-size: 26px; font-weight: 650; color: var(--rx-text); margin-top: 6px; letter-spacing: -.01em; }
.rx-stat-foot { font-size: 12px; color: var(--rx-muted); margin-top: 4px; }
.rx-delta-up { color: var(--rx-good); font-weight: 600; }
.rx-delta-down { color: var(--rx-critical); font-weight: 600; }

/* ---------- grid helpers ---------- */
.rx-grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
.rx-grid-2eq { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 1199px) { .rx-grid-2, .rx-grid-2eq { grid-template-columns: 1fr; } }
.rx-grid-2 > *, .rx-grid-2eq > * { min-width: 0; }

/* ---------- lists ---------- */
.rx-list { list-style: none; margin: 0; padding: 0; }
.rx-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--rx-border); }
.rx-list li:first-child { border-top: 0; }
.rx-list .rx-list-main { min-width: 0; }
.rx-list .rx-list-title { font-weight: 500; color: var(--rx-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.rx-list .rx-list-sub { font-size: 12px; color: var(--rx-muted); }
.rx-list .rx-list-side { text-align: right; flex: none; font-size: 13px; }
.rx-empty { padding: 28px 18px; text-align: center; color: var(--rx-muted); }
.rx-empty i { display: block; font-size: 22px; margin-bottom: 8px; color: var(--rx-border-strong); }

/* ---------- column chart (SVG) ---------- */
.rx-chart { position: relative; }
.rx-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.rx-chart .grid line { stroke: #eef0f3; stroke-width: 1; }
.rx-chart .axis text { fill: var(--rx-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.rx-chart .bar { fill: var(--rx-brand); }
.rx-chart .bar.current { fill: var(--rx-brand); }
.rx-chart .bar.past { fill: #9fcca8; }
.rx-chart .hit { fill: transparent; cursor: default; }
.rx-chart .hit:hover + .bar, .rx-chart g.col:hover .bar { fill: var(--rx-brand-600); }
.rx-chart .cap { fill: var(--rx-text); font-size: 11px; font-weight: 600; transition: opacity .1s; }
.rx-chart:hover .cap, .rx-chart:focus-within .cap { opacity: 0; }  /* the tooltip replaces the direct label */
.rx-tip {
  position: absolute; pointer-events: none; background: var(--rx-text); color: #fff; font-size: 12px; padding: 6px 9px;
  border-radius: 6px; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .1s;
}
.rx-tip strong { display: block; font-size: 13px; }

/* segmented status bar */
.rx-seg { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: transparent; }
.rx-seg span { display: block; height: 100%; }
.rx-seg .good { background: #0ca30c; } .rx-seg .warn { background: #fab219; }
.rx-seg .serious { background: #ec835a; } .rx-seg .critical { background: #d03b3b; }
.rx-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 13px; color: var(--rx-text-2); }
.rx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rx-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* ---------- tabs ---------- */
.rx-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rx-border); margin-bottom: 20px; overflow-x: auto; }
.rx-tabs a {
  padding: 10px 14px; color: var(--rx-muted) !important; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
  text-decoration: none !important; white-space: nowrap;
}
.rx-tabs a.active { color: var(--rx-text) !important; border-bottom-color: var(--rx-brand); }
.rx-tabs a .rx-count { background: var(--rx-neutral-bg); color: var(--rx-text-2); border-radius: 999px; padding: 1px 7px; font-size: 11px; margin-left: 6px; }

/* key/value */
.rx-kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; }
.rx-kv dt { color: var(--rx-muted); font-weight: 500; }
.rx-kv dd { margin: 0; color: var(--rx-text); word-break: break-word; }

.rx-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rx-filters .form-control { width: auto; min-width: 160px; }
.rx-chip { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--rx-border-strong); color: var(--rx-text-2) !important; font-size: 13px; font-weight: 500; text-decoration: none !important; background: #fff; }
.rx-chip.active { background: var(--rx-text); border-color: var(--rx-text); color: #fff !important; }
.rx-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; font-size: 12px; }
.rx-muted { color: var(--rx-muted); }
.text-muted { color: var(--rx-muted) !important; }

/* search results */
.rx-result-group h6 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--rx-muted); margin: 0; padding: 12px 18px; border-bottom: 1px solid var(--rx-border); }
mark { background: #fff3b0; padding: 0 1px; border-radius: 2px; }

/* ==========================================================================
   Legacy markup still used by older pages (Bootstrap 4 era). Kept small; new pages should use Bootstrap 5 + rx-* classes.
   ========================================================================== */
.page-header { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.page-header .page-title { margin: 0; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; list-style: none; margin: 0; padding: 0 0 0 12px;
               border-left: 1px solid var(--rx-border); font-size: 13px; }
.breadcrumbs li, .breadcrumbs a { color: var(--rx-muted); }
.breadcrumbs .separator i { font-size: 10px; }
.page-category { color: var(--rx-muted); margin-bottom: 16px; }

.card-category { color: var(--rx-muted); font-size: 13px; margin: 2px 0 0; }
.card-tools, .card-action { display: flex; gap: 8px; align-items: center; }
.card-action { border-top: 1px solid var(--rx-border); padding: 14px 18px; }
.card-block { padding: 18px; }

/* Bootstrap 4 helpers that no longer exist in 5 */
.form-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-inline .form-control, .form-inline .form-select { width: auto; }
.input-group-prepend, .input-group-append { display: flex; }
.modal-md { --bs-modal-width: 560px; }
.btn-xs { padding: 2px 8px !important; font-size: 12px !important; }
.btn.sharp { min-width: 32px; padding: 4px 8px !important; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.btn-link { box-shadow: none !important; }
.form-button-action { display: inline-flex; gap: 2px; }
.form-button-action .btn { padding: 4px 8px !important; }
.form-errors { list-style: none; padding: 0; }
ul.messages { list-style: none; padding: 0; margin: 0; }

/* the old themed checkbox: <label class="form-check-label"><input class="form-check-input"><span class="form-check-sign">… */
.form-check-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check-label > .form-check-input { float: none; margin: 0; }
.form-check-sign, .form-radio-sign { color: var(--rx-text); }
.form-radio-label { display: inline-flex; align-items: center; gap: 8px; margin-right: 16px; cursor: pointer; }
.form-radio-input { accent-color: var(--rx-brand); }
.imagecheck-image { max-width: 100%; border-radius: 6px; }

/* simple vertical timeline (ticket history) */
.timeline { list-style: none; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 0; bottom: 0; width: 2px; background: var(--rx-border); }
.timeline > li { position: relative; padding-left: 44px; margin-bottom: 16px; }
.timeline-badge { position: absolute; left: 4px; top: 4px; width: 24px; height: 24px; border-radius: 50%;
                  background: var(--rx-brand-100); color: var(--rx-brand-600); display: flex; align-items: center; justify-content: center; font-size: 11px; }
.timeline-panel { background: var(--rx-surface); border: 1px solid var(--rx-border); border-radius: var(--rx-radius); padding: 12px 14px; }
.timeline-title { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.timeline-footer { color: var(--rx-muted); font-size: 12px; margin-top: 6px; }

/* DataTables + bootstrap-table on BS5 */
div.dataTables_wrapper div.dataTables_filter input, div.dataTables_wrapper div.dataTables_length select { margin-left: 6px; }
div.dataTables_wrapper div.dataTables_info { color: var(--rx-muted); font-size: 13px; }
.bootstrap-table .fixed-table-toolbar .btn-group > .btn, .bootstrap-table .fixed-table-toolbar .btn { padding: 6px 10px !important; }
.bootstrap-table .fixed-table-pagination .page-list .btn-group .btn { padding: 4px 10px !important; }
.bootstrap-table .filter-control select, .bootstrap-table .filter-control input { font-size: 12px !important; padding: 4px 8px !important; }

/* auth pages */
.rx-auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); background: var(--rx-surface); }
.rx-auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 96px); }
.rx-auth-form { width: 100%; max-width: 380px; }
.rx-auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }
.rx-auth-brand img { width: 40px; height: 40px; object-fit: contain; }
.rx-auth-title { font-size: 24px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.01em; }
.rx-auth-aside { position: relative; color: #fff; display: flex; flex-direction: column; justify-content: flex-end;
                 padding: 56px; overflow: hidden; background-color: #1f5c29;
                 background-image:
                   linear-gradient(to top, rgba(18, 56, 26, .94) 0%, rgba(18, 56, 26, .72) 32%, rgba(18, 56, 26, .15) 62%, rgba(0, 0, 0, 0) 100%),
                   url('../img/loginback.jpg');
                 background-size: cover; background-position: 60% center; }
.rx-auth-aside h2 { font-size: 28px; font-weight: 700; line-height: 1.25; max-width: 460px; position: relative; z-index: 1; text-shadow: 0 1px 12px rgba(0,0,0,.35); }
.rx-auth-aside ul { list-style: none; padding: 0; margin: 24px 0 0; position: relative; z-index: 1; }
.rx-auth-aside li { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; color: rgba(255,255,255,.9); }
.rx-auth-aside li i { width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,.15); display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 991px) { .rx-auth { grid-template-columns: 1fr; } .rx-auth-aside { display: none; } }

/* password field with a show/hide eye inside it */
.rx-password { position: relative; }
.rx-password .form-control { padding-right: 2.75rem; }
.rx-password .form-control.is-invalid { padding-right: 4.5rem; background-position: right 2.75rem center; }
.rx-password-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--rx-radius-sm); background: transparent; color: var(--rx-muted); cursor: pointer;
}
.rx-password-toggle:hover { color: var(--rx-text); background: var(--rx-bg); }
.rx-password-toggle:focus-visible { outline: 2px solid var(--rx-brand); outline-offset: 1px; }
.rx-nav-badge { margin-left: auto; background: var(--rx-warn-bg); color: var(--rx-warn); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }

/* code blocks with copy button */
.rx-code { position: relative; margin-bottom: 12px; }
.rx-code pre { background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 14px 16px; margin: 0; font-size: 12.5px;
               line-height: 1.55; overflow-x: auto; white-space: pre; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.rx-code-copy { position: absolute; top: 8px; right: 8px; padding: 2px 8px !important; font-size: 11px !important; opacity: .9; }
.rx-steps .rx-card-title { display: flex; align-items: center; gap: 10px; }

/* integration diagram */
.rx-flow { display: grid; grid-template-columns: 170px minmax(0, 1fr) 170px; gap: 16px; align-items: stretch; }
.rx-flow-node { border: 1px solid var(--rx-border); border-radius: var(--rx-radius); background: var(--rx-bg); padding: 18px 12px;
                display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; }
.rx-flow-node i { font-size: 22px; color: var(--rx-brand); }
.rx-flow-node span { color: var(--rx-muted); font-size: 12px; }
.rx-flow-links { display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.rx-flow-link { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px;
                border: 1px solid var(--rx-border); border-radius: 8px; background: #fff; }
.rx-flow-link::after { position: absolute; top: 50%; transform: translateY(-50%); font-family: "Font Awesome 5 Free"; font-weight: 900;
                       color: var(--rx-brand); font-size: 14px; }
.rx-flow-link.right::after { content: "\f061"; right: -22px; }
.rx-flow-link.left::after { content: "\f060"; left: -22px; }
.rx-flow-step { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--rx-brand); color: #fff;
                display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.rx-flow code { font-size: 12px; word-break: break-all; }
@media (max-width: 991px) { .rx-flow { grid-template-columns: 1fr; } .rx-flow-link::after { display: none; } }
.rx-tabs a .rx-count.rx-count-alert { background: var(--rx-critical-bg); color: var(--rx-critical); }

/* ticket conversation */
.rx-thread { list-style: none; padding: 0; margin: 0; }
.rx-msg { display: flex; gap: 12px; padding: 16px 18px; border-top: 1px solid var(--rx-border); }
.rx-msg:first-child { border-top: 0; }
.rx-msg .rx-avatar { width: 32px; height: 32px; font-size: 12px; }
.rx-msg-body { min-width: 0; flex: 1; }
.rx-msg-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.rx-msg-head strong { font-size: 13px; }
.rx-msg-head span { color: var(--rx-muted); font-size: 12px; }
.rx-msg-text { white-space: pre-wrap; word-break: break-word; }
.rx-msg.internal { background: #fffbeb; }
.rx-msg.internal .rx-avatar { background: #fde68a; color: #92400e; }
.rx-msg.customer .rx-avatar { background: var(--rx-info-bg); color: var(--rx-info); }
.rx-msg.event { padding: 8px 18px; color: var(--rx-muted); font-size: 12px; align-items: center; }
.rx-msg.event i { width: 32px; text-align: center; }
.rx-composer { border-top: 1px solid var(--rx-border); padding: 16px 18px; }
.rx-composer.internal textarea { background: #fffbeb; }
/* key/value lists in narrow sidebars: let values shrink and wrap */
.rx-kv dd { min-width: 0; }
.rx-kv .form-select, .rx-kv .form-control { width: 100%; max-width: 100%; }
.rx-kv .rx-status { white-space: normal; }
/* segmented toggles (e.g. reply / internal note) */
.btn-group > .btn.rx-btn-ghost.active { background: var(--rx-text) !important; color: #fff !important; border-color: var(--rx-text) !important; }

/* ---------- Help & documentation ---------- */
.rx-doc-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr) 200px; gap: 20px; align-items: start; }
@media (max-width: 1399px) { .rx-doc-layout { grid-template-columns: 220px minmax(0, 1fr); } .rx-doc-toc { display: none; } }
@media (max-width: 991px) { .rx-doc-layout { grid-template-columns: 1fr; } }
.rx-doc-nav, .rx-doc-toc { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
.rx-doc-nav-section { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--rx-muted); margin: 14px 0 6px; }
.rx-doc-nav-link { display: block; padding: 6px 10px; border-radius: 8px; color: var(--rx-text); font-size: 14px; text-decoration: none; }
.rx-doc-nav-link i { color: var(--rx-muted); }
.rx-doc-nav-link:hover { background: var(--rx-surface-2, #f3f5f7); }
.rx-doc-nav-link.active { background: var(--rx-brand-50, #e8f5ec); color: var(--rx-brand-600); font-weight: 600; }
.rx-doc-nav-link.active i { color: var(--rx-brand); }
.rx-doc-toc a { display: block; font-size: 13px; color: var(--rx-muted); padding: 3px 0 3px 10px; border-left: 2px solid var(--rx-border); text-decoration: none; }
.rx-doc-toc a.sub { padding-left: 22px; }
.rx-doc-toc a:hover { color: var(--rx-brand-600); border-left-color: var(--rx-brand); }
.rx-doc .rx-card-body { padding: 28px 36px; max-width: 900px; }
.rx-doc h1 { font-size: 26px; margin-bottom: 8px; }
.rx-doc h1 + p { font-size: 16px; color: var(--rx-muted); }
.rx-doc h2 { font-size: 20px; margin: 32px 0 12px; padding-top: 8px; border-top: 1px solid var(--rx-border); scroll-margin-top: 80px; }
.rx-doc h3 { font-size: 16px; margin: 22px 0 8px; scroll-margin-top: 80px; }
.rx-doc p, .rx-doc li { line-height: 1.65; }
.rx-doc li { margin-bottom: 4px; }
.rx-doc code { background: #f1f3f5; color: #c2255c; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.rx-doc pre { background: #1f2933; color: #e6edf3; padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-size: 12.5px; line-height: 1.55; }
.rx-doc pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.rx-doc blockquote { border-left: 4px solid var(--rx-brand); background: var(--rx-brand-50, #e8f5ec); padding: 10px 16px; border-radius: 0 8px 8px 0; margin: 16px 0; }
.rx-doc blockquote p:last-child { margin-bottom: 0; }
.rx-doc table { font-size: 14px; margin: 12px 0 18px; }
.rx-doc table th { white-space: nowrap; }
.rx-doc mark { background: #fff3bf; padding: 0 2px; }
.rx-doc-pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--rx-border); }
.rx-doc-pager a { text-decoration: none; font-weight: 600; }
.rx-doc-pager small { display: block; color: var(--rx-muted); font-weight: 400; font-size: 12px; }
.rx-qr { width: 220px; } .rx-qr svg { display: block; width: 100%; height: auto; }
