/* Qualiconsult Engineering Operations Portal V3.0.0
   Approved corporate command-center visual system. */

:root{
  --v3-navy-950:#0a1425;
  --v3-navy-900:#101b31;
  --v3-navy-800:#192641;
  --v3-navy-700:#263651;
  --v3-red:#c5362d;
  --v3-red-dark:#a82d26;
  --v3-red-soft:#fff1ef;
  --v3-canvas:#f4f5f7;
  --v3-surface:#ffffff;
  --v3-surface-2:#f8f9fb;
  --v3-line:#dfe3e8;
  --v3-line-strong:#cbd2dc;
  --v3-text:#182237;
  --v3-muted:#68758a;
  --v3-green:#3f7857;
  --v3-green-soft:#eaf4ed;
  --v3-amber:#a76b0c;
  --v3-amber-soft:#fff5dc;
  --v3-danger:#a9312a;
  --v3-sidebar:250px;
  --v3-radius:8px;
  --v3-shadow:0 2px 8px rgba(16,27,49,.055);
  --sidebar:var(--v3-sidebar);
  --navy:var(--v3-navy-900);
  --navy-2:var(--v3-navy-800);
  --red:var(--v3-red);
  --red-dark:var(--v3-red-dark);
  --green:var(--v3-green);
  --amber:var(--v3-amber);
  --line:var(--v3-line);
  --muted:var(--v3-muted);
  --shadow:var(--v3-shadow);
}

html{background:var(--v3-canvas)}
body{
  background:var(--v3-canvas);
  color:var(--v3-text);
  font-family:Inter,"Segoe UI",Arial,sans-serif;
  font-size:14px;
  text-rendering:optimizeLegibility;
}
button,input,select,textarea{font:inherit}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{
  outline:3px solid rgba(197,54,45,.18);
  outline-offset:2px;
}

