/* ============================================================================
   Plus de Tareas y Calendario — estilo Apple (ver plan: clientes-360.css/empresa.css)
   Incluye: badges de categoría, selector+gestor de categorías, Kanban de tareas,
   campos nuevos del formulario de tarea/evento, subtareas/checklist y widget "Mi día".
   ============================================================================ */

/* --- Badges de categoría (icono + color, fondo sólido, como .entity-tag-badge) --- */
.categoria-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: var(--tag-color, #6b7280);
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.categoria-badge-compact {
    padding: 1px 7px;
    font-size: 11px;
}

.categoria-badge-icon {
    font-size: 12px;
    line-height: 1;
}

.categoria-badge-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Selector de categoría + botón "Gestionar" --- */
.categoria-picker-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.categoria-picker-row .categoria-picker-select {
    flex: 1;
    min-width: 0;
}

.categoria-picker-manage {
    flex-shrink: 0;
    padding: 6px 10px !important;
}

/* --- Modal ligero de gestión de categorías --- */
.categoria-gestion-modal {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 22px;
}

.categoria-gestion-lista {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 260px;
    overflow-y: auto;
}

.categoria-gestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 10px;
    transition: background-color 0.15s ease;
}

.categoria-gestion-item:hover {
    background-color: #f5f5f7;
}

.categoria-gestion-swatch {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.categoria-gestion-icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.categoria-gestion-nombre {
    flex: 1;
    font-size: 13.5px;
    font-weight: 500;
    color: #1d1d1f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.categoria-gestion-del {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #86868b;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: inline-flex;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.categoria-gestion-del:hover {
    color: #dc2626;
    background-color: rgba(220, 38, 38, 0.08);
}

.categoria-gestion-empty {
    padding: 16px 4px;
    text-align: center;
    color: #86868b;
    font-size: 13px;
}

.categoria-gestion-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
}

.categoria-gestion-icono-input {
    width: 48px;
    flex-shrink: 0;
    text-align: center;
    padding: 8px 4px !important;
}

.categoria-gestion-color-input {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 2px;
    cursor: pointer;
    background: #fff;
}

.categoria-gestion-form .form-input {
    flex: 1;
}

/* --- Toggle de vista Lista/Kanban en la toolbar de tareas --- */
.tareas-view-toggle {
    margin-left: auto;
}

/* --- Kanban global de tareas (patrón .c360-kanban / .c360-col, más pulido que proyectos.css) --- */
.tareas-kanban-pane {
    overflow-x: auto;
}

.tareas-kanban {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: 420px;
    align-items: flex-start;
}

.tareas-kanban-col {
    min-width: 260px;
    max-width: 300px;
    flex-shrink: 0;
    background: #f3f4f6;
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tareas-kanban-col-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    padding: 0 2px;
}

.tareas-kanban-col-head span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tareas-kanban-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.tareas-kanban-col-count {
    background: #fff;
    border-radius: 980px;
    padding: 2px 8px;
    font-size: 11px;
    color: #6b7280;
}

.tareas-kanban-col-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
}

.tareas-kanban-card {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.tareas-kanban-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.08);
}

.tareas-kanban-card:active {
    cursor: grabbing;
}

.tareas-kanban-card.is-active {
    border-color: #111;
    box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.08);
}

.tareas-kanban-card-top {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tareas-kanban-card-title {
    font-weight: 550;
    font-size: 13.5px;
    color: #111;
    line-height: 1.3;
}

.tareas-kanban-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11.5px;
    color: #6b7280;
}

.tareas-kanban-sub {
    font-weight: 500;
}

/* --- Enlaces dentro del detalle de tarea (cliente/proveedor, documento vinculado) --- */
.tareas-detail-meta a {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 500;
}

.tareas-detail-meta a:hover {
    text-decoration: underline;
}

.tareas-btn-danger {
    color: #dc2626 !important;
}

/* --- Badge de documento vinculado (solo lectura) dentro de formularios de tarea/evento --- */
.tareas-doc-link-badge label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.tareas-doc-link-badge a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(29, 78, 216, 0.08);
    color: #1d4ed8;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 550;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.tareas-doc-link-badge a:hover {
    background: rgba(29, 78, 216, 0.14);
}

