/* ============================================================
   Intranet - estilos especificos
   ============================================================ */

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--c-ink-50);
}
@media (min-width: 1024px) {
  .auth-page { grid-template-columns: 1fr 1fr; }
}
.auth-side {
  display: none;
  background: linear-gradient(135deg, var(--c-primary-700), var(--c-primary-900));
  color: white;
  padding: 64px;
  position: relative;
  overflow: hidden;
}
.auth-side::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 80% 20%, rgba(255, 255, 255, 0.10), transparent 50%);
}
.auth-side > * { position: relative; }
.auth-side h2 { color: white; font-size: 2.4rem; margin-bottom: 16px; }
.auth-side p { color: rgba(255, 255, 255, 0.8); max-width: 40ch; }
@media (min-width: 1024px) { .auth-side { display: flex; flex-direction: column; justify-content: space-between; } }

.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  min-height: 100vh;
}
.auth-form { width: 100%; max-width: 420px; }
.auth-form .brand { margin-bottom: 24px; }
.auth-form h1 { font-size: 1.8rem; margin-bottom: 6px; }
.auth-form .subtitle { color: var(--c-ink-500); margin-bottom: 24px; }

/* === Selector médico / institución === */
.login-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  border: 1px solid var(--c-ink-200);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.login-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--c-ink-500);
  background: var(--c-ink-50);
  border: none;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.login-tab:hover { background: var(--c-ink-100); color: var(--c-ink-800); }
.login-tab.active {
  background: var(--c-primary-600);
  color: white;
}

/* === Dashboard layout === */
.dash {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--c-ink-50);
}
@media (min-width: 1024px) {
  .dash { grid-template-columns: 260px 1fr; }
}
.dash-side {
  background: white;
  border-right: 1px solid var(--c-ink-200);
  padding: 24px 16px;
  display: none;
}
@media (min-width: 1024px) { .dash-side { display: block; } }
.dash-side .brand { margin-bottom: 32px; padding: 0 12px; }
.dash-side ul { list-style: none; padding: 0; margin: 0; }
.dash-side a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--c-ink-700);
  font-size: .92rem; font-weight: 500;
  margin-bottom: 2px;
}
.dash-side a:hover { background: var(--c-ink-50); color: var(--c-primary-700); }
.dash-side a.active { background: var(--c-primary-50); color: var(--c-primary-700); }
.dash-side .section-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--c-ink-400); padding: 16px 12px 6px; font-weight: 600;
}

.dash-main { padding: 24px; }
@media (min-width: 768px) { .dash-main { padding: 32px 40px; } }

.dash-topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--c-ink-200);
}
.dash-user {
  display: flex; align-items: center; gap: 10px;
  font-size: .9rem;
}
.avatar {
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--c-primary-400), var(--c-primary-700));
  color: white;
  display: grid; place-items: center;
  font-size: .9rem; font-weight: 600;
}

