body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: #0f172a;
}

.auth-wrapper {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
  box-sizing: border-box;
  background-color: #030d24;
  background-image: url('/helpdesk_itil/static/Fondo_Login.png');
  background-size: min(500px, 80vw);
  background-position: center 6%;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.auth-wrapper::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(90deg, rgba(3, 13, 36, 0.28) 0%, rgba(3, 13, 36, 0.14) 40%, rgba(3, 13, 36, 0.58) 100%);
  pointer-events: none;
}

.auth-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  width: 100%;
  max-width: 420px;
  border: 1px solid rgba(217, 226, 236, 0.6);
  border-radius: 14px;
  padding: 32px 24px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.24);
  position: relative;
  z-index: 1;
}

.login-logo {
  height: 120px;
  width: auto;
  display: block;
  margin: 0 auto 16px;
  object-fit: contain;
}

.login-header {
  text-align: center;
  margin-bottom: 12px;
}

.grid {
  display: grid;
  gap: 8px;
}

.grid label {
  color: #1e293b;
  font-weight: 500;
  font-size: 14px;
  margin-top: 4px;
}

#usuario-clave-group {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  width: 100%;
}

#usuario-clave-group label {
  color: #1e293b;
  font-weight: 500;
  font-size: 14px;
  margin-top: 4px;
}

#usuario-clave-group input {
  width: 100%;
  box-sizing: border-box;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: #0f172a;
  font-size: 14px;
}

input::placeholder,
textarea::placeholder {
  color: #9ca3af;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
  color: white;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.3);
}

