/* ==========================================================================
   Design System Oficial Freiría Lorenzo · App Gestor de Curriculum Vitae
   Tema Dark Slate / Engineering Blue & Plantilla Técnica A4
   ========================================================================== */

:root {
  /* Fondos y Paneles */
  --bg: #0f172a;           /* Slate 900 */
  --panel: #1e293b;        /* Slate 800 */
  --panel-hover: #273548;  /* Resalte hover */
  --panel-active: #1e3a5f; /* Fila o item activo */
  --border: #334155;       /* Slate 700 */

  /* Colores de Acento Corporativo */
  --accent: #2563eb;       /* Blue 600 */
  --accent-hover: #1d4ed8; /* Blue 700 */
  --accent-light: #38bdf8; /* Sky 400 */
  --accent-bg: #1e3a5f;    /* Fondo acento suave */

  /* Jerarquía Tipográfica */
  --text: #e2e8f0;         /* Slate 200 */
  --text-dim: #94a3b8;     /* Slate 400 */
  --text-muted: #64748b;   /* Slate 500 */
  --white: #ffffff;

  /* Estados Semánticos */
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  height: 100vh;
  overflow: hidden;
  font-size: 13px;
}

/* ==================== HEADER FIJO ==================== */
.header {
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.logo img,
.header-logo {
  max-width: 28px;
  max-height: 28px;
  object-fit: contain;
}

.header-title h1 {
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title h1 span {
  font-size: 12px;
  font-weight: 400;
  color: var(--accent-light);
  border-left: 1px solid var(--border);
  padding-left: 10px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==================== BOTONES ESTÁNDAR ==================== */
.btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--panel-hover);
  border-color: var(--text-muted);
}

.btn-success {
  background: var(--success);
  color: var(--white);
}
.btn-success:hover {
  background: #16a34a;
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
  color: var(--text-dim);
}
.btn-icon:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

/* ==================== LAYOUT DE 3 COLUMNAS ==================== */
.app-layout {
  display: flex;
  height: calc(100vh - 56px);
  width: 100vw;
  overflow: hidden;
}

/* ==================== COLUMNA 1: PERFIL & FILTROS (360px) ==================== */
.col-profile {
  width: 360px;
  min-width: 340px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 16px;
}

.profile-card {
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 12px;
}

.avatar-wrap {
  width: 96px;
  height: 96px;
  margin: 0 auto 10px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 12%; /* Bajar la foto para encuadrar la cabeza y rostro con espacio superior */
}

.profile-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 2px;
}

.profile-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-light);
  margin-bottom: 4px;
}

.profile-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
  text-align: left;
  background: var(--panel);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.meta-item a {
  color: var(--text);
  text-decoration: none;
}
.meta-item a:hover {
  color: var(--accent-light);
  text-decoration: underline;
}

.badges-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.cert-seal {
  height: 42px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
  background: #ffffff;
  padding: 2px;
}

/* Segmented Scope Tabs (Recibida / Impartida / Visados) */
.scope-tabs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px;
}

.scope-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: inherit;
  width: 100%;
}

.scope-btn:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.scope-btn.active {
  background: var(--accent);
  color: var(--white);
  font-weight: 600;
}

.scope-btn-left {
  display: flex;
  align-items: center;
  gap: 7px;
}

.scope-badge {
  font-size: 10px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--accent-light);
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.scope-btn.active .scope-badge {
  background: rgba(255, 255, 255, 0.25);
  color: var(--white);
}

/* Métricas en vivo */
.stats-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.stat-cell.highlight {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.08);
}

.stat-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
}

.stat-cell.highlight .stat-num {
  color: var(--accent-light);
}

.stat-lbl {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Lista de Temáticas */
.filter-section {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.filter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.count-badge {
  background: var(--accent-bg);
  color: var(--accent-light);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
}

.thematic-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.thematic-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.12s ease;
  border: 1px solid transparent;
}

.thematic-item:hover {
  background: var(--panel-hover);
}

.thematic-item.active {
  background: var(--accent-bg);
  color: var(--white);
  border-color: var(--accent);
  font-weight: 600;
}

.thematic-name {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thematic-badge {
  font-size: 10px;
  color: var(--accent-light);
  background: rgba(0, 0, 0, 0.25);
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 500;
}

.thematic-item.active .thematic-badge {
  background: var(--accent);
  color: var(--white);
}

/* Datos Adicionales */
.profile-extra-box {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.extra-toggle {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 4px 0;
}
.extra-toggle:hover {
  color: var(--accent-light);
}

.extra-content {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
  line-height: 1.5;
}

/* ==================== COLUMNA 2: TABLA DE REGISTROS ==================== */
.col-table {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  min-width: 480px;
}

/* Toolbar superior */
.table-toolbar {
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 460px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-dim);
}

.search-input {
  width: 100%;
  padding: 7px 30px 7px 30px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  font-family: inherit;
}
.search-input:focus {
  border-color: var(--accent);
}

.clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.checkbox-label input {
  cursor: pointer;
  accent-color: var(--accent);
}

.selection-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.selection-tag {
  font-size: 11px;
  color: var(--accent-light);
  background: var(--accent-bg);
  padding: 3px 8px;
  border-radius: 4px;
}

/* Header de categoría activa con selector desplegable */
.active-category-header {
  padding: 8px 16px;
  background: rgba(30, 41, 59, 0.7);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.category-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}

.header-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.header-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg);
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 30px 6px 11px;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  max-width: 320px;
}

