/* ── ZATCA Monitor — Modern Design System ─────────────────────────────────── */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

:root {
  --sidebar-width: 260px;
  --topbar-height: 64px;

  /* Brand palette */
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #818cf8;
  --primary-soft: rgba(79, 70, 229, 0.1);

  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.1);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.1);
  --info: #06b6d4;
  --info-soft: rgba(6, 182, 212, 0.1);

  /* Sidebar */
  --sidebar-bg: #0f172a;
  --sidebar-bg2: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #f8fafc;
  --sidebar-hover-bg: rgba(148, 163, 184, 0.08);
  --sidebar-active-bg: var(--primary);

  /* Layout */
  --content-bg: #f1f5f9;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;

  /* Typography */
  --font-base: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
}

/* ── Reset / Base ──────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-base);
  font-size: 0.875rem;
  color: #1e293b;
  background: var(--content-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.sb-nav-fixed {
  padding-top: var(--topbar-height);
  overflow-x: hidden;
  max-width: 100vw;
}

html {
  overflow-x: hidden;
}

/* ── Layout Shell ──────────────────────────────────────────────────────────── */
#layoutSidenav {
  display: flex;
  width: 100%;
  overflow-x: hidden;
}

#layoutSidenav_nav {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: fixed;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.2) transparent;
}

#layoutSidenav_content {
  flex-grow: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  min-height: calc(100vh - var(--topbar-height));
  display: flex;
  flex-direction: column;
  background: var(--content-bg);
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* ── Top Navbar ────────────────────────────────────────────────────────────── */
.sb-topnav {
  height: var(--topbar-height);
  z-index: 1040;
  background: #ffffff !important;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.sb-topnav .navbar-brand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary) !important;
  letter-spacing: -0.02em;
  min-width: 0;
  max-width: 180px;
  height: calc(var(--topbar-height) - 16px);
  overflow: hidden;
  line-height: 0;
}

.app-brand-logo {
  display: block;
  width: auto;
  height: auto;
  max-height: 44px;
  max-width: 180px;
  object-fit: contain;
  object-position: left center;
}

.sb-topnav .navbar-brand .brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

#sidebarToggle {
  color: #64748b !important;
  padding: 0.4rem 0.5rem;
  border-radius: 0.375rem;
}
#sidebarToggle:hover {
  background: var(--primary-soft);
  color: var(--primary) !important;
}

.topnav-user-btn {
  color: #374151 !important;
  background: none;
  border: none;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s;
}
.topnav-user-btn:hover {
  background: var(--primary-soft);
  color: var(--primary) !important;
}

.topnav-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.topnav-actions {
  min-width: 0;
}

.dropdown-menu {
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-sm);
  padding: 0.4rem;
  min-width: 200px;
}
.dropdown-item {
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: #374151;
  transition: background 0.12s;
}
.dropdown-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.dropdown-item.text-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}
.dropdown-header {
  font-size: 0.75rem;
  color: #94a3b8;
  padding: 0.35rem 0.75rem;
}
.dropdown-divider {
  border-color: var(--border-color);
  margin: 0.3rem 0;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sb-sidenav-dark {
  background: var(--sidebar-bg);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.sb-sidenav-menu {
  flex: 1;
  padding: 1rem 0 0.5rem;
}

.sb-sidenav-menu .nav {
  flex-direction: column;
  padding: 0 0.75rem;
  gap: 2px;
}

.sb-sidenav-menu-heading {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #475569;
  padding: 1.25rem 0.75rem 0.35rem;
}

.sb-sidenav-menu .nav-link {
  color: var(--sidebar-text);
  padding: 0.6rem 0.85rem;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  text-decoration: none;
}
.sb-sidenav-menu .nav-link:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-active);
}
.sb-sidenav-menu .nav-link.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

.sb-nav-link-icon {
  width: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  opacity: 0.85;
}
.sb-sidenav-menu .nav-link.active .sb-nav-link-icon {
  opacity: 1;
}

