/* ============================================================================
   HEMG Weld Integrity Pro™ — Premium Enterprise UI Layer
   Front-end only override. Loaded after Bootstrap + legacy styles.
   ============================================================================ */

:root {
  --hemg-ink: #07111f;
  --hemg-navy-950: #081522;
  --hemg-navy-900: #0b1727;
  --hemg-navy-850: #0e1d30;
  --hemg-navy-800: #12243a;
  --hemg-navy-700: #193452;
  --hemg-steel-700: #40556f;
  --hemg-steel-600: #586d85;
  --hemg-steel-500: #6f8196;
  --hemg-steel-400: #9aa9b9;
  --hemg-steel-300: #c4ced8;
  --hemg-steel-200: #dde4eb;
  --hemg-steel-150: #e8edf2;
  --hemg-steel-100: #f1f4f7;
  --hemg-steel-50: #f7f9fb;
  --hemg-white: #ffffff;
  --hemg-amber: #f3a712;
  --hemg-amber-dark: #d98a00;
  --hemg-amber-soft: #fff7e4;
  --hemg-blue: #2e6ea6;
  --hemg-cyan: #0f9bb8;
  --hemg-green: #16815d;
  --hemg-red: #c94b4b;
  --hemg-shadow-xs: 0 1px 2px rgba(7, 17, 31, .05);
  --hemg-shadow-sm: 0 6px 18px rgba(7, 17, 31, .06);
  --hemg-shadow-md: 0 12px 34px rgba(7, 17, 31, .09);
  --hemg-shadow-lg: 0 22px 60px rgba(7, 17, 31, .14);
  --hemg-radius-sm: 8px;
  --hemg-radius: 12px;
  --hemg-radius-lg: 16px;
  --hemg-header-h: 68px;
  --hemg-sidebar-w: 278px;
  --hemg-sidebar-collapsed: 88px;
}

* { box-sizing: border-box; }

html { background: var(--hemg-steel-50); }

body {
  color: #1c2b3a;
  background:
    radial-gradient(circle at 92% 5%, rgba(46, 110, 166, .045), transparent 27rem),
    var(--hemg-steel-50);
  font-family: Inter, Poppins, "Segoe UI", Roboto, Arial, sans-serif !important;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body > main { min-height: 100vh; }

a { color: var(--hemg-blue); }
a:hover { color: var(--hemg-navy-700); }

/* ---------- Bootstrap semantic color refinement ---------- */
.bg-primary { background-color: var(--hemg-navy-900) !important; }
.text-primary { color: var(--hemg-navy-800) !important; }
.border-primary { border-color: var(--hemg-navy-700) !important; }
.text-info { color: var(--hemg-cyan) !important; }
.bg-info { background-color: var(--hemg-cyan) !important; }
.text-success { color: var(--hemg-green) !important; }
.text-danger { color: var(--hemg-red) !important; }

/* ---------- Header / top navigation ---------- */
.hemg-topbar.navbar,
.navbar.fixed-top {
  min-height: var(--hemg-header-h);
  background: linear-gradient(110deg, var(--hemg-ink) 0%, var(--hemg-navy-900) 62%, #132a43 100%) !important;
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 7px 24px rgba(4, 12, 22, .18);
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  z-index: 1040;
}

.hemg-topbar .container-fluid,
.navbar.fixed-top .container-fluid {
  min-height: var(--hemg-header-h);
}

.hemg-brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.hemg-brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px !important;
  background: rgba(255,255,255,.97);
  padding: 4px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16), 0 4px 14px rgba(0,0,0,.22);
  flex: 0 0 auto;
}

.hemg-brand-copy { min-width: 0; }
.hemg-brand-title {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .015em;
  line-height: 1.15;
  margin: 0;
  white-space: nowrap;
}
.hemg-brand-product {
  color: rgba(255,255,255,.60);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1.15;
  margin-top: 3px;
  text-transform: uppercase;
}

.hemg-menu-toggle {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,.055) !important;
  color: #fff !important;
  transition: .18s ease;
}
.hemg-menu-toggle:hover { background: rgba(255,255,255,.10) !important; transform: translateY(-1px); }