.header-select.scope-select {
  border-color: rgba(59, 130, 246, 0.4);
  background-color: rgba(15, 23, 42, 0.9);
}

.header-select:hover:not(:disabled) {
  border-color: var(--accent);
  background-color: var(--panel-hover);
}

.header-select:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.header-select:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background-color: rgba(15, 23, 42, 0.4);
  border-color: rgba(51, 65, 85, 0.5);
  color: var(--text-dim);
}

.header-select option {
  background: var(--panel);
  color: var(--text);
  font-weight: 500;
  padding: 8px 10px;
}

.header-select-arrow {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 700;
  user-select: none;
  opacity: 0.6;
}

.category-meta {
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

.hours-chip {
  font-size: 12px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid var(--accent);
  padding: 3px 12px;
  border-radius: 20px;
  color: var(--accent-light);
  white-space: nowrap;
}
.hours-chip strong {
  color: var(--white);
}

/* Contenedor de la tabla */
.table-container {
  flex: 1;
  overflow-y: auto;
}

.cv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.cv-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.cv-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.6);
  vertical-align: middle;
}

.cv-table tr {
  cursor: pointer;
  transition: background 0.1s ease;
}

.cv-table tr:hover {
  background: var(--panel-hover);
}

.cv-table tr.selected-row {
  background: var(--panel-active) !important;
  border-left: 3px solid var(--accent);
}

/* Fila de cabecera de sección / temática pegajosa */
.section-divider-row td {
  background: #172033 !important;
  border-top: 2px solid var(--accent) !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 8px 12px !important;
  position: sticky;
  top: 31px;
  z-index: 6;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  cursor: default;
}

.section-divider-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-divider-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-icon {
  font-size: 14px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.section-stats {
  font-size: 11px;
  color: var(--accent-light);
  background: var(--accent-bg);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.row-check {
  cursor: pointer;
  accent-color: var(--accent);
}

.date-cell {
  color: var(--text-dim);
  font-size: 11px;
  white-space: nowrap;
}

.title-cell {
  font-weight: 500;
  color: var(--text);
}
.title-cell .course-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  display: block;
  margin-top: 1px;
}

.entity-cell {
  color: var(--text-dim);
  font-size: 11px;
}

.hours-cell {
  text-align: right;
  white-space: nowrap;
}

.hours-badge {
  display: inline-block;
  background: rgba(37, 99, 235, 0.15);
  color: var(--accent-light);
  font-weight: 600;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
}

.thematic-pill {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #334155;
  color: #cbd5e1;
  white-space: nowrap;
}

/* Indicadores de diploma */
.diploma-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  font-size: 12px;
  text-decoration: none;
}
.diploma-indicator.has-pdf {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.4);
}
.diploma-indicator.has-drive {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-light);
  border: 1px solid rgba(56, 189, 248, 0.4);
}
.diploma-indicator.no-doc {
  background: transparent;
  color: var(--text-muted);
}

