/* Quality Dashboard — page-specific layout */

body.qd-page .nav-item.active {
  background: #e8f0fe;
  color: var(--blue);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--blue);
}
body.qd-page .nav-item.active .ic { color: var(--blue); }

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.sidebar-logout {
  width: 100%;
  margin-top: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: #5b647a;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.sidebar-logout:hover { background: #f4f6fd; color: var(--navy); }

.qd-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 58%, var(--blue) 100%);
  border-radius: 12px;
  padding: 18px 24px;
  margin-bottom: 18px;
  color: #fff;
}
.qd-header-left h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #fff;
}
.qd-header-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  font-size: 12.5px;
  opacity: 0.92;
}
.qd-header-meta b { font-weight: 700; }
.qd-meta-sep { opacity: 0.45; }

.qd-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.9);
}
.qd-header-right b { color: #fff; }
.qd-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 7px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.qd-refresh:hover { background: rgba(255, 255, 255, 0.22); transform: translateY(-1px); }

.sidebar-logout .ic,
.qd-refresh .ic {
  width: 14px;
  height: 14px;
  stroke-width: 2.1;
}

.qd-header .icon-inline,
.qd-header .ic {
  color: rgba(255, 255, 255, 0.92);
}

body.qd-page .kpi-row {
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
body.qd-page .kpi-card { min-height: 118px; }

.qd-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}
.qd-grid-3 .card { margin-bottom: 0; }

.qd-card-foot {
  display: flex;
  justify-content: center;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--line);
}
.qd-link {
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.qd-link:hover { text-decoration: underline; }

.qd-priority {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12px;
  text-transform: capitalize;
}
.qd-priority .dot { width: 9px; height: 9px; }

.qd-qty-high { color: var(--red); font-weight: 700; }

.qd-contrib {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.qd-contrib-bar {
  flex: 1;
  max-width: 80px;
  height: 7px;
  background: #eef1fb;
  border-radius: 4px;
  overflow: hidden;
}
.qd-contrib-fill {
  height: 100%;
  background: var(--red);
  border-radius: 4px;
}
.qd-contrib-pct {
  min-width: 32px;
  font-weight: 600;
  font-size: 11.5px;
}

.qd-rej-high { color: var(--red); font-weight: 700; }
.qd-rej-medium { color: var(--orange); font-weight: 700; }
.qd-rej-low { color: var(--green); font-weight: 700; }

.qd-days-open { color: var(--red); font-weight: 700; }

.qd-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}
.qd-badge.open             { background: #fdeaea; color: var(--red); }
.qd-badge.investigation    { background: #fff3e6; color: var(--orange); }
.qd-badge.under_review     { background: #fffbe6; color: var(--amber); }
.qd-badge.under_inspection { background: #fdeaea; color: var(--red); }
.qd-badge.sorting_running  { background: #fff3e6; color: var(--orange); }

.qd-chart-wrap {
  padding: 8px 14px 14px;
}
.qd-chart {
  width: 100%;
  height: 220px;
  display: block;
}
.qd-chart-label {
  font-size: 10px;
  fill: #8a93a8;
  font-family: "Poppins", sans-serif;
}
.qd-chart-value {
  font-size: 10px;
  fill: var(--navy);
  font-weight: 700;
  font-family: "Poppins", sans-serif;
}
.qd-chart-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.qd-chart-dot {
  fill: #fff;
  stroke: var(--blue);
  stroke-width: 2;
}

.kpi-trend {
  font-size: 10px;
  font-weight: 600;
  margin-top: 2px;
}
.kpi-trend.good { color: var(--green); }
.kpi-trend.bad  { color: var(--red); }
.kpi-status-label {
  font-size: 10px;
  font-weight: 600;
  margin-top: 2px;
}

@media (max-width: 1200px) {
  body.qd-page .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .qd-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  body.qd-page .kpi-row { grid-template-columns: 1fr; }
  .qd-header { flex-direction: column; gap: 14px; }
}
