/* =============================================================================
   Portal del paciente — ONKOgenetik
   Público · dark clínico · sin dependencia del shell staff
   ============================================================================= */

:root {
  --pp-bg: #0a0e18;
  --pp-surface: #121826;
  --pp-surface-soft: #171f2e;
  --pp-border: #243044;
  --pp-text: #e8eef8;
  --pp-muted: #94a3b8;
  --pp-accent: #22d3ee;
  --pp-accent-soft: rgba(34, 211, 238, 0.12);
  --pp-success: #34d399;
  --pp-success-soft: rgba(52, 211, 153, 0.12);
  --pp-warning: #fbbf24;
  --pp-warning-soft: rgba(251, 191, 36, 0.12);
  --pp-danger: #f87171;
  --pp-danger-soft: rgba(248, 113, 113, 0.12);
  --pp-info: #60a5fa;
  --pp-info-soft: rgba(96, 165, 250, 0.12);
  --pp-radius: 16px;
  --pp-radius-sm: 10px;
  --pp-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --pp-max: 720px;
  --pp-max-wide: 880px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body.pp-shell {
  background: var(--pp-bg);
  color: var(--pp-text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--pp-accent); text-decoration: none; }
a:hover { text-decoration: underline; color: #67e8f9; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.pp-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 24, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--pp-border);
}

.pp-header-inner {
  max-width: var(--pp-max-wide);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pp-brand {
  display: block;
  line-height: 0;
}

.pp-brand-logo {
  display: block;
  height: 36px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

/* ── Main ───────────────────────────────────────────────────────────────── */
.pp-main {
  flex: 1;
  width: 100%;
  max-width: var(--pp-max-wide);
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.pp-page {
  max-width: var(--pp-max);
  margin: 0 auto;
}

.pp-page-wide {
  max-width: var(--pp-max-wide);
  margin: 0 auto;
}

/* ── Typography ─────────────────────────────────────────────────────────── */
.pp-title {
  margin: 0 0 8px;
  font-size: 1.65rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--pp-text);
}

.pp-subtitle {
  margin: 0 0 24px;
  font-size: 15px;
  color: var(--pp-muted);
  max-width: 520px;
  line-height: 1.5;
}

.pp-section-title {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 650;
}

.pp-section-meta {
  font-size: 13px;
  color: var(--pp-muted);
  margin-bottom: 14px;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.pp-card {
  background: var(--pp-surface);
  border: 1px solid var(--pp-border);
  border-radius: var(--pp-radius);
  padding: 22px 24px;
  box-shadow: var(--pp-shadow);
  margin-bottom: 16px;
}

.pp-card-highlight {
  border-color: rgba(34, 211, 238, 0.35);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.08) 0%, var(--pp-surface) 60%);
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.pp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--pp-radius-sm);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none !important;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.pp-btn:active { transform: scale(0.98); }

.pp-btn-primary {
  background: linear-gradient(135deg, #0891b2, #22d3ee);
  color: #042f2e;
  border-color: rgba(34, 211, 238, 0.5);
}

.pp-btn-primary:hover {
  filter: brightness(1.08);
  color: #042f2e;
  text-decoration: none;
}

.pp-btn-secondary {
  background: var(--pp-surface-soft);
  color: var(--pp-text);
  border-color: var(--pp-border);
}

.pp-btn-secondary:hover {
  background: #1c2638;
  color: var(--pp-text);
  text-decoration: none;
}

.pp-btn-ghost {
  background: transparent;
  color: var(--pp-muted);
  border-color: var(--pp-border);
}

.pp-btn-ghost:hover {
  background: var(--pp-accent-soft);
  color: var(--pp-accent);
  border-color: rgba(34, 211, 238, 0.3);
  text-decoration: none;
}

.pp-btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.pp-btn-lg {
  padding: 14px 22px;
  font-size: 15px;
  width: 100%;
  max-width: 280px;
}

/* ── Forms (lookup) ─────────────────────────────────────────────────────── */
.pp-lookup-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
  margin: 0 0 16px;
}

.pp-input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 14px 16px;
  border-radius: var(--pp-radius-sm);
  border: 1px solid var(--pp-border);
  background: var(--pp-surface-soft);
  color: var(--pp-text);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pp-input::placeholder {
  color: var(--pp-muted);
  opacity: 0.7;
  letter-spacing: 0.06em;
  font-weight: 500;
  text-transform: none;
}

.pp-input:focus {
  outline: none;
  border-color: var(--pp-accent);
  box-shadow: 0 0 0 3px var(--pp-accent-soft);
}

.pp-help {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--pp-muted);
  line-height: 1.6;
}

.pp-help li {
  padding-left: 16px;
  position: relative;
  margin-bottom: 6px;
}

.pp-help li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--pp-accent);
  font-weight: 700;
}

.pp-help code {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--pp-surface-soft);
  border: 1px solid var(--pp-border);
  color: var(--pp-accent);
}

