/* ==========================================================================
   SISTEMA DE DISEÑO - PALETA INSTITUCIONAL TRYP
   Colores corporativos hoteleros + prioridades con máximo contraste
   ========================================================================== */
:root {
  /* TRYP Corporativos */
  --primary: #005CA9;
  --primary-hover: #00427A;
  --primary-light: #eff6ff;
  --primary-rgb: 0, 92, 169;
  --accent-gold: #00A3E0;

  /* Grises Profesionales */
  --accent-slate: #1f2937;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #005CA9;

  /* Estados Mejorados */
  --status-open: #005CA9;
  --status-process: #ea580c;
  --status-waiting: #eab308;
  --status-resolved: #15803d;
  --status-closed: #64748b;

  /* Prioridades con Máximo Contraste */
  --priority-critica: #dc2626;
  --priority-critica-bg: rgba(220, 38, 38, 0.08);
  --priority-critica-border: rgba(220, 38, 38, 0.3);

  --priority-alta: #ea580c;
  --priority-alta-bg: rgba(234, 88, 12, 0.08);
  --priority-alta-border: rgba(234, 88, 12, 0.3);

  --priority-media: #d97706;
  --priority-media-bg: rgba(217, 119, 6, 0.08);
  --priority-media-border: rgba(217, 119, 6, 0.3);

  --priority-baja: #15803d;
  --priority-baja-bg: rgba(21, 128, 61, 0.08);
  --priority-baja-border: rgba(21, 128, 61, 0.3);

  --priority-pending: #64748b;
  --priority-pending-bg: rgba(100, 116, 139, 0.08);
  --priority-pending-border: rgba(100, 116, 139, 0.3);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --transition: all 0.2s ease-in-out;
}

/* RESET & BASE */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* PANTALLA DE CARGA INSTANTÁNEA PARA ENLACES A TICKETS */
html.loading-deep-ticket #view-create-ticket {
  display: none !important;
}

#view-loading-ticket {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  width: 100%;
}

html.loading-deep-ticket #view-loading-ticket,
#view-loading-ticket.is-active {
  display: flex !important;
}

.loading-ticket-card {
  max-width: 440px;
  width: 90%;
  margin: 40px auto;
  background: var(--bg-card);
  padding: 40px 28px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  text-align: center;
}

.loading-ticket-spinner {
  display: inline-block;
  width: 46px;
  height: 46px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 20px;
}

.loading-ticket-title {
  color: var(--primary);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.loading-ticket-text {
  color: var(--text-muted);
  font-size: 0.95rem;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   HEADER / BARRA SUPERIOR - TEMA CORPORATIVO TRYP
   ========================================================================== */
.top-nav {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  border-bottom: 3px solid var(--accent-gold);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.15);
}

.nav-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-square {
  background-color: rgba(255, 255, 255, 0.95);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0 12px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  letter-spacing: 1.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #ffffff;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.brand-subtitle {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.8);
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  padding-left: 1.25rem;
}

.breadcrumb a {
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.breadcrumb a:hover {
  color: var(--accent-gold);
  text-decoration: underline;
}

.bc-sep {
  color: var(--text-light);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-box {
  display: flex;
  align-items: center;
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.75rem;
  width: 250px;
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-box input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
}

.search-box button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding-left: 0.35rem;
}

.search-box button:hover {
  color: var(--primary);
}

.btn-secondary-nav {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary-nav:hover {
  background-color: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.6);
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.main-layout {
  max-width: 1320px;
  margin: 2rem auto;
  padding: 0 1.5rem 3rem;
}

.content-wrapper {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2.5rem;
  align-items: start;
}

#view-ticket-detail,
#view-technician-panel,
#view-dashboard {
  display: block;
}

/* ==========================================================================
   COLUMNA DE FORMULARIO
   ========================================================================== */
.form-column {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-sm);
}

.section-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.25rem;
}

.section-header h1 {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.sub-heading {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 1.8rem 0 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border-color);
}

/* FORM GROUPS Y GRID */
.form-group {
  margin-bottom: 1.35rem;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 0.45rem;
}

.required {
  color: #ef4444;
  font-weight: 700;
}

.tooltip-icon {
  display: inline-block;
  cursor: help;
  color: var(--primary);
  font-size: 0.88rem;
  margin-left: 0.25rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.95rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
  outline: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon input {
  padding-right: 2.2rem;
}

.input-icon {
  position: absolute;
  right: 0.75rem;
  color: var(--text-light);
  pointer-events: none;
  font-size: 0.9rem;
}

.form-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.input-error {
  border-color: #ef4444 !important;
  background-color: #fef2f2 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
}

.form-alert-error {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: var(--radius-md);
  padding: 0.9rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 1.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.1);
  animation: shakeAlert 0.3s ease-in-out;
}

@keyframes shakeAlert {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ==========================================================================
   EDITOR DE TEXTO ENRIQUECIDO (WYSIWYG)
   ========================================================================== */
.editor-container {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
  transition: var(--transition);
}

.editor-container:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  background-color: #f8fafc;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border-color);
}

.toolbar-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.toolbar-btn:hover {
  background-color: #e2e8f0;
  color: var(--primary);
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-color);
  margin: 0 0.25rem;
}

