/* =========================
   BASE
========================= */

* {
  box-sizing: border-box;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --border: #e2e4f0;
  --border-soft: #edf0ff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --accent: #7c3aed;
  --accent-soft: #ede9fe;
  --accent-strong: #4f46e5;
  --danger: #ef4444;
  --success: #16a34a;
  --shadow-soft: 0 16px 40px rgba(15, 23, 42, 0.12);
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-main);
}

/* =========================
   HEADER
========================= */

header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* ✅ antes tenías header-left (tag inexistente); lo correcto es .header-left */
.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-dot {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, #a855f7, #2563eb);
  display: inline-block;
}

header h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

header span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

#userBar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
}

/* =========================
   LAYOUT
========================= */

main {
  padding: 1rem 1.3rem 1.4rem;
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1.3fr);
  gap: 1rem;
}

.app-footer {
  max-width: 1440px;
  margin: 0.4rem auto 1.4rem;
  padding: 0 1.3rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
  }

  header {
    padding: 0.6rem 1rem;
    flex-wrap: wrap;
  }

  #userBar {
    width: 100%;
    justify-content: space-between;
  }
}

.card {
  background: var(--card);
  border-radius: 0.9rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
}

.card h2 {
  margin-top: 0;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
}

.card h2::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

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

.flex {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

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

/* =========================
   FORM
========================= */

label {
  font-size: 0.78rem;
  color: #4b5563;
  display: block;
  margin-bottom: 0.1rem;
}

input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.32rem 0.55rem;
  border-radius: 0.55rem;
  border: 1px solid var(--border);
  font-size: 0.84rem;
  margin-bottom: 0.45rem;
  outline: none;
  background: #f9fafb;
  transition: border 0.15s, box-shadow 0.15s, background 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.4);
  background: #ffffff;
}

textarea {
  resize: vertical;
  min-height: 60px;
}

/* =========================
   BUTTONS
========================= */

button {
  border: none;
  border-radius: 999px;
  padding: 0.38rem 0.9rem;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: transform 0.08s ease, box-shadow 0.08s ease,
    background 0.15s ease, opacity 0.1s;
  white-space: nowrap;
  font-weight: 500;
}

button.primary {
  background: linear-gradient(135deg, #8b5cf6, #2563eb);
  color: #f9fafb;
  box-shadow: 0 12px 24px rgba(88, 28, 135, 0.3);
}

button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(79, 70, 229, 0.4);
}

button.secondary {
  background: #eef1ff;
  color: #111827;
}

button.secondary:hover {
  background: #e0e7ff;
}

button.icon {
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  box-shadow: none;
}

button:active {
  transform: translateY(0);
  opacity: 0.9;
}

/* =========================
   BADGES / CHIPS
========================= */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
}

.badge-low {
  background: #dcfce7;
  color: #166534;
}

.badge-medium {
  background: #e0f2fe;
  color: #1d4ed8;
}

.badge-high {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-status {
  background: #e0e7ff;
  color: #4338ca;
}

.role-chip {
  padding: 0.08rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  background: #e5e7eb;
  color: #374151;
}

.role-admin {
  background: #ede9fe;
  color: #6d28d9;
}

/* =========================
   LOGIN
========================= */

#loginContainer {
  max-width: 380px;
  margin: 1.5rem auto;
}

/* =========================
   BOARD
========================= */

.board-header {
  margin-bottom: 0.5rem;
}

#metricsBox {
  margin: 0.4rem 0 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.6rem;
  background: #f5f3ff;
  border: 1px dashed #e0e7ff;
  font-size: 0.8rem;
  color: #111827;
}

.filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