.tareas-btn-danger:hover {
    background-color: rgba(220, 38, 38, 0.08) !important;
}

/* --- Subtareas / checklist dentro del detalle de tarea --- */
.tareas-subtareas-progress {
    font-weight: 500;
    color: #9ca3af;
    text-transform: none;
    letter-spacing: normal;
    margin-left: 4px;
}

.tareas-subtareas-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 10px;
}

.tarea-subtarea-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 4px;
    border-radius: 8px;
    transition: background-color 0.15s ease;
}

.tarea-subtarea-item:hover {
    background-color: #f9fafb;
}

.tarea-subtarea-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: #111;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.tarea-subtarea-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #111;
    flex-shrink: 0;
    cursor: pointer;
}

.tarea-subtarea-item.is-done .tarea-subtarea-check span {
    color: #9ca3af;
    text-decoration: line-through;
}

.tarea-subtarea-del {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #86868b;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: inline-flex;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.tarea-subtarea-del:hover {
    color: #dc2626;
    background-color: rgba(220, 38, 38, 0.08);
}

.tareas-subtarea-form {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

.tareas-subtarea-form .form-input {
    flex: 1;
    min-width: 0;
}

@media (max-width: 900px) {
    .tareas-kanban-pane {
        margin-top: 8px;
    }
}

/* --- Aviso de serie recurrente en el modal de editar evento (calendario.js) --- */
.cal-serie-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    background: rgba(59, 130, 246, 0.08);
    color: #1d4ed8;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
}

/* ============================================================================
   AgendaFormWizard — modal multipaso para crear/editar tarea y evento
   Mismo lenguaje visual que .personal-modal (overlay blur, radius 16px,
   sombra 0 20px 60px), con cabecera de progreso (dots) y pie Atrás/Siguiente.
   ============================================================================ */
.agenda-wizard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: agendaWizardFadeIn 0.2s ease;
    padding: 16px;
}

@keyframes agendaWizardFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.agenda-wizard-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: agendaWizardSlideUp 0.25s ease;
}

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

.agenda-wizard-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    flex-shrink: 0;
}

.agenda-wizard-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.agenda-wizard-header-top h2 {
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: #1d1d1f;
    margin: 0;
}

.agenda-wizard-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #f5f5f7;
    color: #6b7280;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
}

.agenda-wizard-close:hover {
    background: #e5e7eb;
}

.agenda-wizard-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
}

.agenda-wizard-dot {
    flex: 1;
    height: 4px;
    border-radius: 999px;
    background: #e5e7eb;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.agenda-wizard-dot.active {
    background: #1d1d1f;
}

.agenda-wizard-dot.done {
    background: #9ca3af;
}

.agenda-wizard-body {
    padding: 22px 24px;
    overflow-y: auto;
    flex: 1;
}

.agenda-wizard-step {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: agendaWizardFadeIn 0.2s ease;
}

.agenda-wizard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    flex-shrink: 0;
}

.agenda-wizard-footer-left,
.agenda-wizard-footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Switches de vínculo (cliente/proveedor/proyecto) del paso "Vincular" --- */
.agenda-wizard-link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
}

.agenda-wizard-link-row-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #1d1d1f;
}

.agenda-wizard-link-row-icon {
    font-size: 15px;
    line-height: 1;
}

.agenda-wizard-link-picker {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: none;
}

.agenda-wizard-link-picker.show {
    display: block;
}

.agenda-wizard-link-group + .agenda-wizard-link-group {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* --- Filas de dos columnas dentro de un paso --- */
.agenda-wizard-row {
    display: flex;
    gap: 14px;
}

.agenda-wizard-row > * {
    flex: 1;
    min-width: 0;
}

@media (max-width: 560px) {
    .agenda-wizard-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .agenda-wizard-modal {
        max-width: 100% !important;
        border-radius: 16px 16px 0 0;
        max-height: 92vh;
        animation: agendaWizardSlideUpMobile 0.25s ease;
    }

    @keyframes agendaWizardSlideUpMobile {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .agenda-wizard-row {
        flex-direction: column;
    }
}