.hemg-project-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 290px;
  min-height: 38px;
  padding: 7px 12px !important;
  border: 1px solid rgba(243,167,18,.26) !important;
  border-radius: 9px !important;
  background: rgba(243,167,18,.10) !important;
  color: #ffe3a4 !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  box-shadow: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hemg-project-switcher:hover { background: rgba(243,167,18,.16) !important; }

.hemg-user-trigger {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  padding: 4px;
}
.hemg-user-trigger img { width: 30px !important; height: 30px !important; }

.navbar .dropdown-menu {
  border: 1px solid var(--hemg-steel-200) !important;
  border-radius: 12px !important;
  box-shadow: var(--hemg-shadow-lg) !important;
  padding: 10px !important;
  overflow: hidden;
}
.navbar .dropdown-item {
  border-radius: 8px;
  padding: 9px 10px !important;
  font-size: 12px;
}
.navbar .dropdown-item:hover { background: var(--hemg-steel-100); color: var(--hemg-navy-900) !important; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed !important;
  top: var(--hemg-header-h) !important;
  left: 0;
  height: calc(100vh - var(--hemg-header-h)) !important;
  width: var(--hemg-sidebar-w) !important;
  background: linear-gradient(180deg, #0c1828 0%, #091420 100%) !important;
  border-right: 1px solid rgba(255,255,255,.06);
  box-shadow: 7px 0 28px rgba(5, 14, 24, .12) !important;
  z-index: 1028 !important;
  transition: width .22s ease !important;
  overflow: visible;
}
.sidebar.close { width: var(--hemg-sidebar-collapsed) !important; }
.sidebar .logo-details { display: none !important; }
.sidebar .nav-links {
  height: 100% !important;
  padding: 16px 12px 22px !important;
  margin: 0;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.13) transparent;
}
.sidebar .nav-links::-webkit-scrollbar { width: 5px !important; display: block !important; }
.sidebar .nav-links::-webkit-scrollbar-thumb { background: rgba(255,255,255,.13); border-radius: 6px; }

.sidebar .nav-links > li,
.sidebar .nav-links > a > li,
.sidebar .nav-links li.headhov {
  min-height: 48px;
  margin: 3px 0;
  border: 0 !important;
  border-radius: 10px;
  background: transparent;
  overflow: visible;
  transition: background .16s ease, transform .16s ease;
}
.sidebar .nav-links li.headhov:hover { background: rgba(255,255,255,.055) !important; }
.sidebar .nav-links li.sidebar_head_lg {
  position: relative;
  background: linear-gradient(90deg, rgba(243,167,18,.18), rgba(243,167,18,.055)) !important;
  border-left: 0 !important;
  box-shadow: inset 0 0 0 1px rgba(243,167,18,.10);
}
.sidebar .nav-links li.sidebar_head_lg::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--hemg-amber);
}