@media (max-width: 1100px) {
  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  main {
    padding: 0.75rem 0.9rem 1.1rem;
  }

  .modal-overlay {
    align-items: flex-start;
  }

  #userBar {
    flex-wrap: nowrap;
    overflow-y: visible;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    gap: 0.4rem;
    -webkit-overflow-scrolling: touch;
  }

  #userBar::-webkit-scrollbar {
    display: none;
  }

  #userBar .secondary,
  #userBar .toggle-btn,
  #userBar .user-menu-btn {
    font-size: 0.78rem;
    padding: 0.3rem 0.6rem;
  }

  .view-toggle {
    order: 2;
  }

  .user-menu {
    position: static;
    order: 3;
    width: 100%;
    justify-content: flex-end;
  }

  .user-menu-dropdown {
    position: fixed;
    top: 4.2rem;
    right: 0.9rem;
    left: auto;
    width: min(90vw, 260px);
    z-index: 1000;
  }

  .card {
    padding: 0.7rem 0.75rem;
  }

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

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

  .board-columns {
    gap: 0.6rem;
  }

  .column {
    padding: 0.55rem;
  }

  .task-card {
    padding: 0.5rem 0.55rem;
  }

  .task-card-title {
    font-size: 0.82rem;
  }

  .task-card-body {
    font-size: 0.75rem;
  }

  .task-card-footer {
    gap: 0.25rem;
  }

  .pill {
    font-size: 0.7rem;
    padding: 0.12rem 0.4rem;
  }

  .board-header .flex-between {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  #metricsBox {
    font-size: 0.75rem;
  }

  .app-footer {
    margin: 0.35rem auto 1.1rem;
    padding: 0 0.9rem;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 0.95rem;
  }

  header span {
    font-size: 0.75rem;
  }

  .column-title {
    font-size: 0.8rem;
  }

  .column-count {
    font-size: 0.7rem;
  }
}

.board-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .board-columns {
    grid-template-columns: 1fr;
  }
}

.column {
  background: #f9fafb;
  border-radius: 0.9rem;
  padding: 0.6rem;
  border: 1px solid #e5e7eb;
  min-height: 150px;
}

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

.column-title {
  font-size: 0.84rem;
  font-weight: 600;
}

.column-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: #e5e7eb;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.column-dropzone {
  min-height: 140px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Tareas */
.task-card {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.07);
  margin-bottom: 0.4rem;
  cursor: grab;
}

.task-card.dragging {
  opacity: 0.6;
  box-shadow: 0 16px 35px rgba(15, 23, 42, 0.25);
}

.task-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.35rem;
}

.task-card-title {
  font-size: 0.86rem;
  font-weight: 600;
}

.task-card-body {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.task-card-footer {
  margin-top: 0.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.pill {
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  font-size: 0.74rem;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.pill small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.no-tasks {
  text-align: center;
  padding: 0.55rem 0.45rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-radius: 0.7rem;
  border: 1px dashed #e5e7eb;
  background: rgba(255,255,255,0.6);
}

/* =========================
   ADMIN LOG
========================= */

#adminLogContainer {
  margin-top: 0.4rem;
}

details {
  margin-top: 0.3rem;
  border-radius: 0.6rem;
  background: #f9fafb;
  border: 1px dashed #e5e7eb;
  padding: 0.3rem 0.5rem 0.4rem;
}

details summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.8rem;
  color: #4b5563;
  font-weight: 500;
}

details summary::-webkit-details-marker {
  display: none;
}

/* =========================
   MODALES BASE
========================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 1rem;
  overflow: auto;
}

.modal-hidden {
  display: none !important;
}

.modal-overlay:not(.modal-hidden) {
  display: flex;
}

.modal-overlay:not(.modal-hidden) {
  display: flex;
}

.modal {
  background: #ffffff;
  color: #111827;
  padding: 1rem 1.2rem 0.9rem;
  border-radius: 0.9rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.65);
  border: 1px solid #e5e7eb;
}

#profileOverlay .modal {
  max-width: 420px;
  max-height: 90vh;
  overflow: auto;
}

.modal h3 {
  margin: 0 0 0.25rem;
  font-size: 0.98rem;
  font-weight: 600;
}

.modal p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.modal-actions {
  margin-top: 0.9rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Overlay específico: confirm siempre arriba */
#teamOverlay.modal-overlay {
  z-index: 800;
}

#confirmOverlay.modal-overlay {
  z-index: 9999;
}

#memberActionOverlay.modal-overlay {
  z-index: 900;
}

/* =========================
   MODAL EQUIPO / DEPTOS
========================= */

#teamOverlay .modal {
  max-width: 920px;
  width: 100%;
  padding: 1.1rem 1.4rem 1.1rem;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

#memberActionOverlay .modal {
  max-width: 460px;
  width: min(92vw, 460px);
  padding: 1rem 1.2rem 1.1rem;
}

