.reports-app{
  height:100vh;
  grid-template-rows:var(--header-h) minmax(0,1fr);
}

.reports-page{
  display:grid;
  grid-template-columns:360px minmax(0,1fr);
  gap:18px;
  padding:18px;
  min-height:0;
}

.reports-sidebar{
  display:flex;
  flex-direction:column;
  gap:14px;
  padding:18px;
  min-height:0;
}

.sidebar-head,
.panel-headline,
.output-headline{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.panel-title{
  font-size:18px;
  font-weight:800;
  line-height:1.1;
}

.panel-subtitle{
  font-size:13px;
  color:var(--muted);
  margin-top:6px;
}

.sidebar-toolbar{display:flex;gap:10px}

.reports-stats{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}

.report-template-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  overflow:auto;
  padding-right:4px;
  min-height:0;
}

.report-template-list::-webkit-scrollbar,
.report-builder-panel::-webkit-scrollbar,
.report-table-wrap::-webkit-scrollbar{
  width:7px;
}

.report-template-list::-webkit-scrollbar-thumb,
.report-builder-panel::-webkit-scrollbar-thumb,
.report-table-wrap::-webkit-scrollbar-thumb{
  background:rgba(255,122,24,.25);
  border-radius:999px;
}

.report-template-card{
  position:relative;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
  border-radius:18px;
  padding:14px;
  cursor:pointer;
  transition:.2s ease;
}

.report-template-card:hover{
  transform:translateY(-1px);
  border-color:rgba(255,122,24,.35);
}

.report-template-card.active{
  border-color:rgba(255,122,24,.8);
  box-shadow:0 0 0 1px rgba(255,122,24,.25), 0 12px 28px rgba(0,0,0,.22);
}

.report-template-title{
  font-size:15px;
  font-weight:800;
  margin-bottom:4px;
  padding-right:88px;
}

.report-template-meta{
  font-size:12px;
  color:rgba(255,255,255,.62);
  margin-bottom:10px;
}

.report-template-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
  font-size:12px;
}

.report-template-grid span{
  display:block;
  color:rgba(255,255,255,.56);
  margin-bottom:2px;
}

.template-source-badge{
  position:absolute;
  top:12px;
  right:12px;
  padding:4px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:700;
  background:rgba(255,122,24,.14);
  color:#ffd7b3;
  border:1px solid rgba(255,122,24,.18);
}

.reports-workspace,
.workspace-grid,
.report-builder-panel,
.report-output-panel{
  min-height:0;
}

.workspace-grid{
  display:grid;
  grid-template-columns:470px minmax(0,1fr);
  gap:18px;
  height:100%;
}

.report-builder-panel{
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:16px;
  overflow:auto;
}

.report-form{
  display:flex;
  flex-direction:column;
  gap:14px;
  min-height:min-content;
}

.form-grid{display:grid;gap:12px}
.form-grid.two-cols{grid-template-columns:repeat(2,minmax(0,1fr))}
.form-grid.three-cols{grid-template-columns:repeat(3,minmax(0,1fr))}

.report-form label{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.report-form label span{
  font-size:12px;
  color:rgba(255,255,255,.72);
}

.ri-input{
  width:100%;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.08);
  color:#fff;
  border-radius:14px;
  padding:12px 14px;
  outline:none;
}

.ri-input:focus{
  border-color:rgba(255,122,24,.65);
  box-shadow:0 0 0 3px rgba(255,122,24,.12);
}

.ri-input::placeholder{color:rgba(255,255,255,.40)}
.ri-input option{background:#101722;color:#fff}
.ri-textarea{resize:vertical;min-height:100px}

.selector-box,
.report-tools{
  background:rgba(255,255,255,.035);
  border:1px solid rgba(255,255,255,.08);
  border-radius:18px;
  padding:14px;
}

.selector-title,
.tools-title{
  font-size:13px;
  font-weight:800;
}

.selector-subtitle,
.tools-hint{
  margin-top:6px;
  font-size:12px;
  color:rgba(255,255,255,.66);
  line-height:1.45;
}

.field-selector{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-top:12px;
}

.field-check{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.06);
  background:rgba(255,255,255,.02);
}