.sb-sidenav-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.15);
}
.sb-sidenav-footer .footer-user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.sidebar-user-meta {
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-subtitle {
  font-size: 0.7rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Page Content ──────────────────────────────────────────────────────────── */
main {
  flex: 1;
}
.page-content {
  padding: 1.75rem 2rem;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.25rem 0.75rem;
  border-radius: var(--radius) var(--radius) 0 0 !important;
}
.card-header-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}
.card-header-title .header-icon {
  width: 28px;
  height: 28px;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* ── Stat Cards ────────────────────────────────────────────────────────────── */
.stat-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: #fff;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  overflow: hidden;
  position: relative;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.stat-card.stat-primary::after {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}
.stat-card.stat-success::after {
  background: linear-gradient(90deg, var(--success), #34d399);
}
.stat-card.stat-danger::after {
  background: linear-gradient(90deg, var(--danger), #f87171);
}
.stat-card.stat-warning::after {
  background: linear-gradient(90deg, var(--warning), #fcd34d);
}
.stat-card.stat-info::after {
  background: linear-gradient(90deg, var(--info), #38bdf8);
}

.stat-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-icon-wrap.primary {
  background: var(--primary-soft);
  color: var(--primary);
}
.stat-icon-wrap.success {
  background: var(--success-soft);
  color: var(--success);
}
.stat-icon-wrap.danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.stat-icon-wrap.warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.stat-icon-wrap.info {
  background: var(--info-soft);
  color: var(--info);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #0f172a;
}
.stat-label {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.2rem;
  font-weight: 500;
}

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table {
  font-size: 0.85rem;
  color: #374151;
}
.table thead th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  white-space: nowrap;
}
.table tbody td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table-hover tbody tr:hover {
  background: #f8fafc;
}

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.3em 0.65em;
  border-radius: 0.375rem;
  letter-spacing: 0.02em;
}
.badge.bg-success {
  background: var(--success) !important;
}
.badge.bg-danger {
  background: var(--danger) !important;
}
.badge.bg-warning {
  background: var(--warning) !important;
  color: #fff !important;
}
.badge.bg-primary {
  background: var(--primary) !important;
}
.badge.bg-secondary {
  background: #94a3b8 !important;
}
.badge.bg-info {
  background: var(--info) !important;
}

/* Status badge pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3em 0.75em;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-pill.accepted {
  background: var(--success-soft);
  color: var(--success);
}
.status-pill.rejected {
  background: var(--danger-soft);
  color: var(--danger);
}
.status-pill.pending {
  background: var(--warning-soft);
  color: #d97706;
}
.status-pill.skipped {
  background: #f1f5f9;
  color: #94a3b8;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  font-weight: 500;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}
.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}
.btn-outline-secondary {
  color: #64748b;
  border-color: #e2e8f0;
}
.btn-outline-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #374151;
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-control,
.form-select {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  color: #1e293b;
  transition:
    border 0.15s,
    box-shadow 0.15s;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
  outline: none;
}
.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.35rem;
}
.input-group-text {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  color: #94a3b8;
  font-size: 0.875rem;
}

/* ── Page Header ───────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin: 0;
}
.page-subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
  margin: 0.2rem 0 0;
}
.breadcrumb-nav {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.breadcrumb-nav a {
  color: var(--primary);
  text-decoration: none;
}
.breadcrumb-nav a:hover {
  text-decoration: underline;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-actions-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Pagination ────────────────────────────────────────────────────────────── */
.pagination {
  gap: 0.25rem;
}
.page-link {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm) !important;
  color: #64748b;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.12s;
}
.page-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-light);
}
.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}
.page-item.disabled .page-link {
  color: #cbd5e1;
}