#memberActionOverlay .modal h3 {
  font-size: 1rem;
  font-weight: 700;
}

#memberActionOverlay .modal p {
  font-size: 0.8rem;
  color: #6b7280;
}

#memberActionOverlay .member-email-panel,
#memberActionOverlay .member-password-panel {
  display: block;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

#memberActionOverlay .member-email-actions,
#memberActionOverlay .member-password-actions {
  margin-top: 0.7rem;
}

.member-action-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.member-action-list .menu-item {
  border-radius: 0.7rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #eef2ff;
  background: #ffffff;
}

.modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
  gap: 1rem;
  margin-top: 0.6rem;
  flex: 1;
  min-height: 260px;
}

@media (max-width: 700px) {
  .modal-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  #teamOverlay ul.member-list {
    grid-template-columns: 1fr;
  }
}

/* Lista integrantes */
ul.member-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

ul.member-list li {
  padding: 0.32rem 0.5rem;
  border-radius: 0.6rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.6rem;
}

ul.member-list li:hover {
  background: #f3f4ff;
  border-color: #d4d4ff;
}

/* fila principal dentro del li */
.member-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
}

.department-remove-btn {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid #fee2e2;
  background: #fff5f5;
  color: #b91c1c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
}

.department-remove-btn:hover {
  background: #fee2e2;
}

.member-email {
  font-size: 0.75rem;
  color: #6b7280;
}

/* Panel desplegable: cambiar contraseña */
.member-password-panel {
  display: none;
  width: 100%;
  padding: 0.55rem;
  border-radius: 0.6rem;
  background: #fff;
  border: 1px dashed #d1d5db;
}

.member-password-panel.open {
  display: block;
}

.member-email-panel {
  display: none;
  width: 100%;
  padding: 0.55rem;
  border-radius: 0.6rem;
  background: #fff;
  border: 1px dashed #d1d5db;
}

.member-email-panel label {
  display: block;
  font-size: 0.72rem;
  margin-bottom: 0.15rem;
  color: #374151;
}

.member-email-panel input {
  width: 100%;
}

.member-email-panel.open {
  display: block;
}

.member-email-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.member-password-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.member-password-field label {
  display: block;
  font-size: 0.72rem;
  margin-bottom: 0.15rem;
  color: #374151;
}

.member-password-field input {
  width: 100%;
}

.member-password-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.45rem;
  font-size: 0.75rem;
  color: #374151;
}

.member-password-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

@media (max-width: 700px) {
  .member-password-grid {
    grid-template-columns: 1fr;
  }
}

.member-name {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  font-size: 0.8rem;
  color: #111827;
}

.member-name strong {
  font-size: 0.83rem;
  font-weight: 600;
}

.member-name span {
  font-size: 0.75rem;
  color: #6b7280;
}

/* chip rol pegado */
.member-name .role-chip {
  display: inline-flex;
  align-items: center;
  margin-top: 0.08rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
}

/* Menú ⋮ */
.member-menu {
  position: relative;
  flex-shrink: 0;
}

.member-menu-trigger {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: none;
  padding: 0;
}

.member-menu-trigger:hover {
  background: #eef2ff;
  border-color: #e0e7ff;
}

.member-menu-dropdown {
  position: absolute;
  top: auto;
  bottom: 115%;
  right: 0;
  background: #ffffff;
  border-radius: 0.65rem;
  border: 1px solid #e5e7eb;
  padding: 0.25rem;
  min-width: 170px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
  display: none;
  z-index: 20;
}

.member-menu-dropdown.show {
  display: block;
}

.member-menu-dropdown button {
  width: 100%;
  justify-content: flex-start;
  border-radius: 0.45rem;
  padding: 0.32rem 0.55rem;
  font-size: 0.78rem;
  background: transparent;
  border: none;
  box-shadow: none;
}

.member-menu-dropdown button:hover {
  background: #f3f4ff;
}

.member-menu-dropdown .menu-item-danger {
  color: #b91c1c;
}

.member-menu-dropdown .menu-item-danger:hover {
  background: #fef2f2;
}

.member-password-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.55rem;
  font-size: 0.78rem;
  color: #374151;
}

.member-password-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

/* Modal editar tarea */
#taskEditOverlay .modal {
  max-width: 520px;
}

/* =========================
   TOAST
========================= */

#toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 50;
  padding: 0.45rem 0.9rem;
  background: #111827;
  color: #e5e7eb;
  border-radius: 999px;
  font-size: 0.78rem;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.75);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

#toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.column-dropzone.drag-over {
  background: #eef2ff;
  border: 2px dashed #6366f1;
  box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.15);
  transition: background 0.15s ease, border 0.15s ease;
}

.task-card {
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.task-card:hover {
  transform: translateY(-2px);
}

/* =========================
   UX PRO: VENCIDAS + SKELETON
========================= */

/* Card vencida */
.task-card.overdue {
  border: 1px solid #fecaca;
  box-shadow: 0 14px 35px rgba(239, 68, 68, 0.12);
}

.overdue-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-weight: 600;
}

/* Badge estado (más visible) */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
  color: #374151;
  font-weight: 600;
}

.status-pendiente { background:#fff7ed; border-color:#fed7aa; color:#9a3412; }
.status-enprogreso { background:#eef2ff; border-color:#c7d2fe; color:#4338ca; }
.status-terminada { background:#ecfdf5; border-color:#bbf7d0; color:#166534; }

/* Skeleton loading cards */
.skeleton-card {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 0.55rem;
  border: 1px solid #e5e7eb;
  margin-bottom: 0.4rem;
  overflow: hidden;
  position: relative;
}

.skeleton-line {
  height: 10px;
  border-radius: 999px;
  background: #eef2f7;
  margin: 0.35rem 0;
}

.skeleton-line.w60 { width: 60%; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w40 { width: 40%; }

.skeleton-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(229,231,235,0.9), transparent);
  animation: skeletonShimmer 1.1s infinite;
}

@keyframes skeletonShimmer {
  0% { left: -60%; }
  100% { left: 120%; }
}

/* =========================
   COLUMN THEMES
========================= */
.column.theme-pendiente {
  background: #fff7ed;              /* naranja suave */
  border-color: #fed7aa;
}

.column.theme-enprogreso {
  background: #eef2ff;              /* azul suave */
  border-color: #c7d2fe;
}

.column.theme-terminada {
  background: #ecfdf5;              /* verde suave */
  border-color: #bbf7d0;
}

/* para que el dropzone quede integrado */
.column.theme-pendiente .column-dropzone,
.column.theme-enprogreso .column-dropzone,
.column.theme-terminada .column-dropzone {
  background: transparent;
}
/* =========================
   AVATAR (INICIALES)
========================= */
.avatar {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #111827;
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
}

.assignee-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* =========================
   PROGRESS BAR
========================= */
.progress-wrap {
  margin: 0.4rem 0 0.2rem;
}

.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  width: 0%;
  transition: width 0.25s ease;
}

/* =========================
   TEAM MODAL TYPO CLEANUP
========================= */
#teamModal .modal-title {
  font-size: 1.05rem;
  font-weight: 800;
}

#teamModal .small,
#teamModal small {
  font-size: 0.82rem;
  color: #6b7280;
}

#teamModal .member-name {
  font-size: 0.95rem;
  font-weight: 700;
}

#teamModal .member-username {
  font-size: 0.82rem;
  color: #6b7280;
}

#teamModal .pill,
#teamModal .tag,
#teamModal .badge {
  font-size: 0.78rem;
  padding: 0.12rem 0.5rem;
}

/* =========================
   TOGGLE: Todas | Mis tareas
========================= */
.view-toggle {
  display: inline-flex;
  gap: 0.35rem;
  background: #eef1ff;
  border: 1px solid #e0e7ff;
  padding: 0.2rem;
  border-radius: 999px;
}

.toggle-btn {
  border: none;
  border-radius: 999px;
  padding: 0.34rem 0.7rem;
  font-size: 0.8rem;
  background: transparent;
  color: #111827;
  cursor: pointer;
}

.toggle-btn.active {
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.10);
  border: 1px solid #e5e7eb;
}

/* =========================
   MODAL Equipo/Deptos - tipografía pareja
========================= */
#teamOverlay .modal h3 {
  font-size: 1rem;
}

#teamOverlay .modal p {
  font-size: 0.82rem;
}

#teamOverlay h4 {
  font-size: 0.88rem !important;
  font-weight: 600;
  margin: 0.2rem 0 0.35rem !important;
}

