/* Override container constraint for full-width portal */
body {
  overflow: hidden;
}

header .container,
footer .container {
  max-width: 100%;
  padding: 0 20px;
}

main.container {
  max-width: 100%;
  padding: 0;
  margin: 0;
  width: 100%;
}

:root{
  --sidebar-w: clamp(300px, 20vw, 400px);
}

.portal-app{
  display:flex;
  height: calc(100vh - 140px);
  width:100vw;
  min-height:0;
  position:relative;
  margin: 0;
  padding: 0;
}

.portal-sidebar{
  position:absolute;
  left:0; top:0; bottom:0;
  width: var(--sidebar-w);
  min-width: 260px;
  max-width: 520px;
  border-right:1px solid rgba(255,255,255,0.1);
  background: rgba(20, 20, 20, 0.85);
  display:flex;
  flex-direction:column;
  min-height:0;
}

.sidebar-top{
  padding:14px;
  border-bottom:1px solid rgba(255,255,255,0.1);
  display:flex;
  flex-direction:column;
  gap:10px;
  flex: 0 0 auto;
}

.progress-block{
  padding:10px 12px;
  background: rgba(30, 30, 40, 0.6);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.progress-block .label{ color:#94a3b8; font-size:12px; font-weight:700 }
.progress-block .value{ font-size:14px; font-weight:900; color:#e0e0e0; }

.filter-chips{ display:flex; gap:8px; flex-wrap:wrap; }
.chip{
  cursor:pointer;
  padding:6px 12px;
  border-radius: 6px;
  border:1px solid rgba(255,255,255,0.2);
  background: rgba(30, 30, 40, 0.6);
  color: #94a3b8;
  font-size:12px;
  font-weight:700;
  user-select:none;
  transition:.12s ease;
}
.chip.active{
  color: #e0e0e0;
  border-color: #5b9bd5;
  background: rgba(91, 155, 213, 0.2);
}

.image-list{
  overflow:auto;
  padding:10px;
  flex:1 1 auto;
  min-height:0;
}

.image-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(30, 30, 40, 0.4);
  margin-bottom:8px;
  cursor:pointer;
  transition: .12s ease;
}
.image-item:hover{
  border-color: #5b9bd5;
  background: rgba(30, 30, 40, 0.6);
}
.image-item.active{
  border-color: #5b9bd5;
  background: rgba(91, 155, 213, 0.2);
}

.item-name{
  font-weight:700;
  font-size:13px;
  min-width:0;
  overflow:hidden;
  text-overflow: ellipsis;
  color: #e0e0e0;
}

.label-pill{
  font-size:11px;
  font-weight:800;
  padding:4px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,0.2);
  background: rgba(148,163,184,0.2);
  color: #94a3b8;
  min-width: 70px;
  text-align:center;
}
.label-pill.roi{ background: rgba(52,211,153,0.2); border-color: rgba(52,211,153,0.4); color:#6ee7b7;}
.label-pill.normal{ background: rgba(91,155,213,0.2); border-color: rgba(91,155,213,0.4); color:#93c5fd;}

.portal-main{
  flex:1;
  min-width: 0;
  min-height:0;
  padding-left: var(--sidebar-w);
  display:flex;
  flex-direction:column;
}

.main-header{
  padding:14px 16px;
  border-bottom:1px solid rgba(255,255,255,0.1);
  background: rgba(20, 20, 20, 0.5);
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex: 0 0 auto;
}

.main-title{
  font-size:16px;
  font-weight:700;
  color:#e0e0e0;
}
.main-subtitle{
  font-size:13px;
  color:#94a3b8;
  margin-top:2px;
}

.canvas-area{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:10px;
  background:rgba(10, 14, 39, 0.6);
  min-height:0;
  overflow:auto;
}

.image-card{
  background:rgba(20, 20, 20, 0.85);
  border-radius:8px;
  border:1px solid rgba(255,255,255,0.15);
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  width: 100%;
  height: 100%;
  display:flex;
  flex-direction:column;
}

.image-wrapper{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:10px;
  flex:1;
  min-height:0;
  overflow: hidden;
}
.image-wrapper img{
  width: 90vw;
  height: calc(100vh - 350px);
  display:block;
  border-radius:4px;
  object-fit: contain;
  background: rgba(30, 30, 40, 0.6);
}

.image-footer{
  padding:16px;
  border-top:1px solid rgba(255,255,255,0.1);
  display:flex;
  justify-content:space-between;
  gap:12px;
}

.action-group{
  display:flex;
  gap:8px;
}

.btn{
  padding:10px 16px;
  border-radius:6px;
  border:1px solid rgba(255,255,255,0.2);
  background:rgba(30, 30, 40, 0.6);
  color:#e0e0e0;
  font-weight:600;
  font-size:13px;
  cursor:pointer;
  transition:.12s ease;
}
.btn:hover{ background:rgba(30, 30, 40, 0.8); border-color:#5b9bd5; }
.btn:disabled{ opacity:0.5; cursor:not-allowed; }
.btn.btn-success{ background:rgba(52,211,153,0.2); border-color:rgba(52,211,153,0.4); color:#6ee7b7; }
.btn.btn-primary{ background:rgba(91,155,213,0.2); border-color:rgba(91,155,213,0.4); color:#93c5fd; }

.kbd{
  font-family: monospace;
  font-size:10px;
  padding:2px 5px;
  border-radius:3px;
  background: rgba(30, 30, 40, 0.6);
  border: 1px solid rgba(255,255,255,0.2);
  color: #94a3b8;
  margin-left:4px;
}

@media (max-width: 900px){
  .portal-main{ padding-left: 0; }
  .portal-sidebar{ width: 85vw; transform: translateX(-100%); }
}
