.report-layout {
  display: flex;
  flex-direction: column;
  gap: 30px;
  width: 100%;
}

.report-filter-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  width: 100%;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 16px 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.filter-segment-group, .filter-select-group, .filter-date-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-segment-title, .filter-select-title, .filter-date-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.custom-date-input {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  outline: none;
  font-size: 0.85rem;
  font-family: inherit;
  width: 160px;
  height: 38px;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-date-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(0, 210, 255, 0.2);
}

.segment-control {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 4px;
  display: flex;
  gap: 2px;
}

.segment-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  user-select: none;
  white-space: nowrap;
}

.segment-btn:hover {
  color: var(--text-primary);
}

.segment-btn.active {
  background-color: var(--accent-blue);
  color: var(--bg-primary);
}

.custom-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 200px;
}

.custom-select-wrapper select {
  width: 100%;
  padding: 10px 35px 10px 16px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: all 0.3s;
}

.custom-select-wrapper select:hover {
  border-color: rgba(0, 210, 255, 0.3);
}

.custom-select-wrapper select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.15);
}

.custom-select-wrapper::after {
  content: "";
  position: absolute;
  right: 14px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-secondary);
  pointer-events: none;
}

/* KPI Row */
.report-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  width: 100%;
}

.r-kpi-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.r-kpi-content {
  display: flex;
  flex-direction: column;
}

.r-kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.r-kpi-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 8px 0;
  display: flex;
  align-items: baseline;
}

.r-kpi-value .unit {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-left: 4px;
}

.r-kpi-subtext {
  font-size: 0.8rem;
  font-weight: 700;
}

.r-kpi-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-color: rgba(0, 210, 255, 0.05);
  border: 1px solid rgba(0, 210, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.r-kpi-svg-icon {
  width: 22px;
  height: 22px;
  color: var(--accent-blue);
}

/* Progress bar uptime */
.r-kpi-progress-wrapper {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.r-kpi-progress-bar {
  width: 100%;
  height: 6px;
  background-color: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.r-kpi-progress-fill {
  height: 100%;
  background-color: var(--status-running);
  box-shadow: 0 0 8px rgba(0, 230, 118, 0.4);
  border-radius: 3px;
  transition: width 0.5s ease-out;
}

.r-kpi-progress-desc {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Downtime columns split */
.r-kpi-downtime-split {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 10px;
}

.downtime-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.col-lbl {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.col-val {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.downtime-divider {
  width: 1px;
  height: 28px;
  background-color: var(--border-color);
}

/* Charts Grid Row */
.report-charts-row {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 30px;
  width: 100%;
}

.r-chart-panel {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
}

.r-chart-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.r-chart-panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.r-chart-legend {
  display: flex;
  gap: 16px;
}

.r-chart-legend .legend-dot.prod { background-color: var(--status-running); }
.r-chart-legend .legend-dot.err { background-color: rgba(255, 61, 0, 0.4); }

.r-chart-canvas-wrapper {
  flex-grow: 1;
  width: 100%;
  height: 240px;
  position: relative;
}

.r-distribution-panel {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
}

.r-pie-chart-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  flex-grow: 1;
  justify-content: center;
  margin-top: 15px;
}

.r-pie-canvas-container {
  position: relative;
  width: 180px;
  height: 180px;
}

.r-pie-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.total-errors-val {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.total-errors-lbl {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
}

.r-pie-legend {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.r-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
}

.r-legend-lbl-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.r-legend-square {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.r-legend-val {
  font-weight: 700;
  color: var(--text-secondary);
}

/* Operations Table */
.report-table-panel {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.r-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.r-table-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.r-history-link {
  font-size: 0.85rem;
  color: var(--accent-blue);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s;
}

.r-history-link:hover {
  color: white;
  text-shadow: 0 0 8px rgba(0, 210, 255, 0.3);
}

.r-table-container {
  width: 100%;
  overflow-x: auto;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.report-table th {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
}

.report-table td {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}

.report-table tbody tr {
  transition: background-color 0.2s;
}

.report-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.015);
}

.badge-info {
  background-color: rgba(0, 210, 255, 0.08);
  color: var(--accent-blue);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-block;
}

@media (max-width: 1200px) {
  .report-kpi-row {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .report-charts-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .report-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  
  .report-filter-bar .export-btn {
    margin-left: 0;
  }
}

/* Alarms View Styling (Task 5.9) */