/* Footer de la tabla */
.table-footer {
  height: 44px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.footer-left strong {
  color: var(--text);
}
.divider {
  color: var(--border);
}

.total-hours-banner {
  background: var(--bg);
  border: 1px solid var(--accent);
  padding: 5px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.total-hours-banner span {
  font-size: 10px;
  letter-spacing: 0.5px;
  font-weight: 600;
  color: var(--accent-light);
}
.total-hours-banner strong {
  font-size: 14px;
  color: var(--white);
}

/* ==================== COLUMNA 3: VISOR DE DIPLOMAS ==================== */
.col-viewer {
  width: 400px;
  min-width: 340px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-header {
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel);
}

.viewer-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.viewer-header-icon {
  font-size: 15px;
  line-height: 1;
}

.viewer-header-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.2px;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.viewer-body {
  flex: 1;
  position: relative;
  background: #0b1120;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-placeholder {
  text-align: center;
  padding: 30px;
  max-width: 320px;
}
.placeholder-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.7;
}
.viewer-placeholder h4 {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 6px;
}
.viewer-placeholder p {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

.pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.drive-notice {
  text-align: center;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-width: 340px;
}
.notice-icon {
  font-size: 32px;
  margin-bottom: 8px;
}
.drive-notice h4 {
  font-size: 13px;
  color: var(--white);
  margin-bottom: 6px;
}
.drive-notice p {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.viewer-footer-info {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
}
.detail-label {
  color: var(--text-dim);
}
.detail-val {
  color: var(--text);
  font-weight: 500;
  text-align: right;
}

/* ==================== MODALES ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.modal-card.modal-lg {
  max-width: 950px;
  height: 92vh;
}

.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
}

.modal-header-actions {
  display: flex;
  gap: 8px;
}

.modal-toolbar {
  padding: 10px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 16px;
}

.form-group-inline {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.form-group-inline label {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}
.form-group-inline input {
  flex: 1;
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 11px;
  outline: none;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--panel);
}

/* Formularios en modal */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 20px;
  overflow-y: auto;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-group.form-full {
  grid-column: 1 / -1;
}
.form-group label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}
.form-group input, .form-group select {
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--accent);
}

/* Dropzone */
.upload-dropzone {
  margin: 20px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.upload-dropzone:hover {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.05);
}
.dropzone-icon {
  font-size: 36px;
  margin-bottom: 8px;
}
.upload-dropzone h4 {
  font-size: 13px;
  color: var(--white);
  margin-bottom: 4px;
}
.upload-dropzone p {
  font-size: 11px;
  color: var(--text-dim);
}
.file-name-chosen {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  color: var(--accent-light);
  font-weight: 600;
}

/* ==========================================================================
   PLANTILLA DE IMPRESIÓN OFICIAL TÉCNICA (A4)
   Conforme a Plantilla_Design_System_y_UI_Apps.md (Logo Negro y Cajetín)
   ========================================================================== */
.print-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #475569;
}

.report-preview {
  background: #ffffff;
  color: #1a1a1a;
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 32px;
  font-family: 'Arial Narrow', Arial, -apple-system, sans-serif;
  font-size: 10.5px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #1e3a5f;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.report-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.report-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.doc-main-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e3a5f;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.doc-subtitle {
  font-size: 9.5px;
  color: #64748b;
  margin-top: 2px;
}

.report-header-right {
  text-align: right;
}

.doc-badge-pill {
  font-size: 8.5px;
  font-weight: 700;
  color: #1e3a5f;
  background: #e8f0fe;
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-block;
  margin-bottom: 3px;
}

.doc-date-str {
  font-size: 9px;
  color: #64748b;
}

/* Cajetín Oficial */
.cajetin-table, .doc-table, .firmas-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
  font-size: 10px;
}

.cajetin-table td {
  border: 1px solid #94a3b8;
  padding: 4px 6px;
}

.cajetin-label {
  background: #f1f5f9;
  font-weight: 700;
  color: #1e3a5f;
}

/* Barra resumen de horas en informe */
.report-summary-bar {
  display: flex;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 6px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
  justify-content: space-between;
}

.summary-col {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sum-lbl {
  font-size: 9.5px;
  color: #64748b;
  font-weight: 600;
}
.sum-val {
  font-size: 12px;
  font-weight: 700;
  color: #1e3a5f;
}
.sum-highlight {
  color: #2563eb;
  font-size: 13px;
}

.report-sec-title {
  font-size: 11px;
  color: #1e3a5f;
  border-bottom: 1px solid #2563eb;
  padding-bottom: 2px;
  margin: 10px 0 6px;
  text-transform: uppercase;
  font-weight: 700;
}

/* Tabla del informe */
.doc-table th {
  background: #e8f0fe;
  color: #1e3a5f;
  border: 1px solid #94a3b8;
  padding: 4px 6px;
  text-align: left;
  font-weight: 700;
  font-size: 9.5px;
}

.doc-table td {
  border: 1px solid #cbd5e1;
  padding: 3.5px 6px;
  font-size: 9.5px;
}

.doc-table tr:nth-child(even) td {
  background: #f8fafc;
}

/* Firmas */
.firmas-table td {
  border: 1px solid #94a3b8;
  padding: 8px;
}

.footer-report {
  display: flex;
  justify-content: space-between;
  font-size: 8.5px;
  color: #64748b;
  border-top: 1px solid #cbd5e1;
  padding-top: 5px;
  margin-top: 14px;
}

/* ==================== PESTAÑAS MULTI-DOCUMENTO EN VISOR ==================== */
.doc-tabs-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: #0f172a;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.doc-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.doc-tab:hover {
  background: var(--panel-hover);
  color: var(--white);
}