/* ── Alert / Message ───────────────────────────────────────────────────────── */
.alert {
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.alert-success {
  background: var(--success-soft);
  color: #065f46;
}
.alert-danger {
  background: var(--danger-soft);
  color: #7f1d1d;
}
.alert-warning {
  background: var(--warning-soft);
  color: #78350f;
}
.alert-info {
  background: var(--info-soft);
  color: #164e63;
}

/* ── JSON display ──────────────────────────────────────────────────────────── */
.json-display {
  font-family: "Consolas", "Monaco", monospace;
  font-size: 0.78rem;
  background: #0f172a;
  color: #94a3b8;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
  border-radius: 0 0 var(--radius) var(--radius);
  line-height: 1.6;
}

/* ── Invoice Detail ────────────────────────────────────────────────────────── */
.invoice-print-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem;
  border-bottom: 2px solid var(--border-color);
}
.invoice-company-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: #0f172a;
}
.invoice-no {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}
.invoice-table th {
  background: #f8fafc;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 600;
}
.invoice-totals-table td {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}
.invoice-totals-table .total-row td {
  font-weight: 700;
  font-size: 1rem;
  border-top: 2px solid var(--border-color);
}

/* ── ZATCA Status Card ─────────────────────────────────────────────────────── */
.zatca-status-card {
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}
.zatca-status-card.pass {
  background: var(--success-soft);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.zatca-status-card.fail {
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ── Flag Indicator ────────────────────────────────────────────────────────── */
.flag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.flag-row:last-child {
  border-bottom: none;
}
.flag-label {
  font-size: 0.82rem;
  color: #64748b;
}
.flag-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.flag-dot.on {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}
.flag-dot.off {
  background: #e2e8f0;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
footer {
  padding: 1rem 2rem;
  background: #fff;
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: #94a3b8;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.font-monospace {
  font-family: "Consolas", "Monaco", monospace;
}
.text-primary {
  color: var(--primary) !important;
}
.text-success {
  color: var(--success) !important;
}
.text-danger {
  color: var(--danger) !important;
}
.text-warning {
  color: var(--warning) !important;
}
.fw-medium {
  font-weight: 500;
}

/* ── Mobile sidebar ────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  #layoutSidenav_nav {
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }
  #layoutSidenav_content {
    margin-left: 0;
  }
  body.sb-nav-fixed.sb-sidenav-toggled #layoutSidenav_nav {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .page-content {
    padding: 1.25rem 1rem;
  }
  body.sb-sidenav-toggled::after {
    content: "";
    position: fixed;
    inset: var(--topbar-height) 0 0 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 990;
  }
}

/* ── Filter bar ────────────────────────────────────────────────────────────── */
.filter-bar {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #94a3b8;
}
.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: block;
  opacity: 0.5;
}
.empty-state p {
  font-size: 0.9rem;
  margin: 0;
}

/* ── Modern Dashboard additions ───────────────────────────────────────── */

.badge-soft {
  display: inline-flex;
  align-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35em 0.7em;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.hero-banner {
  position: relative;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #8b5cf6 100%);
  color: #fff;
  padding: 1.75rem 2rem;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.18);
}
.hero-bg-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(
      circle at 20% 20%,
      rgba(255, 255, 255, 0.18),
      transparent 35%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(255, 255, 255, 0.12),
      transparent 40%
    );
  pointer-events: none;
}
.hero-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.18);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  margin-bottom: 0.65rem;
}
.hero-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.3rem;
  color: #fff;
}
.hero-subtitle {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  max-width: 640px;
}
.hero-illustration {
  position: relative;
  width: 140px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 3rem;
  opacity: 0.9;
}
.hero-orb {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}
.hero-orb-1 {
  width: 90px;
  height: 90px;
  top: 5px;
  right: 0;
}
.hero-orb-2 {
  width: 50px;
  height: 50px;
  bottom: -10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.22);
}
.hero-orb-3 {
  width: 30px;
  height: 30px;
  top: -8px;
  left: 35%;
  background: rgba(255, 255, 255, 0.28);
}