#teamOverlay label {
  font-size: 0.78rem;
}

#teamOverlay input,
#teamOverlay select,
#teamOverlay button {
  font-size: 0.84rem;
}

/* Lista miembros/deptos más “ClickUp-like” */
.member-name strong {
  font-size: 0.86rem;
}

.member-name span {
  font-size: 0.78rem;
}

.member-name .role-chip {
  font-size: 0.74rem;
}
/* =========================
   UI MEJORADA: Modal Equipo/Deptos
========================= */

#teamOverlay .modal {
  border-radius: 1.1rem;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.55);
  overflow: visible;
  max-width: 880px;
  max-height: 90vh;
  overflow: hidden;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

/* Header del modal (sin tocar HTML, apuntamos al primer .flex-between) */
#teamOverlay .modal > .flex-between {
  padding: 0.85rem 1.15rem;
  margin: 0 !important;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #ffffff, #fbfbff);
}

#teamOverlay .modal h3 {
  font-size: 1rem;
  letter-spacing: 0.01em;
}

#teamOverlay #memberSubtitle {
  padding: 0.55rem 1.15rem 0;
}

/* Grid con “sub-cards” */
#teamOverlay .modal-grid {
  padding: 0.7rem 1rem 0.9rem;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem 1.1rem;
  gap: 0.9rem;
  flex: 1 1 auto;
  min-height: 0;
}

#teamOverlay .modal-grid > div {
  background: #fbfcff;
  border: 1px solid var(--border-soft);
  border-radius: 0.95rem;
  padding: 0.85rem 0.85rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 0;
}

/* Títulos de secciones (Integrantes / Departamentos) */
#teamOverlay .modal-grid h4 {
  margin: 0 0 0.45rem 0 !important;
  font-size: 0.88rem !important;
  font-weight: 650;
  color: #111827;
}

/* Lista con scroll para que no se “deforme” el modal */
#teamOverlay ul.member-list {
  margin-top: 0.25rem;
  max-height: none;
  overflow: visible;
  padding-right: 0;
  padding-bottom: 0.25rem;
  margin-top: 0.35rem;
  max-height: 45vh;
  overflow: auto;
  padding-right: 0.35rem;
  padding-bottom: 0.4rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.35rem;
}

/* Scrollbar suave (Chrome/Edge) */
#teamOverlay ul.member-list::-webkit-scrollbar {
  width: 10px;
}
#teamOverlay ul.member-list::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
#teamOverlay ul.member-list::-webkit-scrollbar-thumb:hover {
  background: #d1d5db;
  border: 3px solid transparent;
  background-clip: content-box;
}

/* Ítems de lista más “app-like” */
#teamOverlay ul.member-list li {
  border-radius: 0.8rem;
  background: #ffffff;
  border: 1px solid #eef2ff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  padding: 0.35rem 0.55rem;
}

#teamOverlay ul.member-list li:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.10);
  background: #ffffff;
  border-color: #dbe4ff;
}

/* Tipografía de departamentos para que iguale al listado de integrantes */
#teamOverlay #departmentList .member-row-main span {
  font-size: 0.86rem;
  font-weight: 600;
  color: #111827;
}

/* Nombre más destacado */
#teamOverlay .member-name strong {
  font-size: 0.86rem;
}

/* Fila input + botón “+” más prolija */
#teamOverlay #departmentName {
  margin-bottom: 0;
}

#teamOverlay #addDepartmentBtn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  font-weight: 800;
}

#teamOverlay #addDepartmentBtn:hover {
  background: #e0e7ff;
}

/* Botón cerrar mejor */
#teamOverlay #teamCloseBtn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #eef2ff;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.10);
}

#teamOverlay #teamCloseBtn:hover {
  background: #f3f4ff;
}

/* Admin controls: separador visual */
#teamOverlay #memberAdminControls {
  margin: 0 0 0.45rem !important;
  padding-bottom: 0.65rem;
  border-bottom: 1px dashed #e5e7eb;
}
#memberSubtitle {
  font-size: 0.78rem;
  color: #6b7280;
}
/* =========================
   Menú usuario (arriba derecha)
========================= */
.user-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.user-menu-btn .chev {
  margin-left: .35rem;
  opacity: .65;
  font-size: .9em;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + .45rem);
  right: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: .9rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  padding: .35rem;
  z-index: 50;
}

