:root{
  --pid-petrol:#173F4D;
  --pid-mint:#75BCC6;
  --pid-bg:#F5F7F9;
  --pid-card:#FFFFFF;
  --pid-text:#1F2937;
  --pid-muted:#6B7280;
  --pid-border:#E5E7EB;
  --pid-danger:#B91C1C;
  --pid-success:#047857;
}

body{
  margin:0;
  background:var(--pid-bg);
  color:var(--pid-text);
  font-family:Roboto, Open Sans, Arial, sans-serif;
}

.pid-topbar{
  height:72px;
  background:var(--pid-card);
  border-bottom:1px solid var(--pid-border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 32px;
  box-shadow:0 4px 18px rgba(23,63,77,.08);
}

.pid-logo{
  height:46px;
  max-width:220px;
  object-fit:contain;
}

.pid-nav{
  display:flex;
  gap:10px;
  align-items:center;
}

.pid-nav a{
  color:var(--pid-petrol);
  text-decoration:none;
  font-weight:600;
  padding:10px 12px;
  border-radius:10px;
}

.pid-nav a:hover{
  background:rgba(117,188,198,.18);
}

.pid-shell{
  padding:28px;
  max-width:1400px;
  margin:0 auto;
}

.card,.box{
  background:var(--pid-card)!important;
  border-radius:18px!important;
  box-shadow:0 8px 28px rgba(23,63,77,.08)!important;
  border:1px solid rgba(23,63,77,.06);
}

button{
  background:var(--pid-petrol)!important;
  color:white!important;
  border:0!important;
  border-radius:11px!important;
  padding:10px 14px!important;
  cursor:pointer!important;
  font-weight:600;
}

button:hover{
  background:#0f2c36!important;
}

input,select{
  border:1px solid var(--pid-border)!important;
  border-radius:11px!important;
  padding:10px 12px!important;
}

h1,h2,h3{
  color:var(--pid-petrol);
}

.muted{
  color:var(--pid-muted)!important;
}

.ok{
  color:var(--pid-success)!important;
}

.error,.neg{
  color:var(--pid-danger)!important;
}

/* PID360 Projects V2 */
.pid-page-hero{
  background:linear-gradient(135deg,#173F4D 0%,#245A6B 60%,#75BCC6 100%);
  color:white;
  border-radius:24px;
  padding:28px 32px;
  margin-bottom:24px;
  box-shadow:0 14px 38px rgba(23,63,77,.22);
}

.pid-page-hero h1{
  color:white;
  margin:0 0 8px 0;
  font-size:34px;
}

.pid-toolbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin-bottom:22px;
  flex-wrap:wrap;
}

.pid-toolbar-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.project-grid{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(310px,1fr))!important;
  gap:24px!important;
}

.project-card{
  background:white!important;
  border-radius:24px!important;
  overflow:hidden!important;
  box-shadow:0 12px 34px rgba(23,63,77,.12)!important;
  border:1px solid rgba(23,63,77,.08);
  transition:transform .18s ease, box-shadow .18s ease;
}

.project-card:hover{
  transform:translateY(-4px);
  box-shadow:0 18px 44px rgba(23,63,77,.18)!important;
}

.project-cover{
  height:178px;
  background:linear-gradient(135deg,rgba(23,63,77,.92),rgba(117,188,198,.75));
  position:relative;
  overflow:hidden;
}

.project-cover img{
  width:100%;
  height:178px;
  object-fit:cover;
  display:block;
}

.project-cover::after{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(180deg,rgba(0,0,0,0) 40%,rgba(0,0,0,.34) 100%);
}

.project-card-content{
  padding:20px!important;
}

.project-title{
  color:#173F4D;
  font-size:22px!important;
  font-weight:800!important;
  margin-bottom:8px!important;
}

.project-meta{
  color:#6B7280!important;
  font-size:14px!important;
  margin-bottom:14px!important;
}

.pid-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.pid-badge-active{
  background:rgba(4,120,87,.12);
  color:#047857;
}

.pid-badge-demo{
  background:rgba(217,119,6,.13);
  color:#B45309;
}

.pid-badge-archived{
  background:rgba(185,28,28,.12);
  color:#B91C1C;
}