.sidebar .nav-links li > a,
.sidebar .nav-links .iocn-link > a {
  min-height: 48px;
  width: 100%;
  display: flex !important;
  align-items: center !important;
  text-decoration: none !important;
}
.sidebar .nav-links li i {
  width: 52px !important;
  min-width: 52px !important;
  height: 48px !important;
  line-height: 48px !important;
  color: #8ea4bb !important;
  font-size: 17px !important;
  transition: color .16s ease;
}
.sidebar .nav-links li:hover i,
.sidebar .nav-links li.sidebar_head_lg i { color: var(--hemg-amber) !important; }
.sidebar .nav-links li a .link_name,
.sidebar .nav-links li .link_name {
  color: #dce5ee !important;
  font-size: 12.5px !important;
  font-weight: 580 !important;
  letter-spacing: .005em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar .nav-links li.sidebar_head_lg .link_name { color: #fff4d4 !important; }

.sidebar.close .nav-links li a .link_name { opacity: 0 !important; pointer-events: none !important; }
.sidebar.close .nav-links li i { width: 64px !important; min-width: 64px !important; }
.sidebar .nav-links li .sub-menu { background: #fff !important; box-shadow: var(--hemg-shadow-md); border: 1px solid var(--hemg-steel-200); }
.sidebar.close .nav-links li .sub-menu { border-radius: 0 10px 10px 0 !important; padding: 10px 14px !important; min-width: 170px; }
.sidebar.close .nav-links li .sub-menu .link_name { color: var(--hemg-navy-800) !important; font-size: 12px !important; }
.sidebar .nav-links li .sub-menu a { color: var(--hemg-steel-600) !important; }
.sidebar .nav-links li .sub-menu a:hover { color: var(--hemg-navy-900) !important; }

.home-section {
  position: relative !important;
  left: var(--hemg-sidebar-w) !important;
  width: calc(100% - var(--hemg-sidebar-w)) !important;
  min-height: 100vh !important;
  height: auto !important;
  background: transparent;
  transition: left .22s ease, width .22s ease !important;
  overflow-x: clip;
}
.sidebar.close ~ .home-section {
  left: var(--hemg-sidebar-collapsed) !important;
  width: calc(100% - var(--hemg-sidebar-collapsed)) !important;
}

/* ---------- Page hero / title strips ---------- */
.home-section > .hemg-page-hero {
  position: relative;
  background:
    radial-gradient(circle at 88% 25%, rgba(243,167,18,.14), transparent 18rem),
    linear-gradient(105deg, #0e1d30 0%, #15314d 68%, #1b4164 100%) !important;
  border: 1px solid rgba(255,255,255,.04);
  border-radius: 0 0 14px 14px;
  box-shadow: 0 10px 24px rgba(7,17,31,.08);
  overflow: hidden;
}
.home-section > .hemg-page-hero h1 {
  font-size: clamp(24px, 2vw, 31px) !important;
  font-weight: 720 !important;
  letter-spacing: -.02em;
}
.home-section > .hemg-page-hero p { color: rgba(255,255,255,.68) !important; }
.home-section > .hemg-page-hero img { opacity: .16; filter: grayscale(1) brightness(2); }

/* ---------- Content spacing / grids ---------- */
.container-fluid { --bs-gutter-x: 1.65rem; }
.home-section > .container-fluid > .p-lg-4,
.home-section > .container-fluid > .p-4 { padding: 24px !important; }
.row { --bs-gutter-x: 1.25rem; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--hemg-steel-200) !important;
  border-radius: var(--hemg-radius) !important;
  background: rgba(255,255,255,.98);
  box-shadow: var(--hemg-shadow-sm) !important;
}
.card.shadow-sm { box-shadow: var(--hemg-shadow-sm) !important; }
.card:hover.card_zoom { transform: translateY(-2px) !important; box-shadow: var(--hemg-shadow-md) !important; }
.card_zoom { transition: transform .18s ease, box-shadow .18s ease !important; }
.card-header {
  background: #fff !important;
  border-bottom: 1px solid var(--hemg-steel-150) !important;
  padding: 14px 18px;
  font-weight: 650;
}
.card-body { padding: 18px; }
.card-footer { background: var(--hemg-steel-50); border-top-color: var(--hemg-steel-150); }
.rounded-3 { border-radius: var(--hemg-radius) !important; }
.shadow-sm { box-shadow: var(--hemg-shadow-sm) !important; }

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 { color: var(--hemg-navy-900); letter-spacing: -.012em; }
.fw-bold { font-weight: 680 !important; }
.fw-semibold { font-weight: 620 !important; }
.text-muted { color: var(--hemg-steel-600) !important; }
.small, small { line-height: 1.45; }

/* ---------- Forms ---------- */
.form-label,
.card p.text-muted.m-0 + .form-control,
.card p.text-muted.m-0 + .form-select { margin-top: 5px; }
.form-label,
form p.text-muted.m-0 {
  color: var(--hemg-steel-700) !important;
  font-size: 11.5px !important;
  font-weight: 650 !important;
  letter-spacing: .012em;
  margin-bottom: 6px !important;
}
.form-control,
.form-select,
.input-group-text {
  min-height: 40px;
  border-color: var(--hemg-steel-300) !important;
  border-radius: 2px !important;
  color: #26384a;
  font-size: 13px;
  box-shadow: none !important;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.form-control,
.form-select { background-color: #fff; padding: 8px 11px; }
.form-control:focus,
.form-select:focus {
  border-color: #7096ba !important;
  box-shadow: 0 0 0 3px rgba(46,110,166,.10) !important;
}
.form-control[readonly],
.form-control:disabled,
.form-select:disabled { background: var(--hemg-steel-100); color: var(--hemg-steel-600); }
textarea.form-control { min-height: 92px; }
.form-check-input:checked { background-color: var(--hemg-navy-700); border-color: var(--hemg-navy-700); }

.select2-container { width: 100% !important; }
.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple {
  min-height: 40px !important;
  border: 1px solid var(--hemg-steel-300) !important;
  border-radius: 9px !important;
  display: flex !important;
  align-items: center;
  background: #fff !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 38px !important; padding-left: 11px !important; color: #26384a !important; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 38px !important; right: 6px !important; }
.select2-dropdown { border-color: var(--hemg-steel-300) !important; border-radius: 9px !important; box-shadow: var(--hemg-shadow-md); overflow: hidden; }

/* ---------- Buttons ---------- */
.btn {
  min-height: 38px;
  border-radius: 9px !important;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: .003em;
  padding: 8px 14px;
  box-shadow: none !important;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-sm { min-height: 32px; padding: 6px 10px; font-size: 11.5px; }
.btn-lg { min-height: 46px; border-radius: 10px !important; }
.btn-primary {
  background: var(--hemg-navy-800) !important;
  border-color: var(--hemg-navy-800) !important;
  color: #fff !important;
}
.btn-primary:hover { background: #17304a !important; border-color: #17304a !important; box-shadow: 0 7px 18px rgba(18,36,58,.17) !important; }
.btn-info {
  background: var(--hemg-amber) !important;
  border-color: var(--hemg-amber) !important;
  color: #182230 !important;
}
.btn-info:hover { background: #e79b0d !important; border-color: #e79b0d !important; }
.btn-success { background: var(--hemg-green) !important; border-color: var(--hemg-green) !important; }
.btn-danger { background: var(--hemg-red) !important; border-color: var(--hemg-red) !important; }
.btn-outline-primary { color: var(--hemg-navy-800) !important; border-color: #8ba0b4 !important; }
.btn-outline-primary:hover { color: #fff !important; background: var(--hemg-navy-800) !important; border-color: var(--hemg-navy-800) !important; }

/* ---------- Tables / DataTables ---------- */
.table-responsive {
  border-radius: 10px;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100% !important;
  margin-bottom: 0;
  color: #2a3c4e;
  vertical-align: middle;
}
.table > :not(caption) > * > * { padding: 11px 12px; }
.table thead th {
  background: #f2f5f8 !important;
  color: #4a5e73 !important;
  border-top: 1px solid var(--hemg-steel-200) !important;
  border-bottom: 1px solid var(--hemg-steel-200) !important;
  font-size: 10.5px !important;
  font-weight: 720 !important;
  line-height: 1.25;
  letter-spacing: .045em;
  text-transform: uppercase;
  white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid var(--hemg-steel-150) !important; transition: background .12s ease; }
.table tbody tr:hover { background: #f8fafc; }
.table tbody td {
  border: 0 !important;
  border-bottom: 1px solid var(--hemg-steel-150) !important;
  font-size: 12.5px;
  line-height: 1.35;
}
.table tbody tr:last-child td { border-bottom: 0 !important; }
.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-accent-bg: rgba(241,244,247,.60); }

.dataTables_wrapper { width: 100%; }
.dataTables_wrapper .row { align-items: center; }
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter { margin-bottom: 12px; color: var(--hemg-steel-600); font-size: 11.5px; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  min-height: 36px;
  border: 1px solid var(--hemg-steel-300) !important;
  border-radius: 8px !important;
  padding: 6px 9px;
  background: #fff;
}
.dataTables_wrapper .dataTables_info { color: var(--hemg-steel-600); font-size: 11.5px; padding-top: 14px !important; }
.dataTables_wrapper .pagination { gap: 4px; margin-top: 10px !important; }
.page-link {
  border-radius: 7px !important;
  border-color: var(--hemg-steel-200) !important;
  color: var(--hemg-steel-700);
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
}
.page-item.active .page-link { background: var(--hemg-navy-800) !important; border-color: var(--hemg-navy-800) !important; }

/* ---------- Status, alerts, badges, progress ---------- */
.badge { border-radius: 999px !important; padding: 5px 8px; font-size: 10.5px; font-weight: 680; letter-spacing: .012em; }
.alert { border: 0 !important; border-radius: 10px !important; font-size: 12.5px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }
.alert-info { background: #edf8fb; color: #176479; }
.alert-success { background: #edf8f3; color: #17684f; }
.alert-warning { background: var(--hemg-amber-soft); color: #75510b; }
.alert-danger { background: #fff0f0; color: #963b3b; }
.progress { background: #e9eef3 !important; border-radius: 999px !important; overflow: hidden; }
.progress-bar { border-radius: 999px; }

/* ---------- Tabs / nav ---------- */
.nav-tabs { border-bottom: 1px solid var(--hemg-steel-200); gap: 4px; }
.nav-tabs .nav-link {
  border: 0 !important;
  border-radius: 8px 8px 0 0 !important;
  color: var(--hemg-steel-600);
  font-size: 12px;
  font-weight: 620;
  padding: 10px 13px;
}
.nav-tabs .nav-link.active { color: var(--hemg-navy-900); background: var(--hemg-steel-100); box-shadow: inset 0 -2px 0 var(--hemg-amber); }

/* ---------- Modals / offcanvas ---------- */
.modal-content {
  border: 1px solid var(--hemg-steel-200) !important;
  border-radius: 14px !important;
  box-shadow: var(--hemg-shadow-lg) !important;
  overflow: hidden;
}
.modal-header { padding: 15px 18px; border-bottom-color: var(--hemg-steel-150); background: var(--hemg-steel-50); }
.modal-title { color: var(--hemg-navy-900); font-weight: 680; }
.modal-body { padding: 18px; }
.modal-footer { padding: 13px 18px; border-top-color: var(--hemg-steel-150); }

.offcanvas { background: #fff; }
.hemg-mobile-profile {
  background: linear-gradient(135deg, var(--hemg-navy-900), #15314d) !important;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.hemg-mobile-profile .text-primary { color: #fff !important; }
.hemg-mobile-profile .text-muted { color: rgba(255,255,255,.62) !important; }
.offcanvas .list-group-item { border-color: var(--hemg-steel-150) !important; }
.offcanvas .list-group-item:hover { background: var(--hemg-steel-50) !important; }

/* ---------- Legacy helpers normalized ---------- */
.sidebar_color { background: #eef3f7 !important; border-left-color: var(--hemg-amber) !important; color: var(--hemg-navy-900) !important; }
.admin_header { color: var(--hemg-navy-800) !important; border-color: var(--hemg-steel-300) !important; }
.sidebar_admin_lg { color: var(--hemg-navy-800) !important; }
.border_seprator { border-color: var(--hemg-steel-200) !important; }
.bg-grey { background: var(--hemg-steel-50) !important; }
.left_90 { left: 90% !important; }

/* Avoid icons/images forcing broken row alignment */
td img:not(.img-fluid), .table img:not(.img-fluid) { max-width: 100%; height: auto; }
.input-group > .form-control:not(:last-child),
.input-group > .form-select:not(:last-child) { border-radius: 9px 0 0 9px !important; }
.input-group > .btn:last-child,
.input-group > .input-group-text:last-child { border-radius: 0 9px 9px 0 !important; }


/* ---------- Weld-specific premium consistency ---------- */
.weld_row:nth-child(even) { background-color: #f7f9fb !important; }
.weld_row:nth-child(odd) { background-color: #eef3f7 !important; }
.weld_row:hover { background-color: #fff7e4 !important; }
#row_color { transition: background-color .14s ease; }

/* Explicit mobile-role navigation alignment */
.hemg-mobile-nav-item {
  min-height: 54px;
  padding-left: 16px !important;
  padding-right: 14px !important;
  color: var(--hemg-steel-700) !important;
  background: #fff !important;
}
.hemg-mobile-nav-item > .d-flex { gap: 12px; min-width: 0; }
.hemg-mobile-nav-item p { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.hemg-mobile-nav-item p i { color: var(--hemg-steel-600); }
.hemg-mobile-nav-item.sidebar_color {
  color: var(--hemg-navy-900) !important;
  background: var(--hemg-amber-soft) !important;
  box-shadow: inset 3px 0 0 var(--hemg-amber);
}
.hemg-mobile-nav-item.sidebar_color p i { color: var(--hemg-amber-dark); }

.hemg-footer-surface {
  background: linear-gradient(110deg, var(--hemg-ink), var(--hemg-navy-800)) !important;
}

/* Grid/control containment — prevents narrow-column alignment breaks. */
.home-section .row > [class*="col-"] { min-width: 0; }
.home-section .form-control,
.home-section .form-select,
.home-section .input-group,
.home-section .select2-container { max-width: 100%; min-width: 0; }
.home-section .input-group > .form-control,
.home-section .input-group > .form-select { min-width: 0; }
.offcanvas { --bs-offcanvas-width: min(88vw, 360px); }
.offcanvas .list-group-item .d-flex { min-width: 0; }

/* ---------- Login ---------- */
.hemg-login-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 15%, rgba(243,167,18,.14), transparent 22rem),
    radial-gradient(circle at 85% 85%, rgba(46,110,166,.19), transparent 28rem),
    linear-gradient(135deg, #06101d 0%, #0b1727 56%, #102a43 100%);
  display: flex;
  align-items: stretch;
  overflow: hidden;
}
.hemg-login-brand {
  min-height: 100vh;
  position: relative;
  padding: clamp(36px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  overflow: hidden;
}
.hemg-login-brand::after {
  content: "";
  position: absolute;
  right: -180px;
  bottom: -210px;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(255,255,255,.018), 0 0 0 140px rgba(255,255,255,.012);
}
.hemg-login-brand-logo { width: 68px; height: 68px; object-fit: contain; border-radius: 14px; background: #fff; padding: 6px; }
.hemg-login-kicker { color: var(--hemg-amber); font-size: 11px; font-weight: 760; letter-spacing: .14em; text-transform: uppercase; }
.hemg-login-brand h1 { max-width: 660px; color: #fff; font-size: clamp(32px, 4vw, 54px); font-weight: 720; line-height: 1.06; letter-spacing: -.04em; }
.hemg-login-brand p { max-width: 640px; color: rgba(255,255,255,.66); font-size: 14px; }
.hemg-login-points { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px 18px; max-width: 650px; }
.hemg-login-point { display: flex; align-items: center; gap: 9px; color: rgba(255,255,255,.78); font-size: 12px; }
.hemg-login-point i { color: var(--hemg-amber); font-size: 14px; }
.hemg-login-foot { color: rgba(255,255,255,.38); font-size: 10.5px; letter-spacing: .035em; }
.hemg-login-panel {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(248,250,252,.985);
}
.hemg-login-card { width: min(100%, 440px); }
.hemg-login-card .brand-mobile { display: none; }
.hemg-login-card h2 { font-size: 28px; font-weight: 720; letter-spacing: -.025em; }
.hemg-login-card .lead-copy { color: var(--hemg-steel-600); font-size: 12.5px; }
.hemg-login-card .form-control { min-height: 48px; padding-left: 14px; font-size: 13px; }
.hemg-login-card .btn { min-height: 48px; }
.hemg-login-card .support-copy { color: var(--hemg-steel-500); font-size: 11px; text-align: center; }

/* ---------- QR / scanner / image utility ---------- */
video, canvas { max-width: 100%; }
img { image-rendering: auto; }

/* ---------- Accessibility / focus ---------- */
:focus-visible { outline: 2px solid rgba(243,167,18,.72); outline-offset: 2px; }

/* ---------- Responsive ---------- */
@media (max-width: 1199.98px) {
  .container-fluid { --bs-gutter-x: 1.25rem; }
  .home-section > .container-fluid > .p-lg-4,
  .home-section > .container-fluid > .p-4 { padding: 18px !important; }
}

@media (max-width: 991.98px) {
  body { font-size: 13.5px; }
  .sidebar { display: none !important; }
  .home-section,
  .sidebar.close ~ .home-section {
    left: 0 !important;
    width: 100% !important;
  }
  .navbar.fixed-top { min-height: 62px; }
  .navbar.fixed-top .container-fluid { min-height: 62px; }
  .hemg-brand-title { font-size: 12.5px; }
  .hemg-brand-product { font-size: 9.5px; }
  .hemg-brand-logo { width: 38px; height: 38px; }
  .hemg-project-switcher { max-width: 190px; min-height: 34px; padding: 6px 9px !important; }
  .home-section > .hemg-page-hero { border-radius: 0; }
  .home-section > .container-fluid > .p-lg-4,
  .home-section > .container-fluid > .p-4 { padding: 14px !important; }
  .card-body { padding: 15px; }
  .table > :not(caption) > * > * { padding: 10px; }

  .home-section .card-body > table.table {
    display: block;
    width: 100% !important;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .home-section .card-body > table.table > thead,
  .home-section .card-body > table.table > tbody { width: max-content; min-width: 100%; }
}

@media (max-width: 767.98px) {
  :root { --hemg-header-h: 62px; }
  .hemg-login-brand { display: none; }
  .hemg-login-panel { min-height: 100vh; padding: 24px 18px; background: linear-gradient(180deg, #f7f9fb 0%, #edf2f6 100%); }
  .hemg-login-card .brand-mobile { display: flex; align-items: center; gap: 11px; margin-bottom: 34px; }
  .hemg-login-card .brand-mobile img { width: 48px; height: 48px; object-fit: contain; background: #fff; border-radius: 11px; padding: 4px; box-shadow: var(--hemg-shadow-sm); }
  .hemg-login-card h2 { font-size: 25px; }
  .hemg-login-points { grid-template-columns: 1fr; }
  .container-fluid { --bs-gutter-x: 1rem; }
  .row { --bs-gutter-x: 1rem; }
  .btn { width: auto; }
  .table-responsive { border: 1px solid var(--hemg-steel-200); }
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter { text-align: left !important; }
}

@media (max-width: 575.98px) {
  .hemg-brand-copy { display: none; }
  .hemg-project-switcher { max-width: 145px; font-size: 10.5px !important; }
  .home-section > .container-fluid > .p-lg-4,
  .home-section > .container-fluid > .p-4 { padding: 12px !important; }
  .card { border-radius: 10px !important; }
  .card-body { padding: 13px; }
  .form-control, .form-select { font-size: 16px; } /* prevents iOS zoom */
  .modal-dialog { margin: 10px; }
}

@media print {
  .navbar, .sidebar, .offcanvas, .btn, .dataTables_filter, .dataTables_length, .dataTables_paginate { display: none !important; }
  .home-section, .sidebar.close ~ .home-section { left: 0 !important; width: 100% !important; }
  body { background: #fff !important; color: #000; }
  .card { box-shadow: none !important; border-color: #ccc !important; }
}

/* ---------- Section navigation ---------- */
.hemg-subnav {
  border-radius: 0 0 12px 12px !important;
  border-top: 0 !important;
  box-shadow: 0 5px 16px rgba(7,17,31,.045) !important;
}
.hemg-subnav .card-body {
  gap: 4px;
  padding: 9px 12px !important;
  scrollbar-width: thin;
}
.hemg-subnav .vr { display: none; }
.hemg-subnav a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid transparent !important;
  color: var(--hemg-steel-600) !important;
  font-size: 11.5px;
  font-weight: 620;
  transition: .15s ease;
}
.hemg-subnav a:hover { background: var(--hemg-steel-100); color: var(--hemg-navy-900) !important; }
.hemg-subnav a.admin_header {
  background: var(--hemg-amber-soft) !important;
  border-color: rgba(243,167,18,.23) !important;
  color: #7d570d !important;
  box-shadow: inset 0 -2px 0 var(--hemg-amber);
}

.btn-outline-info {
  color: var(--hemg-cyan) !important;
  border-color: #8ccbd8 !important;
}
.btn-outline-info:hover {
  color: #fff !important;
  background: var(--hemg-cyan) !important;
  border-color: var(--hemg-cyan) !important;
}

/* Keep legacy fixed-width UI elements contained without disturbing reports/print pages. */
.home-section [style*="width:"] { max-width: 100%; }
.home-section .d-flex > * { min-width: 0; }
.home-section .card-header.d-flex { gap: 12px; align-items: center; }
.home-section .card-header.d-flex > p:first-child { flex: 1 1 auto; }
.home-section .card-header.d-flex > .btn,
.home-section .card-header.d-flex > a.btn { flex: 0 0 auto; }

/* Premium project selection */
.hemg-project-page {
  min-height: 100vh;
  padding-top: 92px;
  background:
    radial-gradient(circle at 90% 10%, rgba(46,110,166,.075), transparent 24rem),
    linear-gradient(180deg, #f7f9fb 0%, #eef3f7 100%);
}
.hemg-project-heading { max-width: 720px; margin: 0 auto 28px; text-align: center; }
.hemg-project-heading .kicker { color: var(--hemg-amber-dark); font-size: 10.5px; font-weight: 740; letter-spacing: .13em; text-transform: uppercase; }
.hemg-project-heading h1 { font-size: clamp(26px,3vw,38px); font-weight: 720; letter-spacing: -.035em; }
.hemg-project-heading p { color: var(--hemg-steel-600); font-size: 13px; }
.hemg-project-card { height: 100%; transition: transform .18s ease, box-shadow .18s ease; overflow: hidden; }
.hemg-project-card:hover { transform: translateY(-3px); box-shadow: var(--hemg-shadow-md) !important; }
.hemg-project-card .project-logo-wrap {
  width: 74px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--hemg-steel-50);
  border: 1px solid var(--hemg-steel-150);
  border-radius: 10px;
  padding: 8px;
  flex: 0 0 auto;
}
.hemg-project-card .project-logo-wrap img { width: 100%; height: 100%; object-fit: contain; }
.hemg-project-card .project-no { color: var(--hemg-steel-500); font-size: 10.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.hemg-project-card .project-name { color: var(--hemg-navy-900); font-size: 17px; font-weight: 680; line-height: 1.25; }
.hemg-project-card .card-footer { padding: 0 18px 18px; background: #fff; border-top: 0; }

@media (max-width: 575.98px) {
  .hemg-subnav .card-body { padding: 8px !important; }
  .hemg-subnav a { min-height: 30px; padding: 5px 8px; }
  .home-section .card-header.d-flex { flex-wrap: wrap; }
  .hemg-project-page { padding-top: 82px; }
}

/* Neutralize legacy pastel row striping in high-density weld/MIR entry screens. */
body .home-section .table .weld_row:nth-child(even),
body .home-section .table tr[id^="detail_iso_"]:nth-child(even),
body .home-section [id="row_color"]:nth-child(even) {
  background-color: #f7f9fb !important;
}
body .home-section .table .weld_row:nth-child(odd),
body .home-section .table tr[id^="detail_iso_"]:nth-child(odd),
body .home-section [id="row_color"]:nth-child(odd) {
  background-color: #ffffff !important;
}
body .home-section .table .weld_row:hover,
body .home-section .table tr[id^="detail_iso_"]:hover,
body .home-section [id="row_color"]:hover {
  background-color: #f2f6f9 !important;
}