/* === Stats === */
.stats {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
  margin-bottom: 32px;
}
@media (min-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: white;
  border: 1px solid var(--c-ink-200);
  border-radius: var(--r-lg);
  padding: 20px;
}
.stat .label { font-size: .82rem; color: var(--c-ink-500); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.stat .value { font-family: var(--font-serif); font-size: 2rem; font-weight: 500; color: var(--c-ink-900); line-height: 1.1; }
.stat .delta { font-size: .82rem; color: var(--c-success); margin-top: 4px; }

/* === Filters bar === */
.filters {
  background: white;
  border: 1px solid var(--c-ink-200);
  border-radius: var(--r-lg);
  padding: 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  margin-bottom: 24px;
}
@media (min-width: 768px) {
  .filters { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; }
}

/* === Table === */
.table-wrap {
  background: white;
  border: 1px solid var(--c-ink-200);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-ink-100);
  white-space: nowrap;
}
table.data th {
  background: var(--c-ink-50);
  font-weight: 600;
  color: var(--c-ink-700);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
table.data tbody tr:hover { background: var(--c-ink-50); }
table.data tbody tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: .78rem;
  font-weight: 500;
  background: var(--c-ink-100);
  color: var(--c-ink-700);
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-info { background: var(--c-primary-50); color: var(--c-primary-700); }

/* === Pagination === */
.pagination {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 16px;
  border-top: 1px solid var(--c-ink-100);
  background: var(--c-ink-50);
}
.pagination a, .pagination span {
  display: inline-grid; place-items: center;
  min-width: 36px; height: 36px;
  padding: 0 10px;
  border-radius: var(--r-md);
  font-size: .88rem;
  color: var(--c-ink-700);
  background: white;
  border: 1px solid var(--c-ink-200);
}
.pagination a:hover { background: var(--c-primary-50); color: var(--c-primary-700); border-color: var(--c-primary-300); }
.pagination .current { background: var(--c-primary-600); color: white; border-color: var(--c-primary-600); }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* === Report viewer === */
.report-viewer {
  background: white;
  border: 1px solid var(--c-ink-200);
  border-radius: var(--r-lg);
  padding: 32px;
  max-width: 880px;
  margin: 0 auto;
  overflow-x: hidden;
}
.report-viewer .meta {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--c-ink-200);
  margin-bottom: 32px;
}
@media (min-width: 640px) { .report-viewer .meta { grid-template-columns: repeat(2, 1fr); } }
.report-viewer .meta .field .label { font-size: .78rem; color: var(--c-ink-500); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 2px; }
.report-viewer .meta .field .value { font-weight: 500; color: var(--c-ink-900); }
.report-viewer .body { font-family: var(--font-serif); font-size: 1.05rem; line-height: 1.7; color: var(--c-ink-900); overflow-wrap: break-word; word-break: break-word; }
.report-viewer .body p { margin-bottom: 1em; }

.report-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 24px;
}

/* Membrete: oculto en pantalla, visible solo al imprimir */
.print-header { display: none; }

/* === Firma (imagen combinada, alineada a la derecha) === */
.report-signature {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
}
.sig-img {
  max-width: 320px;
  width: 100%;
  height: auto;
  display: block;
}

/* Pie institucional: solo visible al imprimir */
.report-footer-txt { display: none; }

@media print {
  .dash-side, .dash-topbar, .filters, .pagination, .report-actions, .no-print { display: none !important; }
  .dash { grid-template-columns: 1fr; }
  .dash-main { padding: 0; }
  .report-viewer { border: none; padding: 0; max-width: none; box-shadow: none; }
  .print-header { display: block !important; }

  @page {
    margin: 8mm 12mm 10mm 12mm;
    size: A4;
  }

  body { font-size: 9.5pt; color: #000; }
  .report-viewer h1 { font-size: 11pt; margin-bottom: 4px; }
  .report-viewer .meta {
    grid-template-columns: repeat(3, 1fr);
    font-size: 8pt;
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 10px;
  }
  .report-viewer .body {
    font-size: 9pt;
    line-height: 1.45;
    margin-top: 8px;
    overflow-wrap: break-word;
    word-break: break-word;
  }
  .report-signature {
    margin-top: 12px;
    padding-top: 0;
  }
  .sig-img { max-width: 260px; }

  .report-footer-txt {
    display: block;
    text-align: center;
    font-size: 7.5pt;
    color: #666;
    border-top: 1px solid #ccc;
    margin-top: 10px;
    padding-top: 6px;
  }
}

/* === Empty state === */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--c-ink-500);
}
.empty .icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  background: var(--c-ink-100);
  border-radius: var(--r-full);
  display: grid; place-items: center;
  color: var(--c-ink-400);
}

/* ── Setup credentials / form validation ── */
.field-error { font-size: .8rem; color: var(--c-danger, #dc2626); margin-top: 4px; }
.form-control.is-invalid { border-color: var(--c-danger, #dc2626); }