.project-actions{
  margin-top:16px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.project-actions button{
  margin:0!important;
}

.project-actions .secondary{
  background:white!important;
  color:#173F4D!important;
  border:1px solid rgba(23,63,77,.18)!important;
}

.project-actions .secondary:hover{
  background:rgba(117,188,198,.16)!important;
}

/* PID360 Dashboard V2 */
.pid-dashboard-hero{
  background:linear-gradient(135deg,#173F4D 0%,#245A6B 60%,#75BCC6 100%);
  color:white;
  border-radius:24px;
  padding:30px 34px;
  margin-bottom:26px;
  box-shadow:0 14px 38px rgba(23,63,77,.22);
}

.pid-dashboard-hero h1{
  color:white;
  margin:0 0 8px 0;
  font-size:36px;
}

.pid-kpi-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(190px,1fr));
  gap:18px;
  margin-bottom:28px;
}

.pid-kpi-card{
  background:white;
  border-radius:22px;
  padding:22px;
  box-shadow:0 12px 34px rgba(23,63,77,.10);
  border:1px solid rgba(23,63,77,.08);
}

.pid-kpi-label{
  color:#6B7280;
  font-weight:700;
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.05em;
}

.pid-kpi-value{
  color:#173F4D;
  font-size:34px;
  font-weight:900;
  margin-top:8px;
}

.pid-section-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin:28px 0 14px 0;
}

.pid-modern-table{
  width:100%;
  border-collapse:collapse;
  background:white;
  border-radius:18px;
  overflow:hidden;
  box-shadow:0 8px 28px rgba(23,63,77,.08);
}

.pid-modern-table th{
  background:#173F4D!important;
  color:white!important;
  padding:13px 14px;
}

.pid-modern-table td{
  padding:12px 14px;
  border-bottom:1px solid #E5E7EB;
}

/* PID360 P&ID Navigation Layout */
.pid-app-layout{
  display:grid;
  grid-template-columns:260px 1fr 320px;
  min-height:calc(100vh - 72px);
  background:#f7fafc;
}

.pid-left-panel,
.pid-right-panel{
  background:white;
  border-right:1px solid #e5e7eb;
  padding:22px;
}

.pid-right-panel{
  border-right:0;
  border-left:1px solid #e5e7eb;
}

