/* ============================================================
   CalibLab ISO 17025 – Componentes y páginas específicas
   ============================================================ */

/* ── Dashboard ─────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  margin-top: 8px;
}

.chart-card { padding: 24px; }
.chart-card canvas { max-height: 260px; width: 100% !important; }

.expiry-list { display: flex; flex-direction: column; }
.expiry-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.expiry-item:last-child { border-bottom: none; }
.expiry-item-info { flex: 1; min-width: 0; }
.expiry-item-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expiry-item-meta { font-size: 12px; color: var(--text-muted); }
.expiry-days { font-size: 12px; font-weight: 700; white-space: nowrap; }

/* ── Toolbar / Filtros ─────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.search-wrap svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  stroke: var(--text-muted);
  fill: none;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.filter-select {
  padding: 9px 32px 9px 12px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  background: var(--surface);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  transition: border-color var(--transition);
}
.filter-select:focus { border-color: var(--primary-light); outline: none; }

/* ── Instruments Table ─────────────────────────────────────── */
.inst-status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.dot-valid    { background: var(--success); }
.dot-expiring { background: var(--warning); }
.dot-expired  { background: var(--danger); }
.dot-unknown  { background: var(--text-light); }

/* ── Accuracy Table ────────────────────────────────────────── */
.acc-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.accuracy-table .cell-ok   { color: var(--success); font-weight: 600; }
.accuracy-table .cell-warn { color: var(--warning); font-weight: 600; }
.accuracy-table .cell-bad  { color: var(--danger);  font-weight: 700; }
.accuracy-table .cell-neutral { color: var(--text-muted); }

.acc-summary {
  display: flex;
  gap: 20px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.acc-summary-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  flex: 1;
  min-width: 140px;
}

.acc-summary-item .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; }
.acc-summary-item .value { font-size: 20px; font-weight: 800; margin-top: 2px; }

.acc-row-remove {
  width: 28px; height: 28px;
  border: none;
  background: var(--danger-light);
  color: var(--danger);
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: background var(--transition);
}
.acc-row-remove:hover { background: var(--danger); color: #fff; }

/* ── Repeatability ─────────────────────────────────────────── */
.rep-config {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.rep-load-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface);
  margin-bottom: 16px;
}

.rep-load-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.rep-load-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.rep-readings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.rep-reading-item label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.rep-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.rep-stat {
  text-align: center;
  padding: 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.rep-stat .stat-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.rep-stat .stat-value { font-size: 18px; font-weight: 800; color: var(--primary); margin-top: 2px; }
.rep-formula { font-size: 12px; color: var(--text-muted); font-style: italic; margin-top: 8px; text-align: center; }

/* ── Excentricidad ─────────────────────────────────────────── */
.eccentric-layout {
  display: flex;
  gap: 32px;
  align-items: center;
  flex-wrap: wrap;
}

.eccentric-svg-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.eccentric-inputs { flex: 1; min-width: 260px; }

.eccentric-result {
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--primary-lighter);
  border-radius: var(--radius);
  border: 1px solid var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eccentric-result .err-label { font-size: 14px; font-weight: 600; color: var(--primary-dark); }
.eccentric-result .err-value { font-size: 24px; font-weight: 800; color: var(--primary); }

/* ── Evaluation Result ─────────────────────────────────────── */
.eval-card {
  border-radius: var(--radius-xl);
  padding: 32px;
  text-align: center;
  border: 2px solid;
}
.eval-card.accepted { background: var(--success-light); border-color: var(--success); }
.eval-card.limited  { background: var(--warning-light); border-color: var(--warning); }
.eval-card.rejected { background: var(--danger-light);  border-color: var(--danger); }

.eval-icon { font-size: 48px; margin-bottom: 12px; }
.eval-result-label {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.eval-card.accepted .eval-result-label { color: var(--success-dark); }
.eval-card.limited  .eval-result-label { color: var(--warning-dark); }
.eval-card.rejected .eval-result-label { color: var(--danger-dark); }
.eval-desc { font-size: 14px; color: var(--text-muted); }

.result-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.result-test-card {
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.result-test-card .rtc-title { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.5px; }
.result-test-card .rtc-value { font-size: 15px; font-weight: 700; color: var(--text); }

/* ── Calibration Detail ────────────────────────────────────── */
.cal-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.cal-detail-field .field-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 3px; }
.cal-detail-field .field-value { font-size: 15px; font-weight: 600; color: var(--text); }

/* ── Calibration History ───────────────────────────────────── */
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.history-item:last-child { border-bottom: none; }
.history-folio { font-size: 13px; font-weight: 700; color: var(--primary); }
.history-date  { font-size: 13px; color: var(--text-muted); }

/* ── Standards page ────────────────────────────────────────── */
.std-uncertainty { font-family: 'Courier New', monospace; font-size: 13px; }

/* ── Mobile overlay for sidebar ────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}
.sidebar-overlay.show { display: block; }

/* ── Info-pair display ─────────────────────────────────────── */
.info-pair { margin-bottom: 6px; }
.info-pair .ip-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.info-pair .ip-value { font-size: 14px; color: var(--text); font-weight: 500; }

/* ── Number badge count ────────────────────────────────────── */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px; height: 20px;
  padding: 0 6px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-lighter);
  color: var(--primary);
  margin-left: 6px;
}

/* ── Confirm dialog overlay ────────────────────────────────── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.confirm-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.confirm-box h3 { font-size: 17px; margin-bottom: 10px; }
.confirm-box p  { font-size: 14px; color: var(--text-muted); margin-bottom: 22px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Print / PDF hidden content ───────────────────────────── */
@media print {
  .sidebar, .page-header .page-actions, #menu-toggle { display: none !important; }
  .main-content { margin-left: 0 !important; }
}

/* ── Responsive dashboard grid ─────────────────────────────── */
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* ── Responsive rep stats ──────────────────────────────────── */
@media (max-width: 480px) {
  .rep-stats { grid-template-columns: 1fr 1fr; }
  .eccentric-layout { flex-direction: column; }
  .eccentric-svg-wrap svg { width: 220px; height: 220px; }
}
