/* ============================================================
   PRL HSEQ Portal - Main Stylesheet
   Theme: PRL Corporate — Refinery Blue + Brand Green + Signal Red
   Colours sampled from the PRL company logo.
   Design rule: NO partition lines. Content is separated by
   whitespace and soft surfaces only — no horizontal/vertical
   divider rules anywhere (screen, reports, print, PDF).
   ============================================================ */

.fa-chart-line:before, .fa-line-chart:before {
  content: url("assets/img/3_w.png") !important;
}

:root {
  /* Brand — unified to #1f45a4 (both the former blue and the green now use it) */
  --primary: #1f45a4; /* brand blue (buttons, active nav, headings) */
  --primary-light: #2a57c8;
  --primary-mid: #18387f;
  --accent: #1f45a4; /* was PRL leaf green — unified to #1f45a4 */
  --accent-hover: #2a57c8;
  --success: #1f45a4; /* was green — unified to #1f45a4 */
  --warning: #e0a800;
  --danger: #d72822; /* PRL flame red */
  --info: #1f45a4;
  --dark: #14306f;
  --gray-100: #f4f7fb;
  --gray-200: #e9eef5;
  --gray-300: #dde4ee;
  --gray-400: #9aaabf;
  --gray-500: #6b7e99;
  --gray-600: #4a5a72;
  --gray-700: #2c3a4f;
  --white: #ffffff;
  /* All dividers/partitions resolve to transparent — kept as a token so
       the few structural borders that remain stay invisible but layout-safe. */
  --border: transparent;
  --sidebar-width: 270px;
  --topbar-height: 64px;
  --font-main: "Barlow", sans-serif;
  --font-display: "Barlow Condensed", sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 12px rgba(31, 69, 164, 0.1);
  --shadow-lg: 0 8px 32px rgba(31, 69, 164, 0.16);
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
}

body {
  font-family: var(--font-main);
  /* Portal-wide plain background (background image removed) */
  background-color: var(--gray-100);
  color: var(--gray-700);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: #233d8b;
  box-shadow: 2px 0 14px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
  overflow: hidden;
}

.sidebar-brand {
  background: var(--white);
  padding: 0 20px;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo img {
  width: 130px;
  height: 130px;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  background: #233d8b;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

.nav-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
  padding: 16px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 2px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,0.8);
  font-size: 1rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.12);
}

.nav-item.active {
  color: #fff;
  background: rgba(255,255,255,0.2);
  box-shadow: none;
  font-weight: 600;
}

.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
  opacity: 0.85;
}

.nav-item.active i {
  opacity: 1;
  color: #fff;
}

.sidebar-footer {
  padding: 14px 20px;
  background: #233d8b;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--white);
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
  text-transform: capitalize;
}

/* ============================================================
   MAIN WRAPPER & TOPBAR
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: #233d8b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  z-index: 900;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  margin-top: 4px;
  margin-left: 14px;
  margin-right: 14px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all var(--transition);
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.page-heading {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
}

.breadcrumb-nav {
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-top: 1px;
}

.breadcrumb-nav a {
  color: var(--gray-400);
}
.breadcrumb-nav a:hover {
  color: var(--accent);
}
.breadcrumb-nav span {
  margin: 0 5px;
}
.breadcrumb-nav .current {
  color: var(--gray-600);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-item {
  position: relative;
}

.location-badge {
  background: var(--primary);
  color: rgba(255, 255, 255, 0.85);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.location-badge i {
  margin-right: 5px;
  color: var(--accent);
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  color: #233d8b;
  transition: all var(--transition);
}

.user-btn:hover {
  background: #e8edf5;
  transform: translateY(-1px);
}

.avatar-sm {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  padding: 6px 0;
  display: none;
  z-index: 9999;
}

.dropdown-menu.open {
  display: block;
}

.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--gray-700);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background var(--transition);
}

.dropdown-menu a:hover {
  background: var(--gray-100);
}
.dropdown-menu a.text-danger {
  color: var(--danger);
}
.dropdown-menu a.text-danger:hover {
  background: #fdf0ef;
}
.dropdown-divider {
  height: 4px;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  padding: 10px 24px 24px;
  max-width: 100%;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  /* font-weight: 700; */
  color: black;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-card .card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.kpi-card .card-title i {
  color: #cf2c2a;
}

.card-body {
  padding: 20px;
}

/* ============================================================
   KPI / STAT CARDS
   ============================================================ */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition:
    transform var(--transition),
    box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.orange {
  background: #d7d7d791;
  color: var(--accent);
}
.stat-icon.blue {
  background: rgba(27, 111, 179, 0.12);
  color: var(--info);
}
.stat-icon.green {
  background: #d7d7d791;
  color: var(--success);
}
.stat-icon.red {
  background: rgba(215, 40, 34, 0.12);
  color: var(--danger);
}
.stat-icon.navy {
  background: #d7d7d791;
  color: var(--primary);
}

