/* =========================================================
   Planned vs Actual & Delay Impact Section Styles
   ========================================================= */

.kpi-sub-row {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.stat-box-highlight {
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
}

.stat-box-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.delay-impact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.delay-card {
  background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.delay-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.delay-period-header {
  font-size: 15px;
  font-weight: 700;
  color: var(--amber);
}

.delay-metrics {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.delay-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.delay-metric-row:last-child {
  border-bottom: none;
}

.delay-label {
  color: var(--muted);
}

.delay-value {
  font-weight: 700;
  color: #ffffff;
}

/* Read-only (share links): no logging, exporting or printing someone else's records */
body.is-read-only #exportCsvBtn,
body.is-read-only #printPdfBtn {
  display: none !important;
}

/* Pill Tab Switcher Controls */
.pill-tab-container {
  display: flex;
  background: #0f172a;
  border: 1px solid var(--line-light);
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.pill-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-height: 36px;
}

.pill-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.pill-tab.active {
  background: var(--blue);
  color: #ffffff;
  border: 1px solid var(--blue-hover);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.breakdown-list {
  display: flex; 
  flex-direction: column; 
  gap: 10px; 
  margin-top: 4px; 
  max-height: 280px; 
  overflow-y: auto; 
  padding-right: 4px;
}

.breakdown-info {
  display: flex; 
  justify-content: space-between; 
  font-size: 11px; 
  font-weight: 600; 
  color: #fff; 
  margin-bottom: 4px;
}

.breakdown-bar-bg {
  background: #0f172a; 
  border-radius: 4px; 
  height: 8px; 
  overflow: hidden; 
  width: 100%; 
  border: 1px solid var(--line);
}

.breakdown-bar-fill {
  height: 100%; 
  border-radius: 4px; 
  transition: width 0.3s ease;
}

/* Standby Outcome Status Badges */
.badge-status.flown {
  background: var(--green-light);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status.released {
  background: var(--amber-light);
  color: #facc15;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-status.scrubbed {
  background: var(--danger-light);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.log-container {
  max-height: 420px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 6px;
}

@media (max-width: 600px) {
  .kpi-sub-row, .delay-impact-grid { grid-template-columns: 1fr; }
  /* Dates and badges stay on one line; the table scrolls sideways instead */
  .log-container td:first-child, .log-container td:nth-child(2) { white-space: nowrap; }
  /* Both tab labels fit by wrapping onto two lines instead of being cut off */
  .pill-tab { padding: 8px 10px; font-size: 13px; white-space: normal; text-align: center; line-height: 1.25; }
  /* Log forms: one field per row, full-width button */
  #logForm-cancel > div > .field,
  #logForm-standby > div > .field { flex: 1 1 100% !important; }
  #logForm-cancel button, #logForm-standby button { width: 100%; }
  .delay-metric-row { gap: 12px; }
  .delay-value { text-align: right; }
}