/* ══════════════════════════════════════════════════════════════════════
   RATIOS / HPPD & PPD — Page-specific styles
   Layered on top of the global CareMetrics design system in styles.css
   ══════════════════════════════════════════════════════════════════════ */

/* ----- Ratio meter (small bar at the bottom of KPI cards) ----- */
.ratio-meter {
  position: relative;
  height: 4px;
  background: var(--slate-100);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px;
}
.ratio-meter > span {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent-500);
  border-radius: 2px;
}
.ratio-meter-ok > span     { background: #22c55e; }
.ratio-meter-warn > span   { background: #f59e0b; }
.ratio-meter-danger > span { background: #ef4444; }

/* ----- Two-column row used twice on the page ----- */
.ratios-row {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: var(--space-5, 20px);
  margin-bottom: var(--space-5, 20px);
}
@media (max-width: 1100px) {
  .ratios-row { grid-template-columns: 1fr; }
}

/* ----- Trend chart panel ----- */
.ratios-chart-canvas {
  position: relative;
  height: 320px;
  margin-top: var(--space-3, 12px);
}
.ratios-chart-canvas-sm { height: 220px; }

.ratios-foot {
  display: flex;
  gap: 24px;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--slate-200);
  flex-wrap: wrap;
}
.ratios-foot-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rfs-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary, #64748b);
  font-weight: 600;
}
.rfs-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  font-variant-numeric: tabular-nums;
}
.val-good { color: #15803d; }
.val-bad  { color: #b91c1c; }

/* ----- Legend ----- */
.legend-row {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary, #475569);
  font-weight: 500;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}
.legend-dot-dashed {
  width: 14px;
  height: 0;
  border-radius: 0;
  border-top: 2px dashed #94a3b8;
}

/* ----- Compliance / alerts panel ----- */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--slate-100);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 8px;
}
.alert-row {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: white;
}
.alert-row:hover { background: var(--slate-50); }
.alert-indicator {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #94a3b8;
  align-self: center;
  margin-top: 2px;
}
.alert-danger .alert-indicator { background: #ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,0.15); }
.alert-warn   .alert-indicator { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,0.15); }
.alert-info   .alert-indicator { background: #0ea5e9; box-shadow: 0 0 0 4px rgba(14,165,233,0.15); }
.alert-body { min-width: 0; }
.alert-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  margin-bottom: 2px;
}
.alert-meta {
  font-size: 12px;
  color: var(--text-secondary, #475569);
}

/* ----- Per-Unit table ----- */
.unit-table {
  display: flex;
  flex-direction: column;
}
.unit-table-head, .unit-row {
  display: grid;
  grid-template-columns: 2.4fr 0.6fr 0.6fr 1.6fr 0.9fr 1fr 1.1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 4px;
}
.unit-table-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary, #64748b);
  font-weight: 600;
  border-bottom: 1px solid var(--slate-200);
}
.unit-row {
  border-bottom: 1px solid var(--slate-100);
  transition: background 0.12s;
}
.unit-row:hover { background: var(--slate-50); }
.unit-row:last-child { border-bottom: none; }

.unit-name {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.unit-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.unit-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary, #0f172a);
}
.unit-sub {
  font-size: 11px;
  color: var(--text-tertiary, #64748b);
  margin-top: 2px;
}

.unit-num {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #0f172a);
}

.hppd-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hppd-val {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.hppd-target {
  font-size: 11px;
  color: var(--text-tertiary, #64748b);
  margin-left: 4px;
  font-weight: 500;
}

.trend-mini {
  position: relative;
  height: 28px;
  width: 100%;
}
.trend-mini canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ----- Shift cards ----- */
.shift-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 8px;
}
.shift-card {
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 14px;
  background: var(--slate-50);
}
.shift-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.shift-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary, #0f172a);
}
.shift-sub {
  font-size: 11px;
  color: var(--text-tertiary, #64748b);
  margin-top: 2px;
}
.shift-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin: 4px 0;
  color: var(--text-secondary, #475569);
}
.shift-row strong {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #0f172a);
}

@media (max-width: 760px) {
  .shift-grid { grid-template-columns: 1fr; }
  .unit-table-head, .unit-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
