/* =========================================================================
   1. VARIABLES DE DISEÑO Y TEMAS
   ========================================================================= */
:root {
  --color-primary: #FD1843;
  --color-primary-hover: #D90F35;
  --color-primary-light: rgba(253, 24, 67, 0.1);
  
  --bg-main: #EEF2F6;
  --bg-surface: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border-color: #CBD5E1;
  
  --color-warning: #F59E0B;
  --color-danger: #EF4444;
  --color-success: #10B981;

  --sidebar-width-expanded: 260px;
  --sidebar-width-collapsed: 72px;
  --navbar-height: 64px;

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

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-main: #0B1120;
  --bg-surface: #1E293B;
  --bg-sidebar: #1E293B;
  
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --border-color: #334155;
}

/* =========================================================================
   2. RESET GENERAL Y SCROLL
   ========================================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

.scrollable-area {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  pointer-events: auto !important;
  scroll-behavior: smooth;
}

/* =========================================================================
   3. FORMULARIOS, INPUTS Y BUSCADOR CON BOTÓN "X"
   ========================================================================= */
select,
input[type="text"],
input[type="date"],
input[type="number"],
textarea,
input[type="file"],
input[type="password"] {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

select {
  appearance: none;
  -webkit-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='%2364748B'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
  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='%2364748B'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 1.25rem !important;
  width: 1.25rem;
  height: 1.25rem;
}

[data-theme="dark"] select,
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  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='%2394A3B8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important;
  filter: none !important;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

/* BUSCADOR CON BOTÓN "X" */
.search-box {
  position: relative;
  flex-grow: 1;
  min-width: 200px;
}

.clear-search-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  padding: 4px;
}

.clear-search-btn:hover {
  color: var(--color-primary);
}

.input-locked {
  background-color: var(--bg-main) !important;
  opacity: 0.75;
  cursor: not-allowed;
}

.input-calc-highlight {
  background-color: var(--bg-main) !important;
  font-weight: 600;
  color: var(--color-primary) !important;
}

/* =========================================================================
   4. CLASES DE UTILIDAD E ÍCONOS
   ========================================================================= */
.hidden {
  display: none !important;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

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

.brand-icon-svg {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  fill: var(--color-primary);
}

.icon-svg {
  width: 1.4rem;
  height: 1.4rem;
  flex-shrink: 0;
  fill: currentColor;
}

.kpi-icon-svg {
  width: 2rem;
  height: 2rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  box-sizing: content-box;
}

.kpi-icon-svg.primary {
  background-color: var(--color-primary-light);
  fill: var(--color-primary);
}

.kpi-icon-svg.warning {
  background-color: rgba(245, 158, 11, 0.1);
  fill: var(--color-warning);
}

.kpi-icon-svg.danger {
  background-color: rgba(239, 68, 68, 0.1);
  fill: var(--color-danger);
}

@keyframes blink-animation {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    opacity: 1;
  }
}

.blink {
  animation: blink-animation 1.2s infinite ease-in-out;
}

.status-vencida {
  background-color: rgba(239, 68, 68, 0.15) !important;
  color: var(--color-danger) !important;
  border: 1px solid var(--color-danger);
}

/* =========================================================================
   5. LOGIN Y DASHBOARD
   ========================================================================= */
.screen-container {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.brand-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.brand-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 2rem;
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.btn-google:hover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
}

.google-logo {
  width: 20px;
  height: 20px;
}

.error-message {
  margin-top: 1rem;
  padding: 0.75rem;
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  text-align: center;
}

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

.kpi-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.kpi-card-clickable {
  cursor: pointer;
  transition: var(--transition);
}

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

.kpi-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
}

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

/* =========================================================================
   6. SIDEBAR, NAVBAR Y FOOTER VERSION
   ========================================================================= */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

#app-screen {
  display: flex;
  width: 100vw;
  min-height: 100vh;
  position: relative;
}

.sidebar {
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  white-space: nowrap;
  flex-shrink: 0;
  height: 100vh;
  overflow: hidden;
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--color-primary);
}

.brand-name {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-main);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 0.75rem;
  flex-grow: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
}