.pid-main-canvas{
  padding:28px;
  background:
    radial-gradient(circle at 30% 20%, rgba(117,188,198,.12), transparent 30%),
    linear-gradient(180deg,#ffffff 0%,#f7fafc 100%);
}

.pid-step{
  display:flex;
  gap:12px;
  align-items:center;
  padding:14px;
  border:1px solid #dbe3ea;
  border-radius:14px;
  margin-bottom:12px;
  background:white;
  font-weight:700;
  color:#173F4D;
}

.pid-step.active{
  border-color:#75BCC6;
  box-shadow:0 8px 24px rgba(117,188,198,.22);
}

.pid-node-map{
  position:relative;
  min-height:620px;
  background:white;
  border-radius:26px;
  border:1px solid #e5e7eb;
  box-shadow:0 14px 38px rgba(23,63,77,.10);
  overflow:hidden;
  padding:36px;
}

.pid-line{
  position:absolute;
  background:#75BCC6;
  opacity:.75;
  border-radius:999px;
}

.pid-line.h{ height:4px; }
.pid-line.v{ width:4px; }

.pid-project-node{
  position:absolute;
  width:210px;
  background:white;
  border:1px solid #cfdce4;
  border-radius:18px;
  padding:18px;
  box-shadow:0 10px 28px rgba(23,63,77,.12);
}

.pid-project-node.active{
  border-color:#047857;
}

.pid-project-node h3{
  margin:0 0 8px 0;
  color:#173F4D;
}

.pid-node-meta{
  color:#6b7280;
  font-size:13px;
}

.pid-node-status{
  display:inline-block;
  margin-top:10px;
  padding:5px 9px;
  border-radius:999px;
  background:rgba(4,120,87,.12);
  color:#047857;
  font-size:12px;
  font-weight:800;
}

.pid-module-row{
  position:absolute;
  bottom:38px;
  left:60px;
  right:60px;
  display:flex;
  justify-content:space-around;
}

.pid-module{
  text-align:center;
  color:#173F4D;
  font-weight:800;
}

.pid-module-circle{
  width:58px;
  height:58px;
  border-radius:50%;
  border:1px solid #cfdce4;
  display:flex;
  align-items:center;
  justify-content:center;
  margin:0 auto 8px auto;
  background:white;
  box-shadow:0 8px 20px rgba(23,63,77,.10);
}

.pid-side-card{
  background:white;
  border:1px solid #e5e7eb;
  border-radius:18px;
  padding:18px;
  margin-bottom:16px;
  box-shadow:0 8px 24px rgba(23,63,77,.08);
}

.pid-mini-stat{
  display:flex;
  justify-content:space-between;
  border-bottom:1px solid #eef2f5;
  padding:9px 0;
  font-size:14px;
}

@media(max-width:1200px){
  .pid-app-layout{
    grid-template-columns:1fr;
  }
  .pid-left-panel,.pid-right-panel{
    display:none;
  }
}

/* Fix topbar P&ID360 */
.pid-topbar{
  background:#173F4D!important;
  color:white!important;
}

.pid-nav a{
  color:white!important;
}

.pid-nav a:hover{
  background:rgba(117,188,198,.22)!important;
}

.pid-logo{
  height:54px!important;
  max-width:240px!important;
}

header{
  display:none!important;
}

/* PID360 Dashboard Homogeneous Layout */
.pid-topbar{
  background:#173F4D!important;
  color:white!important;
}

.pid-topbar-search{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:360px;
}

.pid-topbar-search input{
  width:320px;
  background:white!important;
}

.pid-topbar-actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.pid-sidebar a,
.pid-context a{
  text-decoration:none;
}

.pid-flow-item{
  cursor:pointer;
}

.pid-flow-item:hover{
  transform:translateX(3px);
}

.pid-node-map{
  min-height:680px!important;
}

.pid-svg-node{
  cursor:pointer;
  transition:all .15s ease;
}

.pid-svg-node:hover rect{
  filter:drop-shadow(0 10px 18px rgba(23,63,77,.25));
  stroke:#75BCC6;
  stroke-width:3;
}

.pid-svg-node text{
  pointer-events:none;
}

.pid-svg-link{
  cursor:pointer;
}

.pid-svg-link:hover{
  opacity:.8;
}

.pid-mini-module-value{
  font-size:20px;
  font-weight:900;
  fill:#173F4D;
}

.pid-mini-module-label{
  font-size:12px;
  fill:#6B7280;
  font-weight:700;
}

.pid-context-link{
  display:block;
  padding:10px 12px;
  border-radius:12px;
  color:#173F4D;
  font-weight:700;
  margin-bottom:6px;
}

.pid-context-link:hover{
  background:rgba(117,188,198,.18);
}

.pid-message-fade{
  transition:opacity .4s ease;
}

.pid-schema-bg{
  background-image:
    linear-gradient(180deg,rgba(255,255,255,.88),rgba(247,250,252,.94)),
    url("/static/img/pid-schema-bg.svg");
  background-repeat:no-repeat;
  background-position:right bottom;
  background-size:420px auto;
}

.pid-topbar-search{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:360px;
}

.pid-topbar-search input{
  width:340px;
  background:white!important;
}

.pid-topbar-actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.pid-message-fade{
  transition:opacity .4s ease;
}

#pidTree{
  margin-bottom:20px;
}

.pid-tree-group{
  margin-bottom:12px;
}

.pid-tree-client{
  font-weight:800;
  color:#173F4D;
  padding:8px 10px;
  border-radius:10px;
  background:rgba(117,188,198,.15);
  margin-bottom:6px;
}

.pid-tree-project{
  margin-left:18px;
  padding:6px 10px;
  color:#374151;
  cursor:pointer;
}

.pid-tree-project:hover{
  color:#173F4D;
  font-weight:700;
}

#pidTree{
  margin-bottom:20px;
}

.pid-tree-group{
  margin-bottom:12px;
}

.pid-tree-client{
  font-weight:800;
  color:#173F4D;
  padding:8px 10px;
  border-radius:10px;
  background:rgba(117,188,198,.15);
  margin-bottom:6px;
}

.pid-tree-project{
  margin-left:18px;
  padding:6px 10px;
  color:#374151;
  cursor:pointer;
}

.pid-tree-project:hover{
  color:#173F4D;
  font-weight:700;
}
