/* Mine Shift Intelligence 3.1 — Executive Analytics & Intelligence UI Styles */
.msi31-host {
  margin-top: 20px;
}

.msi31-panel {
  margin-bottom: 24px;
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.6;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.2s ease;
}

.msi31-panel h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  flex-wrap: wrap;
  margin: 0 0 16px 0;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}

.msi31-panel h3 small {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 20px;
  margin-left: auto;
  border: 1px solid #e2e8f0;
}

/* User Guide / Explanation Banner */
.msi31-guide-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f0f7ff 0%, #e6f2ff 100%);
  border: 1px solid #bae0fd;
  border-radius: 10px;
  margin-bottom: 20px;
  color: #1e3a8a;
  font-size: 13px;
  line-height: 1.55;
}

.msi31-guide-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.msi31-guide-text {
  flex: 1;
  min-width: 0;
}

.msi31-guide-text b {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 3px;
}

.msi31-guide-text p {
  margin: 0;
  color: #334155;
}

/* KPI Summary Cards Grid */
.msi31-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.msi31-kpi-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.msi31-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: #3b82f6;
  border-radius: 4px 0 0 4px;
}

.msi31-kpi-card.tone-mint::before {
  background: #10b981;
}

.msi31-kpi-card.tone-amber::before {
  background: #f59e0b;
}

.msi31-kpi-card.tone-indigo::before {
  background: #6366f1;
}

.msi31-kpi-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.msi31-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.msi31-kpi-desc {
  font-size: 11.5px;
  color: #64748b;
}

/* Delta Badges for Comparison */
.msi31-delta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  margin-left: 6px;
}

.msi31-delta-badge.positive {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.msi31-delta-badge.negative {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.msi31-delta-badge.neutral {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* Control Toolbar & Inputs */
.msi31-controls {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin: 16px 0;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.msi31-controls label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.msi31-controls fieldset {
  display: flex;
  gap: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 8px;
  min-width: 0;
  padding: 10px 14px;
}

.msi31-controls legend {
  font-size: 11.5px;
  font-weight: 700;
  color: #1e40af;
  padding: 0 6px;
}

.msi31-controls .btn-primary {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #1d4ed8;
  font-weight: 600;
  padding: 0 18px;
}

.msi31-controls .btn-primary:hover {
  background: #1d4ed8;
}

/* Status & Graph Readouts */
[data-msi31-graph-status] {
  font-size: 12.5px;
  font-weight: 600;
  color: #2563eb;
  margin: 8px 0;
  min-height: 20px;
}

/* Network Diagram Visualization */
.msi31-network-container {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin: 18px 0;
}

.msi31-network-header {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.msi31-network {
  width: 100%;
  max-height: 580px;
  min-width: 0;
  font: 13.5px system-ui, -apple-system, sans-serif;
  color: #0f172a;
}

.msi31-network text {
  fill: #1e293b;
  font-weight: 600;
}

.msi31-network path {
  transition: stroke 0.2s, stroke-width 0.2s;
}

.msi31-network path:hover {
  stroke: #2563eb !important;
}

/* Details and Accordions */
.msi31-panel details {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 14px 0;
}

.msi31-panel details summary {
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  user-select: none;
}

.msi31-panel details[open] summary {
  margin-bottom: 12px;
}

/* Tables */
.msi31-panel .table-wrap {
  max-height: 550px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.msi31-panel table {
  width: 100%;
  border-collapse: collapse;
}

.msi31-panel th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 600;
  font-size: 12px !important;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.msi31-panel td {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12.5px !important;
  color: #1e293b;
}

.msi31-panel tr:hover td {
  background: #f8fafc;
}

/* Waterfalls in Comparison */
.msi31-compare-waterfalls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

.msi31-compare-waterfalls > section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
}

.msi31-compare-waterfalls h4 {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 10px 0;
}

/* Shift Handover Official Form Card */
.msi31-handover-document {
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 24px;
  margin-top: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.msi31-handover-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.msi31-handover-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.msi31-handover-meta {
  font-size: 12px;
  color: #475569;
}

/* Provenance Badge (Footer) */
.msi31-evidence {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 11px;
  overflow-wrap: anywhere;
  color: #64748b;
  margin-top: 14px;
}

/* Timeline & Heatmap Styles */
.msi31-unit {
  padding: 12px 0;
  border-bottom: 1px solid #e2e8f0;
}

.msi31-unit h4 {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0;
}

.msi31-unit h4 small {
  font-weight: 400;
  color: #64748b;
}

.msi31-timeline {
  height: 38px;
  position: relative;
  background: repeating-linear-gradient(135deg, #f1f5f9, #f1f5f9 6px, #e2e8f0 6px, #e2e8f0 7px);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  overflow: visible;
}

.msi31-segment {
  position: absolute;
  top: 3px;
  min-height: 30px;
  border: 1px solid white;
  border-radius: 4px;
  font-size: 10px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.85;
}

.status-W { background: #10b981; color: #ffffff; }
.status-S { background: #f59e0b; color: #ffffff; }
.status-D { background: #8b5cf6; color: #ffffff; }
.status-BU { background: #ef4444; color: #ffffff; }
.status-MS { background: #2563eb; color: #ffffff; }

.msi31-heat {
  background: color-mix(in srgb, #60a5fa calc(var(--heat) * 80%), white);
}

.msi31-heat.unknown {
  background: repeating-linear-gradient(135deg, #f8fafc, #f8fafc 5px, #cbd5e1 5px, #cbd5e1 6px);
}

.msi31-heat button {
  border: 0;
  background: transparent;
  color: #0f172a;
  min-height: 32px;
  min-width: 44px;
  cursor: pointer;
}

.msi31-pareto-bar {
  height: 8px;
  background: #3b82f6;
  border-radius: 4px;
  min-width: 2px;
}

.msi31-blocked {
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 14px;
  font-size: 12.5px;
}

/* Responsive Overrides */
@media (max-width: 768px) {
  .msi31-compare-waterfalls {
    grid-template-columns: 1fr;
  }
  .msi31-panel {
    padding: 16px;
  }
  .msi31-controls fieldset {
    flex-wrap: wrap;
    width: 100%;
  }
  .msi31-controls input {
    max-width: 100%;
  }
  .msi31-controls .btn {
    width: 100%;
  }
}

/* Print Optimization */
@media print {
  .msi31-controls,
  .msi31-pager,
  .msi31-panel button {
    display: none !important;
  }
  .msi31-panel {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .msi31-panel details {
    display: block !important;
  }
  .msi31-panel .table-wrap {
    max-height: none !important;
    overflow: visible !important;
  }
  .msi31-compare-waterfalls {
    display: block !important;
  }
}
