/* HEMG Enterprise UI skin - UI-only overrides. Backend names, routes and form bindings remain untouched. */
:root {
  --hemg-navy: #07111f;
  --hemg-dark: #0b1628;
  --hemg-steel: #1f2f45;
  --hemg-slate: #334155;
  --hemg-orange: #f47b20;
  --hemg-gold: #ffb347;
  --hemg-light: #f6f8fb;
  --hemg-border: #d8dee8;
  --hemg-success: #16a34a;
  --hemg-warning: #f59e0b;
  --hemg-danger: #dc2626;
  --hemg-info: #2563eb;
  --hemg-shadow: 0 14px 35px rgba(7, 17, 31, 0.10);
  --hemg-shadow-soft: 0 6px 22px rgba(7, 17, 31, 0.08);
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  background: linear-gradient(180deg, #f6f8fb 0%, #eef2f7 100%) !important;
  color: #172033;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { transition: color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease; }

/* Brand color overrides */
.bg-primary,
.wave-bg-blue,
[style*="background-color: #3256a1"],
[style*="background-color:#3256a1"],
[style*="background-color: #112f70"],
[style*="background-color:#112f70"] {
  background: radial-gradient(circle at top right, rgba(244, 123, 32, .24), transparent 30%),
              linear-gradient(135deg, var(--hemg-navy) 0%, var(--hemg-dark) 48%, var(--hemg-steel) 100%) !important;
}
.text-primary { color: var(--hemg-dark) !important; }
.text-info { color: var(--hemg-orange) !important; }
.border-info { border-color: rgba(244, 123, 32, .45) !important; }
.border-primary { border-color: var(--hemg-orange) !important; }

/* Top navigation */
.navbar.fixed-top {
  min-height: 68px;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .22);
  z-index: 1040;
}
.navbar .container-fluid { gap: .75rem; }
.navbar img.rounded-circle {
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(255,255,255,.34);
  box-shadow: 0 0 0 3px rgba(244, 123, 32, .18), 0 8px 18px rgba(0,0,0,.18);
  object-fit: contain;
}
.navbar .btn-success,
.hemg-project-switcher {
  border-radius: 999px !important;
  background: rgba(244, 123, 32, .14) !important;
  border: 1px solid rgba(255, 179, 71, .55) !important;
  color: #fff !important;
  padding: .48rem .85rem !important;
  box-shadow: none !important;
}
.navbar .dropdown-toggle { color: #fff; text-decoration: none; }
.dropdown-menu {
  border: 1px solid rgba(216, 222, 232, .9) !important;
  box-shadow: 0 18px 45px rgba(7, 17, 31, .18) !important;
  border-radius: 16px !important;
}
.dropdown-item { border-radius: 10px; padding: .58rem .7rem !important; }
.dropdown-item:hover { background: rgba(244,123,32,.10) !important; color: var(--hemg-dark) !important; }

/* Sidebar */
.sidebar {
  position: fixed !important;
  height: calc(100vh - 68px) !important;
  top: 68px !important;
  left: 0;
  background: linear-gradient(180deg, #07111f 0%, #0b1628 100%) !important;
  border-right: 1px solid rgba(255,255,255,.08);
  box-shadow: 12px 0 28px rgba(7,17,31,.20) !important;
}
.sidebar .logo-details {
  min-height: 76px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: .65rem .75rem;
}
.sidebar .logo-details i {
  min-width: 58px !important;
  background: url('/static/img/hemg-enterprise-mark.png') center / 42px 42px no-repeat;
}
.sidebar .logo-details .logo_name {
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff !important;
}
.sidebar .logo-details .logo_name::after {
  content: 'Joint Integrity Platform';
  display: block;
  margin-top: .14rem;
  font-size: .56rem;
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: .09em;
  color: rgba(255, 179, 71, .86);
}
.sidebar .nav-links { padding: 18px 10px 110px !important; }
.sidebar .nav-links li {
  border: 0 !important;
  border-radius: 14px;
  margin: .18rem 0;
}
.sidebar .nav-links .headhov:hover,
.sidebar .nav-links li:hover {
  background: rgba(255,255,255,.07) !important;
}
.sidebar .nav-links li a {
  min-height: 48px;
  border-radius: 14px;
}
.sidebar .nav-links li i {
  min-width: 58px !important;
  height: 48px !important;
  line-height: 48px !important;
  color: var(--hemg-gold) !important;
}
.sidebar .nav-links li a .link_name,
.sidebar .nav-links li a .link_name.text-primary,
.sidebar .nav-links li .sub-menu .link_name {
  color: rgba(255,255,255,.90) !important;
  font-size: .84rem;
  letter-spacing: .01em;
  white-space: normal;
}
.sidebar_head_lg,
.sidebar_color {
  background: linear-gradient(90deg, rgba(244,123,32,.24), rgba(255,255,255,.06)) !important;
  border-left: 4px solid var(--hemg-orange) !important;
  color: #fff !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}
.sidebar .nav-links li .sub-menu,
.sidebar.close .nav-links li .sub-menu {
  background: #0f1b2e !important;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  box-shadow: 0 16px 34px rgba(0,0,0,.25);
}
.sidebar .nav-links li .sub-menu a { color: rgba(255,255,255,.72) !important; }
.sidebar .nav-links li .sub-menu a:hover { color: var(--hemg-gold) !important; }
.home-section {
  min-height: 100vh !important;
  background: transparent !important;
  padding-bottom: 2rem;
}

/* Mobile offcanvas */
.offcanvas { background: var(--hemg-light) !important; }
.offcanvas .btn-close { margin: .65rem; filter: invert(1); opacity: .8; }
.offcanvas [style*="background-color: #d4eefc"] {
  background: linear-gradient(135deg, var(--hemg-navy), var(--hemg-steel)) !important;
}
.list-group-item {
  border-color: rgba(216, 222, 232, .68) !important;
}
.list--bg.list-group-item {
  background: #fff;
  color: var(--hemg-slate) !important;
}
.list--bg.list-group-item:hover { background: rgba(244,123,32,.06) !important; }

/* Page hero banners */
.home-section > .position-relative.d-lg-none,
.home-section > .p-4.d-none.d-lg-block,
.home-section > div[style*="background-color: #3256a1"] {
  border-bottom: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 18px 40px rgba(7, 17, 31, .16);
}
.home-section h1,
.home-section .fs-5.fw-bold { letter-spacing: -.02em; }
.home-section .small.text-white { opacity: .84; }

/* Cards and sections */
.card {
  border: 1px solid rgba(216, 222, 232, .82) !important;
  border-radius: 18px !important;
  box-shadow: var(--hemg-shadow-soft) !important;
  overflow: hidden;
}
.card-header {
  background: rgba(255,255,255,.96) !important;
  border-bottom: 1px solid rgba(216,222,232,.82) !important;
}
.card-body { padding: 1.25rem; }
.card_zoom { border: 1px solid rgba(216,222,232,.72) !important; }
.card_zoom:hover { transform: translateY(-3px) scale(1.01); box-shadow: var(--hemg-shadow) !important; }
.border_seprator { border: 1px dashed rgba(148, 163, 184, .46) !important; }
.bg-grey { background: #f8fafc !important; }

/* Dashboard KPI cards */
.row .col-lg-2 > .card .bg-primary,
.row .col-lg-3 > .card .bg-primary,
.card .rounded-top.bg-primary {
  background: linear-gradient(135deg, #07111f 0%, #17263d 62%, #2b3649 100%) !important;
  border-bottom: 2px solid rgba(244,123,32,.82);
}
.progress {
  height: 8px !important;
  border-radius: 999px;
  background: #e7edf5;
  overflow: hidden;
}
.progress-bar { border-radius: 999px; }
.progress-bar.bg-success { background: linear-gradient(90deg, #22c55e, #16a34a) !important; }
.progress-bar.bg-warning { background: linear-gradient(90deg, #ffb347, #f59e0b) !important; }
.progress-bar.bg-danger { background: linear-gradient(90deg, #fb7185, #dc2626) !important; }
.progress-bar.bg-info { background: linear-gradient(90deg, #f47b20, #ffb347) !important; }

/* Forms */
.form-label,
label,
.card p.text-muted.m-0,
.card p.text-muted.m-0.mb-2,
.card p.m-0.text-muted {
  font-weight: 600;
  color: #475569 !important;
  font-size: .80rem;
  letter-spacing: .01em;
}
.form-control,
.form-select,
select,
input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
textarea {
  border: 1px solid #cbd5e1 !important;
  border-radius: 0px !important;
  min-height: 42px;
  color: #0f172a;
  box-shadow: none !important;
}
.form-control:focus,
.form-select:focus,
select:focus,
textarea:focus {
  border-color: var(--hemg-orange) !important;
  box-shadow: 0 0 0 .22rem rgba(244,123,32,.16) !important;
}
.form-control::placeholder { color: #94a3b8; }
.form-check-input:checked { background-color: var(--hemg-orange) !important; border-color: var(--hemg-orange) !important; }
.btn-check:checked + .btn-outline-primary,
.btn-check:active + .btn-outline-primary,
.btn-outline-primary:hover {
  background: var(--hemg-orange) !important;
  border-color: var(--hemg-orange) !important;
  color: #fff !important;
}

/* Buttons */
.btn {
  border-radius: 12px !important;
  font-weight: 700 !important;
  letter-spacing: .01em;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  box-shadow: none !important;
}
.btn-lg { min-height: 48px; }
.btn-info,
.btn-primary {
  background: linear-gradient(135deg, var(--hemg-orange), #ff9a3d) !important;
  border-color: #f47b20 !important;
  color: #fff !important;
}
.btn-info:hover,
.btn-primary:hover {
  background: linear-gradient(135deg, #dd6818, var(--hemg-orange)) !important;
  border-color: #dd6818 !important;
  color: #fff !important;
}
.btn-success {
  background: linear-gradient(135deg, var(--hemg-success), #22c55e) !important;
  border-color: var(--hemg-success) !important;
  color: #fff !important;
}
.btn-danger {
  background: linear-gradient(135deg, var(--hemg-danger), #ef4444) !important;
  border-color: var(--hemg-danger) !important;
  color: #fff !important;
}
.btn-warning {
  background: linear-gradient(135deg, var(--hemg-warning), var(--hemg-gold)) !important;
  border-color: var(--hemg-warning) !important;
  color: #111827 !important;
}
.btn-outline-primary {
  border-color: rgba(244,123,32,.55) !important;
  color: var(--hemg-dark) !important;
}
.btn-outline-primary:hover { color: #fff !important; }
.btn-sm { min-height: 34px; }

/* Tables */
.table-responsive {
  border-radius: 16px;
  overflow: auto;
  border: 1px solid rgba(216,222,232,.72);
}
.table {
  margin-bottom: 0 !important;
  vertical-align: middle;
  --bs-table-bg: #fff;
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc !important;
  color: #334155 !important;
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .035em;
  border-bottom: 1px solid #d8dee8 !important;
  white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid #edf2f7 !important; }
.table tbody tr:hover { background: #fff7ed !important; }
.table tbody td {
  border-bottom: 1px solid #edf2f7 !important;
  font-size: .86rem;
  color: #1e293b;
}
.table a { font-weight: 700; color: var(--hemg-orange) !important; }
.pagination .page-link {
  color: var(--hemg-dark);
  border-color: #d8dee8;
}
.pagination .page-link:hover {
  color: var(--hemg-orange);
  background: #fff7ed;
}

/* Status and alerts */
.alert.badge,
.badge.alert,
span.alert,
div.alert.badge {
  border-radius: 999px !important;
  padding: .36rem .72rem !important;
  font-weight: 800 !important;
  text-transform: capitalize;
  letter-spacing: .02em;
  min-width: 88px;
}
.alert-success { background: #dcfce7 !important; color: #166534 !important; border-color: #86efac !important; }
.alert-warning { background: #fef3c7 !important; color: #92400e !important; border-color: #fcd34d !important; }
.alert-danger { background: #fee2e2 !important; color: #991b1b !important; border-color: #fca5a5 !important; }
.alert-info { background: #e0f2fe !important; color: #075985 !important; border-color: #7dd3fc !important; }

/* Tabs / local nav */
.admin_header {
  color: var(--hemg-orange) !important;
  font-weight: 800 !important;
  border-bottom: 3px solid var(--hemg-orange) !important;
  padding-bottom: .35rem;
}
.card .vr { opacity: .18; }

/* Login / auth pages */
.hemg-login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 18%, rgba(244, 123, 32, .28), transparent 27%),
    radial-gradient(circle at 86% 78%, rgba(255, 179, 71, .18), transparent 30%),
    linear-gradient(135deg, #020916 0%, var(--hemg-navy) 52%, #0f1b2e 100%) !important;
  overflow: hidden;
}
.hemg-login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.65), transparent 88%);
  pointer-events: none;
}
.hemg-login-brand-logo {
  max-width: 178px;
  width: 42vw;
  height: auto;
  filter: drop-shadow(0 16px 30px rgba(0,0,0,.42));
}
.hemg-login-card {
  background: rgba(255,255,255,.97) !important;
  border: 1px solid rgba(255,255,255,.72) !important;
  backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(0,0,0,.34) !important;
}
.hemg-login-kicker {
  color: var(--hemg-gold);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 800;
}
.hemg-login-title { color: var(--hemg-navy); letter-spacing: -.03em; }
.hemg-login-support { color: #64748b; }
.hemg-login-feature {
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.065);
  border-radius: 16px;
  padding: 1rem;
  color: rgba(255,255,255,.86);
}
.hemg-login-feature i { color: var(--hemg-gold); }

/* Auth fallback pages that still use bg-primary */
.vh-100.bg-primary { background: linear-gradient(135deg, #020916, #07111f 58%, #17263d) !important; }
.vh-100.bg-primary > .container { position: relative; z-index: 2; }

/* Spacing and responsiveness */
.container-fluid > .p-lg-4 { padding-top: 1.35rem !important; }
@media (max-width: 998px) {
  .navbar.fixed-top { min-height: 64px; }
  .home-section { padding-top: 0 !important; }
  .home-section > .position-relative.d-lg-none { margin-top: 4rem !important; }
  .card-body { padding: 1rem; }
  .btn { min-height: 42px; }
  .d-flex.justify-content-between { gap: .6rem; flex-wrap: wrap; }
  .table thead th, .table tbody td { font-size: .78rem; }
}
@media (max-width: 576px) {
  .navbar .btn-success { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .card { border-radius: 16px !important; }
  .row > [class*='col-'] { margin-bottom: .35rem; }
  .table-responsive { border-radius: 12px; }
}
.btn-close {
  display: inline-block !important;
  min-height: auto !important;
  border-radius: .375rem !important;
}
.offcanvas [style*="background-color: #d4eefc"] .text-primary,
.offcanvas .text-primary.fw-bold {
  color: #fff !important;
}

/* Final HEMG client-demo hardening */
.hemg-footer-shell {
  background: radial-gradient(circle at top right, rgba(244, 123, 32, .22), transparent 30%),
              linear-gradient(135deg, var(--hemg-navy), var(--hemg-dark) 55%, var(--hemg-steel)) !important;
  border-top: 1px solid rgba(255,255,255,.10) !important;
}
.hemg-footer-card.card { box-shadow: none !important; border: 0 !important; }
.hemg-compliance-strip {
  max-width: 860px;
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 18px 38px rgba(0,0,0,.20);
}
.hemg-hero-badge {
  background: rgba(244, 123, 32, .18) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 179, 71, .55);
  padding: .55rem .85rem;
}
.hemg-form-section-title {
  color: var(--hemg-navy);
  font-weight: 800;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-left: 4px solid var(--hemg-orange);
  padding: .2rem .75rem;
  margin-bottom: .75rem;
  background: linear-gradient(90deg, rgba(244,123,32,.10), rgba(244,123,32,0));
  border-radius: 8px;
}
.hemg-assessment-card .input-group-text {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
  font-weight: 700;
  border-radius: 0 12px 12px 0 !important;
}
.hemg-reference-card img {
  background: #fff;
  object-fit: contain;
}
.hemg-result-card {
  border: 1px solid rgba(216, 222, 232, .82);
  border-radius: 18px;
  padding: 1.25rem;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow: var(--hemg-shadow-soft);
}
.hemg-result-message {
  font-size: clamp(1.4rem, 2vw, 2rem);
  font-weight: 900;
  letter-spacing: .06em;
  margin-top: .2rem;
}
.hemg-result-details {
  border-radius: 14px;
  border: 1px solid rgba(216,222,232,.82);
  background: #fff;
  padding: 1rem;
  color: #334155;
  line-height: 1.6;
}
.hemg-status-icon {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--hemg-slate);
  font-size: 1.35rem;
}
.status-accepted { color: var(--hemg-success) !important; }
.status-rejected { color: var(--hemg-danger) !important; }
.status-accepted-bg { background: var(--hemg-success) !important; }
.status-rejected-bg { background: var(--hemg-danger) !important; }
@media (max-width: 576px) {
  .hemg-assessment-card .card-header { align-items: flex-start !important; }
  .hemg-compliance-strip { border-radius: 10px; }
}

.dashboard-card {
    background: #ffffff;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid #e9ecef;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    height: 100%;
}

.dashboard-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 35px rgba(0,0,0,0.12);
}

.card-header-gradient {
    /* background: linear-gradient(135deg, #2563eb, #1d4ed8); */
    background:linear-gradient(135deg,#334155,#475569);
    color: #fff;
    padding: 28px 20px;
    position: relative;
}

.card-header-gradient::after {
    content: "";
    position: absolute;
    right: -30px;
    top: -30px;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,.05);
    border-radius: 50%;
}

.card-number {
    font-size: 2.7rem;
    font-weight: 700;
    line-height: 1;
}

.card-label-top {
    margin-top: 10px;
    font-size: .85rem;
    letter-spacing: .5px;
    opacity: .9;
}

.card-content {
    padding: 20px;
}

.custom-progress {
    height: 8px;
    border-radius: 20px;
    background: #edf2f7;
    overflow: hidden;
}

.custom-progress .progress-bar {
    border-radius: 20px;
    transition: width .6s ease;
}

.status-title {
    font-size: .95rem;
    font-weight: 600;
    color: #334155;
}

.status-percentage {
    font-size: .85rem;
    font-weight: 700;
    color: #dc3545;
    background: rgba(220,53,69,.08);
    padding: 4px 10px;
    border-radius: 20px;
}

.total-card{
    background:linear-gradient(135deg,#2563eb,#4f46e5);
    border-radius:20px;
    padding:28px;
    color:white;
    overflow:hidden;
    position:relative;
    box-shadow:0 15px 35px rgba(37,99,235,.25);
    transition:.3s;
}

.total-card:hover{
    transform:translateY(-6px);
}

.total-card::before{
    content:"";
    position:absolute;
    width:180px;
    height:180px;
    background:rgba(255,255,255,.08);
    border-radius:50%;
    top:-60px;
    right:-60px;
}

.total-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
}

.total-number{
    font-size:3rem;
    font-weight:700;
    margin-top:8px;
    margin-bottom:0;
}

.total-label{
    font-size:.9rem;
    letter-spacing:1px;
    text-transform:uppercase;
    opacity:.85;
}

.total-icon{
    width:60px;
    height:60px;
    border-radius:18px;
    background:rgba(255,255,255,.15);
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:28px;
}

.total-progress{
    height:8px;
    background:rgba(255,255,255,.25);
}

.total-progress .progress-bar{
    background:white;
}


/* ===========================
   CARD HEADER COLORS
=========================== */

.untouched-header{
    background:linear-gradient(135deg,#64748b,#475569);
}

.breakdown-header{
    background:linear-gradient(135deg,#f59e0b,#d97706);
}

.tightened-header{
    background:linear-gradient(135deg,#06b6d4,#0891b2);
}

.qc-header{
    background:linear-gradient(135deg,#10b981,#059669);
}

.qa-header{
    background:linear-gradient(135deg,#6366f1,#4f46e5);
}


/* ===========================
   PROGRESS BAR
=========================== */

.progress-untouched{
    background:#64748b;
}

.progress-breakdown{
    background:#f59e0b;
}

.progress-tightened{
    background:#06b6d4;
}

.progress-qc{
    background:#10b981;
}

.progress-qa{
    background:#6366f1;
}


/* ===========================
   PERCENTAGE BADGE
=========================== */

.badge-untouched{
    color:#475569;
    background:#e2e8f0;
}

.badge-breakdown{
    color:#b45309;
    background:#fef3c7;
}

.badge-tightened{
    color:#0e7490;
    background:#cffafe;
}

.badge-qc{
    color:#047857;
    background:#d1fae5;
}

.badge-qa{
    color:#4338ca;
    background:#e0e7ff;
}