/* ============================================================
   ZONPAY FINANCE — Owner Portal Design System
   Replace AdminLTE 3 with this custom CSS.
   ============================================================ */

/* ─── CSS TOKENS ─────────────────────────────────────────── */
:root {
  --sidebar-w:             260px;
  --sidebar-bg:            #151c2c;
  --sidebar-bg-2:          #1b2438;
  --sidebar-hover:         #232e47;
  --sidebar-text:          #aab4c8;
  --sidebar-text-active:   #ffffff;

  --primary:               #2757e8;
  --primary-dark:          #1c41b8;
  --primary-light:         #eaf0ff;
  --success:               #17a34a;
  --success-light:         #e7f8ee;
  --warning:               #e08a1c;
  --warning-light:         #fdf1e0;
  --danger:                #dc2b2b;
  --danger-light:          #fce9e9;
  --info:                  #0891b2;
  --info-light:            #e3f6fa;

  --body-bg:               #f3f5f9;
  --card-bg:               #ffffff;
  --border:                #e6e9f0;
  --text:                  #1c2333;
  --text-muted:            #7a8296;

  --radius:                10px;
  --shadow:                0 1px 2px rgba(16,24,40,.04),0 1px 3px rgba(16,24,40,.06);
  --shadow-md:             0 4px 14px rgba(16,24,40,.08);

  --topbar-h:              60px;
  --font-main:             'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:             'JetBrains Mono', 'Courier New', monospace;
  --transition:            all 0.2s ease;

  /* Documented spacing scale — additive tokens, nothing existing was
     renamed, so no page depending on the raw px values above breaks.
     New sections (Dashboard's redesign and onward) should reach for
     these instead of ad-hoc px values. */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;

  /* Deep-navy accent — distinct from --primary (the interactive/action
     blue used on buttons/links/active-nav everywhere already) — reserved
     for financial data accents (chart lines, positive-trend emphasis)
     so numbers read as "trustworthy fintech ink," not just "another blue
     button." Never applied globally — see Dashboard's own styles. */
  --navy-ink:              #1e293b;
  --navy-accent:           #1e40af;
}

/* ─── RESET / BASE ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--body-bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
}

a { text-decoration: none; }
a:hover { text-decoration: none; }

.mono, code, pre { font-family: var(--font-mono); }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-thumb { background: #c7cede; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* Consistent, visible keyboard-focus ring — additive, nothing anywhere
   suppresses the browser default (:focus-visible degrades gracefully to
   never firing on mouse interaction, so this never adds a ring on click). */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ─── SIDEBAR ────────────────────────────────────────────── */
#zp-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  z-index: 1030;
  display: flex;
  flex-direction: column;
  transition: width .2s ease, transform .2s ease;
  overflow: hidden;
}

#zp-sidebar.collapsed { width: 72px; }