/* Application frame */
.enterprise-portal{
  display:grid;
  grid-template-columns:var(--v3-sidebar) minmax(0,1fr);
  min-height:100vh;
  background:var(--v3-canvas);
}
.app-sidebar{
  position:fixed;
  inset:0 auto 0 0;
  z-index:100;
  display:flex;
  width:var(--v3-sidebar);
  min-height:100vh;
  flex-direction:column;
  overflow:hidden;
  border-right:1px solid rgba(255,255,255,.08);
  background:var(--v3-navy-900);
  color:#fff;
  box-shadow:none;
}
.sidebar-brand.sidebar-brand-v3{
  display:flex;
  min-height:82px;
  align-items:center;
  gap:.8rem;
  padding:1rem 1rem .85rem;
  border-top:4px solid var(--v3-red);
  border-bottom:1px solid rgba(255,255,255,.08);
  background:var(--v3-navy-950);
}
.sidebar-logo-crop{
  position:relative;
  display:block;
  flex:0 0 44px;
  width:44px;
  height:44px;
  overflow:hidden;
  border-radius:6px;
  background:#fff;
}
.sidebar-logo-crop img{
  position:absolute;
  left:-42px;
  top:-16px;
  width:132px;
  max-width:none;
  height:auto;
}
.sidebar-brand-copy{display:block;min-width:0}
.sidebar-brand-copy strong{
  display:block;
  color:#fff;
  font-family:Georgia,"Times New Roman",serif;
  font-size:.94rem;
  line-height:1.1;
  letter-spacing:-.015em;
  white-space:nowrap;
}
.sidebar-brand-copy small{
  display:block;
  margin-top:.35rem;
  color:#aebad0;
  font-size:.55rem;
  font-weight:800;
  letter-spacing:.13em;
  text-transform:uppercase;
}
.sidebar-context{
  display:grid;
  grid-template-columns:auto 1fr;
  align-items:center;
  gap:.65rem;
  margin:.8rem .9rem .35rem;
  padding:.62rem .7rem;
  border:1px solid rgba(255,255,255,.11);
  border-radius:7px;
  background:rgba(255,255,255,.035);
}
.sidebar-context small{
  overflow:hidden;
  color:#8496ad;
  font-size:.55rem;
  text-align:right;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.environment-badge{
  display:flex;
  align-items:center;
  gap:.42rem;
  color:#cce8d6;
  font-size:.58rem;
  font-weight:900;
  letter-spacing:.07em;
  text-transform:uppercase;
}
.environment-badge i,.status-dot{
  width:7px;
  height:7px;
  border-radius:50%;
  background:#55b97c;
  box-shadow:0 0 0 3px rgba(85,185,124,.13);
}
.app-sidebar .nav-tabs{
  position:static;
  display:block;
  flex:1;
  overflow-y:auto;
  padding:.1rem .75rem 1rem;
  border:0;
  background:transparent;
  scrollbar-width:thin;
  scrollbar-color:#344159 transparent;
}
.nav-group{
  margin:1.05rem .65rem .36rem;
  color:#7e8da5;
  font-size:.56rem;
  font-weight:900;
  letter-spacing:.16em;
  text-transform:uppercase;
}
.app-sidebar .nav-button{
  position:relative;
  display:flex;
  width:100%;
  min-height:42px;
  align-items:center;
  gap:.72rem;
  margin:.12rem 0;
  padding:.62rem .72rem;
  border:1px solid transparent;
  border-radius:7px;
  background:transparent;
  color:#c4cede;
  font-size:.7rem;
  font-weight:750;
  text-align:left;
  transition:background .15s,border-color .15s,color .15s;
}
.app-sidebar .nav-button:hover{
  transform:none;
  border-color:rgba(255,255,255,.08);
  background:rgba(255,255,255,.055);
  color:#fff;
}
.app-sidebar .nav-button.active{
  border-color:rgba(255,255,255,.08);
  background:var(--v3-red);
  color:#fff;
  box-shadow:none;
}
.app-sidebar .nav-button.active:before{
  content:"";
  position:absolute;
  inset:8px auto 8px -12px;
  width:3px;
  background:#fff;
}
.nav-icon{
  display:grid;
  flex:0 0 25px;
  width:25px;
  height:25px;
  place-items:center;
  border:1px solid rgba(255,255,255,.06);
  border-radius:6px;
  background:rgba(255,255,255,.06);
  font-size:.78rem;
}
.nav-button.active .nav-icon{background:rgba(255,255,255,.14)}
.nav-alert-badge{
  display:grid;
  min-width:20px;
  height:20px;
  margin-left:auto;
  place-items:center;
  border:1px solid rgba(255,255,255,.5);
  border-radius:99px;
  background:#fff;
  color:var(--v3-red);
  font-size:.59rem;
}
.sidebar-footer{
  padding:.85rem 1.15rem 1.05rem;
  border-top:1px solid rgba(255,255,255,.08);
  color:#8fa0b6;
}
.sidebar-footer span{font-size:.51rem;letter-spacing:.14em}
.sidebar-footer strong{margin-top:.18rem;font-size:.66rem}
.sidebar-footer>small{margin-top:.55rem;font-size:.52rem}

.app-shell{grid-column:2;min-width:0;min-height:100vh}
.app-topbar{
  position:sticky;
  top:0;
  z-index:50;
  display:flex;
  min-height:70px;
  align-items:center;
  justify-content:space-between;
  gap:1.15rem;
  padding:.72rem 1.5rem;
  border-bottom:1px solid var(--v3-line);
  background:rgba(255,255,255,.98);
  box-shadow:0 1px 0 rgba(16,27,49,.025);
  backdrop-filter:none;
}
.topbar-title{min-width:255px}
.topbar-title p{
  margin:0 0 .16rem;
  color:#778398;
  font-size:.58rem;
  font-weight:800;
  letter-spacing:.02em;
}
.topbar-title h1{
  margin:0;
  color:var(--v3-navy-900);
  font-family:Georgia,"Times New Roman",serif;
  font-size:1.2rem;
  font-weight:700;
  letter-spacing:-.015em;
}
.global-search{
  display:flex;
  width:min(470px,38vw);
  min-height:40px;
  align-items:center;
  gap:.5rem;
  padding:0 .75rem;
  border:1px solid var(--v3-line);
  border-radius:7px;
  background:var(--v3-surface-2);
  color:#8591a3;
}
.global-search input{padding:.55rem 0;border:0;background:transparent;font-size:.7rem;box-shadow:none}
.topbar-actions{display:flex;align-items:center;gap:.6rem}
.topbar-icon{
  display:grid;
  width:36px;
  height:36px;
  place-items:center;
  padding:0;
  border:1px solid var(--v3-line);
  border-radius:7px;
  background:#fff;
  color:#516078;
}
.topbar-icon:hover{border-color:#aeb8c6;background:#f8f9fb;color:var(--v3-navy-900)}
.app-topbar .user-panel{grid-template-columns:36px auto 32px;min-width:210px}
.user-avatar{border-radius:7px;background:var(--v3-navy-900)}
.app-topbar .user-panel strong{font-size:.7rem}
.app-topbar .user-panel span:not(.user-avatar){font-size:.58rem}
.user-menu{border-radius:8px;box-shadow:0 12px 30px rgba(16,27,49,.15)}
.system-strip{
  display:flex;
  min-height:31px;
  align-items:center;
  justify-content:space-between;
  padding:.42rem 1.5rem;
  border-bottom:1px solid #e7e9ed;
  background:#fafbfc;
  color:#69768a;
  font-size:.57rem;
  font-weight:700;
}

/* Workspace hierarchy */
.enterprise-portal main{
  width:100%;
  max-width:1920px;
  margin:0 auto;
  padding:1.3rem 1.5rem 4rem;
}
.tab{animation:v3-enter .18s ease-out}
@keyframes v3-enter{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}
.page-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:1rem;
  margin:0 0 1rem;
  padding:.1rem 0;
}
.page-head h2{
  margin:0;
  color:var(--v3-navy-900);
  font-family:Georgia,"Times New Roman",serif;
  font-size:1.35rem;
}
.page-head p{margin:.25rem 0 0;color:var(--v3-muted);font-size:.72rem}
.page-head .page-label,.eyebrow{
  color:var(--v3-red);
  font-size:.56rem;
  font-weight:900;
  letter-spacing:.16em;
  text-transform:uppercase;
}
.page-head .page-context span{
  padding:.4rem .58rem;
  border:1px solid var(--v3-line);
  border-radius:6px;
  background:#fff;
  color:#5f6c80;
  font-size:.58rem;
}
.workspace-banner{
  position:relative;
  overflow:hidden;
  min-height:110px;
  margin-bottom:1rem;
  padding:1.25rem 1.4rem;
  border:1px solid #202f4b;
  border-radius:var(--v3-radius);
  background:var(--v3-navy-900);
  box-shadow:none;
}
.workspace-banner:before{
  content:"";
  position:absolute;
  inset:0 0 0 auto;
  width:36%;
  opacity:.45;
  background:
    linear-gradient(135deg,transparent 47%,rgba(255,255,255,.055) 48% 49%,transparent 50%),
    linear-gradient(45deg,transparent 47%,rgba(255,255,255,.04) 48% 49%,transparent 50%);
  background-size:56px 56px;
}
.workspace-banner:after{display:none}
.workspace-banner h2,.workspace-banner h3,.workspace-banner strong{font-family:Georgia,"Times New Roman",serif}

/* Cards and data visualization */
.kpi-grid{
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:.7rem;
  margin-bottom:1rem;
}
.kpi{
  position:relative;
  min-height:92px;
  overflow:hidden;
  padding:.95rem 1rem;
  border:1px solid var(--v3-line);
  border-radius:var(--v3-radius);
  background:#fff;
  box-shadow:none;
}
.kpi:before{width:3px;background:#7f8ca0}
.kpi:after{
  content:"";
  position:absolute;
  top:13px;
  right:13px;
  width:24px;
  height:24px;
  border:1px solid #e2e6eb;
  border-radius:6px;
  background:#f7f8fa;
}
.kpi.red:before{background:var(--v3-red)}
.kpi.green:before{background:var(--v3-green)}
.kpi.amber:before{background:var(--v3-amber)}
.kpi span{display:block;padding-right:34px;color:#718096;font-size:.57rem;letter-spacing:.09em}
.kpi strong{
  display:block;
  margin-top:.52rem;
  color:var(--v3-navy-900);
  font-family:Georgia,"Times New Roman",serif;
  font-size:clamp(1.1rem,1.55vw,1.42rem);
  letter-spacing:-.02em;
}
.kpi.red strong{color:var(--v3-red-dark)}
.kpi.green strong{color:var(--v3-green)}
.kpi.amber strong{color:var(--v3-amber)}
.chart-grid{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(320px,.75fr);gap:.85rem;margin-bottom:.9rem}
.dashboard-grid{gap:.85rem}
.panel{
  margin-bottom:.85rem;
  padding:1rem 1.05rem;
  border:1px solid var(--v3-line);
  border-radius:var(--v3-radius);
  background:var(--v3-surface);
  box-shadow:var(--v3-shadow);
}
.panel-title,.toolbar{display:flex;align-items:center;justify-content:space-between;gap:1rem}
.panel-title{margin-bottom:.8rem;padding-bottom:.72rem;border-bottom:1px solid #e8ebef}
.panel h2,.toolbar h2{
  margin:.15rem 0 0;
  color:var(--v3-navy-900);
  font-family:Georgia,"Times New Roman",serif;
  font-size:.98rem;
  letter-spacing:-.01em;
}
.panel p.muted,.muted{color:var(--v3-muted);font-size:.7rem;line-height:1.5}
.pill{
  padding:.32rem .52rem;
  border:1px solid #dfe3e8;
  border-radius:99px;
  background:#f7f8fa;
  color:#4f5d71;
  font-size:.59rem;
  font-weight:800;
}
.bar-chart,.mini-chart,.stacked-chart,.donut-host{min-height:230px}
.rank-list>div,.rank-row,.preview-card,.preview-grid>div{border-radius:6px;background:#f8f9fb}

/* Controls */
.button{
  min-height:36px;
  padding:.58rem .82rem;
  border-radius:6px;
  font-size:.68rem;
  font-weight:800;
  box-shadow:none;
}
.button.primary{border-color:var(--v3-red);background:var(--v3-red);color:#fff}
.button.primary:hover{border-color:var(--v3-red-dark);background:var(--v3-red-dark)}
.button.neutral{border-color:var(--v3-line-strong);background:#fff;color:#26344c}
.button.neutral:hover{border-color:#9eaaba;background:#f7f8fa}
.text-button{font-size:.68rem;font-weight:800}
input,select,textarea{
  min-height:38px;
  border:1px solid #cfd6df;
  border-radius:6px;
  background:#fff;
  color:var(--v3-text);
  font-size:.7rem;
  box-shadow:none;
}
textarea{line-height:1.45}
input:hover,select:hover,textarea:hover{border-color:#acb6c4}
input:focus,select:focus,textarea:focus{border-color:#8d9aad;box-shadow:0 0 0 3px rgba(16,27,49,.06)}
.filters{
  display:grid;
  grid-template-columns:2fr repeat(3,minmax(160px,1fr));
  gap:.65rem;
  margin:.75rem 0;
  padding:.72rem;
  border:1px solid var(--v3-line);
  border-radius:7px;
  background:#f8f9fb;
}
.report-toolbar{
  margin-bottom:.85rem;
  padding:.75rem .85rem;
  border:1px solid var(--v3-line);
  border-radius:7px;
  background:#fff;
  box-shadow:none;
}
.report-toolbar>div:first-child span{font-size:.63rem}

/* Tables */
.table-wrap{
  overflow:auto;
  border:1px solid var(--v3-line);
  border-radius:7px;
  background:#fff;
  scrollbar-color:#9ea7b4 #eef0f2;
  scrollbar-width:thin;
}
table{width:100%;border-collapse:separate;border-spacing:0;font-variant-numeric:tabular-nums}
th{
  position:sticky;
  top:0;
  z-index:3;
  padding:.68rem .72rem;
  border-right:1px solid rgba(255,255,255,.08);
  background:var(--v3-navy-900);
  color:#fff;
  font-size:.59rem;
  font-weight:850;
  letter-spacing:.025em;
  text-align:left;
  white-space:nowrap;
}
td{
  padding:.65rem .72rem;
  border-bottom:1px solid #e8ebef;
  background:#fff;
  color:#27334a;
  font-size:.66rem;
  line-height:1.35;
  vertical-align:middle;
}
tbody tr:nth-child(even) td{background:#fafbfc}
tbody tr:hover td,tbody tr:focus-within td{background:#f4f7fa}
tbody tr:last-child td{border-bottom:0}
.row-actions{display:flex;align-items:center;gap:.35rem;white-space:nowrap}
.row-actions button{
  padding:.4rem .52rem;
  border:1px solid #d4dae2;
  border-radius:5px;
  background:#fff;
  color:#344159;
  font-size:.61rem;
}
.row-actions button:hover{border-color:#aeb8c6;background:#f7f8fa}
.status{padding:.28rem .48rem;border-radius:99px;font-size:.57rem;font-weight:850;white-space:nowrap}

/* Engineer workspace: keep all approved direct-entry fields visible. */
.engineer-hero{
  border-left:4px solid var(--v3-red);
  background:#fff;
}
.engineer-kpis{grid-template-columns:repeat(6,minmax(0,1fr))}
.engineer-grid-wrap{max-height:64vh;border-radius:7px}
.engineer-table{
  width:max-content;
  min-width:2260px;
  table-layout:fixed;
  border-collapse:separate;
  border-spacing:0;
}
.engineer-table th,.engineer-table td{vertical-align:middle}
.engineer-table th:nth-child(1),.engineer-table td:nth-child(1){width:145px;min-width:145px;max-width:145px}
.engineer-table th:nth-child(2),.engineer-table td:nth-child(2){width:185px;min-width:185px;max-width:185px}
.engineer-table th:nth-child(3),.engineer-table td:nth-child(3){width:180px;min-width:180px;max-width:180px}
.engineer-table th:nth-child(4),.engineer-table td:nth-child(4){width:245px;min-width:245px;max-width:245px}
.engineer-table th:nth-child(5),.engineer-table td:nth-child(5){width:330px;min-width:330px;max-width:330px}
.engineer-table th:nth-child(6),.engineer-table td:nth-child(6){width:235px;min-width:235px;max-width:235px}
.engineer-table th:nth-child(7),.engineer-table td:nth-child(7){width:155px;min-width:155px;max-width:155px}
.engineer-table th:nth-child(8),.engineer-table td:nth-child(8){width:140px;min-width:140px;max-width:140px}
.engineer-table th:nth-child(9),.engineer-table td:nth-child(9){width:125px;min-width:125px;max-width:125px}
.engineer-table th:nth-child(10),.engineer-table td:nth-child(10){width:135px;min-width:135px;max-width:135px}
.engineer-table th:nth-child(11),.engineer-table td:nth-child(11){width:120px;min-width:120px;max-width:120px;text-align:center}
.engineer-table th:nth-child(12),.engineer-table td:nth-child(12){width:150px;min-width:150px;max-width:150px;text-align:center}
.engineer-table th:nth-child(13),.engineer-table td:nth-child(13){width:105px;min-width:105px;max-width:105px;text-align:center}
.engineer-table th:nth-child(1),.engineer-table td:nth-child(1){
  position:sticky;
  left:0;
  z-index:4;
  box-shadow:8px 0 12px -12px rgba(15,23,42,.7);
}
.engineer-table th:nth-child(1){z-index:7;background:var(--v3-navy-900)}
.engineer-table input,.engineer-table select,.engineer-table textarea{width:100%;min-width:0}
.engineer-table textarea{min-height:60px;resize:vertical}
.engineer-table td:nth-child(10) input{text-align:right;font-weight:800}
.engineer-status-select{border-left:3px solid #8290a4!important;font-weight:800}
.engineer-status-select.is-warning{border-left-color:#d09422!important;background:var(--v3-amber-soft)!important;color:#76500e!important}
.engineer-status-select.is-success{border-left-color:var(--v3-green)!important;background:var(--v3-green-soft)!important;color:#2e6448!important}
.engineer-status-select.is-danger{border-left-color:var(--v3-danger)!important;background:#fff0ef!important;color:#8c2d27!important}
.engineer-documents,.engineer-finance-action,.engineer-archive{white-space:nowrap}
.engineer-archive{color:var(--v3-danger)}
.finance-alert-banner{
  border:1px solid #efc8a7;
  border-left:4px solid var(--v3-red);
  border-radius:7px;
  background:#fff8f0;
}

/* Directories, forms and detail panels */
.form-grid,.dashboard-grid{column-gap:.85rem;row-gap:.75rem}
.preview-grid{gap:.7rem}
dialog{
  border:1px solid #cfd5de;
  border-radius:9px;
  background:#fff;
  box-shadow:0 28px 80px rgba(16,27,49,.26);
}
dialog::backdrop{background:rgba(10,20,37,.48)}
.side-drawer{
  border-left:1px solid var(--v3-line);
  border-radius:0;
  box-shadow:-18px 0 50px rgba(16,27,49,.2);
}
.task-detail-grid dt{color:#6b778b;font-size:.65rem}
.task-detail-grid dd{color:var(--v3-text);font-size:.72rem}
.notification-list>*,.reviewer-grid>*,.client-grid>*{border-radius:7px}

/* Formal secure sign-in remains part of the approved visual system. */
.login-screen{
  background:
    radial-gradient(circle at 50% 42%,rgba(40,68,108,.42),transparent 38%),
    linear-gradient(118deg,#071329 0%,#0d1d38 52%,#071329 100%);
}
.login-card{
  border-radius:10px;
  box-shadow:0 28px 75px rgba(0,0,0,.34);
}
.login-card .button.primary{background:var(--v3-red);box-shadow:none}
.login-card .button.primary:hover{background:var(--v3-red-dark)}

/* Responsive command center */
@media(max-width:1280px){
  :root{--v3-sidebar:226px}
  .app-topbar,.system-strip{padding-inline:1rem}
  .enterprise-portal main{padding-inline:1rem}
  .global-search{width:min(330px,30vw)}
  .engineer-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:980px){
  .enterprise-portal{display:block}
  .app-sidebar{transform:translateX(-102%);transition:transform .2s ease}
  .app-sidebar.open{transform:none}
  .app-shell{margin:0}
  .mobile-menu{display:grid}
  .global-search{display:none}
  .topbar-title{min-width:0}
  .app-topbar .user-panel{min-width:auto;grid-template-columns:36px 32px}
  .app-topbar .user-panel>div:not(.user-menu){display:none}
  .topbar-actions{margin-left:auto}
  .chart-grid{grid-template-columns:1fr}
  .kpi-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .engineer-table th:nth-child(n),.engineer-table td:nth-child(n){position:static;box-shadow:none}
  .engineer-table th{position:sticky;top:0;z-index:5}
}
@media(max-width:700px){
  .app-topbar{min-height:62px;padding:.55rem .7rem}
  .system-strip{padding:.4rem .7rem}
  .system-strip span:first-child{display:none}
  .enterprise-portal main{padding:.8rem .7rem 3rem}
  .topbar-title h1{font-size:1rem}
  .topbar-title p{display:none}
  .page-head{align-items:flex-start;flex-direction:column}
  .page-head .page-context{justify-content:flex-start}
  .workspace-banner{min-height:100px;padding:1rem}
  .kpi-grid,.engineer-kpis{grid-template-columns:1fr 1fr}
  .filters{grid-template-columns:1fr}
  .panel{padding:.82rem}
  .toolbar,.panel-title,.report-toolbar{align-items:flex-start;flex-direction:column}
  .toolbar-actions{width:100%;flex-wrap:wrap}
}
@media(max-width:440px){
  .kpi-grid,.engineer-kpis{grid-template-columns:1fr}
}

@media print{
  .app-sidebar,.app-topbar,.system-strip,.page-head,.report-toolbar,.toolbar-actions{display:none!important}
  .enterprise-portal,.app-shell{display:block!important}
  .enterprise-portal main{max-width:none;padding:0}
  .panel,.kpi{break-inside:avoid;box-shadow:none}
}