.field-check input{
  accent-color:#ff7a18;
}

.tools-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-top:12px;
}

.report-output-panel{
  padding:18px;
  display:grid;
  grid-template-rows:auto auto minmax(0,1fr);
  gap:14px;
}

.result-badges{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.result-chip{
  padding:10px 14px;
  border-radius:999px;
  background:rgba(7,10,16,.72);
  border:1px solid rgba(255,255,255,.07);
  font-size:13px;
  font-weight:800;
  color:var(--muted);
}

.result-chip strong{color:#fff;margin-left:8px}

.report-summary-cards{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
}

.report-summary-card{
  border:1px solid rgba(255,255,255,.06);
  background:rgba(255,255,255,.03);
  border-radius:16px;
  padding:12px 14px;
}

.report-summary-card span{
  display:block;
  color:var(--muted);
  font-size:12px;
  font-weight:700;
  margin-bottom:4px;
}

.report-summary-card strong{
  font-size:22px;
  color:var(--amber);
  font-weight:800;
}

.report-table-wrap{
  min-height:0;
  overflow:auto;
  border:1px solid rgba(255,255,255,.06);
  border-radius:22px;
  background:linear-gradient(180deg, rgba(8,12,18,.9), rgba(10,14,22,.86));
}

.report-empty{
  min-height:260px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  color:rgba(255,255,255,.6);
  padding:20px;
}

.report-table{
  width:100%;
  border-collapse:collapse;
  min-width:760px;
}

.report-table thead th{
  position:sticky;
  top:0;
  z-index:2;
  text-align:left;
  padding:14px 14px;
  background:#111926;
  border-bottom:1px solid rgba(255,255,255,.08);
  color:#fff;
  font-size:13px;
  font-weight:800;
}

.report-table tbody td{
  padding:12px 14px;
  border-bottom:1px solid rgba(255,255,255,.05);
  color:rgba(255,255,255,.86);
  font-size:13px;
  vertical-align:top;
}

.report-table tbody tr:hover{
  background:rgba(255,122,24,.05);
}

.mode-btn.reports-top-btn,
.mode-btn.report-action-btn,
.mode-btn.report-tool-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
}

.mode-btn.reports-top-btn{
  background:linear-gradient(180deg, rgba(255,122,24,.26), rgba(255,122,24,.12));
  color:#fff1e5;
  box-shadow:inset 0 0 0 1px rgba(255,122,24,.28), 0 0 20px rgba(255,122,24,.08);
}

.mode-btn.report-action-btn,
.mode-btn.report-tool-btn{
  background:rgba(255,255,255,.025);
  color:var(--muted);
  border:1px solid rgba(255,255,255,.06);
}

.mode-btn.report-action-btn:hover,
.mode-btn.report-tool-btn:hover{
  background:linear-gradient(180deg, rgba(255,122,24,.26), rgba(255,122,24,.12));
  color:#fff1e5;
  box-shadow:inset 0 0 0 1px rgba(255,122,24,.28), 0 0 20px rgba(255,122,24,.08);
}

.mode-btn.report-action-btn.danger{
  color:#ffb0b0;
  border-color:rgba(255,91,84,.18);
}

.mode-btn.report-action-btn.danger:hover{
  background:linear-gradient(180deg, rgba(255,91,84,.22), rgba(255,91,84,.10));
  color:#fff1e5;
  box-shadow:inset 0 0 0 1px rgba(255,91,84,.28), 0 0 20px rgba(255,91,84,.08);
}

.mode-btn[disabled]{
  opacity:.45;
  cursor:not-allowed;
  pointer-events:none;
}

@media (max-width:1360px){
  .reports-page{grid-template-columns:320px minmax(0,1fr)}
  .workspace-grid{grid-template-columns:430px minmax(0,1fr)}
  .report-summary-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media (max-width:1100px){
  body{overflow:auto}
  .reports-app{height:auto;grid-template-rows:auto auto}
  .reports-page{grid-template-columns:1fr}
  .workspace-grid{grid-template-columns:1fr}
  .report-summary-cards{grid-template-columns:1fr}
}