button:hover {
  background: linear-gradient(135deg, #115e59 0%, #0d5549 100%);
  box-shadow: 0 6px 20px rgba(15, 118, 110, 0.4);
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
}

.box {
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 10px;
  margin-top: 10px;
}

.muted {
  color: #475569;
  font-size: 14px;
  text-align: center;
  margin-bottom: 20px;
}

.auth-card h1 {
  color: #0f172a;
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 6px 0;
  text-align: center;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #1f2937 100%);
  color: #ffffff;
  padding: 24px 16px;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.brand {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-icon {
  width: 20px;
  text-align: center;
  display: inline-block;
  flex: 0 0 auto;
}

.brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
}

.collapse-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 0;
}

.collapse-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.user-pill {
  font-size: 0.85rem;
  color: #d1d5db;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 6px 10px;
  margin-bottom: 18px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: #e5e7eb;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.menu-link:hover,
.menu-link.active {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.18);
}

.menu-link.logout {
  margin-top: 22px;
  background: rgba(239, 68, 68, 0.25);
}

.layout.collapsed {
  grid-template-columns: 84px 1fr;
}

.layout.collapsed .label {
  display: none;
}

.layout.collapsed .brand {
  justify-content: center;
}

.layout.collapsed .brand-logo {
  margin: 0;
}

.layout.collapsed .menu-link {
  justify-content: center;
}

.layout.collapsed .sidebar-top {
  justify-content: center;
  gap: 8px;
}

.layout.collapsed .collapse-btn .menu-icon {
  transform: rotate(180deg);
}

.layout.collapsed .user-pill {
  display: none;
}

.content {
  padding: 24px;
}

.panel-view {
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.secondary {
  background: #334155;
}

.secondary:hover {
  background: #1e293b;
}

@media (max-width: 860px) {
  .auth-wrapper {
    place-items: center;
    padding: 16px;
    background-size: min(390px, 86vw);
    background-position: center 2%;
  }

  .auth-wrapper::before {
    background: linear-gradient(180deg, rgba(7, 18, 45, 0.32) 0%, rgba(7, 18, 45, 0.26) 100%);
  }

  .auth-card {
    max-width: 460px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  .brand,
  .user-pill,
  .sidebar-top {
    margin: 0;
  }

  .sidebar-top {
    width: 100%;
  }

  .sidebar nav {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .menu-link {
    width: auto;
    margin: 0;
  }

  .menu-link.logout {
    margin-top: 0;
  }

  .layout.collapsed {
    grid-template-columns: 1fr;
  }


@media (min-width: 1024px) {
  .auth-wrapper {
    justify-items: end;
    padding-right: min(9vw, 130px);
    padding-left: min(5vw, 70px);
  }
}
  .layout.collapsed .label,
  .layout.collapsed .user-pill {
    display: inline;
  }
}

.hidden {
  display: none !important;
}

/* ===== CHAT ===== */
.chatbot-panel {
  max-width: 900px;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.chat-header h2 {
  margin: 0 0 4px 0;
}

.chat-header p {
  margin: 0;
}

.chat-header button {
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-box {
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  min-height: 320px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 14px;
  margin-bottom: 12px;
}

.message {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 85%;
}

.message.user {
  background: #dbeafe;
  margin-left: auto;
}

.message.assistant {
  background: #ecfccb;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.typing-label {
  color: #3f6212;
  font-weight: 600;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #65a30d;
  opacity: 0.3;
  animation: typingPulse 1s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chat-quick-btn {
  background: #0f766e;
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
}

.chat-quick-btn:hover {
  background: #115e59;
}

.chat-quick-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.chat-form {
  display: grid;
  gap: 8px;
}

.evidencia-row {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.evidencia-row label {
  display: block;
  margin-bottom: 6px;
  color: #5b6875;
}

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

.incident-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  overflow: hidden;
}

.incident-table th,
.incident-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
  font-size: 0.95rem;
}

.incident-table th {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
}

.incident-table tbody tr:hover {
  background: #f8fafc;
}

.incident-table tbody tr:last-child td {
  border-bottom: 0;
}

.view-detail-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #2563eb;
  color: #ffffff;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.view-detail-btn:hover {
  background: #1d4ed8;
}

.row-edit-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #0f766e;
  color: #ffffff;
  font-size: 1rem;
}

.row-edit-btn:hover {
  background: #115e59;
}

.incident-empty {
  margin-top: 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 14px;
  color: #5b6875;
}

.incident-detail {
  margin-top: 12px;
}

.incident-card {
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.incident-card-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 14px;
  font-weight: 700;
  color: #0f172a;
}

.incident-card-body {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.incident-field {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
}

.incident-field.full {
  grid-column: 1 / -1;
}

.incident-field .label {
  display: block;
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 4px;
}

.incident-field .value {
  color: #0f172a;
  white-space: pre-wrap;
  word-break: break-word;
}

.evidence-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.evidence-item {
  border: 1px solid #dbe6f3;
  border-radius: 10px;
  background: #ffffff;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.evidence-thumb {
  width: 100%;
  height: 98px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  display: block;
}

.evidence-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 8px;
  background: #0f766e;
  color: #ffffff;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
}

.evidence-download:hover {
  background: #115e59;
}

.help-link {
  display: inline-block;
  margin-top: 8px;
  color: #0f766e;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.92rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(85vh, 900px);
  overflow: auto;
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #d9e2ec;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
  padding: 10px 10px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.modal-header h3 {
  margin: 0;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0;
}

.modal-body h4 {
  margin: 18px 0 8px;
}

.modal-body ol {
  margin: 0;
  padding-left: 20px;
}

.modal-body li {
  margin-bottom: 8px;
}

/* ===== JEFE PANEL ===== */
.jefe-section {
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  background: #ffffff;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.jefe-section h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: #0f172a;
}

.jefe-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}

.jefe-filter-bar select {
  padding: 7px 10px;
  border: 1px solid #c8d6e5;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.9rem;
  color: #0f172a;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-danger:hover {
  background: #b91c1c;
}

.assign-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #7c3aed;
  color: #ffffff;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.assign-btn:hover {
  background: #6d28d9;
}

.badge-escalado {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-normal {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.78rem;
}

.report-card {
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
  margin-top: 12px;
}

.report-card-header {
  background: #1e3a5f;
  color: #ffffff;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 1rem;
}

.report-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
}

.report-stat {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 18px;
  min-width: 130px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-stat span {
  font-size: 0.8rem;
  color: #5b6875;
}

.report-stat strong {
  font-size: 1.3rem;
  color: #0f172a;
}

.report-stat strong.danger {
  color: #dc2626;
}

.report-stat strong.warning {
  color: #d97706;
}