.pp-privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 10px 14px;
  border-radius: var(--pp-radius-sm);
  background: var(--pp-surface-soft);
  border: 1px solid var(--pp-border);
  font-size: 13px;
  color: var(--pp-muted);
}

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.pp-alert {
  border-radius: var(--pp-radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.pp-alert-error {
  background: var(--pp-danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.pp-alert-info {
  background: var(--pp-info-soft);
  border: 1px solid rgba(96, 165, 250, 0.35);
  color: #bfdbfe;
}

/* ── Status hero ────────────────────────────────────────────────────────── */
.pp-status-hero {
  margin-bottom: 20px;
}

.pp-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.pp-status-badge-done {
  background: var(--pp-success-soft);
  color: var(--pp-success);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.pp-status-badge-progress {
  background: var(--pp-info-soft);
  color: var(--pp-info);
  border: 1px solid rgba(96, 165, 250, 0.35);
}

.pp-status-badge-delay {
  background: var(--pp-warning-soft);
  color: var(--pp-warning);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.pp-status-badge-pending {
  background: rgba(148, 163, 184, 0.12);
  color: var(--pp-muted);
  border: 1px solid var(--pp-border);
}

.pp-progress-block {
  margin-top: 8px;
}

.pp-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--pp-muted);
}

.pp-progress-label strong {
  font-size: 1.5rem;
  font-weight: 750;
  color: var(--pp-accent);
  font-variant-numeric: tabular-nums;
}

.pp-progress-bar {
  height: 10px;
  background: var(--pp-surface-soft);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--pp-border);
}

.pp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0891b2, #22d3ee);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.pp-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--pp-border);
}

.pp-meta-item {
  font-size: 12px;
  color: var(--pp-muted);
}

.pp-meta-item strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  color: var(--pp-text);
  font-weight: 650;
}

/* ── Results card ───────────────────────────────────────────────────────── */
.pp-results-card {
  text-align: center;
  padding: 28px 24px;
}

.pp-results-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  background: var(--pp-success-soft);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.pp-results-title {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 700;
}

.pp-results-desc {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--pp-muted);
}

.pp-results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.pp-report-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pp-report-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--pp-radius-sm);
  background: var(--pp-surface-soft);
  border: 1px solid var(--pp-border);
}

.pp-report-name {
  font-weight: 650;
  font-size: 14px;
  text-align: left;
}

.pp-report-date {
  font-size: 12px;
  color: var(--pp-muted);
  margin-top: 2px;
}

.pp-empty-results {
  text-align: center;
  padding: 24px;
}

.pp-empty-results-icon {
  font-size: 32px;
  opacity: 0.5;
  margin-bottom: 10px;
}

/* ── Timeline ─────────────────────────────────────────────────────────────── */
.pp-timeline-wrap {
  max-height: min(58vh, 520px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

.pp-timeline {
  list-style: none;
  margin: 0;
  padding: 4px 0 4px 8px;
}

.pp-timeline-item {
  position: relative;
  padding: 0 0 24px 28px;
}

.pp-timeline-item:last-child {
  padding-bottom: 8px;
}

.pp-timeline-item::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 14px;
  bottom: 0;
  width: 2px;
  background: var(--pp-border);
}

.pp-timeline-item:last-child::before {
  display: none;
}

.pp-timeline-dot {
  position: absolute;
  left: 0;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--pp-border);
  background: var(--pp-surface-soft);
  z-index: 1;
}

.pp-timeline-item.is-done .pp-timeline-dot {
  border-color: var(--pp-success);
  background: var(--pp-success-soft);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15);
}

.pp-timeline-item.is-progress .pp-timeline-dot {
  border-color: var(--pp-info);
  background: var(--pp-info-soft);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
  animation: pp-pulse 2s ease infinite;
}

.pp-timeline-item.is-failed .pp-timeline-dot {
  border-color: var(--pp-warning);
  background: var(--pp-warning-soft);
}

.pp-timeline-item.is-pending .pp-timeline-dot {
  opacity: 0.6;
}

@keyframes pp-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(96, 165, 250, 0.08); }
}

.pp-timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.pp-timeline-name {
  font-weight: 650;
  font-size: 14px;
  color: var(--pp-text);
}

.pp-timeline-step-num {
  color: var(--pp-muted);
  font-weight: 600;
  margin-right: 4px;
}

.pp-step-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.pp-step-badge-done { background: var(--pp-success-soft); color: var(--pp-success); }
.pp-step-badge-progress { background: var(--pp-info-soft); color: var(--pp-info); }
.pp-step-badge-failed { background: var(--pp-warning-soft); color: var(--pp-warning); }
.pp-step-badge-pending { background: rgba(148, 163, 184, 0.15); color: var(--pp-muted); }

.pp-timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--pp-muted);
}

.pp-timeline-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--pp-radius-sm);
  background: var(--pp-warning-soft);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #fde68a;
  font-size: 13px;
  line-height: 1.45;
}

.pp-timeline-empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--pp-muted);
  font-size: 14px;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.pp-footer {
  margin-top: auto;
  padding: 24px 20px 28px;
  background: linear-gradient(180deg, #121820 0%, #0a0e14 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.pp-footer-trust {
  margin: 0 auto 20px;
  max-width: 480px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.5;
}

.pp-trust-icon {
  margin-right: 4px;
}

.pp-footer-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 36px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.pp-footer-logo-aegis {
  height: 46px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}

.pp-footer-logo-mxaib {
  height: 34px;
  width: auto;
  max-width: min(300px, 75vw);
  object-fit: contain;
  opacity: 0.95;
}

.pp-footer-tag {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .pp-main { padding: 20px 16px 32px; }
  .pp-title { font-size: 1.4rem; }
  .pp-lookup-form { flex-direction: column; }
  .pp-lookup-form .pp-btn { width: 100%; }
  .pp-header-inner { padding: 12px 16px; }
  .pp-brand-logo { height: 30px; }
  .pp-results-actions { flex-direction: column; }
  .pp-results-actions .pp-btn { width: 100%; max-width: none; }
}

@media print {
  .pp-header, .pp-footer { display: none; }
  body.pp-shell { background: #fff; color: #000; }
}