.doc-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
  font-weight: 600;
}

.doc-tab-del {
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 1px 3px;
  border-radius: 2px;
}
.doc-tab-del:hover {
  color: var(--white);
  background: rgba(239, 68, 68, 0.8);
}

.doc-tab-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: transparent;
  border: 1px dashed var(--accent-light);
  border-radius: 5px;
  font-size: 11px;
  color: var(--accent-light);
  cursor: pointer;
  white-space: nowrap;
}
.doc-tab-add:hover {
  background: rgba(37, 99, 235, 0.15);
}

/* ==================== MÓDULO TRABAJOS VISADOS ==================== */
.visados-section {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.badge-visado-type {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.type-deo { background: rgba(37, 99, 235, 0.15); color: var(--accent-light); border: 1px solid rgba(37, 99, 235, 0.4); }
.type-sys { background: rgba(245, 158, 11, 0.15); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.4); }
.type-proy { background: rgba(34, 197, 94, 0.15); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.4); }
.type-peritaje { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.4); }
.type-ite { background: rgba(236, 72, 153, 0.15); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.4); }
.type-cert { background: rgba(14, 165, 233, 0.15); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.4); }
.type-catastro { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; border: 1px solid rgba(20, 184, 166, 0.4); }
.type-other { background: rgba(148, 163, 184, 0.15); color: var(--text-dim); border: 1px solid var(--border); }

.pem-badge {
  font-weight: 600;
  color: var(--accent-light);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bulk-textarea {
  width: 100%;
  height: 180px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 10px;
  font-family: monospace;
  font-size: 11px;
  resize: vertical;
  line-height: 1.4;
  outline: none;
}
.bulk-textarea:focus {
  border-color: var(--accent);
}

.bulk-help-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}
.bulk-help-box code {
  color: var(--accent-light);
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ==================== REGLAS @MEDIA PRINT ==================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 12mm 15mm 12mm;
  }

  body {
    background: #ffffff !important;
    color: #1a1a1a !important;
    height: auto !important;
    overflow: visible !important;
  }

  .header, .app-layout, .modal-header, .modal-toolbar, .modal-footer {
    display: none !important;
  }

  .modal-overlay {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
    backdrop-filter: none !important;
    display: block !important;
  }

  .modal-card {
    border: none !important;
    box-shadow: none !important;
    max-width: 100% !important;
    height: auto !important;
  }

  .print-container {
    background: transparent !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .report-preview {
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    font-size: 9.5px !important;
  }

  .doc-table tr {
    page-break-inside: avoid;
  }

  .firmas-table {
    page-break-inside: avoid;
  }
}

/* ==================== PORTADA DE ACCESO / BLOQUEO PIN (1234) ==================== */
.auth-gate-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 30%, #1e293b 0%, #0f172a 70%, #080d1a 100%);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-gate-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 380px;
  max-width: 92vw;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 20px rgba(37, 99, 235, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: authScaleIn 0.25s ease-out;
}

@keyframes authScaleIn {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.auth-header {
  padding: 24px 20px 14px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.auth-logo {
  height: 44px;
  width: auto;
  margin-bottom: 10px;
  object-fit: contain;
}

.auth-header h2 {
  font-size: 18px;
  color: var(--white);
  font-weight: 700;
}

.auth-header h2 span {
  color: var(--accent-light);
  font-size: 14px;
  font-weight: 400;
}

.auth-subtitle {
  font-size: 12px;
  color: var(--text);
  margin-top: 2px;
}

.auth-course-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-light);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.auth-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-lock-icon {
  font-size: 24px;
  margin-bottom: 6px;
}

.auth-notice {
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 16px;
}

.pin-input-wrap {
  display: flex;
  position: relative;
  width: 100%;
  margin-bottom: 8px;
}

.pin-input {
  width: 100%;
  padding: 10px 42px 10px 14px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 6px;
  color: var(--accent-light);
  outline: none;
  transition: all 0.2s;
}

.pin-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.35);
}

.btn-toggle-pin {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}
.btn-toggle-pin:hover { color: var(--text); }

.auth-error-msg {
  color: var(--danger);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.auth-remember-row {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 14px;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 260px;
  margin: 0 auto 6px auto;
}

.keypad-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
  cursor: pointer;
  transition: all 0.1s ease;
  user-select: none;
}

.keypad-btn:hover {
  background: var(--panel-hover);
  border-color: var(--accent);
}

.keypad-btn:active {
  transform: scale(0.96);
  background: var(--accent);
}

.keypad-btn-clear {
  color: var(--danger);
}

.keypad-btn-enter {
  color: var(--success);
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
}
.keypad-btn-enter:hover {
  background: var(--success);
  color: #fff;
}

.auth-footer {
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}
