/* ==========================================================================
   ESTILOS DE APLICACIÓN: PROPERTY LOSS SERVICE INC. - FORENSIC ESTIMATOR
   Standard: Cost Database (2026 Edition) - Puerto Rico Jurisdiction
   ========================================================================== */

:root {
  --primary-navy: #0f172a;
  --primary-blue: #1e3a8a;
  --accent-blue: #2563eb;
  --accent-cyan: #0284c7;
  --surface-bg: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--surface-bg);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   HEADER CORPORATIVO
   ========================================================================== */
.app-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 1rem 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: #2563eb;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
}

.brand-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0;
}

.brand-title .brand-sub {
  font-size: 0.78rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge-pr {
  background: rgba(37, 99, 235, 0.2);
  border: 1px solid #3b82f6;
  color: #93c5fd;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ==========================================================================
   BOTONES Y CONTROLES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--accent-blue);
  color: white;
}
.btn-primary:hover {
  background-color: #1d4ed8;
}

.btn-success {
  background-color: var(--success);
  color: white;
}
.btn-success:hover {
  background-color: #15803d;
}

.btn-secondary {
  background-color: #334155;
  color: #f1f5f9;
  border-color: #475569;
}
.btn-secondary:hover {
  background-color: #475569;
}

.btn-outline {
  background-color: transparent;
  color: #ffffff;
  border-color: rgba(255,255,255,0.25);
}
.btn-outline:hover {
  background-color: rgba(255,255,255,0.1);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}
.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

/* ==========================================================================
   NAVEGACIÓN POR PESTAÑAS
   ========================================================================== */
.tabs-navigation {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 73px;
  z-index: 90;
}

.tabs-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  gap: 0.5rem;
  padding: 0 1.5rem;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.9rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--accent-blue);
}

.tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  background-color: #eff6ff;
}

.tab-badge {
  background-color: #e2e8f0;
  color: #475569;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-weight: 700;
}