/* brand */
.zp-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.zp-brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #5b8bff);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 15px;
  flex-shrink: 0;
}
.zp-brand-text { color: #fff; font-weight: 700; font-size: 15.5px; letter-spacing: .2px; white-space: nowrap; }
.zp-brand-text small { display: block; color: #8891a8; font-weight: 500; font-size: 10.5px; letter-spacing: .6px; }
#zp-sidebar.collapsed .zp-brand-text { display: none; }

/* sidebar search */
.zp-sidebar-search { padding: 12px 14px; flex-shrink: 0; position: relative; }
.zp-sidebar-search input {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  color: #dfe3ee;
  border-radius: 8px;
  font-size: 12.5px;
  padding: 7px 10px 7px 30px;
  width: 100%;
  outline: none;
}
.zp-sidebar-search input::placeholder { color: #6d7690; }
.zp-sidebar-search .si-icon { position: absolute; top: 21px; left: 24px; color: #6d7690; font-size: 12px; }
#zp-sidebar.collapsed .zp-sidebar-search { display: none; }

/* nav scroll area */
.zp-nav-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  padding: 4px 10px 20px;
}
.zp-nav-scroll::-webkit-scrollbar { width: 4px; }
.zp-nav-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); }

.zp-nav-section { color: #5b6480; font-size: 10.5px; font-weight: 700; letter-spacing: 1px; padding: 14px 12px 6px; white-space: nowrap; }
#zp-sidebar.collapsed .zp-nav-section { display: none; }

/* nav items */
.zp-nav-item { margin-bottom: 2px; }
.zp-nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--sidebar-text); font-size: 13.2px; font-weight: 500;
  cursor: pointer; white-space: nowrap; position: relative;
  transition: background .12s, color .12s;
  text-decoration: none;
}
.zp-nav-link .zp-nav-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.zp-nav-link .zp-nav-label { flex: 1; }
.zp-nav-link .zp-chev { font-size: 10px; transition: transform .15s; flex-shrink: 0; margin-left: auto; }
.zp-nav-item.open > .zp-nav-link .zp-chev { transform: rotate(90deg); }
.zp-nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.zp-nav-item.active > .zp-nav-link { background: var(--sidebar-hover); color: #fff; }
.zp-nav-item.active > .zp-nav-link::before {
  content: '';
  position: absolute; left: -10px; top: 6px; bottom: 6px;
  width: 3px; background: var(--primary); border-radius: 2px;
}

/* NavLink active (Blazor) */
.zp-nav-link.active { background: var(--sidebar-hover); color: #fff; }
.zp-nav-link.active::before {
  content: '';
  position: absolute; left: -10px; top: 6px; bottom: 6px;
  width: 3px; background: var(--primary); border-radius: 2px;
}

/* children */
.zp-nav-children { max-height: 0; overflow: hidden; transition: max-height .18s ease; }
.zp-nav-item.open > .zp-nav-children { max-height: 800px; }
.zp-nav-child {
  display: block; padding: 7px 12px 7px 44px;
  font-size: 12.6px; color: #8a93ab; border-radius: 7px; cursor: pointer;
  transition: background .12s, color .12s;
}
.zp-nav-child:hover { color: #fff; background: var(--sidebar-hover); }
.zp-nav-child.active { color: #fff; background: var(--primary); font-weight: 600; }

/* collapsed */
#zp-sidebar.collapsed .zp-nav-label,
#zp-sidebar.collapsed .zp-nav-children,
#zp-sidebar.collapsed .zp-chev { display: none; }
#zp-sidebar.collapsed .zp-nav-link { justify-content: center; }
#zp-sidebar.collapsed .zp-nav-section { opacity: 0; }

/* sidebar footer */
.zp-sidebar-foot {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.zp-owner-chip { display: flex; align-items: center; gap: 9px; }
.zp-owner-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--primary-light); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.zp-owner-name { color: #fff; font-size: 12.5px; font-weight: 600; }
.zp-owner-role { color: #7a839c; font-size: 10.5px; }
#zp-sidebar.collapsed .zp-oc-text { display: none; }

/* ─── MAIN AREA ──────────────────────────────────────────── */
#zp-main {
  margin-left: var(--sidebar-w);
  transition: margin-left .2s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
#zp-main.collapsed { margin-left: 72px; }

/* ─── TOPBAR ─────────────────────────────────────────────── */
#zp-topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.zp-tb-search { position: relative; width: 320px; }
.zp-tb-search input {
  border-radius: 8px;
  background: #f4f6fa;
  border: 1px solid var(--border);
  font-size: 13px;
  padding: 8px 36px 8px 34px;
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.zp-tb-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.zp-tb-search .zp-tb-si { position: absolute; left: 12px; top: 9px; color: var(--text-muted); font-size: 14px; }
.zp-tb-search kbd { position: absolute; right: 8px; top: 7px; font-size: 10px; background: #eceff5; color: #8a93ab; border-radius: 4px; padding: 2px 5px; border: none; }
.zp-tb-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #4b5468; background: transparent; border: none;
  font-size: 16px; position: relative; cursor: pointer;
  transition: background .12s;
}
.zp-tb-icon:hover { background: #f1f3f8; }
.zp-tb-icon .zp-dot {
  position: absolute; top: 6px; right: 7px;
  width: 8px; height: 8px; background: var(--danger);
  border-radius: 50%; border: 2px solid #fff;
}
.zp-tb-profile {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 5px 8px 5px 5px; border-radius: 8px;
  transition: background .12s;
}
.zp-tb-profile:hover { background: #f1f3f8; }
.zp-tb-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #6d93ff);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12.5px;
}
.zp-tb-name { font-size: 12.5px; font-weight: 700; line-height: 1.1; }
.zp-tb-role { font-size: 10.5px; color: var(--text-muted); }

/* ─── CONTENT AREA ───────────────────────────────────────── */
#zp-content {
  padding: 20px 24px 60px;
  flex: 1;
}

/* ─── BREADCRUMB ROW ─────────────────────────────────────── */
.zp-crumb-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.zp-crumb-row .breadcrumb { margin: 0; font-size: 12.5px; }
.zp-crumb-row .breadcrumb-item a { color: var(--text-muted); }
.zp-crumb-row .breadcrumb-item.active { color: var(--text-muted); }
.zp-page-title { font-size: 20px; font-weight: 700; margin: 2px 0 0; }
.zp-page-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* ─── KPI / STAT CARDS ───────────────────────────────────── */
.zp-kpi {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  height: 100%;
}
.zp-kpi-top { display: flex; justify-content: space-between; align-items: flex-start; }
.zp-kpi-icon {
  width: 38px; height: 38px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.zp-kpi-label { color: var(--text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.zp-kpi-value { font-size: 24px; font-weight: 800; margin-top: 4px; line-height: 1.2; }
.zp-kpi-delta { font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; margin-top: 6px; }
.zp-kpi-delta.up { color: var(--success); }
.zp-kpi-delta.down { color: var(--danger); }

/* ─── SECURITY POSTURE GRID ──────────────────────────────── */
/* Distributes the score + status badges across the full card width
   instead of clustering them left with dead space to the right —
   auto-fit lets cells wrap onto new rows on narrow screens without a
   separate media query. */
.zp-posture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}
.zp-posture-cell {
  padding-right: 16px;
  border-right: 1px solid var(--border);
}
.zp-posture-cell:last-child { border-right: none; }
.zp-posture-score { display: flex; align-items: center; gap: 8px; }

/* ─── SETTINGS TAB GRID ──────────────────────────────────── */
/* Two-column enterprise layout that fills the available width instead
   of a fixed max-width column — sections that don't split naturally
   (the MFA/IP-restriction toggle bars) opt out with grid-column:1/-1
   inline on the individual element. */
.zp-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px 32px;
}
.zp-settings-heading {
  font-weight: 700;
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 8px;
}
@media (max-width: 768px) {
  .zp-settings-grid { grid-template-columns: 1fr; }
}

/* ─── CARDS ──────────────────────────────────────────────── */
.zp-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.zp-card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.zp-card-head h6 { margin: 0; font-weight: 700; font-size: 14px; }
.zp-card-head .zp-sub { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }
.zp-card-body { padding: 18px; }
.zp-card-body-sm { padding: 12px 18px; }

/* ─── MEDIA DROPZONE ─────────────────────────────────────── */
.zp-dropzone { transition: border-color .15s, background .15s; }
.zp-dropzone-active { border-color: var(--primary) !important; background: rgba(39,87,232,.05); }

/* ─── BUTTONS ────────────────────────────────────────────── */
.btn { font-size: 13px; font-weight: 600; border-radius: 8px; padding: 7px 14px; }
.btn-sm { font-size: 12px; padding: 5px 10px; }
.btn-xs { font-size: 11px; padding: 3px 8px; border-radius: 6px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-outline-secondary { color: #4b5468; border-color: var(--border); background: #fff; }
.btn-outline-secondary:hover { background: #f1f3f8; color: #1c2333; border-color: #d0d5df; }
.btn-light-icon { background: #f4f6fa; border: 1px solid var(--border); color: #4b5468; }
.btn-light-icon:hover { background: #e9ecf2; color: var(--primary); border-color: #d0d5df; }

/* ─── TABLE ──────────────────────────────────────────────── */
.zp-table-toolbar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.zp-search-wrap { position: relative; min-width: 220px; }
.zp-search-wrap input { padding-left: 32px; font-size: 12.5px; }
.zp-search-wrap .zp-search-icon { position: absolute; left: 10px; top: 8px; font-size: 13px; color: var(--text-muted); }

/* ─── ROLES & PERMISSIONS — ENTERPRISE SPLIT PANE ───────── */
/* Fixed-width left directory + flex-grow right detail, filling the full
   content-area width inside the sidebar layout (no page-level max-width).
   Collapses to a single column below tablet width — list and detail
   stack instead of sitting side by side, and only the matrix itself
   scrolls horizontally on narrow screens, never the page body. */
.zp-roles-split {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.zp-roles-left {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: calc(100vh - 220px);
  min-height: 400px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.zp-roles-search { padding: 12px; border-bottom: 1px solid var(--border); }
.zp-roles-list { overflow-y: auto; flex: 1; }
.zp-role-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.zp-role-row:hover { background: rgba(39,87,232,.04); }
.zp-role-row.active { background: rgba(39,87,232,.08); border-left: 3px solid var(--primary); padding-left: 11px; }
.zp-role-row .zp-role-name { font-weight: 700; font-size: 13px; color: var(--text); }
.zp-role-row .zp-role-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; display: flex; gap: 10px; }

.zp-roles-right {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 400px;
}

.zp-classification {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
}
.zp-classification-critical   { background: var(--danger-light);  color: var(--danger); }
.zp-classification-privileged { background: var(--warning-light); color: var(--warning); }
.zp-classification-standard   { background: var(--info-light);    color: var(--info); }
.zp-classification-readonly   { background: #f1f2f6; color: #6b7280; }

.zp-perm-group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: #f7f8fb;
  cursor: pointer;
  font-weight: 700;
  font-size: 12.5px;
  border-top: 1px solid var(--border);
}
.zp-perm-group-head:first-child { border-top: none; }
.zp-perm-group-head .zp-chev { transition: transform .15s; margin-left: auto; font-size: 11px; color: var(--text-muted); }
.zp-perm-group-head.collapsed .zp-chev { transform: rotate(-90deg); }
.zp-perm-matrix-wrap { overflow-x: auto; }
table.zp-perm-matrix { width: 100%; border-collapse: collapse; font-size: 12px; }
table.zp-perm-matrix th, table.zp-perm-matrix td {
  padding: 7px 10px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.zp-perm-matrix th { color: #5b6478; font-size: 10.3px; text-transform: uppercase; letter-spacing: .3px; }
table.zp-perm-matrix td:first-child, table.zp-perm-matrix th:first-child { text-align: left; }
.zp-perm-granted { color: var(--success); font-size: 15px; }
.zp-perm-notgranted { color: var(--border); font-size: 15px; }
.zp-perm-dangerous-icon { color: var(--danger); margin-left: 4px; cursor: help; }
.zp-perm-lock-icon { color: var(--text-muted); margin-left: 4px; cursor: help; }

@media (max-width: 900px) {
  .zp-roles-split { grid-template-columns: 1fr; }
  .zp-roles-left { max-height: 320px; }
}

.zp-table-wrap { overflow-x: auto; }
table.zp-table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
table.zp-table thead th {
  background: #f7f8fb;
  color: #5b6478;
  text-transform: uppercase;
  font-size: 10.7px;
  letter-spacing: .4px;
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.zp-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #f0f1f6;
  vertical-align: middle;
}
table.zp-table tbody tr:hover { background: #f9fafc; }
table.zp-table tbody tr:last-child td { border-bottom: none; }

.zp-cell-primary { font-weight: 600; color: var(--text); }
.zp-cell-sub { color: var(--text-muted); font-size: 11.5px; }

/* Operations toolbar risk tiers (Database Management details page) — the
   toolbar visually separates Safe/Administrative/Controlled/Privileged
   action groups instead of rendering every button identically. */
.zp-toolbar-tier-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted); white-space: nowrap;
}
.zp-toolbar-tier-label-danger { color: var(--warning); }
.zp-toolbar-tier-divider { width: 1px; align-self: stretch; background: var(--border); }
@media (max-width: 576px) {
  .zp-toolbar-tier-divider { display: none; }
}

.zp-kpi-clickable { transition: box-shadow .15s, transform .15s; }
.zp-kpi-clickable:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); transform: translateY(-1px); }

/* WhatsApp Cloud Conversations — 3-column enterprise inbox shell.
   Desktop: list / thread / customer-context panel side by side.
   Tablet: panel becomes a toggled overlay (see showContextPanel in code) —
   the info button in the thread header shows/hides it via d-lg-flex/d-none.
   Mobile: list stacks above the thread; both stay full-width so nothing
   overflows horizontally at 390px. */
.zp-wa-inbox-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr minmax(260px, 320px);
}
.zp-wa-inbox-panel { min-width: 0; }
@media (max-width: 991px) {
  .zp-wa-inbox-shell { grid-template-columns: minmax(240px, 300px) 1fr; }
  .zp-wa-inbox-panel {
    position: absolute; right: 0; top: 0; bottom: 0; width: min(320px, 90vw);
    z-index: 20; box-shadow: -4px 0 16px rgba(0,0,0,.15);
  }
}
@media (max-width: 767px) {
  .zp-wa-inbox-shell { position: relative; grid-template-columns: 1fr; height: calc(100vh - 160px) !important; }
  .zp-wa-inbox-list { border-right: none !important; }
  /* Single navigable screen at a time — .zp-wa-mobile-hide-list is toggled
     from code once a conversation is selected, so list and thread never
     both occupy the viewport at once on a phone. */
  .zp-wa-mobile-hide-list .zp-wa-inbox-list { display: none; }
  .zp-wa-mobile-hide-thread .zp-wa-inbox-thread { display: none; }
}
@media (min-width: 768px) {
  .zp-wa-mobile-back-btn { display: none; }
}

.zp-avatar-mini {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--primary-light); color: var(--primary-dark);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px; flex-shrink: 0;
}

.zp-row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.zp-icon-btn {
  width: 28px; height: 28px; border-radius: 7px;
  border: 1px solid var(--border); background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  color: #5b6478; font-size: 13px; cursor: pointer;
  transition: background .12s, color .12s;
}
.zp-icon-btn:hover { background: #f4f6fa; color: var(--primary); }
.zp-icon-btn.danger:hover { background: var(--danger-light); color: var(--danger); border-color: #f9c3c3; }

.zp-table-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; flex-wrap: wrap; gap: 10px;
}
.zp-pg-btn {
  width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid var(--border); background: #fff;
  font-size: 12px; color: #4b5468; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.zp-pg-btn:hover { background: #f1f3f8; }
.zp-pg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.zp-pg-btn:disabled { opacity: .4; cursor: default; }

/* ─── BADGES ─────────────────────────────────────────────── */
.zp-badge {
  font-size: 10.8px; font-weight: 700;
  padding: 4px 9px; border-radius: 20px; letter-spacing: .2px;
  display: inline-flex; align-items: center; gap: 4px;
}
.zp-badge-active   { background: var(--success-light); color: var(--success); }
.zp-badge-trial    { background: var(--info-light);    color: var(--info); }
.zp-badge-suspended{ background: var(--danger-light);  color: var(--danger); }
.zp-badge-pending  { background: var(--warning-light); color: var(--warning); }
.zp-badge-expired  { background: #f1f2f6; color: #6b7280; }
.zp-badge-draft    { background: #f1f2f6; color: #6b7280; }
.zp-badge-paid     { background: var(--success-light); color: var(--success); }
.zp-badge-overdue  { background: var(--danger-light);  color: var(--danger); }
.zp-badge-verified { background: var(--success-light); color: var(--success); }
.zp-badge-enabled  { background: var(--success-light); color: var(--success); }
.zp-badge-disabled { background: #f1f2f6; color: #6b7280; }
.zp-badge-open     { background: var(--info-light);    color: var(--info); }
.zp-badge-closed   { background: #f1f2f6; color: #6b7280; }
.zp-badge-success  { background: var(--success-light); color: var(--success); }
.zp-badge-failed   { background: var(--danger-light);  color: var(--danger); }
.zp-badge-warning  { background: var(--warning-light); color: var(--warning); }
.zp-badge-running  { background: var(--info-light);    color: var(--info); }

/* ─── EMPTY / ERROR / LOADING STATES ─────────────────────── */
.zp-state-box { padding: 60px 20px; text-align: center; }
.zp-state-icon {
  width: 64px; height: 64px; border-radius: 16px;
  background: #f1f3f8;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #9aa2b8; margin: 0 auto 16px;
}
.zp-state-icon.error { background: var(--danger-light); color: var(--danger); }
.zp-state-box h6 { font-weight: 700; margin-bottom: 4px; font-size: 15px; }
.zp-state-box p { color: var(--text-muted); font-size: 12.8px; max-width: 360px; margin: 0 auto 16px; }

/* Skeleton loader */
.zp-skel {
  background: linear-gradient(90deg,#eef0f5 25%,#f6f7fa 37%,#eef0f5 63%);
  background-size: 400% 100%;
  animation: zp-skel-anim 1.4s ease infinite;
  border-radius: 6px;
}
@keyframes zp-skel-anim {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ─── FORMS ──────────────────────────────────────────────── */
.form-label { font-size: 12.3px; font-weight: 600; color: #3c4457; margin-bottom: 5px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-control, .form-select {
  border-radius: 8px;
  border-color: var(--border);
  font-size: 13px;
  padding: 8px 11px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-control-sm, .form-select-sm { border-radius: 7px; font-size: 12.5px; }
.zp-section-title {
  font-size: 13.5px; font-weight: 700;
  margin: 22px 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.zp-upload-drop {
  border: 1.5px dashed var(--border); border-radius: 10px;
  padding: 26px; text-align: center; background: #fafbfd; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.zp-upload-drop:hover { border-color: var(--primary); background: var(--primary-light); }

/* ─── TABS ───────────────────────────────────────────────── */
.zp-tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
  overflow-x: auto;
}
.zp-tab {
  padding: 11px 16px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition: color .12s, border-color .12s;
}
.zp-tab:hover { color: var(--text); }
.zp-tab.active { color: var(--primary); border-color: var(--primary); }

/* ─── STEPPER / WIZARD ───────────────────────────────────── */
.zp-stepper { display: flex; align-items: center; margin-bottom: 26px; }
.zp-step { display: flex; align-items: center; gap: 10px; flex: 1; }
.zp-step-circle {
  width: 32px; height: 32px; border-radius: 50%;
  background: #eef0f6; color: #8a93ab;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
  border: 2px solid #eef0f6;
}
.zp-step.active .zp-step-circle { background: var(--primary); color: #fff; border-color: var(--primary); }
.zp-step.done   .zp-step-circle { background: var(--success); color: #fff; border-color: var(--success); }
.zp-step-label { font-size: 12.5px; font-weight: 600; color: #8a93ab; }
.zp-step.active .zp-step-label,
.zp-step.done   .zp-step-label { color: var(--text); }
.zp-step-line { flex: 1; height: 2px; background: #eef0f6; margin: 0 6px; }

/* ─── PRICING CARDS ──────────────────────────────────────── */
.zp-pricing-card {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 22px; background: #fff; height: 100%; position: relative;
}
.zp-pricing-card.popular { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.zp-pricing-card.disabled { opacity: .55; background: var(--body-bg); }
.zp-pricing-card .zp-ribbon {
  position: absolute; top: -11px; left: 22px;
  background: var(--primary); color: #fff;
  font-size: 10.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
}

/* Visually hidden but still focusable/clickable — used to back a
   card-styled <label> with a real, accessible native <input> instead of a
   div-with-onclick reimplementation of radio-button semantics. */
.zp-visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ─── QUICK ACTION BUTTON ────────────────────────────────── */
.zp-qa-btn {
  border: 1px dashed var(--border); border-radius: 9px;
  padding: 10px 12px; font-size: 12px; font-weight: 600;
  color: #4b5468; background: #fff;
  display: flex; align-items: center; gap: 8px; width: 100%;
  transition: border-color .12s, color .12s, background .12s;
  cursor: pointer;
}
.zp-qa-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ─── MINI GAUGE ─────────────────────────────────────────── */
.zp-gauge { height: 8px; border-radius: 5px; background: #eef0f6; overflow: hidden; }
.zp-gauge > div { height: 100%; border-radius: 5px; transition: width .4s; }
.progress-thin { height: 6px; border-radius: 5px; }

/* ─── TOAST ─────────────────────────────────────────────────
   ZonPay uses Blazored.Toast — these styles extend/override it
   to match the reference design. */
.blazored-toast-container { z-index: 2000 !important; }

/* Also a simple ZP toast for JS-initiated notifications */
.zp-toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.zp-toast {
  background: #1c2333; color: #fff; padding: 12px 16px; border-radius: 9px;
  font-size: 12.8px; display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-md); min-width: 260px;
  animation: zp-slide-in .2s ease;
}
@keyframes zp-slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.zp-toast.success { border-left: 3px solid var(--success); }
.zp-toast.error   { border-left: 3px solid var(--danger); }
.zp-toast.warning { border-left: 3px solid var(--warning); }

/* ─── HELP FAB ───────────────────────────────────────────── */
.zp-help-fab {
  position: fixed; bottom: 24px; right: 24px;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; box-shadow: var(--shadow-md); cursor: pointer;
  z-index: 1500; border: none;
  transition: background .15s, transform .15s;
}
.zp-help-fab:hover { background: var(--primary-dark); transform: scale(1.05); }

/* ─── ERROR BOUNDARY ─────────────────────────────────────── */
.zp-page-error {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 24px; text-align: center;
}
.zp-page-error-icon { font-size: 40px; color: var(--danger); margin-bottom: 16px; }
.zp-page-error h5 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 10px; }

/* ─── BLAZORED TOAST OVERRIDE ────────────────────────────── */
.blazored-toast__icon { font-size: 16px !important; }

/* ─── SYSTEM STATUS BADGE ────────────────────────────────── */
.zp-sys-ok {
  font-size: 11px; font-weight: 700;
  background: var(--success-light); color: var(--success);
  padding: 4px 10px; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 5px;
}

/* ─── DETAIL KEY-VALUE ───────────────────────────────────── */
.zp-kv-row {
  display: flex; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--border);
  font-size: 12.8px;
}
.zp-kv-row:last-child { border-bottom: none; }
.zp-kv-label { color: var(--text-muted); }
.zp-kv-value { font-weight: 600; }

/* ─── TIMELINE ───────────────────────────────────────────── */
.zp-timeline { border-left: 2px solid var(--border); padding-left: 18px; }
.zp-timeline-item { margin-bottom: 16px; position: relative; }
.zp-timeline-dot {
  position: absolute; left: -24px; top: 3px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary);
}

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 992px) {
  #zp-sidebar { transform: translateX(-100%); }
  #zp-sidebar.mobile-open { transform: translateX(0); }
  #zp-main { margin-left: 0 !important; }
  .zp-tb-search { width: 180px; }
}
@media (max-width: 576px) {
  #zp-content { padding: 14px 14px 40px; }
  .zp-page-title { font-size: 17px; }
  .zp-kpi-value { font-size: 20px; }
}

/* ─── DARK MODE ──────────────────────────────────────────── */
.dark-mode {
  --body-bg:  #12151f;
  --card-bg:  #1a1f2e;
  --border:   #2a3040;
  --text:     #e6e9f2;
  --text-muted: #8a93ab;
}
.dark-mode #zp-topbar            { background: #161b28; border-color: #2a3040; }
.dark-mode .zp-tb-search input   { background: #1f2534; color: #e6e9f2; border-color: #2a3040; }
.dark-mode table.zp-table thead th { background: #1f2534; color: #8a93ab; }
.dark-mode table.zp-table tbody td { border-color: #232a3a; }
.dark-mode table.zp-table tbody tr:hover { background: #1f2534; }
.dark-mode .zp-card           { background: var(--card-bg); border-color: var(--border); }
.dark-mode .zp-kpi            { background: var(--card-bg); border-color: var(--border); }
.dark-mode .form-control,
.dark-mode .form-select       { background: #1f2534; color: #e6e9f2; border-color: #2a3040; }
.dark-mode .zp-icon-btn       { background: #1f2534; border-color: #2a3040; color: #8a93ab; }
.dark-mode .zp-icon-btn:hover { background: #2a3040; }
.dark-mode .btn-outline-secondary { background: #1f2534; color: #e6e9f2; border-color: #2a3040; }
.dark-mode .btn-light-icon    { background: #1f2534; border-color: #2a3040; color: #8a93ab; }

/* ─── KEEP GlobalLoader.razor overlay on top ─────────────── */
.zp-global-overlay { z-index: 999999 !important; }

/* ─── BLAZOR ERROR BANNER — suppress the default crash strip ─ */
/* Circuit errors are caught in code and shown via toast/snackbar */
#blazor-error-ui { display: none !important; }

/* ─── LOGIN PAGE ─────────────────────────────────────────── */
.zp-login-bg {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f1524, #1b2440);
}
.zp-login-box {
  width: 100%; max-width: 400px;
  background: #fff; border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

/* ─── ACCESS DENIED (inline, in-page RBAC restriction) ──────── */
.zp-access-denied {
  width: 100%;
  max-width: 560px;
  margin: 48px auto;
  padding: 48px 40px;
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.zp-access-denied-icon {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(245,158,11,.12);
  color: #d97706;
  font-size: 28px;
}
.zp-access-denied-title {
  font-size: 20px; font-weight: 800; color: var(--text);
  margin: 0 0 10px;
}
.zp-access-denied-desc {
  font-size: 14px; color: var(--text-muted, #6b7280);
  max-width: 420px; margin: 0 auto 20px; line-height: 1.6;
}
.zp-access-denied-module {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--body-bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 16px;
  font-size: 13px; font-weight: 600; color: var(--text);
  margin-bottom: 20px;
}
.zp-access-denied-code {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--body-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 16px;
  margin: 0 auto 24px; max-width: 320px;
}
.zp-access-denied-code code {
  font-size: 13px; color: var(--primary); font-weight: 700;
}
.zp-access-denied-actions {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap;
}
@media (max-width: 480px) {
  .zp-access-denied { padding: 32px 20px; margin: 24px auto; }
  .zp-access-denied-actions { flex-direction: column; }
  .zp-access-denied-actions .btn { width: 100%; }
}