.user-menu-dropdown.hidden {
  display: none;
}

.menu-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: .55rem .65rem;
  border-radius: .7rem;
  cursor: pointer;
  font-weight: 600;
}

.menu-item:hover {
  background: #f3f4ff;
}

.menu-item-danger:hover {
  background: #fee2e2;
}

/* =========================
   DASHBOARD + AUDITORÍA
========================= */

.dashboard-main,
.audit-main {
  grid-template-columns: 1fr;
  grid-template-columns: 1fr !important;
  max-width: 1200px;
}

.dashboard-main {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  grid-template-columns: 1.6fr 1fr !important;
  gap: 1rem;
  align-items: start;
  max-width: 1400px;
}

@media (max-width: 1100px) {
  .dashboard-main {
    grid-template-columns: 1fr;
    grid-template-columns: 1fr !important;
  }
}

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 0.75rem;
}

@media (max-width: 1200px) {
  .dashboard-kpis {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}

.dashboard-kpi {
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid var(--border-soft);
  background: #fff;
}

.dashboard-kpi .lbl {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.dashboard-kpi .val {
  font-size: 1.7rem;
  font-weight: 900;
  margin-top: 0.25rem;
}

.dashboard-kpi .sub {
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.dashboard-kpi .val.accent {
  color: var(--accent-strong);
}

.dashboard-kpi .val.danger {
  color: #c0392b;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.6rem 0.55rem;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  font-size: 0.92rem;
  vertical-align: top;
}

.data-table th {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.row-title {
  font-weight: 800;
}

.row-sub {
  margin-top: 0.15rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

.sticky {
  position: sticky;
  top: 1rem;
}

@media (max-width: 1100px) {
  .sticky {
    position: static;
  }
}

.pill-note {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.pill-note .dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--accent);
  display: inline-block;
}

.empty-good {
  padding: 0.85rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.hdr-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hdr-actions .secondary {
  border-radius: 999px;
  padding: 0.5rem 0.75rem;
}

.audit-row {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.8rem;
  background: #fff;
  margin-top: 0.55rem;
}

.audit-row-top {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.audit-row-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.audit-sev-ok {
  background: #dcfce7;
  color: #166534;
}

.audit-sev-info {
  background: #e0f2fe;
  color: #1d4ed8;
}

.audit-sev-danger {
  background: #fee2e2;
  color: #991b1b;
}

.audit-sev-badge {
  border-radius: 999px;
  padding: 0.14rem 0.55rem;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.audit-actor-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f8fafc;
  border: 1px solid var(--border-soft);
  border-radius: 0.6rem;
  padding: 0.35rem 0.5rem;
}

.audit-meta-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.audit-details-box {
  margin-top: 0.5rem;
}

.audit-details-meta {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.2rem 0.6rem;
  font-size: 0.8rem;
}

.audit-pre {
  background: #0b1020;
  color: #e5e7eb;
  padding: 0.6rem;
  border-radius: 0.6rem;
  overflow: auto;
  font-size: 0.75rem;
}
/* =========================
   Estados vacíos del tablero
========================= */
.empty-state{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:.45rem;
  padding:1.1rem .6rem;
  color:#6b7280;
  font-size:.85rem;
  text-align:center;
}

.empty-state .empty-title{
  font-weight:700;
  color:#374151;
}

.empty-state .empty-actions button{
  margin-top:.3rem;
  padding:.35rem .6rem;
  font-size:.8rem;
}


/* =========================
   LINKS AS BUTTONS (Nav)
   ========================= */
a.primary, a.secondary, a.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-main);
  background: rgba(255,255,255,0.8);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease, opacity 0.1s;
  white-space: nowrap;
  font-weight: 500;
}

a.secondary:hover, a.ghost:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(15, 23, 42, 0.10); }

a.primary {
  background: linear-gradient(135deg, #8b5cf6, #2563eb);
  border-color: transparent;
  color: #f9fafb;
  box-shadow: 0 12px 24px rgba(88, 28, 135, 0.30);
}

a.primary:hover { transform: translateY(-1px); box-shadow: 0 16px 30px rgba(79, 70, 229, 0.40); }

a.ghost {
  background: transparent;
  box-shadow: none;
}