.tab-btn.active .tab-badge {
  background-color: var(--accent-blue);
  color: #ffffff;
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.main-wrapper {
  max-width: 1440px;
  margin: 1.5rem auto 4rem auto;
  padding: 0 1.5rem;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ==========================================================================
   CARDS Y PANELES
   ========================================================================== */
.card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

/* ==========================================================================
   FORMULARIOS Y CAMPOS
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-control {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: var(--text-main);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Selector de Peril / Siniestro */
.peril-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.peril-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: #ffffff;
  text-align: center;
}

.peril-card:hover {
  border-color: #93c5fd;
  background-color: #f8fafc;
}

.peril-card.active {
  border-color: var(--accent-blue);
  background-color: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.peril-icon {
  font-size: 1.8rem;
}

.peril-name {
  font-weight: 700;
  font-size: 0.9rem;
}

/* ==========================================================================
   GESTIÓN DE ÁREAS E INSPECCIÓN
   ========================================================================== */
.area-block {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.area-block-header {
  background-color: #f1f5f9;
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.area-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.area-badge {
  background-color: var(--primary-navy);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
}

.area-body {
  padding: 1.25rem;
}

.area-notes-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 768px) {
  .area-notes-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   TABLA DE ESTIMADOS DE COSTOS
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin-top: 0.5rem;
}

.estimate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.estimate-table th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 0.65rem 0.6rem;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.estimate-table td {
  padding: 0.65rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.estimate-table tr:hover td {
  background-color: #f8fafc;
}

.col-qty {
  width: 85px;
}
.col-qty input {
  width: 100%;
  padding: 0.35rem 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.col-code {
  font-family: monospace;
  font-size: 0.78rem;
  color: #475569;
  background: #f1f5f9;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  white-space: nowrap;
}

.col-actions {
  width: 40px;
  text-align: center;
}

.btn-del-item {
  color: #94a3b8;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  transition: color 0.15s;
}
.btn-del-item:hover {
  color: var(--danger);
}

.area-subtotals-bar {
  background-color: #f8fafc;
  border-top: 2px solid #cbd5e1;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 1.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  flex-wrap: wrap;
}

.subtotal-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.subtotal-pill span {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
}

/* ==========================================================================
   GALERÍA FOTOGRÁFICA FORENSE
   ========================================================================== */
.photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.photo-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
}

.photo-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-bottom: 1px solid var(--border-color);
}

.photo-card-body {
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-grow: 1;
}

.photo-tag {
  display: inline-block;
  background-color: #eff6ff;
  color: var(--accent-blue);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  width: fit-content;
}

.photo-caption-input {
  width: 100%;
  font-size: 0.78rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  resize: none;
}

.btn-del-photo {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}
.btn-del-photo:hover {
  background: var(--danger);
}

/* ==========================================================================
   RESUMEN FINANCIERO & O&P
   ========================================================================== */
.financial-summary-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  border-radius: var(--radius-md);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.summary-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-item {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 1rem;
  border-radius: var(--radius-sm);
}

.stat-label {
  font-size: 0.75rem;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.stat-value.grand-total {
  color: #38bdf8;
  font-size: 1.9rem;
}

/* ==========================================================================
   MODAL / DRAWER CATÁLOGO DE COSTOS
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex !important;
}

.modal-container {
  background-color: #ffffff;
  width: 100%;
  max-width: 960px;
  max-height: 88vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  background-color: var(--primary-navy);
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-close-modal {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}
.btn-close-modal:hover {
  color: white;
}

.modal-search-bar {
  padding: 1rem 1.5rem;
  background-color: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.modal-body {
  padding: 1rem 1.5rem;
  overflow-y: auto;
  flex-grow: 1;
}

.cost-item-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cost-item-card:hover {
  border-color: #93c5fd;
  background-color: #f8fafc;
}

.item-info {
  flex-grow: 1;
}

.item-badge-wrap {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.badge-code {
  font-size: 0.7rem;
  font-family: monospace;
  font-weight: 700;
  background-color: #e0e7ff;
  color: #3730a3;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.badge-cat {
  font-size: 0.7rem;
  background-color: #e2e8f0;
  color: #475569;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.item-desc {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.item-cost-breakdown {
  display: flex;
  gap: 1rem;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.item-cost-breakdown b {
  color: var(--text-main);
}

/* ==========================================================================
   VISTA DEL REPORTE FORMAL FORENSE (PRINT & PDF READY)
   ========================================================================== */
.report-paper {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 3rem;
  max-width: 1080px;
  margin: 0 auto;
  color: #0f172a;
}

.report-header-box {
  border-bottom: 3px solid #0f172a;
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.report-logo-text h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #0f172a;
  text-transform: uppercase;
}

.report-logo-text p {
  font-size: 0.82rem;
  color: #475569;
  font-weight: 600;
}

.report-claim-badge {
  text-align: right;
}
.report-claim-badge .claim-tag {
  background-color: #0f172a;
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.3rem;
}

.report-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 2rem;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.85rem;
}

.report-meta-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed #e2e8f0;
  padding-bottom: 0.25rem;
}
.report-meta-row span.label {
  color: #64748b;
  font-weight: 600;
}
.report-meta-row span.val {
  font-weight: 700;
  color: #0f172a;
}

.report-section-title {
  font-size: 1.05rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 0.35rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: #0f172a;
}

.report-narrative {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #1e293b;
  text-align: justify;
  margin-bottom: 1.5rem;
}

.report-area-header {
  background-color: #0f172a;
  color: white;
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 4px 4px 0 0;
  margin-top: 1.5rem;
}

.report-signature-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid #cbd5e1;
}

.sig-box {
  text-align: center;
}
.sig-line {
  border-top: 1px solid #0f172a;
  margin: 2.5rem 2rem 0.5rem 2rem;
}
.sig-name {
  font-weight: 800;
  font-size: 0.9rem;
}
.sig-title {
  font-size: 0.78rem;
  color: #475569;
}

/* ==========================================================================
   FLUJO DE TRABAJO INTELIGENTE POR ESTANCIA (SMART ROOM WORKFLOW)
   ========================================================================== */
.room-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.room-preset-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.75rem;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
}

.room-preset-card:hover {
  border-color: var(--accent-blue);
  background: #eff6ff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.room-preset-card.active {
  border-color: var(--accent-blue);
  background: #dbeafe;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.room-preset-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.room-preset-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.room-preset-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.area-metrics-strip {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.area-metric-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.area-metric-item b {
  color: #0369a1;
  font-weight: 800;
}

.context-systems-bar {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.other-systems-panel {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-top: 0.75rem;
  display: none;
}

.other-systems-panel.open {
  display: block;
}

.other-systems-group {
  margin-bottom: 0.75rem;
}

.other-systems-group:last-child {
  margin-bottom: 0;
}

.other-systems-group-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
}

/* ==========================================================================
   REGLAS DE IMPRESIÓN OFICIALES (@media print)
   ========================================================================== */