.editor-content {
  min-height: 170px;
  padding: 0.95rem;
  outline: none;
  font-size: 0.92rem;
  line-height: 1.6;
}

.editor-content[placeholder]:empty:before {
  content: attr(placeholder);
  color: var(--text-light);
}

/* ==========================================================================
   ZONA DE ADJUNTOS
   ========================================================================== */
.file-input-hidden {
  display: none;
}

.attachment-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  background-color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

.attachment-zone.dragover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.btn-attach {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: var(--transition);
}

.btn-attach:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.file-limit {
  color: var(--text-light);
  font-size: 0.78rem;
}

.drag-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.attached-files-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.file-chip {
  background-color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.file-chip-remove {
  cursor: pointer;
  font-weight: bold;
  color: #ef4444;
}

/* BOTONES DE ACCIÓN */
.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  padding: 0.75rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(var(--primary-rgb), 0.2);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(var(--primary-rgb), 0.3);
}

.btn-primary:disabled {
  background-color: var(--text-light);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   BARRA LATERAL / SIDEBAR
   ========================================================================== */
.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.sidebar-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.sidebar-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.article-list {
  list-style: none;
}

.article-list li {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.article-list li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.article-list a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
  display: block;
  transition: var(--transition);
}

.article-list a:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}

.info-box {
  background-color: #f8fafc;
  border-left: 4px solid var(--primary);
}

.info-box h4 {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.info-box p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.rule-box {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  margin: 0.75rem 0;
}

.rule-box strong {
  font-size: 0.8rem;
  color: var(--primary);
  display: block;
  margin-bottom: 0.2rem;
}

.rule-box p {
  font-size: 0.8rem;
  margin-bottom: 0;
}

.alert-no-reply {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b !important;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem !important;
}

/* ==========================================================================
   VISTA 2: SEGUIMIENTO DE TICKET (EXPEDIENTE)
   ========================================================================== */
.detail-container {
  max-width: 960px;
  margin: 0 auto;
}

.detail-header-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.75rem;
}

.detail-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1.5rem;
}

.ticket-id-tag {
  display: inline-block;
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
}