.nav-item:hover {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

.nav-item.active {
  background-color: var(--color-primary);
  color: #FFFFFF;
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.btn-logout {
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
}

.sidebar-version {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.7;
  padding: 0.5rem 0.85rem 0.25rem 0.85rem;
  font-family: monospace;
  text-align: center;
}

@media (min-width: 769px) {
  .sidebar {
    width: var(--sidebar-width-collapsed);
    position: relative;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar:not(.pinned):hover {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width-expanded);
    box-shadow: var(--shadow-lg);
    z-index: 200;
  }

  .sidebar.pinned {
    width: var(--sidebar-width-expanded);
  }

  .sidebar:not(.pinned):not(:hover) .brand-name,
  .sidebar:not(.pinned):not(:hover) .link-text,
  .sidebar:not(.pinned):not(:hover) .sidebar-version {
    opacity: 0;
    visibility: hidden;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: calc(-1 * var(--sidebar-width-expanded));
    width: var(--sidebar-width-expanded);
    z-index: 1000;
    transition: left 0.3s ease;
  }

  .sidebar.mobile-open {
    left: 0;
  }
}

.main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-navbar {
  height: var(--navbar-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-primary);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.content-area {
  padding: 1.5rem;
  flex-grow: 1;
  height: calc(100vh - var(--navbar-height));
}

/* =========================================================================
   7. MODO LISTADO / CAJAS Y ADAPTACIÓN MÓVIL
   ========================================================================= */
.view-toggle-group {
  display: flex;
  gap: 0.25rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
}

.toggle-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.toggle-icon-btn.active {
  background-color: var(--color-primary) !important;
  color: #FFFFFF !important;
  box-shadow: var(--shadow-sm);
}

.toggle-icon-btn.active .icon-svg {
  fill: #FFFFFF !important;
}

/* VISTA LISTA DE PROYECTOS EN ESCRITORIO */
.projects-grid.list-view {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.85rem !important;
}

.projects-grid.list-view .project-card {
  display: grid !important;
  grid-template-columns: 1fr 220px 180px !important;
  align-items: center !important;
  gap: 1.25rem !important;
  padding: 1rem 1.25rem !important;
}

/* EN MÓVILES: OCULTAR TOGGLE Y MANTENER SOLO VISTA CAJAS */
@media (max-width: 768px) {
  .view-toggle-group {
    display: none !important;
  }
  
  .projects-grid,
  .projects-grid.list-view {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .projects-grid.list-view .project-card {
    display: flex !important;
    flex-direction: column !important;
  }
}

/* =========================================================================
   8. SEGUIMIENTO Y TARJETAS DE TAREAS
   ========================================================================= */
.agenda-header {
  margin-bottom: 1.25rem;
}

.agenda-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.agenda-date-range {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.agenda-date-range input[type="date"] {
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  width: auto;
}

.btn-add-task {
  background-color: var(--color-primary);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-add-task:hover {
  background-color: var(--color-primary-hover);
}

.btn-danger {
  background-color: var(--color-danger) !important;
}

.btn-danger:hover {
  background-color: #DC2626 !important;
}

.task-filters {
  display: flex;
  gap: 0.5rem;
}

.filter-btn {
  background: none;
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.filter-btn.active {
  background-color: var(--color-primary);
  color: #FFFFFF;
  border-color: var(--color-primary);
}

.tasks-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: calc(100vh - 250px);
}

.task-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--transition);
}

.task-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.task-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: #FFFFFF;
  font-weight: bold;
}

.task-checkbox.checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.task-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

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

.task-title.completed {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-desc-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.task-project-tag {
  color: var(--color-primary);
  font-weight: 500;
  font-size: 0.85rem;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.task-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: capitalize;
}

.duration-badge {
  background-color: var(--bg-main);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  font-weight: 700;
}

.priority-alta {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
}

.priority-media {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
}

.priority-baja {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.action-icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.action-icon-btn:hover {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

.action-icon-btn.whatsapp:hover {
  background-color: rgba(16, 185, 129, 0.1);
  color: #25D366;
}

.action-icon-btn.delete:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
}

/* =========================================================================
   9. PROYECTOS, TARJETAS Y CONTENEDORES
   ========================================================================= */
.projects-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.projects-filters {
  display: flex;
  gap: 0.5rem;
}

.projects-grid-wrapper {
  max-height: calc(100vh - 230px);
  padding-right: 4px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.project-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.project-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

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

.project-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.badges-container {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.status-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-weight: 600;
}

.status-en_curso {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

.status-completado {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.status-pausado {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
}

.status-nuevo {
  background-color: rgba(253, 24, 67, 0.15);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.project-category {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.project-progress-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--color-primary);
  border-radius: 4px;
}

.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* =========================================================================
   10. MODALES, CAPAS Z-INDEX Y ALINEACIÓN DE ADJUNTOS
   ========================================================================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

#project-detail-modal {
  z-index: 2000 !important;
}

#agenda-task-modal {
  z-index: 2500 !important;
}

#confirm-delete-modal,
#custom-alert-modal {
  z-index: 3000 !important;
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.modal-card-alert {
  max-width: 420px;
}

.alert-modal-text {
  margin: 1rem 0 1.25rem 0;
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.4;
}

.modal-card-large {
  width: 90vw;
  max-width: 860px;
  height: 85vh;
  max-height: 700px;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.detail-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
  flex-shrink: 0;
}

.detail-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.detail-tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.detail-tab-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-right: 4px;
}

.tab-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  width: 100%;
}

.form-row.trio-row {
  grid-template-columns: 1fr 100px 1fr;
}

.form-row.quad-row {
  grid-template-columns: 1fr 1fr 100px 1fr;
}

/* ALINEACIÓN PERFECTA DEL BOTÓN AÑADIR TAREA CON CAJA DE ADJUNTO */
.attachment-action-row {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  width: 100%;
}

.attachment-input-group {
  flex-grow: 1;
}

.btn-align-bottom {
  display: flex;
  align-items: flex-end;
}

.attachment-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  background-color: var(--bg-main);
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
}

.btn-remove-attachment {
  background: none;
  border: none;
  color: var(--color-danger);
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.btn-remove-attachment:hover {
  background-color: rgba(239, 68, 68, 0.1);
}

.baseline-box {
  background-color: var(--bg-main);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.baseline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.btn-link-action {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.calc-progress-badge {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  font-weight: 700;
  color: var(--color-primary);
  font-size: 0.95rem;
}

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

/* =========================================================================
   11. CALENDARIO Y VISTA DE REPORTES
   ========================================================================= */
.reports-projects-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.report-project-item {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.report-project-item:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.report-project-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.95rem;
}

.calendar-wrapper {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.calendar-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 1.5rem;
}

.cal-day-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  position: relative;
  background-color: var(--bg-main);
}

.cal-day-cell.selected {
  background-color: var(--color-primary);
  color: #FFFFFF;
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--color-primary);
  position: absolute;
  bottom: 4px;
}

.reports-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.report-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.report-card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
}

.report-section {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}