@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .tabs-navigation,
  .no-print,
  .modal-overlay,
  .header-actions {
    display: none !important;
  }

  .main-wrapper {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .tab-content {
    display: none !important;
  }

  #tab-report {
    display: block !important;
  }

  .report-paper {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  .estimate-table th {
    background-color: #f1f5f9 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .report-area-header {
    background-color: #0f172a !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .area-block,
  .report-area-card {
    page-break-inside: avoid;
  }

  .report-signature-section {
    page-break-inside: avoid;
  }
}

/* ==========================================================================
   SELECTOR DE MODO PRINCIPAL (MODO MANUAL CLÁSICO VS COPILOTO IA)
   ========================================================================== */
.app-mode-switch-wrapper {
  display: inline-flex;
  background: #0f172a;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid #334155;
}

.app-mode-btn {
  background: transparent;
  color: #94a3b8;
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.app-mode-btn:hover {
  color: #ffffff;
}

.app-mode-btn.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   VISTA DEL ASISTENTE IA & COPILOTO DE VOZ
   ========================================================================== */
.ai-copilot-wrapper {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.25rem;
  height: calc(100vh - 160px);
  min-height: 550px;
}

@media (max-width: 960px) {
  .ai-copilot-wrapper {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.ai-chat-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.ai-chat-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #334155;
}

.ai-chat-messages {
  flex-grow: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #f8fafc;
}

.ai-chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ai-chat-bubble.user {
  align-self: flex-end;
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.ai-chat-bubble.assistant {
  align-self: flex-start;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 2px;
}

.ai-chat-bubble.system {
  align-self: center;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 0.8rem;
  text-align: center;
}

.ai-bubble-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.85;
}

.ai-quick-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #cbd5e1;
}

.ai-pill-btn {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-pill-btn:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.ai-chat-input-bar {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-mic-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #2563eb;
  color: #ffffff;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-mic-btn:hover {
  background: #1d4ed8;
  transform: scale(1.05);
}

.ai-mic-btn.listening {
  background: #dc2626;
  animation: ai-pulse 1.5s infinite;
}

@keyframes ai-pulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.ai-attach-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-attach-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  transform: scale(1.05);
}

.ai-attachment-preview-tray {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 6px 12px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  align-items: center;
}

.ai-attachment-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 3px 8px 3px 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #334155;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  max-width: 180px;
  flex-shrink: 0;
}

.ai-attach-thumb {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  object-fit: cover;
}

.ai-attach-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.ai-attach-remove {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-weight: bold;
}

.ai-attach-remove:hover {
  color: #b91c1c;
}

.ai-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 0.78rem;
  color: #64748b;
  font-style: italic;
}

.ai-typing-dots {
  display: inline-flex;
  gap: 3px;
}

.ai-typing-dots span {
  width: 4px;
  height: 4px;
  background: #64748b;
  border-radius: 50%;
  animation: typing-blink 1.2s infinite ease-in-out;
}

.ai-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-blink {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* Panel de Vista Previa en Vivo del Expediente para el Copiloto */
.ai-live-preview-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Opciones Rápidas e Interactivas del Copiloto IA (Suggestion Pills) */
.ai-quick-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.ai-pill-btn {
  background: #f1f5f9;
  color: #0f172a;
  border: 1.5px solid #cbd5e1;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ai-pill-btn:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
}

.ai-pill-btn:active {
  transform: translateY(0);
}

/* ==========================================================================
   ESTILOS DE AUDITORÍA QA/QC Y DESTACADO DE CAMPOS
   ========================================================================== */
@keyframes pulse-highlight {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    border-color: #ef4444;
  }
  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    border-color: #ef4444;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.highlight-pulse {
  animation: pulse-highlight 1.2s ease-in-out 3 !important;
  border: 2px solid #ef4444 !important;
  background-color: #fef2f2 !important;
}

/* ==========================================================================
   VISTAS DEL FLUJO DE 3 PASOS (LOGIN, DASHBOARD, WORKSPACE)
   ========================================================================== */
.step-view {
  width: 100%;
}

.case-filter-btn {
  background-color: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-weight: 600;
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.case-filter-btn:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

.case-filter-btn.active {
  background-color: #2563eb !important;
  color: #ffffff !important;
  border-color: #1d4ed8 !important;
  font-weight: 700;
}

@media print {
  #viewStep1Login,
  #viewStep2Dashboard,
  #btnBackToDashboard,
  #existingCasesModal,
  #userManagementModal {
    display: none !important;
  }
  #viewStep3Workspace {
    display: block !important;
  }
}