.kpi-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem 1.15rem;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  overflow: hidden;
}
.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.kpi-card.kpi-primary::before {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}
.kpi-card.kpi-success::before {
  background: linear-gradient(90deg, var(--success), #34d399);
}
.kpi-card.kpi-danger::before {
  background: linear-gradient(90deg, var(--danger), #f87171);
}
.kpi-card.kpi-warning::before {
  background: linear-gradient(90deg, var(--warning), #fcd34d);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}
.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.kpi-primary .kpi-icon {
  background: var(--primary-soft);
  color: var(--primary);
}
.kpi-success .kpi-icon {
  background: var(--success-soft);
  color: var(--success);
}
.kpi-danger .kpi-icon {
  background: var(--danger-soft);
  color: var(--danger);
}
.kpi-warning .kpi-icon {
  background: var(--warning-soft);
  color: var(--warning);
}

.kpi-trend {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  background: #f1f5f9;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
}
.kpi-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #0f172a;
}
.kpi-success .kpi-value {
  color: var(--success);
}
.kpi-danger .kpi-value {
  color: var(--danger);
}
.kpi-warning .kpi-value {
  color: var(--warning);
}
.kpi-label {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.3rem;
  font-weight: 500;
}

/* ── New KPI Cards (Mockup Style) ────────────────────────────────────────── */
.kpi-card-new {
  position: relative;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 1rem;
  padding: 1.25rem 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s, box-shadow 0.2s;
  height: 100%;
}
.kpi-card-new:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.04);
}

.kpi-top-new {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.kpi-icon-new {
  width: 40px;
  height: 40px;
  border-radius: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.kpi-new-primary .kpi-icon-new {
  background: #eef2ff;
  color: #4f46e5;
}
.kpi-new-success .kpi-icon-new {
  background: #f0fdf4;
  color: #10b981;
}
.kpi-new-danger .kpi-icon-new {
  background: #fef2f2;
  color: #ef4444;
}
.kpi-new-warning .kpi-icon-new {
  background: #fffbeb;
  color: #f59e0b;
}

.kpi-trend-new {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
}

.kpi-value-new {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #0f172a;
}
.kpi-label-new {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.4rem;
  font-weight: 500;
}

.compliance-bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #f1f5f9;
}
.bar-seg {
  height: 100%;
  transition: width 0.4s;
}
.bar-success {
  background: var(--success);
}
.bar-danger {
  background: var(--danger);
}
.bar-warning {
  background: var(--warning);
}
.bar-skipped {
  background: #94a3b8;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.donut-wrap {
  position: relative;
  width: min(200px, 100%);
  aspect-ratio: 1 / 1;
  height: auto;
}
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.donut-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}
.donut-label {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.company-avatar {
  width: 36px;
  height: 36px;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.count-pill {
  display: inline-block;
  min-width: 38px;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
}
.count-pill.success {
  background: var(--success-soft);
  color: var(--success);
}
.count-pill.danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.count-pill.muted {
  background: #f1f5f9;
  color: #94a3b8;
}

.mini-progress {
  width: 100%;
  height: 6px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}
.mini-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--success), #34d399);
  border-radius: 999px;
}

.kpi-card.kpi-purple::before {
  background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

.list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.filter-actions {
  flex-wrap: wrap;
}

.compliance-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.compliance-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: flex-end;
}

.endpoint-detail-card {
  font-size: 0.875rem;
}

.detail-label,
.detail-value {
  padding: 0.5rem 0.75rem;
}

.detail-label {
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-value {
  color: #0f172a;
}

.detail-label-alt,
.detail-value-alt {
  background: #f8fafc;
}

.detail-value-mono {
  font-size: 0.78rem;
}

/* ── Invoice Document (Detail Page) ────────────────────────────────────── */
.invoice-doc {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.invoice-doc .doc-status-bar {
  height: 6px;
}
.invoice-doc .doc-status-bar.accepted {
  background: linear-gradient(90deg, #10b981, #34d399);
}
.invoice-doc .doc-status-bar.rejected {
  background: linear-gradient(90deg, #ef4444, #f87171);
}
.invoice-doc .doc-status-bar.pending {
  background: linear-gradient(90deg, #f59e0b, #fcd34d);
}
.invoice-doc .doc-status-bar.skipped {
  background: linear-gradient(90deg, #94a3b8, #cbd5e1);
}

.invoice-doc .doc-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  padding: 2rem 2.25rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(180deg, #fafbff 0%, #ffffff 100%);
}
.invoice-doc .seller-logo {
  width: 56px;
  height: 56px;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.4rem;
  margin-bottom: 0.6rem;
}
.invoice-doc .seller-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.2rem;
}
.invoice-doc .seller-meta {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.6;
}
.invoice-doc .doc-title-block {
  text-align: right;
}
.invoice-doc .doc-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin: 0;
}
.invoice-doc .doc-number {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 0.25rem;
  font-family: "Consolas", "Monaco", monospace;
}
.invoice-doc .doc-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 0.65rem;
}
.invoice-doc .doc-status-pill.accepted {
  background: var(--success-soft);
  color: var(--success);
}
.invoice-doc .doc-status-pill.rejected {
  background: var(--danger-soft);
  color: var(--danger);
}
.invoice-doc .doc-status-pill.pending {
  background: var(--warning-soft);
  color: #b45309;
}
.invoice-doc .doc-status-pill.skipped {
  background: #f1f5f9;
  color: #64748b;
}

.invoice-doc .doc-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  padding: 1.25rem 2.25rem;
  background: #fafbff;
  border-bottom: 1px solid #f1f5f9;
}
.invoice-doc .meta-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.invoice-doc .meta-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
}

.invoice-doc .doc-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 1.25rem 2.25rem 0.35rem;
}

.invoice-doc table.line-items {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}
.invoice-doc table.line-items thead th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: #64748b;
  background: #f8fafc;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}
.invoice-doc table.line-items thead th.num {
  text-align: right;
}
.invoice-doc table.line-items thead th:first-child {
  padding-left: 2.25rem;
}
.invoice-doc table.line-items thead th:last-child {
  padding-right: 2.25rem;
  text-align: right;
}
.invoice-doc table.line-items tbody td {
  padding: 0.9rem 1rem;
  font-size: 0.87rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}
.invoice-doc table.line-items tbody td.num {
  text-align: right;
}
.invoice-doc table.line-items tbody td:first-child {
  padding-left: 2.25rem;
}
.invoice-doc table.line-items tbody td:last-child {
  padding-right: 2.25rem;
  text-align: right;
  font-weight: 700;
  color: #0f172a;
}
.invoice-doc table.line-items tbody tr:hover {
  background: #fafbff;
}
.invoice-doc .item-name {
  font-weight: 600;
  color: #0f172a;
}
.invoice-doc .item-code {
  font-size: 0.73rem;
  color: #94a3b8;
  margin-top: 2px;
}
.invoice-doc .tax-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

.invoice-doc .doc-totals {
  display: flex;
  justify-content: flex-end;
  padding: 1.5rem 2.25rem;
  border-top: 1px solid #f1f5f9;
  background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
}
.invoice-doc .totals-box {
  width: 360px;
  max-width: 100%;
}
.invoice-doc .totals-row {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0;
  font-size: 0.9rem;
  color: #475569;
}
.invoice-doc .totals-row .label {
  color: #64748b;
}
.invoice-doc .totals-row .value {
  font-weight: 600;
  color: #0f172a;
}
.invoice-doc .totals-row.grand {
  border-top: 2px dashed var(--border-color);
  margin-top: 0.6rem;
  padding-top: 0.9rem;
  font-size: 1.05rem;
}
.invoice-doc .totals-row.grand .label {
  font-weight: 700;
  color: #0f172a;
}
.invoice-doc .totals-row.grand .value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.invoice-doc .doc-footer {
  padding: 1.25rem 2.25rem;
  border-top: 1px solid #f1f5f9;
  font-size: 0.82rem;
  color: #64748b;
  text-align: center;
  background: #fafbff;
}

@media (max-width: 767.98px) {
  .app-brand-logo {
    max-height: 36px;
    max-width: 140px;
  }
  .page-content {
    padding: 0.85rem 0.75rem;
  }
  .row {
    --bs-gutter-x: 0.75rem;
    margin-right: 0;
    margin-left: 0;
  }
  .row > * {
    padding-right: calc(var(--bs-gutter-x) * 0.5);
    padding-left: calc(var(--bs-gutter-x) * 0.5);
  }
  .topnav-user-btn {
    padding-inline: 0.5rem;
  }
  .sb-topnav {
    padding-inline: 0.75rem !important;
  }
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }
  .page-actions {
    justify-content: flex-start;
  }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-banner {
    padding: 1rem;
  }
  .hero-content {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-title {
    font-size: 1.25rem;
  }
  .kpi-card {
    padding: 0.9rem;
    width: 100%;
  }
  .kpi-value {
    font-size: 1.4rem;
  }
  .compliance-summary,
  .list-meta {
    flex-direction: column;
    align-items: flex-start;
  }
  .compliance-legend {
    justify-content: flex-start;
  }
  .filter-bar {
    padding: 0.85rem;
  }
  .filter-bar .row {
    --bs-gutter-x: 0.6rem;
    --bs-gutter-y: 0.6rem;
  }
  .filter-actions .btn {
    flex: 1 1 0;
    min-height: 40px;
  }
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
  }
  .responsive-table thead {
    display: none;
  }
  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }
  .responsive-table tr {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
  }
  .responsive-table tr:last-child {
    border-bottom: none;
  }
  .responsive-table tbody td {
    padding: 0.45rem 0;
    border: 0;
    text-align: left !important;
  }
  .responsive-table tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
  }
  .responsive-table tbody td[data-label="Action"]::before {
    margin-bottom: 0.45rem;
  }
  .responsive-table tbody td:empty {
    display: none;
  }
  .responsive-table .btn {
    width: 100%;
  }
  .table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    margin-inline: 0;
  }
  .company-avatar {
    width: 32px;
    height: 32px;
  }
  .detail-label,
  .detail-value,
  .detail-label-alt,
  .detail-value-alt {
    background: transparent;
    padding-inline: 0;
  }
  .detail-label {
    padding-top: 0.75rem;
  }
  .detail-value {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
  }
  .detail-pairs > :last-child {
    border-bottom: 0;
  }
  .invoice-doc .doc-header,
  .invoice-doc .doc-meta {
    grid-template-columns: 1fr;
    padding: 1.25rem;
  }
  .invoice-doc .doc-title-block {
    text-align: left;
  }
  .invoice-doc table.line-items thead th:first-child,
  .invoice-doc table.line-items tbody td:first-child {
    padding-left: 1.25rem;
  }
  .invoice-doc table.line-items thead th:last-child,
  .invoice-doc table.line-items tbody td:last-child {
    padding-right: 1.25rem;
  }
  .invoice-doc .doc-totals {
    padding: 1.25rem;
  }
}