.stat-info {
  flex: 1;
  min-width: 0;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 4rem;
  /* font-weight: 700; */
  color: #2c7138;
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive {
  overflow-x: auto;
  padding: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 11px 14px;
  text-align: left;
  white-space: nowrap;
}

/* No horizontal/vertical partition lines between cells — rows are
   separated by padding and a soft hover tint only. */
tbody td {
  padding: 12px 14px;
  color: var(--gray-700);
  vertical-align: middle;
}

tbody tr:hover {
  background: rgba(37, 99, 235, 0.035);
}

/* Footer total rows — padded, weighted, and divided from the body */
tfoot td {
  padding: 13px 14px;
  font-weight: 700;
  color: var(--gray-800, #1f2937);
  background: var(--gray-100);
  border-top: 2px solid var(--gray-200, #e5e7eb);
}
tfoot tr:first-child td {
  border-top: 2px solid var(--gray-300, #d1d5db);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control,
.form-select {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-family: var(--font-main);
  font-size: 0.9rem;
  color: var(--gray-700);
  background: var(--white);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  outline: none;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 160, 67, 0.15);
}

.form-control::placeholder {
  color: var(--gray-400);
}
textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  margin-left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: white;
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}
.btn-secondary:hover {
  background: var(--gray-300);
}
.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover {
  background: #247a4a;
  color: white;
}
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover {
  background: #a93226;
  color: white;
}
.btn-info {
  background: var(--info);
  color: white;
}
.btn-info:hover {
  background: #1565a0;
  color: white;
}
.btn-navy {
  background: var(--primary);
  color: white;
}
.btn-navy:hover {
  background: var(--primary-mid);
  color: white;
}
.btn-outline {
  background: white;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-600);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-sm {
  padding: 4px 8px;
  font-size: 0.8rem;
  border-radius: 5px;
}
.btn-sm:has(.fa-search),
.btn-sm:has(.fa-times) { padding: 6px 14px; font-size: 0.9rem; }
.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

table td:last-child { text-align: center; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: rgba(45, 158, 95, 0.12);
  color: var(--success);
}
.badge-danger {
  background: rgba(192, 57, 43, 0.12);
  color: var(--danger);
}
.badge-warning {
  background: rgba(224, 168, 0, 0.15);
  color: #9a7300;
}
.badge-primary {
  background: rgba(47, 160, 67, 0.12);
  color: var(--accent);
}
.badge-info {
  background: rgba(26, 122, 191, 0.12);
  color: var(--info);
}
.badge-secondary {
  background: var(--gray-200);
  color: var(--gray-600);
}
.badge-dark {
  background: var(--gray-700);
  color: white;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
}

.alert-success {
  background: #fff;
  color: #3ddc84;
  border-left: 4px solid var(--success);
}
.alert-danger {
  background: #fff;
  color: #ff7a70;
  border-left: 4px solid var(--danger);
}
.alert-warning {
  background: #fff;
  color: #ffcf4d;
  border-left: 4px solid var(--warning);
}
.alert-info {
  background: #fff;
  color: #79b6ff;
  border-left: 4px solid var(--info);
}

.alert-close {
  position: absolute;
  right: 12px;
  top: 10px;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: currentColor;
  opacity: 0.6;
}

.alert-close:hover {
  opacity: 1;
}

/* ============================================================
   PAGE ACTIONS BAR
   ============================================================ */
.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.page-actions-left,
.page-actions-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================================================
   SEARCH & FILTER BAR
   ============================================================ */
.filter-bar {
  background: var(--white);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  padding: 10px;
  padding-bottom: 25px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  /* min-width: 160px; */
}

.filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: white;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-box i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 0.85rem;
}

.search-box input {
  padding-left: 34px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 46, 82, 0.6);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--gray-500);
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--danger);
}
.modal-body {
  padding: 22px;
}
.modal-footer {
  padding: 14px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 14px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1rem;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.875rem;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress {
  height: 8px;
  background: var(--gray-200);
  border-radius: 20px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 20px;
  background: var(--accent);
  transition: width 0.5s ease;
}

.progress-bar.green {
  background: var(--success);
}
.progress-bar.red {
  background: var(--danger);
}
.progress-bar.yellow {
  background: var(--warning);
}
.progress-bar.blue {
  background: var(--info);
}

/* ============================================================
   SECTION DIVIDERS & HEADERS
   ============================================================ */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* The page heading is shown in the topbar (page-title-area). Hide the duplicate
   heading rendered in the page body so it only appears once. Action buttons in
   .page-actions-right are kept. */
.page-actions-left .section-title {
  display: none;
}

/* Section dividers are intentionally invisible — sections are separated by
   spacing only (client requirement: no partition lines). */
.section-divider {
  flex: 1;
  height: 0;
  background: transparent;
}

/* ============================================================
   RESPONSIVE SIDEBAR COLLAPSE
   ============================================================ */
.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

.sidebar-collapsed .main-wrapper {
  margin-left: 0;
}

@media (max-width: 768px) {
  /* ── Off-canvas sidebar drawer ── */
  .sidebar {
    transform: translateX(-100%);
    width: min(82vw, 300px);
    box-shadow: 2px 0 28px rgba(0, 0, 0, 0.22);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  /* dimmed backdrop behind the open drawer; sidebar z-index is 1000 */
  body.sidebar-mobile-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 999;
  }
  body.sidebar-mobile-open {
    overflow: hidden; /* lock page scroll while the drawer is open */
  }

  /* ── Topbar / headings ── */
  .topbar {
    padding: 0 14px;
    margin-left: 10px;
    margin-right: 10px;
    margin-top: 10px;
  }
  .page-heading {
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 56vw;
  }

  /* ── Content spacing ── */
  .main-content {
    padding: 16px 14px;
  }
  .card-header,
  .card-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  /* ── Filters / actions stack full-width ── */
  /* !important overrides the inline grid-template-columns many .stat-cards carry */
  .stat-cards {
    grid-template-columns: 1fr 1fr !important;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-bar .form-select,
  .filter-bar .form-control,
  .filter-group {
    width: 100%;
  }
  .page-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  /* ── Wide tables scroll horizontally instead of breaking the page ── */
  .main-content table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .stat-cards {
    grid-template-columns: 1fr !important; /* beat inline grid-template-columns */
  }
  .page-heading {
    font-size: 0.98rem;
    max-width: 52vw;
  }
  /* On the smallest screens show just the avatar in the user menu, not the name */
  .topbar-right .user-btn span {
    display: none;
  }
}

/* Report view pages: single stacked column (no left/right partition) */
.report-stack {
  display: block;
}
.report-stack > div {
  width: 100%;
}

/* ============================================================
   NO PARTITIONS — global override
   Many pages draw divider lines inline (e.g. a detail row with
   `border-bottom:1px solid var(--gray-200)`, or a section with a
   `border-top`). Those inline styles carry no !important, so these
   rules win and render every such line invisible while keeping the
   layout/spacing intact. Applies on screen, in print and in the
   html2pdf capture (which reads the live DOM).
   ============================================================ */
.main-content table td,
.main-content table th,
.main-content table tr,
.main-content .card,
.main-content .card-header,
.main-content .card-body,
.main-content .modal-header,
.main-content .modal-footer {
  border-top-color: transparent !important;
  border-bottom-color: transparent !important;
  border-left-color: transparent !important;
  border-right-color: transparent !important;
}

/* ============================================================
   PRINT / PDF — show only the report content, no chrome
   ============================================================ */
@media print {
  .sidebar,
  .topbar,
  .page-actions-right,
  #mailReportModal,
  .no-print,
  .alert-dismissible,
  .filter-bar {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  .main-content {
    padding: 0 !important;
  }
  body {
    background: #fff !important;
  }
  /* Bring the page title back for the printout (it's hidden on screen) */
  .page-actions-left .section-title {
    display: block !important;
  }
  /* No card borders or table grid lines on the printout / PDF either. */
  .card {
    box-shadow: none !important;
    border: none !important;
    break-inside: avoid;
  }
  table,
  thead th,
  tbody td,
  tbody tr,
  .card-header,
  .card-body,
  .modal-header,
  .modal-footer {
    border: none !important;
  }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}
.text-muted {
  color: #0a0a0a !important;
}
.text-danger {
  color: var(--danger) !important;
}
.text-success {
  color: var(--success) !important;
}
.text-warning {
  color: var(--warning) !important;
}
.text-primary {
  color: var(--accent) !important;
}
.fw-bold {
  font-weight: 700;
}
.fw-600 {
  font-weight: 600;
}
.small {
  font-size: 0.9rem;
}
.d-flex {
  display: flex;
}
.align-center {
  align-items: center;
}
.gap-2 {
  gap: 8px;
}
.gap-3 {
  gap: 12px;
}
.mt-1 {
  margin-top: 6px;
}
.mt-2 {
  margin-top: 12px;
}
.mt-3 {
  margin-top: 20px;
}
.mb-2 {
  margin-bottom: 12px;
}
.mb-3 {
  margin-bottom: 20px;
}
.w-100 {
  width: 100%;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}