.detail-top-row h2 {
  font-size: 1.5rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.detail-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.detail-badges {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

.badge-status {
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-priority {
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1.5px solid;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-refresh-live {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary-color, #005CA9);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-refresh-live:hover {
  background: var(--primary-light, #eff6ff);
  border-color: var(--primary-color, #005CA9);
  transform: translateY(-1px);
}

.btn-refresh-live:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.detail-grid-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.88rem;
}

.thread-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.thread-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.message-item {
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.message-item.tech-msg {
  background-color: #f0f7ff;
  border-left: 4px solid var(--primary);
}

.message-item.user-msg {
  background-color: #ffffff;
  border-left: 4px solid #64748b;
}

.message-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.65rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.message-author {
  font-weight: 700;
  color: var(--text-main);
}

.message-role {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  margin-left: 0.4rem;
  font-weight: 600;
}

.role-tech {
  background-color: var(--primary);
  color: #ffffff;
}

.role-user {
  background-color: #e2e8f0;
  color: var(--text-main);
}

.message-body {
  font-size: 0.92rem;
  line-height: 1.6;
}

.reply-box {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.reply-box h4 {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.reply-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

/* ==========================================================================
   VISTA 3: PANEL DE GESTIÓN TÉCNICA (SISTEMAS)
   ========================================================================== */
.tech-panel-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-sm);
}

.tech-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.tech-header h2 {
  font-size: 1.6rem;
  color: var(--text-main);
}

.tech-header p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  user-select: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
  position: relative;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  border-color: #94a3b8;
}

.stat-card:active {
  transform: translateY(0);
}

.stat-card.stat-card-active {
  box-shadow: 0 4px 14px rgba(0, 92, 169, 0.16);
  transform: translateY(-2px);
}

.stat-card.border-blue { border-left: 4px solid var(--status-open); }
.stat-card.border-orange { border-left: 4px solid var(--status-process); }
.stat-card.border-green { border-left: 4px solid var(--status-resolved); }

.stat-card.border-blue.stat-card-active {
  background-color: #f0f7ff;
  border-color: var(--status-open);
  border-left-width: 6px;
}

.stat-card.border-orange.stat-card-active {
  background-color: #fffaf0;
  border-color: var(--status-process);
  border-left-width: 6px;
}

.stat-card.border-green.stat-card-active {
  background-color: #f0fdf4;
  border-color: var(--status-resolved);
  border-left-width: 6px;
}

.stat-card#card-stat-total.stat-card-active {
  background-color: #f8fafc;
  border-color: var(--primary);
  border-left: 6px solid var(--primary);
}

.stat-number {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filter-bar input {
  flex: 2;
}

.filter-bar select {
  flex: 1;
}

/* Pestañas de Tickets */
.tickets-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color);
  overflow-x: auto;
}

.tab-button {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-size: 0.95rem;
}

.tab-button:hover {
  color: var(--primary-color);
  background-color: var(--hover-bg);
}

.tab-button.tab-active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background-color: rgba(0, 92, 169, 0.05);
}

.table-responsive {
  overflow-x: auto;
}

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

.tickets-table th {
  background-color: #f8fafc;
  padding: 0.85rem 1rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
}

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

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

.btn-table-action {
  background-color: var(--primary-light);
  color: var(--primary);
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-table-action:hover {
  background-color: var(--primary);
  color: #ffffff;
}

/* ==========================================================================
   BADGES Y ESTILOS DE ESTADO Y PRIORIDAD
   ========================================================================== */
.badge-status-Abierto { background: #e0f2fe; color: #0369a1; }
.badge-status-En-Proceso { background: #ffedd5; color: #c2410c; }
.badge-status-En-Espera { background: #fef3c7; color: #b45309; }
.badge-status-Resuelto { background: #dcfce7; color: #15803d; }
.badge-status-Cerrado { background: #f1f5f9; color: #475569; }

/* Prioridades Mejoradas con Máximo Contraste */
.badge-prio-Crítica {
  background: var(--priority-critica-bg);
  color: var(--priority-critica);
  border-color: var(--priority-critica-border);
}

.badge-prio-Alta {
  background: var(--priority-alta-bg);
  color: var(--priority-alta);
  border-color: var(--priority-alta-border);
}

.badge-prio-Media {
  background: var(--priority-media-bg);
  color: var(--priority-media);
  border-color: var(--priority-media-border);
}

.badge-prio-Baja {
  background: var(--priority-baja-bg);
  color: var(--priority-baja);
  border-color: var(--priority-baja-border);
}

.badge-prio-Por-Asignar {
  background: var(--priority-pending-bg);
  color: var(--priority-pending);
  border-color: var(--priority-pending-border);
}

/* Estados de Tickets Mejorados */
.badge-status-Abierto {
  background: rgba(3, 105, 161, 0.08);
  color: #0369a1;
  border: 1px solid rgba(3, 105, 161, 0.3);
}

.badge-status-En-Proceso {
  background: var(--priority-alta-bg);
  color: var(--priority-alta);
  border: 1px solid var(--priority-alta-border);
}

.badge-status-En-Espera {
  background: var(--status-waiting);
  color: #fff;
  border: 1px solid var(--status-waiting);
  font-weight: 600;
}

.badge-status-Resuelto {
  background: rgba(21, 128, 61, 0.08);
  color: #15803d;
  border: 1px solid rgba(21, 128, 61, 0.3);
}

.badge-status-Cerrado {
  background: rgba(100, 116, 139, 0.08);
  color: #64748b;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.badge-status-Reabierto {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  font-weight: 700;
}

.badge-status-Cerrado-Definitivo {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #020617;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* Badges de Naturaleza de Ticket (ITIL: Incidencia vs Requerimiento) */
.badge-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-type-incidencia {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.badge-type-requerimiento {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}

.drilldown-kpi-card {
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.drilldown-kpi-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted, #64748b);
  font-weight: 700;
  margin-bottom: 4px;
}
.drilldown-kpi-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main, #0f172a);
}

/* ==========================================================================
   MODALES
   ========================================================================== */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-box {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

.modal-box.modal-wide {
  max-width: 720px;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.header-success {
  background-color: #f0fdf4;
  border-bottom-color: #bbf7d0;
}

.header-success h3 {
  color: #166534;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background-color: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.success-ticket-badge {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  margin: 1.25rem 0;
  background-color: var(--primary-light);
  padding: 0.5rem;
  border-radius: var(--radius-md);
  letter-spacing: 1px;
}

/* PLANTILLA DE CORREO INSTITUCIONAL */
.email-preview-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  font-size: 0.85rem;
}

.email-preview-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  font-family: monospace;
}

.email-preview-body {
  border: 1px solid #e2e8f0;
  padding: 1.25rem;
  border-radius: var(--radius-sm);
}

.email-btn-cta {
  display: inline-block;
  background-color: var(--primary);
  color: #ffffff !important;
  text-decoration: none;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  margin: 1rem 0;
}

.email-no-reply-notice {
  background-color: #fef2f2;
  border-left: 3px solid #ef4444;
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  color: #991b1b;
  margin-top: 1rem;
}

/* ==========================================================================
   DISEÑO RESPONSIVO MULTIPLATAFORMA (MÓVILES, TABLETS, LAPTOPS Y DESKTOPS)
   ========================================================================== */

/* Prevenir scroll horizontal accidental y auto-zoom en iOS */
html, body {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

/* Soporte táctil mejorado */
button, input, select, textarea, .file-chip-remove, .btn-close, .article-list a {
  touch-action: manipulation;
}

/* 1. TABLETS Y PANTALLAS MEDIANAS (<= 1024px) */
@media (max-width: 1024px) {
  .main-layout {
    max-width: 100%;
    margin: 1.25rem auto;
    padding: 0 1.25rem 2.5rem;
  }

  .content-wrapper {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .sidebar-column {
    width: 100%;
    order: 2;
  }

  .form-column {
    order: 1;
    padding: 2rem 1.75rem;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .dashboard-analytics-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .kpi-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .charts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .detail-grid-info {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 2. TABLETS VERTICALES Y SMARTPHONES GRANDES (<= 768px) */
@media (max-width: 768px) {
  /* Cabecera y Navegación */
  .top-nav {
    padding: 0.65rem 0;
  }

  .nav-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0 1rem;
  }

  .nav-left {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .brand-title {
    font-size: 1.05rem;
  }

  .brand-subtitle {
    font-size: 0.75rem;
  }

  .breadcrumb {
    font-size: 0.78rem;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
  }

  .search-box {
    flex: 1;
    min-width: 0;
  }

  .search-box input {
    font-size: 16px !important; /* Previene auto-zoom molesto en iPhones */
    padding: 0.55rem 0.75rem;
  }

  .btn-secondary-nav {
    white-space: nowrap;
    padding: 0.55rem 0.85rem;
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  /* Formulario de Requerimiento */
  .form-column {
    padding: 1.5rem 1.1rem;
    border-radius: var(--radius-md);
  }

  .section-header h1 {
    font-size: 1.45rem;
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .form-group {
    margin-bottom: 1.1rem;
  }

  /* Inputs accesibles para dedos en pantallas táctiles */
  input[type="text"],
  input[type="email"],
  input[type="date"],
  input[type="password"],
  select,
  textarea,
  .form-control {
    font-size: 16px !important; /* Estándar iOS para evitar zoom automático */
    min-height: 44px;
    padding: 0.65rem 0.85rem;
  }

  /* Barra de Herramientas del Editor Enriquecido */
  .editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.4rem;
  }

  .toolbar-btn {
    padding: 0.4rem 0.55rem;
    font-size: 0.78rem;
    min-height: 34px;
  }

  .editor-content {
    min-height: 120px;
    font-size: 16px;
    padding: 0.85rem;
  }

  /* Zona de carga y adjuntos */
  .attachment-zone {
    padding: 1.25rem 0.75rem;
    flex-direction: column;
    gap: 0.6rem;
  }

  .btn-attach {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
  }

  .form-actions {
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
  }

  .form-actions .btn-primary,
  .form-actions .btn-secondary {
    width: 100%;
    min-height: 46px;
    justify-content: center;
    font-size: 0.95rem;
  }

  /* Panel Técnico (Sistemas) */
  .tech-panel-container {
    padding: 1.25rem 1rem;
  }

  .tech-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .tech-header > div:last-child {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }

  .tech-header > div:last-child button {
    width: 100%;
    justify-content: center;
    min-height: 42px;
  }

  /* Pestañas de Navegación del Panel Técnico */
  .tech-tabs-nav {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    display: flex;
    gap: 0.35rem;
    padding-bottom: 2px;
    border-bottom: 2px solid var(--border-color);
  }

  .tech-tab-btn {
    padding: 0.6rem 0.85rem;
    font-size: 0.82rem;
    flex-shrink: 0;
  }

  .btn-print-report {
    margin-left: 0;
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
  }

  /* Barra de Filtros del Técnico */
  .filter-bar {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
  }

  .filter-bar input,
  .filter-bar select,
  .filter-bar button {
    width: 100%;
    min-height: 42px;
  }

  /* Contenedor responsivo de tablas con scroll suave */
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
  }

  .tickets-table {
    min-width: 680px; /* Evita que las columnas se aplasten en pantallas pequeñas */
  }

  .tickets-table th,
  .tickets-table td {
    padding: 0.75rem 0.65rem;
    font-size: 0.82rem;
  }

  /* Detalle y Muro de Ticket */
  .detail-container {
    padding: 1.25rem 1rem;
  }

  .detail-top-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    width: 100%;
  }

  .detail-grid-info {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.85rem;
  }

  /* Dashboard Gerencial */
  .dashboard-container {
    padding: 1.25rem 1rem;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }

  .header-actions button {
    width: 100%;
    justify-content: center;
    min-height: 40px;
    font-size: 0.82rem;
    padding: 0.5rem;
  }

  .filters-section {
    padding: 1rem;
  }

  .filters-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .charts-section {
    padding: 0 0 1.25rem;
  }

  .charts-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .chart-card {
    padding: 1rem;
  }

  .chart-card canvas {
    max-height: 240px;
  }

  /* Modales en Móviles */
  .modal-backdrop {
    padding: 0.75rem;
  }

  .modal-box {
    width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-body {
    padding: 1rem;
    max-height: 70vh;
  }

  .modal-footer {
    padding: 0.75rem 1rem;
  }
}

/* 3. TELÉFONOS INTELIGENTES COMPACTOS (<= 480px) */
@media (max-width: 480px) {
  .main-layout {
    margin: 0.5rem auto;
    padding: 0 0.5rem 1.5rem;
  }

  .form-column {
    padding: 1rem 0.75rem;
    border-radius: var(--radius-sm);
  }

  .section-header h1 {
    font-size: 1.3rem;
  }

  .brand-square {
    width: 32px;
    height: 32px;
    font-size: 0.7rem;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .brand-subtitle {
    display: none; /* Ahorra espacio vertical en pantallas ultra-pequeñas */
  }

  .breadcrumb {
    display: none;
  }

  .nav-right {
    flex-direction: column;
    gap: 0.4rem;
  }

  .search-box,
  #btn-toggle-portal {
    width: 100%;
  }

  #btn-toggle-portal {
    justify-content: center;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
  }

  .stat-card {
    padding: 0.65rem 0.5rem;
    text-align: center;
  }

  .stat-number {
    font-size: 1.35rem;
  }

  .stat-label {
    font-size: 0.72rem;
  }

  /* KPIs en columna simple para máxima legibilidad */
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .kpi-cards-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .kpi-card {
    padding: 0.85rem 0.75rem;
  }

  .kpi-val {
    font-size: 1.6rem;
  }

  .header-actions {
    grid-template-columns: 1fr;
  }

  .success-ticket-badge {
    font-size: 1.6rem;
    padding: 0.5rem 1rem;
  }

  .sync-cloud-badge {
    font-size: 0.76rem;
    padding: 6px 8px;
    flex-direction: column;
    text-align: center;
  }
}

/* ==========================================================================
   EVIDENCIAS Y ADJUNTOS EN DETALLE
   ========================================================================== */
.detail-description-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.detail-description-card .card-subtitle {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.description-body {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 1.25rem;
}

.attachments-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
}

.attachments-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.attachments-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.attachment-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 0.5rem;
  width: 140px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
}

.attachment-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.attachment-thumb {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 3px;
  margin-bottom: 0.4rem;
}

.attachment-icon-fallback {
  width: 120px;
  height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
  border-radius: 3px;
  font-size: 1.8rem;
  color: var(--text-muted);
}

.attachment-name {
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.attachment-size {
  font-size: 0.68rem;
  color: var(--text-light);
}

.attachment-actions {
  display: flex;
  gap: 4px;
  width: 100%;
  margin-top: 0.35rem;
}

.att-action-btn {
  flex: 1;
  font-size: 0.68rem;
  padding: 0.22rem 0.25rem;
  border-radius: 4px;
  text-align: center;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--primary);
  line-height: 1.2;
}

.att-action-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.att-action-btn.tab-btn {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.att-action-btn.tab-btn:hover {
  background: #1d4ed8;
  color: #ffffff;
  border-color: #1d4ed8;
}

/* LIGHTBOX MODAL */
.modal-lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  display: block;
  margin: 0 auto;
}

.btn-lightbox-tab {
  background: rgba(0, 92, 169, 0.95);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-lightbox-tab:hover {
  background: #004d8c;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

/* LOGIN DE SISTEMAS TI */
.modal-login {
  max-width: 440px;
}

.login-intro {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.login-alert-error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.login-credentials-tip {
  background: var(--primary-light);
  border: 1px solid rgba(0, 92, 169, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: #0c4a6e;
}

.login-credentials-tip .tip-user {
  margin-top: 0.3rem;
}

.login-credentials-tip code {
  background: rgba(255, 255, 255, 0.8);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: monospace;
}

.tech-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.3rem 0.75rem;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--text-main);
}

.tech-user-badge .badge-role {
  background: var(--primary);
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
}

.btn-logout {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 0.5rem;
}

.btn-logout:hover {
  background: #fee2e2;
}

/* ==========================================================================
   PIE INSTITUCIONAL - TRYP BY WYNDHAM GUAYAQUIL
   ========================================================================== */
.hotel-footer {
  background-color: #ffffff;
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 1rem;
  margin-top: 3rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-brand {
  font-size: 0.9rem;
  color: var(--text-main);
}

.footer-brand strong {
  color: var(--primary);
}

.footer-meta span {
  font-weight: 600;
  color: var(--text-main);
}

.footer-address {
  font-size: 0.76rem;
  color: var(--text-light);
}

/* ==========================================================================
   TABS DEL PANEL DE SISTEMAS Y DASHBOARD GERENCIAL
   ========================================================================== */
.tech-tabs-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.5rem;
  padding-bottom: 0.25rem;
  flex-wrap: wrap;
}

.tech-tab-btn {
  background: none;
  border: none;
  padding: 0.6rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.tech-tab-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.tech-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #ffffff;
}

.btn-print-report {
  margin-left: auto;
  background: linear-gradient(135deg, #005CA9, #004885);
  color: #ffffff;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-print-report:hover {
  opacity: 0.92;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* DASHBOARD EJECUTIVO */
.executive-dashboard {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.report-header-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #005CA9;
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.report-title-area h3 {
  color: var(--primary);
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.report-title-area p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0;
}

.report-badge-period {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  border: 1px solid rgba(0, 92, 169, 0.2);
}

/* KPIS EJECUTIVOS GRID */
.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.1rem;
  position: relative;
  overflow: hidden;
  border-left: 4px solid var(--primary);
}

.kpi-card.kpi-success { border-left-color: #16a34a; }
.kpi-card.kpi-warning { border-left-color: #ea580c; }
.kpi-card.kpi-danger { border-left-color: #dc2626; }
.kpi-card.kpi-info { border-left-color: #0284c7; }

.kpi-val {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.kpi-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 0.35rem;
}

.kpi-sub {
  font-size: 0.76rem;
  color: var(--text-light);
}

/* GRÁFICOS Y DISTRIBUCIONES */
.dashboard-analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.analytics-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.analytics-card h4 {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.5rem;
}

.bars-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.bar-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
}

.bar-track {
  width: 100%;
  height: 8px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.6s ease;
}

.bar-fill.fill-orange { background: #ea580c; }
.bar-fill.fill-green { background: #16a34a; }
.bar-fill.fill-purple { background: #8b5cf6; }
.bar-fill.fill-red { background: #dc2626; }

/* SECCIÓN DE TOMA DE DECISIONES GERENCIALES */
.management-insights-box {
  background: #f0f7ff;
  border: 1px solid #bae6fd;
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.management-insights-box h4 {
  color: var(--primary);
  font-size: 1rem;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.management-insights-box ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.86rem;
  color: #1e293b;
  line-height: 1.6;
}

.management-insights-box li {
  margin-bottom: 0.4rem;
}

/* FIRMAS DE APROBACIÓN EJECUTIVA (IMPRESIÓN) */
.report-signatures-block {
  display: none;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px dashed #cbd5e1;
}

.signatures-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  text-align: center;
}

.sign-box {
  padding-top: 2rem;
  border-top: 1px solid #334155;
}

.sign-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1e293b;
}

.sign-role {
  font-size: 0.82rem;
  color: #64748b;
}

/* REGLAS ESTRICTAS DE IMPRESIÓN OFICIAL */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 10pt !important;
  }

  .top-nav,
  .tech-header,
  .tech-tabs-nav,
  .btn-print-report,
  .hotel-footer,
  #tech-tab-tickets,
  #view-create-ticket,
  #view-ticket-detail,
  #modal-tech-manage,
  #modal-tech-login,
  #modal-success,
  #modal-lightbox,
  .no-print {
    display: none !important;
  }

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

  #view-technician-panel {
    display: block !important;
  }

  #tech-tab-dashboard {
    display: block !important;
  }

  .executive-dashboard {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .report-signatures-block {
    display: block !important;
    page-break-inside: avoid;
  }

  .analytics-card, .kpi-card, .management-insights-box {
    page-break-inside: avoid;
    border: 1px solid #cbd5e1 !important;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Dashboard Print Styles */
  #view-dashboard,
  .dashboard-container {
    page-break-inside: avoid;
  }

  .dashboard-header {
    page-break-after: avoid;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 15px;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
    page-break-inside: avoid;
  }

  .kpi-card {
    page-break-inside: avoid;
    border: 1px solid #cbd5e1;
    box-shadow: none;
  }

  .table-section {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .filter-bar {
    display: none !important;
  }

  .header-actions {
    display: none !important;
  }
}

/* ==========================================================================
   VISTA 4: DASHBOARD GERENCIAL
   ========================================================================== */
.dashboard-container {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
}

.dashboard-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  padding: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.15);
}

.dashboard-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.dashboard-header p {
  font-size: 0.9rem;
  opacity: 0.95;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
  padding: 0 2rem;
}

.kpi-card {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  border-left: 4px solid var(--primary);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.kpi-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.kpi-value {
  display: block;
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.kpi-subtitle {
  display: block;
  font-size: 0.8rem;
  color: var(--text-light);
}

.table-section {
  background: white;
  border-radius: 10px;
  padding: 1.75rem;
  margin: 0 2rem 1.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  overflow-x: auto;
}

.table-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--text-main);
}

.dashboard-footer {
  text-align: center;
  padding: 1.5rem 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-page);
  margin-top: 2rem;
}

/* FILTROS AVANZADOS (FASE 2) */
.filters-section {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  margin: 0 2rem 1.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  align-items: flex-end;
}

.filters-section label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
}

.filters-section input,
.filters-section select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.filters-section input:focus,
.filters-section select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* GRÁFICOS INTERACTIVOS (FASE 3) */
.charts-section {
  padding: 0 2rem 1.5rem;
}

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

.chart-card {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
}

.chart-card h4 {
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
}

.chart-card canvas {
  max-height: 300px;
  width: 100%;
}

/* ==========================================================================
   BADGE DE SINCRONIZACIÓN EN TIEMPO REAL
   ========================================================================== */
.sync-cloud-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  margin: 12px 0 16px 0;
  transition: all 0.3s ease;
  font-weight: 500;
}

.sync-cloud-badge.syncing {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.sync-cloud-badge.synced {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.sync-cloud-badge.offline {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.sync-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #93c5fd;
  border-top-color: #1d4ed8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

/* ==========================================================================
   FASE 3: GOBIERNO TI JEFATURA (ING. PALOMINO) & ENCUESTAS DE SATISFACCIÓN CSAT
   ========================================================================== */
.jefatura-admin-card {
  background: linear-gradient(135deg, rgba(0, 92, 169, 0.05) 0%, rgba(2, 132, 199, 0.08) 100%);
  border: 1.5px solid rgba(0, 92, 169, 0.25);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 6px rgba(0, 92, 169, 0.06);
}

.jefatura-admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.jefatura-admin-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.jefatura-icon {
  font-size: 1.6rem;
  background: #ffffff;
  padding: 8px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.jefatura-title {
  margin: 0;
  font-size: 0.98rem;
  color: var(--primary);
  font-weight: 700;
}

.jefatura-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.csat-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.csat-toggle-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Switch Toggle Slider */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.25s;
  border-radius: 34px;
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.switch-toggle input:checked + .slider-round {
  background-color: #16a34a;
}

.switch-toggle input:checked + .slider-round:before {
  transform: translateX(20px);
}

.badge-csat-on {
  font-size: 0.74rem;
  font-weight: 700;
  color: #16a34a;
  background: #f0fdf4;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid #bbf7d0;
}

.badge-csat-off {
  font-size: 0.74rem;
  font-weight: 700;
  color: #64748b;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

/* CSAT Card en Detalle del Ticket */
.csat-card {
  margin-bottom: 1.75rem;
}

.csat-form-box {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1.5px solid #86efac;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.08);
}

.csat-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 1rem;
}

.csat-header h4 {
  margin: 0 0 4px 0;
  color: #166534;
  font-size: 1.05rem;
}

.csat-header p {
  margin: 0;
  font-size: 0.85rem;
  color: #15803d;
}

.csat-stars-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 1rem 0;
  user-select: none;
}

.csat-star {
  font-size: 2rem;
  color: #cbd5e1;
  cursor: pointer;
  transition: transform 0.15s, color 0.15s;
  line-height: 1;
}

.csat-star:hover,
.csat-star.active,
.csat-star.hovered {
  color: #eab308;
  transform: scale(1.15);
}

.csat-hint {
  font-size: 0.85rem;
  color: #166534;
  font-weight: 600;
  margin-left: 10px;
}

.csat-comment-input {
  width: 100%;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-main);
  background: #ffffff;
  resize: vertical;
  margin-bottom: 0.85rem;
  box-sizing: border-box;
}

.csat-comment-input:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.csat-actions {
  display: flex;
  justify-content: flex-end;
}

.csat-success-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: var(--radius-md);
  padding: 1.1rem 1.4rem;
  box-shadow: 0 1px 4px rgba(22, 163, 74, 0.06);
}

/* AUTO-SUGERENCIA INTELIGENTE DE ARTÍCULOS KB (DEFLEXIÓN DE TICKETS) */
.kb-suggestion-card {
  margin-top: 0.65rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-left: 4px solid #16a34a;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  animation: fadeInDown 0.25s ease-out;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ✨ ANIMACIÓN DE BLINK PARA LLAMAR ATENCIÓN */
@keyframes suggestionPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4),
                0 2px 8px rgba(0, 0, 0, 0.06);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(22, 163, 74, 0),
                0 2px 16px rgba(22, 163, 74, 0.3);
  }
}

.kb-suggestion-card.kb-suggestion-active {
  animation: suggestionPulse 2s ease-in-out infinite;
  border-color: #22c55e;
  border-left-color: #16a34a;
  background: #f0fdf4;
}

.kb-suggest-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
}

.kb-suggest-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.kb-suggest-text {
  flex: 1;
  font-size: 0.88rem;
  color: #166534;
  line-height: 1.4;
}

.kb-suggest-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  margin-left: 4px;
}

.kb-suggest-link:hover {
  color: var(--primary-hover);
}

.kb-suggest-close {
  background: transparent;
  border: none;
  color: #86efac;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}

.kb-suggest-close:hover {
  color: #166534;
}

/* ==========================================================================
   BARRA DE CICLO DE VIDA (REAPERTURA Y CIERRE DEFINITIVO)
   ========================================================================== */
.lifecycle-banner {
  margin: 1.25rem 0 1.5rem 0;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #cbd5e1;
  border-left: 5px solid #005ca9;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.lifecycle-banner.resolved {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #86efac;
  border-left-color: #16a34a;
}

.lifecycle-banner.reopened {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #fca5a5;
  border-left-color: #dc2626;
}

.lifecycle-banner.final-closed {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-color: #94a3b8;
  border-left-color: #0f172a;
}

.lifecycle-banner-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.lifecycle-banner-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lifecycle-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.lifecycle-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-lifecycle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-reopen {
  background: #ea580c;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(234, 88, 12, 0.25);
}

.btn-reopen:hover {
  background: #c2410c;
  transform: translateY(-1px);
}

.btn-final-close {
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.3);
}

.btn-final-close:hover {
  background: #1e293b;
  transform: translateY(-1px);
}

.closed-notice-card {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #cbd5e1;
  border-left: 5px solid #0f172a;
  border-radius: 10px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.btn-new-ticket-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: #ffffff;
  padding: 0.6rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 92, 169, 0.25);
  transition: all 0.2s ease;
}

.btn-new-ticket-shortcut:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* ==========================================================================
   FICHA DE AUDITORÍA Y TRAZABILIDAD (AUDIT TRAIL MINUTO A MINUTO)
   ========================================================================== */
.audit-trail-section {
  margin-top: 2rem;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
}

.audit-trail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.audit-trail-title {
  margin: 0 0 0.25rem 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.audit-trail-subtitle {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.audit-trail-count {
  font-size: 0.75rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
}

.audit-timeline {
  position: relative;
  padding-left: 2.4rem;
}

.audit-item {
  position: relative;
  margin-bottom: 1.25rem;
}

.audit-item:last-child {
  margin-bottom: 0;
}

/* Conector vertical entre eventos auditados (se oculta automáticamente en el último evento) */
.audit-item::before {
  content: "";
  position: absolute;
  left: calc(-2.4rem + 17px);
  top: 38px;
  bottom: -1.25rem;
  width: 2px;
  background: #e2e8f0;
}

.audit-item:last-child::before {
  display: none !important;
}

.audit-marker {
  position: absolute;
  left: -2.4rem;
  top: 4px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.audit-marker.marker-create { border-color: #005ca9; background: #eff6ff; }
.audit-marker.marker-assign { border-color: #0284c7; background: #f0f9ff; }
.audit-marker.marker-status { border-color: #f59e0b; background: #fffbeb; }
.audit-marker.marker-csat   { border-color: #eab308; background: #fefce8; }
.audit-marker.marker-reopen { border-color: #ef4444; background: #fef2f2; }
.audit-marker.marker-close  { border-color: #10b981; background: #ecfdf5; }
.audit-marker.marker-final  { border-color: #0f172a; background: #f8fafc; }
.audit-marker.marker-reply  { border-color: #6366f1; background: #eef2ff; }

.audit-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.85rem 1.1rem;
  transition: all 0.15s ease;
}

.audit-card:hover {
  background: #ffffff;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
}

.audit-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.audit-action-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.tag-create { background: #dbeafe; color: #1e40af; }
.tag-assign { background: #e0f2fe; color: #0369a1; }
.tag-status { background: #fef3c7; color: #92400e; }
.tag-csat   { background: #fef08a; color: #854d0e; }
.tag-reopen { background: #fee2e2; color: #991b1b; }
.tag-close  { background: #dcfce7; color: #166534; }
.tag-final  { background: #0f172a; color: #f8fafc; }
.tag-reply  { background: #e0e7ff; color: #3730a3; }

.audit-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.audit-actor-line {
  font-size: 0.82rem;
  color: #334155;
  margin-bottom: 0.35rem;
}

.audit-actor-name {
  font-weight: 700;
  color: #0f172a;
}

.audit-details-text {
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.45;
  margin: 0;
  word-break: break-word;
}

.audit-csat-highlight {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: #d97706;
  background: #fef3c7;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
}

/* ==========================================================================
   PANEL DE ACCIONES TÉCNICAS (CERRAR INCIDENCIA DESDE EL MURO)
   ========================================================================== */
.tech-actions-section {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  border: 1px solid #bfdbfe;
  border-left: 4px solid #005ca9;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.tech-actions-header {
  margin-bottom: 0.75rem;
}

.tech-actions-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #005ca9;
  margin: 0 0 0.25rem 0;
}

.tech-actions-header p {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0;
}

.tech-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.btn-tech-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.75rem 1rem;
  background: white;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: #005ca9;
  transition: all 0.2s;
}

.btn-tech-action:hover {
  background: #005ca9;
  color: white;
  border-color: #005ca9;
  box-shadow: 0 4px 8px rgba(0, 92, 169, 0.15);
  transform: translateY(-2px);
}

.btn-tech-action .action-icon {
  font-size: 1.25rem;
}

.btn-tech-action .action-label {
  white-space: nowrap;
  text-align: center;
}

/* ==========================================================================
   DIRECTORIO CORPORATIVO INTELIGENTE DE CONTACTOS & AUTOCOMPLETADO
   ========================================================================== */
.autocomplete-input-wrapper {
  position: relative;
  width: 100%;
}

.directory-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.16), 0 4px 14px -2px rgba(0, 92, 169, 0.08);
  z-index: 9999;
  overflow: hidden;
  max-height: 330px;
  display: flex;
  flex-direction: column;
  animation: dirSlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

@keyframes dirSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.directory-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.74rem;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.directory-header-badge {
  background: rgba(0, 92, 169, 0.1);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.directory-results-list {
  overflow-y: auto;
  max-height: 240px;
  margin: 0;
  padding: 4px;
  list-style: none;
  scroll-behavior: smooth;
}

.directory-results-list::-webkit-scrollbar {
  width: 5px;
}
.directory-results-list::-webkit-scrollbar-track {
  background: #f1f5f9;
}
.directory-results-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.directory-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.directory-contact-item:hover,
.directory-contact-item.active {
  background: #f0f7ff;
  border-left-color: var(--primary);
  transform: translateX(2px);
}

.contact-avatar-pill {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
  text-transform: uppercase;
}

.contact-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.contact-name-email {
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-dept-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: #e0f2fe;
  color: #0369a1;
  white-space: nowrap;
  flex-shrink: 0;
}

.contact-row-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.77rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-highlight-match {
  background: #fef08a;
  color: #854d0e;
  font-weight: 700;
  border-radius: 2px;
  padding: 0 2px;
}

.directory-dropdown-footer {
  padding: 6px 12px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  font-size: 0.72rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.directory-dropdown-footer span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.directory-empty-state {
  padding: 18px 14px;
  text-align: center;
  color: #64748b;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.directory-empty-state small {
  color: #94a3b8;
  font-size: 0.75rem;
}

/* Responsividad Móvil */
@media (max-width: 640px) {
  .directory-autocomplete-dropdown {
    max-height: 280px;
    border-radius: 10px;
  }
  .contact-avatar-pill {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
  }
  .contact-name-email {
    font-size: 0.82rem;
  }
  .contact-dept-tag {
    font-size: 0.65rem;
    padding: 1px 5px;
  }
  .directory-dropdown-footer {
    display: none;
  }
}