/* ── Responsive Tables ─────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .responsive-table {
    display: block;
    width: 100%;
  }
  .responsive-table thead {
    display: none;
  }
  .responsive-table tbody {
    display: block;
    width: 100%;
  }
  .responsive-table tr {
    display: block;
    border-bottom: 2px solid var(--border-color);
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    background: #fff;
    border-radius: 0.5rem;
  }
  .responsive-table tr:last-child {
    border-bottom: none;
    margin-bottom: 0;
  }
  .responsive-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem !important;
    border-bottom: 1px solid #f8fafc;
    text-align: right !important;
  }
  .responsive-table td:last-child {
    border-bottom: none;
  }
  .responsive-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    text-align: left;
    margin-right: 1rem;
    flex-shrink: 0;
  }
  .responsive-table td[data-label="Action"] {
    justify-content: flex-end;
  }
  .responsive-table td[data-label="Action"]::before {
    display: none;
  }
}

@media print {
  body {
    background: #fff;
  }
  .sb-topnav,
  #layoutSidenav_nav,
  footer,
  .page-header,
  .no-print {
    display: none !important;
  }
  #layoutSidenav_content {
    margin-left: 0 !important;
  }
  body.sb-nav-fixed {
    padding-top: 0 !important;
  }
  .invoice-doc {
    border: none;
    box-shadow: none;
  }
}
